diff --git a/compassql.js b/compassql.js new file mode 100644 index 00000000..45eac1a4 --- /dev/null +++ b/compassql.js @@ -0,0 +1,8868 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.cql = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0)) return range; // also handles Invalid Date + offseti(start, 1), floori(start); + if (start < stop) range.push(new Date(+start)); + while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start)); + return range; + }; + + interval.filter = function(test) { + return newInterval(function(date) { + while (floori(date), !test(date)) date.setTime(date - 1); + }, function(date, step) { + while (--step >= 0) while (offseti(date, 1), !test(date)); + }); + }; + + if (count) { + interval.count = function(start, end) { + t0.setTime(+start), t1.setTime(+end); + floori(t0), floori(t1); + return Math.floor(count(t0, t1)); + }; + + interval.every = function(step) { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null + : !(step > 1) ? interval + : interval.filter(field + ? function(d) { return field(d) % step === 0; } + : function(d) { return interval.count(0, d) % step === 0; }); + }; + } + + return interval; + }; + + var millisecond = newInterval(function() { + // noop + }, function(date, step) { + date.setTime(+date + step); + }, function(start, end) { + return end - start; + }); + + // An optimized implementation for this simple case. + millisecond.every = function(k) { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return newInterval(function(date) { + date.setTime(Math.floor(date / k) * k); + }, function(date, step) { + date.setTime(+date + step * k); + }, function(start, end) { + return (end - start) / k; + }); + }; + + var second = newInterval(function(date) { + date.setMilliseconds(0); + }, function(date, step) { + date.setTime(+date + step * 1e3); + }, function(start, end) { + return (end - start) / 1e3; + }, function(date) { + return date.getSeconds(); + }); + + var minute = newInterval(function(date) { + date.setSeconds(0, 0); + }, function(date, step) { + date.setTime(+date + step * 6e4); + }, function(start, end) { + return (end - start) / 6e4; + }, function(date) { + return date.getMinutes(); + }); + + var hour = newInterval(function(date) { + date.setMinutes(0, 0, 0); + }, function(date, step) { + date.setTime(+date + step * 36e5); + }, function(start, end) { + return (end - start) / 36e5; + }, function(date) { + return date.getHours(); + }); + + var day = newInterval(function(date) { + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setDate(date.getDate() + step); + }, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5; + }, function(date) { + return date.getDate() - 1; + }); + + function weekday(i) { + return newInterval(function(date) { + date.setHours(0, 0, 0, 0); + date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); + }, function(date, step) { + date.setDate(date.getDate() + step * 7); + }, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5; + }); + } + + var sunday = weekday(0); + var monday = weekday(1); + var tuesday = weekday(2); + var wednesday = weekday(3); + var thursday = weekday(4); + var friday = weekday(5); + var saturday = weekday(6); + + var month = newInterval(function(date) { + date.setHours(0, 0, 0, 0); + date.setDate(1); + }, function(date, step) { + date.setMonth(date.getMonth() + step); + }, function(start, end) { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; + }, function(date) { + return date.getMonth(); + }); + + var year = newInterval(function(date) { + date.setHours(0, 0, 0, 0); + date.setMonth(0, 1); + }, function(date, step) { + date.setFullYear(date.getFullYear() + step); + }, function(start, end) { + return end.getFullYear() - start.getFullYear(); + }, function(date) { + return date.getFullYear(); + }); + + var utcSecond = newInterval(function(date) { + date.setUTCMilliseconds(0); + }, function(date, step) { + date.setTime(+date + step * 1e3); + }, function(start, end) { + return (end - start) / 1e3; + }, function(date) { + return date.getUTCSeconds(); + }); + + var utcMinute = newInterval(function(date) { + date.setUTCSeconds(0, 0); + }, function(date, step) { + date.setTime(+date + step * 6e4); + }, function(start, end) { + return (end - start) / 6e4; + }, function(date) { + return date.getUTCMinutes(); + }); + + var utcHour = newInterval(function(date) { + date.setUTCMinutes(0, 0, 0); + }, function(date, step) { + date.setTime(+date + step * 36e5); + }, function(start, end) { + return (end - start) / 36e5; + }, function(date) { + return date.getUTCHours(); + }); + + var utcDay = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCDate(date.getUTCDate() + step); + }, function(start, end) { + return (end - start) / 864e5; + }, function(date) { + return date.getUTCDate() - 1; + }); + + function utcWeekday(i) { + return newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); + date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); + }, function(date, step) { + date.setUTCDate(date.getUTCDate() + step * 7); + }, function(start, end) { + return (end - start) / 6048e5; + }); + } + + var utcSunday = utcWeekday(0); + var utcMonday = utcWeekday(1); + var utcTuesday = utcWeekday(2); + var utcWednesday = utcWeekday(3); + var utcThursday = utcWeekday(4); + var utcFriday = utcWeekday(5); + var utcSaturday = utcWeekday(6); + + var utcMonth = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); + date.setUTCDate(1); + }, function(date, step) { + date.setUTCMonth(date.getUTCMonth() + step); + }, function(start, end) { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; + }, function(date) { + return date.getUTCMonth(); + }); + + var utcYear = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); + date.setUTCMonth(0, 1); + }, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step); + }, function(start, end) { + return end.getUTCFullYear() - start.getUTCFullYear(); + }, function(date) { + return date.getUTCFullYear(); + }); + + var milliseconds = millisecond.range; + var seconds = second.range; + var minutes = minute.range; + var hours = hour.range; + var days = day.range; + var sundays = sunday.range; + var mondays = monday.range; + var tuesdays = tuesday.range; + var wednesdays = wednesday.range; + var thursdays = thursday.range; + var fridays = friday.range; + var saturdays = saturday.range; + var weeks = sunday.range; + var months = month.range; + var years = year.range; + + var utcMillisecond = millisecond; + var utcMilliseconds = milliseconds; + var utcSeconds = utcSecond.range; + var utcMinutes = utcMinute.range; + var utcHours = utcHour.range; + var utcDays = utcDay.range; + var utcSundays = utcSunday.range; + var utcMondays = utcMonday.range; + var utcTuesdays = utcTuesday.range; + var utcWednesdays = utcWednesday.range; + var utcThursdays = utcThursday.range; + var utcFridays = utcFriday.range; + var utcSaturdays = utcSaturday.range; + var utcWeeks = utcSunday.range; + var utcMonths = utcMonth.range; + var utcYears = utcYear.range; + + var version = "0.1.1"; + + exports.version = version; + exports.milliseconds = milliseconds; + exports.seconds = seconds; + exports.minutes = minutes; + exports.hours = hours; + exports.days = days; + exports.sundays = sundays; + exports.mondays = mondays; + exports.tuesdays = tuesdays; + exports.wednesdays = wednesdays; + exports.thursdays = thursdays; + exports.fridays = fridays; + exports.saturdays = saturdays; + exports.weeks = weeks; + exports.months = months; + exports.years = years; + exports.utcMillisecond = utcMillisecond; + exports.utcMilliseconds = utcMilliseconds; + exports.utcSeconds = utcSeconds; + exports.utcMinutes = utcMinutes; + exports.utcHours = utcHours; + exports.utcDays = utcDays; + exports.utcSundays = utcSundays; + exports.utcMondays = utcMondays; + exports.utcTuesdays = utcTuesdays; + exports.utcWednesdays = utcWednesdays; + exports.utcThursdays = utcThursdays; + exports.utcFridays = utcFridays; + exports.utcSaturdays = utcSaturdays; + exports.utcWeeks = utcWeeks; + exports.utcMonths = utcMonths; + exports.utcYears = utcYears; + exports.millisecond = millisecond; + exports.second = second; + exports.minute = minute; + exports.hour = hour; + exports.day = day; + exports.sunday = sunday; + exports.monday = monday; + exports.tuesday = tuesday; + exports.wednesday = wednesday; + exports.thursday = thursday; + exports.friday = friday; + exports.saturday = saturday; + exports.week = sunday; + exports.month = month; + exports.year = year; + exports.utcSecond = utcSecond; + exports.utcMinute = utcMinute; + exports.utcHour = utcHour; + exports.utcDay = utcDay; + exports.utcSunday = utcSunday; + exports.utcMonday = utcMonday; + exports.utcTuesday = utcTuesday; + exports.utcWednesday = utcWednesday; + exports.utcThursday = utcThursday; + exports.utcFriday = utcFriday; + exports.utcSaturday = utcSaturday; + exports.utcWeek = utcSunday; + exports.utcMonth = utcMonth; + exports.utcYear = utcYear; + exports.interval = newInterval; + +})); +},{}],3:[function(require,module,exports){ +var util = require('../util'), + time = require('../time'), + EPSILON = 1e-15; + +function bins(opt) { + if (!opt) { throw Error("Missing binning options."); } + + // determine range + var maxb = opt.maxbins || 15, + base = opt.base || 10, + logb = Math.log(base), + div = opt.div || [5, 2], + min = opt.min, + max = opt.max, + span = max - min, + step, level, minstep, precision, v, i, eps; + + if (opt.step) { + // if step size is explicitly given, use that + step = opt.step; + } else if (opt.steps) { + // if provided, limit choice to acceptable step sizes + step = opt.steps[Math.min( + opt.steps.length - 1, + bisect(opt.steps, span/maxb, 0, opt.steps.length) + )]; + } else { + // else use span to determine step size + level = Math.ceil(Math.log(maxb) / logb); + minstep = opt.minstep || 0; + step = Math.max( + minstep, + Math.pow(base, Math.round(Math.log(span) / logb) - level) + ); + + // increase step size if too many bins + while (Math.ceil(span/step) > maxb) { step *= base; } + + // decrease step size if allowed + for (i=0; i= minstep && span / v <= maxb) step = v; + } + } + + // update precision, min and max + v = Math.log(step); + precision = v >= 0 ? 0 : ~~(-v / logb) + 1; + eps = Math.pow(base, -precision - 1); + min = Math.min(min, Math.floor(min / step + eps) * step); + max = Math.ceil(max / step) * step; + + return { + start: min, + stop: max, + step: step, + unit: {precision: precision}, + value: value, + index: index + }; +} + +function bisect(a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >>> 1; + if (util.cmp(a[mid], x) < 0) { lo = mid + 1; } + else { hi = mid; } + } + return lo; +} + +function value(v) { + return this.step * Math.floor(v / this.step + EPSILON); +} + +function index(v) { + return Math.floor((v - this.start) / this.step + EPSILON); +} + +function date_value(v) { + return this.unit.date(value.call(this, v)); +} + +function date_index(v) { + return index.call(this, this.unit.unit(v)); +} + +bins.date = function(opt) { + if (!opt) { throw Error("Missing date binning options."); } + + // find time step, then bin + var units = opt.utc ? time.utc : time, + dmin = opt.min, + dmax = opt.max, + maxb = opt.maxbins || 20, + minb = opt.minbins || 4, + span = (+dmax) - (+dmin), + unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb), + spec = bins({ + min: unit.min != null ? unit.min : unit.unit(dmin), + max: unit.max != null ? unit.max : unit.unit(dmax), + maxbins: maxb, + minstep: unit.minstep, + steps: unit.step + }); + + spec.unit = unit; + spec.index = date_index; + if (!opt.raw) spec.value = date_value; + return spec; +}; + +module.exports = bins; + +},{"../time":7,"../util":8}],4:[function(require,module,exports){ +var util = require('./util'), + gen = module.exports; + +gen.repeat = function(val, n) { + var a = Array(n), i; + for (i=0; i stop) range.push(j); + else while ((j = start + step * ++i) < stop) range.push(j); + return range; +}; + +gen.random = {}; + +gen.random.uniform = function(min, max) { + if (max === undefined) { + max = min === undefined ? 1 : min; + min = 0; + } + var d = max - min; + var f = function() { + return min + d * Math.random(); + }; + f.samples = function(n) { + return gen.zeros(n).map(f); + }; + f.pdf = function(x) { + return (x >= min && x <= max) ? 1/d : 0; + }; + f.cdf = function(x) { + return x < min ? 0 : x > max ? 1 : (x - min) / d; + }; + f.icdf = function(p) { + return (p >= 0 && p <= 1) ? min + p*d : NaN; + }; + return f; +}; + +gen.random.integer = function(a, b) { + if (b === undefined) { + b = a; + a = 0; + } + var d = b - a; + var f = function() { + return a + Math.floor(d * Math.random()); + }; + f.samples = function(n) { + return gen.zeros(n).map(f); + }; + f.pdf = function(x) { + return (x === Math.floor(x) && x >= a && x < b) ? 1/d : 0; + }; + f.cdf = function(x) { + var v = Math.floor(x); + return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; + }; + f.icdf = function(p) { + return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p*d) : NaN; + }; + return f; +}; + +gen.random.normal = function(mean, stdev) { + mean = mean || 0; + stdev = stdev || 1; + var next; + var f = function() { + var x = 0, y = 0, rds, c; + if (next !== undefined) { + x = next; + next = undefined; + return x; + } + do { + x = Math.random()*2-1; + y = Math.random()*2-1; + rds = x*x + y*y; + } while (rds === 0 || rds > 1); + c = Math.sqrt(-2*Math.log(rds)/rds); // Box-Muller transform + next = mean + y*c*stdev; + return mean + x*c*stdev; + }; + f.samples = function(n) { + return gen.zeros(n).map(f); + }; + f.pdf = function(x) { + var exp = Math.exp(Math.pow(x-mean, 2) / (-2 * Math.pow(stdev, 2))); + return (1 / (stdev * Math.sqrt(2*Math.PI))) * exp; + }; + f.cdf = function(x) { + // Approximation from West (2009) + // Better Approximations to Cumulative Normal Functions + var cd, + z = (x - mean) / stdev, + Z = Math.abs(z); + if (Z > 37) { + cd = 0; + } else { + var sum, exp = Math.exp(-Z*Z/2); + if (Z < 7.07106781186547) { + sum = 3.52624965998911e-02 * Z + 0.700383064443688; + sum = sum * Z + 6.37396220353165; + sum = sum * Z + 33.912866078383; + sum = sum * Z + 112.079291497871; + sum = sum * Z + 221.213596169931; + sum = sum * Z + 220.206867912376; + cd = exp * sum; + sum = 8.83883476483184e-02 * Z + 1.75566716318264; + sum = sum * Z + 16.064177579207; + sum = sum * Z + 86.7807322029461; + sum = sum * Z + 296.564248779674; + sum = sum * Z + 637.333633378831; + sum = sum * Z + 793.826512519948; + sum = sum * Z + 440.413735824752; + cd = cd / sum; + } else { + sum = Z + 0.65; + sum = Z + 4 / sum; + sum = Z + 3 / sum; + sum = Z + 2 / sum; + sum = Z + 1 / sum; + cd = exp / sum / 2.506628274631; + } + } + return z > 0 ? 1 - cd : cd; + }; + f.icdf = function(p) { + // Approximation of Probit function using inverse error function. + if (p <= 0 || p >= 1) return NaN; + var x = 2*p - 1, + v = (8 * (Math.PI - 3)) / (3 * Math.PI * (4-Math.PI)), + a = (2 / (Math.PI*v)) + (Math.log(1 - Math.pow(x,2)) / 2), + b = Math.log(1 - (x*x)) / v, + s = (x > 0 ? 1 : -1) * Math.sqrt(Math.sqrt((a*a) - b) - a); + return mean + stdev * Math.SQRT2 * s; + }; + return f; +}; + +gen.random.bootstrap = function(domain, smooth) { + // Generates a bootstrap sample from a set of observations. + // Smooth bootstrapping adds random zero-centered noise to the samples. + var val = domain.filter(util.isValid), + len = val.length, + err = smooth ? gen.random.normal(0, smooth) : null; + var f = function() { + return val[~~(Math.random()*len)] + (err ? err() : 0); + }; + f.samples = function(n) { + return gen.zeros(n).map(f); + }; + return f; +}; +},{"./util":8}],5:[function(require,module,exports){ +var util = require('../util'); + +var TYPES = '__types__'; + +var PARSERS = { + boolean: util.boolean, + integer: util.number, + number: util.number, + date: util.date, + string: function(x) { return x==='' ? null : x; } +}; + +var TESTS = { + boolean: function(x) { return x==='true' || x==='false' || util.isBoolean(x); }, + integer: function(x) { return TESTS.number(x) && (x=+x) === ~~x; }, + number: function(x) { return !isNaN(+x) && !util.isDate(x); }, + date: function(x) { return !isNaN(Date.parse(x)); } +}; + +function annotation(data, types) { + if (!types) return data && data[TYPES] || null; + data[TYPES] = types; +} + +function type(values, f) { + values = util.array(values); + f = util.$(f); + var v, i, n; + + // if data array has type annotations, use them + if (values[TYPES]) { + v = f(values[TYPES]); + if (util.isString(v)) return v; + } + + for (i=0, n=values.length; !util.isValid(v) && i 0 ? Math.pow(mean, 1/c) : 0; + return mean; +}; + +// Compute the harmonic mean of an array of numbers. +stats.mean.harmonic = function(values, f) { + f = util.$(f); + var mean = 0, c, n, v, i; + for (i=0, c=0, n=values.length; i b) b = v; + } + } + return [a, b]; +}; + +// Find the integer indices of the minimum and maximum values. +stats.extent.index = function(values, f) { + f = util.$(f); + var x = -1, y = -1, a, b, v, i, n = values.length; + for (i=0; i b) { b = v; y = i; } + } + } + return [x, y]; +}; + +// Compute the dot product of two arrays of numbers. +stats.dot = function(values, a, b) { + var sum = 0, i, v; + if (!b) { + if (values.length !== a.length) { + throw Error('Array lengths must match.'); + } + for (i=0; i -1 && p !== v) { + mu = 1 + (i-1 + tie) / 2; + for (; tie -1) { + mu = 1 + (n-1 + tie) / 2; + for (; tie max) max = x; + delta = x - mean; + mean = mean + delta / (++valid); + M2 = M2 + delta * (x - mean); + vals.push(x); + } + } + M2 = M2 / (valid - 1); + sd = Math.sqrt(M2); + + // sort values for median and iqr + vals.sort(util.cmp); + + return { + type: type(values, f), + unique: u, + count: values.length, + valid: valid, + missing: missing, + distinct: distinct, + min: min, + max: max, + mean: mean, + stdev: sd, + median: (v = stats.quantile(vals, 0.5)), + q1: stats.quantile(vals, 0.25), + q3: stats.quantile(vals, 0.75), + modeskew: sd === 0 ? 0 : (mean - v) / sd + }; +}; + +// Compute profiles for all variables in a data set. +stats.summary = function(data, fields) { + fields = fields || util.keys(data[0]); + var s = fields.map(function(f) { + var p = stats.profile(data, util.$(f)); + return (p.field = f, p); + }); + return (s.__summary__ = true, s); +}; + +},{"./generate":4,"./import/type":5,"./util":8}],7:[function(require,module,exports){ +var d3_time = require('d3-time'); + +var tempDate = new Date(), + baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD + utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0); + +function date(d) { + return (tempDate.setTime(+d), tempDate); +} + +// create a time unit entry +function entry(type, date, unit, step, min, max) { + var e = { + type: type, + date: date, + unit: unit + }; + if (step) { + e.step = step; + } else { + e.minstep = 1; + } + if (min != null) e.min = min; + if (max != null) e.max = max; + return e; +} + +function create(type, unit, base, step, min, max) { + return entry(type, + function(d) { return unit.offset(base, d); }, + function(d) { return unit.count(base, d); }, + step, min, max); +} + +var locale = [ + create('second', d3_time.second, baseDate), + create('minute', d3_time.minute, baseDate), + create('hour', d3_time.hour, baseDate), + create('day', d3_time.day, baseDate, [1, 7]), + create('month', d3_time.month, baseDate, [1, 3, 6]), + create('year', d3_time.year, baseDate), + + // periodic units + entry('seconds', + function(d) { return new Date(1970, 0, 1, 0, 0, d); }, + function(d) { return date(d).getSeconds(); }, + null, 0, 59 + ), + entry('minutes', + function(d) { return new Date(1970, 0, 1, 0, d); }, + function(d) { return date(d).getMinutes(); }, + null, 0, 59 + ), + entry('hours', + function(d) { return new Date(1970, 0, 1, d); }, + function(d) { return date(d).getHours(); }, + null, 0, 23 + ), + entry('weekdays', + function(d) { return new Date(1970, 0, 4+d); }, + function(d) { return date(d).getDay(); }, + [1], 0, 6 + ), + entry('dates', + function(d) { return new Date(1970, 0, d); }, + function(d) { return date(d).getDate(); }, + [1], 1, 31 + ), + entry('months', + function(d) { return new Date(1970, d % 12, 1); }, + function(d) { return date(d).getMonth(); }, + [1], 0, 11 + ) +]; + +var utc = [ + create('second', d3_time.utcSecond, utcBaseDate), + create('minute', d3_time.utcMinute, utcBaseDate), + create('hour', d3_time.utcHour, utcBaseDate), + create('day', d3_time.utcDay, utcBaseDate, [1, 7]), + create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]), + create('year', d3_time.utcYear, utcBaseDate), + + // periodic units + entry('seconds', + function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); }, + function(d) { return date(d).getUTCSeconds(); }, + null, 0, 59 + ), + entry('minutes', + function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); }, + function(d) { return date(d).getUTCMinutes(); }, + null, 0, 59 + ), + entry('hours', + function(d) { return new Date(Date.UTC(1970, 0, 1, d)); }, + function(d) { return date(d).getUTCHours(); }, + null, 0, 23 + ), + entry('weekdays', + function(d) { return new Date(Date.UTC(1970, 0, 4+d)); }, + function(d) { return date(d).getUTCDay(); }, + [1], 0, 6 + ), + entry('dates', + function(d) { return new Date(Date.UTC(1970, 0, d)); }, + function(d) { return date(d).getUTCDate(); }, + [1], 1, 31 + ), + entry('months', + function(d) { return new Date(Date.UTC(1970, d % 12, 1)); }, + function(d) { return date(d).getUTCMonth(); }, + [1], 0, 11 + ) +]; + +var STEPS = [ + [31536e6, 5], // 1-year + [7776e6, 4], // 3-month + [2592e6, 4], // 1-month + [12096e5, 3], // 2-week + [6048e5, 3], // 1-week + [1728e5, 3], // 2-day + [864e5, 3], // 1-day + [432e5, 2], // 12-hour + [216e5, 2], // 6-hour + [108e5, 2], // 3-hour + [36e5, 2], // 1-hour + [18e5, 1], // 30-minute + [9e5, 1], // 15-minute + [3e5, 1], // 5-minute + [6e4, 1], // 1-minute + [3e4, 0], // 30-second + [15e3, 0], // 15-second + [5e3, 0], // 5-second + [1e3, 0] // 1-second +]; + +function find(units, span, minb, maxb) { + var step = STEPS[0], i, n, bins; + + for (i=1, n=STEPS.length; i step[0]) { + bins = span / step[0]; + if (bins > maxb) { + return units[STEPS[i-1][1]]; + } + if (bins >= minb) { + return units[step[1]]; + } + } + } + return units[STEPS[n-1][1]]; +} + +function toUnitMap(units) { + var map = {}, i, n; + for (i=0, n=units.length; i 1 ? + function(x, v) { + for (var i=0; i y) return sign[i]; + } + return 0; + }; +}; + +u.cmp = function(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else if (a >= b) { + return 0; + } else if (a === null) { + return -1; + } else if (b === null) { + return 1; + } + return NaN; +}; + +u.numcmp = function(a, b) { return a - b; }; + +u.stablesort = function(array, sortBy, keyFn) { + var indices = array.reduce(function(idx, v, i) { + return (idx[keyFn(v)] = i, idx); + }, {}); + + array.sort(function(a, b) { + var sa = sortBy(a), + sb = sortBy(b); + return sa < sb ? -1 : sa > sb ? 1 + : (indices[keyFn(a)] - indices[keyFn(b)]); + }); + + return array; +}; + +// permutes an array using a Knuth shuffle +u.permute = function(a) { + var m = a.length, + swap, + i; + + while (m) { + i = Math.floor(Math.random() * m--); + swap = a[m]; + a[m] = a[i]; + a[i] = swap; + } +}; + +// string functions + +u.pad = function(s, length, pos, padchar) { + padchar = padchar || " "; + var d = length - s.length; + if (d <= 0) return s; + switch (pos) { + case 'left': + return strrep(d, padchar) + s; + case 'middle': + case 'center': + return strrep(Math.floor(d/2), padchar) + + s + strrep(Math.ceil(d/2), padchar); + default: + return s + strrep(d, padchar); + } +}; + +function strrep(n, str) { + var s = "", i; + for (i=0; i 1) { + return false; + } + } + } + } + return true; + } + }, + { + name: 'omitNonPositionalOverPositionalChannels', + description: 'Do not use non-positional channels unless all positional channels are used', + properties: [property_1.Property.CHANNEL], + allowEnumSpecForProperties: false, + strict: false, + satisfy: function (specM, schema, opt) { + return util_1.some(channel_1.NONSPATIAL_CHANNELS, function (channel) { return specM.channelUsed(channel); }) ? + // if non-positional channels are used, then both x and y must be used. + specM.channelUsed(channel_1.Channel.X) && specM.channelUsed(channel_1.Channel.Y) : + true; + } + }, + { + name: 'omitRaw', + description: 'Omit raw plots.', + properties: [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT], + allowEnumSpecForProperties: false, + strict: false, + satisfy: function (specM, schema, opt) { + if (!specM.isAggregate()) { + return false; + } + return true; + } + }, + { + name: 'omitRawContinuousFieldForAggregatePlot', + description: 'Aggregate plot should not use raw continuous field as group by values. ' + + '(Quantitative should be binned. Temporal should have time unit.)', + properties: [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.TYPE], + allowEnumSpecForProperties: true, + strict: false, + satisfy: function (specM, schema, opt) { + if (specM.isAggregate()) { + return util_1.every(specM.getEncodings(), function (encQ) { + if (encQ.type === type_1.Type.TEMPORAL) { + // Temporal fields should have timeUnit or is still an enumSpec + return !!encQ.timeUnit; + } + if (encQ.type === type_1.Type.QUANTITATIVE) { + return !!encQ.bin || !!encQ.aggregate || !!encQ.autoCount; + } + return true; + }); + } + return true; + } + }, + { + name: 'omitRawDetail', + description: 'Do not use detail channel with raw plot.', + properties: [property_1.Property.CHANNEL, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT], + allowEnumSpecForProperties: false, + strict: true, + satisfy: function (specM, schema, opt) { + if (specM.isAggregate()) { + return true; + } + return util_1.every(specM.getEncodings(), function (encQ) { + return encQ.channel !== channel_1.Channel.DETAIL; + }); + } + }, + { + name: 'omitRepeatedField', + description: 'Each field should be mapped to only one channel', + properties: [property_1.Property.FIELD], + allowEnumSpecForProperties: true, + strict: false, + satisfy: function (specM, schema, opt) { + var usedField = {}; + // the same field should not be encoded twice + return util_1.every(specM.getEncodings(), function (encQ) { + if (encQ.field && !enumspec_1.isEnumSpec(encQ.field)) { + // If field is specified, it should not be used already + if (usedField[encQ.field]) { + return false; + } + usedField[encQ.field] = true; + return true; + } + return true; // unspecified field is valid + }); + } + }, + // TODO: omitShapeWithBin + { + name: 'omitVerticalDotPlot', + description: 'Do not output vertical dot plot.', + properties: [property_1.Property.CHANNEL], + allowEnumSpecForProperties: true, + strict: false, + satisfy: function (specM, schema, opt) { + var encodings = specM.getEncodings(); + if (encodings.length === 1 && encodings[0].channel === channel_1.Channel.Y) { + return false; + } + return true; + } + }, + // EXPENSIVE CONSTRAINTS -- check them later! + { + name: 'hasAppropriateGraphicTypeForMark', + description: 'Has appropriate graphic type for mark', + properties: [property_1.Property.CHANNEL, property_1.Property.MARK, property_1.Property.TYPE, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT], + allowEnumSpecForProperties: false, + strict: false, + satisfy: function (specM, schema, opt) { + var mark = specM.getMark(); + switch (mark) { + case mark_1.Mark.AREA: + case mark_1.Mark.LINE: + if (specM.isAggregate()) { + var xEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.X); + var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y); + var xIsMeasure = xEncQ && encoding_2.isMeasure(xEncQ); + var yIsMeasure = yEncQ && encoding_2.isMeasure(yEncQ); + // for aggregate line / area, we need at least one group-by axis and one measure axis. + return xEncQ && yEncQ && (xIsMeasure !== yIsMeasure) && + // and the dimension axis should not be nominal + // TODO: make this clause optional + !(!xIsMeasure && xEncQ.type === type_1.Type.NOMINAL) && + !(!yIsMeasure && yEncQ.type === type_1.Type.NOMINAL); + } + return true; + case mark_1.Mark.TEXT: + // FIXME correctly when we add text + return true; + case mark_1.Mark.BAR: + case mark_1.Mark.TICK: + // Bar and tick should not use size. + if (specM.channelUsed(channel_1.Channel.SIZE)) { + return false; + } + // Tick and Bar should have one and only one measure + if (specM.isMeasure(channel_1.Channel.X) !== specM.isMeasure(channel_1.Channel.Y)) { + // TODO: Bar and tick's dimension should not be continuous (quant/time) scale + return true; + } + return false; + case mark_1.Mark.CIRCLE: + case mark_1.Mark.POINT: + case mark_1.Mark.SQUARE: + case mark_1.Mark.RULE: + return true; + } + /* istanbul ignore next */ + throw new Error('hasAllRequiredChannelsForMark not implemented for mark' + mark); + } + }, + { + name: 'omitNonSumStack', + description: 'Stacked plot should use summative aggregation such as sum, count, or distinct', + properties: [property_1.Property.CHANNEL, property_1.Property.MARK, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT], + allowEnumSpecForProperties: false, + strict: false, + satisfy: function (specM, schema, opt) { + var stack = specM.stack(); + if (stack) { + var measureEncQ = specM.getEncodingQueryByChannel(stack.fieldChannel); + return util_1.contains(aggregate_1.SUM_OPS, measureEncQ.aggregate) || !!measureEncQ.autoCount; + } + return true; + } + }, + { + name: 'omitTableWithOcclusionIfAutoAddCount', + description: 'Plots without aggregation or autocount where x and y are both dimensions should be omitted if autoAddCount is enabled as they often lead to occlusion', + properties: [property_1.Property.CHANNEL, property_1.Property.TYPE, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT], + allowEnumSpecForProperties: false, + strict: false, + satisfy: function (specM, schema, opt) { + if (opt.autoAddCount) { + // TODO(#186): take mark properties channel into account + if (specM.isDimension(channel_1.Channel.X) && + specM.isDimension(channel_1.Channel.Y) && + !specM.isAggregate() // TODO: refactor based on statistics + ) { + return false; + } + } + return true; + } + } +].map(function (sc) { return new SpecConstraintModel(sc); }); +// For testing +exports.SPEC_CONSTRAINT_INDEX = exports.SPEC_CONSTRAINTS.reduce(function (m, c) { + m[c.name()] = c; + return m; +}, {}); +// +exports.SPEC_CONSTRAINTS_BY_PROPERTY = exports.SPEC_CONSTRAINTS.reduce(function (m, c) { + c.properties().forEach(function (prop) { + m[prop] = m[prop] || []; + m[prop].push(c); + }); + return m; +}, {}); +/** + * Check all encoding constraints for a particular property and index tuple + */ +function checkSpec(prop, enumSpec, specM, schema, opt) { + // Check encoding constraint + var specConstraints = exports.SPEC_CONSTRAINTS_BY_PROPERTY[prop] || []; + for (var i = 0; i < specConstraints.length; i++) { + var c = specConstraints[i]; + // Check if the constraint is enabled + if (c.strict() || !!opt[c.name()]) { + // For strict constraint, or enabled non-strict, check the constraints + var satisfy = c.satisfy(specM, schema, opt); + if (!satisfy) { + var violatedConstraint = '(spec) ' + c.name(); + /* istanbul ignore if */ + if (opt.verbose) { + console.log(violatedConstraint + ' failed with ' + specM.toShorthand() + ' for ' + enumSpec.name); + } + return violatedConstraint; + } + } + } + return null; +} +exports.checkSpec = checkSpec; + +},{"../enumspec":16,"../property":21,"../query/encoding":22,"../util":36,"./base":10,"vega-lite/src/aggregate":42,"vega-lite/src/channel":45,"vega-lite/src/mark":50,"vega-lite/src/scale":51,"vega-lite/src/type":55}],14:[function(require,module,exports){ +"use strict"; +exports.version = '0.5.2'; +var util_1 = require('./util'); +exports.constraint = require('./constraint/constraint'); +exports.enumerate = require('./enumerator'); +exports.enumSpec = require('./enumspec'); +var generate_1 = require('./generate'); +exports.generate = generate_1.generate; +exports.model = require('./model'); +exports.nest = require('./nest'); +exports.property = require('./property'); +// Make it so that we can call cql.query() as method, or access other methods inside cql.query +var cqlQuery = require('./query/query'); +var query_1 = require('./query/query'); +exports.query = util_1.extend(query_1.query, cqlQuery); +exports.ranking = require('./ranking/ranking'); +exports.schema = require('./schema'); +exports.util = require('./util'); + +},{"./constraint/constraint":11,"./enumerator":15,"./enumspec":16,"./generate":18,"./model":19,"./nest":20,"./property":21,"./query/query":24,"./ranking/ranking":33,"./schema":34,"./util":36}],15:[function(require,module,exports){ +"use strict"; +var encoding_1 = require('./constraint/encoding'); +var spec_1 = require('./constraint/spec'); +var property_1 = require('./property'); +exports.ENUMERATOR_INDEX = {}; +exports.ENUMERATOR_INDEX[property_1.Property.MARK] = function (enumSpecIndex, schema, opt) { + return function (answerSet, specM) { + var markEnumSpec = specM.getMark(); + // enumerate the value + markEnumSpec.enum.forEach(function (mark) { + specM.setMark(mark); + // Check spec constraint + var violatedSpecConstraint = spec_1.checkSpec(property_1.Property.MARK, enumSpecIndex.mark, specM, schema, opt); + if (!violatedSpecConstraint) { + // emit + answerSet.push(specM.duplicate()); + } + }); + // Reset to avoid side effect + specM.resetMark(); + return answerSet; + }; +}; +property_1.ENCODING_PROPERTIES.forEach(function (prop) { + exports.ENUMERATOR_INDEX[prop] = EncodingPropertyGeneratorFactory(prop); +}); +property_1.NESTED_ENCODING_PROPERTIES.forEach(function (nestedProp) { + exports.ENUMERATOR_INDEX[nestedProp.property] = EncodingPropertyGeneratorFactory(nestedProp.property); +}); +/** + * @param prop property type. + * @return an answer set reducer factory for the given prop. + */ +function EncodingPropertyGeneratorFactory(prop) { + /** + * @return as reducer that takes a specQueryModel as input and output an answer set array. + */ + return function (enumSpecIndex, schema, opt) { + return function (answerSet, specM) { + // index of encoding mappings that require enumeration + var indices = enumSpecIndex.encodingIndicesByProperty[prop]; + function enumerate(jobIndex) { + if (jobIndex === indices.length) { + // emit and terminate + answerSet.push(specM.duplicate()); + return; + } + var index = indices[jobIndex]; + var enumSpec = enumSpecIndex.encodings[index][prop]; + var encQ = specM.getEncodingQueryByIndex(index); + var propEnumSpec = specM.getEncodingProperty(index, prop); + if ( + // TODO: encQ.exclude + // If this encoding query is an excluded autoCount, there is no point enumerating other properties + // for this encoding query because they will be excluded anyway. + // Thus, we can just move on to the next encoding to enumerate. + encQ.autoCount === false || + // nested encoding property might have its parent set to false + // therefore, we no longer have to enumerate them + !propEnumSpec) { + enumerate(jobIndex + 1); + } + else { + enumSpec.enum.forEach(function (propVal) { + if (propVal === null) { + // our duplicate() method use JSON.stringify, parse and thus can accidentally + // convert undefined in an array into null + propVal = undefined; + } + specM.setEncodingProperty(index, prop, propVal, enumSpec); + // Check encoding constraint + var violatedEncodingConstraint = encoding_1.checkEncoding(prop, enumSpec, index, specM, schema, opt); + if (violatedEncodingConstraint) { + return; // do not keep searching + } + // Check spec constraint + var violatedSpecConstraint = spec_1.checkSpec(prop, enumSpec, specM, schema, opt); + if (violatedSpecConstraint) { + return; // do not keep searching + } + // If qualify all of the constraints, keep enumerating + enumerate(jobIndex + 1); + }); + // Reset to avoid side effect + specM.resetEncodingProperty(index, prop, enumSpec); + } + } + // start enumerating from 0 + enumerate(0); + return answerSet; + }; + }; +} +exports.EncodingPropertyGeneratorFactory = EncodingPropertyGeneratorFactory; + +},{"./constraint/encoding":12,"./constraint/spec":13,"./property":21}],16:[function(require,module,exports){ +"use strict"; +var util_1 = require('./util'); +/** Enum for a short form of the enumeration spec. */ +(function (ShortEnumSpec) { + ShortEnumSpec[ShortEnumSpec["ENUMSPEC"] = '?'] = "ENUMSPEC"; +})(exports.ShortEnumSpec || (exports.ShortEnumSpec = {})); +var ShortEnumSpec = exports.ShortEnumSpec; +exports.SHORT_ENUM_SPEC = ShortEnumSpec.ENUMSPEC; +function isEnumSpec(prop) { + return prop === exports.SHORT_ENUM_SPEC || (prop !== undefined && (!!prop.enum || !!prop.name) && !util_1.isArray(prop)); +} +exports.isEnumSpec = isEnumSpec; +function initEnumSpec(prop, defaultName, defaultEnumValues) { + return util_1.extend({}, { + name: defaultName, + enum: defaultEnumValues + }, prop === exports.SHORT_ENUM_SPEC ? {} : prop); +} +exports.initEnumSpec = initEnumSpec; + +},{"./util":36}],17:[function(require,module,exports){ +"use strict"; +var property_1 = require('./property'); +var util_1 = require('./util'); +var EnumSpecIndex = (function () { + function EnumSpecIndex() { + this._mark = undefined; + this._encodings = {}; + this._encodingIndicesByProperty = {}; + } + EnumSpecIndex.prototype.setEncodingProperty = function (index, prop, enumSpec) { + var encodingsIndex = this._encodings; + // Init encoding index and set prop + var encIndex = encodingsIndex[index] = encodingsIndex[index] || {}; + encIndex[prop] = enumSpec; + // Initialize indicesByProperty[prop] and add index + var encodingIndicesByProperty = this._encodingIndicesByProperty; + (encodingIndicesByProperty[prop] = encodingIndicesByProperty[prop] || []).push(index); + return this; + }; + EnumSpecIndex.prototype.hasProperty = function (prop) { + if (property_1.isEncodingProperty(prop)) { + return !!this.encodingIndicesByProperty[prop]; + } + if (prop === property_1.Property.MARK) { + return !!this.mark; + } + /* istanbul ignore next */ + throw new Error('Unimplemented for property ' + prop); + }; + EnumSpecIndex.prototype.isEmpty = function () { + return !this.mark && util_1.keys(this.encodingIndicesByProperty).length === 0; + }; + EnumSpecIndex.prototype.setMark = function (mark) { + this._mark = mark; + return this; + }; + Object.defineProperty(EnumSpecIndex.prototype, "mark", { + get: function () { + return this._mark; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EnumSpecIndex.prototype, "encodings", { + get: function () { + return this._encodings; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(EnumSpecIndex.prototype, "encodingIndicesByProperty", { + get: function () { + return this._encodingIndicesByProperty; + }, + enumerable: true, + configurable: true + }); + return EnumSpecIndex; +}()); +exports.EnumSpecIndex = EnumSpecIndex; + +},{"./property":21,"./util":36}],18:[function(require,module,exports){ +"use strict"; +var enumerator_1 = require('../src/enumerator'); +var config_1 = require('./config'); +var model_1 = require('./model'); +var stylize_1 = require('./stylize'); +function generate(specQ, schema, opt) { + if (opt === void 0) { opt = config_1.DEFAULT_QUERY_CONFIG; } + // 1. Build a SpecQueryModel, which also contains enumSpecIndex + var specM = model_1.SpecQueryModel.build(specQ, schema, opt); + var enumSpecIndex = specM.enumSpecIndex; + // 2. Enumerate each of the properties based on propPrecedence. + var answerSet = [specM]; // Initialize Answer Set with only the input spec query. + opt.propertyPrecedence.forEach(function (prop) { + // If the original specQuery contains enumSpec for this prop + if (enumSpecIndex.hasProperty(prop)) { + // update answerset + var reducer = enumerator_1.ENUMERATOR_INDEX[prop](enumSpecIndex, schema, opt); + answerSet = answerSet.reduce(reducer, []); + } + }); + if ((opt.nominalColorScaleForHighCardinality !== null) || + (opt.smallBandSizeForHighCardinalityOrFacet !== null) || + (opt.xAxisOnTopForHighYCardinalityWithoutColumn !== null)) { + return stylize_1.stylize(answerSet, schema, opt); + } + return answerSet; +} +exports.generate = generate; + +},{"../src/enumerator":15,"./config":9,"./model":19,"./stylize":35}],19:[function(require,module,exports){ +"use strict"; +var aggregate_1 = require('vega-lite/src/aggregate'); +var type_1 = require('vega-lite/src/type'); +var property_1 = require('./property'); +var enumspec_1 = require('./enumspec'); +var enumspecindex_1 = require('./enumspecindex'); +var spec_1 = require('./query/spec'); +var encoding_1 = require('./query/encoding'); +var shorthand_1 = require('./query/shorthand'); +var util_1 = require('./util'); +function getDefaultName(prop) { + switch (prop) { + case property_1.Property.MARK: + return 'm'; + case property_1.Property.CHANNEL: + return 'c'; + case property_1.Property.AGGREGATE: + return 'a'; + case property_1.Property.AUTOCOUNT: + return '#'; + case property_1.Property.BIN: + return 'b'; + case property_1.Property.BIN_MAXBINS: + return 'b-mb'; + case property_1.Property.SORT: + return 'so'; + case property_1.Property.SORT_FIELD: + return 'so-f'; + case property_1.Property.SORT_OP: + return 'so-op'; + case property_1.Property.SORT_ORDER: + return 'so-or'; + case property_1.Property.SCALE: + return 's'; + case property_1.Property.SCALE_BANDSIZE: + return 's-bs'; + case property_1.Property.SCALE_CLAMP: + return 's-c'; + case property_1.Property.SCALE_DOMAIN: + return 's-d'; + case property_1.Property.SCALE_EXPONENT: + return 's-e'; + case property_1.Property.SCALE_NICE: + return 's-n'; + case property_1.Property.SCALE_RANGE: + return 's-ra'; + case property_1.Property.SCALE_ROUND: + return 's-r'; + case property_1.Property.SCALE_TYPE: + return 's-t'; + case property_1.Property.SCALE_USERAWDOMAIN: + return 's-u'; + case property_1.Property.SCALE_ZERO: + return 's-z'; + case property_1.Property.AXIS: + return 'ax'; + case property_1.Property.AXIS_AXISCOLOR: + return 'ax-ac'; + case property_1.Property.AXIS_AXISWIDTH: + return 'ax-aw'; + case property_1.Property.AXIS_LAYER: + return 'ax-lay'; + case property_1.Property.AXIS_OFFSET: + return 'ax-of'; + case property_1.Property.AXIS_ORIENT: + return 'ax-or'; + case property_1.Property.AXIS_GRID: + return 'ax-g'; + case property_1.Property.AXIS_GRIDCOLOR: + return 'ax-gc'; + case property_1.Property.AXIS_GRIDDASH: + return 'ax-gd'; + case property_1.Property.AXIS_GRIDOPACITY: + return 'ax-go'; + case property_1.Property.AXIS_GRIDWIDTH: + return 'ax-gw'; + case property_1.Property.AXIS_LABELS: + return 'ax-lab'; + case property_1.Property.AXIS_FORMAT: + return 'ax-f'; + case property_1.Property.AXIS_LABELANGLE: + return 'ax-laba'; + case property_1.Property.AXIS_LABELMAXLENGTH: + return 'ax-labm'; + case property_1.Property.AXIS_SHORTTIMELABELS: + return 'ax-stl'; + case property_1.Property.AXIS_SUBDIVIDE: + return 'ax-sub'; + case property_1.Property.AXIS_TICKS: + return 'ax-t'; + case property_1.Property.AXIS_TICKCOLOR: + return 'ax-tc'; + case property_1.Property.AXIS_TICKLABELCOLOR: + return 'ax-tlc'; + case property_1.Property.AXIS_TICKLABELFONT: + return 'ax-tlf'; + case property_1.Property.AXIS_TICKLABELFONTSIZE: + return 'ax-tlfs'; + case property_1.Property.AXIS_TICKPADDING: + return 'ax-tp'; + case property_1.Property.AXIS_TICKSIZE: + return 'ax-ts'; + case property_1.Property.AXIS_TICKSIZEMAJOR: + return 'ax-tsma'; + case property_1.Property.AXIS_TICKSIZEMINOR: + return 'ax-tsmi'; + case property_1.Property.AXIS_TICKSIZEEND: + return 'ax-tse'; + case property_1.Property.AXIS_TICKWIDTH: + return 'ax-tw'; + case property_1.Property.AXIS_VALUES: + return 'ax-v'; + case property_1.Property.AXIS_TITLE: + return 'ax-ti'; + case property_1.Property.AXIS_TITLECOLOR: + return 'ax-tic'; + case property_1.Property.AXIS_TITLEFONT: + return 'ax-tif'; + case property_1.Property.AXIS_TITLEFONTSIZE: + return 'ax-tifs'; + case property_1.Property.AXIS_TITLEFONTWEIGHT: + return 'ax-tifw'; + case property_1.Property.AXIS_TITLEOFFSET: + return 'ax-tio'; + case property_1.Property.AXIS_TITLEMAXLENGTH: + return 'ax-timl'; + case property_1.Property.AXIS_CHARACTERWIDTH: + return 'ax-cw'; + case property_1.Property.LEGEND: + return 'l'; + case property_1.Property.LEGEND_ORIENT: + return 'l-or'; + case property_1.Property.LEGEND_OFFSET: + return 'l-of'; + case property_1.Property.LEGEND_VALUES: + return 'l-v'; + case property_1.Property.LEGEND_FORMAT: + return 'l-f'; + case property_1.Property.LEGEND_LABELALIGN: + return 'l-la'; + case property_1.Property.LEGEND_LABELBASELINE: + return 'l-lb'; + case property_1.Property.LEGEND_LABELCOLOR: + return 'l-lc'; + case property_1.Property.LEGEND_LABELFONT: + return 'l-lf'; + case property_1.Property.LEGEND_LABELFONTSIZE: + return 'l-lfs'; + case property_1.Property.LEGEND_SHORTTIMELABELS: + return 'l-stl'; + case property_1.Property.LEGEND_SYMBOLCOLOR: + return 'l-syc'; + case property_1.Property.LEGEND_SYMBOLSHAPE: + return 'l-sysh'; + case property_1.Property.LEGEND_SYMBOLSIZE: + return 'l-sysi'; + case property_1.Property.LEGEND_SYMBOLSTROKEWIDTH: + return 'l-sysw'; + case property_1.Property.LEGEND_TITLE: + return 'l-ti'; + case property_1.Property.LEGEND_TITLECOLOR: + return 'l-tic'; + case property_1.Property.LEGEND_TITLEFONT: + return 'l-tif'; + case property_1.Property.LEGEND_TITLEFONTSIZE: + return 'l-tifs'; + case property_1.Property.LEGEND_TITLEFONTWEIGHT: + return 'l-tifw'; + case property_1.Property.TIMEUNIT: + return 'tu'; + case property_1.Property.FIELD: + return 'f'; + case property_1.Property.TYPE: + return 't'; + } + /* istanbul ignore next */ + throw new Error('Default name undefined'); +} +exports.getDefaultName = getDefaultName; +function getDefaultEnumValues(prop, schema, opt) { + switch (prop) { + case property_1.Property.FIELD: // For field, by default enumerate all fields + case property_1.Property.SORT_FIELD: + return schema.fields(); + // True, False for boolean values + case property_1.Property.AXIS: + case property_1.Property.AXIS_GRID: + case property_1.Property.AXIS_LABELS: + case property_1.Property.AXIS_SHORTTIMELABELS: + case property_1.Property.BIN: + case property_1.Property.LEGEND: + case property_1.Property.LEGEND_SHORTTIMELABELS: + case property_1.Property.SCALE: + case property_1.Property.SCALE_CLAMP: + case property_1.Property.SCALE_NICE: + case property_1.Property.SCALE_ROUND: + case property_1.Property.SCALE_USERAWDOMAIN: + case property_1.Property.SCALE_ZERO: + case property_1.Property.AUTOCOUNT: + return [false, true]; + // For other properties, take default enumValues from config. + // The config name for each prop is a plural form of the prop. + case property_1.Property.AGGREGATE: + return opt.aggregates; + case property_1.Property.AXIS_AXISCOLOR: + return opt.axisAxisColors; + case property_1.Property.AXIS_AXISWIDTH: + return opt.axisAxisWidths; + case property_1.Property.AXIS_LAYER: + return opt.axisLayers; + case property_1.Property.AXIS_OFFSET: + return opt.axisOffsets; + case property_1.Property.AXIS_ORIENT: + return opt.axisOrients; + case property_1.Property.AXIS_GRIDCOLOR: + return opt.axisGridColors; + case property_1.Property.AXIS_GRIDDASH: + return opt.axisGridDashes; + case property_1.Property.AXIS_GRIDOPACITY: + return opt.axisGridOpacities; + case property_1.Property.AXIS_GRIDWIDTH: + return opt.axisGridWidths; + case property_1.Property.AXIS_FORMAT: + return opt.axisFormats; + case property_1.Property.AXIS_LABELANGLE: + return opt.axisLabelAngles; + case property_1.Property.AXIS_LABELMAXLENGTH: + return opt.axisLabelMaxLengths; + case property_1.Property.AXIS_SUBDIVIDE: + return opt.axisSubDivides; + case property_1.Property.AXIS_TICKS: + return opt.axisTicks; + case property_1.Property.AXIS_TICKCOLOR: + return opt.axisTickColors; + case property_1.Property.AXIS_TICKLABELCOLOR: + return opt.axisTickLabelColors; + case property_1.Property.AXIS_TICKLABELFONT: + return opt.axisTickLabelFonts; + case property_1.Property.AXIS_TICKLABELFONTSIZE: + return opt.axisTickLabelFontSizes; + case property_1.Property.AXIS_TICKPADDING: + return opt.axisTickPaddings; + case property_1.Property.AXIS_TICKSIZE: + return opt.axisTickSizes; + case property_1.Property.AXIS_TICKSIZEMAJOR: + return opt.axisTickSizeMajors; + case property_1.Property.AXIS_TICKSIZEMINOR: + return opt.axisTickSizeMinors; + case property_1.Property.AXIS_TICKSIZEEND: + return opt.axisTickSizeEnds; + case property_1.Property.AXIS_TICKWIDTH: + return opt.axisTickWidths; + case property_1.Property.AXIS_VALUES: + return opt.axisValuesList; + case property_1.Property.AXIS_TITLE: + return opt.axisTitles; + case property_1.Property.AXIS_TITLECOLOR: + return opt.axisTitleColors; + case property_1.Property.AXIS_TITLEFONT: + return opt.axisTitleFonts; + case property_1.Property.AXIS_TITLEFONTWEIGHT: + return opt.axisTitleFontWeights; + case property_1.Property.AXIS_TITLEFONTSIZE: + return opt.axisTitleFontSizes; + case property_1.Property.AXIS_TITLEOFFSET: + return opt.axisTitleOffsets; + case property_1.Property.AXIS_TITLEMAXLENGTH: + return opt.axisTitleMaxLengths; + case property_1.Property.AXIS_CHARACTERWIDTH: + return opt.axisCharacterWidths; + case property_1.Property.BIN_MAXBINS: + return opt.maxBinsList; + case property_1.Property.CHANNEL: + return opt.channels; + case property_1.Property.MARK: + return opt.marks; + case property_1.Property.LEGEND_ORIENT: + return opt.legendOrients; + case property_1.Property.LEGEND_OFFSET: + return opt.legendOffsets; + case property_1.Property.LEGEND_VALUES: + return opt.legendValuesList; + case property_1.Property.LEGEND_FORMAT: + return opt.legendFormats; + case property_1.Property.LEGEND_LABELALIGN: + return opt.legendLabelAligns; + case property_1.Property.LEGEND_LABELBASELINE: + return opt.legendLabelBaselines; + case property_1.Property.LEGEND_LABELCOLOR: + return opt.legendLabelColors; + case property_1.Property.LEGEND_LABELFONT: + return opt.legendLabelFonts; + case property_1.Property.LEGEND_LABELFONTSIZE: + return opt.legendLabelFontSizes; + case property_1.Property.LEGEND_SYMBOLCOLOR: + return opt.legendSymbolColors; + case property_1.Property.LEGEND_SYMBOLSHAPE: + return opt.legendSymbolShapes; + case property_1.Property.LEGEND_SYMBOLSIZE: + return opt.legendSymbolSizes; + case property_1.Property.LEGEND_SYMBOLSTROKEWIDTH: + return opt.legendSymbolStrokeWidths; + case property_1.Property.LEGEND_TITLE: + return opt.legendTitles; + case property_1.Property.LEGEND_TITLECOLOR: + return opt.legendTitleColors; + case property_1.Property.LEGEND_TITLEFONT: + return opt.legendTitleFonts; + case property_1.Property.LEGEND_TITLEFONTSIZE: + return opt.legendTitleFontSizes; + case property_1.Property.LEGEND_TITLEFONTWEIGHT: + return opt.legendTitleFontWeights; + case property_1.Property.SORT: + return opt.sorts; + case property_1.Property.SORT_OP: + return opt.sortOps; + case property_1.Property.SORT_ORDER: + return opt.sortOrders; + case property_1.Property.SCALE_BANDSIZE: + return opt.scaleBandSizes; + case property_1.Property.SCALE_DOMAIN: + return opt.scaleDomains; + case property_1.Property.SCALE_EXPONENT: + return opt.scaleExponents; + case property_1.Property.SCALE_RANGE: + return opt.scaleRanges; + case property_1.Property.SCALE_TYPE: + return opt.scaleTypes; + case property_1.Property.TIMEUNIT: + return opt.timeUnits; + case property_1.Property.TYPE: + return opt.types; + } + /* istanbul ignore next */ + throw new Error('No default enumValues for ' + prop); +} +exports.getDefaultEnumValues = getDefaultEnumValues; +/** + * Internal class for specQuery that provides helper for the enumeration process. + */ +var SpecQueryModel = (function () { + function SpecQueryModel(spec, enumSpecIndex, schema, opt, enumSpecAssignment) { + this._rankingScore = {}; + this._spec = spec; + this._channelCount = spec.encodings.reduce(function (m, encQ) { + if (!enumspec_1.isEnumSpec(encQ.channel) && encQ.autoCount !== false) { + m[encQ.channel] = 1; + } + return m; + }, {}); + this._enumSpecIndex = enumSpecIndex; + this._enumSpecAssignment = enumSpecAssignment; + this._opt = opt; + this._schema = schema; + } + /** + * Build an enumSpecIndex by detecting enumeration specifiers + * in the input specQuery and replace short enum specs with + * full ones that includes both names and enumValues. + * + * @return a SpecQueryModel that wraps the specQuery and the enumSpecIndex. + */ + SpecQueryModel.build = function (specQ, schema, opt) { + var enumSpecIndex = new enumspecindex_1.EnumSpecIndex(); + // mark + if (enumspec_1.isEnumSpec(specQ.mark)) { + var name_1 = getDefaultName(property_1.Property.MARK); + specQ.mark = enumspec_1.initEnumSpec(specQ.mark, name_1, opt.marks); + enumSpecIndex.setMark(specQ.mark); + } + // TODO: transform + // encodings + specQ.encodings.forEach(function (encQ, index) { + if (encQ.autoCount !== undefined) { + // This is only for testing purpose + console.warn('A field with autoCount should not be included as autoCount meant to be an internal object.'); + encQ.type = type_1.Type.QUANTITATIVE; // autoCount is always quantitative + } + if (encQ.type === undefined) { + // type is optional -- we automatically augment enum spec if not specified + encQ.type = enumspec_1.SHORT_ENUM_SPEC; + } + // For each property of the encodingQuery, enumerate + property_1.ENCODING_PROPERTIES.forEach(function (prop) { + if (enumspec_1.isEnumSpec(encQ[prop])) { + // Assign default enum spec name and enum values. + var defaultEnumSpecName = getDefaultName(prop) + index; + var defaultEnumValues = getDefaultEnumValues(prop, schema, opt); + var enumSpec = encQ[prop] = enumspec_1.initEnumSpec(encQ[prop], defaultEnumSpecName, defaultEnumValues); + // Add index of the encoding mapping to the property's enum spec index. + enumSpecIndex.setEncodingProperty(index, prop, enumSpec); + } + }); + // For each nested property of the encoding query (e.g., encQ.bin.maxbins) + property_1.NESTED_ENCODING_PROPERTIES.forEach(function (nestedProp) { + var propObj = encQ[nestedProp.parent]; // the property object e.g., encQ.bin + if (propObj) { + var prop = nestedProp.property; + var child = nestedProp.child; + if (enumspec_1.isEnumSpec(propObj[child])) { + // Assign default enum spec name and enum values. + var defaultEnumSpecName = getDefaultName(prop) + index; + var defaultEnumValues = getDefaultEnumValues(prop, schema, opt); + var enumSpec = propObj[child] = enumspec_1.initEnumSpec(propObj[child], defaultEnumSpecName, defaultEnumValues); + // Add index of the encoding mapping to the property's enum spec index. + enumSpecIndex.setEncodingProperty(index, prop, enumSpec); + } + } + }); + }); + // AUTO COUNT + // Add Auto Count Field + if (opt.autoAddCount) { + var countEncQ = { + channel: { + name: getDefaultName(property_1.Property.CHANNEL) + specQ.encodings.length, + enum: getDefaultEnumValues(property_1.Property.CHANNEL, schema, opt) + }, + autoCount: { + name: getDefaultName(property_1.Property.AUTOCOUNT) + specQ.encodings.length, + enum: [false, true] + }, + type: type_1.Type.QUANTITATIVE + }; + specQ.encodings.push(countEncQ); + var index = specQ.encodings.length - 1; + // Add index of the encoding mapping to the property's enum spec index. + enumSpecIndex.setEncodingProperty(index, property_1.Property.CHANNEL, countEncQ.channel); + enumSpecIndex.setEncodingProperty(index, property_1.Property.AUTOCOUNT, countEncQ.autoCount); + } + return new SpecQueryModel(specQ, enumSpecIndex, schema, opt, {}); + }; + Object.defineProperty(SpecQueryModel.prototype, "enumSpecIndex", { + get: function () { + return this._enumSpecIndex; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SpecQueryModel.prototype, "schema", { + get: function () { + return this._schema; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SpecQueryModel.prototype, "specQuery", { + get: function () { + return this._spec; + }, + enumerable: true, + configurable: true + }); + SpecQueryModel.prototype.duplicate = function () { + return new SpecQueryModel(util_1.duplicate(this._spec), this._enumSpecIndex, this._schema, this._opt, util_1.duplicate(this._enumSpecAssignment)); + }; + SpecQueryModel.prototype.setMark = function (mark) { + var name = this._spec.mark.name; + this._enumSpecAssignment[name] = this._spec.mark = mark; + }; + SpecQueryModel.prototype.resetMark = function () { + var enumSpec = this._spec.mark = this._enumSpecIndex.mark; + delete this._enumSpecAssignment[enumSpec.name]; + }; + SpecQueryModel.prototype.getMark = function () { + return this._spec.mark; + }; + SpecQueryModel.prototype.getEncodingProperty = function (index, prop) { + var encQ = this._spec.encodings[index]; + var nestedProp = property_1.getNestedEncodingProperty(prop); + if (nestedProp) { + return encQ[nestedProp.parent][nestedProp.child]; + } + return encQ[prop]; // encoding property (non-nested) + }; + SpecQueryModel.prototype.setEncodingProperty = function (index, prop, value, enumSpec) { + var encQ = this._spec.encodings[index]; + var nestedProp = property_1.getNestedEncodingProperty(prop); + if (prop === property_1.Property.CHANNEL && encQ.channel && !enumspec_1.isEnumSpec(encQ.channel)) { + // If there is an old channel + this._channelCount[encQ.channel]--; + } + if (nestedProp) { + encQ[nestedProp.parent][nestedProp.child] = value; + } + else if (property_1.hasNestedProperty(prop) && value === true) { + encQ[prop] = util_1.extend({}, encQ[prop], // copy all existing properties + { enum: undefined, name: undefined } // except name and values to it no longer an enumSpec + ); + } + else { + encQ[prop] = value; + } + this._enumSpecAssignment[enumSpec.name] = value; + if (prop === property_1.Property.CHANNEL) { + // If there is a new channel, make sure it exists and add it to the count. + this._channelCount[value] = (this._channelCount[value] || 0) + 1; + } + }; + SpecQueryModel.prototype.resetEncodingProperty = function (index, prop, enumSpec) { + var encQ = this._spec.encodings[index]; + var nestedProp = property_1.getNestedEncodingProperty(prop); + if (prop === property_1.Property.CHANNEL) { + this._channelCount[encQ.channel]--; + } + // reset it to enumSpec + if (nestedProp) { + encQ[nestedProp.parent][nestedProp.child] = enumSpec; + } + else { + encQ[prop] = enumSpec; + } + // add remove value that is reset from the assignment map + delete this._enumSpecAssignment[enumSpec.name]; + }; + SpecQueryModel.prototype.channelUsed = function (channel) { + // do not include encoding that has autoCount = false because it is not a part of the output spec. + return this._channelCount[channel] > 0; + }; + SpecQueryModel.prototype.stack = function () { + return spec_1.stack(this._spec); + }; + SpecQueryModel.prototype.getEncodings = function () { + // do not include encoding that has autoCount = false because it is not a part of the output spec. + return this._spec.encodings.filter(function (encQ) { return encQ.autoCount !== false; }); + }; + SpecQueryModel.prototype.getEncodingQueryByChannel = function (channel) { + for (var i = 0; i < this._spec.encodings.length; i++) { + if (this._spec.encodings[i].channel === channel) { + return this._spec.encodings[i]; + } + } + return undefined; + }; + SpecQueryModel.prototype.getEncodingQueryByIndex = function (i) { + return this._spec.encodings[i]; + }; + SpecQueryModel.prototype.isDimension = function (channel) { + var encQ = this.getEncodingQueryByChannel(channel); + return encQ && encoding_1.isDimension(encQ); + }; + SpecQueryModel.prototype.isMeasure = function (channel) { + var encQ = this.getEncodingQueryByChannel(channel); + return encQ && encoding_1.isMeasure(encQ); + }; + SpecQueryModel.prototype.isAggregate = function () { + return spec_1.isAggregate(this._spec); + }; + SpecQueryModel.prototype.toShorthand = function () { + return shorthand_1.spec(this._spec); + }; + SpecQueryModel.prototype._encoding = function () { + var encoding = {}; + for (var i = 0; i < this._spec.encodings.length; i++) { + var encQ = this._spec.encodings[i]; + var fieldDef = {}; + // For count field that is automatically added, convert to correct vega-lite fieldDef + if (encQ.autoCount === true) { + fieldDef.aggregate = aggregate_1.AggregateOp.COUNT; + fieldDef.field = '*'; + fieldDef.type = type_1.Type.QUANTITATIVE; + } + else if (encQ.autoCount === false) { + continue; // Do not include this in the output. + } + // if channel is an enum spec, return null + if (enumspec_1.isEnumSpec(encQ.channel)) + return null; + // assemble other property into a field def. + var PROPERTIES = [property_1.Property.AGGREGATE, property_1.Property.BIN, property_1.Property.TIMEUNIT, property_1.Property.FIELD, property_1.Property.TYPE, property_1.Property.SCALE, property_1.Property.SORT, property_1.Property.AXIS, property_1.Property.LEGEND]; + // TODO(#226): + // write toSpec() and toShorthand() in a way that prevents outputting inapplicable scale, sort, axis / legend + for (var j = 0; j < PROPERTIES.length; j++) { + var prop = PROPERTIES[j]; + // if the property is an enum spec, return null + if (enumspec_1.isEnumSpec(encQ[prop])) + return null; + // otherwise, assign the proper to the field def + if (encQ[prop] !== undefined) { + fieldDef[prop] = encQ[prop]; + } + } + if (fieldDef.bin === false) { + // exclude bin false + delete fieldDef.bin; + } + encoding[encQ.channel] = fieldDef; + } + return encoding; + }; + /** + * Convert a query to a Vega-Lite spec if it is completed. + * @return a Vega-Lite spec if completed, null otherwise. + */ + SpecQueryModel.prototype.toSpec = function (data) { + if (enumspec_1.isEnumSpec(this._spec.mark)) + return null; + var spec = {}; + data = data || this._spec.data; + if (data) { + spec.data = data; + } + if (this._spec.transform) { + spec.transform = this._spec.transform; + } + spec.mark = this._spec.mark; + spec.encoding = this._encoding(); + if (spec.encoding === null) { + return null; + } + if (this._spec.config || this._opt.defaultSpecConfig) + spec.config = util_1.extend({}, this._opt.defaultSpecConfig, this._spec.config); + return spec; + }; + SpecQueryModel.prototype.getRankingScore = function (rankingName) { + return this._rankingScore[rankingName]; + }; + SpecQueryModel.prototype.setRankingScore = function (rankingName, score) { + this._rankingScore[rankingName] = score; + }; + return SpecQueryModel; +}()); +exports.SpecQueryModel = SpecQueryModel; +var SpecQueryModelGroup = (function () { + function SpecQueryModelGroup(name, path, items, groupBy, orderGroupBy) { + if (name === void 0) { name = ''; } + if (path === void 0) { path = ''; } + if (items === void 0) { items = []; } + if (groupBy === void 0) { groupBy = undefined; } + if (orderGroupBy === void 0) { orderGroupBy = undefined; } + this._name = name; + this._path = path; + this._items = items; + this._groupBy = groupBy; + this._orderGroupBy = orderGroupBy; + } + SpecQueryModelGroup.prototype.getTopSpecQueryModel = function () { + var topItem = this._items[0]; + if (topItem instanceof SpecQueryModelGroup) { + return topItem.getTopSpecQueryModel(); + } + else { + return topItem; + } + }; + Object.defineProperty(SpecQueryModelGroup.prototype, "name", { + get: function () { + return this._name; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SpecQueryModelGroup.prototype, "items", { + get: function () { + return this._items; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SpecQueryModelGroup.prototype, "groupBy", { + get: function () { + return this._groupBy; + }, + set: function (groupBy) { + this._groupBy = groupBy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SpecQueryModelGroup.prototype, "orderGroupBy", { + get: function () { + return this._orderGroupBy; + }, + set: function (orderGroupBy) { + this._orderGroupBy = orderGroupBy; + }, + enumerable: true, + configurable: true + }); + return SpecQueryModelGroup; +}()); +exports.SpecQueryModelGroup = SpecQueryModelGroup; + +},{"./enumspec":16,"./enumspecindex":17,"./property":21,"./query/encoding":22,"./query/shorthand":25,"./query/spec":26,"./util":36,"vega-lite/src/aggregate":42,"vega-lite/src/type":55}],20:[function(require,module,exports){ +"use strict"; +var channel_1 = require('vega-lite/src/channel'); +var util_1 = require('datalib/src/util'); +var enumspec_1 = require('./enumspec'); +var model_1 = require('./model'); +var util_2 = require('./util'); +var groupby_1 = require('./query/groupby'); +var shorthand_1 = require('./query/shorthand'); +var spec_1 = require('./query/spec'); +/** + * Registry for all possible grouping key functions. + */ +var groupRegistry = {}; +/** + * Add a grouping function to the registry. + */ +function registerKeyFn(name, keyFn) { + groupRegistry[name] = keyFn; +} +exports.registerKeyFn = registerKeyFn; +exports.FIELD = 'field'; +exports.FIELD_TRANSFORM = 'fieldTransform'; +exports.ENCODING = 'encoding'; +exports.TRANSPOSE = 'transpose'; +exports.SPEC = 'spec'; +/** + * Group the input spec query model by a key function registered in the group registry + * @return + */ +function nest(specModels, query) { + if (query.nest) { + var rootGroup_1 = new model_1.SpecQueryModelGroup(); + var groupIndex_1 = {}; + // global `includes` and `replaces` will get augmented by each level's groupBy. + // Upper level's `groupBy` will get cascaded to lower-level groupBy. + // `replace` can be overriden in a lower-level to support different grouping. + var includes_1 = []; + var replaces_1 = []; + var replacers_1 = []; + var _loop_1 = function(l) { + includes_1.push(l > 0 ? util_2.duplicate(includes_1[l - 1]) : {}); + replaces_1.push(l > 0 ? util_2.duplicate(replaces_1[l - 1]) : {}); + var groupBy = query.nest[l].groupBy; + if (util_1.isArray(groupBy)) { + groupBy.forEach(function (grpBy) { + if (groupby_1.isExtendedGroupBy(grpBy)) { + includes_1[l][grpBy.property] = true; + replaces_1[l][grpBy.property] = grpBy.replace; + } + else { + includes_1[l][grpBy] = true; + } + }); + var replaceFnIndex = util_2.keys(replaces_1[l]).reduce(function (fnIndex, prop) { + fnIndex[prop] = shorthand_1.getReplacer(replaces_1[l][prop]); + return fnIndex; + }, {}); + replacers_1.push(replaceFnIndex); + } + }; + for (var l = 0; l < query.nest.length; l++) { + _loop_1(l); + } + // With includes and replacers, now we can construct the nesting tree + specModels.forEach(function (specM) { + var path = ''; + var group = rootGroup_1; + for (var l = 0; l < query.nest.length; l++) { + var groupBy = group.groupBy = query.nest[l].groupBy; + group.orderGroupBy = query.nest[l].orderGroupBy; + var key = util_1.isArray(groupBy) ? + shorthand_1.spec(specM.specQuery, includes_1[l], replacers_1[l]) : + groupRegistry[groupBy](specM); + path += '/' + key; + if (!groupIndex_1[path]) { + groupIndex_1[path] = new model_1.SpecQueryModelGroup(key, path, []); + group.items.push(groupIndex_1[path]); + } + group = groupIndex_1[path]; + } + group.items.push(specM); + }); + return rootGroup_1; + } + else { + // no nesting, just return a flat group + return new model_1.SpecQueryModelGroup('', '', specModels); + } +} +exports.nest = nest; +registerKeyFn(exports.FIELD, function (specM) { + return specM.getEncodings().map(function (encQ) { return encQ.field; }) + .filter(function (field) { return field && field !== '*'; }) + .sort() + .join('|'); +}); +registerKeyFn(exports.FIELD_TRANSFORM, function (specM) { + return specM.getEncodings().map(function (encQ) { return shorthand_1.fieldDef(encQ); }) + .sort() + .join('|'); +}); +function channelType(channel) { + if (enumspec_1.isEnumSpec(channel)) { + return enumspec_1.SHORT_ENUM_SPEC + ''; + } + var c = channel; + switch (c) { + case channel_1.Channel.X: + case channel_1.Channel.Y: + return 'xy'; + case channel_1.Channel.ROW: + case channel_1.Channel.COLUMN: + return 'facet'; + case channel_1.Channel.COLOR: + case channel_1.Channel.SIZE: + case channel_1.Channel.SHAPE: + case channel_1.Channel.OPACITY: + return 'non-xy'; + case channel_1.Channel.TEXT: + case channel_1.Channel.DETAIL: + case channel_1.Channel.PATH: + case channel_1.Channel.ORDER: + return c + ''; + /* istanbul ignore next */ + default: + console.warn('channel type not implemented for ' + c); + return c + ''; + } +} +function stringifyStack(specM) { + var _stack = spec_1.stack(specM.specQuery); + return (!!_stack ? 'stack=' + _stack.offset + '|' : ''); +} +registerKeyFn(exports.ENCODING, function (specM) { + // mark does not matter + return stringifyStack(specM) + + specM.getEncodings().map(function (encQ) { + var fieldDef = shorthand_1.fieldDef(encQ); + return channelType(encQ.channel) + ':' + fieldDef; + }) + .sort() + .join('|'); +}); +registerKeyFn(exports.TRANSPOSE, function (specM) { + return specM.getMark() + '|' + + stringifyStack(specM) + + specM.getEncodings().map(function (encQ) { + var fieldDef = shorthand_1.fieldDef(encQ); + var channel = (encQ.channel === channel_1.Channel.X || encQ.channel === channel_1.Channel.Y) ? 'xy' : + (encQ.channel === channel_1.Channel.ROW || encQ.channel === channel_1.Channel.COLUMN) ? 'facet' : + encQ.channel; + return channel + ':' + fieldDef; + }) + .sort() + .join('|'); +}); +registerKeyFn(exports.SPEC, function (specM) { return JSON.stringify(specM.specQuery); }); + +},{"./enumspec":16,"./model":19,"./query/groupby":23,"./query/shorthand":25,"./query/spec":26,"./util":36,"datalib/src/util":8,"vega-lite/src/channel":45}],21:[function(require,module,exports){ +"use strict"; +var scale_1 = require('vega-lite/src/scale'); +(function (Property) { + Property[Property["MARK"] = 'mark'] = "MARK"; + Property[Property["FILTER"] = 'filter'] = "FILTER"; + // TODO: Sub-properties for filter + Property[Property["CALCULATE"] = 'calculate'] = "CALCULATE"; + // TODO: Sub-properties for calculate + Property[Property["FILTERINVALID"] = 'filterInvalid'] = "FILTERINVALID"; + // Layout + Property[Property["STACK"] = 'stack'] = "STACK"; + // TODO: sub parts of stack + // Encoding Properties + Property[Property["CHANNEL"] = 'channel'] = "CHANNEL"; + Property[Property["AGGREGATE"] = 'aggregate'] = "AGGREGATE"; + Property[Property["AUTOCOUNT"] = 'autoCount'] = "AUTOCOUNT"; + Property[Property["BIN"] = 'bin'] = "BIN"; + Property[Property["BIN_MAXBINS"] = 'binMaxBins'] = "BIN_MAXBINS"; + Property[Property["TIMEUNIT"] = 'timeUnit'] = "TIMEUNIT"; + Property[Property["FIELD"] = 'field'] = "FIELD"; + Property[Property["TYPE"] = 'type'] = "TYPE"; + // - Sort + Property[Property["SORT"] = 'sort'] = "SORT"; + Property[Property["SORT_FIELD"] = 'sortField'] = "SORT_FIELD"; + Property[Property["SORT_OP"] = 'sortOp'] = "SORT_OP"; + Property[Property["SORT_ORDER"] = 'sortOrder'] = "SORT_ORDER"; + // - Scale + Property[Property["SCALE"] = 'scale'] = "SCALE"; + Property[Property["SCALE_BANDSIZE"] = 'scaleBandSize'] = "SCALE_BANDSIZE"; + Property[Property["SCALE_CLAMP"] = 'scaleClamp'] = "SCALE_CLAMP"; + Property[Property["SCALE_DOMAIN"] = 'scaleDomain'] = "SCALE_DOMAIN"; + Property[Property["SCALE_EXPONENT"] = 'scaleExponent'] = "SCALE_EXPONENT"; + Property[Property["SCALE_NICE"] = 'scaleNice'] = "SCALE_NICE"; + Property[Property["SCALE_RANGE"] = 'scaleRange'] = "SCALE_RANGE"; + Property[Property["SCALE_ROUND"] = 'scaleRound'] = "SCALE_ROUND"; + Property[Property["SCALE_TYPE"] = 'scaleType'] = "SCALE_TYPE"; + Property[Property["SCALE_USERAWDOMAIN"] = 'scaleUseRawDomain'] = "SCALE_USERAWDOMAIN"; + Property[Property["SCALE_ZERO"] = 'scaleZero'] = "SCALE_ZERO"; + // - Axis + Property[Property["AXIS"] = 'axis'] = "AXIS"; + // General Axis Properties + Property[Property["AXIS_AXISCOLOR"] = 'axisAxisColor'] = "AXIS_AXISCOLOR"; + Property[Property["AXIS_AXISWIDTH"] = 'axisAxisWidth'] = "AXIS_AXISWIDTH"; + Property[Property["AXIS_LAYER"] = 'axisLayer'] = "AXIS_LAYER"; + Property[Property["AXIS_OFFSET"] = 'axisOffset'] = "AXIS_OFFSET"; + Property[Property["AXIS_ORIENT"] = 'axisOrient'] = "AXIS_ORIENT"; + // Axis_Grid Properties + Property[Property["AXIS_GRID"] = 'axisGrid'] = "AXIS_GRID"; + Property[Property["AXIS_GRIDCOLOR"] = 'axisGridColor'] = "AXIS_GRIDCOLOR"; + Property[Property["AXIS_GRIDDASH"] = 'axisGridDash'] = "AXIS_GRIDDASH"; + Property[Property["AXIS_GRIDOPACITY"] = 'axisGridOpacity'] = "AXIS_GRIDOPACITY"; + Property[Property["AXIS_GRIDWIDTH"] = 'axisGridWidth'] = "AXIS_GRIDWIDTH"; + // Axis Properties + Property[Property["AXIS_LABELS"] = 'axisLabels'] = "AXIS_LABELS"; + Property[Property["AXIS_FORMAT"] = 'axisFormat'] = "AXIS_FORMAT"; + Property[Property["AXIS_LABELANGLE"] = 'axisLabelAngle'] = "AXIS_LABELANGLE"; + Property[Property["AXIS_LABELMAXLENGTH"] = 'axisLabelMaxLength'] = "AXIS_LABELMAXLENGTH"; + Property[Property["AXIS_SHORTTIMELABELS"] = 'axisShortTimeLabels'] = "AXIS_SHORTTIMELABELS"; + // Axis_Tick Properties + Property[Property["AXIS_SUBDIVIDE"] = 'axisSubdivide'] = "AXIS_SUBDIVIDE"; + Property[Property["AXIS_TICKS"] = 'axisTicks'] = "AXIS_TICKS"; + Property[Property["AXIS_TICKCOLOR"] = 'axisTickColor'] = "AXIS_TICKCOLOR"; + Property[Property["AXIS_TICKLABELCOLOR"] = 'axisTickLabelColor'] = "AXIS_TICKLABELCOLOR"; + Property[Property["AXIS_TICKLABELFONT"] = 'axisTickLabelFont'] = "AXIS_TICKLABELFONT"; + Property[Property["AXIS_TICKLABELFONTSIZE"] = 'axisTickLabelFontSize'] = "AXIS_TICKLABELFONTSIZE"; + Property[Property["AXIS_TICKPADDING"] = 'axisTickPadding'] = "AXIS_TICKPADDING"; + Property[Property["AXIS_TICKSIZE"] = 'axisTickSize'] = "AXIS_TICKSIZE"; + Property[Property["AXIS_TICKSIZEMAJOR"] = 'axisTickSizeMajor'] = "AXIS_TICKSIZEMAJOR"; + Property[Property["AXIS_TICKSIZEMINOR"] = 'axisTickSizeMinor'] = "AXIS_TICKSIZEMINOR"; + Property[Property["AXIS_TICKSIZEEND"] = 'axisTickSizeEnd'] = "AXIS_TICKSIZEEND"; + Property[Property["AXIS_TICKWIDTH"] = 'axisTickWidth'] = "AXIS_TICKWIDTH"; + Property[Property["AXIS_VALUES"] = 'axisValues'] = "AXIS_VALUES"; + // Axis_Title Properties + Property[Property["AXIS_TITLE"] = 'axisTitle'] = "AXIS_TITLE"; + Property[Property["AXIS_TITLECOLOR"] = 'axisTitleColor'] = "AXIS_TITLECOLOR"; + Property[Property["AXIS_TITLEFONT"] = 'axisTitleFont'] = "AXIS_TITLEFONT"; + Property[Property["AXIS_TITLEFONTSIZE"] = 'axisTitleFontSize'] = "AXIS_TITLEFONTSIZE"; + Property[Property["AXIS_TITLEFONTWEIGHT"] = 'axisTitleFontWeight'] = "AXIS_TITLEFONTWEIGHT"; + Property[Property["AXIS_TITLEOFFSET"] = 'axisTitleOffset'] = "AXIS_TITLEOFFSET"; + Property[Property["AXIS_TITLEMAXLENGTH"] = 'axisTitleMaxLength'] = "AXIS_TITLEMAXLENGTH"; + Property[Property["AXIS_CHARACTERWIDTH"] = 'axisCharacterWidth'] = "AXIS_CHARACTERWIDTH"; + // - Legend + Property[Property["LEGEND"] = 'legend'] = "LEGEND"; + // General Legend Properties + Property[Property["LEGEND_ORIENT"] = 'legendOrient'] = "LEGEND_ORIENT"; + Property[Property["LEGEND_OFFSET"] = 'legendOffset'] = "LEGEND_OFFSET"; + Property[Property["LEGEND_VALUES"] = 'legendValues'] = "LEGEND_VALUES"; + // Legend_Label Properties + Property[Property["LEGEND_FORMAT"] = 'legendFormat'] = "LEGEND_FORMAT"; + Property[Property["LEGEND_LABELALIGN"] = 'legendLabelAlign'] = "LEGEND_LABELALIGN"; + Property[Property["LEGEND_LABELBASELINE"] = 'legendLabelBaseline'] = "LEGEND_LABELBASELINE"; + Property[Property["LEGEND_LABELCOLOR"] = 'legendLabelColor'] = "LEGEND_LABELCOLOR"; + Property[Property["LEGEND_LABELFONT"] = 'legendLabelFont'] = "LEGEND_LABELFONT"; + Property[Property["LEGEND_LABELFONTSIZE"] = 'legendLabelFontSize'] = "LEGEND_LABELFONTSIZE"; + Property[Property["LEGEND_SHORTTIMELABELS"] = 'legendShortTimeLabels'] = "LEGEND_SHORTTIMELABELS"; + // Legend_Symbol Properties + Property[Property["LEGEND_SYMBOLCOLOR"] = 'legendSymbolColor'] = "LEGEND_SYMBOLCOLOR"; + Property[Property["LEGEND_SYMBOLSHAPE"] = 'legendSymbolShape'] = "LEGEND_SYMBOLSHAPE"; + Property[Property["LEGEND_SYMBOLSIZE"] = 'legendSymbolSize'] = "LEGEND_SYMBOLSIZE"; + Property[Property["LEGEND_SYMBOLSTROKEWIDTH"] = 'legendSymbolStrokeWidth'] = "LEGEND_SYMBOLSTROKEWIDTH"; + // Legend_Title Properties + Property[Property["LEGEND_TITLE"] = 'legendTitle'] = "LEGEND_TITLE"; + Property[Property["LEGEND_TITLECOLOR"] = 'legendTitleColor'] = "LEGEND_TITLECOLOR"; + Property[Property["LEGEND_TITLEFONT"] = 'legendTitleFont'] = "LEGEND_TITLEFONT"; + Property[Property["LEGEND_TITLEFONTSIZE"] = 'legendTitleFontSize'] = "LEGEND_TITLEFONTSIZE"; + Property[Property["LEGEND_TITLEFONTWEIGHT"] = 'legendTitleFontWeight'] = "LEGEND_TITLEFONTWEIGHT"; +})(exports.Property || (exports.Property = {})); +var Property = exports.Property; +function hasNestedProperty(prop) { + switch (prop) { + case Property.BIN: + case Property.SCALE: + case Property.SORT: + case Property.AXIS: + case Property.LEGEND: + return true; + case Property.MARK: + case Property.FILTER: + case Property.CALCULATE: + case Property.FILTERINVALID: + case Property.STACK: + case Property.CHANNEL: + case Property.AGGREGATE: + case Property.AUTOCOUNT: + case Property.TIMEUNIT: + case Property.FIELD: + case Property.TYPE: + case Property.BIN_MAXBINS: + case Property.SCALE_BANDSIZE: + case Property.SCALE_CLAMP: + case Property.SCALE_DOMAIN: + case Property.SCALE_EXPONENT: + case Property.SCALE_NICE: + case Property.SCALE_RANGE: + case Property.SCALE_ROUND: + case Property.SCALE_TYPE: + case Property.SCALE_USERAWDOMAIN: + case Property.SCALE_ZERO: + case Property.AXIS_AXISCOLOR: + case Property.AXIS_AXISWIDTH: + case Property.AXIS_LAYER: + case Property.AXIS_OFFSET: + case Property.AXIS_ORIENT: + case Property.AXIS_GRID: + case Property.AXIS_GRIDCOLOR: + case Property.AXIS_GRIDDASH: + case Property.AXIS_GRIDOPACITY: + case Property.AXIS_GRIDWIDTH: + case Property.AXIS_LABELS: + case Property.AXIS_FORMAT: + case Property.AXIS_LABELANGLE: + case Property.AXIS_LABELMAXLENGTH: + case Property.AXIS_SHORTTIMELABELS: + case Property.AXIS_TICKS: + case Property.AXIS_SUBDIVIDE: + case Property.AXIS_TICKCOLOR: + case Property.AXIS_TICKLABELCOLOR: + case Property.AXIS_TICKLABELFONT: + case Property.AXIS_TICKLABELFONTSIZE: + case Property.AXIS_TICKPADDING: + case Property.AXIS_TICKSIZE: + case Property.AXIS_TICKSIZEMAJOR: + case Property.AXIS_TICKSIZEMINOR: + case Property.AXIS_TICKSIZEEND: + case Property.AXIS_TICKWIDTH: + case Property.AXIS_VALUES: + case Property.AXIS_TITLE: + case Property.AXIS_TITLECOLOR: + case Property.AXIS_TITLEFONT: + case Property.AXIS_TITLEFONTSIZE: + case Property.AXIS_TITLEFONTWEIGHT: + case Property.AXIS_CHARACTERWIDTH: + case Property.AXIS_TITLEMAXLENGTH: + case Property.AXIS_TITLEOFFSET: + case Property.LEGEND_ORIENT: + case Property.LEGEND_OFFSET: + case Property.LEGEND_VALUES: + case Property.LEGEND_FORMAT: + case Property.LEGEND_LABELALIGN: + case Property.LEGEND_LABELBASELINE: + case Property.LEGEND_LABELCOLOR: + case Property.LEGEND_LABELFONT: + case Property.LEGEND_LABELFONTSIZE: + case Property.LEGEND_SHORTTIMELABELS: + case Property.LEGEND_SYMBOLCOLOR: + case Property.LEGEND_SYMBOLSHAPE: + case Property.LEGEND_SYMBOLSIZE: + case Property.LEGEND_SYMBOLSTROKEWIDTH: + case Property.LEGEND_TITLE: + case Property.LEGEND_TITLECOLOR: + case Property.LEGEND_TITLEFONT: + case Property.LEGEND_TITLEFONTSIZE: + case Property.LEGEND_TITLEFONTWEIGHT: + return false; + } + /* istanbul ignore next */ + throw new Error('hasNestedProperty undefined for property ' + prop); +} +exports.hasNestedProperty = hasNestedProperty; +exports.ENCODING_PROPERTIES = [ + Property.CHANNEL, + Property.BIN, + Property.BIN_MAXBINS, + Property.TIMEUNIT, + Property.AGGREGATE, + Property.AUTOCOUNT, + Property.FIELD, + Property.TYPE, + Property.SORT, + Property.SORT_FIELD, + Property.SORT_OP, + Property.SORT_ORDER, + Property.SCALE, + Property.SCALE_BANDSIZE, + Property.SCALE_CLAMP, + Property.SCALE_DOMAIN, + Property.SCALE_EXPONENT, + Property.SCALE_NICE, + Property.SCALE_RANGE, + Property.SCALE_ROUND, + Property.SCALE_TYPE, + Property.SCALE_USERAWDOMAIN, + Property.SCALE_ZERO, + Property.AXIS, + Property.AXIS_AXISCOLOR, + Property.AXIS_AXISWIDTH, + Property.AXIS_CHARACTERWIDTH, + Property.AXIS_FORMAT, + Property.AXIS_GRID, + Property.AXIS_GRIDCOLOR, + Property.AXIS_GRIDDASH, + Property.AXIS_GRIDOPACITY, + Property.AXIS_GRIDWIDTH, + Property.AXIS_LABELANGLE, + Property.AXIS_LABELMAXLENGTH, + Property.AXIS_LABELS, + Property.AXIS_LAYER, + Property.AXIS_OFFSET, + Property.AXIS_ORIENT, + Property.AXIS_SHORTTIMELABELS, + Property.AXIS_SUBDIVIDE, + Property.AXIS_TICKCOLOR, + Property.AXIS_TICKLABELCOLOR, + Property.AXIS_TICKLABELFONT, + Property.AXIS_TICKLABELFONTSIZE, + Property.AXIS_TICKPADDING, + Property.AXIS_TICKS, + Property.AXIS_TICKSIZE, + Property.AXIS_TICKSIZEEND, + Property.AXIS_TICKSIZEMAJOR, + Property.AXIS_TICKSIZEMINOR, + Property.AXIS_TICKWIDTH, + Property.AXIS_TITLE, + Property.AXIS_TITLECOLOR, + Property.AXIS_TITLEFONT, + Property.AXIS_TITLEFONTSIZE, + Property.AXIS_TITLEFONTWEIGHT, + Property.AXIS_TITLEMAXLENGTH, + Property.AXIS_TITLEOFFSET, + Property.AXIS_VALUES, + Property.LEGEND, + Property.LEGEND_ORIENT, + Property.LEGEND_OFFSET, + Property.LEGEND_VALUES, + Property.LEGEND_FORMAT, + Property.LEGEND_LABELALIGN, + Property.LEGEND_LABELBASELINE, + Property.LEGEND_LABELCOLOR, + Property.LEGEND_LABELFONT, + Property.LEGEND_LABELFONTSIZE, + Property.LEGEND_SHORTTIMELABELS, + Property.LEGEND_SYMBOLCOLOR, + Property.LEGEND_SYMBOLSHAPE, + Property.LEGEND_SYMBOLSIZE, + Property.LEGEND_SYMBOLSTROKEWIDTH, + Property.LEGEND_TITLE, + Property.LEGEND_TITLECOLOR, + Property.LEGEND_TITLEFONT, + Property.LEGEND_TITLEFONTSIZE, + Property.LEGEND_TITLEFONTWEIGHT +]; +exports.DEFAULT_PROPERTY_PRECEDENCE = [ + // Projection + Property.TYPE, + Property.FIELD, + // TODO: Add stack and remove it from INCLUDE_ALL in shorthand + // TODO: Add filter and remove it from INCLUDE_ALL in shorthand + // TODO: Add calculate and remove it from INCLUDE_ALL in shorthand + // TODO: Add filterInvalid and remove it from INCLUDE_ALL in shorthand + // Field Transform + Property.BIN, + Property.TIMEUNIT, + Property.AGGREGATE, + Property.AUTOCOUNT, + Property.SORT, + Property.SORT_FIELD, + Property.SORT_OP, + Property.SORT_ORDER, + // Nested Transform Property + Property.BIN_MAXBINS, + // Encoding + Property.CHANNEL, + Property.MARK, + Property.SCALE, + Property.AXIS, + Property.LEGEND, + // Nested Encoding Property + // - Scale + Property.SCALE_BANDSIZE, + Property.SCALE_CLAMP, + Property.SCALE_DOMAIN, + Property.SCALE_EXPONENT, + Property.SCALE_NICE, + Property.SCALE_RANGE, + Property.SCALE_ROUND, + Property.SCALE_TYPE, + Property.SCALE_USERAWDOMAIN, + Property.SCALE_ZERO, + // - Axis + Property.AXIS_AXISCOLOR, + Property.AXIS_AXISWIDTH, + Property.AXIS_CHARACTERWIDTH, + Property.AXIS_FORMAT, + Property.AXIS_GRID, + Property.AXIS_GRIDCOLOR, + Property.AXIS_GRIDDASH, + Property.AXIS_GRIDOPACITY, + Property.AXIS_GRIDWIDTH, + Property.AXIS_LABELANGLE, + Property.AXIS_LABELMAXLENGTH, + Property.AXIS_LABELS, + Property.AXIS_LAYER, + Property.AXIS_OFFSET, + Property.AXIS_ORIENT, + Property.AXIS_SHORTTIMELABELS, + Property.AXIS_SUBDIVIDE, + Property.AXIS_TICKCOLOR, + Property.AXIS_TICKLABELCOLOR, + Property.AXIS_TICKLABELFONT, + Property.AXIS_TICKLABELFONTSIZE, + Property.AXIS_TICKPADDING, + Property.AXIS_TICKS, + Property.AXIS_TICKSIZE, + Property.AXIS_TICKSIZEEND, + Property.AXIS_TICKSIZEMAJOR, + Property.AXIS_TICKSIZEMINOR, + Property.AXIS_TICKWIDTH, + Property.AXIS_TITLE, + Property.AXIS_TITLECOLOR, + Property.AXIS_TITLEFONT, + Property.AXIS_TITLEFONTSIZE, + Property.AXIS_TITLEFONTWEIGHT, + Property.AXIS_TITLEMAXLENGTH, + Property.AXIS_TITLEOFFSET, + Property.AXIS_VALUES, + // - Legend + Property.LEGEND_ORIENT, + Property.LEGEND_OFFSET, + Property.LEGEND_VALUES, + Property.LEGEND_FORMAT, + Property.LEGEND_LABELALIGN, + Property.LEGEND_LABELBASELINE, + Property.LEGEND_LABELCOLOR, + Property.LEGEND_LABELFONT, + Property.LEGEND_LABELFONTSIZE, + Property.LEGEND_SHORTTIMELABELS, + Property.LEGEND_SYMBOLCOLOR, + Property.LEGEND_SYMBOLSHAPE, + Property.LEGEND_SYMBOLSIZE, + Property.LEGEND_SYMBOLSTROKEWIDTH, + Property.LEGEND_TITLE, + Property.LEGEND_TITLECOLOR, + Property.LEGEND_TITLEFONT, + Property.LEGEND_TITLEFONTSIZE, + Property.LEGEND_TITLEFONTWEIGHT +]; +exports.NESTED_ENCODING_PROPERTIES = [ + { + property: Property.BIN_MAXBINS, + parent: 'bin', + child: 'maxbins' + }, + { + property: Property.SORT_FIELD, + parent: 'sort', + child: 'field' + }, + { + property: Property.SORT_OP, + parent: 'sort', + child: 'op' + }, + { + property: Property.SORT_ORDER, + parent: 'sort', + child: 'order' + }, + { + property: Property.SCALE_BANDSIZE, + parent: 'scale', + child: 'bandSize' + }, + { + property: Property.SCALE_CLAMP, + parent: 'scale', + child: 'clamp' + }, + { + property: Property.SCALE_DOMAIN, + parent: 'scale', + child: 'domain' + }, + { + property: Property.SCALE_EXPONENT, + parent: 'scale', + child: 'exponent' + }, + { + property: Property.SCALE_NICE, + parent: 'scale', + child: 'nice' + }, + { + property: Property.SCALE_RANGE, + parent: 'scale', + child: 'range' + }, + { + property: Property.SCALE_ROUND, + parent: 'scale', + child: 'round' + }, + { + property: Property.SCALE_TYPE, + parent: 'scale', + child: 'type' + }, + { + property: Property.SCALE_USERAWDOMAIN, + parent: 'scale', + child: 'useRawDomain' + }, + { + property: Property.SCALE_ZERO, + parent: 'scale', + child: 'zero' + }, + { + property: Property.AXIS_AXISCOLOR, + parent: 'axis', + child: 'axisColor' + }, + { + property: Property.AXIS_AXISWIDTH, + parent: 'axis', + child: 'axisWidth' + }, + { + property: Property.AXIS_LAYER, + parent: 'axis', + child: 'layer' + }, + { + property: Property.AXIS_OFFSET, + parent: 'axis', + child: 'offset' + }, + { + property: Property.AXIS_ORIENT, + parent: 'axis', + child: 'orient' + }, + { + property: Property.AXIS_GRID, + parent: 'axis', + child: 'grid' + }, + { + property: Property.AXIS_GRIDCOLOR, + parent: 'axis', + child: 'gridColor' + }, + { + property: Property.AXIS_GRIDDASH, + parent: 'axis', + child: 'gridDash' + }, + { + property: Property.AXIS_GRIDOPACITY, + parent: 'axis', + child: 'gridOpacity' + }, + { + property: Property.AXIS_GRIDWIDTH, + parent: 'axis', + child: 'gridWidth' + }, + { + property: Property.AXIS_LABELS, + parent: 'axis', + child: 'labels' + }, + { + property: Property.AXIS_FORMAT, + parent: 'axis', + child: 'format' + }, + { + property: Property.AXIS_LABELANGLE, + parent: 'axis', + child: 'labelAngle' + }, + { + property: Property.AXIS_LABELMAXLENGTH, + parent: 'axis', + child: 'labelMaxLength' + }, + { + property: Property.AXIS_SHORTTIMELABELS, + parent: 'axis', + child: 'shortTimeLabels' + }, + { + property: Property.AXIS_TICKS, + parent: 'axis', + child: 'ticks' + }, + { + property: Property.AXIS_SUBDIVIDE, + parent: 'axis', + child: 'subdivide' + }, + { + property: Property.AXIS_TICKCOLOR, + parent: 'axis', + child: 'tickColor' + }, + { + property: Property.AXIS_TICKLABELCOLOR, + parent: 'axis', + child: 'tickLabelColor' + }, + { + property: Property.AXIS_TICKLABELFONT, + parent: 'axis', + child: 'tickLabelFont' + }, + { + property: Property.AXIS_TICKLABELFONTSIZE, + parent: 'axis', + child: 'tickLabelFontSize' + }, + { + property: Property.AXIS_TICKPADDING, + parent: 'axis', + child: 'tickPadding' + }, + { + property: Property.AXIS_TICKSIZE, + parent: 'axis', + child: 'tickSize' + }, + { + property: Property.AXIS_TICKSIZEMAJOR, + parent: 'axis', + child: 'tickSizeMajor' + }, + { + property: Property.AXIS_TICKSIZEMINOR, + parent: 'axis', + child: 'tickSizeMinor' + }, + { + property: Property.AXIS_TICKSIZEEND, + parent: 'axis', + child: 'tickSizeEnd' + }, + { + property: Property.AXIS_TICKWIDTH, + parent: 'axis', + child: 'tickWidth' + }, + { + property: Property.AXIS_VALUES, + parent: 'axis', + child: 'values' + }, + { + property: Property.AXIS_TITLE, + parent: 'axis', + child: 'title' + }, + { + property: Property.AXIS_TITLECOLOR, + parent: 'axis', + child: 'titleColor' + }, + { + property: Property.AXIS_TITLEFONT, + parent: 'axis', + child: 'titleFont' + }, + { + property: Property.AXIS_TITLEFONTSIZE, + parent: 'axis', + child: 'titleFontSize' + }, + { + property: Property.AXIS_TITLEFONTWEIGHT, + parent: 'axis', + child: 'titleFontWeight' + }, + { + property: Property.AXIS_CHARACTERWIDTH, + parent: 'axis', + child: 'characterWidth' + }, + { + property: Property.AXIS_TITLEMAXLENGTH, + parent: 'axis', + child: 'titleMaxLength' + }, + { + property: Property.AXIS_TITLEOFFSET, + parent: 'axis', + child: 'titleOffset' + }, + { + property: Property.LEGEND_ORIENT, + parent: 'legend', + child: 'orient' + }, + { + property: Property.LEGEND_OFFSET, + parent: 'legend', + child: 'offset', + }, + { + property: Property.LEGEND_VALUES, + parent: 'legend', + child: 'values' + }, + { + property: Property.LEGEND_FORMAT, + parent: 'legend', + child: 'format' + }, + { + property: Property.LEGEND_LABELALIGN, + parent: 'legend', + child: 'labelAlign' + }, + { + property: Property.LEGEND_LABELBASELINE, + parent: 'legend', + child: 'labelBaseline' + }, + { + property: Property.LEGEND_LABELFONT, + parent: 'legend', + child: 'labelFont' + }, + { + property: Property.LEGEND_LABELFONTSIZE, + parent: 'legend', + child: 'labelFontSize' + }, + { + property: Property.LEGEND_SHORTTIMELABELS, + parent: 'legend', + child: 'shortTimeLabels' + }, + { + property: Property.LEGEND_SYMBOLCOLOR, + parent: 'legend', + child: 'symbolColor' + }, + { + property: Property.LEGEND_SYMBOLSHAPE, + parent: 'legend', + child: 'symbolShape' + }, + { + property: Property.LEGEND_SYMBOLSIZE, + parent: 'legend', + child: 'symbolSize' + }, + { + property: Property.LEGEND_SYMBOLSTROKEWIDTH, + parent: 'legend', + child: 'symbolStrokeWidth' + }, + { + property: Property.LEGEND_TITLE, + parent: 'legend', + child: 'title' + }, + { + property: Property.LEGEND_TITLECOLOR, + parent: 'legend', + child: 'titleColor' + }, + { + property: Property.LEGEND_TITLEFONT, + parent: 'legend', + child: 'titleFont' + }, + { + property: Property.LEGEND_TITLEFONTSIZE, + parent: 'legend', + child: 'titleFontSize' + }, + { + property: Property.LEGEND_TITLEFONTWEIGHT, + parent: 'legend', + child: 'titleFontWeight' + } +]; +var NESTED_ENCODING_INDEX = exports.NESTED_ENCODING_PROPERTIES.reduce(function (m, nestedProp) { + m[nestedProp.property] = nestedProp; + return m; +}, {}); +var NESTED_ENCODING_PROPERTY_PARENT_INDEX = exports.NESTED_ENCODING_PROPERTIES.reduce(function (m, nestedProp) { + var parent = nestedProp.parent; + // if the parent does not exist in m yet, add it as a key in m with empty [] as value + if (!(parent in m)) { + m[parent] = []; + } + m[nestedProp.parent].push(nestedProp); + return m; +}, {}); // as Dict>); +exports.SCALE_PROPERTIES = NESTED_ENCODING_PROPERTY_PARENT_INDEX['scale'].map(function (nestedProp) { + return nestedProp.property; +}); +var ENCODING_INDEX = exports.ENCODING_PROPERTIES.reduce(function (m, prop) { + m[prop] = prop; + return m; +}, {}); +function isEncodingProperty(prop) { + return ENCODING_INDEX[prop] !== undefined; +} +exports.isEncodingProperty = isEncodingProperty; +function getNestedEncodingProperty(prop) { + return NESTED_ENCODING_INDEX[prop]; +} +exports.getNestedEncodingProperty = getNestedEncodingProperty; +function getNestedEncodingPropertyChildren(parent) { + return NESTED_ENCODING_PROPERTY_PARENT_INDEX[parent]; +} +exports.getNestedEncodingPropertyChildren = getNestedEncodingPropertyChildren; +function isNestedEncodingProperty(prop) { + return prop in NESTED_ENCODING_INDEX; +} +exports.isNestedEncodingProperty = isNestedEncodingProperty; +var SUPPORTED_SCALE_PROPERTY = [ + { + property: 'bandSize', + supportedScaleType: [ + scale_1.ScaleType.ORDINAL + ] + }, + { + property: 'clamp', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'domain', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.QUANTILE, + scale_1.ScaleType.QUANTIZE, + scale_1.ScaleType.ORDINAL, + scale_1.ScaleType.SQRT, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'exponent', + supportedScaleType: [ + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.SQRT + ] + }, + { + property: 'nice', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'range', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.QUANTILE, + scale_1.ScaleType.QUANTIZE, + scale_1.ScaleType.ORDINAL, + scale_1.ScaleType.SQRT, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'round', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.SQRT, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'useRawDomain', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.LOG, + scale_1.ScaleType.POW, + scale_1.ScaleType.QUANTILE, + scale_1.ScaleType.QUANTIZE, + scale_1.ScaleType.ORDINAL, + scale_1.ScaleType.SQRT, + scale_1.ScaleType.TIME, + scale_1.ScaleType.UTC + ] + }, + { + property: 'zero', + supportedScaleType: [ + scale_1.ScaleType.LINEAR, + scale_1.ScaleType.POW, + scale_1.ScaleType.SQRT + ] + } +]; +exports.SUPPORTED_SCALE_PROPERTY_INDEX = SUPPORTED_SCALE_PROPERTY.reduce(function (m, scaleProp) { + var prop = scaleProp.property; + m[prop] = scaleProp.supportedScaleType; + return m; +}, {}); + +},{"vega-lite/src/scale":51}],22:[function(require,module,exports){ +"use strict"; +var scale_1 = require('vega-lite/src/scale'); +var timeunit_1 = require('vega-lite/src/timeunit'); +var type_1 = require('vega-lite/src/type'); +var enumspec_1 = require('../enumspec'); +var util_1 = require('../util'); +function isDimension(encQ) { + return util_1.contains([type_1.Type.NOMINAL, type_1.Type.ORDINAL], encQ.type) || + (!enumspec_1.isEnumSpec(encQ.bin) && !!encQ.bin) || + (!enumspec_1.isEnumSpec(encQ.timeUnit) && !!encQ.timeUnit); // surely T type + // TODO For T type, take scale type of the timeUnit into account +} +exports.isDimension = isDimension; +function isMeasure(encQ) { + return (encQ.type === type_1.Type.QUANTITATIVE && !encQ.bin) || + (encQ.type === type_1.Type.TEMPORAL && !encQ.timeUnit); + // TODO For T type, take scale type of the timeUnit into account +} +exports.isMeasure = isMeasure; +/** + * Returns the true scale type of an encoding. + * @returns {ScaleType} If the scale type was not specified, it is inferred from the encoding's Type. + * @returns {undefined} If the scale type was not specified and Type (or TimeUnit if applicable) is an EnumSpec, there is no clear scale type + */ +function scaleType(encQ) { + var scale = encQ.scale === true || encQ.scale === enumspec_1.SHORT_ENUM_SPEC ? {} : encQ.scale; + var type = encQ.type; + var timeUnit = encQ.timeUnit; + if (scale && scale.type !== undefined) { + return scale.type; + } + if (enumspec_1.isEnumSpec(type)) { + return undefined; + } + /* istanbul ignore else */ + if (type === type_1.Type.QUANTITATIVE) { + return scale_1.ScaleType.LINEAR; + } + else if (type === type_1.Type.ORDINAL || type === type_1.Type.NOMINAL) { + return scale_1.ScaleType.ORDINAL; + } + else if (type === type_1.Type.TEMPORAL) { + if (timeUnit !== undefined) { + if (enumspec_1.isEnumSpec(timeUnit)) { + return undefined; + } + return timeunit_1.defaultScaleType(timeUnit); + } + else { + return scale_1.ScaleType.TIME; + } + } + else { + throw new Error('Unsupported type: ' + type + ' in scaleType'); + } +} +exports.scaleType = scaleType; + +},{"../enumspec":16,"../util":36,"vega-lite/src/scale":51,"vega-lite/src/timeunit":54,"vega-lite/src/type":55}],23:[function(require,module,exports){ +"use strict"; +var util_1 = require('datalib/src/util'); +var util_2 = require('../util'); +exports.REPLACE_BLANK_FIELDS = { '*': '' }; +exports.REPLACE_XY_CHANNELS = { x: 'xy', y: 'xy' }; +exports.REPLACE_FACET_CHANNELS = { row: 'facet', column: 'facet' }; +exports.REPLACE_MARK_STYLE_CHANNELS = { color: 'style', opacity: 'style', shape: 'style', size: 'style' }; +function isExtendedGroupBy(g) { + return util_1.isObject(g) && !!g['property']; +} +exports.isExtendedGroupBy = isExtendedGroupBy; +function toString(groupBy) { + if (util_1.isArray(groupBy)) { + return groupBy.map(function (g) { + if (isExtendedGroupBy(g)) { + if (g.replace) { + var replaceIndex = util_2.keys(g.replace).reduce(function (index, valFrom) { + var valTo = g.replace[valFrom]; + (index[valTo] = index[valTo] || []).push(valFrom); + return index; + }, {}); + return g.property + '[' + util_2.keys(replaceIndex).map(function (valTo) { + var valsFrom = replaceIndex[valTo].sort(); + return valsFrom.join(',') + '=>' + valTo; + }).join(';') + ']'; + } + return g.property; + } + return g; + }).join(','); + } + else { + return groupBy; + } +} +exports.toString = toString; + +},{"../util":36,"datalib/src/util":8}],24:[function(require,module,exports){ +"use strict"; +var config_1 = require('../config'); +var generate_1 = require('../generate'); +var nest_1 = require('../nest'); +var ranking_1 = require('../ranking/ranking'); +var util_1 = require('../util'); +exports.encoding = require('./encoding'); +exports.groupBy = require('./groupby'); +exports.shorthand = require('./shorthand'); +exports.spec = require('./spec'); +exports.transform = require('./transform'); +function query(q, schema, config) { + // 1. Normalize non-nested `groupBy` to always have `groupBy` inside `nest` + // and merge config with the following precedence + // query.config > config > DEFAULT_QUERY_CONFIG + q = util_1.extend({}, normalize(q), { + config: util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, config, q.config) + }); + // 2. Generate + var answerSet = generate_1.generate(q.spec, schema, q.config); + var nestedAnswerSet = nest_1.nest(answerSet, q); + var result = ranking_1.rank(nestedAnswerSet, q, schema, 0); + return { + query: q, + result: result + }; +} +exports.query = query; +/** + * Normalize the non-nested version of the query to a standardize nested + */ +function normalize(q) { + if (q.groupBy) { + var nest_2 = { + groupBy: q.groupBy + }; + if (q.orderBy) { + nest_2.orderGroupBy = q.orderBy; + } + var normalizedQ = { + spec: util_1.duplicate(q.spec), + nest: [nest_2], + }; + if (q.chooseBy) { + normalizedQ.chooseBy = q.chooseBy; + } + if (q.config) { + normalizedQ.config = q.config; + } + return normalizedQ; + } + return util_1.duplicate(q); // We will cause side effect to q.spec in SpecQueryModel.build +} +exports.normalize = normalize; + +},{"../config":9,"../generate":18,"../nest":20,"../ranking/ranking":33,"../util":36,"./encoding":22,"./groupby":23,"./shorthand":25,"./spec":26,"./transform":27}],25:[function(require,module,exports){ +"use strict"; +var filter_1 = require('vega-lite/src/filter'); +var type_1 = require('vega-lite/src/type'); +var util_1 = require('datalib/src/util'); +var spec_1 = require('./spec'); +var enumspec_1 = require('../enumspec'); +var property_1 = require('../property'); +var util_2 = require('../util'); +function getReplacer(replace) { + return function (s) { + if (replace[s] !== undefined) { + return replace[s]; + } + return s; + }; +} +exports.getReplacer = getReplacer; +function value(v, replace) { + if (enumspec_1.isEnumSpec(v)) { + return enumspec_1.SHORT_ENUM_SPEC; + } + if (replace) { + return replace(v); + } + return v; +} +exports.value = value; +exports.INCLUDE_ALL = +// TODO: remove manual STACK, FILTER, CALCULATE concat once we really support enumerating it. +property_1.DEFAULT_PROPERTY_PRECEDENCE.concat([property_1.Property.CALCULATE, property_1.Property.FILTER, property_1.Property.FILTERINVALID, property_1.Property.STACK]) + .reduce(function (m, prop) { + m[prop] = true; + return m; +}, {}); +function vlSpec(vlspec, include, replace) { + if (include === void 0) { include = exports.INCLUDE_ALL; } + if (replace === void 0) { replace = {}; } + var specQ = spec_1.fromSpec(vlspec); + return spec(specQ); +} +exports.vlSpec = vlSpec; +/** + * Returns a shorthand for a spec query + * @param specQ a spec query + * @param include Dict Set listing property types (key) to be included in the shorthand + * @param replace Dictionary of replace function for values of a particular property type (key) + */ +function spec(specQ, include, replace) { + if (include === void 0) { include = exports.INCLUDE_ALL; } + if (replace === void 0) { replace = {}; } + var parts = []; + if (include[property_1.Property.MARK]) { + parts.push(value(specQ.mark, replace[property_1.Property.MARK])); + } + if (specQ.transform) { + if (include[property_1.Property.CALCULATE]) { + if (specQ.transform.calculate !== undefined) { + parts.push('calculate:' + calculate(specQ.transform.calculate)); + } + } + if (include[property_1.Property.FILTER]) { + if (specQ.transform.filter !== undefined) { + parts.push('filter:' + filter(specQ.transform.filter)); + } + } + if (include[property_1.Property.FILTERINVALID]) { + if (specQ.transform.filterInvalid !== undefined) { + parts.push('filterInvalid:' + specQ.transform.filterInvalid); + } + } + } + // TODO: extract this to its own stack method + if (include[property_1.Property.STACK]) { + var _stack = spec_1.stack(specQ); + if (_stack) { + // TODO: Refactor this once we have child stack property. + // Exclude type since we don't care about type in stack + var includeExceptType = util_2.extend({}, include, { type: false }); + var field = fieldDef(_stack.fieldEncQ, includeExceptType, replace); + var groupby = fieldDef(_stack.groupByEncQ, includeExceptType, replace); + parts.push('stack={field:' + field + ',' + + (groupby ? 'by:' + groupby + ',' : '') + + 'offset:' + _stack.offset + '}'); + } + } + parts.push(specQ.encodings.reduce(function (encQs, encQ) { + // Exclude encoding mapping with autoCount=false as they are basically disabled. + if (encQ.autoCount !== false) { + var str = encoding(encQ, include, replace); + if (str) { + encQs.push(str); + } + } + return encQs; + }, []) + .sort() // sort at the end to ignore order + .join('|')); + return parts.join('|'); +} +exports.spec = spec; +function filter(_filter) { + if (_filter instanceof Array) { + var filters = _filter.map(filter); + return filters.length > 1 ? '(' + filters.join(') && (') + ')' : filters[0]; + } + else if (typeof _filter === 'string') { + return _filter; + } + else { + return filter_1.expression(_filter); + } +} +exports.filter = filter; +function calculate(formulaArr) { + return formulaArr.map(function (calculateItem) { + return "{" + calculateItem.field + ":" + calculateItem.expr + "}"; + }).join(','); +} +exports.calculate = calculate; +/** + * Returns a shorthand for an encoding query + * @param encQ an encoding query + * @param include Dict Set listing property types (key) to be included in the shorthand + * @param replace Dictionary of replace function for values of a particular property type (key) + */ +function encoding(encQ, include, replace) { + if (include === void 0) { include = exports.INCLUDE_ALL; } + if (replace === void 0) { replace = {}; } + var parts = []; + if (include[property_1.Property.CHANNEL]) { + parts.push(value(encQ.channel, replace[property_1.Property.CHANNEL])); + } + var fieldDefStr = fieldDef(encQ, include, replace); + if (fieldDefStr) { + parts.push(fieldDefStr); + } + return parts.join(':'); +} +exports.encoding = encoding; +/** + * Returns a field definiton shorthand for an encoding query + * @param encQ an encoding query + * @param include Dict Set listing property types (key) to be included in the shorthand + * @param replace Dictionary of replace function for values of a particular property type (key) + */ +function fieldDef(encQ, include, replace) { + if (include === void 0) { include = exports.INCLUDE_ALL; } + if (replace === void 0) { replace = {}; } + var fn = null; + /** Encoding properties e.g., Scale, Axis, Legend */ + var props = []; + if (include[property_1.Property.AGGREGATE] && encQ.autoCount === false) { + return '-'; + } + else if (include[property_1.Property.AGGREGATE] && encQ.aggregate && !enumspec_1.isEnumSpec(encQ.aggregate)) { + fn = value(encQ.aggregate, replace[property_1.Property.AGGREGATE]); + } + else if (include[property_1.Property.AGGREGATE] && encQ.autoCount && !enumspec_1.isEnumSpec(encQ.autoCount)) { + fn = value('count', replace[property_1.Property.AGGREGATE]); + ; + } + else if (include[property_1.Property.TIMEUNIT] && encQ.timeUnit && !enumspec_1.isEnumSpec(encQ.timeUnit)) { + fn = value(encQ.timeUnit, replace[property_1.Property.TIMEUNIT]); + } + else if (include[property_1.Property.BIN] && encQ.bin && !enumspec_1.isEnumSpec(encQ.bin)) { + fn = 'bin'; + if (include[property_1.Property.BIN_MAXBINS] && encQ.bin['maxbins']) { + props.push({ + key: 'maxbins', + value: value(encQ.bin['maxbins'], replace[property_1.Property.BIN_MAXBINS]) + }); + } + } + else { + for (var _i = 0, _a = [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT, property_1.Property.TIMEUNIT, property_1.Property.BIN]; _i < _a.length; _i++) { + var prop = _a[_i]; + if (include[prop] && encQ[prop] && enumspec_1.isEnumSpec(encQ[prop])) { + fn = enumspec_1.SHORT_ENUM_SPEC + ''; + break; + } + } + } + // Scale + // TODO(#226): + // write toSpec() and toShorthand() in a way that prevents outputting inapplicable scale, sort, axis / legend + var _loop_1 = function(nestedPropParent) { + if (include[nestedPropParent]) { + if (encQ[nestedPropParent] && !enumspec_1.isEnumSpec(encQ[nestedPropParent])) { + // `sort` can be a string (ascending/descending). + if (util_1.isString(encQ[nestedPropParent])) { + props.push({ + key: nestedPropParent + '', + value: encQ[nestedPropParent] + }); + } + else { + var nestedProps = property_1.getNestedEncodingPropertyChildren(nestedPropParent); + var nestedPropChildren = nestedProps.reduce(function (p, nestedProp) { + if (include[nestedProp.property] && encQ[nestedPropParent][nestedProp.child] !== undefined) { + p[nestedProp.child] = value(encQ[nestedPropParent][nestedProp.child], replace[nestedProp.property]); + } + return p; + }, {}); + if (util_2.keys(nestedPropChildren).length > 0) { + props.push({ + key: nestedPropParent + '', + value: JSON.stringify(nestedPropChildren) + }); + } + } + } + else if (encQ[nestedPropParent] === false || encQ[nestedPropParent] === null) { + // `scale`, `axis`, `legend` can be false/null. + props.push({ + key: nestedPropParent + '', + value: false + }); + } + } + }; + for (var _b = 0, _c = [property_1.Property.SCALE, property_1.Property.SORT, property_1.Property.AXIS, property_1.Property.LEGEND]; _b < _c.length; _b++) { + var nestedPropParent = _c[_b]; + _loop_1(nestedPropParent); + } + // field + var fieldAndParams = include[property_1.Property.FIELD] ? value(encQ.field || '*', replace[property_1.Property.FIELD]) : '...'; + // type + if (include[property_1.Property.TYPE]) { + var typeShort = ((encQ.type || type_1.Type.QUANTITATIVE) + '').substr(0, 1); + fieldAndParams += ',' + value(typeShort, replace[property_1.Property.TYPE]); + } + // encoding properties + fieldAndParams += props.map(function (p) { return ',' + p.key + '=' + p.value; }).join(''); + return (fn ? fn + '(' + fieldAndParams + ')' : fieldAndParams); +} +exports.fieldDef = fieldDef; + +},{"../enumspec":16,"../property":21,"../util":36,"./spec":26,"datalib/src/util":8,"vega-lite/src/filter":49,"vega-lite/src/type":55}],26:[function(require,module,exports){ +"use strict"; +var channel_1 = require('vega-lite/src/channel'); +var mark_1 = require('vega-lite/src/mark'); +var stack_1 = require('vega-lite/src/stack'); +var enumspec_1 = require('../enumspec'); +var property_1 = require('../property'); +var util_1 = require('../util'); +/** + * Convert a Vega-Lite's ExtendedUnitSpec into a CompassQL's SpecQuery + * @param {ExtendedUnitSpec} spec + * @returns + */ +function fromSpec(spec) { + return util_1.extend(spec.data ? { data: spec.data } : {}, spec.transform ? { transform: spec.transform } : {}, { + mark: spec.mark, + encodings: util_1.keys(spec.encoding).map(function (channel) { + var encQ = { channel: channel }; + var channelDef = spec.encoding[channel]; + for (var _i = 0, ENCODING_PROPERTIES_1 = property_1.ENCODING_PROPERTIES; _i < ENCODING_PROPERTIES_1.length; _i++) { + var prop = ENCODING_PROPERTIES_1[_i]; + if (!property_1.isNestedEncodingProperty(prop) && channelDef[prop] !== undefined) { + encQ[prop] = channelDef[prop]; + } + // Currently scale, axis, legend only support boolean, but not null. + // Therefore convert null to false. + if (util_1.contains([property_1.Property.SCALE, property_1.Property.AXIS, property_1.Property.LEGEND], prop) && encQ[prop] === null) { + encQ[prop] = false; + } + } + return encQ; + }) + }, spec.config ? { config: spec.config } : {}); +} +exports.fromSpec = fromSpec; +function isAggregate(specQ) { + return util_1.some(specQ.encodings, function (encQ) { + return (!enumspec_1.isEnumSpec(encQ.aggregate) && !!encQ.aggregate) || encQ.autoCount === true; + }); +} +exports.isAggregate = isAggregate; +/** + * @return the stack offset type for the specQuery + */ +function stack(specQ) { + var config = specQ.config; + var stacked = (config && config.mark) ? config.mark.stacked : undefined; + // Should not have stack explicitly disabled + if (util_1.contains([stack_1.StackOffset.NONE, null, false], stacked)) { + return null; + } + // Should have stackable mark + if (!util_1.contains([mark_1.BAR, mark_1.AREA], specQ.mark)) { + return null; + } + // Should be aggregate plot + if (!isAggregate(specQ)) { + return null; + } + var stackByChannels = specQ.encodings.reduce(function (sc, encQ) { + if (util_1.contains(channel_1.STACK_GROUP_CHANNELS, encQ.channel) && !encQ.aggregate) { + sc.push(encQ.channel); + } + return sc; + }, []); + if (stackByChannels.length === 0) { + return null; + } + // Has only one aggregate axis + var xEncQ = specQ.encodings.reduce(function (f, encQ) { + return f || (encQ.channel === channel_1.Channel.X ? encQ : null); + }, null); + var yEncQ = specQ.encodings.reduce(function (f, encQ) { + return f || (encQ.channel === channel_1.Channel.Y ? encQ : null); + }, null); + var xIsAggregate = !!xEncQ && (!!xEncQ.aggregate || !!xEncQ.autoCount); + var yIsAggregate = !!yEncQ && (!!yEncQ.aggregate || !!yEncQ.autoCount); + if (xIsAggregate !== yIsAggregate) { + return { + groupbyChannel: xIsAggregate ? (!!yEncQ ? channel_1.Y : null) : (!!xEncQ ? channel_1.X : null), + groupByEncQ: xIsAggregate ? yEncQ : xEncQ, + fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y, + fieldEncQ: xIsAggregate ? xEncQ : yEncQ, + stackByChannels: stackByChannels, + offset: stacked || stack_1.StackOffset.ZERO + }; + } + return null; +} +exports.stack = stack; + +},{"../enumspec":16,"../property":21,"../util":36,"vega-lite/src/channel":45,"vega-lite/src/mark":50,"vega-lite/src/stack":53}],27:[function(require,module,exports){ +"use strict"; + +},{}],28:[function(require,module,exports){ +"use strict"; +var aggregate_1 = require('vega-lite/src/aggregate'); +var type_1 = require('vega-lite/src/type'); +var util_1 = require('../util'); +var encoding_1 = require('../query/encoding'); +exports.name = 'aggregationQuality'; +function score(specM, schema, opt) { + var feature = aggregationQualityFeature(specM, schema, opt); + return { + score: feature.score, + features: [feature] + }; +} +exports.score = score; +function aggregationQualityFeature(specM, schema, opt) { + var encodings = specM.getEncodings(); + if (specM.isAggregate()) { + var isRawContinuous = function (encQ) { + return (encQ.type === type_1.Type.QUANTITATIVE && !encQ.bin && !encQ.aggregate && !encQ.autoCount) || + (encQ.type === type_1.Type.TEMPORAL && !encQ.timeUnit); + }; + if (util_1.some(encodings, isRawContinuous)) { + // These are plots that pollute continuous fields as dimension. + // They are often intermediate visualizations rather than what users actually want. + return { + type: exports.name, + score: 0.1, + feature: 'Aggregate with raw continuous' + }; + } + if (util_1.some(encodings, encoding_1.isDimension)) { + if (util_1.some(encodings, function (encQ) { return encQ.aggregate === aggregate_1.AggregateOp.COUNT; })) { + // If there is count, we might add additional count field, making it a little less simple + // then when we just apply aggregate to Q field + return { + type: exports.name, + score: 0.8, + feature: 'Aggregate with count' + }; + } + return { + type: exports.name, + score: 0.9, + feature: 'Aggregate without count' + }; + } + // no dimension -- often not very useful + return { + type: exports.name, + score: 0.3, + feature: 'Aggregate without dimension' + }; + } + else { + if (util_1.some(encodings, encoding_1.isMeasure)) { + // raw plots with measure -- simplest of all! + return { + type: exports.name, + score: 1, + feature: 'Raw with measure' + }; + } + // raw plots with no measure -- often a lot of occlusion + return { + type: exports.name, + score: 0.2, + feature: 'Raw without measure' + }; + } +} + +},{"../query/encoding":22,"../util":36,"vega-lite/src/aggregate":42,"vega-lite/src/type":55}],29:[function(require,module,exports){ +"use strict"; +var channel_1 = require('vega-lite/src/channel'); +var config_1 = require('../../config'); +var shorthand_1 = require('../../query/shorthand'); +var util_1 = require('../../util'); +var effectiveness_1 = require('./effectiveness'); +var type_1 = require('./type'); +/** + * Field Type (with Bin and TimeUnit) and Channel Score (Cleveland / Mackinlay based) + */ +var TypeChannelScore; +(function (TypeChannelScore) { + TypeChannelScore.TYPE_CHANNEL = 'typeChannel'; + function init() { + var SCORE = {}; + var ORDERED_TYPE_CHANNEL_SCORE = { + x: 0, + y: 0, + size: -0.55, + color: -0.6, + opacity: -0.75, + text: -0.775, + row: -0.8, + column: -0.8, + shape: -2.5, + detail: -3 + }; + [type_1.Q, type_1.BIN_Q, type_1.T, type_1.TIMEUNIT_T, type_1.TIMEUNIT_O, type_1.O].forEach(function (type) { + util_1.keys(ORDERED_TYPE_CHANNEL_SCORE).forEach(function (channel) { + SCORE[featurize(type, channel)] = ORDERED_TYPE_CHANNEL_SCORE[channel]; + }); + }); + // Penalize row/column for bin quantitative / timeUnit_temporal / O less + [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.TIMEUNIT_O, type_1.O].forEach(function (type) { + [channel_1.Channel.ROW, channel_1.Channel.COLUMN].forEach(function (channel) { + SCORE[featurize(type, channel)] += 0.15; + }); + }); + var NOMINAL_TYPE_CHANNEL_SCORE = { + x: 0, + y: 0, + color: -0.6, + shape: -0.65, + row: -0.7, + column: -0.7, + text: -0.8, + size: -1.8, + detail: -2, + opacity: -2.1 + }; + util_1.keys(NOMINAL_TYPE_CHANNEL_SCORE).forEach(function (channel) { + SCORE[featurize(type_1.N, channel)] = NOMINAL_TYPE_CHANNEL_SCORE[channel]; + }); + return SCORE; + } + TypeChannelScore.init = init; + function featurize(type, channel) { + return type + '_' + channel; + } + TypeChannelScore.featurize = featurize; + function getScore(specM, schema, opt) { + var encodingQueryByField = specM.getEncodings().reduce(function (m, encQ) { + var fieldKey = shorthand_1.fieldDef(encQ); + (m[fieldKey] = m[fieldKey] || []).push(encQ); + return m; + }, {}); + var features = []; + util_1.forEach(encodingQueryByField, function (encQs) { + var bestFieldFeature = encQs.reduce(function (best, encQ) { + var type = type_1.getExtendedType(encQ); + var feature = featurize(type, encQ.channel); + var featureScore = effectiveness_1.getFeatureScore(TypeChannelScore.TYPE_CHANNEL, feature); + if (best === null || featureScore.score > best.score) { + return featureScore; + } + return best; + }, null); + features.push(bestFieldFeature); + // TODO: add plus for over-encoding of one field + }); + return features; + } + TypeChannelScore.getScore = getScore; +})(TypeChannelScore = exports.TypeChannelScore || (exports.TypeChannelScore = {})); +var PreferredAxisScore; +(function (PreferredAxisScore) { + PreferredAxisScore.PREFERRED_AXIS = 'preferredAxis'; + // FIXME support doing this at runtime + function init(opt) { + if (opt === void 0) { opt = {}; } + opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt); + var score = {}; + var preferredAxes = [{ + feature: type_1.BIN_Q, + opt: 'preferredBinAxis' + }, { + feature: type_1.T, + opt: 'preferredTemporalAxis' + }, { + feature: type_1.TIMEUNIT_T, + opt: 'preferredTemporalAxis' + }, { + feature: type_1.TIMEUNIT_O, + opt: 'preferredTemporalAxis' + }, { + feature: type_1.O, + opt: 'preferredOrdinalAxis' + }, { + feature: type_1.N, + opt: 'preferredNominalAxis' + }]; + preferredAxes.forEach(function (preferredAxis) { + if (opt[preferredAxis.opt] === channel_1.Channel.X) { + // penalize the other axis + score[preferredAxis.feature + '_' + channel_1.Channel.Y] = -0.01; + } + else if (opt[preferredAxis.opt] === channel_1.Channel.Y) { + // penalize the other axis + score[preferredAxis.feature + '_' + channel_1.Channel.X] = -0.01; + } + }); + return score; + } + PreferredAxisScore.init = init; + function featurize(type, channel) { + return type + '_' + channel; + } + PreferredAxisScore.featurize = featurize; + function getScore(specM, schema, opt) { + return specM.getEncodings().reduce(function (features, encQ) { + var type = type_1.getExtendedType(encQ); + var feature = featurize(type, encQ.channel); + var featureScore = effectiveness_1.getFeatureScore(PreferredAxisScore.PREFERRED_AXIS, feature); + if (featureScore) { + features.push(featureScore); + } + return features; + }, []); + } + PreferredAxisScore.getScore = getScore; +})(PreferredAxisScore = exports.PreferredAxisScore || (exports.PreferredAxisScore = {})); +var PreferredFacetScore; +(function (PreferredFacetScore) { + PreferredFacetScore.PREFERRED_FACET = 'preferredFacet'; + // FIXME support doing this at runtime + function init(opt) { + opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt); + var score = {}; + if (opt.preferredFacet === channel_1.Channel.ROW) { + // penalize the other axis + score[channel_1.Channel.COLUMN] = -0.01; + } + else if (opt.preferredFacet === channel_1.Channel.COLUMN) { + // penalize the other axis + score[channel_1.Channel.ROW] = -0.01; + } + return score; + } + PreferredFacetScore.init = init; + function getScore(specM, schema, opt) { + return specM.getEncodings().reduce(function (features, encQ) { + var featureScore = effectiveness_1.getFeatureScore(PreferredFacetScore.PREFERRED_FACET, encQ.channel); + if (featureScore) { + features.push(featureScore); + } + return features; + }, []); + } + PreferredFacetScore.getScore = getScore; +})(PreferredFacetScore = exports.PreferredFacetScore || (exports.PreferredFacetScore = {})); +var MarkChannelScore; +(function (MarkChannelScore) { + // Penalty for certain channel for certain mark types + MarkChannelScore.MARK_CHANNEL = 'markChannel'; + function init() { + return { + bar_size: -2, + tick_size: -2 + }; + } + MarkChannelScore.init = init; + function getScore(specM, schema, opt) { + var mark = specM.getMark(); + return specM.getEncodings().reduce(function (featureScores, encQ) { + var feature = mark + '_' + encQ.channel; + var featureScore = effectiveness_1.getFeatureScore(MarkChannelScore.MARK_CHANNEL, feature); + if (featureScore) { + featureScores.push(featureScore); + } + return featureScores; + }, []); + } + MarkChannelScore.getScore = getScore; +})(MarkChannelScore = exports.MarkChannelScore || (exports.MarkChannelScore = {})); +/** + * Penalize if facet channels are the only dimensions + */ +var DimensionScore; +(function (DimensionScore) { + DimensionScore.DIMENSION = 'dimension'; + function init() { + return { + row: -2, + column: -2, + color: 0, + opacity: 0, + size: 0, + shape: 0 + }; + } + DimensionScore.init = init; + function getScore(specM, schema, opt) { + if (specM.isAggregate()) { + specM.getEncodings().reduce(function (maxFScore, encQ) { + if (!encQ.aggregate && !encQ.autoCount) { + var featureScore = effectiveness_1.getFeatureScore(DimensionScore.DIMENSION, encQ.channel + ''); + if (featureScore.score > maxFScore.score) { + return featureScore; + } + } + return maxFScore; + }, { type: DimensionScore.DIMENSION, feature: 'No Dimension', score: -5 }); + } + return []; + } + DimensionScore.getScore = getScore; +})(DimensionScore = exports.DimensionScore || (exports.DimensionScore = {})); + +},{"../../config":9,"../../query/shorthand":25,"../../util":36,"./effectiveness":30,"./type":32,"vega-lite/src/channel":45}],30:[function(require,module,exports){ +"use strict"; +var channel_1 = require('./channel'); +var mark_1 = require('./mark'); +exports.FEATURE_INDEX = {}; +var FEATURE_FACTORIES = []; +function getFeatureScore(type, feature) { + var score = exports.FEATURE_INDEX[type][feature]; + if (score !== undefined) { + return { + score: score, + type: type, + feature: feature + }; + } + return null; +} +exports.getFeatureScore = getFeatureScore; +function addFeatureFactory(factory) { + FEATURE_FACTORIES.push(factory); + exports.FEATURE_INDEX[factory.type] = factory.init(); +} +exports.addFeatureFactory = addFeatureFactory; +addFeatureFactory({ + type: channel_1.TypeChannelScore.TYPE_CHANNEL, + init: channel_1.TypeChannelScore.init, + getScore: channel_1.TypeChannelScore.getScore +}); +addFeatureFactory({ + type: channel_1.PreferredAxisScore.PREFERRED_AXIS, + init: channel_1.PreferredAxisScore.init, + getScore: channel_1.PreferredAxisScore.getScore +}); +addFeatureFactory({ + type: channel_1.PreferredFacetScore.PREFERRED_FACET, + init: channel_1.PreferredFacetScore.init, + getScore: channel_1.PreferredFacetScore.getScore +}); +addFeatureFactory({ + type: channel_1.MarkChannelScore.MARK_CHANNEL, + init: channel_1.MarkChannelScore.init, + getScore: channel_1.MarkChannelScore.getScore +}); +addFeatureFactory({ + type: mark_1.MarkScore.MARK_SCORE, + init: mark_1.MarkScore.init, + getScore: mark_1.MarkScore.getScore +}); +// TODO: x/y, row/column preference +// TODO: stacking +// TODO: Channel, Cardinality +// TODO: Penalize over encoding +function default_1(specM, schema, opt) { + var features = FEATURE_FACTORIES.reduce(function (f, factory) { + var scores = factory.getScore(specM, schema, opt); + return f.concat(scores); + }, []); + return { + score: features.reduce(function (s, f) { + return s + f.score; + }, 0), + features: features + }; +} +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = default_1; + +},{"./channel":29,"./mark":31}],31:[function(require,module,exports){ +"use strict"; +var channel_1 = require('vega-lite/src/channel'); +var mark_1 = require('vega-lite/src/mark'); +var util_1 = require('../../util'); +var effectiveness_1 = require('./effectiveness'); +var type_1 = require('./type'); +var MarkScore; +(function (MarkScore) { + MarkScore.MARK_SCORE = 'markScore'; + function featurize(xType, yType, hasOcclusion, mark) { + return xType + '_' + yType + '_' + hasOcclusion + '_' + mark; + } + MarkScore.featurize = featurize; + function init() { + var MEASURES = [type_1.Q, type_1.T]; + var DISCRETE = [type_1.BIN_Q, type_1.TIMEUNIT_O, type_1.O, type_1.N]; + var DISCRETE_OR_NONE = DISCRETE.concat([type_1.NONE]); + var SCORE = {}; + // QxQ + MEASURES.forEach(function (xType) { + MEASURES.forEach(function (yType) { + // has occlusion + var occludedQQMark = { + point: 0, + text: -0.2, + tick: -0.5, + rect: -1, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + util_1.forEach(occludedQQMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + }); + // no occlusion + // TODO: possible to use connected scatter plot + var noOccludedQQMark = { + point: 0, + text: -0.2, + tick: -0.5, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + util_1.forEach(noOccludedQQMark, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + }); + }); + }); + // DxQ, QxD + MEASURES.forEach(function (xType) { + // HAS OCCLUSION + DISCRETE_OR_NONE.forEach(function (yType) { + var occludedDimensionMeasureMark = { + tick: 0, + point: -0.2, + text: -0.5, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + util_1.forEach(occludedDimensionMeasureMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + // also do the inverse + var feature2 = featurize(yType, xType, true, mark); + SCORE[feature2] = score; + }); + }); + [type_1.TIMEUNIT_T].forEach(function (yType) { + var occludedDimensionMeasureMark = { + // For Time Dimension with time scale, tick is not good + point: 0, + text: -0.5, + tick: -1, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + util_1.forEach(occludedDimensionMeasureMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + // also do the inverse + var feature2 = featurize(yType, xType, true, mark); + SCORE[feature2] = score; + }); + }); + // NO OCCLUSION + [type_1.NONE, type_1.N, type_1.O].forEach(function (yType) { + var noOccludedQxN = { + bar: 0, + point: -0.2, + tick: -0.25, + text: -0.3, + // Line / Area can mislead trend for N + line: -2, + area: -2, + // Non-sense to use rule here + rule: -2.5 + }; + util_1.forEach(noOccludedQxN, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + // also do the inverse + var feature2 = featurize(yType, xType, false, mark); + SCORE[feature2] = score; + }); + }); + [type_1.BIN_Q].forEach(function (yType) { + var noOccludedQxBinQ = { + bar: 0, + point: -0.2, + tick: -0.25, + text: -0.3, + // Line / Area isn't the best fit for bin + line: -0.5, + area: -0.5, + // Non-sense to use rule here + rule: -2.5 + }; + util_1.forEach(noOccludedQxBinQ, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + // also do the inverse + var feature2 = featurize(yType, xType, false, mark); + SCORE[feature2] = score; + }); + }); + [type_1.TIMEUNIT_T, type_1.TIMEUNIT_O].forEach(function (yType) { + // For aggregate / surely no occlusion plot, Temporal with time or ordinal + // are not that different. + var noOccludedQxBinQ = { + line: 0, + area: -0.1, + bar: -0.2, + point: -0.3, + tick: -0.35, + text: -0.4, + // Non-sense to use rule here + rule: -2.5 + }; + util_1.forEach(noOccludedQxBinQ, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + // also do the inverse + var feature2 = featurize(yType, xType, false, mark); + SCORE[feature2] = score; + }); + }); + }); + [type_1.TIMEUNIT_T].forEach(function (xType) { + [type_1.TIMEUNIT_T].forEach(function (yType) { + // has occlusion + var ttMark = { + point: 0, + rect: -0.1, + text: -0.5, + tick: -1, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + // No difference between has occlusion and no occlusion + // as most of the time, it will be the occluded case. + util_1.forEach(ttMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + }); + util_1.forEach(ttMark, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + }); + }); + DISCRETE_OR_NONE.forEach(function (yType) { + // has occlusion + var tdMark = { + tick: 0, + point: -0.2, + text: -0.5, + rect: -1, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + // No difference between has occlusion and no occlusion + // as most of the time, it will be the occluded case. + util_1.forEach(tdMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + }); + util_1.forEach(tdMark, function (score, mark) { + var feature = featurize(yType, xType, true, mark); + SCORE[feature] = score; + }); + util_1.forEach(tdMark, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + }); + util_1.forEach(tdMark, function (score, mark) { + var feature = featurize(yType, xType, false, mark); + SCORE[feature] = score; + }); + }); + }); + // DxD + DISCRETE_OR_NONE.forEach(function (xType) { + DISCRETE_OR_NONE.forEach(function (yType) { + // has occlusion + var ddMark = { + point: 0, + rect: 0, + text: -0.1, + tick: -1, + bar: -2, + line: -2, + area: -2, + rule: -2.5 + }; + // No difference between has occlusion and no occlusion + util_1.forEach(ddMark, function (score, mark) { + var feature = featurize(xType, yType, true, mark); + SCORE[feature] = score; + }); + util_1.forEach(ddMark, function (score, mark) { + var feature = featurize(xType, yType, false, mark); + SCORE[feature] = score; + }); + }); + }); + return SCORE; + } + MarkScore.init = init; + function getScore(specM, schema, opt) { + var mark = specM.getMark(); + if (mark === mark_1.Mark.CIRCLE || mark === mark_1.Mark.SQUARE) { + mark = mark_1.Mark.POINT; + } + var xEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.X); + var xType = xEncQ ? type_1.getExtendedType(xEncQ) : type_1.NONE; + var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y); + var yType = yEncQ ? type_1.getExtendedType(yEncQ) : type_1.NONE; + var isOccluded = !specM.isAggregate(); // FIXME + var feature = xType + '_' + yType + '_' + isOccluded + '_' + mark; + var featureScore = effectiveness_1.getFeatureScore(MarkScore.MARK_SCORE, feature); + return [featureScore]; + } + MarkScore.getScore = getScore; +})(MarkScore = exports.MarkScore || (exports.MarkScore = {})); + +},{"../../util":36,"./effectiveness":30,"./type":32,"vega-lite/src/channel":45,"vega-lite/src/mark":50}],32:[function(require,module,exports){ +"use strict"; +var scale_1 = require('vega-lite/src/scale'); +var type_1 = require('vega-lite/src/type'); +var encoding_1 = require('../../query/encoding'); +/** + * Finer grained data types that takes binning and timeUnit into account. + */ +(function (ExtendedType) { + ExtendedType[ExtendedType["Q"] = type_1.Type.QUANTITATIVE] = "Q"; + ExtendedType[ExtendedType["BIN_Q"] = 'bin_' + type_1.Type.QUANTITATIVE] = "BIN_Q"; + ExtendedType[ExtendedType["T"] = type_1.Type.TEMPORAL] = "T"; + /** + * Time Unit Temporal Field with time scale. + */ + ExtendedType[ExtendedType["TIMEUNIT_T"] = 'timeUnit_time'] = "TIMEUNIT_T"; + /** + * Time Unit Temporal Field with ordinal scale. + */ + ExtendedType[ExtendedType["TIMEUNIT_O"] = 'timeUnit_' + type_1.Type.ORDINAL] = "TIMEUNIT_O"; + ExtendedType[ExtendedType["O"] = type_1.Type.ORDINAL] = "O"; + ExtendedType[ExtendedType["N"] = type_1.Type.NOMINAL] = "N"; + ExtendedType[ExtendedType["NONE"] = '-'] = "NONE"; +})(exports.ExtendedType || (exports.ExtendedType = {})); +var ExtendedType = exports.ExtendedType; +exports.Q = ExtendedType.Q; +exports.BIN_Q = ExtendedType.BIN_Q; +exports.T = ExtendedType.T; +exports.TIMEUNIT_T = ExtendedType.TIMEUNIT_T; +exports.TIMEUNIT_O = ExtendedType.TIMEUNIT_O; +exports.O = ExtendedType.O; +exports.N = ExtendedType.N; +exports.NONE = ExtendedType.NONE; +function getExtendedType(encQ) { + if (encQ.bin) { + return ExtendedType.BIN_Q; + } + else if (encQ.timeUnit) { + return encoding_1.scaleType(encQ) === scale_1.ScaleType.ORDINAL ? ExtendedType.TIMEUNIT_O : ExtendedType.TIMEUNIT_T; + } + return encQ.type; +} +exports.getExtendedType = getExtendedType; + +},{"../../query/encoding":22,"vega-lite/src/scale":51,"vega-lite/src/type":55}],33:[function(require,module,exports){ +"use strict"; +exports.effectiveness = require('./effectiveness/effectiveness'); +exports.aggregation = require('./aggregation'); +/** + * Registry for all encoding ranking functions + */ +var rankingRegistry = {}; +/** + * Add an ordering function to the registry. + */ +function register(name, keyFn) { + rankingRegistry[name] = keyFn; +} +exports.register = register; +function get(name) { + return rankingRegistry[name]; +} +exports.get = get; +function rank(group, query, schema, level) { + if (!query.nest || level === query.nest.length) { + if (query.orderBy || query.chooseBy) { + group.items.sort(comparator(query.orderBy || query.chooseBy, schema, query.config)); + if (query.chooseBy) { + if (group.items.length > 0) { + // for chooseBy -- only keep the top-item + group.items.splice(1); + } + } + } + } + else { + // sort lower-level nodes first because our ranking takes top-item in the subgroup + group.items.forEach(function (subgroup) { + rank(subgroup, query, schema, level + 1); + }); + if (query.nest[level].orderGroupBy) { + group.items.sort(groupComparator(query.nest[level].orderGroupBy, schema, query.config)); + } + } + return group; +} +exports.rank = rank; +function getScore(model, rankingName, schema, opt) { + if (model.getRankingScore(rankingName) !== undefined) { + return model.getRankingScore(rankingName); + } + var fn = get(rankingName); + var score = fn(model, schema, opt); + model.setRankingScore(rankingName, score); + return score; +} +function comparator(name, schema, opt) { + return function (m1, m2) { + return getScore(m2, name, schema, opt).score - getScore(m1, name, schema, opt).score; + }; +} +exports.comparator = comparator; +function groupComparator(name, schema, opt) { + return function (g1, g2) { + var m1 = g1.getTopSpecQueryModel(); + var m2 = g2.getTopSpecQueryModel(); + return getScore(m2, name, schema, opt).score - getScore(m1, name, schema, opt).score; + }; +} +exports.groupComparator = groupComparator; +exports.EFFECTIVENESS = 'effectiveness'; +register(exports.EFFECTIVENESS, exports.effectiveness.default); +register(exports.aggregation.name, exports.aggregation.score); + +},{"./aggregation":28,"./effectiveness/effectiveness":30}],34:[function(require,module,exports){ +"use strict"; +var type_1 = require('vega-lite/src/type'); +var bin_1 = require('vega-lite/src/bin'); +var timeunit_1 = require('vega-lite/src/timeunit'); +var stats_1 = require('datalib/src/stats'); +var type_2 = require('datalib/src/import/type'); +var dlBin = require('datalib/src/bins/bins'); +var config_1 = require('./config'); +var util_1 = require('./util'); +var Schema = (function () { + function Schema(fieldSchemas) { + this.fieldSchemas = fieldSchemas; + this.fieldSchemaIndex = fieldSchemas.reduce(function (m, fieldSchema) { + m[fieldSchema.field] = fieldSchema; + return m; + }, {}); + } + /** + * Build a Schema object. + * + * @param data - a set of raw data + * @return a Schema object + */ + Schema.build = function (data, opt) { + if (opt === void 0) { opt = {}; } + opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt); + // create profiles for each variable + var summaries = stats_1.summary(data); + var types = type_2.inferAll(data); // inferAll does stronger type inference than summary + var fieldSchemas = summaries.map(function (summary) { + var field = summary.field; + var primitiveType = types[field]; + var distinct = summary.distinct; + var type; + if (primitiveType === PrimitiveType.NUMBER) { + type = type_1.Type.QUANTITATIVE; + } + else if (primitiveType === PrimitiveType.INTEGER) { + // use ordinal or nominal when cardinality of integer type is relatively low and the distinct values are less than an amount specified in options + if ((distinct < opt.numberOrdinalLimit) && (distinct / summary.count < opt.numberOrdinalProportion)) { + // use nominal if the integers are 1,2,3,...,N or 0,1,2,3,...,N-1 where N = cardinality + type = (summary.max - summary.min === distinct - 1 && util_1.contains([0, 1], summary.min)) ? type_1.Type.NOMINAL : type_1.Type.ORDINAL; + } + else { + type = type_1.Type.QUANTITATIVE; + } + } + else if (primitiveType === PrimitiveType.DATE) { + type = type_1.Type.TEMPORAL; + // need to get correct min/max of date data because datalib's summary method does not + // calculate this correctly for date types. + summary.min = new Date(data[0][field]); + summary.max = new Date(data[0][field]); + for (var i = 0; i < data.length; i++) { + var time = new Date(data[i][field]).getTime(); + if (time < summary.min.getTime()) { + summary.min = new Date(time); + } + if (time > summary.max.getTime()) { + summary.max = new Date(time); + } + } + } + else { + type = type_1.Type.NOMINAL; + } + return { + field: field, + type: type, + primitiveType: primitiveType, + stats: summary, + timeStats: {}, + binStats: {} + }; + }); + // order the fieldSchemas (sort them) + var order = { + 'nominal': 0, + 'ordinal': 1, + 'temporal': 2, + 'quantitative': 3 + }; + fieldSchemas.sort(function (a, b) { + // first order by type: nominal < temporal < quantitative < ordinal + if (order[a.type] < order[b.type]) { + return -1; + } + else if (order[a.type] > order[b.type]) { + return 1; + } + else { + // then order by field (alphabetically) + return a.field.localeCompare(b.field); + } + }); + // calculate preset bins for quantitative and temporal data + for (var _i = 0, fieldSchemas_1 = fieldSchemas; _i < fieldSchemas_1.length; _i++) { + var fieldSchema = fieldSchemas_1[_i]; + if (fieldSchema.type === type_1.Type.QUANTITATIVE) { + for (var _a = 0, _b = opt.maxBinsList; _a < _b.length; _a++) { + var maxbins = _b[_a]; + fieldSchema.binStats[maxbins] = binSummary(maxbins, fieldSchema.stats); + } + } + else if (fieldSchema.type === type_1.Type.TEMPORAL) { + for (var _c = 0, _d = opt.timeUnits; _c < _d.length; _c++) { + var unit = _d[_c]; + if (unit !== undefined) { + fieldSchema.timeStats[unit] = timeSummary(unit, fieldSchema.stats); + } + } + } + } + return new Schema(fieldSchemas); + }; + Schema.prototype.fields = function () { + return this.fieldSchemas.map(function (fieldSchema) { return fieldSchema.field; }); + }; + /** + * @return primitive type of the field if exist, otherwise return null + */ + Schema.prototype.primitiveType = function (field) { + return this.fieldSchemaIndex[field] ? this.fieldSchemaIndex[field].primitiveType : null; + }; + /** + * @return type of measturement of the field if exist, otherwise return null + */ + Schema.prototype.type = function (field) { + return this.fieldSchemaIndex[field] ? this.fieldSchemaIndex[field].type : null; + }; + /** @return cardinality of the field associated with encQ, null if it doesn't exist. + * @param augmentTimeUnitDomain - TimeUnit field domains will not be augmented if explicitly set to false. + */ + Schema.prototype.cardinality = function (encQ, augmentTimeUnitDomain, excludeInvalid) { + if (augmentTimeUnitDomain === void 0) { augmentTimeUnitDomain = true; } + if (excludeInvalid === void 0) { excludeInvalid = false; } + var fieldSchema = this.fieldSchemaIndex[encQ.field]; + if (encQ.aggregate || encQ.autoCount) { + return 1; + } + else if (encQ.bin) { + // encQ.bin will either be a boolean or a BinQuery + var bin; + if (typeof encQ.bin === 'boolean') { + // autoMaxBins defaults to 10 if channel is EnumSpec + bin = { + maxbins: bin_1.autoMaxBins(encQ.channel) + }; + } + else { + bin = encQ.bin; + } + var maxbins = bin.maxbins; + if (!fieldSchema.binStats[maxbins]) { + // need to calculate + fieldSchema.binStats[maxbins] = binSummary(maxbins, fieldSchema.stats); + } + // don't need to worry about excludeInvalid here because invalid values don't affect linearly binned field's cardinality + return fieldSchema.binStats[maxbins].distinct; + } + else if (encQ.timeUnit) { + if (augmentTimeUnitDomain) { + switch (encQ.timeUnit) { + // TODO: this should not always be the case once Vega-Lite supports turning off domain augmenting (VL issue #1385) + case timeunit_1.TimeUnit.SECONDS: return 60; + case timeunit_1.TimeUnit.MINUTES: return 60; + case timeunit_1.TimeUnit.HOURS: return 24; + case timeunit_1.TimeUnit.DAY: return 7; + case timeunit_1.TimeUnit.DATE: return 31; + case timeunit_1.TimeUnit.MONTH: return 12; + case timeunit_1.TimeUnit.QUARTER: return 4; + case timeunit_1.TimeUnit.MILLISECONDS: return 1000; + } + } + var unit = encQ.timeUnit; + var timeStats = fieldSchema.timeStats; + // if the cardinality for the timeUnit is not cached, calculate it + if (!timeStats[unit]) { + timeStats[unit] = timeSummary(encQ.timeUnit, fieldSchema.stats); + } + if (excludeInvalid) { + return timeStats[unit].distinct - invalidCount(timeStats[unit].unique, ['Invalid Date', null]); + } + else { + return timeStats[unit].distinct; + } + } + else { + if (fieldSchema) { + if (excludeInvalid) { + return fieldSchema.stats.distinct - invalidCount(fieldSchema.stats.unique, [NaN, null]); + } + else { + return fieldSchema.stats.distinct; + } + } + else { + return null; + } + } + }; + /** + * Given an EncodingQuery with a timeUnit, returns true if the date field + * has multiple distinct values for all parts of the timeUnit. Returns undefined + * if the timeUnit is undefined. + * i.e. + * ('yearmonth', [Jan 1 2000, Feb 2 2000] returns false) + * ('yearmonth', [Jan 1 2000, Feb 2 2001] returns true) + */ + Schema.prototype.timeUnitHasVariation = function (encQ) { + if (!encQ.timeUnit) { + return; + } + // if there is no variation in `date`, there should not be variation in `day` + if (encQ.timeUnit === timeunit_1.TimeUnit.DAY) { + var dateEncQ = util_1.extend({}, encQ, { timeUnit: timeunit_1.TimeUnit.DATE }); + if (this.cardinality(dateEncQ, false, true) <= 1) { + return false; + } + } + var fullTimeUnit = encQ.timeUnit; + for (var _i = 0, SINGLE_TIMEUNITS_1 = timeunit_1.SINGLE_TIMEUNITS; _i < SINGLE_TIMEUNITS_1.length; _i++) { + var singleUnit = SINGLE_TIMEUNITS_1[_i]; + if (timeunit_1.containsTimeUnit(fullTimeUnit, singleUnit)) { + encQ.timeUnit = singleUnit; + if (this.cardinality(encQ, false, true) <= 1) { + return false; + } + } + } + return true; + }; + Schema.prototype.domain = function (encQ) { + // TODO: differentiate for field with bin / timeUnit + var fieldSchema = this.fieldSchemaIndex[encQ.field]; + var domain = util_1.keys(fieldSchema.stats.unique); + if (fieldSchema.type === type_1.Type.QUANTITATIVE || fieldSchema.primitiveType === PrimitiveType.DATE) { + // return [min, max] for quantitative and date data + domain = [fieldSchema.stats.min, fieldSchema.stats.max]; + } + else if (fieldSchema.primitiveType === PrimitiveType.INTEGER || + fieldSchema.primitiveType === PrimitiveType.NUMBER) { + // coerce non-quantitative numerical data into number type + domain = domain.map(function (x) { return +x; }); + } + return domain.sort(); + }; + /** + * @return a Summary corresponding to the field of the given EncodingQuery + */ + Schema.prototype.stats = function (encQ) { + // TODO: differentiate for field with bin / timeUnit vs without + var fieldSchema = this.fieldSchemaIndex[encQ.field]; + return fieldSchema ? fieldSchema.stats : null; + }; + return Schema; +}()); +exports.Schema = Schema; +/** + * @return a summary of the binning scheme determined from the given max number of bins + */ +function binSummary(maxbins, summary) { + var bin = dlBin({ + min: summary.min, + max: summary.max, + maxbins: maxbins + }); + // start with summary, pre-binning + var result = util_1.extend({}, summary); + result.unique = binUnique(bin, summary.unique); + result.distinct = (bin.stop - bin.start) / bin.step; + result.min = bin.start; + result.max = bin.stop; + return result; +} +/** @return a modified version of the passed summary with unique and distinct set according to the timeunit. + * Maps 'null' (string) keys to the null value and invalid dates to 'Invalid Date' in the unique dictionary. + */ +function timeSummary(timeunit, summary) { + var result = util_1.extend({}, summary); + var unique = {}; + util_1.keys(summary.unique).forEach(function (dateString) { + // don't convert null value because the Date constructor will actually convert it to a date + var date = (dateString === 'null') ? null : new Date(dateString); + // at this point, `date` is either the null value, a valid Date object, or "Invalid Date" which is a Date + var key; + if (date === null) { + key = null; + } + else if (isNaN(date.getTime())) { + key = 'Invalid Date'; + } + else { + key = ((timeunit === timeunit_1.TimeUnit.DAY) ? date.getDay() : timeunit_1.convert(timeunit, date)).toString(); + } + unique[key] = (unique[key] || 0) + summary.unique[dateString]; + }); + result.unique = unique; + result.distinct = util_1.keys(unique).length; + return result; +} +/** + * @return a new unique object based off of the old unique count and a binning scheme + */ +function binUnique(bin, oldUnique) { + var newUnique = {}; + for (var value in oldUnique) { + var bucket = void 0; + if (value === null) { + bucket = null; + } + else if (isNaN(Number(value))) { + bucket = NaN; + } + else { + bucket = bin.value(Number(value)); + } + newUnique[bucket] = (newUnique[bucket] || 0) + oldUnique[value]; + } + return newUnique; +} +/** @return the number of items in list that occur as keys of unique */ +function invalidCount(unique, list) { + return list.reduce(function (prev, cur) { + return unique[cur] ? prev + 1 : prev; + }, 0); +} +(function (PrimitiveType) { + PrimitiveType[PrimitiveType["STRING"] = 'string'] = "STRING"; + PrimitiveType[PrimitiveType["NUMBER"] = 'number'] = "NUMBER"; + PrimitiveType[PrimitiveType["INTEGER"] = 'integer'] = "INTEGER"; + PrimitiveType[PrimitiveType["BOOLEAN"] = 'boolean'] = "BOOLEAN"; + PrimitiveType[PrimitiveType["DATE"] = 'date'] = "DATE"; +})(exports.PrimitiveType || (exports.PrimitiveType = {})); +var PrimitiveType = exports.PrimitiveType; + +},{"./config":9,"./util":36,"datalib/src/bins/bins":3,"datalib/src/import/type":5,"datalib/src/stats":6,"vega-lite/src/bin":44,"vega-lite/src/timeunit":54,"vega-lite/src/type":55}],35:[function(require,module,exports){ +"use strict"; +var axis_1 = require('vega-lite/src/axis'); +var channel_1 = require('vega-lite/src/channel'); +var scale_1 = require('vega-lite/src/scale'); +var type_1 = require('vega-lite/src/type'); +var encoding_1 = require('./query/encoding'); +var util_1 = require('./util'); +function stylize(answerSet, schema, opt) { + var encQIndex = {}; + answerSet = answerSet.map(function (specM) { + if (opt.smallBandSizeForHighCardinalityOrFacet) { + specM = smallBandSizeForHighCardinalityOrFacet(specM, schema, encQIndex, opt); + } + if (opt.nominalColorScaleForHighCardinality) { + specM = nominalColorScaleForHighCardinality(specM, schema, encQIndex, opt); + } + if (opt.xAxisOnTopForHighYCardinalityWithoutColumn) { + specM = xAxisOnTopForHighYCardinalityWithoutColumn(specM, schema, encQIndex, opt); + } + return specM; + }); + return answerSet; +} +exports.stylize = stylize; +function smallBandSizeForHighCardinalityOrFacet(specM, schema, encQIndex, opt) { + [channel_1.Channel.ROW, channel_1.Channel.Y, channel_1.Channel.COLUMN, channel_1.Channel.X].forEach(function (channel) { + encQIndex[channel] = specM.getEncodingQueryByChannel(channel); + }); + var yEncQ = encQIndex[channel_1.Channel.Y]; + if (yEncQ !== undefined) { + if (encQIndex[channel_1.Channel.ROW] || + schema.cardinality(yEncQ) > opt.smallBandSizeForHighCardinalityOrFacet.maxCardinality) { + // We check for undefined rather than + // yEncQ.scale = yEncQ.scale || {} to cover the case where + // yEncQ.scale has been set to false/null. + // This prevents us from incorrectly overriding scale and + // assigning a bandSize when scale is set to false. + if (yEncQ.scale === undefined) { + yEncQ.scale = {}; + } + // We do not want to assign a bandSize if scale is set to false + // and we only apply this if the scale is (or can be) an ordinal scale. + if (yEncQ.scale && util_1.contains([scale_1.ScaleType.ORDINAL, undefined], encoding_1.scaleType(yEncQ))) { + if (!yEncQ.scale.bandSize) { + yEncQ.scale.bandSize = 12; + } + } + } + } + var xEncQ = encQIndex[channel_1.Channel.X]; + if (xEncQ !== undefined) { + if (encQIndex[channel_1.Channel.COLUMN] || + schema.cardinality(xEncQ) > opt.smallBandSizeForHighCardinalityOrFacet.maxCardinality) { + // Just like y, we don't want to do this if scale is null/false + if (xEncQ.scale === undefined) { + xEncQ.scale = {}; + } + // We do not want to assign a bandSize if scale is set to false + // and we only apply this if the scale is (or can be) an ordinal scale. + if (xEncQ.scale && util_1.contains([scale_1.ScaleType.ORDINAL, undefined], encoding_1.scaleType(xEncQ))) { + if (!xEncQ.scale.bandSize) { + xEncQ.scale.bandSize = 12; + } + } + } + } + return specM; +} +exports.smallBandSizeForHighCardinalityOrFacet = smallBandSizeForHighCardinalityOrFacet; +function nominalColorScaleForHighCardinality(specM, schema, encQIndex, opt) { + encQIndex[channel_1.Channel.COLOR] = specM.getEncodingQueryByChannel(channel_1.Channel.COLOR); + var colorEncQ = encQIndex[channel_1.Channel.COLOR]; + if ((colorEncQ !== undefined) && (colorEncQ.type === type_1.Type.NOMINAL) && + (schema.cardinality(colorEncQ) > opt.nominalColorScaleForHighCardinality.maxCardinality)) { + if (colorEncQ.scale === undefined) { + colorEncQ.scale = {}; + } + if (colorEncQ.scale) { + if (!colorEncQ.scale.range) { + colorEncQ.scale.range = opt.nominalColorScaleForHighCardinality.palette; + } + } + } + return specM; +} +exports.nominalColorScaleForHighCardinality = nominalColorScaleForHighCardinality; +function xAxisOnTopForHighYCardinalityWithoutColumn(specM, schema, encQIndex, opt) { + [channel_1.Channel.COLUMN, channel_1.Channel.X, channel_1.Channel.Y].forEach(function (channel) { + encQIndex[channel] = specM.getEncodingQueryByChannel(channel); + }); + if (encQIndex[channel_1.Channel.COLUMN] === undefined) { + var xEncQ = encQIndex[channel_1.Channel.X]; + var yEncQ = encQIndex[channel_1.Channel.Y]; + if (yEncQ !== undefined && yEncQ.field && encoding_1.scaleType(yEncQ) === scale_1.ScaleType.ORDINAL) { + if (xEncQ !== undefined) { + if (schema.cardinality(yEncQ) > opt.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality) { + if (xEncQ.axis === undefined) { + xEncQ.axis = {}; + } + if (xEncQ.axis && !xEncQ.axis.orient) { + xEncQ.axis.orient = axis_1.AxisOrient.TOP; + } + } + } + } + } + return specM; +} +exports.xAxisOnTopForHighYCardinalityWithoutColumn = xAxisOnTopForHighYCardinalityWithoutColumn; + +},{"./query/encoding":22,"./util":36,"vega-lite/src/axis":43,"vega-lite/src/channel":45,"vega-lite/src/scale":51,"vega-lite/src/type":55}],36:[function(require,module,exports){ +"use strict"; +var util_1 = require('datalib/src/util'); +var util_2 = require('datalib/src/util'); +exports.keys = util_2.keys; +exports.duplicate = util_2.duplicate; +exports.extend = util_2.extend; +exports.isObject = util_2.isObject; +exports.isArray = util_2.isArray; +function contains(array, item) { + return array.indexOf(item) !== -1; +} +exports.contains = contains; +; +function every(arr, f) { + var i = 0, k; + for (k in arr) { + if (!f(arr[k], k, i++)) { + return false; + } + } + return true; +} +exports.every = every; +; +function forEach(obj, f, thisArg) { + if (obj.forEach) { + obj.forEach.call(thisArg, f); + } + else { + for (var k in obj) { + f.call(thisArg, obj[k], k, obj); + } + } +} +exports.forEach = forEach; +; +function some(arr, f) { + var i = 0, k; + for (k in arr) { + if (f(arr[k], k, i++)) { + return true; + } + } + return false; +} +exports.some = some; +; +function nestedMap(array, f) { + return array.map(function (a) { + if (util_1.isArray(a)) { + return nestedMap(a, f); + } + return f(a); + }); +} +exports.nestedMap = nestedMap; +/** Returns the array without the elements in item */ +function without(array, excludedItems) { + return array.filter(function (item) { + return !contains(excludedItems, item); + }); +} +exports.without = without; + +},{"datalib/src/util":8}],37:[function(require,module,exports){ +(function (Buffer){ +var u = module.exports; + +// utility functions + +var FNAME = '__name__'; + +u.namedfunc = function(name, f) { return (f[FNAME] = name, f); }; + +u.name = function(f) { return f==null ? null : f[FNAME]; }; + +u.identity = function(x) { return x; }; + +u.true = u.namedfunc('true', function() { return true; }); + +u.false = u.namedfunc('false', function() { return false; }); + +u.duplicate = function(obj) { + return JSON.parse(JSON.stringify(obj)); +}; + +u.equal = function(a, b) { + return JSON.stringify(a) === JSON.stringify(b); +}; + +u.extend = function(obj) { + for (var x, name, i=1, len=arguments.length; i 1 ? + function(x, v) { + for (var i=0; i b || b == null) && a != null ? 1 : + ((b = b instanceof Date ? +b : b), + (a = a instanceof Date ? +a : a)) !== a && b === b ? -1 : + b !== b && a === a ? 1 : 0; +}; + +u.numcmp = function(a, b) { return a - b; }; + +u.stablesort = function(array, sortBy, keyFn) { + var indices = array.reduce(function(idx, v, i) { + return (idx[keyFn(v)] = i, idx); + }, {}); + + array.sort(function(a, b) { + var sa = sortBy(a), + sb = sortBy(b); + return sa < sb ? -1 : sa > sb ? 1 + : (indices[keyFn(a)] - indices[keyFn(b)]); + }); + + return array; +}; + +// permutes an array using a Knuth shuffle +u.permute = function(a) { + var m = a.length, + swap, + i; + + while (m) { + i = Math.floor(Math.random() * m--); + swap = a[m]; + a[m] = a[i]; + a[i] = swap; + } +}; + +// string functions + +u.pad = function(s, length, pos, padchar) { + padchar = padchar || " "; + var d = length - s.length; + if (d <= 0) return s; + switch (pos) { + case 'left': + return strrep(d, padchar) + s; + case 'middle': + case 'center': + return strrep(Math.floor(d/2), padchar) + + s + strrep(Math.ceil(d/2), padchar); + default: + return s + strrep(d, padchar); + } +}; + +function strrep(n, str) { + var s = "", i; + for (i=0; i= '0' && ch <= '9') { + string += ch; + next(); + } + if (ch === '.') { + string += '.'; + while (next() && ch >= '0' && ch <= '9') { + string += ch; + } + } + if (ch === 'e' || ch === 'E') { + string += ch; + next(); + if (ch === '-' || ch === '+') { + string += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + } + number = +string; + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + + string = function () { + // Parse a string value. + var hex, + i, + string = '', + uffff; + + // When parsing for string values, we must look for " and \ characters. + if (ch === '"') { + while (next()) { + if (ch === '"') { + next(); + return string; + } else if (ch === '\\') { + next(); + if (ch === 'u') { + uffff = 0; + for (i = 0; i < 4; i += 1) { + hex = parseInt(next(), 16); + if (!isFinite(hex)) { + break; + } + uffff = uffff * 16 + hex; + } + string += String.fromCharCode(uffff); + } else if (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else { + string += ch; + } + } + } + error("Bad string"); + }, + + white = function () { + +// Skip whitespace. + + while (ch && ch <= ' ') { + next(); + } + }, + + word = function () { + +// true, false, or null. + + switch (ch) { + case 't': + next('t'); + next('r'); + next('u'); + next('e'); + return true; + case 'f': + next('f'); + next('a'); + next('l'); + next('s'); + next('e'); + return false; + case 'n': + next('n'); + next('u'); + next('l'); + next('l'); + return null; + } + error("Unexpected '" + ch + "'"); + }, + + value, // Place holder for the value function. + + array = function () { + +// Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + if (ch === ']') { + next(']'); + return array; // empty array + } + while (ch) { + array.push(value()); + white(); + if (ch === ']') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + + object = function () { + +// Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + if (ch === '}') { + next('}'); + return object; // empty object + } + while (ch) { + key = string(); + white(); + next(':'); + if (Object.hasOwnProperty.call(object, key)) { + error('Duplicate key "' + key + '"'); + } + object[key] = value(); + white(); + if (ch === '}') { + next('}'); + return object; + } + next(','); + white(); + } + } + error("Bad object"); + }; + +value = function () { + +// Parse a JSON value. It could be an object, an array, a string, a number, +// or a word. + + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + return string(); + case '-': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } +}; + +// Return the json_parse function. It will have access to all of the above +// functions and variables. + +module.exports = function (source, reviver) { + var result; + + text = source; + at = 0; + ch = ' '; + result = value(); + white(); + if (ch) { + error("Syntax error"); + } + + // If there is a reviver function, we recursively walk the new structure, + // passing each name/value pair to the reviver function for possible + // transformation, starting with a temporary root object that holds the result + // in an empty key. If there is not a reviver function, we simply return the + // result. + + return typeof reviver === 'function' ? (function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + }({'': result}, '')) : result; +}; + +},{}],41:[function(require,module,exports){ +var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + +function quote(string) { + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; +} + +function str(key, holder) { + // Produce a string from holder[key]. + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + // JSON numbers must be finite. Encode non-finite numbers as null. + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + return String(value); + + case 'object': + if (!value) return 'null'; + gap += indent; + partial = []; + + // Array.isArray + if (Object.prototype.toString.apply(value) === '[object Array]') { + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and + // wrap them in brackets. + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be + // stringified. + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + else { + // Otherwise, iterate through all of the keys in the object. + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } +} + +module.exports = function (value, replacer, space) { + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + } + // If the space parameter is a string, it will be used as the indent string. + else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + rep = replacer; + if (replacer && typeof replacer !== 'function' + && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + return str('', {'': value}); +}; + +},{}],42:[function(require,module,exports){ +"use strict"; +(function (AggregateOp) { + AggregateOp[AggregateOp["VALUES"] = 'values'] = "VALUES"; + AggregateOp[AggregateOp["COUNT"] = 'count'] = "COUNT"; + AggregateOp[AggregateOp["VALID"] = 'valid'] = "VALID"; + AggregateOp[AggregateOp["MISSING"] = 'missing'] = "MISSING"; + AggregateOp[AggregateOp["DISTINCT"] = 'distinct'] = "DISTINCT"; + AggregateOp[AggregateOp["SUM"] = 'sum'] = "SUM"; + AggregateOp[AggregateOp["MEAN"] = 'mean'] = "MEAN"; + AggregateOp[AggregateOp["AVERAGE"] = 'average'] = "AVERAGE"; + AggregateOp[AggregateOp["VARIANCE"] = 'variance'] = "VARIANCE"; + AggregateOp[AggregateOp["VARIANCEP"] = 'variancep'] = "VARIANCEP"; + AggregateOp[AggregateOp["STDEV"] = 'stdev'] = "STDEV"; + AggregateOp[AggregateOp["STDEVP"] = 'stdevp'] = "STDEVP"; + AggregateOp[AggregateOp["MEDIAN"] = 'median'] = "MEDIAN"; + AggregateOp[AggregateOp["Q1"] = 'q1'] = "Q1"; + AggregateOp[AggregateOp["Q3"] = 'q3'] = "Q3"; + AggregateOp[AggregateOp["MODESKEW"] = 'modeskew'] = "MODESKEW"; + AggregateOp[AggregateOp["MIN"] = 'min'] = "MIN"; + AggregateOp[AggregateOp["MAX"] = 'max'] = "MAX"; + AggregateOp[AggregateOp["ARGMIN"] = 'argmin'] = "ARGMIN"; + AggregateOp[AggregateOp["ARGMAX"] = 'argmax'] = "ARGMAX"; +})(exports.AggregateOp || (exports.AggregateOp = {})); +var AggregateOp = exports.AggregateOp; +exports.AGGREGATE_OPS = [ + AggregateOp.VALUES, + AggregateOp.COUNT, + AggregateOp.VALID, + AggregateOp.MISSING, + AggregateOp.DISTINCT, + AggregateOp.SUM, + AggregateOp.MEAN, + AggregateOp.AVERAGE, + AggregateOp.VARIANCE, + AggregateOp.VARIANCEP, + AggregateOp.STDEV, + AggregateOp.STDEVP, + AggregateOp.MEDIAN, + AggregateOp.Q1, + AggregateOp.Q3, + AggregateOp.MODESKEW, + AggregateOp.MIN, + AggregateOp.MAX, + AggregateOp.ARGMIN, + AggregateOp.ARGMAX, +]; +/** Additive-based aggregation operations. These can be applied to stack. */ +exports.SUM_OPS = [ + AggregateOp.COUNT, + AggregateOp.SUM, + AggregateOp.DISTINCT +]; +exports.SHARED_DOMAIN_OPS = [ + AggregateOp.MEAN, + AggregateOp.AVERAGE, + AggregateOp.STDEV, + AggregateOp.STDEVP, + AggregateOp.MEDIAN, + AggregateOp.Q1, + AggregateOp.Q3, + AggregateOp.MIN, + AggregateOp.MAX, +]; + +},{}],43:[function(require,module,exports){ +"use strict"; +(function (AxisOrient) { + AxisOrient[AxisOrient["TOP"] = 'top'] = "TOP"; + AxisOrient[AxisOrient["RIGHT"] = 'right'] = "RIGHT"; + AxisOrient[AxisOrient["LEFT"] = 'left'] = "LEFT"; + AxisOrient[AxisOrient["BOTTOM"] = 'bottom'] = "BOTTOM"; +})(exports.AxisOrient || (exports.AxisOrient = {})); +var AxisOrient = exports.AxisOrient; +// TODO: add comment for properties that we rely on Vega's default to produce +// more concise Vega output. +exports.defaultAxisConfig = { + offset: undefined, + grid: undefined, + labels: true, + labelMaxLength: 25, + tickSize: undefined, + characterWidth: 6 +}; +exports.defaultFacetAxisConfig = { + axisWidth: 0, + labels: true, + grid: false, + tickSize: 0 +}; + +},{}],44:[function(require,module,exports){ +"use strict"; +var channel_1 = require('./channel'); +function autoMaxBins(channel) { + switch (channel) { + case channel_1.ROW: + case channel_1.COLUMN: + case channel_1.SIZE: + // Facets and Size shouldn't have too many bins + // We choose 6 like shape to simplify the rule + case channel_1.SHAPE: + return 6; // Vega's "shape" has 6 distinct values + default: + return 10; + } +} +exports.autoMaxBins = autoMaxBins; + +},{"./channel":45}],45:[function(require,module,exports){ +/* + * Constants and utilities for encoding channels (Visual variables) + * such as 'x', 'y', 'color'. + */ +"use strict"; +var util_1 = require('./util'); +(function (Channel) { + Channel[Channel["X"] = 'x'] = "X"; + Channel[Channel["Y"] = 'y'] = "Y"; + Channel[Channel["X2"] = 'x2'] = "X2"; + Channel[Channel["Y2"] = 'y2'] = "Y2"; + Channel[Channel["ROW"] = 'row'] = "ROW"; + Channel[Channel["COLUMN"] = 'column'] = "COLUMN"; + Channel[Channel["SHAPE"] = 'shape'] = "SHAPE"; + Channel[Channel["SIZE"] = 'size'] = "SIZE"; + Channel[Channel["COLOR"] = 'color'] = "COLOR"; + Channel[Channel["TEXT"] = 'text'] = "TEXT"; + Channel[Channel["DETAIL"] = 'detail'] = "DETAIL"; + Channel[Channel["LABEL"] = 'label'] = "LABEL"; + Channel[Channel["PATH"] = 'path'] = "PATH"; + Channel[Channel["ORDER"] = 'order'] = "ORDER"; + Channel[Channel["OPACITY"] = 'opacity'] = "OPACITY"; +})(exports.Channel || (exports.Channel = {})); +var Channel = exports.Channel; +exports.X = Channel.X; +exports.Y = Channel.Y; +exports.X2 = Channel.X2; +exports.Y2 = Channel.Y2; +exports.ROW = Channel.ROW; +exports.COLUMN = Channel.COLUMN; +exports.SHAPE = Channel.SHAPE; +exports.SIZE = Channel.SIZE; +exports.COLOR = Channel.COLOR; +exports.TEXT = Channel.TEXT; +exports.DETAIL = Channel.DETAIL; +exports.LABEL = Channel.LABEL; +exports.PATH = Channel.PATH; +exports.ORDER = Channel.ORDER; +exports.OPACITY = Channel.OPACITY; +exports.CHANNELS = [exports.X, exports.Y, exports.X2, exports.Y2, exports.ROW, exports.COLUMN, exports.SIZE, exports.SHAPE, exports.COLOR, exports.PATH, exports.ORDER, exports.OPACITY, exports.TEXT, exports.DETAIL, exports.LABEL]; +exports.UNIT_CHANNELS = util_1.without(exports.CHANNELS, [exports.ROW, exports.COLUMN]); +exports.UNIT_SCALE_CHANNELS = util_1.without(exports.UNIT_CHANNELS, [exports.PATH, exports.ORDER, exports.DETAIL, exports.TEXT, exports.LABEL, exports.X2, exports.Y2]); +exports.NONSPATIAL_CHANNELS = util_1.without(exports.UNIT_CHANNELS, [exports.X, exports.Y, exports.X2, exports.Y2]); +exports.NONSPATIAL_SCALE_CHANNELS = util_1.without(exports.UNIT_SCALE_CHANNELS, [exports.X, exports.Y, exports.X2, exports.Y2]); +/** Channels that can serve as groupings for stacked charts. */ +exports.STACK_GROUP_CHANNELS = [exports.COLOR, exports.DETAIL, exports.ORDER, exports.OPACITY, exports.SIZE]; +; +/** + * Return whether a channel supports a particular mark type. + * @param channel channel name + * @param mark the mark type + * @return whether the mark supports the channel + */ +function supportMark(channel, mark) { + return !!getSupportedMark(channel)[mark]; +} +exports.supportMark = supportMark; +/** + * Return a dictionary showing whether a channel supports mark type. + * @param channel + * @return A dictionary mapping mark types to boolean values. + */ +function getSupportedMark(channel) { + switch (channel) { + case exports.X: + case exports.Y: + case exports.COLOR: + case exports.DETAIL: + case exports.ORDER: + case exports.OPACITY: + case exports.ROW: + case exports.COLUMN: + return { + point: true, tick: true, rule: true, circle: true, square: true, + bar: true, line: true, area: true, text: true + }; + case exports.X2: + case exports.Y2: + return { + rule: true, bar: true, area: true + }; + case exports.SIZE: + return { + point: true, tick: true, rule: true, circle: true, square: true, + bar: true, text: true + }; + case exports.SHAPE: + return { point: true }; + case exports.TEXT: + return { text: true }; + case exports.PATH: + return { line: true }; + } + return {}; +} +exports.getSupportedMark = getSupportedMark; +; +/** + * Return whether a channel supports dimension / measure role + * @param channel + * @return A dictionary mapping role to boolean values. + */ +function getSupportedRole(channel) { + switch (channel) { + case exports.X: + case exports.Y: + case exports.COLOR: + case exports.OPACITY: + case exports.LABEL: + case exports.DETAIL: + return { + measure: true, + dimension: true + }; + case exports.ROW: + case exports.COLUMN: + case exports.SHAPE: + return { + measure: false, + dimension: true + }; + case exports.X2: + case exports.Y2: + case exports.SIZE: + case exports.TEXT: + return { + measure: true, + dimension: false + }; + case exports.PATH: + return { + measure: false, + dimension: true + }; + } + throw new Error('Invalid encoding channel' + channel); +} +exports.getSupportedRole = getSupportedRole; +function hasScale(channel) { + return !util_1.contains([exports.DETAIL, exports.PATH, exports.TEXT, exports.LABEL, exports.ORDER], channel); +} +exports.hasScale = hasScale; + +},{"./util":56}],46:[function(require,module,exports){ +// DateTime definition object +"use strict"; +var util_1 = require('./util'); +function isDateTime(o) { + return !!o.year || !!o.quarter || !!o.month || !!o.date || !!o.day || + !!o.hours || !!o.minutes || !!o.seconds || !!o.milliseconds; +} +exports.isDateTime = isDateTime; +exports.MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; +exports.SHORT_MONTHS = exports.MONTHS.map(function (m) { return m.substr(0, 3); }); +exports.DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; +exports.SHORT_DAYS = exports.DAYS.map(function (d) { return d.substr(0, 3); }); +function normalizeQuarter(q) { + if (util_1.isNumber(q)) { + // We accept 1-based quarter, so need to readjust to 0-based quarter + return (q - 1) + ''; + } + else { + // Simply an expression string, but normalize should not be called in this case. + console.warn('Potentially invalid quarter', q); + return q; + } +} +function normalizeMonth(m) { + if (util_1.isNumber(m)) { + // We accept 1-based month, so need to readjust to 0-based month + return (m - 1) + ''; + } + else { + var lowerM = m.toLowerCase(); + var monthIndex = exports.MONTHS.indexOf(lowerM); + if (monthIndex !== -1) { + return monthIndex + ''; // 0 for january, ... + } + var shortM = lowerM.substr(0, 3); + var shortMonthIndex = exports.SHORT_MONTHS.indexOf(shortM); + if (shortMonthIndex !== -1) { + return shortMonthIndex + ''; + } + // Simply an expression string, but normalize should not be called in this case. + console.warn('Potentially invalid month', m); + return m; + } +} +function normalizeDay(d) { + if (util_1.isNumber(d)) { + // mod so that this can be both 0-based where 0 = sunday + // and 1-based where 7=sunday + return (d % 7) + ''; + } + else { + var lowerD = d.toLowerCase(); + var dayIndex = exports.DAYS.indexOf(lowerD); + if (dayIndex !== -1) { + return dayIndex + ''; // 0 for january, ... + } + var shortD = lowerD.substr(0, 3); + var shortDayIndex = exports.SHORT_DAYS.indexOf(shortD); + if (shortDayIndex !== -1) { + return shortDayIndex + ''; + } + // Simply an expression string, but normalize should not be called in this case. + console.warn('Potentially invalid day', d); + return d; + } +} +/** + * Return Vega Expression for a particular date time. + * @param d + * @param normalize whether to normalize quarter, month, day. + */ +function dateTimeExpr(d, normalize) { + if (normalize === void 0) { normalize = false; } + var units = []; + if (normalize && d.day !== undefined) { + for (var _i = 0, _a = ['year', 'quarter', 'month', 'date']; _i < _a.length; _i++) { + var unit = _a[_i]; + if (d[unit] !== undefined) { + console.warn('Dropping day from datetime', JSON.stringify(d), 'as day cannot be combined with', unit); + d = util_1.duplicate(d); + delete d.day; + break; + } + } + } + if (d.year !== undefined) { + units.push(d.year); + } + else if (d.day !== undefined) { + // Set year to 2006 for working with day since January 1 2006 is a Sunday + units.push(2006); + } + else { + units.push(0); + } + if (d.month !== undefined) { + var month = normalize ? normalizeMonth(d.month) : d.month; + units.push(month); + } + else if (d.quarter !== undefined) { + var quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; + units.push(quarter + '*3'); + } + else { + units.push(0); // months start at zero in JS + } + if (d.date !== undefined) { + units.push(d.date); + } + else if (d.day !== undefined) { + // HACK: Day only works as a standalone unit + // This is only correct because we always set year to 2006 for day + var day = normalize ? normalizeDay(d.day) : d.day; + units.push(day + '+1'); + } + else { + units.push(1); // Date starts at 1 in JS + } + // Note: can't use TimeUnit enum here as importing it will create + // circular dependency problem! + for (var _b = 0, _c = ['hours', 'minutes', 'seconds', 'milliseconds']; _b < _c.length; _b++) { + var timeUnit = _c[_b]; + if (d[timeUnit] !== undefined) { + units.push(d[timeUnit]); + } + else { + units.push(0); + } + } + return 'datetime(' + units.join(', ') + ')'; +} +exports.dateTimeExpr = dateTimeExpr; + +},{"./util":56}],47:[function(require,module,exports){ +"use strict"; +var channel_1 = require('./channel'); +var util_1 = require('./util'); +function countRetinal(encoding) { + var count = 0; + if (encoding.color) { + count++; + } + if (encoding.opacity) { + count++; + } + if (encoding.size) { + count++; + } + if (encoding.shape) { + count++; + } + return count; +} +exports.countRetinal = countRetinal; +function channels(encoding) { + return channel_1.CHANNELS.filter(function (channel) { + return has(encoding, channel); + }); +} +exports.channels = channels; +// TOD: rename this to hasChannelField and only use we really want it. +function has(encoding, channel) { + var channelEncoding = encoding && encoding[channel]; + return channelEncoding && (channelEncoding.field !== undefined || + // TODO: check that we have field in the array + (util_1.isArray(channelEncoding) && channelEncoding.length > 0)); +} +exports.has = has; +function isAggregate(encoding) { + return util_1.some(channel_1.CHANNELS, function (channel) { + if (has(encoding, channel) && encoding[channel].aggregate) { + return true; + } + return false; + }); +} +exports.isAggregate = isAggregate; +function isRanged(encoding) { + return encoding && ((!!encoding.x && !!encoding.x2) || (!!encoding.y && !!encoding.y2)); +} +exports.isRanged = isRanged; +function fieldDefs(encoding) { + var arr = []; + channel_1.CHANNELS.forEach(function (channel) { + if (has(encoding, channel)) { + if (util_1.isArray(encoding[channel])) { + encoding[channel].forEach(function (fieldDef) { + arr.push(fieldDef); + }); + } + else { + arr.push(encoding[channel]); + } + } + }); + return arr; +} +exports.fieldDefs = fieldDefs; +; +function forEach(encoding, f, thisArg) { + channelMappingForEach(channel_1.CHANNELS, encoding, f, thisArg); +} +exports.forEach = forEach; +function channelMappingForEach(channels, mapping, f, thisArg) { + var i = 0; + channels.forEach(function (channel) { + if (has(mapping, channel)) { + if (util_1.isArray(mapping[channel])) { + mapping[channel].forEach(function (fieldDef) { + f.call(thisArg, fieldDef, channel, i++); + }); + } + else { + f.call(thisArg, mapping[channel], channel, i++); + } + } + }); +} +exports.channelMappingForEach = channelMappingForEach; +function map(encoding, f, thisArg) { + return channelMappingMap(channel_1.CHANNELS, encoding, f, thisArg); +} +exports.map = map; +function channelMappingMap(channels, mapping, f, thisArg) { + var arr = []; + channels.forEach(function (channel) { + if (has(mapping, channel)) { + if (util_1.isArray(mapping[channel])) { + mapping[channel].forEach(function (fieldDef) { + arr.push(f.call(thisArg, fieldDef, channel)); + }); + } + else { + arr.push(f.call(thisArg, mapping[channel], channel)); + } + } + }); + return arr; +} +exports.channelMappingMap = channelMappingMap; +function reduce(encoding, f, init, thisArg) { + return channelMappingReduce(channel_1.CHANNELS, encoding, f, init, thisArg); +} +exports.reduce = reduce; +function channelMappingReduce(channels, mapping, f, init, thisArg) { + var r = init; + channel_1.CHANNELS.forEach(function (channel) { + if (has(mapping, channel)) { + if (util_1.isArray(mapping[channel])) { + mapping[channel].forEach(function (fieldDef) { + r = f.call(thisArg, r, fieldDef, channel); + }); + } + else { + r = f.call(thisArg, r, mapping[channel], channel); + } + } + }); + return r; +} +exports.channelMappingReduce = channelMappingReduce; + +},{"./channel":45,"./util":56}],48:[function(require,module,exports){ +// utility for a field definition object +"use strict"; +var aggregate_1 = require('./aggregate'); +var scale_1 = require('./scale'); +var type_1 = require('./type'); +var util_1 = require('./util'); +function field(fieldDef, opt) { + if (opt === void 0) { opt = {}; } + var field = fieldDef.field; + var prefix = opt.prefix; + var suffix = opt.suffix; + if (isCount(fieldDef)) { + field = 'count'; + } + else { + var fn = opt.fn; + if (!opt.nofn) { + if (fieldDef.bin) { + fn = 'bin'; + suffix = opt.binSuffix || (opt.scaleType === scale_1.ScaleType.ORDINAL ? + // For ordinal scale type, use `range` as suffix. + 'range' : + // For non-ordinal scale or unknown, use `start` as suffix. + 'start'); + } + else if (!opt.noAggregate && fieldDef.aggregate) { + fn = String(fieldDef.aggregate); + } + else if (fieldDef.timeUnit) { + fn = String(fieldDef.timeUnit); + } + } + if (!!fn) { + field = fn + "_" + field; + } + } + if (!!suffix) { + field = field + "_" + suffix; + } + if (!!prefix) { + field = prefix + "_" + field; + } + if (opt.datum) { + field = "datum[\"" + field + "\"]"; + } + return field; +} +exports.field = field; +function _isFieldDimension(fieldDef) { + return util_1.contains([type_1.NOMINAL, type_1.ORDINAL], fieldDef.type) || !!fieldDef.bin || + (fieldDef.type === type_1.TEMPORAL && !!fieldDef.timeUnit); +} +function isDimension(fieldDef) { + return fieldDef && fieldDef.field && _isFieldDimension(fieldDef); +} +exports.isDimension = isDimension; +function isMeasure(fieldDef) { + return fieldDef && fieldDef.field && !_isFieldDimension(fieldDef); +} +exports.isMeasure = isMeasure; +function count() { + return { field: '*', aggregate: aggregate_1.AggregateOp.COUNT, type: type_1.QUANTITATIVE }; +} +exports.count = count; +function isCount(fieldDef) { + return fieldDef.aggregate === aggregate_1.AggregateOp.COUNT; +} +exports.isCount = isCount; +function title(fieldDef, config) { + if (fieldDef.title != null) { + return fieldDef.title; + } + if (isCount(fieldDef)) { + return config.countTitle; + } + var fn = fieldDef.aggregate || fieldDef.timeUnit || (fieldDef.bin && 'bin'); + if (fn) { + return fn.toString().toUpperCase() + '(' + fieldDef.field + ')'; + } + else { + return fieldDef.field; + } +} +exports.title = title; + +},{"./aggregate":42,"./scale":51,"./type":55,"./util":56}],49:[function(require,module,exports){ +"use strict"; +var datetime_1 = require('./datetime'); +var fielddef_1 = require('./fielddef'); +var timeunit_1 = require('./timeunit'); +var util_1 = require('./util'); +function isEqualFilter(filter) { + return filter && !!filter.field && filter.equal !== undefined; +} +exports.isEqualFilter = isEqualFilter; +function isRangeFilter(filter) { + if (filter && !!filter.field) { + if (util_1.isArray(filter.range) && filter.range.length === 2) { + return true; + } + } + return false; +} +exports.isRangeFilter = isRangeFilter; +function isInFilter(filter) { + return filter && !!filter.field && util_1.isArray(filter.in); +} +exports.isInFilter = isInFilter; +function expression(filter) { + if (util_1.isString(filter)) { + return filter; + } + else { + var fieldExpr = filter.timeUnit ? + // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. + // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline + // TODO: support utc + ('time(' + timeunit_1.fieldExpr(filter.timeUnit, filter.field) + ')') : + fielddef_1.field(filter, { datum: true }); + if (isEqualFilter(filter)) { + return fieldExpr + '===' + valueExpr(filter.equal, filter.timeUnit); + } + else if (isInFilter(filter)) { + return 'indexof([' + + filter.in.map(function (v) { return valueExpr(v, filter.timeUnit); }).join(',') + + '], ' + fieldExpr + ') !== -1'; + } + else if (isRangeFilter(filter)) { + var lower = filter.range[0]; + var upper = filter.range[1]; + if (lower !== null && upper !== null) { + return 'inrange(' + fieldExpr + ', ' + + valueExpr(lower, filter.timeUnit) + ', ' + + valueExpr(upper, filter.timeUnit) + ')'; + } + else if (lower !== null) { + return fieldExpr + ' >= ' + lower; + } + else if (upper !== null) { + return fieldExpr + ' <= ' + upper; + } + } + } + return undefined; +} +exports.expression = expression; +function valueExpr(v, timeUnit) { + if (datetime_1.isDateTime(v)) { + var expr = datetime_1.dateTimeExpr(v, true); + return 'time(' + expr + ')'; + } + if (timeunit_1.isSingleTimeUnit(timeUnit)) { + var datetime = {}; + datetime[timeUnit] = v; + var expr = datetime_1.dateTimeExpr(datetime, true); + return 'time(' + expr + ')'; + } + return JSON.stringify(v); +} + +},{"./datetime":46,"./fielddef":48,"./timeunit":54,"./util":56}],50:[function(require,module,exports){ +"use strict"; +(function (Mark) { + Mark[Mark["AREA"] = 'area'] = "AREA"; + Mark[Mark["BAR"] = 'bar'] = "BAR"; + Mark[Mark["LINE"] = 'line'] = "LINE"; + Mark[Mark["POINT"] = 'point'] = "POINT"; + Mark[Mark["TEXT"] = 'text'] = "TEXT"; + Mark[Mark["TICK"] = 'tick'] = "TICK"; + Mark[Mark["RULE"] = 'rule'] = "RULE"; + Mark[Mark["CIRCLE"] = 'circle'] = "CIRCLE"; + Mark[Mark["SQUARE"] = 'square'] = "SQUARE"; + Mark[Mark["ERRORBAR"] = 'errorBar'] = "ERRORBAR"; +})(exports.Mark || (exports.Mark = {})); +var Mark = exports.Mark; +exports.AREA = Mark.AREA; +exports.BAR = Mark.BAR; +exports.LINE = Mark.LINE; +exports.POINT = Mark.POINT; +exports.TEXT = Mark.TEXT; +exports.TICK = Mark.TICK; +exports.RULE = Mark.RULE; +exports.CIRCLE = Mark.CIRCLE; +exports.SQUARE = Mark.SQUARE; +exports.ERRORBAR = Mark.ERRORBAR; +exports.PRIMITIVE_MARKS = [exports.AREA, exports.BAR, exports.LINE, exports.POINT, exports.TEXT, exports.TICK, exports.RULE, exports.CIRCLE, exports.SQUARE]; + +},{}],51:[function(require,module,exports){ +"use strict"; +(function (ScaleType) { + ScaleType[ScaleType["LINEAR"] = 'linear'] = "LINEAR"; + ScaleType[ScaleType["LOG"] = 'log'] = "LOG"; + ScaleType[ScaleType["POW"] = 'pow'] = "POW"; + ScaleType[ScaleType["SQRT"] = 'sqrt'] = "SQRT"; + ScaleType[ScaleType["QUANTILE"] = 'quantile'] = "QUANTILE"; + ScaleType[ScaleType["QUANTIZE"] = 'quantize'] = "QUANTIZE"; + ScaleType[ScaleType["ORDINAL"] = 'ordinal'] = "ORDINAL"; + ScaleType[ScaleType["TIME"] = 'time'] = "TIME"; + ScaleType[ScaleType["UTC"] = 'utc'] = "UTC"; +})(exports.ScaleType || (exports.ScaleType = {})); +var ScaleType = exports.ScaleType; +(function (NiceTime) { + NiceTime[NiceTime["SECOND"] = 'second'] = "SECOND"; + NiceTime[NiceTime["MINUTE"] = 'minute'] = "MINUTE"; + NiceTime[NiceTime["HOUR"] = 'hour'] = "HOUR"; + NiceTime[NiceTime["DAY"] = 'day'] = "DAY"; + NiceTime[NiceTime["WEEK"] = 'week'] = "WEEK"; + NiceTime[NiceTime["MONTH"] = 'month'] = "MONTH"; + NiceTime[NiceTime["YEAR"] = 'year'] = "YEAR"; +})(exports.NiceTime || (exports.NiceTime = {})); +var NiceTime = exports.NiceTime; +(function (BandSize) { + BandSize[BandSize["FIT"] = 'fit'] = "FIT"; +})(exports.BandSize || (exports.BandSize = {})); +var BandSize = exports.BandSize; +exports.BANDSIZE_FIT = BandSize.FIT; +exports.defaultScaleConfig = { + round: true, + textBandWidth: 90, + bandSize: 21, + padding: 0.1, + useRawDomain: false, + opacity: [0.3, 0.8], + nominalColorRange: 'category10', + sequentialColorRange: ['#AFC6A3', '#09622A'], + shapeRange: 'shapes', + fontSizeRange: [8, 40], + ruleSizeRange: [1, 5], + tickSizeRange: [1, 20] +}; +exports.defaultFacetScaleConfig = { + round: true, + padding: 16 +}; + +},{}],52:[function(require,module,exports){ +"use strict"; +(function (SortOrder) { + SortOrder[SortOrder["ASCENDING"] = 'ascending'] = "ASCENDING"; + SortOrder[SortOrder["DESCENDING"] = 'descending'] = "DESCENDING"; + SortOrder[SortOrder["NONE"] = 'none'] = "NONE"; +})(exports.SortOrder || (exports.SortOrder = {})); +var SortOrder = exports.SortOrder; +function isSortField(sort) { + return !!sort && !!sort['field'] && !!sort['op']; +} +exports.isSortField = isSortField; + +},{}],53:[function(require,module,exports){ +"use strict"; +var channel_1 = require('./channel'); +var encoding_1 = require('./encoding'); +var mark_1 = require('./mark'); +var util_1 = require('./util'); +(function (StackOffset) { + StackOffset[StackOffset["ZERO"] = 'zero'] = "ZERO"; + StackOffset[StackOffset["CENTER"] = 'center'] = "CENTER"; + StackOffset[StackOffset["NORMALIZE"] = 'normalize'] = "NORMALIZE"; + StackOffset[StackOffset["NONE"] = 'none'] = "NONE"; +})(exports.StackOffset || (exports.StackOffset = {})); +var StackOffset = exports.StackOffset; +function stack(mark, encoding, config) { + var stacked = (config && config.mark) ? config.mark.stacked : undefined; + // Should not have stack explicitly disabled + if (util_1.contains([StackOffset.NONE, null, false], stacked)) { + return null; + } + // Should have stackable mark + if (!util_1.contains([mark_1.BAR, mark_1.AREA], mark)) { + return null; + } + // Should be aggregate plot + if (!encoding_1.isAggregate(encoding)) { + return null; + } + // Should have grouping level of detail + var stackByChannels = channel_1.STACK_GROUP_CHANNELS.reduce(function (sc, channel) { + if (encoding_1.has(encoding, channel) && !encoding[channel].aggregate) { + sc.push(channel); + } + return sc; + }, []); + if (stackByChannels.length === 0) { + return null; + } + // Has only one aggregate axis + var hasXField = encoding_1.has(encoding, channel_1.X); + var hasYField = encoding_1.has(encoding, channel_1.Y); + var xIsAggregate = hasXField && !!encoding.x.aggregate; + var yIsAggregate = hasYField && !!encoding.y.aggregate; + if (xIsAggregate !== yIsAggregate) { + return { + groupbyChannel: xIsAggregate ? (hasYField ? channel_1.Y : null) : (hasXField ? channel_1.X : null), + fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y, + stackByChannels: stackByChannels, + offset: stacked || StackOffset.ZERO + }; + } + return null; +} +exports.stack = stack; + +},{"./channel":45,"./encoding":47,"./mark":50,"./util":56}],54:[function(require,module,exports){ +"use strict"; +var channel_1 = require('./channel'); +var datetime_1 = require('./datetime'); +var scale_1 = require('./scale'); +var util_1 = require('./util'); +(function (TimeUnit) { + TimeUnit[TimeUnit["YEAR"] = 'year'] = "YEAR"; + TimeUnit[TimeUnit["MONTH"] = 'month'] = "MONTH"; + TimeUnit[TimeUnit["DAY"] = 'day'] = "DAY"; + TimeUnit[TimeUnit["DATE"] = 'date'] = "DATE"; + TimeUnit[TimeUnit["HOURS"] = 'hours'] = "HOURS"; + TimeUnit[TimeUnit["MINUTES"] = 'minutes'] = "MINUTES"; + TimeUnit[TimeUnit["SECONDS"] = 'seconds'] = "SECONDS"; + TimeUnit[TimeUnit["MILLISECONDS"] = 'milliseconds'] = "MILLISECONDS"; + TimeUnit[TimeUnit["YEARMONTH"] = 'yearmonth'] = "YEARMONTH"; + // Note: don't add MONTH DATE because it will be incorrect + // since days on a leap year will be shifted by one if + // we only add + TimeUnit[TimeUnit["YEARMONTHDATE"] = 'yearmonthdate'] = "YEARMONTHDATE"; + TimeUnit[TimeUnit["YEARMONTHDATEHOURS"] = 'yearmonthdatehours'] = "YEARMONTHDATEHOURS"; + TimeUnit[TimeUnit["YEARMONTHDATEHOURSMINUTES"] = 'yearmonthdatehoursminutes'] = "YEARMONTHDATEHOURSMINUTES"; + TimeUnit[TimeUnit["YEARMONTHDATEHOURSMINUTESSECONDS"] = 'yearmonthdatehoursminutesseconds'] = "YEARMONTHDATEHOURSMINUTESSECONDS"; + TimeUnit[TimeUnit["HOURSMINUTES"] = 'hoursminutes'] = "HOURSMINUTES"; + TimeUnit[TimeUnit["HOURSMINUTESSECONDS"] = 'hoursminutesseconds'] = "HOURSMINUTESSECONDS"; + TimeUnit[TimeUnit["MINUTESSECONDS"] = 'minutesseconds'] = "MINUTESSECONDS"; + TimeUnit[TimeUnit["SECONDSMILLISECONDS"] = 'secondsmilliseconds'] = "SECONDSMILLISECONDS"; + TimeUnit[TimeUnit["QUARTER"] = 'quarter'] = "QUARTER"; + TimeUnit[TimeUnit["YEARQUARTER"] = 'yearquarter'] = "YEARQUARTER"; + TimeUnit[TimeUnit["QUARTERMONTH"] = 'quartermonth'] = "QUARTERMONTH"; + TimeUnit[TimeUnit["YEARQUARTERMONTH"] = 'yearquartermonth'] = "YEARQUARTERMONTH"; +})(exports.TimeUnit || (exports.TimeUnit = {})); +var TimeUnit = exports.TimeUnit; +/** Time Unit that only corresponds to only one part of Date objects. */ +exports.SINGLE_TIMEUNITS = [ + TimeUnit.YEAR, + TimeUnit.QUARTER, + TimeUnit.MONTH, + TimeUnit.DAY, + TimeUnit.DATE, + TimeUnit.HOURS, + TimeUnit.MINUTES, + TimeUnit.SECONDS, + TimeUnit.MILLISECONDS, +]; +var SINGLE_TIMEUNIT_INDEX = exports.SINGLE_TIMEUNITS.reduce(function (d, timeUnit) { + d[timeUnit] = true; + return d; +}, {}); +function isSingleTimeUnit(timeUnit) { + return !!SINGLE_TIMEUNIT_INDEX[timeUnit]; +} +exports.isSingleTimeUnit = isSingleTimeUnit; +/** + * Converts a date to only have the measurements relevant to the specified unit + * i.e. ('yearmonth', '2000-12-04 07:58:14') -> '2000-12-01 00:00:00' + * Note: the base date is Jan 01 1900 00:00:00 + */ +function convert(unit, date) { + var result = new Date(0, 0, 1, 0, 0, 0, 0); // start with uniform date + exports.SINGLE_TIMEUNITS.forEach(function (singleUnit) { + if (containsTimeUnit(unit, singleUnit)) { + switch (singleUnit) { + case TimeUnit.DAY: + throw new Error('Cannot convert to TimeUnits containing \'day\''); + case TimeUnit.YEAR: + result.setFullYear(date.getFullYear()); + break; + case TimeUnit.QUARTER: + // indicate quarter by setting month to be the first of the quarter i.e. may (4) -> april (3) + result.setMonth((Math.floor(date.getMonth() / 3)) * 3); + break; + case TimeUnit.MONTH: + result.setMonth(date.getMonth()); + break; + case TimeUnit.DATE: + result.setDate(date.getDate()); + break; + case TimeUnit.HOURS: + result.setHours(date.getHours()); + break; + case TimeUnit.MINUTES: + result.setMinutes(date.getMinutes()); + break; + case TimeUnit.SECONDS: + result.setSeconds(date.getSeconds()); + break; + case TimeUnit.MILLISECONDS: + result.setMilliseconds(date.getMilliseconds()); + break; + } + } + }); + return result; +} +exports.convert = convert; +exports.MULTI_TIMEUNITS = [ + TimeUnit.YEARQUARTER, + TimeUnit.YEARQUARTERMONTH, + TimeUnit.YEARMONTH, + TimeUnit.YEARMONTHDATE, + TimeUnit.YEARMONTHDATEHOURS, + TimeUnit.YEARMONTHDATEHOURSMINUTES, + TimeUnit.YEARMONTHDATEHOURSMINUTESSECONDS, + TimeUnit.QUARTERMONTH, + TimeUnit.HOURSMINUTES, + TimeUnit.HOURSMINUTESSECONDS, + TimeUnit.MINUTESSECONDS, + TimeUnit.SECONDSMILLISECONDS, +]; +var MULTI_TIMEUNIT_INDEX = exports.MULTI_TIMEUNITS.reduce(function (d, timeUnit) { + d[timeUnit] = true; + return d; +}, {}); +function isMultiTimeUnit(timeUnit) { + return !!MULTI_TIMEUNIT_INDEX[timeUnit]; +} +exports.isMultiTimeUnit = isMultiTimeUnit; +exports.TIMEUNITS = exports.SINGLE_TIMEUNITS.concat(exports.MULTI_TIMEUNITS); +/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ +function containsTimeUnit(fullTimeUnit, timeUnit) { + var fullTimeUnitStr = fullTimeUnit.toString(); + var timeUnitStr = timeUnit.toString(); + var index = fullTimeUnitStr.indexOf(timeUnitStr); + return index > -1 && + (timeUnit !== TimeUnit.SECONDS || + index === 0 || + fullTimeUnitStr.charAt(index - 1) !== 'i' // exclude milliseconds + ); +} +exports.containsTimeUnit = containsTimeUnit; +function defaultScaleType(timeUnit) { + switch (timeUnit) { + case TimeUnit.HOURS: + case TimeUnit.DAY: + case TimeUnit.MONTH: + case TimeUnit.QUARTER: + return scale_1.ScaleType.ORDINAL; + } + // date, year, minute, second, yearmonth, monthday, ... + return scale_1.ScaleType.TIME; +} +exports.defaultScaleType = defaultScaleType; +/** + * Returns Vega expresssion for a given timeUnit and fieldRef + */ +function fieldExpr(fullTimeUnit, field) { + var fieldRef = 'datum["' + field + '"]'; + function func(timeUnit) { + if (timeUnit === TimeUnit.QUARTER) { + // Divide by 3 to get the corresponding quarter number, multiply by 3 + // to scale to the first month of the corresponding quarter(0,3,6,9). + return 'floor(month(' + fieldRef + ')' + '/3)'; + } + else { + return timeUnit + '(' + fieldRef + ')'; + } + } + var d = exports.SINGLE_TIMEUNITS.reduce(function (_d, tu) { + if (containsTimeUnit(fullTimeUnit, tu)) { + _d[tu] = func(tu); + } + return _d; + }, {}); + if (d.day && util_1.keys(d).length > 1) { + console.warn('Time unit "' + fullTimeUnit + '" is not supported. We are replacing it with ', (fullTimeUnit + '').replace('day', 'date') + '.'); + delete d.day; + d.date = func(TimeUnit.DATE); + } + return datetime_1.dateTimeExpr(d); +} +exports.fieldExpr = fieldExpr; +/** Generate the complete raw domain. */ +function rawDomain(timeUnit, channel) { + if (util_1.contains([channel_1.ROW, channel_1.COLUMN, channel_1.SHAPE, channel_1.COLOR], channel)) { + return null; + } + switch (timeUnit) { + case TimeUnit.SECONDS: + return util_1.range(0, 60); + case TimeUnit.MINUTES: + return util_1.range(0, 60); + case TimeUnit.HOURS: + return util_1.range(0, 24); + case TimeUnit.DAY: + return util_1.range(0, 7); + case TimeUnit.DATE: + return util_1.range(1, 32); + case TimeUnit.MONTH: + return util_1.range(0, 12); + case TimeUnit.QUARTER: + return [0, 3, 6, 9]; + } + return null; +} +exports.rawDomain = rawDomain; +/** returns the smallest nice unit for scale.nice */ +function smallestUnit(timeUnit) { + if (!timeUnit) { + return undefined; + } + if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) { + return 'second'; + } + if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) { + return 'minute'; + } + if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) { + return 'hour'; + } + if (containsTimeUnit(timeUnit, TimeUnit.DAY) || + containsTimeUnit(timeUnit, TimeUnit.DATE)) { + return 'day'; + } + if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) { + return 'month'; + } + if (containsTimeUnit(timeUnit, TimeUnit.YEAR)) { + return 'year'; + } + return undefined; +} +exports.smallestUnit = smallestUnit; +/** returns the template name used for axis labels for a time unit */ +function template(timeUnit, field, shortTimeLabels) { + if (!timeUnit) { + return undefined; + } + var dateComponents = []; + if (containsTimeUnit(timeUnit, TimeUnit.YEAR)) { + dateComponents.push(shortTimeLabels ? '%y' : '%Y'); + } + if (containsTimeUnit(timeUnit, TimeUnit.QUARTER)) { + // special template for quarter + dateComponents.push('\'}}Q{{' + field + ' | quarter}}{{' + field + ' | time:\''); + } + if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) { + dateComponents.push(shortTimeLabels ? '%b' : '%B'); + } + if (containsTimeUnit(timeUnit, TimeUnit.DAY)) { + dateComponents.push(shortTimeLabels ? '%a' : '%A'); + } + else if (containsTimeUnit(timeUnit, TimeUnit.DATE)) { + dateComponents.push('%d'); + } + var timeComponents = []; + if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) { + timeComponents.push('%H'); + } + if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) { + timeComponents.push('%M'); + } + if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) { + timeComponents.push('%S'); + } + if (containsTimeUnit(timeUnit, TimeUnit.MILLISECONDS)) { + timeComponents.push('%L'); + } + var out = []; + if (dateComponents.length > 0) { + out.push(dateComponents.join('-')); + } + if (timeComponents.length > 0) { + out.push(timeComponents.join(':')); + } + if (out.length > 0) { + // clean up empty formatting expressions that may have been generated by the quarter time unit + var template_1 = '{{' + field + ' | time:\'' + out.join(' ') + '\'}}'; + // FIXME: Remove these RegExp Hacks!!! + var escapedField = field.replace(/(\[|\])/g, '\\$1'); // excape field for use in Regex + return template_1.replace(new RegExp('{{' + escapedField + ' \\| time:\'\'}}', 'g'), ''); // remove empty templates with Regex + } + else { + return undefined; + } +} +exports.template = template; + +},{"./channel":45,"./datetime":46,"./scale":51,"./util":56}],55:[function(require,module,exports){ +/** Constants and utilities for data type */ +"use strict"; +(function (Type) { + Type[Type["QUANTITATIVE"] = 'quantitative'] = "QUANTITATIVE"; + Type[Type["ORDINAL"] = 'ordinal'] = "ORDINAL"; + Type[Type["TEMPORAL"] = 'temporal'] = "TEMPORAL"; + Type[Type["NOMINAL"] = 'nominal'] = "NOMINAL"; +})(exports.Type || (exports.Type = {})); +var Type = exports.Type; +exports.QUANTITATIVE = Type.QUANTITATIVE; +exports.ORDINAL = Type.ORDINAL; +exports.TEMPORAL = Type.TEMPORAL; +exports.NOMINAL = Type.NOMINAL; +/** + * Mapping from full type names to short type names. + * @type {Object} + */ +exports.SHORT_TYPE = { + quantitative: 'Q', + temporal: 'T', + nominal: 'N', + ordinal: 'O' +}; +/** + * Mapping from short type names to full type names. + * @type {Object} + */ +exports.TYPE_FROM_SHORT_TYPE = { + Q: exports.QUANTITATIVE, + T: exports.TEMPORAL, + O: exports.ORDINAL, + N: exports.NOMINAL +}; +/** + * Get full, lowercase type name for a given type. + * @param type + * @return Full type name. + */ +function getFullName(type) { + var typeString = type; // force type as string so we can translate short types + return exports.TYPE_FROM_SHORT_TYPE[typeString.toUpperCase()] || + typeString.toLowerCase(); +} +exports.getFullName = getFullName; + +},{}],56:[function(require,module,exports){ +/// +/// +"use strict"; +var stringify = require('json-stable-stringify'); +var util_1 = require('datalib/src/util'); +exports.keys = util_1.keys; +exports.extend = util_1.extend; +exports.duplicate = util_1.duplicate; +exports.isArray = util_1.isArray; +exports.vals = util_1.vals; +exports.truncate = util_1.truncate; +exports.toMap = util_1.toMap; +exports.isObject = util_1.isObject; +exports.isString = util_1.isString; +exports.isNumber = util_1.isNumber; +exports.isBoolean = util_1.isBoolean; +var util_2 = require('datalib/src/util'); +var util_3 = require('datalib/src/util'); +/** + * Creates an object composed of the picked object properties. + * + * Example: (from lodash) + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * pick(object, ['a', 'c']); + * // → { 'a': 1, 'c': 3 } + * + */ +function pick(obj, props) { + var copy = {}; + props.forEach(function (prop) { + if (obj.hasOwnProperty(prop)) { + copy[prop] = obj[prop]; + } + }); + return copy; +} +exports.pick = pick; +// Copied from datalib +function range(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) { + throw new Error('Infinite range'); + } + var range = [], i = -1, j; + if (step < 0) { + /* tslint:disable */ + while ((j = start + step * ++i) > stop) { + range.push(j); + } + } + else { + while ((j = start + step * ++i) < stop) { + range.push(j); + } + } + return range; +} +exports.range = range; +; +/** + * The opposite of _.pick; this method creates an object composed of the own + * and inherited enumerable string keyed properties of object that are not omitted. + */ +function omit(obj, props) { + var copy = util_2.duplicate(obj); + props.forEach(function (prop) { + delete copy[prop]; + }); + return copy; +} +exports.omit = omit; +function hash(a) { + if (util_3.isString(a) || util_3.isNumber(a) || util_3.isBoolean(a)) { + return String(a); + } + return stringify(a); +} +exports.hash = hash; +function contains(array, item) { + return array.indexOf(item) > -1; +} +exports.contains = contains; +/** Returns the array without the elements in item */ +function without(array, excludedItems) { + return array.filter(function (item) { + return !contains(excludedItems, item); + }); +} +exports.without = without; +function union(array, other) { + return array.concat(without(other, array)); +} +exports.union = union; +function forEach(obj, f, thisArg) { + if (obj.forEach) { + obj.forEach.call(thisArg, f); + } + else { + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + f.call(thisArg, obj[k], k, obj); + } + } + } +} +exports.forEach = forEach; +function reduce(obj, f, init, thisArg) { + if (obj.reduce) { + return obj.reduce.call(thisArg, f, init); + } + else { + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + init = f.call(thisArg, init, obj[k], k, obj); + } + } + return init; + } +} +exports.reduce = reduce; +function map(obj, f, thisArg) { + if (obj.map) { + return obj.map.call(thisArg, f); + } + else { + var output = []; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + output.push(f.call(thisArg, obj[k], k, obj)); + } + } + return output; + } +} +exports.map = map; +function some(arr, f) { + var i = 0; + for (var k = 0; k < arr.length; k++) { + if (f(arr[k], k, i++)) { + return true; + } + } + return false; +} +exports.some = some; +function every(arr, f) { + var i = 0; + for (var k = 0; k < arr.length; k++) { + if (!f(arr[k], k, i++)) { + return false; + } + } + return true; +} +exports.every = every; +function flatten(arrays) { + return [].concat.apply([], arrays); +} +exports.flatten = flatten; +function mergeDeep(dest) { + var src = []; + for (var _i = 1; _i < arguments.length; _i++) { + src[_i - 1] = arguments[_i]; + } + for (var i = 0; i < src.length; i++) { + dest = deepMerge_(dest, src[i]); + } + return dest; +} +exports.mergeDeep = mergeDeep; +; +// recursively merges src into dest +function deepMerge_(dest, src) { + if (typeof src !== 'object' || src === null) { + return dest; + } + for (var p in src) { + if (!src.hasOwnProperty(p)) { + continue; + } + if (src[p] === undefined) { + continue; + } + if (typeof src[p] !== 'object' || src[p] === null) { + dest[p] = src[p]; + } + else if (typeof dest[p] !== 'object' || dest[p] === null) { + dest[p] = mergeDeep(src[p].constructor === Array ? [] : {}, src[p]); + } + else { + mergeDeep(dest[p], src[p]); + } + } + return dest; +} +function unique(values, f) { + var results = []; + var u = {}, v, i, n; + for (i = 0, n = values.length; i < n; ++i) { + v = f ? f(values[i]) : values[i]; + if (v in u) { + continue; + } + u[v] = 1; + results.push(values[i]); + } + return results; +} +exports.unique = unique; +; +function warning(message) { + console.warn('[VL Warning]', message); +} +exports.warning = warning; +function error(message) { + console.error('[VL Error]', message); +} +exports.error = error; +/** + * Returns true if the two dicitonaries disagree. Applies only to defioned values. + */ +function differ(dict, other) { + for (var key in dict) { + if (dict.hasOwnProperty(key)) { + if (other[key] && dict[key] && other[key] !== dict[key]) { + return true; + } + } + } + return false; +} +exports.differ = differ; + +},{"datalib/src/util":37,"json-stable-stringify":38}]},{},[14])(14) +}); +//# sourceMappingURL=compassql.js.map diff --git a/compassql.js.map b/compassql.js.map new file mode 100644 index 00000000..afdb0d14 --- /dev/null +++ b/compassql.js.map @@ -0,0 +1,125 @@ +{ + "version": 3, + "sources": [ + "node_modules/browser-pack/_prelude.js", + "node_modules/browser-resolve/empty.js", + "node_modules/d3-time/build/d3-time.js", + "node_modules/datalib/src/bins/bins.js", + "node_modules/datalib/src/generate.js", + "node_modules/datalib/src/import/type.js", + "node_modules/datalib/src/stats.js", + "node_modules/datalib/src/time.js", + "node_modules/datalib/src/util.js", + "src/config.js", + "src/constraint/base.js", + "src/constraint/constraint.js", + "src/constraint/encoding.js", + "src/constraint/spec.js", + "src/cql.js", + "src/enumerator.js", + "src/enumspec.js", + "src/enumspecindex.js", + "src/generate.js", + "src/model.js", + "src/nest.js", + "src/property.js", + "src/query/encoding.js", + "src/query/groupby.js", + "src/query/query.js", + "src/query/shorthand.js", + "src/query/spec.js", + "src/query/transform.js", + "src/ranking/aggregation.js", + "src/ranking/effectiveness/channel.js", + "src/ranking/effectiveness/effectiveness.js", + "src/ranking/effectiveness/mark.js", + "src/ranking/effectiveness/type.js", + "src/ranking/ranking.js", + "src/schema.js", + "src/stylize.js", + "src/util.js", + "../vega-lite/node_modules/datalib/src/util.js", + "../vega-lite/node_modules/json-stable-stringify/index.js", + "../vega-lite/node_modules/jsonify/index.js", + "../vega-lite/node_modules/jsonify/lib/parse.js", + "../vega-lite/node_modules/jsonify/lib/stringify.js", + "../vega-lite/src/aggregate.js", + "../vega-lite/src/axis.js", + "../vega-lite/src/bin.js", + "../vega-lite/src/channel.js", + "../vega-lite/src/datetime.js", + "../vega-lite/src/encoding.js", + "../vega-lite/src/fielddef.js", + "../vega-lite/src/filter.js", + "../vega-lite/src/mark.js", + "../vega-lite/src/scale.js", + "../vega-lite/src/sort.js", + "../vega-lite/src/stack.js", + "../vega-lite/src/timeunit.js", + "../vega-lite/src/type.js", + "../vega-lite/src/util.js" + ], + "names": [], + "mappings": "AAAA;ACAA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACjTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7TA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9jBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1qBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACx1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzFA;AACA;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC1SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "file": "generated.js", + "sourceRoot": "", + "sourcesContent": [ + "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) {\n interval.count = function(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 = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n };\n\n var millisecond = newInterval(function() {\n // noop\n }, function(date, step) {\n date.setTime(+date + step);\n }, function(start, end) {\n return end - start;\n });\n\n // An optimized implementation for this simple case.\n millisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return newInterval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n };\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n }, function(date) {\n return date.getSeconds();\n });\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n }, function(date) {\n return date.getMinutes();\n });\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n }, function(date) {\n return date.getHours();\n });\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n }, function(date) {\n return date.getDate() - 1;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n var tuesday = weekday(2);\n var wednesday = weekday(3);\n var thursday = weekday(4);\n var friday = weekday(5);\n var saturday = weekday(6);\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n }, function(date) {\n return date.getMonth();\n });\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n }, function(date) {\n return date.getFullYear();\n });\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n }, function(date) {\n return date.getUTCSeconds();\n });\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n }, function(date) {\n return date.getUTCMinutes();\n });\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n }, function(date) {\n return date.getUTCHours();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n }, function(date) {\n return date.getUTCDate() - 1;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n var utcTuesday = utcWeekday(2);\n var utcWednesday = utcWeekday(3);\n var utcThursday = utcWeekday(4);\n var utcFriday = utcWeekday(5);\n var utcSaturday = utcWeekday(6);\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n }, function(date) {\n return date.getUTCMonth();\n });\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n }, function(date) {\n return date.getUTCFullYear();\n });\n\n var milliseconds = millisecond.range;\n var seconds = second.range;\n var minutes = minute.range;\n var hours = hour.range;\n var days = day.range;\n var sundays = sunday.range;\n var mondays = monday.range;\n var tuesdays = tuesday.range;\n var wednesdays = wednesday.range;\n var thursdays = thursday.range;\n var fridays = friday.range;\n var saturdays = saturday.range;\n var weeks = sunday.range;\n var months = month.range;\n var years = year.range;\n\n var utcMillisecond = millisecond;\n var utcMilliseconds = milliseconds;\n var utcSeconds = utcSecond.range;\n var utcMinutes = utcMinute.range;\n var utcHours = utcHour.range;\n var utcDays = utcDay.range;\n var utcSundays = utcSunday.range;\n var utcMondays = utcMonday.range;\n var utcTuesdays = utcTuesday.range;\n var utcWednesdays = utcWednesday.range;\n var utcThursdays = utcThursday.range;\n var utcFridays = utcFriday.range;\n var utcSaturdays = utcSaturday.range;\n var utcWeeks = utcSunday.range;\n var utcMonths = utcMonth.range;\n var utcYears = utcYear.range;\n\n var version = \"0.1.1\";\n\n exports.version = version;\n exports.milliseconds = milliseconds;\n exports.seconds = seconds;\n exports.minutes = minutes;\n exports.hours = hours;\n exports.days = days;\n exports.sundays = sundays;\n exports.mondays = mondays;\n exports.tuesdays = tuesdays;\n exports.wednesdays = wednesdays;\n exports.thursdays = thursdays;\n exports.fridays = fridays;\n exports.saturdays = saturdays;\n exports.weeks = weeks;\n exports.months = months;\n exports.years = years;\n exports.utcMillisecond = utcMillisecond;\n exports.utcMilliseconds = utcMilliseconds;\n exports.utcSeconds = utcSeconds;\n exports.utcMinutes = utcMinutes;\n exports.utcHours = utcHours;\n exports.utcDays = utcDays;\n exports.utcSundays = utcSundays;\n exports.utcMondays = utcMondays;\n exports.utcTuesdays = utcTuesdays;\n exports.utcWednesdays = utcWednesdays;\n exports.utcThursdays = utcThursdays;\n exports.utcFridays = utcFridays;\n exports.utcSaturdays = utcSaturdays;\n exports.utcWeeks = utcWeeks;\n exports.utcMonths = utcMonths;\n exports.utcYears = utcYears;\n exports.millisecond = millisecond;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.sunday = sunday;\n exports.monday = monday;\n exports.tuesday = tuesday;\n exports.wednesday = wednesday;\n exports.thursday = thursday;\n exports.friday = friday;\n exports.saturday = saturday;\n exports.week = sunday;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcSunday = utcSunday;\n exports.utcMonday = utcMonday;\n exports.utcTuesday = utcTuesday;\n exports.utcWednesday = utcWednesday;\n exports.utcThursday = utcThursday;\n exports.utcFriday = utcFriday;\n exports.utcSaturday = utcSaturday;\n exports.utcWeek = utcSunday;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n exports.interval = newInterval;\n\n}));", + "var util = require('../util'),\n time = require('../time'),\n EPSILON = 1e-15;\n\nfunction bins(opt) {\n if (!opt) { throw Error(\"Missing binning options.\"); }\n\n // determine range\n var maxb = opt.maxbins || 15,\n base = opt.base || 10,\n logb = Math.log(base),\n div = opt.div || [5, 2],\n min = opt.min,\n max = opt.max,\n span = max - min,\n step, level, minstep, precision, v, i, eps;\n\n if (opt.step) {\n // if step size is explicitly given, use that\n step = opt.step;\n } else if (opt.steps) {\n // if provided, limit choice to acceptable step sizes\n step = opt.steps[Math.min(\n opt.steps.length - 1,\n bisect(opt.steps, span/maxb, 0, opt.steps.length)\n )];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = opt.minstep || 0;\n step = Math.max(\n minstep,\n Math.pow(base, Math.round(Math.log(span) / logb) - level)\n );\n\n // increase step size if too many bins\n while (Math.ceil(span/step) > maxb) { step *= base; }\n\n // decrease step size if allowed\n for (i=0; i= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n precision = v >= 0 ? 0 : ~~(-v / logb) + 1;\n eps = Math.pow(base, -precision - 1);\n min = Math.min(min, Math.floor(min / step + eps) * step);\n max = Math.ceil(max / step) * step;\n\n return {\n start: min,\n stop: max,\n step: step,\n unit: {precision: precision},\n value: value,\n index: index\n };\n}\n\nfunction bisect(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (util.cmp(a[mid], x) < 0) { lo = mid + 1; }\n else { hi = mid; }\n }\n return lo;\n}\n\nfunction value(v) {\n return this.step * Math.floor(v / this.step + EPSILON);\n}\n\nfunction index(v) {\n return Math.floor((v - this.start) / this.step + EPSILON);\n}\n\nfunction date_value(v) {\n return this.unit.date(value.call(this, v));\n}\n\nfunction date_index(v) {\n return index.call(this, this.unit.unit(v));\n}\n\nbins.date = function(opt) {\n if (!opt) { throw Error(\"Missing date binning options.\"); }\n\n // find time step, then bin\n var units = opt.utc ? time.utc : time,\n dmin = opt.min,\n dmax = opt.max,\n maxb = opt.maxbins || 20,\n minb = opt.minbins || 4,\n span = (+dmax) - (+dmin),\n unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb),\n spec = bins({\n min: unit.min != null ? unit.min : unit.unit(dmin),\n max: unit.max != null ? unit.max : unit.unit(dmax),\n maxbins: maxb,\n minstep: unit.minstep,\n steps: unit.step\n });\n\n spec.unit = unit;\n spec.index = date_index;\n if (!opt.raw) spec.value = date_value;\n return spec;\n};\n\nmodule.exports = bins;\n", + "var util = require('./util'),\n gen = module.exports;\n\ngen.repeat = function(val, n) {\n var a = Array(n), i;\n for (i=0; i stop) range.push(j);\n else while ((j = start + step * ++i) < stop) range.push(j);\n return range;\n};\n\ngen.random = {};\n\ngen.random.uniform = function(min, max) {\n if (max === undefined) {\n max = min === undefined ? 1 : min;\n min = 0;\n }\n var d = max - min;\n var f = function() {\n return min + d * Math.random();\n };\n f.samples = function(n) {\n return gen.zeros(n).map(f);\n };\n f.pdf = function(x) {\n return (x >= min && x <= max) ? 1/d : 0;\n };\n f.cdf = function(x) {\n return x < min ? 0 : x > max ? 1 : (x - min) / d;\n };\n f.icdf = function(p) {\n return (p >= 0 && p <= 1) ? min + p*d : NaN;\n };\n return f;\n};\n\ngen.random.integer = function(a, b) {\n if (b === undefined) {\n b = a;\n a = 0;\n }\n var d = b - a;\n var f = function() {\n return a + Math.floor(d * Math.random());\n };\n f.samples = function(n) {\n return gen.zeros(n).map(f);\n };\n f.pdf = function(x) {\n return (x === Math.floor(x) && x >= a && x < b) ? 1/d : 0;\n };\n f.cdf = function(x) {\n var v = Math.floor(x);\n return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;\n };\n f.icdf = function(p) {\n return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p*d) : NaN;\n };\n return f;\n};\n\ngen.random.normal = function(mean, stdev) {\n mean = mean || 0;\n stdev = stdev || 1;\n var next;\n var f = function() {\n var x = 0, y = 0, rds, c;\n if (next !== undefined) {\n x = next;\n next = undefined;\n return x;\n }\n do {\n x = Math.random()*2-1;\n y = Math.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 next = mean + y*c*stdev;\n return mean + x*c*stdev;\n };\n f.samples = function(n) {\n return gen.zeros(n).map(f);\n };\n f.pdf = function(x) {\n var exp = Math.exp(Math.pow(x-mean, 2) / (-2 * Math.pow(stdev, 2)));\n return (1 / (stdev * Math.sqrt(2*Math.PI))) * exp;\n };\n f.cdf = function(x) {\n // Approximation from West (2009)\n // Better Approximations to Cumulative Normal Functions\n var cd,\n z = (x - mean) / stdev,\n Z = Math.abs(z);\n if (Z > 37) {\n cd = 0;\n } else {\n var sum, exp = Math.exp(-Z*Z/2);\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 f.icdf = function(p) {\n // Approximation of Probit function using inverse error function.\n if (p <= 0 || p >= 1) return NaN;\n var x = 2*p - 1,\n v = (8 * (Math.PI - 3)) / (3 * Math.PI * (4-Math.PI)),\n a = (2 / (Math.PI*v)) + (Math.log(1 - Math.pow(x,2)) / 2),\n b = Math.log(1 - (x*x)) / v,\n s = (x > 0 ? 1 : -1) * Math.sqrt(Math.sqrt((a*a) - b) - a);\n return mean + stdev * Math.SQRT2 * s;\n };\n return f;\n};\n\ngen.random.bootstrap = function(domain, smooth) {\n // Generates a bootstrap sample from a set of observations.\n // Smooth bootstrapping adds random zero-centered noise to the samples.\n var val = domain.filter(util.isValid),\n len = val.length,\n err = smooth ? gen.random.normal(0, smooth) : null;\n var f = function() {\n return val[~~(Math.random()*len)] + (err ? err() : 0);\n };\n f.samples = function(n) {\n return gen.zeros(n).map(f);\n };\n return f;\n};", + "var util = require('../util');\n\nvar TYPES = '__types__';\n\nvar PARSERS = {\n boolean: util.boolean,\n integer: util.number,\n number: util.number,\n date: util.date,\n string: function(x) { return x==='' ? null : x; }\n};\n\nvar TESTS = {\n boolean: function(x) { return x==='true' || x==='false' || util.isBoolean(x); },\n integer: function(x) { return TESTS.number(x) && (x=+x) === ~~x; },\n number: function(x) { return !isNaN(+x) && !util.isDate(x); },\n date: function(x) { return !isNaN(Date.parse(x)); }\n};\n\nfunction annotation(data, types) {\n if (!types) return data && data[TYPES] || null;\n data[TYPES] = types;\n}\n\nfunction type(values, f) {\n values = util.array(values);\n f = util.$(f);\n var v, i, n;\n\n // if data array has type annotations, use them\n if (values[TYPES]) {\n v = f(values[TYPES]);\n if (util.isString(v)) return v;\n }\n\n for (i=0, n=values.length; !util.isValid(v) && i 0 ? Math.pow(mean, 1/c) : 0;\n return mean;\n};\n\n// Compute the harmonic mean of an array of numbers.\nstats.mean.harmonic = function(values, f) {\n f = util.$(f);\n var mean = 0, c, n, v, i;\n for (i=0, c=0, n=values.length; i b) b = v;\n }\n }\n return [a, b];\n};\n\n// Find the integer indices of the minimum and maximum values.\nstats.extent.index = function(values, f) {\n f = util.$(f);\n var x = -1, y = -1, a, b, v, i, n = values.length;\n for (i=0; i b) { b = v; y = i; }\n }\n }\n return [x, y];\n};\n\n// Compute the dot product of two arrays of numbers.\nstats.dot = function(values, a, b) {\n var sum = 0, i, v;\n if (!b) {\n if (values.length !== a.length) {\n throw Error('Array lengths must match.');\n }\n for (i=0; i -1 && p !== v) {\n mu = 1 + (i-1 + tie) / 2;\n for (; tie -1) {\n mu = 1 + (n-1 + tie) / 2;\n for (; tie max) max = x;\n delta = x - mean;\n mean = mean + delta / (++valid);\n M2 = M2 + delta * (x - mean);\n vals.push(x);\n }\n }\n M2 = M2 / (valid - 1);\n sd = Math.sqrt(M2);\n\n // sort values for median and iqr\n vals.sort(util.cmp);\n\n return {\n type: type(values, f),\n unique: u,\n count: values.length,\n valid: valid,\n missing: missing,\n distinct: distinct,\n min: min,\n max: max,\n mean: mean,\n stdev: sd,\n median: (v = stats.quantile(vals, 0.5)),\n q1: stats.quantile(vals, 0.25),\n q3: stats.quantile(vals, 0.75),\n modeskew: sd === 0 ? 0 : (mean - v) / sd\n };\n};\n\n// Compute profiles for all variables in a data set.\nstats.summary = function(data, fields) {\n fields = fields || util.keys(data[0]);\n var s = fields.map(function(f) {\n var p = stats.profile(data, util.$(f));\n return (p.field = f, p);\n });\n return (s.__summary__ = true, s);\n};\n", + "var d3_time = require('d3-time');\n\nvar tempDate = new Date(),\n baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD\n utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0);\n\nfunction date(d) {\n return (tempDate.setTime(+d), tempDate);\n}\n\n// create a time unit entry\nfunction entry(type, date, unit, step, min, max) {\n var e = {\n type: type,\n date: date,\n unit: unit\n };\n if (step) {\n e.step = step;\n } else {\n e.minstep = 1;\n }\n if (min != null) e.min = min;\n if (max != null) e.max = max;\n return e;\n}\n\nfunction create(type, unit, base, step, min, max) {\n return entry(type,\n function(d) { return unit.offset(base, d); },\n function(d) { return unit.count(base, d); },\n step, min, max);\n}\n\nvar locale = [\n create('second', d3_time.second, baseDate),\n create('minute', d3_time.minute, baseDate),\n create('hour', d3_time.hour, baseDate),\n create('day', d3_time.day, baseDate, [1, 7]),\n create('month', d3_time.month, baseDate, [1, 3, 6]),\n create('year', d3_time.year, baseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(1970, 0, 1, 0, 0, d); },\n function(d) { return date(d).getSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(1970, 0, 1, 0, d); },\n function(d) { return date(d).getMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(1970, 0, 1, d); },\n function(d) { return date(d).getHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(1970, 0, 4+d); },\n function(d) { return date(d).getDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(1970, 0, d); },\n function(d) { return date(d).getDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(1970, d % 12, 1); },\n function(d) { return date(d).getMonth(); },\n [1], 0, 11\n )\n];\n\nvar utc = [\n create('second', d3_time.utcSecond, utcBaseDate),\n create('minute', d3_time.utcMinute, utcBaseDate),\n create('hour', d3_time.utcHour, utcBaseDate),\n create('day', d3_time.utcDay, utcBaseDate, [1, 7]),\n create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]),\n create('year', d3_time.utcYear, utcBaseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); },\n function(d) { return date(d).getUTCSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); },\n function(d) { return date(d).getUTCMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(Date.UTC(1970, 0, 1, d)); },\n function(d) { return date(d).getUTCHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(Date.UTC(1970, 0, 4+d)); },\n function(d) { return date(d).getUTCDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(Date.UTC(1970, 0, d)); },\n function(d) { return date(d).getUTCDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(Date.UTC(1970, d % 12, 1)); },\n function(d) { return date(d).getUTCMonth(); },\n [1], 0, 11\n )\n];\n\nvar STEPS = [\n [31536e6, 5], // 1-year\n [7776e6, 4], // 3-month\n [2592e6, 4], // 1-month\n [12096e5, 3], // 2-week\n [6048e5, 3], // 1-week\n [1728e5, 3], // 2-day\n [864e5, 3], // 1-day\n [432e5, 2], // 12-hour\n [216e5, 2], // 6-hour\n [108e5, 2], // 3-hour\n [36e5, 2], // 1-hour\n [18e5, 1], // 30-minute\n [9e5, 1], // 15-minute\n [3e5, 1], // 5-minute\n [6e4, 1], // 1-minute\n [3e4, 0], // 30-second\n [15e3, 0], // 15-second\n [5e3, 0], // 5-second\n [1e3, 0] // 1-second\n];\n\nfunction find(units, span, minb, maxb) {\n var step = STEPS[0], i, n, bins;\n\n for (i=1, n=STEPS.length; i step[0]) {\n bins = span / step[0];\n if (bins > maxb) {\n return units[STEPS[i-1][1]];\n }\n if (bins >= minb) {\n return units[step[1]];\n }\n }\n }\n return units[STEPS[n-1][1]];\n}\n\nfunction toUnitMap(units) {\n var map = {}, i, n;\n for (i=0, n=units.length; i 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n// permutes an array using a Knuth shuffle\nu.permute = function(a) {\n var m = a.length,\n swap,\n i;\n\n while (m) {\n i = Math.floor(Math.random() * m--);\n swap = a[m];\n a[m] = a[i];\n a[i] = swap;\n }\n};\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n return false;\n }\n }\n }\n }\n return true;\n }\n },\n {\n name: 'omitNonPositionalOverPositionalChannels',\n description: 'Do not use non-positional channels unless all positional channels are used',\n properties: [property_1.Property.CHANNEL],\n allowEnumSpecForProperties: false,\n strict: false,\n satisfy: function (specM, schema, opt) {\n return util_1.some(channel_1.NONSPATIAL_CHANNELS, function (channel) { return specM.channelUsed(channel); }) ?\n // if non-positional channels are used, then both x and y must be used.\n specM.channelUsed(channel_1.Channel.X) && specM.channelUsed(channel_1.Channel.Y) :\n true;\n }\n },\n {\n name: 'omitRaw',\n description: 'Omit raw plots.',\n properties: [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT],\n allowEnumSpecForProperties: false,\n strict: false,\n satisfy: function (specM, schema, opt) {\n if (!specM.isAggregate()) {\n return false;\n }\n return true;\n }\n },\n {\n name: 'omitRawContinuousFieldForAggregatePlot',\n description: 'Aggregate plot should not use raw continuous field as group by values. ' +\n '(Quantitative should be binned. Temporal should have time unit.)',\n properties: [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.TYPE],\n allowEnumSpecForProperties: true,\n strict: false,\n satisfy: function (specM, schema, opt) {\n if (specM.isAggregate()) {\n return util_1.every(specM.getEncodings(), function (encQ) {\n if (encQ.type === type_1.Type.TEMPORAL) {\n // Temporal fields should have timeUnit or is still an enumSpec\n return !!encQ.timeUnit;\n }\n if (encQ.type === type_1.Type.QUANTITATIVE) {\n return !!encQ.bin || !!encQ.aggregate || !!encQ.autoCount;\n }\n return true;\n });\n }\n return true;\n }\n },\n {\n name: 'omitRawDetail',\n description: 'Do not use detail channel with raw plot.',\n properties: [property_1.Property.CHANNEL, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT],\n allowEnumSpecForProperties: false,\n strict: true,\n satisfy: function (specM, schema, opt) {\n if (specM.isAggregate()) {\n return true;\n }\n return util_1.every(specM.getEncodings(), function (encQ) {\n return encQ.channel !== channel_1.Channel.DETAIL;\n });\n }\n },\n {\n name: 'omitRepeatedField',\n description: 'Each field should be mapped to only one channel',\n properties: [property_1.Property.FIELD],\n allowEnumSpecForProperties: true,\n strict: false,\n satisfy: function (specM, schema, opt) {\n var usedField = {};\n // the same field should not be encoded twice\n return util_1.every(specM.getEncodings(), function (encQ) {\n if (encQ.field && !enumspec_1.isEnumSpec(encQ.field)) {\n // If field is specified, it should not be used already\n if (usedField[encQ.field]) {\n return false;\n }\n usedField[encQ.field] = true;\n return true;\n }\n return true; // unspecified field is valid\n });\n }\n },\n // TODO: omitShapeWithBin\n {\n name: 'omitVerticalDotPlot',\n description: 'Do not output vertical dot plot.',\n properties: [property_1.Property.CHANNEL],\n allowEnumSpecForProperties: true,\n strict: false,\n satisfy: function (specM, schema, opt) {\n var encodings = specM.getEncodings();\n if (encodings.length === 1 && encodings[0].channel === channel_1.Channel.Y) {\n return false;\n }\n return true;\n }\n },\n // EXPENSIVE CONSTRAINTS -- check them later!\n {\n name: 'hasAppropriateGraphicTypeForMark',\n description: 'Has appropriate graphic type for mark',\n properties: [property_1.Property.CHANNEL, property_1.Property.MARK, property_1.Property.TYPE, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT],\n allowEnumSpecForProperties: false,\n strict: false,\n satisfy: function (specM, schema, opt) {\n var mark = specM.getMark();\n switch (mark) {\n case mark_1.Mark.AREA:\n case mark_1.Mark.LINE:\n if (specM.isAggregate()) {\n var xEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.X);\n var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y);\n var xIsMeasure = xEncQ && encoding_2.isMeasure(xEncQ);\n var yIsMeasure = yEncQ && encoding_2.isMeasure(yEncQ);\n // for aggregate line / area, we need at least one group-by axis and one measure axis.\n return xEncQ && yEncQ && (xIsMeasure !== yIsMeasure) &&\n // and the dimension axis should not be nominal\n // TODO: make this clause optional\n !(!xIsMeasure && xEncQ.type === type_1.Type.NOMINAL) &&\n !(!yIsMeasure && yEncQ.type === type_1.Type.NOMINAL);\n }\n return true;\n case mark_1.Mark.TEXT:\n // FIXME correctly when we add text\n return true;\n case mark_1.Mark.BAR:\n case mark_1.Mark.TICK:\n // Bar and tick should not use size.\n if (specM.channelUsed(channel_1.Channel.SIZE)) {\n return false;\n }\n // Tick and Bar should have one and only one measure\n if (specM.isMeasure(channel_1.Channel.X) !== specM.isMeasure(channel_1.Channel.Y)) {\n // TODO: Bar and tick's dimension should not be continuous (quant/time) scale\n return true;\n }\n return false;\n case mark_1.Mark.CIRCLE:\n case mark_1.Mark.POINT:\n case mark_1.Mark.SQUARE:\n case mark_1.Mark.RULE:\n return true;\n }\n /* istanbul ignore next */\n throw new Error('hasAllRequiredChannelsForMark not implemented for mark' + mark);\n }\n },\n {\n name: 'omitNonSumStack',\n description: 'Stacked plot should use summative aggregation such as sum, count, or distinct',\n properties: [property_1.Property.CHANNEL, property_1.Property.MARK, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT],\n allowEnumSpecForProperties: false,\n strict: false,\n satisfy: function (specM, schema, opt) {\n var stack = specM.stack();\n if (stack) {\n var measureEncQ = specM.getEncodingQueryByChannel(stack.fieldChannel);\n return util_1.contains(aggregate_1.SUM_OPS, measureEncQ.aggregate) || !!measureEncQ.autoCount;\n }\n return true;\n }\n },\n {\n name: 'omitTableWithOcclusionIfAutoAddCount',\n description: 'Plots without aggregation or autocount where x and y are both dimensions should be omitted if autoAddCount is enabled as they often lead to occlusion',\n properties: [property_1.Property.CHANNEL, property_1.Property.TYPE, property_1.Property.TIMEUNIT, property_1.Property.BIN, property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT],\n allowEnumSpecForProperties: false,\n strict: false,\n satisfy: function (specM, schema, opt) {\n if (opt.autoAddCount) {\n // TODO(#186): take mark properties channel into account\n if (specM.isDimension(channel_1.Channel.X) &&\n specM.isDimension(channel_1.Channel.Y) &&\n !specM.isAggregate() // TODO: refactor based on statistics\n ) {\n return false;\n }\n }\n return true;\n }\n }\n].map(function (sc) { return new SpecConstraintModel(sc); });\n// For testing\nexports.SPEC_CONSTRAINT_INDEX = exports.SPEC_CONSTRAINTS.reduce(function (m, c) {\n m[c.name()] = c;\n return m;\n}, {});\n//\nexports.SPEC_CONSTRAINTS_BY_PROPERTY = exports.SPEC_CONSTRAINTS.reduce(function (m, c) {\n c.properties().forEach(function (prop) {\n m[prop] = m[prop] || [];\n m[prop].push(c);\n });\n return m;\n}, {});\n/**\n * Check all encoding constraints for a particular property and index tuple\n */\nfunction checkSpec(prop, enumSpec, specM, schema, opt) {\n // Check encoding constraint\n var specConstraints = exports.SPEC_CONSTRAINTS_BY_PROPERTY[prop] || [];\n for (var i = 0; i < specConstraints.length; i++) {\n var c = specConstraints[i];\n // Check if the constraint is enabled\n if (c.strict() || !!opt[c.name()]) {\n // For strict constraint, or enabled non-strict, check the constraints\n var satisfy = c.satisfy(specM, schema, opt);\n if (!satisfy) {\n var violatedConstraint = '(spec) ' + c.name();\n /* istanbul ignore if */\n if (opt.verbose) {\n console.log(violatedConstraint + ' failed with ' + specM.toShorthand() + ' for ' + enumSpec.name);\n }\n return violatedConstraint;\n }\n }\n }\n return null;\n}\nexports.checkSpec = checkSpec;\n//# sourceMappingURL=spec.js.map", + "\"use strict\";\nexports.version = '0.5.2';\nvar util_1 = require('./util');\nexports.constraint = require('./constraint/constraint');\nexports.enumerate = require('./enumerator');\nexports.enumSpec = require('./enumspec');\nvar generate_1 = require('./generate');\nexports.generate = generate_1.generate;\nexports.model = require('./model');\nexports.nest = require('./nest');\nexports.property = require('./property');\n// Make it so that we can call cql.query() as method, or access other methods inside cql.query\nvar cqlQuery = require('./query/query');\nvar query_1 = require('./query/query');\nexports.query = util_1.extend(query_1.query, cqlQuery);\nexports.ranking = require('./ranking/ranking');\nexports.schema = require('./schema');\nexports.util = require('./util');\n//# sourceMappingURL=cql.js.map", + "\"use strict\";\nvar encoding_1 = require('./constraint/encoding');\nvar spec_1 = require('./constraint/spec');\nvar property_1 = require('./property');\nexports.ENUMERATOR_INDEX = {};\nexports.ENUMERATOR_INDEX[property_1.Property.MARK] = function (enumSpecIndex, schema, opt) {\n return function (answerSet, specM) {\n var markEnumSpec = specM.getMark();\n // enumerate the value\n markEnumSpec.enum.forEach(function (mark) {\n specM.setMark(mark);\n // Check spec constraint\n var violatedSpecConstraint = spec_1.checkSpec(property_1.Property.MARK, enumSpecIndex.mark, specM, schema, opt);\n if (!violatedSpecConstraint) {\n // emit\n answerSet.push(specM.duplicate());\n }\n });\n // Reset to avoid side effect\n specM.resetMark();\n return answerSet;\n };\n};\nproperty_1.ENCODING_PROPERTIES.forEach(function (prop) {\n exports.ENUMERATOR_INDEX[prop] = EncodingPropertyGeneratorFactory(prop);\n});\nproperty_1.NESTED_ENCODING_PROPERTIES.forEach(function (nestedProp) {\n exports.ENUMERATOR_INDEX[nestedProp.property] = EncodingPropertyGeneratorFactory(nestedProp.property);\n});\n/**\n * @param prop property type.\n * @return an answer set reducer factory for the given prop.\n */\nfunction EncodingPropertyGeneratorFactory(prop) {\n /**\n * @return as reducer that takes a specQueryModel as input and output an answer set array.\n */\n return function (enumSpecIndex, schema, opt) {\n return function (answerSet, specM) {\n // index of encoding mappings that require enumeration\n var indices = enumSpecIndex.encodingIndicesByProperty[prop];\n function enumerate(jobIndex) {\n if (jobIndex === indices.length) {\n // emit and terminate\n answerSet.push(specM.duplicate());\n return;\n }\n var index = indices[jobIndex];\n var enumSpec = enumSpecIndex.encodings[index][prop];\n var encQ = specM.getEncodingQueryByIndex(index);\n var propEnumSpec = specM.getEncodingProperty(index, prop);\n if (\n // TODO: encQ.exclude\n // If this encoding query is an excluded autoCount, there is no point enumerating other properties\n // for this encoding query because they will be excluded anyway.\n // Thus, we can just move on to the next encoding to enumerate.\n encQ.autoCount === false ||\n // nested encoding property might have its parent set to false\n // therefore, we no longer have to enumerate them\n !propEnumSpec) {\n enumerate(jobIndex + 1);\n }\n else {\n enumSpec.enum.forEach(function (propVal) {\n if (propVal === null) {\n // our duplicate() method use JSON.stringify, parse and thus can accidentally\n // convert undefined in an array into null\n propVal = undefined;\n }\n specM.setEncodingProperty(index, prop, propVal, enumSpec);\n // Check encoding constraint\n var violatedEncodingConstraint = encoding_1.checkEncoding(prop, enumSpec, index, specM, schema, opt);\n if (violatedEncodingConstraint) {\n return; // do not keep searching\n }\n // Check spec constraint\n var violatedSpecConstraint = spec_1.checkSpec(prop, enumSpec, specM, schema, opt);\n if (violatedSpecConstraint) {\n return; // do not keep searching\n }\n // If qualify all of the constraints, keep enumerating\n enumerate(jobIndex + 1);\n });\n // Reset to avoid side effect\n specM.resetEncodingProperty(index, prop, enumSpec);\n }\n }\n // start enumerating from 0\n enumerate(0);\n return answerSet;\n };\n };\n}\nexports.EncodingPropertyGeneratorFactory = EncodingPropertyGeneratorFactory;\n//# sourceMappingURL=enumerator.js.map", + "\"use strict\";\nvar util_1 = require('./util');\n/** Enum for a short form of the enumeration spec. */\n(function (ShortEnumSpec) {\n ShortEnumSpec[ShortEnumSpec[\"ENUMSPEC\"] = '?'] = \"ENUMSPEC\";\n})(exports.ShortEnumSpec || (exports.ShortEnumSpec = {}));\nvar ShortEnumSpec = exports.ShortEnumSpec;\nexports.SHORT_ENUM_SPEC = ShortEnumSpec.ENUMSPEC;\nfunction isEnumSpec(prop) {\n return prop === exports.SHORT_ENUM_SPEC || (prop !== undefined && (!!prop.enum || !!prop.name) && !util_1.isArray(prop));\n}\nexports.isEnumSpec = isEnumSpec;\nfunction initEnumSpec(prop, defaultName, defaultEnumValues) {\n return util_1.extend({}, {\n name: defaultName,\n enum: defaultEnumValues\n }, prop === exports.SHORT_ENUM_SPEC ? {} : prop);\n}\nexports.initEnumSpec = initEnumSpec;\n//# sourceMappingURL=enumspec.js.map", + "\"use strict\";\nvar property_1 = require('./property');\nvar util_1 = require('./util');\nvar EnumSpecIndex = (function () {\n function EnumSpecIndex() {\n this._mark = undefined;\n this._encodings = {};\n this._encodingIndicesByProperty = {};\n }\n EnumSpecIndex.prototype.setEncodingProperty = function (index, prop, enumSpec) {\n var encodingsIndex = this._encodings;\n // Init encoding index and set prop\n var encIndex = encodingsIndex[index] = encodingsIndex[index] || {};\n encIndex[prop] = enumSpec;\n // Initialize indicesByProperty[prop] and add index\n var encodingIndicesByProperty = this._encodingIndicesByProperty;\n (encodingIndicesByProperty[prop] = encodingIndicesByProperty[prop] || []).push(index);\n return this;\n };\n EnumSpecIndex.prototype.hasProperty = function (prop) {\n if (property_1.isEncodingProperty(prop)) {\n return !!this.encodingIndicesByProperty[prop];\n }\n if (prop === property_1.Property.MARK) {\n return !!this.mark;\n }\n /* istanbul ignore next */\n throw new Error('Unimplemented for property ' + prop);\n };\n EnumSpecIndex.prototype.isEmpty = function () {\n return !this.mark && util_1.keys(this.encodingIndicesByProperty).length === 0;\n };\n EnumSpecIndex.prototype.setMark = function (mark) {\n this._mark = mark;\n return this;\n };\n Object.defineProperty(EnumSpecIndex.prototype, \"mark\", {\n get: function () {\n return this._mark;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(EnumSpecIndex.prototype, \"encodings\", {\n get: function () {\n return this._encodings;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(EnumSpecIndex.prototype, \"encodingIndicesByProperty\", {\n get: function () {\n return this._encodingIndicesByProperty;\n },\n enumerable: true,\n configurable: true\n });\n return EnumSpecIndex;\n}());\nexports.EnumSpecIndex = EnumSpecIndex;\n//# sourceMappingURL=enumspecindex.js.map", + "\"use strict\";\nvar enumerator_1 = require('../src/enumerator');\nvar config_1 = require('./config');\nvar model_1 = require('./model');\nvar stylize_1 = require('./stylize');\nfunction generate(specQ, schema, opt) {\n if (opt === void 0) { opt = config_1.DEFAULT_QUERY_CONFIG; }\n // 1. Build a SpecQueryModel, which also contains enumSpecIndex\n var specM = model_1.SpecQueryModel.build(specQ, schema, opt);\n var enumSpecIndex = specM.enumSpecIndex;\n // 2. Enumerate each of the properties based on propPrecedence.\n var answerSet = [specM]; // Initialize Answer Set with only the input spec query.\n opt.propertyPrecedence.forEach(function (prop) {\n // If the original specQuery contains enumSpec for this prop\n if (enumSpecIndex.hasProperty(prop)) {\n // update answerset\n var reducer = enumerator_1.ENUMERATOR_INDEX[prop](enumSpecIndex, schema, opt);\n answerSet = answerSet.reduce(reducer, []);\n }\n });\n if ((opt.nominalColorScaleForHighCardinality !== null) ||\n (opt.smallBandSizeForHighCardinalityOrFacet !== null) ||\n (opt.xAxisOnTopForHighYCardinalityWithoutColumn !== null)) {\n return stylize_1.stylize(answerSet, schema, opt);\n }\n return answerSet;\n}\nexports.generate = generate;\n//# sourceMappingURL=generate.js.map", + "\"use strict\";\nvar aggregate_1 = require('vega-lite/src/aggregate');\nvar type_1 = require('vega-lite/src/type');\nvar property_1 = require('./property');\nvar enumspec_1 = require('./enumspec');\nvar enumspecindex_1 = require('./enumspecindex');\nvar spec_1 = require('./query/spec');\nvar encoding_1 = require('./query/encoding');\nvar shorthand_1 = require('./query/shorthand');\nvar util_1 = require('./util');\nfunction getDefaultName(prop) {\n switch (prop) {\n case property_1.Property.MARK:\n return 'm';\n case property_1.Property.CHANNEL:\n return 'c';\n case property_1.Property.AGGREGATE:\n return 'a';\n case property_1.Property.AUTOCOUNT:\n return '#';\n case property_1.Property.BIN:\n return 'b';\n case property_1.Property.BIN_MAXBINS:\n return 'b-mb';\n case property_1.Property.SORT:\n return 'so';\n case property_1.Property.SORT_FIELD:\n return 'so-f';\n case property_1.Property.SORT_OP:\n return 'so-op';\n case property_1.Property.SORT_ORDER:\n return 'so-or';\n case property_1.Property.SCALE:\n return 's';\n case property_1.Property.SCALE_BANDSIZE:\n return 's-bs';\n case property_1.Property.SCALE_CLAMP:\n return 's-c';\n case property_1.Property.SCALE_DOMAIN:\n return 's-d';\n case property_1.Property.SCALE_EXPONENT:\n return 's-e';\n case property_1.Property.SCALE_NICE:\n return 's-n';\n case property_1.Property.SCALE_RANGE:\n return 's-ra';\n case property_1.Property.SCALE_ROUND:\n return 's-r';\n case property_1.Property.SCALE_TYPE:\n return 's-t';\n case property_1.Property.SCALE_USERAWDOMAIN:\n return 's-u';\n case property_1.Property.SCALE_ZERO:\n return 's-z';\n case property_1.Property.AXIS:\n return 'ax';\n case property_1.Property.AXIS_AXISCOLOR:\n return 'ax-ac';\n case property_1.Property.AXIS_AXISWIDTH:\n return 'ax-aw';\n case property_1.Property.AXIS_LAYER:\n return 'ax-lay';\n case property_1.Property.AXIS_OFFSET:\n return 'ax-of';\n case property_1.Property.AXIS_ORIENT:\n return 'ax-or';\n case property_1.Property.AXIS_GRID:\n return 'ax-g';\n case property_1.Property.AXIS_GRIDCOLOR:\n return 'ax-gc';\n case property_1.Property.AXIS_GRIDDASH:\n return 'ax-gd';\n case property_1.Property.AXIS_GRIDOPACITY:\n return 'ax-go';\n case property_1.Property.AXIS_GRIDWIDTH:\n return 'ax-gw';\n case property_1.Property.AXIS_LABELS:\n return 'ax-lab';\n case property_1.Property.AXIS_FORMAT:\n return 'ax-f';\n case property_1.Property.AXIS_LABELANGLE:\n return 'ax-laba';\n case property_1.Property.AXIS_LABELMAXLENGTH:\n return 'ax-labm';\n case property_1.Property.AXIS_SHORTTIMELABELS:\n return 'ax-stl';\n case property_1.Property.AXIS_SUBDIVIDE:\n return 'ax-sub';\n case property_1.Property.AXIS_TICKS:\n return 'ax-t';\n case property_1.Property.AXIS_TICKCOLOR:\n return 'ax-tc';\n case property_1.Property.AXIS_TICKLABELCOLOR:\n return 'ax-tlc';\n case property_1.Property.AXIS_TICKLABELFONT:\n return 'ax-tlf';\n case property_1.Property.AXIS_TICKLABELFONTSIZE:\n return 'ax-tlfs';\n case property_1.Property.AXIS_TICKPADDING:\n return 'ax-tp';\n case property_1.Property.AXIS_TICKSIZE:\n return 'ax-ts';\n case property_1.Property.AXIS_TICKSIZEMAJOR:\n return 'ax-tsma';\n case property_1.Property.AXIS_TICKSIZEMINOR:\n return 'ax-tsmi';\n case property_1.Property.AXIS_TICKSIZEEND:\n return 'ax-tse';\n case property_1.Property.AXIS_TICKWIDTH:\n return 'ax-tw';\n case property_1.Property.AXIS_VALUES:\n return 'ax-v';\n case property_1.Property.AXIS_TITLE:\n return 'ax-ti';\n case property_1.Property.AXIS_TITLECOLOR:\n return 'ax-tic';\n case property_1.Property.AXIS_TITLEFONT:\n return 'ax-tif';\n case property_1.Property.AXIS_TITLEFONTSIZE:\n return 'ax-tifs';\n case property_1.Property.AXIS_TITLEFONTWEIGHT:\n return 'ax-tifw';\n case property_1.Property.AXIS_TITLEOFFSET:\n return 'ax-tio';\n case property_1.Property.AXIS_TITLEMAXLENGTH:\n return 'ax-timl';\n case property_1.Property.AXIS_CHARACTERWIDTH:\n return 'ax-cw';\n case property_1.Property.LEGEND:\n return 'l';\n case property_1.Property.LEGEND_ORIENT:\n return 'l-or';\n case property_1.Property.LEGEND_OFFSET:\n return 'l-of';\n case property_1.Property.LEGEND_VALUES:\n return 'l-v';\n case property_1.Property.LEGEND_FORMAT:\n return 'l-f';\n case property_1.Property.LEGEND_LABELALIGN:\n return 'l-la';\n case property_1.Property.LEGEND_LABELBASELINE:\n return 'l-lb';\n case property_1.Property.LEGEND_LABELCOLOR:\n return 'l-lc';\n case property_1.Property.LEGEND_LABELFONT:\n return 'l-lf';\n case property_1.Property.LEGEND_LABELFONTSIZE:\n return 'l-lfs';\n case property_1.Property.LEGEND_SHORTTIMELABELS:\n return 'l-stl';\n case property_1.Property.LEGEND_SYMBOLCOLOR:\n return 'l-syc';\n case property_1.Property.LEGEND_SYMBOLSHAPE:\n return 'l-sysh';\n case property_1.Property.LEGEND_SYMBOLSIZE:\n return 'l-sysi';\n case property_1.Property.LEGEND_SYMBOLSTROKEWIDTH:\n return 'l-sysw';\n case property_1.Property.LEGEND_TITLE:\n return 'l-ti';\n case property_1.Property.LEGEND_TITLECOLOR:\n return 'l-tic';\n case property_1.Property.LEGEND_TITLEFONT:\n return 'l-tif';\n case property_1.Property.LEGEND_TITLEFONTSIZE:\n return 'l-tifs';\n case property_1.Property.LEGEND_TITLEFONTWEIGHT:\n return 'l-tifw';\n case property_1.Property.TIMEUNIT:\n return 'tu';\n case property_1.Property.FIELD:\n return 'f';\n case property_1.Property.TYPE:\n return 't';\n }\n /* istanbul ignore next */\n throw new Error('Default name undefined');\n}\nexports.getDefaultName = getDefaultName;\nfunction getDefaultEnumValues(prop, schema, opt) {\n switch (prop) {\n case property_1.Property.FIELD: // For field, by default enumerate all fields\n case property_1.Property.SORT_FIELD:\n return schema.fields();\n // True, False for boolean values\n case property_1.Property.AXIS:\n case property_1.Property.AXIS_GRID:\n case property_1.Property.AXIS_LABELS:\n case property_1.Property.AXIS_SHORTTIMELABELS:\n case property_1.Property.BIN:\n case property_1.Property.LEGEND:\n case property_1.Property.LEGEND_SHORTTIMELABELS:\n case property_1.Property.SCALE:\n case property_1.Property.SCALE_CLAMP:\n case property_1.Property.SCALE_NICE:\n case property_1.Property.SCALE_ROUND:\n case property_1.Property.SCALE_USERAWDOMAIN:\n case property_1.Property.SCALE_ZERO:\n case property_1.Property.AUTOCOUNT:\n return [false, true];\n // For other properties, take default enumValues from config.\n // The config name for each prop is a plural form of the prop.\n case property_1.Property.AGGREGATE:\n return opt.aggregates;\n case property_1.Property.AXIS_AXISCOLOR:\n return opt.axisAxisColors;\n case property_1.Property.AXIS_AXISWIDTH:\n return opt.axisAxisWidths;\n case property_1.Property.AXIS_LAYER:\n return opt.axisLayers;\n case property_1.Property.AXIS_OFFSET:\n return opt.axisOffsets;\n case property_1.Property.AXIS_ORIENT:\n return opt.axisOrients;\n case property_1.Property.AXIS_GRIDCOLOR:\n return opt.axisGridColors;\n case property_1.Property.AXIS_GRIDDASH:\n return opt.axisGridDashes;\n case property_1.Property.AXIS_GRIDOPACITY:\n return opt.axisGridOpacities;\n case property_1.Property.AXIS_GRIDWIDTH:\n return opt.axisGridWidths;\n case property_1.Property.AXIS_FORMAT:\n return opt.axisFormats;\n case property_1.Property.AXIS_LABELANGLE:\n return opt.axisLabelAngles;\n case property_1.Property.AXIS_LABELMAXLENGTH:\n return opt.axisLabelMaxLengths;\n case property_1.Property.AXIS_SUBDIVIDE:\n return opt.axisSubDivides;\n case property_1.Property.AXIS_TICKS:\n return opt.axisTicks;\n case property_1.Property.AXIS_TICKCOLOR:\n return opt.axisTickColors;\n case property_1.Property.AXIS_TICKLABELCOLOR:\n return opt.axisTickLabelColors;\n case property_1.Property.AXIS_TICKLABELFONT:\n return opt.axisTickLabelFonts;\n case property_1.Property.AXIS_TICKLABELFONTSIZE:\n return opt.axisTickLabelFontSizes;\n case property_1.Property.AXIS_TICKPADDING:\n return opt.axisTickPaddings;\n case property_1.Property.AXIS_TICKSIZE:\n return opt.axisTickSizes;\n case property_1.Property.AXIS_TICKSIZEMAJOR:\n return opt.axisTickSizeMajors;\n case property_1.Property.AXIS_TICKSIZEMINOR:\n return opt.axisTickSizeMinors;\n case property_1.Property.AXIS_TICKSIZEEND:\n return opt.axisTickSizeEnds;\n case property_1.Property.AXIS_TICKWIDTH:\n return opt.axisTickWidths;\n case property_1.Property.AXIS_VALUES:\n return opt.axisValuesList;\n case property_1.Property.AXIS_TITLE:\n return opt.axisTitles;\n case property_1.Property.AXIS_TITLECOLOR:\n return opt.axisTitleColors;\n case property_1.Property.AXIS_TITLEFONT:\n return opt.axisTitleFonts;\n case property_1.Property.AXIS_TITLEFONTWEIGHT:\n return opt.axisTitleFontWeights;\n case property_1.Property.AXIS_TITLEFONTSIZE:\n return opt.axisTitleFontSizes;\n case property_1.Property.AXIS_TITLEOFFSET:\n return opt.axisTitleOffsets;\n case property_1.Property.AXIS_TITLEMAXLENGTH:\n return opt.axisTitleMaxLengths;\n case property_1.Property.AXIS_CHARACTERWIDTH:\n return opt.axisCharacterWidths;\n case property_1.Property.BIN_MAXBINS:\n return opt.maxBinsList;\n case property_1.Property.CHANNEL:\n return opt.channels;\n case property_1.Property.MARK:\n return opt.marks;\n case property_1.Property.LEGEND_ORIENT:\n return opt.legendOrients;\n case property_1.Property.LEGEND_OFFSET:\n return opt.legendOffsets;\n case property_1.Property.LEGEND_VALUES:\n return opt.legendValuesList;\n case property_1.Property.LEGEND_FORMAT:\n return opt.legendFormats;\n case property_1.Property.LEGEND_LABELALIGN:\n return opt.legendLabelAligns;\n case property_1.Property.LEGEND_LABELBASELINE:\n return opt.legendLabelBaselines;\n case property_1.Property.LEGEND_LABELCOLOR:\n return opt.legendLabelColors;\n case property_1.Property.LEGEND_LABELFONT:\n return opt.legendLabelFonts;\n case property_1.Property.LEGEND_LABELFONTSIZE:\n return opt.legendLabelFontSizes;\n case property_1.Property.LEGEND_SYMBOLCOLOR:\n return opt.legendSymbolColors;\n case property_1.Property.LEGEND_SYMBOLSHAPE:\n return opt.legendSymbolShapes;\n case property_1.Property.LEGEND_SYMBOLSIZE:\n return opt.legendSymbolSizes;\n case property_1.Property.LEGEND_SYMBOLSTROKEWIDTH:\n return opt.legendSymbolStrokeWidths;\n case property_1.Property.LEGEND_TITLE:\n return opt.legendTitles;\n case property_1.Property.LEGEND_TITLECOLOR:\n return opt.legendTitleColors;\n case property_1.Property.LEGEND_TITLEFONT:\n return opt.legendTitleFonts;\n case property_1.Property.LEGEND_TITLEFONTSIZE:\n return opt.legendTitleFontSizes;\n case property_1.Property.LEGEND_TITLEFONTWEIGHT:\n return opt.legendTitleFontWeights;\n case property_1.Property.SORT:\n return opt.sorts;\n case property_1.Property.SORT_OP:\n return opt.sortOps;\n case property_1.Property.SORT_ORDER:\n return opt.sortOrders;\n case property_1.Property.SCALE_BANDSIZE:\n return opt.scaleBandSizes;\n case property_1.Property.SCALE_DOMAIN:\n return opt.scaleDomains;\n case property_1.Property.SCALE_EXPONENT:\n return opt.scaleExponents;\n case property_1.Property.SCALE_RANGE:\n return opt.scaleRanges;\n case property_1.Property.SCALE_TYPE:\n return opt.scaleTypes;\n case property_1.Property.TIMEUNIT:\n return opt.timeUnits;\n case property_1.Property.TYPE:\n return opt.types;\n }\n /* istanbul ignore next */\n throw new Error('No default enumValues for ' + prop);\n}\nexports.getDefaultEnumValues = getDefaultEnumValues;\n/**\n * Internal class for specQuery that provides helper for the enumeration process.\n */\nvar SpecQueryModel = (function () {\n function SpecQueryModel(spec, enumSpecIndex, schema, opt, enumSpecAssignment) {\n this._rankingScore = {};\n this._spec = spec;\n this._channelCount = spec.encodings.reduce(function (m, encQ) {\n if (!enumspec_1.isEnumSpec(encQ.channel) && encQ.autoCount !== false) {\n m[encQ.channel] = 1;\n }\n return m;\n }, {});\n this._enumSpecIndex = enumSpecIndex;\n this._enumSpecAssignment = enumSpecAssignment;\n this._opt = opt;\n this._schema = schema;\n }\n /**\n * Build an enumSpecIndex by detecting enumeration specifiers\n * in the input specQuery and replace short enum specs with\n * full ones that includes both names and enumValues.\n *\n * @return a SpecQueryModel that wraps the specQuery and the enumSpecIndex.\n */\n SpecQueryModel.build = function (specQ, schema, opt) {\n var enumSpecIndex = new enumspecindex_1.EnumSpecIndex();\n // mark\n if (enumspec_1.isEnumSpec(specQ.mark)) {\n var name_1 = getDefaultName(property_1.Property.MARK);\n specQ.mark = enumspec_1.initEnumSpec(specQ.mark, name_1, opt.marks);\n enumSpecIndex.setMark(specQ.mark);\n }\n // TODO: transform\n // encodings\n specQ.encodings.forEach(function (encQ, index) {\n if (encQ.autoCount !== undefined) {\n // This is only for testing purpose\n console.warn('A field with autoCount should not be included as autoCount meant to be an internal object.');\n encQ.type = type_1.Type.QUANTITATIVE; // autoCount is always quantitative\n }\n if (encQ.type === undefined) {\n // type is optional -- we automatically augment enum spec if not specified\n encQ.type = enumspec_1.SHORT_ENUM_SPEC;\n }\n // For each property of the encodingQuery, enumerate\n property_1.ENCODING_PROPERTIES.forEach(function (prop) {\n if (enumspec_1.isEnumSpec(encQ[prop])) {\n // Assign default enum spec name and enum values.\n var defaultEnumSpecName = getDefaultName(prop) + index;\n var defaultEnumValues = getDefaultEnumValues(prop, schema, opt);\n var enumSpec = encQ[prop] = enumspec_1.initEnumSpec(encQ[prop], defaultEnumSpecName, defaultEnumValues);\n // Add index of the encoding mapping to the property's enum spec index.\n enumSpecIndex.setEncodingProperty(index, prop, enumSpec);\n }\n });\n // For each nested property of the encoding query (e.g., encQ.bin.maxbins)\n property_1.NESTED_ENCODING_PROPERTIES.forEach(function (nestedProp) {\n var propObj = encQ[nestedProp.parent]; // the property object e.g., encQ.bin\n if (propObj) {\n var prop = nestedProp.property;\n var child = nestedProp.child;\n if (enumspec_1.isEnumSpec(propObj[child])) {\n // Assign default enum spec name and enum values.\n var defaultEnumSpecName = getDefaultName(prop) + index;\n var defaultEnumValues = getDefaultEnumValues(prop, schema, opt);\n var enumSpec = propObj[child] = enumspec_1.initEnumSpec(propObj[child], defaultEnumSpecName, defaultEnumValues);\n // Add index of the encoding mapping to the property's enum spec index.\n enumSpecIndex.setEncodingProperty(index, prop, enumSpec);\n }\n }\n });\n });\n // AUTO COUNT\n // Add Auto Count Field\n if (opt.autoAddCount) {\n var countEncQ = {\n channel: {\n name: getDefaultName(property_1.Property.CHANNEL) + specQ.encodings.length,\n enum: getDefaultEnumValues(property_1.Property.CHANNEL, schema, opt)\n },\n autoCount: {\n name: getDefaultName(property_1.Property.AUTOCOUNT) + specQ.encodings.length,\n enum: [false, true]\n },\n type: type_1.Type.QUANTITATIVE\n };\n specQ.encodings.push(countEncQ);\n var index = specQ.encodings.length - 1;\n // Add index of the encoding mapping to the property's enum spec index.\n enumSpecIndex.setEncodingProperty(index, property_1.Property.CHANNEL, countEncQ.channel);\n enumSpecIndex.setEncodingProperty(index, property_1.Property.AUTOCOUNT, countEncQ.autoCount);\n }\n return new SpecQueryModel(specQ, enumSpecIndex, schema, opt, {});\n };\n Object.defineProperty(SpecQueryModel.prototype, \"enumSpecIndex\", {\n get: function () {\n return this._enumSpecIndex;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SpecQueryModel.prototype, \"schema\", {\n get: function () {\n return this._schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SpecQueryModel.prototype, \"specQuery\", {\n get: function () {\n return this._spec;\n },\n enumerable: true,\n configurable: true\n });\n SpecQueryModel.prototype.duplicate = function () {\n return new SpecQueryModel(util_1.duplicate(this._spec), this._enumSpecIndex, this._schema, this._opt, util_1.duplicate(this._enumSpecAssignment));\n };\n SpecQueryModel.prototype.setMark = function (mark) {\n var name = this._spec.mark.name;\n this._enumSpecAssignment[name] = this._spec.mark = mark;\n };\n SpecQueryModel.prototype.resetMark = function () {\n var enumSpec = this._spec.mark = this._enumSpecIndex.mark;\n delete this._enumSpecAssignment[enumSpec.name];\n };\n SpecQueryModel.prototype.getMark = function () {\n return this._spec.mark;\n };\n SpecQueryModel.prototype.getEncodingProperty = function (index, prop) {\n var encQ = this._spec.encodings[index];\n var nestedProp = property_1.getNestedEncodingProperty(prop);\n if (nestedProp) {\n return encQ[nestedProp.parent][nestedProp.child];\n }\n return encQ[prop]; // encoding property (non-nested)\n };\n SpecQueryModel.prototype.setEncodingProperty = function (index, prop, value, enumSpec) {\n var encQ = this._spec.encodings[index];\n var nestedProp = property_1.getNestedEncodingProperty(prop);\n if (prop === property_1.Property.CHANNEL && encQ.channel && !enumspec_1.isEnumSpec(encQ.channel)) {\n // If there is an old channel\n this._channelCount[encQ.channel]--;\n }\n if (nestedProp) {\n encQ[nestedProp.parent][nestedProp.child] = value;\n }\n else if (property_1.hasNestedProperty(prop) && value === true) {\n encQ[prop] = util_1.extend({}, encQ[prop], // copy all existing properties\n { enum: undefined, name: undefined } // except name and values to it no longer an enumSpec\n );\n }\n else {\n encQ[prop] = value;\n }\n this._enumSpecAssignment[enumSpec.name] = value;\n if (prop === property_1.Property.CHANNEL) {\n // If there is a new channel, make sure it exists and add it to the count.\n this._channelCount[value] = (this._channelCount[value] || 0) + 1;\n }\n };\n SpecQueryModel.prototype.resetEncodingProperty = function (index, prop, enumSpec) {\n var encQ = this._spec.encodings[index];\n var nestedProp = property_1.getNestedEncodingProperty(prop);\n if (prop === property_1.Property.CHANNEL) {\n this._channelCount[encQ.channel]--;\n }\n // reset it to enumSpec\n if (nestedProp) {\n encQ[nestedProp.parent][nestedProp.child] = enumSpec;\n }\n else {\n encQ[prop] = enumSpec;\n }\n // add remove value that is reset from the assignment map\n delete this._enumSpecAssignment[enumSpec.name];\n };\n SpecQueryModel.prototype.channelUsed = function (channel) {\n // do not include encoding that has autoCount = false because it is not a part of the output spec.\n return this._channelCount[channel] > 0;\n };\n SpecQueryModel.prototype.stack = function () {\n return spec_1.stack(this._spec);\n };\n SpecQueryModel.prototype.getEncodings = function () {\n // do not include encoding that has autoCount = false because it is not a part of the output spec.\n return this._spec.encodings.filter(function (encQ) { return encQ.autoCount !== false; });\n };\n SpecQueryModel.prototype.getEncodingQueryByChannel = function (channel) {\n for (var i = 0; i < this._spec.encodings.length; i++) {\n if (this._spec.encodings[i].channel === channel) {\n return this._spec.encodings[i];\n }\n }\n return undefined;\n };\n SpecQueryModel.prototype.getEncodingQueryByIndex = function (i) {\n return this._spec.encodings[i];\n };\n SpecQueryModel.prototype.isDimension = function (channel) {\n var encQ = this.getEncodingQueryByChannel(channel);\n return encQ && encoding_1.isDimension(encQ);\n };\n SpecQueryModel.prototype.isMeasure = function (channel) {\n var encQ = this.getEncodingQueryByChannel(channel);\n return encQ && encoding_1.isMeasure(encQ);\n };\n SpecQueryModel.prototype.isAggregate = function () {\n return spec_1.isAggregate(this._spec);\n };\n SpecQueryModel.prototype.toShorthand = function () {\n return shorthand_1.spec(this._spec);\n };\n SpecQueryModel.prototype._encoding = function () {\n var encoding = {};\n for (var i = 0; i < this._spec.encodings.length; i++) {\n var encQ = this._spec.encodings[i];\n var fieldDef = {};\n // For count field that is automatically added, convert to correct vega-lite fieldDef\n if (encQ.autoCount === true) {\n fieldDef.aggregate = aggregate_1.AggregateOp.COUNT;\n fieldDef.field = '*';\n fieldDef.type = type_1.Type.QUANTITATIVE;\n }\n else if (encQ.autoCount === false) {\n continue; // Do not include this in the output.\n }\n // if channel is an enum spec, return null\n if (enumspec_1.isEnumSpec(encQ.channel))\n return null;\n // assemble other property into a field def.\n var PROPERTIES = [property_1.Property.AGGREGATE, property_1.Property.BIN, property_1.Property.TIMEUNIT, property_1.Property.FIELD, property_1.Property.TYPE, property_1.Property.SCALE, property_1.Property.SORT, property_1.Property.AXIS, property_1.Property.LEGEND];\n // TODO(#226):\n // write toSpec() and toShorthand() in a way that prevents outputting inapplicable scale, sort, axis / legend\n for (var j = 0; j < PROPERTIES.length; j++) {\n var prop = PROPERTIES[j];\n // if the property is an enum spec, return null\n if (enumspec_1.isEnumSpec(encQ[prop]))\n return null;\n // otherwise, assign the proper to the field def\n if (encQ[prop] !== undefined) {\n fieldDef[prop] = encQ[prop];\n }\n }\n if (fieldDef.bin === false) {\n // exclude bin false\n delete fieldDef.bin;\n }\n encoding[encQ.channel] = fieldDef;\n }\n return encoding;\n };\n /**\n * Convert a query to a Vega-Lite spec if it is completed.\n * @return a Vega-Lite spec if completed, null otherwise.\n */\n SpecQueryModel.prototype.toSpec = function (data) {\n if (enumspec_1.isEnumSpec(this._spec.mark))\n return null;\n var spec = {};\n data = data || this._spec.data;\n if (data) {\n spec.data = data;\n }\n if (this._spec.transform) {\n spec.transform = this._spec.transform;\n }\n spec.mark = this._spec.mark;\n spec.encoding = this._encoding();\n if (spec.encoding === null) {\n return null;\n }\n if (this._spec.config || this._opt.defaultSpecConfig)\n spec.config = util_1.extend({}, this._opt.defaultSpecConfig, this._spec.config);\n return spec;\n };\n SpecQueryModel.prototype.getRankingScore = function (rankingName) {\n return this._rankingScore[rankingName];\n };\n SpecQueryModel.prototype.setRankingScore = function (rankingName, score) {\n this._rankingScore[rankingName] = score;\n };\n return SpecQueryModel;\n}());\nexports.SpecQueryModel = SpecQueryModel;\nvar SpecQueryModelGroup = (function () {\n function SpecQueryModelGroup(name, path, items, groupBy, orderGroupBy) {\n if (name === void 0) { name = ''; }\n if (path === void 0) { path = ''; }\n if (items === void 0) { items = []; }\n if (groupBy === void 0) { groupBy = undefined; }\n if (orderGroupBy === void 0) { orderGroupBy = undefined; }\n this._name = name;\n this._path = path;\n this._items = items;\n this._groupBy = groupBy;\n this._orderGroupBy = orderGroupBy;\n }\n SpecQueryModelGroup.prototype.getTopSpecQueryModel = function () {\n var topItem = this._items[0];\n if (topItem instanceof SpecQueryModelGroup) {\n return topItem.getTopSpecQueryModel();\n }\n else {\n return topItem;\n }\n };\n Object.defineProperty(SpecQueryModelGroup.prototype, \"name\", {\n get: function () {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SpecQueryModelGroup.prototype, \"items\", {\n get: function () {\n return this._items;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SpecQueryModelGroup.prototype, \"groupBy\", {\n get: function () {\n return this._groupBy;\n },\n set: function (groupBy) {\n this._groupBy = groupBy;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SpecQueryModelGroup.prototype, \"orderGroupBy\", {\n get: function () {\n return this._orderGroupBy;\n },\n set: function (orderGroupBy) {\n this._orderGroupBy = orderGroupBy;\n },\n enumerable: true,\n configurable: true\n });\n return SpecQueryModelGroup;\n}());\nexports.SpecQueryModelGroup = SpecQueryModelGroup;\n//# sourceMappingURL=model.js.map", + "\"use strict\";\nvar channel_1 = require('vega-lite/src/channel');\nvar util_1 = require('datalib/src/util');\nvar enumspec_1 = require('./enumspec');\nvar model_1 = require('./model');\nvar util_2 = require('./util');\nvar groupby_1 = require('./query/groupby');\nvar shorthand_1 = require('./query/shorthand');\nvar spec_1 = require('./query/spec');\n/**\n * Registry for all possible grouping key functions.\n */\nvar groupRegistry = {};\n/**\n * Add a grouping function to the registry.\n */\nfunction registerKeyFn(name, keyFn) {\n groupRegistry[name] = keyFn;\n}\nexports.registerKeyFn = registerKeyFn;\nexports.FIELD = 'field';\nexports.FIELD_TRANSFORM = 'fieldTransform';\nexports.ENCODING = 'encoding';\nexports.TRANSPOSE = 'transpose';\nexports.SPEC = 'spec';\n/**\n * Group the input spec query model by a key function registered in the group registry\n * @return\n */\nfunction nest(specModels, query) {\n if (query.nest) {\n var rootGroup_1 = new model_1.SpecQueryModelGroup();\n var groupIndex_1 = {};\n // global `includes` and `replaces` will get augmented by each level's groupBy.\n // Upper level's `groupBy` will get cascaded to lower-level groupBy.\n // `replace` can be overriden in a lower-level to support different grouping.\n var includes_1 = [];\n var replaces_1 = [];\n var replacers_1 = [];\n var _loop_1 = function(l) {\n includes_1.push(l > 0 ? util_2.duplicate(includes_1[l - 1]) : {});\n replaces_1.push(l > 0 ? util_2.duplicate(replaces_1[l - 1]) : {});\n var groupBy = query.nest[l].groupBy;\n if (util_1.isArray(groupBy)) {\n groupBy.forEach(function (grpBy) {\n if (groupby_1.isExtendedGroupBy(grpBy)) {\n includes_1[l][grpBy.property] = true;\n replaces_1[l][grpBy.property] = grpBy.replace;\n }\n else {\n includes_1[l][grpBy] = true;\n }\n });\n var replaceFnIndex = util_2.keys(replaces_1[l]).reduce(function (fnIndex, prop) {\n fnIndex[prop] = shorthand_1.getReplacer(replaces_1[l][prop]);\n return fnIndex;\n }, {});\n replacers_1.push(replaceFnIndex);\n }\n };\n for (var l = 0; l < query.nest.length; l++) {\n _loop_1(l);\n }\n // With includes and replacers, now we can construct the nesting tree\n specModels.forEach(function (specM) {\n var path = '';\n var group = rootGroup_1;\n for (var l = 0; l < query.nest.length; l++) {\n var groupBy = group.groupBy = query.nest[l].groupBy;\n group.orderGroupBy = query.nest[l].orderGroupBy;\n var key = util_1.isArray(groupBy) ?\n shorthand_1.spec(specM.specQuery, includes_1[l], replacers_1[l]) :\n groupRegistry[groupBy](specM);\n path += '/' + key;\n if (!groupIndex_1[path]) {\n groupIndex_1[path] = new model_1.SpecQueryModelGroup(key, path, []);\n group.items.push(groupIndex_1[path]);\n }\n group = groupIndex_1[path];\n }\n group.items.push(specM);\n });\n return rootGroup_1;\n }\n else {\n // no nesting, just return a flat group\n return new model_1.SpecQueryModelGroup('', '', specModels);\n }\n}\nexports.nest = nest;\nregisterKeyFn(exports.FIELD, function (specM) {\n return specM.getEncodings().map(function (encQ) { return encQ.field; })\n .filter(function (field) { return field && field !== '*'; })\n .sort()\n .join('|');\n});\nregisterKeyFn(exports.FIELD_TRANSFORM, function (specM) {\n return specM.getEncodings().map(function (encQ) { return shorthand_1.fieldDef(encQ); })\n .sort()\n .join('|');\n});\nfunction channelType(channel) {\n if (enumspec_1.isEnumSpec(channel)) {\n return enumspec_1.SHORT_ENUM_SPEC + '';\n }\n var c = channel;\n switch (c) {\n case channel_1.Channel.X:\n case channel_1.Channel.Y:\n return 'xy';\n case channel_1.Channel.ROW:\n case channel_1.Channel.COLUMN:\n return 'facet';\n case channel_1.Channel.COLOR:\n case channel_1.Channel.SIZE:\n case channel_1.Channel.SHAPE:\n case channel_1.Channel.OPACITY:\n return 'non-xy';\n case channel_1.Channel.TEXT:\n case channel_1.Channel.DETAIL:\n case channel_1.Channel.PATH:\n case channel_1.Channel.ORDER:\n return c + '';\n /* istanbul ignore next */\n default:\n console.warn('channel type not implemented for ' + c);\n return c + '';\n }\n}\nfunction stringifyStack(specM) {\n var _stack = spec_1.stack(specM.specQuery);\n return (!!_stack ? 'stack=' + _stack.offset + '|' : '');\n}\nregisterKeyFn(exports.ENCODING, function (specM) {\n // mark does not matter\n return stringifyStack(specM) +\n specM.getEncodings().map(function (encQ) {\n var fieldDef = shorthand_1.fieldDef(encQ);\n return channelType(encQ.channel) + ':' + fieldDef;\n })\n .sort()\n .join('|');\n});\nregisterKeyFn(exports.TRANSPOSE, function (specM) {\n return specM.getMark() + '|' +\n stringifyStack(specM) +\n specM.getEncodings().map(function (encQ) {\n var fieldDef = shorthand_1.fieldDef(encQ);\n var channel = (encQ.channel === channel_1.Channel.X || encQ.channel === channel_1.Channel.Y) ? 'xy' :\n (encQ.channel === channel_1.Channel.ROW || encQ.channel === channel_1.Channel.COLUMN) ? 'facet' :\n encQ.channel;\n return channel + ':' + fieldDef;\n })\n .sort()\n .join('|');\n});\nregisterKeyFn(exports.SPEC, function (specM) { return JSON.stringify(specM.specQuery); });\n//# sourceMappingURL=nest.js.map", + "\"use strict\";\nvar scale_1 = require('vega-lite/src/scale');\n(function (Property) {\n Property[Property[\"MARK\"] = 'mark'] = \"MARK\";\n Property[Property[\"FILTER\"] = 'filter'] = \"FILTER\";\n // TODO: Sub-properties for filter\n Property[Property[\"CALCULATE\"] = 'calculate'] = \"CALCULATE\";\n // TODO: Sub-properties for calculate\n Property[Property[\"FILTERINVALID\"] = 'filterInvalid'] = \"FILTERINVALID\";\n // Layout\n Property[Property[\"STACK\"] = 'stack'] = \"STACK\";\n // TODO: sub parts of stack\n // Encoding Properties\n Property[Property[\"CHANNEL\"] = 'channel'] = \"CHANNEL\";\n Property[Property[\"AGGREGATE\"] = 'aggregate'] = \"AGGREGATE\";\n Property[Property[\"AUTOCOUNT\"] = 'autoCount'] = \"AUTOCOUNT\";\n Property[Property[\"BIN\"] = 'bin'] = \"BIN\";\n Property[Property[\"BIN_MAXBINS\"] = 'binMaxBins'] = \"BIN_MAXBINS\";\n Property[Property[\"TIMEUNIT\"] = 'timeUnit'] = \"TIMEUNIT\";\n Property[Property[\"FIELD\"] = 'field'] = \"FIELD\";\n Property[Property[\"TYPE\"] = 'type'] = \"TYPE\";\n // - Sort\n Property[Property[\"SORT\"] = 'sort'] = \"SORT\";\n Property[Property[\"SORT_FIELD\"] = 'sortField'] = \"SORT_FIELD\";\n Property[Property[\"SORT_OP\"] = 'sortOp'] = \"SORT_OP\";\n Property[Property[\"SORT_ORDER\"] = 'sortOrder'] = \"SORT_ORDER\";\n // - Scale\n Property[Property[\"SCALE\"] = 'scale'] = \"SCALE\";\n Property[Property[\"SCALE_BANDSIZE\"] = 'scaleBandSize'] = \"SCALE_BANDSIZE\";\n Property[Property[\"SCALE_CLAMP\"] = 'scaleClamp'] = \"SCALE_CLAMP\";\n Property[Property[\"SCALE_DOMAIN\"] = 'scaleDomain'] = \"SCALE_DOMAIN\";\n Property[Property[\"SCALE_EXPONENT\"] = 'scaleExponent'] = \"SCALE_EXPONENT\";\n Property[Property[\"SCALE_NICE\"] = 'scaleNice'] = \"SCALE_NICE\";\n Property[Property[\"SCALE_RANGE\"] = 'scaleRange'] = \"SCALE_RANGE\";\n Property[Property[\"SCALE_ROUND\"] = 'scaleRound'] = \"SCALE_ROUND\";\n Property[Property[\"SCALE_TYPE\"] = 'scaleType'] = \"SCALE_TYPE\";\n Property[Property[\"SCALE_USERAWDOMAIN\"] = 'scaleUseRawDomain'] = \"SCALE_USERAWDOMAIN\";\n Property[Property[\"SCALE_ZERO\"] = 'scaleZero'] = \"SCALE_ZERO\";\n // - Axis\n Property[Property[\"AXIS\"] = 'axis'] = \"AXIS\";\n // General Axis Properties\n Property[Property[\"AXIS_AXISCOLOR\"] = 'axisAxisColor'] = \"AXIS_AXISCOLOR\";\n Property[Property[\"AXIS_AXISWIDTH\"] = 'axisAxisWidth'] = \"AXIS_AXISWIDTH\";\n Property[Property[\"AXIS_LAYER\"] = 'axisLayer'] = \"AXIS_LAYER\";\n Property[Property[\"AXIS_OFFSET\"] = 'axisOffset'] = \"AXIS_OFFSET\";\n Property[Property[\"AXIS_ORIENT\"] = 'axisOrient'] = \"AXIS_ORIENT\";\n // Axis_Grid Properties\n Property[Property[\"AXIS_GRID\"] = 'axisGrid'] = \"AXIS_GRID\";\n Property[Property[\"AXIS_GRIDCOLOR\"] = 'axisGridColor'] = \"AXIS_GRIDCOLOR\";\n Property[Property[\"AXIS_GRIDDASH\"] = 'axisGridDash'] = \"AXIS_GRIDDASH\";\n Property[Property[\"AXIS_GRIDOPACITY\"] = 'axisGridOpacity'] = \"AXIS_GRIDOPACITY\";\n Property[Property[\"AXIS_GRIDWIDTH\"] = 'axisGridWidth'] = \"AXIS_GRIDWIDTH\";\n // Axis Properties\n Property[Property[\"AXIS_LABELS\"] = 'axisLabels'] = \"AXIS_LABELS\";\n Property[Property[\"AXIS_FORMAT\"] = 'axisFormat'] = \"AXIS_FORMAT\";\n Property[Property[\"AXIS_LABELANGLE\"] = 'axisLabelAngle'] = \"AXIS_LABELANGLE\";\n Property[Property[\"AXIS_LABELMAXLENGTH\"] = 'axisLabelMaxLength'] = \"AXIS_LABELMAXLENGTH\";\n Property[Property[\"AXIS_SHORTTIMELABELS\"] = 'axisShortTimeLabels'] = \"AXIS_SHORTTIMELABELS\";\n // Axis_Tick Properties\n Property[Property[\"AXIS_SUBDIVIDE\"] = 'axisSubdivide'] = \"AXIS_SUBDIVIDE\";\n Property[Property[\"AXIS_TICKS\"] = 'axisTicks'] = \"AXIS_TICKS\";\n Property[Property[\"AXIS_TICKCOLOR\"] = 'axisTickColor'] = \"AXIS_TICKCOLOR\";\n Property[Property[\"AXIS_TICKLABELCOLOR\"] = 'axisTickLabelColor'] = \"AXIS_TICKLABELCOLOR\";\n Property[Property[\"AXIS_TICKLABELFONT\"] = 'axisTickLabelFont'] = \"AXIS_TICKLABELFONT\";\n Property[Property[\"AXIS_TICKLABELFONTSIZE\"] = 'axisTickLabelFontSize'] = \"AXIS_TICKLABELFONTSIZE\";\n Property[Property[\"AXIS_TICKPADDING\"] = 'axisTickPadding'] = \"AXIS_TICKPADDING\";\n Property[Property[\"AXIS_TICKSIZE\"] = 'axisTickSize'] = \"AXIS_TICKSIZE\";\n Property[Property[\"AXIS_TICKSIZEMAJOR\"] = 'axisTickSizeMajor'] = \"AXIS_TICKSIZEMAJOR\";\n Property[Property[\"AXIS_TICKSIZEMINOR\"] = 'axisTickSizeMinor'] = \"AXIS_TICKSIZEMINOR\";\n Property[Property[\"AXIS_TICKSIZEEND\"] = 'axisTickSizeEnd'] = \"AXIS_TICKSIZEEND\";\n Property[Property[\"AXIS_TICKWIDTH\"] = 'axisTickWidth'] = \"AXIS_TICKWIDTH\";\n Property[Property[\"AXIS_VALUES\"] = 'axisValues'] = \"AXIS_VALUES\";\n // Axis_Title Properties\n Property[Property[\"AXIS_TITLE\"] = 'axisTitle'] = \"AXIS_TITLE\";\n Property[Property[\"AXIS_TITLECOLOR\"] = 'axisTitleColor'] = \"AXIS_TITLECOLOR\";\n Property[Property[\"AXIS_TITLEFONT\"] = 'axisTitleFont'] = \"AXIS_TITLEFONT\";\n Property[Property[\"AXIS_TITLEFONTSIZE\"] = 'axisTitleFontSize'] = \"AXIS_TITLEFONTSIZE\";\n Property[Property[\"AXIS_TITLEFONTWEIGHT\"] = 'axisTitleFontWeight'] = \"AXIS_TITLEFONTWEIGHT\";\n Property[Property[\"AXIS_TITLEOFFSET\"] = 'axisTitleOffset'] = \"AXIS_TITLEOFFSET\";\n Property[Property[\"AXIS_TITLEMAXLENGTH\"] = 'axisTitleMaxLength'] = \"AXIS_TITLEMAXLENGTH\";\n Property[Property[\"AXIS_CHARACTERWIDTH\"] = 'axisCharacterWidth'] = \"AXIS_CHARACTERWIDTH\";\n // - Legend\n Property[Property[\"LEGEND\"] = 'legend'] = \"LEGEND\";\n // General Legend Properties\n Property[Property[\"LEGEND_ORIENT\"] = 'legendOrient'] = \"LEGEND_ORIENT\";\n Property[Property[\"LEGEND_OFFSET\"] = 'legendOffset'] = \"LEGEND_OFFSET\";\n Property[Property[\"LEGEND_VALUES\"] = 'legendValues'] = \"LEGEND_VALUES\";\n // Legend_Label Properties\n Property[Property[\"LEGEND_FORMAT\"] = 'legendFormat'] = \"LEGEND_FORMAT\";\n Property[Property[\"LEGEND_LABELALIGN\"] = 'legendLabelAlign'] = \"LEGEND_LABELALIGN\";\n Property[Property[\"LEGEND_LABELBASELINE\"] = 'legendLabelBaseline'] = \"LEGEND_LABELBASELINE\";\n Property[Property[\"LEGEND_LABELCOLOR\"] = 'legendLabelColor'] = \"LEGEND_LABELCOLOR\";\n Property[Property[\"LEGEND_LABELFONT\"] = 'legendLabelFont'] = \"LEGEND_LABELFONT\";\n Property[Property[\"LEGEND_LABELFONTSIZE\"] = 'legendLabelFontSize'] = \"LEGEND_LABELFONTSIZE\";\n Property[Property[\"LEGEND_SHORTTIMELABELS\"] = 'legendShortTimeLabels'] = \"LEGEND_SHORTTIMELABELS\";\n // Legend_Symbol Properties\n Property[Property[\"LEGEND_SYMBOLCOLOR\"] = 'legendSymbolColor'] = \"LEGEND_SYMBOLCOLOR\";\n Property[Property[\"LEGEND_SYMBOLSHAPE\"] = 'legendSymbolShape'] = \"LEGEND_SYMBOLSHAPE\";\n Property[Property[\"LEGEND_SYMBOLSIZE\"] = 'legendSymbolSize'] = \"LEGEND_SYMBOLSIZE\";\n Property[Property[\"LEGEND_SYMBOLSTROKEWIDTH\"] = 'legendSymbolStrokeWidth'] = \"LEGEND_SYMBOLSTROKEWIDTH\";\n // Legend_Title Properties\n Property[Property[\"LEGEND_TITLE\"] = 'legendTitle'] = \"LEGEND_TITLE\";\n Property[Property[\"LEGEND_TITLECOLOR\"] = 'legendTitleColor'] = \"LEGEND_TITLECOLOR\";\n Property[Property[\"LEGEND_TITLEFONT\"] = 'legendTitleFont'] = \"LEGEND_TITLEFONT\";\n Property[Property[\"LEGEND_TITLEFONTSIZE\"] = 'legendTitleFontSize'] = \"LEGEND_TITLEFONTSIZE\";\n Property[Property[\"LEGEND_TITLEFONTWEIGHT\"] = 'legendTitleFontWeight'] = \"LEGEND_TITLEFONTWEIGHT\";\n})(exports.Property || (exports.Property = {}));\nvar Property = exports.Property;\nfunction hasNestedProperty(prop) {\n switch (prop) {\n case Property.BIN:\n case Property.SCALE:\n case Property.SORT:\n case Property.AXIS:\n case Property.LEGEND:\n return true;\n case Property.MARK:\n case Property.FILTER:\n case Property.CALCULATE:\n case Property.FILTERINVALID:\n case Property.STACK:\n case Property.CHANNEL:\n case Property.AGGREGATE:\n case Property.AUTOCOUNT:\n case Property.TIMEUNIT:\n case Property.FIELD:\n case Property.TYPE:\n case Property.BIN_MAXBINS:\n case Property.SCALE_BANDSIZE:\n case Property.SCALE_CLAMP:\n case Property.SCALE_DOMAIN:\n case Property.SCALE_EXPONENT:\n case Property.SCALE_NICE:\n case Property.SCALE_RANGE:\n case Property.SCALE_ROUND:\n case Property.SCALE_TYPE:\n case Property.SCALE_USERAWDOMAIN:\n case Property.SCALE_ZERO:\n case Property.AXIS_AXISCOLOR:\n case Property.AXIS_AXISWIDTH:\n case Property.AXIS_LAYER:\n case Property.AXIS_OFFSET:\n case Property.AXIS_ORIENT:\n case Property.AXIS_GRID:\n case Property.AXIS_GRIDCOLOR:\n case Property.AXIS_GRIDDASH:\n case Property.AXIS_GRIDOPACITY:\n case Property.AXIS_GRIDWIDTH:\n case Property.AXIS_LABELS:\n case Property.AXIS_FORMAT:\n case Property.AXIS_LABELANGLE:\n case Property.AXIS_LABELMAXLENGTH:\n case Property.AXIS_SHORTTIMELABELS:\n case Property.AXIS_TICKS:\n case Property.AXIS_SUBDIVIDE:\n case Property.AXIS_TICKCOLOR:\n case Property.AXIS_TICKLABELCOLOR:\n case Property.AXIS_TICKLABELFONT:\n case Property.AXIS_TICKLABELFONTSIZE:\n case Property.AXIS_TICKPADDING:\n case Property.AXIS_TICKSIZE:\n case Property.AXIS_TICKSIZEMAJOR:\n case Property.AXIS_TICKSIZEMINOR:\n case Property.AXIS_TICKSIZEEND:\n case Property.AXIS_TICKWIDTH:\n case Property.AXIS_VALUES:\n case Property.AXIS_TITLE:\n case Property.AXIS_TITLECOLOR:\n case Property.AXIS_TITLEFONT:\n case Property.AXIS_TITLEFONTSIZE:\n case Property.AXIS_TITLEFONTWEIGHT:\n case Property.AXIS_CHARACTERWIDTH:\n case Property.AXIS_TITLEMAXLENGTH:\n case Property.AXIS_TITLEOFFSET:\n case Property.LEGEND_ORIENT:\n case Property.LEGEND_OFFSET:\n case Property.LEGEND_VALUES:\n case Property.LEGEND_FORMAT:\n case Property.LEGEND_LABELALIGN:\n case Property.LEGEND_LABELBASELINE:\n case Property.LEGEND_LABELCOLOR:\n case Property.LEGEND_LABELFONT:\n case Property.LEGEND_LABELFONTSIZE:\n case Property.LEGEND_SHORTTIMELABELS:\n case Property.LEGEND_SYMBOLCOLOR:\n case Property.LEGEND_SYMBOLSHAPE:\n case Property.LEGEND_SYMBOLSIZE:\n case Property.LEGEND_SYMBOLSTROKEWIDTH:\n case Property.LEGEND_TITLE:\n case Property.LEGEND_TITLECOLOR:\n case Property.LEGEND_TITLEFONT:\n case Property.LEGEND_TITLEFONTSIZE:\n case Property.LEGEND_TITLEFONTWEIGHT:\n return false;\n }\n /* istanbul ignore next */\n throw new Error('hasNestedProperty undefined for property ' + prop);\n}\nexports.hasNestedProperty = hasNestedProperty;\nexports.ENCODING_PROPERTIES = [\n Property.CHANNEL,\n Property.BIN,\n Property.BIN_MAXBINS,\n Property.TIMEUNIT,\n Property.AGGREGATE,\n Property.AUTOCOUNT,\n Property.FIELD,\n Property.TYPE,\n Property.SORT,\n Property.SORT_FIELD,\n Property.SORT_OP,\n Property.SORT_ORDER,\n Property.SCALE,\n Property.SCALE_BANDSIZE,\n Property.SCALE_CLAMP,\n Property.SCALE_DOMAIN,\n Property.SCALE_EXPONENT,\n Property.SCALE_NICE,\n Property.SCALE_RANGE,\n Property.SCALE_ROUND,\n Property.SCALE_TYPE,\n Property.SCALE_USERAWDOMAIN,\n Property.SCALE_ZERO,\n Property.AXIS,\n Property.AXIS_AXISCOLOR,\n Property.AXIS_AXISWIDTH,\n Property.AXIS_CHARACTERWIDTH,\n Property.AXIS_FORMAT,\n Property.AXIS_GRID,\n Property.AXIS_GRIDCOLOR,\n Property.AXIS_GRIDDASH,\n Property.AXIS_GRIDOPACITY,\n Property.AXIS_GRIDWIDTH,\n Property.AXIS_LABELANGLE,\n Property.AXIS_LABELMAXLENGTH,\n Property.AXIS_LABELS,\n Property.AXIS_LAYER,\n Property.AXIS_OFFSET,\n Property.AXIS_ORIENT,\n Property.AXIS_SHORTTIMELABELS,\n Property.AXIS_SUBDIVIDE,\n Property.AXIS_TICKCOLOR,\n Property.AXIS_TICKLABELCOLOR,\n Property.AXIS_TICKLABELFONT,\n Property.AXIS_TICKLABELFONTSIZE,\n Property.AXIS_TICKPADDING,\n Property.AXIS_TICKS,\n Property.AXIS_TICKSIZE,\n Property.AXIS_TICKSIZEEND,\n Property.AXIS_TICKSIZEMAJOR,\n Property.AXIS_TICKSIZEMINOR,\n Property.AXIS_TICKWIDTH,\n Property.AXIS_TITLE,\n Property.AXIS_TITLECOLOR,\n Property.AXIS_TITLEFONT,\n Property.AXIS_TITLEFONTSIZE,\n Property.AXIS_TITLEFONTWEIGHT,\n Property.AXIS_TITLEMAXLENGTH,\n Property.AXIS_TITLEOFFSET,\n Property.AXIS_VALUES,\n Property.LEGEND,\n Property.LEGEND_ORIENT,\n Property.LEGEND_OFFSET,\n Property.LEGEND_VALUES,\n Property.LEGEND_FORMAT,\n Property.LEGEND_LABELALIGN,\n Property.LEGEND_LABELBASELINE,\n Property.LEGEND_LABELCOLOR,\n Property.LEGEND_LABELFONT,\n Property.LEGEND_LABELFONTSIZE,\n Property.LEGEND_SHORTTIMELABELS,\n Property.LEGEND_SYMBOLCOLOR,\n Property.LEGEND_SYMBOLSHAPE,\n Property.LEGEND_SYMBOLSIZE,\n Property.LEGEND_SYMBOLSTROKEWIDTH,\n Property.LEGEND_TITLE,\n Property.LEGEND_TITLECOLOR,\n Property.LEGEND_TITLEFONT,\n Property.LEGEND_TITLEFONTSIZE,\n Property.LEGEND_TITLEFONTWEIGHT\n];\nexports.DEFAULT_PROPERTY_PRECEDENCE = [\n // Projection\n Property.TYPE,\n Property.FIELD,\n // TODO: Add stack and remove it from INCLUDE_ALL in shorthand\n // TODO: Add filter and remove it from INCLUDE_ALL in shorthand\n // TODO: Add calculate and remove it from INCLUDE_ALL in shorthand\n // TODO: Add filterInvalid and remove it from INCLUDE_ALL in shorthand\n // Field Transform\n Property.BIN,\n Property.TIMEUNIT,\n Property.AGGREGATE,\n Property.AUTOCOUNT,\n Property.SORT,\n Property.SORT_FIELD,\n Property.SORT_OP,\n Property.SORT_ORDER,\n // Nested Transform Property\n Property.BIN_MAXBINS,\n // Encoding\n Property.CHANNEL,\n Property.MARK,\n Property.SCALE,\n Property.AXIS,\n Property.LEGEND,\n // Nested Encoding Property\n // - Scale\n Property.SCALE_BANDSIZE,\n Property.SCALE_CLAMP,\n Property.SCALE_DOMAIN,\n Property.SCALE_EXPONENT,\n Property.SCALE_NICE,\n Property.SCALE_RANGE,\n Property.SCALE_ROUND,\n Property.SCALE_TYPE,\n Property.SCALE_USERAWDOMAIN,\n Property.SCALE_ZERO,\n // - Axis\n Property.AXIS_AXISCOLOR,\n Property.AXIS_AXISWIDTH,\n Property.AXIS_CHARACTERWIDTH,\n Property.AXIS_FORMAT,\n Property.AXIS_GRID,\n Property.AXIS_GRIDCOLOR,\n Property.AXIS_GRIDDASH,\n Property.AXIS_GRIDOPACITY,\n Property.AXIS_GRIDWIDTH,\n Property.AXIS_LABELANGLE,\n Property.AXIS_LABELMAXLENGTH,\n Property.AXIS_LABELS,\n Property.AXIS_LAYER,\n Property.AXIS_OFFSET,\n Property.AXIS_ORIENT,\n Property.AXIS_SHORTTIMELABELS,\n Property.AXIS_SUBDIVIDE,\n Property.AXIS_TICKCOLOR,\n Property.AXIS_TICKLABELCOLOR,\n Property.AXIS_TICKLABELFONT,\n Property.AXIS_TICKLABELFONTSIZE,\n Property.AXIS_TICKPADDING,\n Property.AXIS_TICKS,\n Property.AXIS_TICKSIZE,\n Property.AXIS_TICKSIZEEND,\n Property.AXIS_TICKSIZEMAJOR,\n Property.AXIS_TICKSIZEMINOR,\n Property.AXIS_TICKWIDTH,\n Property.AXIS_TITLE,\n Property.AXIS_TITLECOLOR,\n Property.AXIS_TITLEFONT,\n Property.AXIS_TITLEFONTSIZE,\n Property.AXIS_TITLEFONTWEIGHT,\n Property.AXIS_TITLEMAXLENGTH,\n Property.AXIS_TITLEOFFSET,\n Property.AXIS_VALUES,\n // - Legend\n Property.LEGEND_ORIENT,\n Property.LEGEND_OFFSET,\n Property.LEGEND_VALUES,\n Property.LEGEND_FORMAT,\n Property.LEGEND_LABELALIGN,\n Property.LEGEND_LABELBASELINE,\n Property.LEGEND_LABELCOLOR,\n Property.LEGEND_LABELFONT,\n Property.LEGEND_LABELFONTSIZE,\n Property.LEGEND_SHORTTIMELABELS,\n Property.LEGEND_SYMBOLCOLOR,\n Property.LEGEND_SYMBOLSHAPE,\n Property.LEGEND_SYMBOLSIZE,\n Property.LEGEND_SYMBOLSTROKEWIDTH,\n Property.LEGEND_TITLE,\n Property.LEGEND_TITLECOLOR,\n Property.LEGEND_TITLEFONT,\n Property.LEGEND_TITLEFONTSIZE,\n Property.LEGEND_TITLEFONTWEIGHT\n];\nexports.NESTED_ENCODING_PROPERTIES = [\n {\n property: Property.BIN_MAXBINS,\n parent: 'bin',\n child: 'maxbins'\n },\n {\n property: Property.SORT_FIELD,\n parent: 'sort',\n child: 'field'\n },\n {\n property: Property.SORT_OP,\n parent: 'sort',\n child: 'op'\n },\n {\n property: Property.SORT_ORDER,\n parent: 'sort',\n child: 'order'\n },\n {\n property: Property.SCALE_BANDSIZE,\n parent: 'scale',\n child: 'bandSize'\n },\n {\n property: Property.SCALE_CLAMP,\n parent: 'scale',\n child: 'clamp'\n },\n {\n property: Property.SCALE_DOMAIN,\n parent: 'scale',\n child: 'domain'\n },\n {\n property: Property.SCALE_EXPONENT,\n parent: 'scale',\n child: 'exponent'\n },\n {\n property: Property.SCALE_NICE,\n parent: 'scale',\n child: 'nice'\n },\n {\n property: Property.SCALE_RANGE,\n parent: 'scale',\n child: 'range'\n },\n {\n property: Property.SCALE_ROUND,\n parent: 'scale',\n child: 'round'\n },\n {\n property: Property.SCALE_TYPE,\n parent: 'scale',\n child: 'type'\n },\n {\n property: Property.SCALE_USERAWDOMAIN,\n parent: 'scale',\n child: 'useRawDomain'\n },\n {\n property: Property.SCALE_ZERO,\n parent: 'scale',\n child: 'zero'\n },\n {\n property: Property.AXIS_AXISCOLOR,\n parent: 'axis',\n child: 'axisColor'\n },\n {\n property: Property.AXIS_AXISWIDTH,\n parent: 'axis',\n child: 'axisWidth'\n },\n {\n property: Property.AXIS_LAYER,\n parent: 'axis',\n child: 'layer'\n },\n {\n property: Property.AXIS_OFFSET,\n parent: 'axis',\n child: 'offset'\n },\n {\n property: Property.AXIS_ORIENT,\n parent: 'axis',\n child: 'orient'\n },\n {\n property: Property.AXIS_GRID,\n parent: 'axis',\n child: 'grid'\n },\n {\n property: Property.AXIS_GRIDCOLOR,\n parent: 'axis',\n child: 'gridColor'\n },\n {\n property: Property.AXIS_GRIDDASH,\n parent: 'axis',\n child: 'gridDash'\n },\n {\n property: Property.AXIS_GRIDOPACITY,\n parent: 'axis',\n child: 'gridOpacity'\n },\n {\n property: Property.AXIS_GRIDWIDTH,\n parent: 'axis',\n child: 'gridWidth'\n },\n {\n property: Property.AXIS_LABELS,\n parent: 'axis',\n child: 'labels'\n },\n {\n property: Property.AXIS_FORMAT,\n parent: 'axis',\n child: 'format'\n },\n {\n property: Property.AXIS_LABELANGLE,\n parent: 'axis',\n child: 'labelAngle'\n },\n {\n property: Property.AXIS_LABELMAXLENGTH,\n parent: 'axis',\n child: 'labelMaxLength'\n },\n {\n property: Property.AXIS_SHORTTIMELABELS,\n parent: 'axis',\n child: 'shortTimeLabels'\n },\n {\n property: Property.AXIS_TICKS,\n parent: 'axis',\n child: 'ticks'\n },\n {\n property: Property.AXIS_SUBDIVIDE,\n parent: 'axis',\n child: 'subdivide'\n },\n {\n property: Property.AXIS_TICKCOLOR,\n parent: 'axis',\n child: 'tickColor'\n },\n {\n property: Property.AXIS_TICKLABELCOLOR,\n parent: 'axis',\n child: 'tickLabelColor'\n },\n {\n property: Property.AXIS_TICKLABELFONT,\n parent: 'axis',\n child: 'tickLabelFont'\n },\n {\n property: Property.AXIS_TICKLABELFONTSIZE,\n parent: 'axis',\n child: 'tickLabelFontSize'\n },\n {\n property: Property.AXIS_TICKPADDING,\n parent: 'axis',\n child: 'tickPadding'\n },\n {\n property: Property.AXIS_TICKSIZE,\n parent: 'axis',\n child: 'tickSize'\n },\n {\n property: Property.AXIS_TICKSIZEMAJOR,\n parent: 'axis',\n child: 'tickSizeMajor'\n },\n {\n property: Property.AXIS_TICKSIZEMINOR,\n parent: 'axis',\n child: 'tickSizeMinor'\n },\n {\n property: Property.AXIS_TICKSIZEEND,\n parent: 'axis',\n child: 'tickSizeEnd'\n },\n {\n property: Property.AXIS_TICKWIDTH,\n parent: 'axis',\n child: 'tickWidth'\n },\n {\n property: Property.AXIS_VALUES,\n parent: 'axis',\n child: 'values'\n },\n {\n property: Property.AXIS_TITLE,\n parent: 'axis',\n child: 'title'\n },\n {\n property: Property.AXIS_TITLECOLOR,\n parent: 'axis',\n child: 'titleColor'\n },\n {\n property: Property.AXIS_TITLEFONT,\n parent: 'axis',\n child: 'titleFont'\n },\n {\n property: Property.AXIS_TITLEFONTSIZE,\n parent: 'axis',\n child: 'titleFontSize'\n },\n {\n property: Property.AXIS_TITLEFONTWEIGHT,\n parent: 'axis',\n child: 'titleFontWeight'\n },\n {\n property: Property.AXIS_CHARACTERWIDTH,\n parent: 'axis',\n child: 'characterWidth'\n },\n {\n property: Property.AXIS_TITLEMAXLENGTH,\n parent: 'axis',\n child: 'titleMaxLength'\n },\n {\n property: Property.AXIS_TITLEOFFSET,\n parent: 'axis',\n child: 'titleOffset'\n },\n {\n property: Property.LEGEND_ORIENT,\n parent: 'legend',\n child: 'orient'\n },\n {\n property: Property.LEGEND_OFFSET,\n parent: 'legend',\n child: 'offset',\n },\n {\n property: Property.LEGEND_VALUES,\n parent: 'legend',\n child: 'values'\n },\n {\n property: Property.LEGEND_FORMAT,\n parent: 'legend',\n child: 'format'\n },\n {\n property: Property.LEGEND_LABELALIGN,\n parent: 'legend',\n child: 'labelAlign'\n },\n {\n property: Property.LEGEND_LABELBASELINE,\n parent: 'legend',\n child: 'labelBaseline'\n },\n {\n property: Property.LEGEND_LABELFONT,\n parent: 'legend',\n child: 'labelFont'\n },\n {\n property: Property.LEGEND_LABELFONTSIZE,\n parent: 'legend',\n child: 'labelFontSize'\n },\n {\n property: Property.LEGEND_SHORTTIMELABELS,\n parent: 'legend',\n child: 'shortTimeLabels'\n },\n {\n property: Property.LEGEND_SYMBOLCOLOR,\n parent: 'legend',\n child: 'symbolColor'\n },\n {\n property: Property.LEGEND_SYMBOLSHAPE,\n parent: 'legend',\n child: 'symbolShape'\n },\n {\n property: Property.LEGEND_SYMBOLSIZE,\n parent: 'legend',\n child: 'symbolSize'\n },\n {\n property: Property.LEGEND_SYMBOLSTROKEWIDTH,\n parent: 'legend',\n child: 'symbolStrokeWidth'\n },\n {\n property: Property.LEGEND_TITLE,\n parent: 'legend',\n child: 'title'\n },\n {\n property: Property.LEGEND_TITLECOLOR,\n parent: 'legend',\n child: 'titleColor'\n },\n {\n property: Property.LEGEND_TITLEFONT,\n parent: 'legend',\n child: 'titleFont'\n },\n {\n property: Property.LEGEND_TITLEFONTSIZE,\n parent: 'legend',\n child: 'titleFontSize'\n },\n {\n property: Property.LEGEND_TITLEFONTWEIGHT,\n parent: 'legend',\n child: 'titleFontWeight'\n }\n];\nvar NESTED_ENCODING_INDEX = exports.NESTED_ENCODING_PROPERTIES.reduce(function (m, nestedProp) {\n m[nestedProp.property] = nestedProp;\n return m;\n}, {});\nvar NESTED_ENCODING_PROPERTY_PARENT_INDEX = exports.NESTED_ENCODING_PROPERTIES.reduce(function (m, nestedProp) {\n var parent = nestedProp.parent;\n // if the parent does not exist in m yet, add it as a key in m with empty [] as value\n if (!(parent in m)) {\n m[parent] = [];\n }\n m[nestedProp.parent].push(nestedProp);\n return m;\n}, {}); // as Dict>);\nexports.SCALE_PROPERTIES = NESTED_ENCODING_PROPERTY_PARENT_INDEX['scale'].map(function (nestedProp) {\n return nestedProp.property;\n});\nvar ENCODING_INDEX = exports.ENCODING_PROPERTIES.reduce(function (m, prop) {\n m[prop] = prop;\n return m;\n}, {});\nfunction isEncodingProperty(prop) {\n return ENCODING_INDEX[prop] !== undefined;\n}\nexports.isEncodingProperty = isEncodingProperty;\nfunction getNestedEncodingProperty(prop) {\n return NESTED_ENCODING_INDEX[prop];\n}\nexports.getNestedEncodingProperty = getNestedEncodingProperty;\nfunction getNestedEncodingPropertyChildren(parent) {\n return NESTED_ENCODING_PROPERTY_PARENT_INDEX[parent];\n}\nexports.getNestedEncodingPropertyChildren = getNestedEncodingPropertyChildren;\nfunction isNestedEncodingProperty(prop) {\n return prop in NESTED_ENCODING_INDEX;\n}\nexports.isNestedEncodingProperty = isNestedEncodingProperty;\nvar SUPPORTED_SCALE_PROPERTY = [\n {\n property: 'bandSize',\n supportedScaleType: [\n scale_1.ScaleType.ORDINAL\n ]\n },\n {\n property: 'clamp',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'domain',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.QUANTILE,\n scale_1.ScaleType.QUANTIZE,\n scale_1.ScaleType.ORDINAL,\n scale_1.ScaleType.SQRT,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'exponent',\n supportedScaleType: [\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.SQRT\n ]\n },\n {\n property: 'nice',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'range',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.QUANTILE,\n scale_1.ScaleType.QUANTIZE,\n scale_1.ScaleType.ORDINAL,\n scale_1.ScaleType.SQRT,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'round',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.SQRT,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'useRawDomain',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.LOG,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.QUANTILE,\n scale_1.ScaleType.QUANTIZE,\n scale_1.ScaleType.ORDINAL,\n scale_1.ScaleType.SQRT,\n scale_1.ScaleType.TIME,\n scale_1.ScaleType.UTC\n ]\n },\n {\n property: 'zero',\n supportedScaleType: [\n scale_1.ScaleType.LINEAR,\n scale_1.ScaleType.POW,\n scale_1.ScaleType.SQRT\n ]\n }\n];\nexports.SUPPORTED_SCALE_PROPERTY_INDEX = SUPPORTED_SCALE_PROPERTY.reduce(function (m, scaleProp) {\n var prop = scaleProp.property;\n m[prop] = scaleProp.supportedScaleType;\n return m;\n}, {});\n//# sourceMappingURL=property.js.map", + "\"use strict\";\nvar scale_1 = require('vega-lite/src/scale');\nvar timeunit_1 = require('vega-lite/src/timeunit');\nvar type_1 = require('vega-lite/src/type');\nvar enumspec_1 = require('../enumspec');\nvar util_1 = require('../util');\nfunction isDimension(encQ) {\n return util_1.contains([type_1.Type.NOMINAL, type_1.Type.ORDINAL], encQ.type) ||\n (!enumspec_1.isEnumSpec(encQ.bin) && !!encQ.bin) ||\n (!enumspec_1.isEnumSpec(encQ.timeUnit) && !!encQ.timeUnit); // surely T type\n // TODO For T type, take scale type of the timeUnit into account\n}\nexports.isDimension = isDimension;\nfunction isMeasure(encQ) {\n return (encQ.type === type_1.Type.QUANTITATIVE && !encQ.bin) ||\n (encQ.type === type_1.Type.TEMPORAL && !encQ.timeUnit);\n // TODO For T type, take scale type of the timeUnit into account\n}\nexports.isMeasure = isMeasure;\n/**\n * Returns the true scale type of an encoding.\n * @returns {ScaleType} If the scale type was not specified, it is inferred from the encoding's Type.\n * @returns {undefined} If the scale type was not specified and Type (or TimeUnit if applicable) is an EnumSpec, there is no clear scale type\n */\nfunction scaleType(encQ) {\n var scale = encQ.scale === true || encQ.scale === enumspec_1.SHORT_ENUM_SPEC ? {} : encQ.scale;\n var type = encQ.type;\n var timeUnit = encQ.timeUnit;\n if (scale && scale.type !== undefined) {\n return scale.type;\n }\n if (enumspec_1.isEnumSpec(type)) {\n return undefined;\n }\n /* istanbul ignore else */\n if (type === type_1.Type.QUANTITATIVE) {\n return scale_1.ScaleType.LINEAR;\n }\n else if (type === type_1.Type.ORDINAL || type === type_1.Type.NOMINAL) {\n return scale_1.ScaleType.ORDINAL;\n }\n else if (type === type_1.Type.TEMPORAL) {\n if (timeUnit !== undefined) {\n if (enumspec_1.isEnumSpec(timeUnit)) {\n return undefined;\n }\n return timeunit_1.defaultScaleType(timeUnit);\n }\n else {\n return scale_1.ScaleType.TIME;\n }\n }\n else {\n throw new Error('Unsupported type: ' + type + ' in scaleType');\n }\n}\nexports.scaleType = scaleType;\n//# sourceMappingURL=encoding.js.map", + "\"use strict\";\nvar util_1 = require('datalib/src/util');\nvar util_2 = require('../util');\nexports.REPLACE_BLANK_FIELDS = { '*': '' };\nexports.REPLACE_XY_CHANNELS = { x: 'xy', y: 'xy' };\nexports.REPLACE_FACET_CHANNELS = { row: 'facet', column: 'facet' };\nexports.REPLACE_MARK_STYLE_CHANNELS = { color: 'style', opacity: 'style', shape: 'style', size: 'style' };\nfunction isExtendedGroupBy(g) {\n return util_1.isObject(g) && !!g['property'];\n}\nexports.isExtendedGroupBy = isExtendedGroupBy;\nfunction toString(groupBy) {\n if (util_1.isArray(groupBy)) {\n return groupBy.map(function (g) {\n if (isExtendedGroupBy(g)) {\n if (g.replace) {\n var replaceIndex = util_2.keys(g.replace).reduce(function (index, valFrom) {\n var valTo = g.replace[valFrom];\n (index[valTo] = index[valTo] || []).push(valFrom);\n return index;\n }, {});\n return g.property + '[' + util_2.keys(replaceIndex).map(function (valTo) {\n var valsFrom = replaceIndex[valTo].sort();\n return valsFrom.join(',') + '=>' + valTo;\n }).join(';') + ']';\n }\n return g.property;\n }\n return g;\n }).join(',');\n }\n else {\n return groupBy;\n }\n}\nexports.toString = toString;\n//# sourceMappingURL=groupby.js.map", + "\"use strict\";\nvar config_1 = require('../config');\nvar generate_1 = require('../generate');\nvar nest_1 = require('../nest');\nvar ranking_1 = require('../ranking/ranking');\nvar util_1 = require('../util');\nexports.encoding = require('./encoding');\nexports.groupBy = require('./groupby');\nexports.shorthand = require('./shorthand');\nexports.spec = require('./spec');\nexports.transform = require('./transform');\nfunction query(q, schema, config) {\n // 1. Normalize non-nested `groupBy` to always have `groupBy` inside `nest`\n // and merge config with the following precedence\n // query.config > config > DEFAULT_QUERY_CONFIG\n q = util_1.extend({}, normalize(q), {\n config: util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, config, q.config)\n });\n // 2. Generate\n var answerSet = generate_1.generate(q.spec, schema, q.config);\n var nestedAnswerSet = nest_1.nest(answerSet, q);\n var result = ranking_1.rank(nestedAnswerSet, q, schema, 0);\n return {\n query: q,\n result: result\n };\n}\nexports.query = query;\n/**\n * Normalize the non-nested version of the query to a standardize nested\n */\nfunction normalize(q) {\n if (q.groupBy) {\n var nest_2 = {\n groupBy: q.groupBy\n };\n if (q.orderBy) {\n nest_2.orderGroupBy = q.orderBy;\n }\n var normalizedQ = {\n spec: util_1.duplicate(q.spec),\n nest: [nest_2],\n };\n if (q.chooseBy) {\n normalizedQ.chooseBy = q.chooseBy;\n }\n if (q.config) {\n normalizedQ.config = q.config;\n }\n return normalizedQ;\n }\n return util_1.duplicate(q); // We will cause side effect to q.spec in SpecQueryModel.build\n}\nexports.normalize = normalize;\n//# sourceMappingURL=query.js.map", + "\"use strict\";\nvar filter_1 = require('vega-lite/src/filter');\nvar type_1 = require('vega-lite/src/type');\nvar util_1 = require('datalib/src/util');\nvar spec_1 = require('./spec');\nvar enumspec_1 = require('../enumspec');\nvar property_1 = require('../property');\nvar util_2 = require('../util');\nfunction getReplacer(replace) {\n return function (s) {\n if (replace[s] !== undefined) {\n return replace[s];\n }\n return s;\n };\n}\nexports.getReplacer = getReplacer;\nfunction value(v, replace) {\n if (enumspec_1.isEnumSpec(v)) {\n return enumspec_1.SHORT_ENUM_SPEC;\n }\n if (replace) {\n return replace(v);\n }\n return v;\n}\nexports.value = value;\nexports.INCLUDE_ALL = \n// TODO: remove manual STACK, FILTER, CALCULATE concat once we really support enumerating it.\nproperty_1.DEFAULT_PROPERTY_PRECEDENCE.concat([property_1.Property.CALCULATE, property_1.Property.FILTER, property_1.Property.FILTERINVALID, property_1.Property.STACK])\n .reduce(function (m, prop) {\n m[prop] = true;\n return m;\n}, {});\nfunction vlSpec(vlspec, include, replace) {\n if (include === void 0) { include = exports.INCLUDE_ALL; }\n if (replace === void 0) { replace = {}; }\n var specQ = spec_1.fromSpec(vlspec);\n return spec(specQ);\n}\nexports.vlSpec = vlSpec;\n/**\n * Returns a shorthand for a spec query\n * @param specQ a spec query\n * @param include Dict Set listing property types (key) to be included in the shorthand\n * @param replace Dictionary of replace function for values of a particular property type (key)\n */\nfunction spec(specQ, include, replace) {\n if (include === void 0) { include = exports.INCLUDE_ALL; }\n if (replace === void 0) { replace = {}; }\n var parts = [];\n if (include[property_1.Property.MARK]) {\n parts.push(value(specQ.mark, replace[property_1.Property.MARK]));\n }\n if (specQ.transform) {\n if (include[property_1.Property.CALCULATE]) {\n if (specQ.transform.calculate !== undefined) {\n parts.push('calculate:' + calculate(specQ.transform.calculate));\n }\n }\n if (include[property_1.Property.FILTER]) {\n if (specQ.transform.filter !== undefined) {\n parts.push('filter:' + filter(specQ.transform.filter));\n }\n }\n if (include[property_1.Property.FILTERINVALID]) {\n if (specQ.transform.filterInvalid !== undefined) {\n parts.push('filterInvalid:' + specQ.transform.filterInvalid);\n }\n }\n }\n // TODO: extract this to its own stack method\n if (include[property_1.Property.STACK]) {\n var _stack = spec_1.stack(specQ);\n if (_stack) {\n // TODO: Refactor this once we have child stack property.\n // Exclude type since we don't care about type in stack\n var includeExceptType = util_2.extend({}, include, { type: false });\n var field = fieldDef(_stack.fieldEncQ, includeExceptType, replace);\n var groupby = fieldDef(_stack.groupByEncQ, includeExceptType, replace);\n parts.push('stack={field:' + field + ',' +\n (groupby ? 'by:' + groupby + ',' : '') +\n 'offset:' + _stack.offset + '}');\n }\n }\n parts.push(specQ.encodings.reduce(function (encQs, encQ) {\n // Exclude encoding mapping with autoCount=false as they are basically disabled.\n if (encQ.autoCount !== false) {\n var str = encoding(encQ, include, replace);\n if (str) {\n encQs.push(str);\n }\n }\n return encQs;\n }, [])\n .sort() // sort at the end to ignore order\n .join('|'));\n return parts.join('|');\n}\nexports.spec = spec;\nfunction filter(_filter) {\n if (_filter instanceof Array) {\n var filters = _filter.map(filter);\n return filters.length > 1 ? '(' + filters.join(') && (') + ')' : filters[0];\n }\n else if (typeof _filter === 'string') {\n return _filter;\n }\n else {\n return filter_1.expression(_filter);\n }\n}\nexports.filter = filter;\nfunction calculate(formulaArr) {\n return formulaArr.map(function (calculateItem) {\n return \"{\" + calculateItem.field + \":\" + calculateItem.expr + \"}\";\n }).join(',');\n}\nexports.calculate = calculate;\n/**\n * Returns a shorthand for an encoding query\n * @param encQ an encoding query\n * @param include Dict Set listing property types (key) to be included in the shorthand\n * @param replace Dictionary of replace function for values of a particular property type (key)\n */\nfunction encoding(encQ, include, replace) {\n if (include === void 0) { include = exports.INCLUDE_ALL; }\n if (replace === void 0) { replace = {}; }\n var parts = [];\n if (include[property_1.Property.CHANNEL]) {\n parts.push(value(encQ.channel, replace[property_1.Property.CHANNEL]));\n }\n var fieldDefStr = fieldDef(encQ, include, replace);\n if (fieldDefStr) {\n parts.push(fieldDefStr);\n }\n return parts.join(':');\n}\nexports.encoding = encoding;\n/**\n * Returns a field definiton shorthand for an encoding query\n * @param encQ an encoding query\n * @param include Dict Set listing property types (key) to be included in the shorthand\n * @param replace Dictionary of replace function for values of a particular property type (key)\n */\nfunction fieldDef(encQ, include, replace) {\n if (include === void 0) { include = exports.INCLUDE_ALL; }\n if (replace === void 0) { replace = {}; }\n var fn = null;\n /** Encoding properties e.g., Scale, Axis, Legend */\n var props = [];\n if (include[property_1.Property.AGGREGATE] && encQ.autoCount === false) {\n return '-';\n }\n else if (include[property_1.Property.AGGREGATE] && encQ.aggregate && !enumspec_1.isEnumSpec(encQ.aggregate)) {\n fn = value(encQ.aggregate, replace[property_1.Property.AGGREGATE]);\n }\n else if (include[property_1.Property.AGGREGATE] && encQ.autoCount && !enumspec_1.isEnumSpec(encQ.autoCount)) {\n fn = value('count', replace[property_1.Property.AGGREGATE]);\n ;\n }\n else if (include[property_1.Property.TIMEUNIT] && encQ.timeUnit && !enumspec_1.isEnumSpec(encQ.timeUnit)) {\n fn = value(encQ.timeUnit, replace[property_1.Property.TIMEUNIT]);\n }\n else if (include[property_1.Property.BIN] && encQ.bin && !enumspec_1.isEnumSpec(encQ.bin)) {\n fn = 'bin';\n if (include[property_1.Property.BIN_MAXBINS] && encQ.bin['maxbins']) {\n props.push({\n key: 'maxbins',\n value: value(encQ.bin['maxbins'], replace[property_1.Property.BIN_MAXBINS])\n });\n }\n }\n else {\n for (var _i = 0, _a = [property_1.Property.AGGREGATE, property_1.Property.AUTOCOUNT, property_1.Property.TIMEUNIT, property_1.Property.BIN]; _i < _a.length; _i++) {\n var prop = _a[_i];\n if (include[prop] && encQ[prop] && enumspec_1.isEnumSpec(encQ[prop])) {\n fn = enumspec_1.SHORT_ENUM_SPEC + '';\n break;\n }\n }\n }\n // Scale\n // TODO(#226):\n // write toSpec() and toShorthand() in a way that prevents outputting inapplicable scale, sort, axis / legend\n var _loop_1 = function(nestedPropParent) {\n if (include[nestedPropParent]) {\n if (encQ[nestedPropParent] && !enumspec_1.isEnumSpec(encQ[nestedPropParent])) {\n // `sort` can be a string (ascending/descending).\n if (util_1.isString(encQ[nestedPropParent])) {\n props.push({\n key: nestedPropParent + '',\n value: encQ[nestedPropParent]\n });\n }\n else {\n var nestedProps = property_1.getNestedEncodingPropertyChildren(nestedPropParent);\n var nestedPropChildren = nestedProps.reduce(function (p, nestedProp) {\n if (include[nestedProp.property] && encQ[nestedPropParent][nestedProp.child] !== undefined) {\n p[nestedProp.child] = value(encQ[nestedPropParent][nestedProp.child], replace[nestedProp.property]);\n }\n return p;\n }, {});\n if (util_2.keys(nestedPropChildren).length > 0) {\n props.push({\n key: nestedPropParent + '',\n value: JSON.stringify(nestedPropChildren)\n });\n }\n }\n }\n else if (encQ[nestedPropParent] === false || encQ[nestedPropParent] === null) {\n // `scale`, `axis`, `legend` can be false/null.\n props.push({\n key: nestedPropParent + '',\n value: false\n });\n }\n }\n };\n for (var _b = 0, _c = [property_1.Property.SCALE, property_1.Property.SORT, property_1.Property.AXIS, property_1.Property.LEGEND]; _b < _c.length; _b++) {\n var nestedPropParent = _c[_b];\n _loop_1(nestedPropParent);\n }\n // field\n var fieldAndParams = include[property_1.Property.FIELD] ? value(encQ.field || '*', replace[property_1.Property.FIELD]) : '...';\n // type\n if (include[property_1.Property.TYPE]) {\n var typeShort = ((encQ.type || type_1.Type.QUANTITATIVE) + '').substr(0, 1);\n fieldAndParams += ',' + value(typeShort, replace[property_1.Property.TYPE]);\n }\n // encoding properties\n fieldAndParams += props.map(function (p) { return ',' + p.key + '=' + p.value; }).join('');\n return (fn ? fn + '(' + fieldAndParams + ')' : fieldAndParams);\n}\nexports.fieldDef = fieldDef;\n//# sourceMappingURL=shorthand.js.map", + "\"use strict\";\nvar channel_1 = require('vega-lite/src/channel');\nvar mark_1 = require('vega-lite/src/mark');\nvar stack_1 = require('vega-lite/src/stack');\nvar enumspec_1 = require('../enumspec');\nvar property_1 = require('../property');\nvar util_1 = require('../util');\n/**\n * Convert a Vega-Lite's ExtendedUnitSpec into a CompassQL's SpecQuery\n * @param {ExtendedUnitSpec} spec\n * @returns\n */\nfunction fromSpec(spec) {\n return util_1.extend(spec.data ? { data: spec.data } : {}, spec.transform ? { transform: spec.transform } : {}, {\n mark: spec.mark,\n encodings: util_1.keys(spec.encoding).map(function (channel) {\n var encQ = { channel: channel };\n var channelDef = spec.encoding[channel];\n for (var _i = 0, ENCODING_PROPERTIES_1 = property_1.ENCODING_PROPERTIES; _i < ENCODING_PROPERTIES_1.length; _i++) {\n var prop = ENCODING_PROPERTIES_1[_i];\n if (!property_1.isNestedEncodingProperty(prop) && channelDef[prop] !== undefined) {\n encQ[prop] = channelDef[prop];\n }\n // Currently scale, axis, legend only support boolean, but not null.\n // Therefore convert null to false.\n if (util_1.contains([property_1.Property.SCALE, property_1.Property.AXIS, property_1.Property.LEGEND], prop) && encQ[prop] === null) {\n encQ[prop] = false;\n }\n }\n return encQ;\n })\n }, spec.config ? { config: spec.config } : {});\n}\nexports.fromSpec = fromSpec;\nfunction isAggregate(specQ) {\n return util_1.some(specQ.encodings, function (encQ) {\n return (!enumspec_1.isEnumSpec(encQ.aggregate) && !!encQ.aggregate) || encQ.autoCount === true;\n });\n}\nexports.isAggregate = isAggregate;\n/**\n * @return the stack offset type for the specQuery\n */\nfunction stack(specQ) {\n var config = specQ.config;\n var stacked = (config && config.mark) ? config.mark.stacked : undefined;\n // Should not have stack explicitly disabled\n if (util_1.contains([stack_1.StackOffset.NONE, null, false], stacked)) {\n return null;\n }\n // Should have stackable mark\n if (!util_1.contains([mark_1.BAR, mark_1.AREA], specQ.mark)) {\n return null;\n }\n // Should be aggregate plot\n if (!isAggregate(specQ)) {\n return null;\n }\n var stackByChannels = specQ.encodings.reduce(function (sc, encQ) {\n if (util_1.contains(channel_1.STACK_GROUP_CHANNELS, encQ.channel) && !encQ.aggregate) {\n sc.push(encQ.channel);\n }\n return sc;\n }, []);\n if (stackByChannels.length === 0) {\n return null;\n }\n // Has only one aggregate axis\n var xEncQ = specQ.encodings.reduce(function (f, encQ) {\n return f || (encQ.channel === channel_1.Channel.X ? encQ : null);\n }, null);\n var yEncQ = specQ.encodings.reduce(function (f, encQ) {\n return f || (encQ.channel === channel_1.Channel.Y ? encQ : null);\n }, null);\n var xIsAggregate = !!xEncQ && (!!xEncQ.aggregate || !!xEncQ.autoCount);\n var yIsAggregate = !!yEncQ && (!!yEncQ.aggregate || !!yEncQ.autoCount);\n if (xIsAggregate !== yIsAggregate) {\n return {\n groupbyChannel: xIsAggregate ? (!!yEncQ ? channel_1.Y : null) : (!!xEncQ ? channel_1.X : null),\n groupByEncQ: xIsAggregate ? yEncQ : xEncQ,\n fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y,\n fieldEncQ: xIsAggregate ? xEncQ : yEncQ,\n stackByChannels: stackByChannels,\n offset: stacked || stack_1.StackOffset.ZERO\n };\n }\n return null;\n}\nexports.stack = stack;\n//# sourceMappingURL=spec.js.map", + "\"use strict\";\n//# sourceMappingURL=transform.js.map", + "\"use strict\";\nvar aggregate_1 = require('vega-lite/src/aggregate');\nvar type_1 = require('vega-lite/src/type');\nvar util_1 = require('../util');\nvar encoding_1 = require('../query/encoding');\nexports.name = 'aggregationQuality';\nfunction score(specM, schema, opt) {\n var feature = aggregationQualityFeature(specM, schema, opt);\n return {\n score: feature.score,\n features: [feature]\n };\n}\nexports.score = score;\nfunction aggregationQualityFeature(specM, schema, opt) {\n var encodings = specM.getEncodings();\n if (specM.isAggregate()) {\n var isRawContinuous = function (encQ) {\n return (encQ.type === type_1.Type.QUANTITATIVE && !encQ.bin && !encQ.aggregate && !encQ.autoCount) ||\n (encQ.type === type_1.Type.TEMPORAL && !encQ.timeUnit);\n };\n if (util_1.some(encodings, isRawContinuous)) {\n // These are plots that pollute continuous fields as dimension.\n // They are often intermediate visualizations rather than what users actually want.\n return {\n type: exports.name,\n score: 0.1,\n feature: 'Aggregate with raw continuous'\n };\n }\n if (util_1.some(encodings, encoding_1.isDimension)) {\n if (util_1.some(encodings, function (encQ) { return encQ.aggregate === aggregate_1.AggregateOp.COUNT; })) {\n // If there is count, we might add additional count field, making it a little less simple\n // then when we just apply aggregate to Q field\n return {\n type: exports.name,\n score: 0.8,\n feature: 'Aggregate with count'\n };\n }\n return {\n type: exports.name,\n score: 0.9,\n feature: 'Aggregate without count'\n };\n }\n // no dimension -- often not very useful\n return {\n type: exports.name,\n score: 0.3,\n feature: 'Aggregate without dimension'\n };\n }\n else {\n if (util_1.some(encodings, encoding_1.isMeasure)) {\n // raw plots with measure -- simplest of all!\n return {\n type: exports.name,\n score: 1,\n feature: 'Raw with measure'\n };\n }\n // raw plots with no measure -- often a lot of occlusion\n return {\n type: exports.name,\n score: 0.2,\n feature: 'Raw without measure'\n };\n }\n}\n//# sourceMappingURL=aggregation.js.map", + "\"use strict\";\nvar channel_1 = require('vega-lite/src/channel');\nvar config_1 = require('../../config');\nvar shorthand_1 = require('../../query/shorthand');\nvar util_1 = require('../../util');\nvar effectiveness_1 = require('./effectiveness');\nvar type_1 = require('./type');\n/**\n * Field Type (with Bin and TimeUnit) and Channel Score (Cleveland / Mackinlay based)\n */\nvar TypeChannelScore;\n(function (TypeChannelScore) {\n TypeChannelScore.TYPE_CHANNEL = 'typeChannel';\n function init() {\n var SCORE = {};\n var ORDERED_TYPE_CHANNEL_SCORE = {\n x: 0,\n y: 0,\n size: -0.55,\n color: -0.6,\n opacity: -0.75,\n text: -0.775,\n row: -0.8,\n column: -0.8,\n shape: -2.5,\n detail: -3\n };\n [type_1.Q, type_1.BIN_Q, type_1.T, type_1.TIMEUNIT_T, type_1.TIMEUNIT_O, type_1.O].forEach(function (type) {\n util_1.keys(ORDERED_TYPE_CHANNEL_SCORE).forEach(function (channel) {\n SCORE[featurize(type, channel)] = ORDERED_TYPE_CHANNEL_SCORE[channel];\n });\n });\n // Penalize row/column for bin quantitative / timeUnit_temporal / O less\n [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.TIMEUNIT_O, type_1.O].forEach(function (type) {\n [channel_1.Channel.ROW, channel_1.Channel.COLUMN].forEach(function (channel) {\n SCORE[featurize(type, channel)] += 0.15;\n });\n });\n var NOMINAL_TYPE_CHANNEL_SCORE = {\n x: 0,\n y: 0,\n color: -0.6,\n shape: -0.65,\n row: -0.7,\n column: -0.7,\n text: -0.8,\n size: -1.8,\n detail: -2,\n opacity: -2.1\n };\n util_1.keys(NOMINAL_TYPE_CHANNEL_SCORE).forEach(function (channel) {\n SCORE[featurize(type_1.N, channel)] = NOMINAL_TYPE_CHANNEL_SCORE[channel];\n });\n return SCORE;\n }\n TypeChannelScore.init = init;\n function featurize(type, channel) {\n return type + '_' + channel;\n }\n TypeChannelScore.featurize = featurize;\n function getScore(specM, schema, opt) {\n var encodingQueryByField = specM.getEncodings().reduce(function (m, encQ) {\n var fieldKey = shorthand_1.fieldDef(encQ);\n (m[fieldKey] = m[fieldKey] || []).push(encQ);\n return m;\n }, {});\n var features = [];\n util_1.forEach(encodingQueryByField, function (encQs) {\n var bestFieldFeature = encQs.reduce(function (best, encQ) {\n var type = type_1.getExtendedType(encQ);\n var feature = featurize(type, encQ.channel);\n var featureScore = effectiveness_1.getFeatureScore(TypeChannelScore.TYPE_CHANNEL, feature);\n if (best === null || featureScore.score > best.score) {\n return featureScore;\n }\n return best;\n }, null);\n features.push(bestFieldFeature);\n // TODO: add plus for over-encoding of one field\n });\n return features;\n }\n TypeChannelScore.getScore = getScore;\n})(TypeChannelScore = exports.TypeChannelScore || (exports.TypeChannelScore = {}));\nvar PreferredAxisScore;\n(function (PreferredAxisScore) {\n PreferredAxisScore.PREFERRED_AXIS = 'preferredAxis';\n // FIXME support doing this at runtime\n function init(opt) {\n if (opt === void 0) { opt = {}; }\n opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt);\n var score = {};\n var preferredAxes = [{\n feature: type_1.BIN_Q,\n opt: 'preferredBinAxis'\n }, {\n feature: type_1.T,\n opt: 'preferredTemporalAxis'\n }, {\n feature: type_1.TIMEUNIT_T,\n opt: 'preferredTemporalAxis'\n }, {\n feature: type_1.TIMEUNIT_O,\n opt: 'preferredTemporalAxis'\n }, {\n feature: type_1.O,\n opt: 'preferredOrdinalAxis'\n }, {\n feature: type_1.N,\n opt: 'preferredNominalAxis'\n }];\n preferredAxes.forEach(function (preferredAxis) {\n if (opt[preferredAxis.opt] === channel_1.Channel.X) {\n // penalize the other axis\n score[preferredAxis.feature + '_' + channel_1.Channel.Y] = -0.01;\n }\n else if (opt[preferredAxis.opt] === channel_1.Channel.Y) {\n // penalize the other axis\n score[preferredAxis.feature + '_' + channel_1.Channel.X] = -0.01;\n }\n });\n return score;\n }\n PreferredAxisScore.init = init;\n function featurize(type, channel) {\n return type + '_' + channel;\n }\n PreferredAxisScore.featurize = featurize;\n function getScore(specM, schema, opt) {\n return specM.getEncodings().reduce(function (features, encQ) {\n var type = type_1.getExtendedType(encQ);\n var feature = featurize(type, encQ.channel);\n var featureScore = effectiveness_1.getFeatureScore(PreferredAxisScore.PREFERRED_AXIS, feature);\n if (featureScore) {\n features.push(featureScore);\n }\n return features;\n }, []);\n }\n PreferredAxisScore.getScore = getScore;\n})(PreferredAxisScore = exports.PreferredAxisScore || (exports.PreferredAxisScore = {}));\nvar PreferredFacetScore;\n(function (PreferredFacetScore) {\n PreferredFacetScore.PREFERRED_FACET = 'preferredFacet';\n // FIXME support doing this at runtime\n function init(opt) {\n opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt);\n var score = {};\n if (opt.preferredFacet === channel_1.Channel.ROW) {\n // penalize the other axis\n score[channel_1.Channel.COLUMN] = -0.01;\n }\n else if (opt.preferredFacet === channel_1.Channel.COLUMN) {\n // penalize the other axis\n score[channel_1.Channel.ROW] = -0.01;\n }\n return score;\n }\n PreferredFacetScore.init = init;\n function getScore(specM, schema, opt) {\n return specM.getEncodings().reduce(function (features, encQ) {\n var featureScore = effectiveness_1.getFeatureScore(PreferredFacetScore.PREFERRED_FACET, encQ.channel);\n if (featureScore) {\n features.push(featureScore);\n }\n return features;\n }, []);\n }\n PreferredFacetScore.getScore = getScore;\n})(PreferredFacetScore = exports.PreferredFacetScore || (exports.PreferredFacetScore = {}));\nvar MarkChannelScore;\n(function (MarkChannelScore) {\n // Penalty for certain channel for certain mark types\n MarkChannelScore.MARK_CHANNEL = 'markChannel';\n function init() {\n return {\n bar_size: -2,\n tick_size: -2\n };\n }\n MarkChannelScore.init = init;\n function getScore(specM, schema, opt) {\n var mark = specM.getMark();\n return specM.getEncodings().reduce(function (featureScores, encQ) {\n var feature = mark + '_' + encQ.channel;\n var featureScore = effectiveness_1.getFeatureScore(MarkChannelScore.MARK_CHANNEL, feature);\n if (featureScore) {\n featureScores.push(featureScore);\n }\n return featureScores;\n }, []);\n }\n MarkChannelScore.getScore = getScore;\n})(MarkChannelScore = exports.MarkChannelScore || (exports.MarkChannelScore = {}));\n/**\n * Penalize if facet channels are the only dimensions\n */\nvar DimensionScore;\n(function (DimensionScore) {\n DimensionScore.DIMENSION = 'dimension';\n function init() {\n return {\n row: -2,\n column: -2,\n color: 0,\n opacity: 0,\n size: 0,\n shape: 0\n };\n }\n DimensionScore.init = init;\n function getScore(specM, schema, opt) {\n if (specM.isAggregate()) {\n specM.getEncodings().reduce(function (maxFScore, encQ) {\n if (!encQ.aggregate && !encQ.autoCount) {\n var featureScore = effectiveness_1.getFeatureScore(DimensionScore.DIMENSION, encQ.channel + '');\n if (featureScore.score > maxFScore.score) {\n return featureScore;\n }\n }\n return maxFScore;\n }, { type: DimensionScore.DIMENSION, feature: 'No Dimension', score: -5 });\n }\n return [];\n }\n DimensionScore.getScore = getScore;\n})(DimensionScore = exports.DimensionScore || (exports.DimensionScore = {}));\n//# sourceMappingURL=channel.js.map", + "\"use strict\";\nvar channel_1 = require('./channel');\nvar mark_1 = require('./mark');\nexports.FEATURE_INDEX = {};\nvar FEATURE_FACTORIES = [];\nfunction getFeatureScore(type, feature) {\n var score = exports.FEATURE_INDEX[type][feature];\n if (score !== undefined) {\n return {\n score: score,\n type: type,\n feature: feature\n };\n }\n return null;\n}\nexports.getFeatureScore = getFeatureScore;\nfunction addFeatureFactory(factory) {\n FEATURE_FACTORIES.push(factory);\n exports.FEATURE_INDEX[factory.type] = factory.init();\n}\nexports.addFeatureFactory = addFeatureFactory;\naddFeatureFactory({\n type: channel_1.TypeChannelScore.TYPE_CHANNEL,\n init: channel_1.TypeChannelScore.init,\n getScore: channel_1.TypeChannelScore.getScore\n});\naddFeatureFactory({\n type: channel_1.PreferredAxisScore.PREFERRED_AXIS,\n init: channel_1.PreferredAxisScore.init,\n getScore: channel_1.PreferredAxisScore.getScore\n});\naddFeatureFactory({\n type: channel_1.PreferredFacetScore.PREFERRED_FACET,\n init: channel_1.PreferredFacetScore.init,\n getScore: channel_1.PreferredFacetScore.getScore\n});\naddFeatureFactory({\n type: channel_1.MarkChannelScore.MARK_CHANNEL,\n init: channel_1.MarkChannelScore.init,\n getScore: channel_1.MarkChannelScore.getScore\n});\naddFeatureFactory({\n type: mark_1.MarkScore.MARK_SCORE,\n init: mark_1.MarkScore.init,\n getScore: mark_1.MarkScore.getScore\n});\n// TODO: x/y, row/column preference\n// TODO: stacking\n// TODO: Channel, Cardinality\n// TODO: Penalize over encoding\nfunction default_1(specM, schema, opt) {\n var features = FEATURE_FACTORIES.reduce(function (f, factory) {\n var scores = factory.getScore(specM, schema, opt);\n return f.concat(scores);\n }, []);\n return {\n score: features.reduce(function (s, f) {\n return s + f.score;\n }, 0),\n features: features\n };\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = default_1;\n//# sourceMappingURL=effectiveness.js.map", + "\"use strict\";\nvar channel_1 = require('vega-lite/src/channel');\nvar mark_1 = require('vega-lite/src/mark');\nvar util_1 = require('../../util');\nvar effectiveness_1 = require('./effectiveness');\nvar type_1 = require('./type');\nvar MarkScore;\n(function (MarkScore) {\n MarkScore.MARK_SCORE = 'markScore';\n function featurize(xType, yType, hasOcclusion, mark) {\n return xType + '_' + yType + '_' + hasOcclusion + '_' + mark;\n }\n MarkScore.featurize = featurize;\n function init() {\n var MEASURES = [type_1.Q, type_1.T];\n var DISCRETE = [type_1.BIN_Q, type_1.TIMEUNIT_O, type_1.O, type_1.N];\n var DISCRETE_OR_NONE = DISCRETE.concat([type_1.NONE]);\n var SCORE = {};\n // QxQ\n MEASURES.forEach(function (xType) {\n MEASURES.forEach(function (yType) {\n // has occlusion\n var occludedQQMark = {\n point: 0,\n text: -0.2,\n tick: -0.5,\n rect: -1,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n util_1.forEach(occludedQQMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n });\n // no occlusion\n // TODO: possible to use connected scatter plot\n var noOccludedQQMark = {\n point: 0,\n text: -0.2,\n tick: -0.5,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n util_1.forEach(noOccludedQQMark, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n });\n });\n });\n // DxQ, QxD\n MEASURES.forEach(function (xType) {\n // HAS OCCLUSION\n DISCRETE_OR_NONE.forEach(function (yType) {\n var occludedDimensionMeasureMark = {\n tick: 0,\n point: -0.2,\n text: -0.5,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n util_1.forEach(occludedDimensionMeasureMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n // also do the inverse\n var feature2 = featurize(yType, xType, true, mark);\n SCORE[feature2] = score;\n });\n });\n [type_1.TIMEUNIT_T].forEach(function (yType) {\n var occludedDimensionMeasureMark = {\n // For Time Dimension with time scale, tick is not good\n point: 0,\n text: -0.5,\n tick: -1,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n util_1.forEach(occludedDimensionMeasureMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n // also do the inverse\n var feature2 = featurize(yType, xType, true, mark);\n SCORE[feature2] = score;\n });\n });\n // NO OCCLUSION\n [type_1.NONE, type_1.N, type_1.O].forEach(function (yType) {\n var noOccludedQxN = {\n bar: 0,\n point: -0.2,\n tick: -0.25,\n text: -0.3,\n // Line / Area can mislead trend for N\n line: -2,\n area: -2,\n // Non-sense to use rule here\n rule: -2.5\n };\n util_1.forEach(noOccludedQxN, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n // also do the inverse\n var feature2 = featurize(yType, xType, false, mark);\n SCORE[feature2] = score;\n });\n });\n [type_1.BIN_Q].forEach(function (yType) {\n var noOccludedQxBinQ = {\n bar: 0,\n point: -0.2,\n tick: -0.25,\n text: -0.3,\n // Line / Area isn't the best fit for bin\n line: -0.5,\n area: -0.5,\n // Non-sense to use rule here\n rule: -2.5\n };\n util_1.forEach(noOccludedQxBinQ, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n // also do the inverse\n var feature2 = featurize(yType, xType, false, mark);\n SCORE[feature2] = score;\n });\n });\n [type_1.TIMEUNIT_T, type_1.TIMEUNIT_O].forEach(function (yType) {\n // For aggregate / surely no occlusion plot, Temporal with time or ordinal\n // are not that different.\n var noOccludedQxBinQ = {\n line: 0,\n area: -0.1,\n bar: -0.2,\n point: -0.3,\n tick: -0.35,\n text: -0.4,\n // Non-sense to use rule here\n rule: -2.5\n };\n util_1.forEach(noOccludedQxBinQ, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n // also do the inverse\n var feature2 = featurize(yType, xType, false, mark);\n SCORE[feature2] = score;\n });\n });\n });\n [type_1.TIMEUNIT_T].forEach(function (xType) {\n [type_1.TIMEUNIT_T].forEach(function (yType) {\n // has occlusion\n var ttMark = {\n point: 0,\n rect: -0.1,\n text: -0.5,\n tick: -1,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n // No difference between has occlusion and no occlusion\n // as most of the time, it will be the occluded case.\n util_1.forEach(ttMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n });\n util_1.forEach(ttMark, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n });\n });\n DISCRETE_OR_NONE.forEach(function (yType) {\n // has occlusion\n var tdMark = {\n tick: 0,\n point: -0.2,\n text: -0.5,\n rect: -1,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n // No difference between has occlusion and no occlusion\n // as most of the time, it will be the occluded case.\n util_1.forEach(tdMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n });\n util_1.forEach(tdMark, function (score, mark) {\n var feature = featurize(yType, xType, true, mark);\n SCORE[feature] = score;\n });\n util_1.forEach(tdMark, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n });\n util_1.forEach(tdMark, function (score, mark) {\n var feature = featurize(yType, xType, false, mark);\n SCORE[feature] = score;\n });\n });\n });\n // DxD\n DISCRETE_OR_NONE.forEach(function (xType) {\n DISCRETE_OR_NONE.forEach(function (yType) {\n // has occlusion\n var ddMark = {\n point: 0,\n rect: 0,\n text: -0.1,\n tick: -1,\n bar: -2,\n line: -2,\n area: -2,\n rule: -2.5\n };\n // No difference between has occlusion and no occlusion\n util_1.forEach(ddMark, function (score, mark) {\n var feature = featurize(xType, yType, true, mark);\n SCORE[feature] = score;\n });\n util_1.forEach(ddMark, function (score, mark) {\n var feature = featurize(xType, yType, false, mark);\n SCORE[feature] = score;\n });\n });\n });\n return SCORE;\n }\n MarkScore.init = init;\n function getScore(specM, schema, opt) {\n var mark = specM.getMark();\n if (mark === mark_1.Mark.CIRCLE || mark === mark_1.Mark.SQUARE) {\n mark = mark_1.Mark.POINT;\n }\n var xEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.X);\n var xType = xEncQ ? type_1.getExtendedType(xEncQ) : type_1.NONE;\n var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y);\n var yType = yEncQ ? type_1.getExtendedType(yEncQ) : type_1.NONE;\n var isOccluded = !specM.isAggregate(); // FIXME\n var feature = xType + '_' + yType + '_' + isOccluded + '_' + mark;\n var featureScore = effectiveness_1.getFeatureScore(MarkScore.MARK_SCORE, feature);\n return [featureScore];\n }\n MarkScore.getScore = getScore;\n})(MarkScore = exports.MarkScore || (exports.MarkScore = {}));\n//# sourceMappingURL=mark.js.map", + "\"use strict\";\nvar scale_1 = require('vega-lite/src/scale');\nvar type_1 = require('vega-lite/src/type');\nvar encoding_1 = require('../../query/encoding');\n/**\n * Finer grained data types that takes binning and timeUnit into account.\n */\n(function (ExtendedType) {\n ExtendedType[ExtendedType[\"Q\"] = type_1.Type.QUANTITATIVE] = \"Q\";\n ExtendedType[ExtendedType[\"BIN_Q\"] = 'bin_' + type_1.Type.QUANTITATIVE] = \"BIN_Q\";\n ExtendedType[ExtendedType[\"T\"] = type_1.Type.TEMPORAL] = \"T\";\n /**\n * Time Unit Temporal Field with time scale.\n */\n ExtendedType[ExtendedType[\"TIMEUNIT_T\"] = 'timeUnit_time'] = \"TIMEUNIT_T\";\n /**\n * Time Unit Temporal Field with ordinal scale.\n */\n ExtendedType[ExtendedType[\"TIMEUNIT_O\"] = 'timeUnit_' + type_1.Type.ORDINAL] = \"TIMEUNIT_O\";\n ExtendedType[ExtendedType[\"O\"] = type_1.Type.ORDINAL] = \"O\";\n ExtendedType[ExtendedType[\"N\"] = type_1.Type.NOMINAL] = \"N\";\n ExtendedType[ExtendedType[\"NONE\"] = '-'] = \"NONE\";\n})(exports.ExtendedType || (exports.ExtendedType = {}));\nvar ExtendedType = exports.ExtendedType;\nexports.Q = ExtendedType.Q;\nexports.BIN_Q = ExtendedType.BIN_Q;\nexports.T = ExtendedType.T;\nexports.TIMEUNIT_T = ExtendedType.TIMEUNIT_T;\nexports.TIMEUNIT_O = ExtendedType.TIMEUNIT_O;\nexports.O = ExtendedType.O;\nexports.N = ExtendedType.N;\nexports.NONE = ExtendedType.NONE;\nfunction getExtendedType(encQ) {\n if (encQ.bin) {\n return ExtendedType.BIN_Q;\n }\n else if (encQ.timeUnit) {\n return encoding_1.scaleType(encQ) === scale_1.ScaleType.ORDINAL ? ExtendedType.TIMEUNIT_O : ExtendedType.TIMEUNIT_T;\n }\n return encQ.type;\n}\nexports.getExtendedType = getExtendedType;\n//# sourceMappingURL=type.js.map", + "\"use strict\";\nexports.effectiveness = require('./effectiveness/effectiveness');\nexports.aggregation = require('./aggregation');\n/**\n * Registry for all encoding ranking functions\n */\nvar rankingRegistry = {};\n/**\n * Add an ordering function to the registry.\n */\nfunction register(name, keyFn) {\n rankingRegistry[name] = keyFn;\n}\nexports.register = register;\nfunction get(name) {\n return rankingRegistry[name];\n}\nexports.get = get;\nfunction rank(group, query, schema, level) {\n if (!query.nest || level === query.nest.length) {\n if (query.orderBy || query.chooseBy) {\n group.items.sort(comparator(query.orderBy || query.chooseBy, schema, query.config));\n if (query.chooseBy) {\n if (group.items.length > 0) {\n // for chooseBy -- only keep the top-item\n group.items.splice(1);\n }\n }\n }\n }\n else {\n // sort lower-level nodes first because our ranking takes top-item in the subgroup\n group.items.forEach(function (subgroup) {\n rank(subgroup, query, schema, level + 1);\n });\n if (query.nest[level].orderGroupBy) {\n group.items.sort(groupComparator(query.nest[level].orderGroupBy, schema, query.config));\n }\n }\n return group;\n}\nexports.rank = rank;\nfunction getScore(model, rankingName, schema, opt) {\n if (model.getRankingScore(rankingName) !== undefined) {\n return model.getRankingScore(rankingName);\n }\n var fn = get(rankingName);\n var score = fn(model, schema, opt);\n model.setRankingScore(rankingName, score);\n return score;\n}\nfunction comparator(name, schema, opt) {\n return function (m1, m2) {\n return getScore(m2, name, schema, opt).score - getScore(m1, name, schema, opt).score;\n };\n}\nexports.comparator = comparator;\nfunction groupComparator(name, schema, opt) {\n return function (g1, g2) {\n var m1 = g1.getTopSpecQueryModel();\n var m2 = g2.getTopSpecQueryModel();\n return getScore(m2, name, schema, opt).score - getScore(m1, name, schema, opt).score;\n };\n}\nexports.groupComparator = groupComparator;\nexports.EFFECTIVENESS = 'effectiveness';\nregister(exports.EFFECTIVENESS, exports.effectiveness.default);\nregister(exports.aggregation.name, exports.aggregation.score);\n//# sourceMappingURL=ranking.js.map", + "\"use strict\";\nvar type_1 = require('vega-lite/src/type');\nvar bin_1 = require('vega-lite/src/bin');\nvar timeunit_1 = require('vega-lite/src/timeunit');\nvar stats_1 = require('datalib/src/stats');\nvar type_2 = require('datalib/src/import/type');\nvar dlBin = require('datalib/src/bins/bins');\nvar config_1 = require('./config');\nvar util_1 = require('./util');\nvar Schema = (function () {\n function Schema(fieldSchemas) {\n this.fieldSchemas = fieldSchemas;\n this.fieldSchemaIndex = fieldSchemas.reduce(function (m, fieldSchema) {\n m[fieldSchema.field] = fieldSchema;\n return m;\n }, {});\n }\n /**\n * Build a Schema object.\n *\n * @param data - a set of raw data\n * @return a Schema object\n */\n Schema.build = function (data, opt) {\n if (opt === void 0) { opt = {}; }\n opt = util_1.extend({}, config_1.DEFAULT_QUERY_CONFIG, opt);\n // create profiles for each variable\n var summaries = stats_1.summary(data);\n var types = type_2.inferAll(data); // inferAll does stronger type inference than summary\n var fieldSchemas = summaries.map(function (summary) {\n var field = summary.field;\n var primitiveType = types[field];\n var distinct = summary.distinct;\n var type;\n if (primitiveType === PrimitiveType.NUMBER) {\n type = type_1.Type.QUANTITATIVE;\n }\n else if (primitiveType === PrimitiveType.INTEGER) {\n // use ordinal or nominal when cardinality of integer type is relatively low and the distinct values are less than an amount specified in options\n if ((distinct < opt.numberOrdinalLimit) && (distinct / summary.count < opt.numberOrdinalProportion)) {\n // use nominal if the integers are 1,2,3,...,N or 0,1,2,3,...,N-1 where N = cardinality\n type = (summary.max - summary.min === distinct - 1 && util_1.contains([0, 1], summary.min)) ? type_1.Type.NOMINAL : type_1.Type.ORDINAL;\n }\n else {\n type = type_1.Type.QUANTITATIVE;\n }\n }\n else if (primitiveType === PrimitiveType.DATE) {\n type = type_1.Type.TEMPORAL;\n // need to get correct min/max of date data because datalib's summary method does not\n // calculate this correctly for date types.\n summary.min = new Date(data[0][field]);\n summary.max = new Date(data[0][field]);\n for (var i = 0; i < data.length; i++) {\n var time = new Date(data[i][field]).getTime();\n if (time < summary.min.getTime()) {\n summary.min = new Date(time);\n }\n if (time > summary.max.getTime()) {\n summary.max = new Date(time);\n }\n }\n }\n else {\n type = type_1.Type.NOMINAL;\n }\n return {\n field: field,\n type: type,\n primitiveType: primitiveType,\n stats: summary,\n timeStats: {},\n binStats: {}\n };\n });\n // order the fieldSchemas (sort them)\n var order = {\n 'nominal': 0,\n 'ordinal': 1,\n 'temporal': 2,\n 'quantitative': 3\n };\n fieldSchemas.sort(function (a, b) {\n // first order by type: nominal < temporal < quantitative < ordinal\n if (order[a.type] < order[b.type]) {\n return -1;\n }\n else if (order[a.type] > order[b.type]) {\n return 1;\n }\n else {\n // then order by field (alphabetically)\n return a.field.localeCompare(b.field);\n }\n });\n // calculate preset bins for quantitative and temporal data\n for (var _i = 0, fieldSchemas_1 = fieldSchemas; _i < fieldSchemas_1.length; _i++) {\n var fieldSchema = fieldSchemas_1[_i];\n if (fieldSchema.type === type_1.Type.QUANTITATIVE) {\n for (var _a = 0, _b = opt.maxBinsList; _a < _b.length; _a++) {\n var maxbins = _b[_a];\n fieldSchema.binStats[maxbins] = binSummary(maxbins, fieldSchema.stats);\n }\n }\n else if (fieldSchema.type === type_1.Type.TEMPORAL) {\n for (var _c = 0, _d = opt.timeUnits; _c < _d.length; _c++) {\n var unit = _d[_c];\n if (unit !== undefined) {\n fieldSchema.timeStats[unit] = timeSummary(unit, fieldSchema.stats);\n }\n }\n }\n }\n return new Schema(fieldSchemas);\n };\n Schema.prototype.fields = function () {\n return this.fieldSchemas.map(function (fieldSchema) { return fieldSchema.field; });\n };\n /**\n * @return primitive type of the field if exist, otherwise return null\n */\n Schema.prototype.primitiveType = function (field) {\n return this.fieldSchemaIndex[field] ? this.fieldSchemaIndex[field].primitiveType : null;\n };\n /**\n * @return type of measturement of the field if exist, otherwise return null\n */\n Schema.prototype.type = function (field) {\n return this.fieldSchemaIndex[field] ? this.fieldSchemaIndex[field].type : null;\n };\n /** @return cardinality of the field associated with encQ, null if it doesn't exist.\n * @param augmentTimeUnitDomain - TimeUnit field domains will not be augmented if explicitly set to false.\n */\n Schema.prototype.cardinality = function (encQ, augmentTimeUnitDomain, excludeInvalid) {\n if (augmentTimeUnitDomain === void 0) { augmentTimeUnitDomain = true; }\n if (excludeInvalid === void 0) { excludeInvalid = false; }\n var fieldSchema = this.fieldSchemaIndex[encQ.field];\n if (encQ.aggregate || encQ.autoCount) {\n return 1;\n }\n else if (encQ.bin) {\n // encQ.bin will either be a boolean or a BinQuery\n var bin;\n if (typeof encQ.bin === 'boolean') {\n // autoMaxBins defaults to 10 if channel is EnumSpec\n bin = {\n maxbins: bin_1.autoMaxBins(encQ.channel)\n };\n }\n else {\n bin = encQ.bin;\n }\n var maxbins = bin.maxbins;\n if (!fieldSchema.binStats[maxbins]) {\n // need to calculate\n fieldSchema.binStats[maxbins] = binSummary(maxbins, fieldSchema.stats);\n }\n // don't need to worry about excludeInvalid here because invalid values don't affect linearly binned field's cardinality\n return fieldSchema.binStats[maxbins].distinct;\n }\n else if (encQ.timeUnit) {\n if (augmentTimeUnitDomain) {\n switch (encQ.timeUnit) {\n // TODO: this should not always be the case once Vega-Lite supports turning off domain augmenting (VL issue #1385)\n case timeunit_1.TimeUnit.SECONDS: return 60;\n case timeunit_1.TimeUnit.MINUTES: return 60;\n case timeunit_1.TimeUnit.HOURS: return 24;\n case timeunit_1.TimeUnit.DAY: return 7;\n case timeunit_1.TimeUnit.DATE: return 31;\n case timeunit_1.TimeUnit.MONTH: return 12;\n case timeunit_1.TimeUnit.QUARTER: return 4;\n case timeunit_1.TimeUnit.MILLISECONDS: return 1000;\n }\n }\n var unit = encQ.timeUnit;\n var timeStats = fieldSchema.timeStats;\n // if the cardinality for the timeUnit is not cached, calculate it\n if (!timeStats[unit]) {\n timeStats[unit] = timeSummary(encQ.timeUnit, fieldSchema.stats);\n }\n if (excludeInvalid) {\n return timeStats[unit].distinct - invalidCount(timeStats[unit].unique, ['Invalid Date', null]);\n }\n else {\n return timeStats[unit].distinct;\n }\n }\n else {\n if (fieldSchema) {\n if (excludeInvalid) {\n return fieldSchema.stats.distinct - invalidCount(fieldSchema.stats.unique, [NaN, null]);\n }\n else {\n return fieldSchema.stats.distinct;\n }\n }\n else {\n return null;\n }\n }\n };\n /**\n * Given an EncodingQuery with a timeUnit, returns true if the date field\n * has multiple distinct values for all parts of the timeUnit. Returns undefined\n * if the timeUnit is undefined.\n * i.e.\n * ('yearmonth', [Jan 1 2000, Feb 2 2000] returns false)\n * ('yearmonth', [Jan 1 2000, Feb 2 2001] returns true)\n */\n Schema.prototype.timeUnitHasVariation = function (encQ) {\n if (!encQ.timeUnit) {\n return;\n }\n // if there is no variation in `date`, there should not be variation in `day`\n if (encQ.timeUnit === timeunit_1.TimeUnit.DAY) {\n var dateEncQ = util_1.extend({}, encQ, { timeUnit: timeunit_1.TimeUnit.DATE });\n if (this.cardinality(dateEncQ, false, true) <= 1) {\n return false;\n }\n }\n var fullTimeUnit = encQ.timeUnit;\n for (var _i = 0, SINGLE_TIMEUNITS_1 = timeunit_1.SINGLE_TIMEUNITS; _i < SINGLE_TIMEUNITS_1.length; _i++) {\n var singleUnit = SINGLE_TIMEUNITS_1[_i];\n if (timeunit_1.containsTimeUnit(fullTimeUnit, singleUnit)) {\n encQ.timeUnit = singleUnit;\n if (this.cardinality(encQ, false, true) <= 1) {\n return false;\n }\n }\n }\n return true;\n };\n Schema.prototype.domain = function (encQ) {\n // TODO: differentiate for field with bin / timeUnit\n var fieldSchema = this.fieldSchemaIndex[encQ.field];\n var domain = util_1.keys(fieldSchema.stats.unique);\n if (fieldSchema.type === type_1.Type.QUANTITATIVE || fieldSchema.primitiveType === PrimitiveType.DATE) {\n // return [min, max] for quantitative and date data\n domain = [fieldSchema.stats.min, fieldSchema.stats.max];\n }\n else if (fieldSchema.primitiveType === PrimitiveType.INTEGER ||\n fieldSchema.primitiveType === PrimitiveType.NUMBER) {\n // coerce non-quantitative numerical data into number type\n domain = domain.map(function (x) { return +x; });\n }\n return domain.sort();\n };\n /**\n * @return a Summary corresponding to the field of the given EncodingQuery\n */\n Schema.prototype.stats = function (encQ) {\n // TODO: differentiate for field with bin / timeUnit vs without\n var fieldSchema = this.fieldSchemaIndex[encQ.field];\n return fieldSchema ? fieldSchema.stats : null;\n };\n return Schema;\n}());\nexports.Schema = Schema;\n/**\n * @return a summary of the binning scheme determined from the given max number of bins\n */\nfunction binSummary(maxbins, summary) {\n var bin = dlBin({\n min: summary.min,\n max: summary.max,\n maxbins: maxbins\n });\n // start with summary, pre-binning\n var result = util_1.extend({}, summary);\n result.unique = binUnique(bin, summary.unique);\n result.distinct = (bin.stop - bin.start) / bin.step;\n result.min = bin.start;\n result.max = bin.stop;\n return result;\n}\n/** @return a modified version of the passed summary with unique and distinct set according to the timeunit.\n * Maps 'null' (string) keys to the null value and invalid dates to 'Invalid Date' in the unique dictionary.\n */\nfunction timeSummary(timeunit, summary) {\n var result = util_1.extend({}, summary);\n var unique = {};\n util_1.keys(summary.unique).forEach(function (dateString) {\n // don't convert null value because the Date constructor will actually convert it to a date\n var date = (dateString === 'null') ? null : new Date(dateString);\n // at this point, `date` is either the null value, a valid Date object, or \"Invalid Date\" which is a Date\n var key;\n if (date === null) {\n key = null;\n }\n else if (isNaN(date.getTime())) {\n key = 'Invalid Date';\n }\n else {\n key = ((timeunit === timeunit_1.TimeUnit.DAY) ? date.getDay() : timeunit_1.convert(timeunit, date)).toString();\n }\n unique[key] = (unique[key] || 0) + summary.unique[dateString];\n });\n result.unique = unique;\n result.distinct = util_1.keys(unique).length;\n return result;\n}\n/**\n * @return a new unique object based off of the old unique count and a binning scheme\n */\nfunction binUnique(bin, oldUnique) {\n var newUnique = {};\n for (var value in oldUnique) {\n var bucket = void 0;\n if (value === null) {\n bucket = null;\n }\n else if (isNaN(Number(value))) {\n bucket = NaN;\n }\n else {\n bucket = bin.value(Number(value));\n }\n newUnique[bucket] = (newUnique[bucket] || 0) + oldUnique[value];\n }\n return newUnique;\n}\n/** @return the number of items in list that occur as keys of unique */\nfunction invalidCount(unique, list) {\n return list.reduce(function (prev, cur) {\n return unique[cur] ? prev + 1 : prev;\n }, 0);\n}\n(function (PrimitiveType) {\n PrimitiveType[PrimitiveType[\"STRING\"] = 'string'] = \"STRING\";\n PrimitiveType[PrimitiveType[\"NUMBER\"] = 'number'] = \"NUMBER\";\n PrimitiveType[PrimitiveType[\"INTEGER\"] = 'integer'] = \"INTEGER\";\n PrimitiveType[PrimitiveType[\"BOOLEAN\"] = 'boolean'] = \"BOOLEAN\";\n PrimitiveType[PrimitiveType[\"DATE\"] = 'date'] = \"DATE\";\n})(exports.PrimitiveType || (exports.PrimitiveType = {}));\nvar PrimitiveType = exports.PrimitiveType;\n//# sourceMappingURL=schema.js.map", + "\"use strict\";\nvar axis_1 = require('vega-lite/src/axis');\nvar channel_1 = require('vega-lite/src/channel');\nvar scale_1 = require('vega-lite/src/scale');\nvar type_1 = require('vega-lite/src/type');\nvar encoding_1 = require('./query/encoding');\nvar util_1 = require('./util');\nfunction stylize(answerSet, schema, opt) {\n var encQIndex = {};\n answerSet = answerSet.map(function (specM) {\n if (opt.smallBandSizeForHighCardinalityOrFacet) {\n specM = smallBandSizeForHighCardinalityOrFacet(specM, schema, encQIndex, opt);\n }\n if (opt.nominalColorScaleForHighCardinality) {\n specM = nominalColorScaleForHighCardinality(specM, schema, encQIndex, opt);\n }\n if (opt.xAxisOnTopForHighYCardinalityWithoutColumn) {\n specM = xAxisOnTopForHighYCardinalityWithoutColumn(specM, schema, encQIndex, opt);\n }\n return specM;\n });\n return answerSet;\n}\nexports.stylize = stylize;\nfunction smallBandSizeForHighCardinalityOrFacet(specM, schema, encQIndex, opt) {\n [channel_1.Channel.ROW, channel_1.Channel.Y, channel_1.Channel.COLUMN, channel_1.Channel.X].forEach(function (channel) {\n encQIndex[channel] = specM.getEncodingQueryByChannel(channel);\n });\n var yEncQ = encQIndex[channel_1.Channel.Y];\n if (yEncQ !== undefined) {\n if (encQIndex[channel_1.Channel.ROW] ||\n schema.cardinality(yEncQ) > opt.smallBandSizeForHighCardinalityOrFacet.maxCardinality) {\n // We check for undefined rather than\n // yEncQ.scale = yEncQ.scale || {} to cover the case where\n // yEncQ.scale has been set to false/null.\n // This prevents us from incorrectly overriding scale and\n // assigning a bandSize when scale is set to false.\n if (yEncQ.scale === undefined) {\n yEncQ.scale = {};\n }\n // We do not want to assign a bandSize if scale is set to false\n // and we only apply this if the scale is (or can be) an ordinal scale.\n if (yEncQ.scale && util_1.contains([scale_1.ScaleType.ORDINAL, undefined], encoding_1.scaleType(yEncQ))) {\n if (!yEncQ.scale.bandSize) {\n yEncQ.scale.bandSize = 12;\n }\n }\n }\n }\n var xEncQ = encQIndex[channel_1.Channel.X];\n if (xEncQ !== undefined) {\n if (encQIndex[channel_1.Channel.COLUMN] ||\n schema.cardinality(xEncQ) > opt.smallBandSizeForHighCardinalityOrFacet.maxCardinality) {\n // Just like y, we don't want to do this if scale is null/false\n if (xEncQ.scale === undefined) {\n xEncQ.scale = {};\n }\n // We do not want to assign a bandSize if scale is set to false\n // and we only apply this if the scale is (or can be) an ordinal scale.\n if (xEncQ.scale && util_1.contains([scale_1.ScaleType.ORDINAL, undefined], encoding_1.scaleType(xEncQ))) {\n if (!xEncQ.scale.bandSize) {\n xEncQ.scale.bandSize = 12;\n }\n }\n }\n }\n return specM;\n}\nexports.smallBandSizeForHighCardinalityOrFacet = smallBandSizeForHighCardinalityOrFacet;\nfunction nominalColorScaleForHighCardinality(specM, schema, encQIndex, opt) {\n encQIndex[channel_1.Channel.COLOR] = specM.getEncodingQueryByChannel(channel_1.Channel.COLOR);\n var colorEncQ = encQIndex[channel_1.Channel.COLOR];\n if ((colorEncQ !== undefined) && (colorEncQ.type === type_1.Type.NOMINAL) &&\n (schema.cardinality(colorEncQ) > opt.nominalColorScaleForHighCardinality.maxCardinality)) {\n if (colorEncQ.scale === undefined) {\n colorEncQ.scale = {};\n }\n if (colorEncQ.scale) {\n if (!colorEncQ.scale.range) {\n colorEncQ.scale.range = opt.nominalColorScaleForHighCardinality.palette;\n }\n }\n }\n return specM;\n}\nexports.nominalColorScaleForHighCardinality = nominalColorScaleForHighCardinality;\nfunction xAxisOnTopForHighYCardinalityWithoutColumn(specM, schema, encQIndex, opt) {\n [channel_1.Channel.COLUMN, channel_1.Channel.X, channel_1.Channel.Y].forEach(function (channel) {\n encQIndex[channel] = specM.getEncodingQueryByChannel(channel);\n });\n if (encQIndex[channel_1.Channel.COLUMN] === undefined) {\n var xEncQ = encQIndex[channel_1.Channel.X];\n var yEncQ = encQIndex[channel_1.Channel.Y];\n if (yEncQ !== undefined && yEncQ.field && encoding_1.scaleType(yEncQ) === scale_1.ScaleType.ORDINAL) {\n if (xEncQ !== undefined) {\n if (schema.cardinality(yEncQ) > opt.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality) {\n if (xEncQ.axis === undefined) {\n xEncQ.axis = {};\n }\n if (xEncQ.axis && !xEncQ.axis.orient) {\n xEncQ.axis.orient = axis_1.AxisOrient.TOP;\n }\n }\n }\n }\n }\n return specM;\n}\nexports.xAxisOnTopForHighYCardinalityWithoutColumn = xAxisOnTopForHighYCardinalityWithoutColumn;\n//# sourceMappingURL=stylize.js.map", + "\"use strict\";\nvar util_1 = require('datalib/src/util');\nvar util_2 = require('datalib/src/util');\nexports.keys = util_2.keys;\nexports.duplicate = util_2.duplicate;\nexports.extend = util_2.extend;\nexports.isObject = util_2.isObject;\nexports.isArray = util_2.isArray;\nfunction contains(array, item) {\n return array.indexOf(item) !== -1;\n}\nexports.contains = contains;\n;\nfunction every(arr, f) {\n var i = 0, k;\n for (k in arr) {\n if (!f(arr[k], k, i++)) {\n return false;\n }\n }\n return true;\n}\nexports.every = every;\n;\nfunction forEach(obj, f, thisArg) {\n if (obj.forEach) {\n obj.forEach.call(thisArg, f);\n }\n else {\n for (var k in obj) {\n f.call(thisArg, obj[k], k, obj);\n }\n }\n}\nexports.forEach = forEach;\n;\nfunction some(arr, f) {\n var i = 0, k;\n for (k in arr) {\n if (f(arr[k], k, i++)) {\n return true;\n }\n }\n return false;\n}\nexports.some = some;\n;\nfunction nestedMap(array, f) {\n return array.map(function (a) {\n if (util_1.isArray(a)) {\n return nestedMap(a, f);\n }\n return f(a);\n });\n}\nexports.nestedMap = nestedMap;\n/** Returns the array without the elements in item */\nfunction without(array, excludedItems) {\n return array.filter(function (item) {\n return !contains(excludedItems, item);\n });\n}\nexports.without = without;\n//# sourceMappingURL=util.js.map", + "var u = module.exports;\n\n// utility functions\n\nvar FNAME = '__name__';\n\nu.namedfunc = function(name, f) { return (f[FNAME] = name, f); };\n\nu.name = function(f) { return f==null ? null : f[FNAME]; };\n\nu.identity = function(x) { return x; };\n\nu.true = u.namedfunc('true', function() { return true; });\n\nu.false = u.namedfunc('false', function() { return false; });\n\nu.duplicate = function(obj) {\n return JSON.parse(JSON.stringify(obj));\n};\n\nu.equal = function(a, b) {\n return JSON.stringify(a) === JSON.stringify(b);\n};\n\nu.extend = function(obj) {\n for (var x, name, i=1, len=arguments.length; i 1 ?\n function(x, v) {\n for (var i=0; i b || b == null) && a != null ? 1 :\n ((b = b instanceof Date ? +b : b),\n (a = a instanceof Date ? +a : a)) !== a && b === b ? -1 :\n b !== b && a === a ? 1 : 0;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n// permutes an array using a Knuth shuffle\nu.permute = function(a) {\n var m = a.length,\n swap,\n i;\n\n while (m) {\n i = Math.floor(Math.random() * m--);\n swap = a[m];\n a[m] = a[i];\n a[i] = swap;\n }\n};\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i= '0' && ch <= '9') {\n string += ch;\n next();\n }\n if (ch === '.') {\n string += '.';\n while (next() && ch >= '0' && ch <= '9') {\n string += ch;\n }\n }\n if (ch === 'e' || ch === 'E') {\n string += ch;\n next();\n if (ch === '-' || ch === '+') {\n string += ch;\n next();\n }\n while (ch >= '0' && ch <= '9') {\n string += ch;\n next();\n }\n }\n number = +string;\n if (!isFinite(number)) {\n error(\"Bad number\");\n } else {\n return number;\n }\n },\n \n string = function () {\n // Parse a string value.\n var hex,\n i,\n string = '',\n uffff;\n \n // When parsing for string values, we must look for \" and \\ characters.\n if (ch === '\"') {\n while (next()) {\n if (ch === '\"') {\n next();\n return string;\n } else if (ch === '\\\\') {\n next();\n if (ch === 'u') {\n uffff = 0;\n for (i = 0; i < 4; i += 1) {\n hex = parseInt(next(), 16);\n if (!isFinite(hex)) {\n break;\n }\n uffff = uffff * 16 + hex;\n }\n string += String.fromCharCode(uffff);\n } else if (typeof escapee[ch] === 'string') {\n string += escapee[ch];\n } else {\n break;\n }\n } else {\n string += ch;\n }\n }\n }\n error(\"Bad string\");\n },\n\n white = function () {\n\n// Skip whitespace.\n\n while (ch && ch <= ' ') {\n next();\n }\n },\n\n word = function () {\n\n// true, false, or null.\n\n switch (ch) {\n case 't':\n next('t');\n next('r');\n next('u');\n next('e');\n return true;\n case 'f':\n next('f');\n next('a');\n next('l');\n next('s');\n next('e');\n return false;\n case 'n':\n next('n');\n next('u');\n next('l');\n next('l');\n return null;\n }\n error(\"Unexpected '\" + ch + \"'\");\n },\n\n value, // Place holder for the value function.\n\n array = function () {\n\n// Parse an array value.\n\n var array = [];\n\n if (ch === '[') {\n next('[');\n white();\n if (ch === ']') {\n next(']');\n return array; // empty array\n }\n while (ch) {\n array.push(value());\n white();\n if (ch === ']') {\n next(']');\n return array;\n }\n next(',');\n white();\n }\n }\n error(\"Bad array\");\n },\n\n object = function () {\n\n// Parse an object value.\n\n var key,\n object = {};\n\n if (ch === '{') {\n next('{');\n white();\n if (ch === '}') {\n next('}');\n return object; // empty object\n }\n while (ch) {\n key = string();\n white();\n next(':');\n if (Object.hasOwnProperty.call(object, key)) {\n error('Duplicate key \"' + key + '\"');\n }\n object[key] = value();\n white();\n if (ch === '}') {\n next('}');\n return object;\n }\n next(',');\n white();\n }\n }\n error(\"Bad object\");\n };\n\nvalue = function () {\n\n// Parse a JSON value. It could be an object, an array, a string, a number,\n// or a word.\n\n white();\n switch (ch) {\n case '{':\n return object();\n case '[':\n return array();\n case '\"':\n return string();\n case '-':\n return number();\n default:\n return ch >= '0' && ch <= '9' ? number() : word();\n }\n};\n\n// Return the json_parse function. It will have access to all of the above\n// functions and variables.\n\nmodule.exports = function (source, reviver) {\n var result;\n \n text = source;\n at = 0;\n ch = ' ';\n result = value();\n white();\n if (ch) {\n error(\"Syntax error\");\n }\n\n // If there is a reviver function, we recursively walk the new structure,\n // passing each name/value pair to the reviver function for possible\n // transformation, starting with a temporary root object that holds the result\n // in an empty key. If there is not a reviver function, we simply return the\n // result.\n\n return typeof reviver === 'function' ? (function walk(holder, key) {\n var k, v, value = holder[key];\n if (value && typeof value === 'object') {\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = walk(value, k);\n if (v !== undefined) {\n value[k] = v;\n } else {\n delete value[k];\n }\n }\n }\n }\n return reviver.call(holder, key, value);\n }({'': result}, '')) : result;\n};\n", + "var cx = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n escapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n gap,\n indent,\n meta = { // table of character substitutions\n '\\b': '\\\\b',\n '\\t': '\\\\t',\n '\\n': '\\\\n',\n '\\f': '\\\\f',\n '\\r': '\\\\r',\n '\"' : '\\\\\"',\n '\\\\': '\\\\\\\\'\n },\n rep;\n\nfunction quote(string) {\n // If the string contains no control characters, no quote characters, and no\n // backslash characters, then we can safely slap some quotes around it.\n // Otherwise we must also replace the offending characters with safe escape\n // sequences.\n \n escapable.lastIndex = 0;\n return escapable.test(string) ? '\"' + string.replace(escapable, function (a) {\n var c = meta[a];\n return typeof c === 'string' ? c :\n '\\\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n }) + '\"' : '\"' + string + '\"';\n}\n\nfunction str(key, holder) {\n // Produce a string from holder[key].\n var i, // The loop counter.\n k, // The member key.\n v, // The member value.\n length,\n mind = gap,\n partial,\n value = holder[key];\n \n // If the value has a toJSON method, call it to obtain a replacement value.\n if (value && typeof value === 'object' &&\n typeof value.toJSON === 'function') {\n value = value.toJSON(key);\n }\n \n // If we were called with a replacer function, then call the replacer to\n // obtain a replacement value.\n if (typeof rep === 'function') {\n value = rep.call(holder, key, value);\n }\n \n // What happens next depends on the value's type.\n switch (typeof value) {\n case 'string':\n return quote(value);\n \n case 'number':\n // JSON numbers must be finite. Encode non-finite numbers as null.\n return isFinite(value) ? String(value) : 'null';\n \n case 'boolean':\n case 'null':\n // If the value is a boolean or null, convert it to a string. Note:\n // typeof null does not produce 'null'. The case is included here in\n // the remote chance that this gets fixed someday.\n return String(value);\n \n case 'object':\n if (!value) return 'null';\n gap += indent;\n partial = [];\n \n // Array.isArray\n if (Object.prototype.toString.apply(value) === '[object Array]') {\n length = value.length;\n for (i = 0; i < length; i += 1) {\n partial[i] = str(i, value) || 'null';\n }\n \n // Join all of the elements together, separated with commas, and\n // wrap them in brackets.\n v = partial.length === 0 ? '[]' : gap ?\n '[\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind + ']' :\n '[' + partial.join(',') + ']';\n gap = mind;\n return v;\n }\n \n // If the replacer is an array, use it to select the members to be\n // stringified.\n if (rep && typeof rep === 'object') {\n length = rep.length;\n for (i = 0; i < length; i += 1) {\n k = rep[i];\n if (typeof k === 'string') {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (gap ? ': ' : ':') + v);\n }\n }\n }\n }\n else {\n // Otherwise, iterate through all of the keys in the object.\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (gap ? ': ' : ':') + v);\n }\n }\n }\n }\n \n // Join all of the member texts together, separated with commas,\n // and wrap them in braces.\n\n v = partial.length === 0 ? '{}' : gap ?\n '{\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind + '}' :\n '{' + partial.join(',') + '}';\n gap = mind;\n return v;\n }\n}\n\nmodule.exports = function (value, replacer, space) {\n var i;\n gap = '';\n indent = '';\n \n // If the space parameter is a number, make an indent string containing that\n // many spaces.\n if (typeof space === 'number') {\n for (i = 0; i < space; i += 1) {\n indent += ' ';\n }\n }\n // If the space parameter is a string, it will be used as the indent string.\n else if (typeof space === 'string') {\n indent = space;\n }\n\n // If there is a replacer, it must be a function or an array.\n // Otherwise, throw an error.\n rep = replacer;\n if (replacer && typeof replacer !== 'function'\n && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {\n throw new Error('JSON.stringify');\n }\n \n // Make a fake root object containing our value under the key of ''.\n // Return the result of stringifying the value.\n return str('', {'': value});\n};\n", + "\"use strict\";\n(function (AggregateOp) {\n AggregateOp[AggregateOp[\"VALUES\"] = 'values'] = \"VALUES\";\n AggregateOp[AggregateOp[\"COUNT\"] = 'count'] = \"COUNT\";\n AggregateOp[AggregateOp[\"VALID\"] = 'valid'] = \"VALID\";\n AggregateOp[AggregateOp[\"MISSING\"] = 'missing'] = \"MISSING\";\n AggregateOp[AggregateOp[\"DISTINCT\"] = 'distinct'] = \"DISTINCT\";\n AggregateOp[AggregateOp[\"SUM\"] = 'sum'] = \"SUM\";\n AggregateOp[AggregateOp[\"MEAN\"] = 'mean'] = \"MEAN\";\n AggregateOp[AggregateOp[\"AVERAGE\"] = 'average'] = \"AVERAGE\";\n AggregateOp[AggregateOp[\"VARIANCE\"] = 'variance'] = \"VARIANCE\";\n AggregateOp[AggregateOp[\"VARIANCEP\"] = 'variancep'] = \"VARIANCEP\";\n AggregateOp[AggregateOp[\"STDEV\"] = 'stdev'] = \"STDEV\";\n AggregateOp[AggregateOp[\"STDEVP\"] = 'stdevp'] = \"STDEVP\";\n AggregateOp[AggregateOp[\"MEDIAN\"] = 'median'] = \"MEDIAN\";\n AggregateOp[AggregateOp[\"Q1\"] = 'q1'] = \"Q1\";\n AggregateOp[AggregateOp[\"Q3\"] = 'q3'] = \"Q3\";\n AggregateOp[AggregateOp[\"MODESKEW\"] = 'modeskew'] = \"MODESKEW\";\n AggregateOp[AggregateOp[\"MIN\"] = 'min'] = \"MIN\";\n AggregateOp[AggregateOp[\"MAX\"] = 'max'] = \"MAX\";\n AggregateOp[AggregateOp[\"ARGMIN\"] = 'argmin'] = \"ARGMIN\";\n AggregateOp[AggregateOp[\"ARGMAX\"] = 'argmax'] = \"ARGMAX\";\n})(exports.AggregateOp || (exports.AggregateOp = {}));\nvar AggregateOp = exports.AggregateOp;\nexports.AGGREGATE_OPS = [\n AggregateOp.VALUES,\n AggregateOp.COUNT,\n AggregateOp.VALID,\n AggregateOp.MISSING,\n AggregateOp.DISTINCT,\n AggregateOp.SUM,\n AggregateOp.MEAN,\n AggregateOp.AVERAGE,\n AggregateOp.VARIANCE,\n AggregateOp.VARIANCEP,\n AggregateOp.STDEV,\n AggregateOp.STDEVP,\n AggregateOp.MEDIAN,\n AggregateOp.Q1,\n AggregateOp.Q3,\n AggregateOp.MODESKEW,\n AggregateOp.MIN,\n AggregateOp.MAX,\n AggregateOp.ARGMIN,\n AggregateOp.ARGMAX,\n];\n/** Additive-based aggregation operations. These can be applied to stack. */\nexports.SUM_OPS = [\n AggregateOp.COUNT,\n AggregateOp.SUM,\n AggregateOp.DISTINCT\n];\nexports.SHARED_DOMAIN_OPS = [\n AggregateOp.MEAN,\n AggregateOp.AVERAGE,\n AggregateOp.STDEV,\n AggregateOp.STDEVP,\n AggregateOp.MEDIAN,\n AggregateOp.Q1,\n AggregateOp.Q3,\n AggregateOp.MIN,\n AggregateOp.MAX,\n];\n//# sourceMappingURL=aggregate.js.map", + "\"use strict\";\n(function (AxisOrient) {\n AxisOrient[AxisOrient[\"TOP\"] = 'top'] = \"TOP\";\n AxisOrient[AxisOrient[\"RIGHT\"] = 'right'] = \"RIGHT\";\n AxisOrient[AxisOrient[\"LEFT\"] = 'left'] = \"LEFT\";\n AxisOrient[AxisOrient[\"BOTTOM\"] = 'bottom'] = \"BOTTOM\";\n})(exports.AxisOrient || (exports.AxisOrient = {}));\nvar AxisOrient = exports.AxisOrient;\n// TODO: add comment for properties that we rely on Vega's default to produce\n// more concise Vega output.\nexports.defaultAxisConfig = {\n offset: undefined,\n grid: undefined,\n labels: true,\n labelMaxLength: 25,\n tickSize: undefined,\n characterWidth: 6\n};\nexports.defaultFacetAxisConfig = {\n axisWidth: 0,\n labels: true,\n grid: false,\n tickSize: 0\n};\n//# sourceMappingURL=axis.js.map", + "\"use strict\";\nvar channel_1 = require('./channel');\nfunction autoMaxBins(channel) {\n switch (channel) {\n case channel_1.ROW:\n case channel_1.COLUMN:\n case channel_1.SIZE:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule\n case channel_1.SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n default:\n return 10;\n }\n}\nexports.autoMaxBins = autoMaxBins;\n//# sourceMappingURL=bin.js.map", + "/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\n\"use strict\";\nvar util_1 = require('./util');\n(function (Channel) {\n Channel[Channel[\"X\"] = 'x'] = \"X\";\n Channel[Channel[\"Y\"] = 'y'] = \"Y\";\n Channel[Channel[\"X2\"] = 'x2'] = \"X2\";\n Channel[Channel[\"Y2\"] = 'y2'] = \"Y2\";\n Channel[Channel[\"ROW\"] = 'row'] = \"ROW\";\n Channel[Channel[\"COLUMN\"] = 'column'] = \"COLUMN\";\n Channel[Channel[\"SHAPE\"] = 'shape'] = \"SHAPE\";\n Channel[Channel[\"SIZE\"] = 'size'] = \"SIZE\";\n Channel[Channel[\"COLOR\"] = 'color'] = \"COLOR\";\n Channel[Channel[\"TEXT\"] = 'text'] = \"TEXT\";\n Channel[Channel[\"DETAIL\"] = 'detail'] = \"DETAIL\";\n Channel[Channel[\"LABEL\"] = 'label'] = \"LABEL\";\n Channel[Channel[\"PATH\"] = 'path'] = \"PATH\";\n Channel[Channel[\"ORDER\"] = 'order'] = \"ORDER\";\n Channel[Channel[\"OPACITY\"] = 'opacity'] = \"OPACITY\";\n})(exports.Channel || (exports.Channel = {}));\nvar Channel = exports.Channel;\nexports.X = Channel.X;\nexports.Y = Channel.Y;\nexports.X2 = Channel.X2;\nexports.Y2 = Channel.Y2;\nexports.ROW = Channel.ROW;\nexports.COLUMN = Channel.COLUMN;\nexports.SHAPE = Channel.SHAPE;\nexports.SIZE = Channel.SIZE;\nexports.COLOR = Channel.COLOR;\nexports.TEXT = Channel.TEXT;\nexports.DETAIL = Channel.DETAIL;\nexports.LABEL = Channel.LABEL;\nexports.PATH = Channel.PATH;\nexports.ORDER = Channel.ORDER;\nexports.OPACITY = Channel.OPACITY;\nexports.CHANNELS = [exports.X, exports.Y, exports.X2, exports.Y2, exports.ROW, exports.COLUMN, exports.SIZE, exports.SHAPE, exports.COLOR, exports.PATH, exports.ORDER, exports.OPACITY, exports.TEXT, exports.DETAIL, exports.LABEL];\nexports.UNIT_CHANNELS = util_1.without(exports.CHANNELS, [exports.ROW, exports.COLUMN]);\nexports.UNIT_SCALE_CHANNELS = util_1.without(exports.UNIT_CHANNELS, [exports.PATH, exports.ORDER, exports.DETAIL, exports.TEXT, exports.LABEL, exports.X2, exports.Y2]);\nexports.NONSPATIAL_CHANNELS = util_1.without(exports.UNIT_CHANNELS, [exports.X, exports.Y, exports.X2, exports.Y2]);\nexports.NONSPATIAL_SCALE_CHANNELS = util_1.without(exports.UNIT_SCALE_CHANNELS, [exports.X, exports.Y, exports.X2, exports.Y2]);\n/** Channels that can serve as groupings for stacked charts. */\nexports.STACK_GROUP_CHANNELS = [exports.COLOR, exports.DETAIL, exports.ORDER, exports.OPACITY, exports.SIZE];\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 */\nfunction supportMark(channel, mark) {\n return !!getSupportedMark(channel)[mark];\n}\nexports.supportMark = supportMark;\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to boolean values.\n */\nfunction getSupportedMark(channel) {\n switch (channel) {\n case exports.X:\n case exports.Y:\n case exports.COLOR:\n case exports.DETAIL:\n case exports.ORDER:\n case exports.OPACITY:\n case exports.ROW:\n case exports.COLUMN:\n return {\n point: true, tick: true, rule: true, circle: true, square: true,\n bar: true, line: true, area: true, text: true\n };\n case exports.X2:\n case exports.Y2:\n return {\n rule: true, bar: true, area: true\n };\n case exports.SIZE:\n return {\n point: true, tick: true, rule: true, circle: true, square: true,\n bar: true, text: true\n };\n case exports.SHAPE:\n return { point: true };\n case exports.TEXT:\n return { text: true };\n case exports.PATH:\n return { line: true };\n }\n return {};\n}\nexports.getSupportedMark = getSupportedMark;\n;\n/**\n * Return whether a channel supports dimension / measure role\n * @param channel\n * @return A dictionary mapping role to boolean values.\n */\nfunction getSupportedRole(channel) {\n switch (channel) {\n case exports.X:\n case exports.Y:\n case exports.COLOR:\n case exports.OPACITY:\n case exports.LABEL:\n case exports.DETAIL:\n return {\n measure: true,\n dimension: true\n };\n case exports.ROW:\n case exports.COLUMN:\n case exports.SHAPE:\n return {\n measure: false,\n dimension: true\n };\n case exports.X2:\n case exports.Y2:\n case exports.SIZE:\n case exports.TEXT:\n return {\n measure: true,\n dimension: false\n };\n case exports.PATH:\n return {\n measure: false,\n dimension: true\n };\n }\n throw new Error('Invalid encoding channel' + channel);\n}\nexports.getSupportedRole = getSupportedRole;\nfunction hasScale(channel) {\n return !util_1.contains([exports.DETAIL, exports.PATH, exports.TEXT, exports.LABEL, exports.ORDER], channel);\n}\nexports.hasScale = hasScale;\n//# sourceMappingURL=channel.js.map", + "// DateTime definition object\n\"use strict\";\nvar util_1 = require('./util');\nfunction isDateTime(o) {\n return !!o.year || !!o.quarter || !!o.month || !!o.date || !!o.day ||\n !!o.hours || !!o.minutes || !!o.seconds || !!o.milliseconds;\n}\nexports.isDateTime = isDateTime;\nexports.MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];\nexports.SHORT_MONTHS = exports.MONTHS.map(function (m) { return m.substr(0, 3); });\nexports.DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexports.SHORT_DAYS = exports.DAYS.map(function (d) { return d.substr(0, 3); });\nfunction normalizeQuarter(q) {\n if (util_1.isNumber(q)) {\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return (q - 1) + '';\n }\n else {\n // Simply an expression string, but normalize should not be called in this case.\n console.warn('Potentially invalid quarter', q);\n return q;\n }\n}\nfunction normalizeMonth(m) {\n if (util_1.isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return (m - 1) + '';\n }\n else {\n var lowerM = m.toLowerCase();\n var monthIndex = exports.MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex + ''; // 0 for january, ...\n }\n var shortM = lowerM.substr(0, 3);\n var shortMonthIndex = exports.SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex + '';\n }\n // Simply an expression string, but normalize should not be called in this case.\n console.warn('Potentially invalid month', m);\n return m;\n }\n}\nfunction normalizeDay(d) {\n if (util_1.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 var lowerD = d.toLowerCase();\n var dayIndex = exports.DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex + ''; // 0 for january, ...\n }\n var shortD = lowerD.substr(0, 3);\n var shortDayIndex = exports.SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex + '';\n }\n // Simply an expression string, but normalize should not be called in this case.\n console.warn('Potentially invalid day', d);\n return d;\n }\n}\n/**\n * Return Vega Expression for a particular date time.\n * @param d\n * @param normalize whether to normalize quarter, month, day.\n */\nfunction dateTimeExpr(d, normalize) {\n if (normalize === void 0) { normalize = false; }\n var units = [];\n if (normalize && d.day !== undefined) {\n for (var _i = 0, _a = ['year', 'quarter', 'month', 'date']; _i < _a.length; _i++) {\n var unit = _a[_i];\n if (d[unit] !== undefined) {\n console.warn('Dropping day from datetime', JSON.stringify(d), 'as day cannot be combined with', unit);\n d = util_1.duplicate(d);\n delete d.day;\n break;\n }\n }\n }\n if (d.year !== undefined) {\n units.push(d.year);\n }\n else if (d.day !== undefined) {\n // Set year to 2006 for working with day since January 1 2006 is a Sunday\n units.push(2006);\n }\n else {\n units.push(0);\n }\n if (d.month !== undefined) {\n var month = normalize ? normalizeMonth(d.month) : d.month;\n units.push(month);\n }\n else if (d.quarter !== undefined) {\n var quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n units.push(quarter + '*3');\n }\n else {\n units.push(0); // months start at zero in JS\n }\n if (d.date !== undefined) {\n units.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 var day = normalize ? normalizeDay(d.day) : d.day;\n units.push(day + '+1');\n }\n else {\n units.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 (var _b = 0, _c = ['hours', 'minutes', 'seconds', 'milliseconds']; _b < _c.length; _b++) {\n var timeUnit = _c[_b];\n if (d[timeUnit] !== undefined) {\n units.push(d[timeUnit]);\n }\n else {\n units.push(0);\n }\n }\n return 'datetime(' + units.join(', ') + ')';\n}\nexports.dateTimeExpr = dateTimeExpr;\n//# sourceMappingURL=datetime.js.map", + "\"use strict\";\nvar channel_1 = require('./channel');\nvar util_1 = require('./util');\nfunction countRetinal(encoding) {\n var count = 0;\n if (encoding.color) {\n count++;\n }\n if (encoding.opacity) {\n count++;\n }\n if (encoding.size) {\n count++;\n }\n if (encoding.shape) {\n count++;\n }\n return count;\n}\nexports.countRetinal = countRetinal;\nfunction channels(encoding) {\n return channel_1.CHANNELS.filter(function (channel) {\n return has(encoding, channel);\n });\n}\nexports.channels = channels;\n// TOD: rename this to hasChannelField and only use we really want it.\nfunction has(encoding, channel) {\n var channelEncoding = encoding && encoding[channel];\n return channelEncoding && (channelEncoding.field !== undefined ||\n // TODO: check that we have field in the array\n (util_1.isArray(channelEncoding) && channelEncoding.length > 0));\n}\nexports.has = has;\nfunction isAggregate(encoding) {\n return util_1.some(channel_1.CHANNELS, function (channel) {\n if (has(encoding, channel) && encoding[channel].aggregate) {\n return true;\n }\n return false;\n });\n}\nexports.isAggregate = isAggregate;\nfunction isRanged(encoding) {\n return encoding && ((!!encoding.x && !!encoding.x2) || (!!encoding.y && !!encoding.y2));\n}\nexports.isRanged = isRanged;\nfunction fieldDefs(encoding) {\n var arr = [];\n channel_1.CHANNELS.forEach(function (channel) {\n if (has(encoding, channel)) {\n if (util_1.isArray(encoding[channel])) {\n encoding[channel].forEach(function (fieldDef) {\n arr.push(fieldDef);\n });\n }\n else {\n arr.push(encoding[channel]);\n }\n }\n });\n return arr;\n}\nexports.fieldDefs = fieldDefs;\n;\nfunction forEach(encoding, f, thisArg) {\n channelMappingForEach(channel_1.CHANNELS, encoding, f, thisArg);\n}\nexports.forEach = forEach;\nfunction channelMappingForEach(channels, mapping, f, thisArg) {\n var i = 0;\n channels.forEach(function (channel) {\n if (has(mapping, channel)) {\n if (util_1.isArray(mapping[channel])) {\n mapping[channel].forEach(function (fieldDef) {\n f.call(thisArg, fieldDef, channel, i++);\n });\n }\n else {\n f.call(thisArg, mapping[channel], channel, i++);\n }\n }\n });\n}\nexports.channelMappingForEach = channelMappingForEach;\nfunction map(encoding, f, thisArg) {\n return channelMappingMap(channel_1.CHANNELS, encoding, f, thisArg);\n}\nexports.map = map;\nfunction channelMappingMap(channels, mapping, f, thisArg) {\n var arr = [];\n channels.forEach(function (channel) {\n if (has(mapping, channel)) {\n if (util_1.isArray(mapping[channel])) {\n mapping[channel].forEach(function (fieldDef) {\n arr.push(f.call(thisArg, fieldDef, channel));\n });\n }\n else {\n arr.push(f.call(thisArg, mapping[channel], channel));\n }\n }\n });\n return arr;\n}\nexports.channelMappingMap = channelMappingMap;\nfunction reduce(encoding, f, init, thisArg) {\n return channelMappingReduce(channel_1.CHANNELS, encoding, f, init, thisArg);\n}\nexports.reduce = reduce;\nfunction channelMappingReduce(channels, mapping, f, init, thisArg) {\n var r = init;\n channel_1.CHANNELS.forEach(function (channel) {\n if (has(mapping, channel)) {\n if (util_1.isArray(mapping[channel])) {\n mapping[channel].forEach(function (fieldDef) {\n r = f.call(thisArg, r, fieldDef, channel);\n });\n }\n else {\n r = f.call(thisArg, r, mapping[channel], channel);\n }\n }\n });\n return r;\n}\nexports.channelMappingReduce = channelMappingReduce;\n//# sourceMappingURL=encoding.js.map", + "// utility for a field definition object\n\"use strict\";\nvar aggregate_1 = require('./aggregate');\nvar scale_1 = require('./scale');\nvar type_1 = require('./type');\nvar util_1 = require('./util');\nfunction field(fieldDef, opt) {\n if (opt === void 0) { opt = {}; }\n var field = fieldDef.field;\n var prefix = opt.prefix;\n var suffix = opt.suffix;\n if (isCount(fieldDef)) {\n field = 'count';\n }\n else {\n var fn = opt.fn;\n if (!opt.nofn) {\n if (fieldDef.bin) {\n fn = 'bin';\n suffix = opt.binSuffix || (opt.scaleType === scale_1.ScaleType.ORDINAL ?\n // For ordinal scale type, use `range` as suffix.\n 'range' :\n // For non-ordinal scale or unknown, use `start` as suffix.\n 'start');\n }\n else if (!opt.noAggregate && fieldDef.aggregate) {\n fn = String(fieldDef.aggregate);\n }\n else if (fieldDef.timeUnit) {\n fn = String(fieldDef.timeUnit);\n }\n }\n if (!!fn) {\n field = fn + \"_\" + field;\n }\n }\n if (!!suffix) {\n field = field + \"_\" + suffix;\n }\n if (!!prefix) {\n field = prefix + \"_\" + field;\n }\n if (opt.datum) {\n field = \"datum[\\\"\" + field + \"\\\"]\";\n }\n return field;\n}\nexports.field = field;\nfunction _isFieldDimension(fieldDef) {\n return util_1.contains([type_1.NOMINAL, type_1.ORDINAL], fieldDef.type) || !!fieldDef.bin ||\n (fieldDef.type === type_1.TEMPORAL && !!fieldDef.timeUnit);\n}\nfunction isDimension(fieldDef) {\n return fieldDef && fieldDef.field && _isFieldDimension(fieldDef);\n}\nexports.isDimension = isDimension;\nfunction isMeasure(fieldDef) {\n return fieldDef && fieldDef.field && !_isFieldDimension(fieldDef);\n}\nexports.isMeasure = isMeasure;\nfunction count() {\n return { field: '*', aggregate: aggregate_1.AggregateOp.COUNT, type: type_1.QUANTITATIVE };\n}\nexports.count = count;\nfunction isCount(fieldDef) {\n return fieldDef.aggregate === aggregate_1.AggregateOp.COUNT;\n}\nexports.isCount = isCount;\nfunction title(fieldDef, config) {\n if (fieldDef.title != null) {\n return fieldDef.title;\n }\n if (isCount(fieldDef)) {\n return config.countTitle;\n }\n var fn = fieldDef.aggregate || fieldDef.timeUnit || (fieldDef.bin && 'bin');\n if (fn) {\n return fn.toString().toUpperCase() + '(' + fieldDef.field + ')';\n }\n else {\n return fieldDef.field;\n }\n}\nexports.title = title;\n//# sourceMappingURL=fielddef.js.map", + "\"use strict\";\nvar datetime_1 = require('./datetime');\nvar fielddef_1 = require('./fielddef');\nvar timeunit_1 = require('./timeunit');\nvar util_1 = require('./util');\nfunction isEqualFilter(filter) {\n return filter && !!filter.field && filter.equal !== undefined;\n}\nexports.isEqualFilter = isEqualFilter;\nfunction isRangeFilter(filter) {\n if (filter && !!filter.field) {\n if (util_1.isArray(filter.range) && filter.range.length === 2) {\n return true;\n }\n }\n return false;\n}\nexports.isRangeFilter = isRangeFilter;\nfunction isInFilter(filter) {\n return filter && !!filter.field && util_1.isArray(filter.in);\n}\nexports.isInFilter = isInFilter;\nfunction expression(filter) {\n if (util_1.isString(filter)) {\n return filter;\n }\n else {\n var fieldExpr = filter.timeUnit ?\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(' + timeunit_1.fieldExpr(filter.timeUnit, filter.field) + ')') :\n fielddef_1.field(filter, { datum: true });\n if (isEqualFilter(filter)) {\n return fieldExpr + '===' + valueExpr(filter.equal, filter.timeUnit);\n }\n else if (isInFilter(filter)) {\n return 'indexof([' +\n filter.in.map(function (v) { return valueExpr(v, filter.timeUnit); }).join(',') +\n '], ' + fieldExpr + ') !== -1';\n }\n else if (isRangeFilter(filter)) {\n var lower = filter.range[0];\n var upper = filter.range[1];\n if (lower !== null && upper !== null) {\n return 'inrange(' + fieldExpr + ', ' +\n valueExpr(lower, filter.timeUnit) + ', ' +\n valueExpr(upper, filter.timeUnit) + ')';\n }\n else if (lower !== null) {\n return fieldExpr + ' >= ' + lower;\n }\n else if (upper !== null) {\n return fieldExpr + ' <= ' + upper;\n }\n }\n }\n return undefined;\n}\nexports.expression = expression;\nfunction valueExpr(v, timeUnit) {\n if (datetime_1.isDateTime(v)) {\n var expr = datetime_1.dateTimeExpr(v, true);\n return 'time(' + expr + ')';\n }\n if (timeunit_1.isSingleTimeUnit(timeUnit)) {\n var datetime = {};\n datetime[timeUnit] = v;\n var expr = datetime_1.dateTimeExpr(datetime, true);\n return 'time(' + expr + ')';\n }\n return JSON.stringify(v);\n}\n//# sourceMappingURL=filter.js.map", + "\"use strict\";\n(function (Mark) {\n Mark[Mark[\"AREA\"] = 'area'] = \"AREA\";\n Mark[Mark[\"BAR\"] = 'bar'] = \"BAR\";\n Mark[Mark[\"LINE\"] = 'line'] = \"LINE\";\n Mark[Mark[\"POINT\"] = 'point'] = \"POINT\";\n Mark[Mark[\"TEXT\"] = 'text'] = \"TEXT\";\n Mark[Mark[\"TICK\"] = 'tick'] = \"TICK\";\n Mark[Mark[\"RULE\"] = 'rule'] = \"RULE\";\n Mark[Mark[\"CIRCLE\"] = 'circle'] = \"CIRCLE\";\n Mark[Mark[\"SQUARE\"] = 'square'] = \"SQUARE\";\n Mark[Mark[\"ERRORBAR\"] = 'errorBar'] = \"ERRORBAR\";\n})(exports.Mark || (exports.Mark = {}));\nvar Mark = exports.Mark;\nexports.AREA = Mark.AREA;\nexports.BAR = Mark.BAR;\nexports.LINE = Mark.LINE;\nexports.POINT = Mark.POINT;\nexports.TEXT = Mark.TEXT;\nexports.TICK = Mark.TICK;\nexports.RULE = Mark.RULE;\nexports.CIRCLE = Mark.CIRCLE;\nexports.SQUARE = Mark.SQUARE;\nexports.ERRORBAR = Mark.ERRORBAR;\nexports.PRIMITIVE_MARKS = [exports.AREA, exports.BAR, exports.LINE, exports.POINT, exports.TEXT, exports.TICK, exports.RULE, exports.CIRCLE, exports.SQUARE];\n//# sourceMappingURL=mark.js.map", + "\"use strict\";\n(function (ScaleType) {\n ScaleType[ScaleType[\"LINEAR\"] = 'linear'] = \"LINEAR\";\n ScaleType[ScaleType[\"LOG\"] = 'log'] = \"LOG\";\n ScaleType[ScaleType[\"POW\"] = 'pow'] = \"POW\";\n ScaleType[ScaleType[\"SQRT\"] = 'sqrt'] = \"SQRT\";\n ScaleType[ScaleType[\"QUANTILE\"] = 'quantile'] = \"QUANTILE\";\n ScaleType[ScaleType[\"QUANTIZE\"] = 'quantize'] = \"QUANTIZE\";\n ScaleType[ScaleType[\"ORDINAL\"] = 'ordinal'] = \"ORDINAL\";\n ScaleType[ScaleType[\"TIME\"] = 'time'] = \"TIME\";\n ScaleType[ScaleType[\"UTC\"] = 'utc'] = \"UTC\";\n})(exports.ScaleType || (exports.ScaleType = {}));\nvar ScaleType = exports.ScaleType;\n(function (NiceTime) {\n NiceTime[NiceTime[\"SECOND\"] = 'second'] = \"SECOND\";\n NiceTime[NiceTime[\"MINUTE\"] = 'minute'] = \"MINUTE\";\n NiceTime[NiceTime[\"HOUR\"] = 'hour'] = \"HOUR\";\n NiceTime[NiceTime[\"DAY\"] = 'day'] = \"DAY\";\n NiceTime[NiceTime[\"WEEK\"] = 'week'] = \"WEEK\";\n NiceTime[NiceTime[\"MONTH\"] = 'month'] = \"MONTH\";\n NiceTime[NiceTime[\"YEAR\"] = 'year'] = \"YEAR\";\n})(exports.NiceTime || (exports.NiceTime = {}));\nvar NiceTime = exports.NiceTime;\n(function (BandSize) {\n BandSize[BandSize[\"FIT\"] = 'fit'] = \"FIT\";\n})(exports.BandSize || (exports.BandSize = {}));\nvar BandSize = exports.BandSize;\nexports.BANDSIZE_FIT = BandSize.FIT;\nexports.defaultScaleConfig = {\n round: true,\n textBandWidth: 90,\n bandSize: 21,\n padding: 0.1,\n useRawDomain: false,\n opacity: [0.3, 0.8],\n nominalColorRange: 'category10',\n sequentialColorRange: ['#AFC6A3', '#09622A'],\n shapeRange: 'shapes',\n fontSizeRange: [8, 40],\n ruleSizeRange: [1, 5],\n tickSizeRange: [1, 20]\n};\nexports.defaultFacetScaleConfig = {\n round: true,\n padding: 16\n};\n//# sourceMappingURL=scale.js.map", + "\"use strict\";\n(function (SortOrder) {\n SortOrder[SortOrder[\"ASCENDING\"] = 'ascending'] = \"ASCENDING\";\n SortOrder[SortOrder[\"DESCENDING\"] = 'descending'] = \"DESCENDING\";\n SortOrder[SortOrder[\"NONE\"] = 'none'] = \"NONE\";\n})(exports.SortOrder || (exports.SortOrder = {}));\nvar SortOrder = exports.SortOrder;\nfunction isSortField(sort) {\n return !!sort && !!sort['field'] && !!sort['op'];\n}\nexports.isSortField = isSortField;\n//# sourceMappingURL=sort.js.map", + "\"use strict\";\nvar channel_1 = require('./channel');\nvar encoding_1 = require('./encoding');\nvar mark_1 = require('./mark');\nvar util_1 = require('./util');\n(function (StackOffset) {\n StackOffset[StackOffset[\"ZERO\"] = 'zero'] = \"ZERO\";\n StackOffset[StackOffset[\"CENTER\"] = 'center'] = \"CENTER\";\n StackOffset[StackOffset[\"NORMALIZE\"] = 'normalize'] = \"NORMALIZE\";\n StackOffset[StackOffset[\"NONE\"] = 'none'] = \"NONE\";\n})(exports.StackOffset || (exports.StackOffset = {}));\nvar StackOffset = exports.StackOffset;\nfunction stack(mark, encoding, config) {\n var stacked = (config && config.mark) ? config.mark.stacked : undefined;\n // Should not have stack explicitly disabled\n if (util_1.contains([StackOffset.NONE, null, false], stacked)) {\n return null;\n }\n // Should have stackable mark\n if (!util_1.contains([mark_1.BAR, mark_1.AREA], mark)) {\n return null;\n }\n // Should be aggregate plot\n if (!encoding_1.isAggregate(encoding)) {\n return null;\n }\n // Should have grouping level of detail\n var stackByChannels = channel_1.STACK_GROUP_CHANNELS.reduce(function (sc, channel) {\n if (encoding_1.has(encoding, channel) && !encoding[channel].aggregate) {\n sc.push(channel);\n }\n return sc;\n }, []);\n if (stackByChannels.length === 0) {\n return null;\n }\n // Has only one aggregate axis\n var hasXField = encoding_1.has(encoding, channel_1.X);\n var hasYField = encoding_1.has(encoding, channel_1.Y);\n var xIsAggregate = hasXField && !!encoding.x.aggregate;\n var yIsAggregate = hasYField && !!encoding.y.aggregate;\n if (xIsAggregate !== yIsAggregate) {\n return {\n groupbyChannel: xIsAggregate ? (hasYField ? channel_1.Y : null) : (hasXField ? channel_1.X : null),\n fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y,\n stackByChannels: stackByChannels,\n offset: stacked || StackOffset.ZERO\n };\n }\n return null;\n}\nexports.stack = stack;\n//# sourceMappingURL=stack.js.map", + "\"use strict\";\nvar channel_1 = require('./channel');\nvar datetime_1 = require('./datetime');\nvar scale_1 = require('./scale');\nvar util_1 = require('./util');\n(function (TimeUnit) {\n TimeUnit[TimeUnit[\"YEAR\"] = 'year'] = \"YEAR\";\n TimeUnit[TimeUnit[\"MONTH\"] = 'month'] = \"MONTH\";\n TimeUnit[TimeUnit[\"DAY\"] = 'day'] = \"DAY\";\n TimeUnit[TimeUnit[\"DATE\"] = 'date'] = \"DATE\";\n TimeUnit[TimeUnit[\"HOURS\"] = 'hours'] = \"HOURS\";\n TimeUnit[TimeUnit[\"MINUTES\"] = 'minutes'] = \"MINUTES\";\n TimeUnit[TimeUnit[\"SECONDS\"] = 'seconds'] = \"SECONDS\";\n TimeUnit[TimeUnit[\"MILLISECONDS\"] = 'milliseconds'] = \"MILLISECONDS\";\n TimeUnit[TimeUnit[\"YEARMONTH\"] = 'yearmonth'] = \"YEARMONTH\";\n // Note: don't add MONTH DATE because it will be incorrect\n // since days on a leap year will be shifted by one if\n // we only add\n TimeUnit[TimeUnit[\"YEARMONTHDATE\"] = 'yearmonthdate'] = \"YEARMONTHDATE\";\n TimeUnit[TimeUnit[\"YEARMONTHDATEHOURS\"] = 'yearmonthdatehours'] = \"YEARMONTHDATEHOURS\";\n TimeUnit[TimeUnit[\"YEARMONTHDATEHOURSMINUTES\"] = 'yearmonthdatehoursminutes'] = \"YEARMONTHDATEHOURSMINUTES\";\n TimeUnit[TimeUnit[\"YEARMONTHDATEHOURSMINUTESSECONDS\"] = 'yearmonthdatehoursminutesseconds'] = \"YEARMONTHDATEHOURSMINUTESSECONDS\";\n TimeUnit[TimeUnit[\"HOURSMINUTES\"] = 'hoursminutes'] = \"HOURSMINUTES\";\n TimeUnit[TimeUnit[\"HOURSMINUTESSECONDS\"] = 'hoursminutesseconds'] = \"HOURSMINUTESSECONDS\";\n TimeUnit[TimeUnit[\"MINUTESSECONDS\"] = 'minutesseconds'] = \"MINUTESSECONDS\";\n TimeUnit[TimeUnit[\"SECONDSMILLISECONDS\"] = 'secondsmilliseconds'] = \"SECONDSMILLISECONDS\";\n TimeUnit[TimeUnit[\"QUARTER\"] = 'quarter'] = \"QUARTER\";\n TimeUnit[TimeUnit[\"YEARQUARTER\"] = 'yearquarter'] = \"YEARQUARTER\";\n TimeUnit[TimeUnit[\"QUARTERMONTH\"] = 'quartermonth'] = \"QUARTERMONTH\";\n TimeUnit[TimeUnit[\"YEARQUARTERMONTH\"] = 'yearquartermonth'] = \"YEARQUARTERMONTH\";\n})(exports.TimeUnit || (exports.TimeUnit = {}));\nvar TimeUnit = exports.TimeUnit;\n/** Time Unit that only corresponds to only one part of Date objects. */\nexports.SINGLE_TIMEUNITS = [\n TimeUnit.YEAR,\n TimeUnit.QUARTER,\n TimeUnit.MONTH,\n TimeUnit.DAY,\n TimeUnit.DATE,\n TimeUnit.HOURS,\n TimeUnit.MINUTES,\n TimeUnit.SECONDS,\n TimeUnit.MILLISECONDS,\n];\nvar SINGLE_TIMEUNIT_INDEX = exports.SINGLE_TIMEUNITS.reduce(function (d, timeUnit) {\n d[timeUnit] = true;\n return d;\n}, {});\nfunction isSingleTimeUnit(timeUnit) {\n return !!SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\nexports.isSingleTimeUnit = isSingleTimeUnit;\n/**\n * Converts a date to only have the measurements relevant to the specified unit\n * i.e. ('yearmonth', '2000-12-04 07:58:14') -> '2000-12-01 00:00:00'\n * Note: the base date is Jan 01 1900 00:00:00\n */\nfunction convert(unit, date) {\n var result = new Date(0, 0, 1, 0, 0, 0, 0); // start with uniform date\n exports.SINGLE_TIMEUNITS.forEach(function (singleUnit) {\n if (containsTimeUnit(unit, singleUnit)) {\n switch (singleUnit) {\n case TimeUnit.DAY:\n throw new Error('Cannot convert to TimeUnits containing \\'day\\'');\n case TimeUnit.YEAR:\n result.setFullYear(date.getFullYear());\n break;\n case TimeUnit.QUARTER:\n // indicate quarter by setting month to be the first of the quarter i.e. may (4) -> april (3)\n result.setMonth((Math.floor(date.getMonth() / 3)) * 3);\n break;\n case TimeUnit.MONTH:\n result.setMonth(date.getMonth());\n break;\n case TimeUnit.DATE:\n result.setDate(date.getDate());\n break;\n case TimeUnit.HOURS:\n result.setHours(date.getHours());\n break;\n case TimeUnit.MINUTES:\n result.setMinutes(date.getMinutes());\n break;\n case TimeUnit.SECONDS:\n result.setSeconds(date.getSeconds());\n break;\n case TimeUnit.MILLISECONDS:\n result.setMilliseconds(date.getMilliseconds());\n break;\n }\n }\n });\n return result;\n}\nexports.convert = convert;\nexports.MULTI_TIMEUNITS = [\n TimeUnit.YEARQUARTER,\n TimeUnit.YEARQUARTERMONTH,\n TimeUnit.YEARMONTH,\n TimeUnit.YEARMONTHDATE,\n TimeUnit.YEARMONTHDATEHOURS,\n TimeUnit.YEARMONTHDATEHOURSMINUTES,\n TimeUnit.YEARMONTHDATEHOURSMINUTESSECONDS,\n TimeUnit.QUARTERMONTH,\n TimeUnit.HOURSMINUTES,\n TimeUnit.HOURSMINUTESSECONDS,\n TimeUnit.MINUTESSECONDS,\n TimeUnit.SECONDSMILLISECONDS,\n];\nvar MULTI_TIMEUNIT_INDEX = exports.MULTI_TIMEUNITS.reduce(function (d, timeUnit) {\n d[timeUnit] = true;\n return d;\n}, {});\nfunction isMultiTimeUnit(timeUnit) {\n return !!MULTI_TIMEUNIT_INDEX[timeUnit];\n}\nexports.isMultiTimeUnit = isMultiTimeUnit;\nexports.TIMEUNITS = exports.SINGLE_TIMEUNITS.concat(exports.MULTI_TIMEUNITS);\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nfunction containsTimeUnit(fullTimeUnit, timeUnit) {\n var fullTimeUnitStr = fullTimeUnit.toString();\n var timeUnitStr = timeUnit.toString();\n var index = fullTimeUnitStr.indexOf(timeUnitStr);\n return index > -1 &&\n (timeUnit !== TimeUnit.SECONDS ||\n index === 0 ||\n fullTimeUnitStr.charAt(index - 1) !== 'i' // exclude milliseconds\n );\n}\nexports.containsTimeUnit = containsTimeUnit;\nfunction defaultScaleType(timeUnit) {\n switch (timeUnit) {\n case TimeUnit.HOURS:\n case TimeUnit.DAY:\n case TimeUnit.MONTH:\n case TimeUnit.QUARTER:\n return scale_1.ScaleType.ORDINAL;\n }\n // date, year, minute, second, yearmonth, monthday, ...\n return scale_1.ScaleType.TIME;\n}\nexports.defaultScaleType = defaultScaleType;\n/**\n * Returns Vega expresssion for a given timeUnit and fieldRef\n */\nfunction fieldExpr(fullTimeUnit, field) {\n var fieldRef = 'datum[\"' + field + '\"]';\n function func(timeUnit) {\n if (timeUnit === TimeUnit.QUARTER) {\n // Divide by 3 to get the corresponding quarter number, multiply by 3\n // to scale to the first month of the corresponding quarter(0,3,6,9).\n return 'floor(month(' + fieldRef + ')' + '/3)';\n }\n else {\n return timeUnit + '(' + fieldRef + ')';\n }\n }\n var d = exports.SINGLE_TIMEUNITS.reduce(function (_d, tu) {\n if (containsTimeUnit(fullTimeUnit, tu)) {\n _d[tu] = func(tu);\n }\n return _d;\n }, {});\n if (d.day && util_1.keys(d).length > 1) {\n console.warn('Time unit \"' + fullTimeUnit + '\" is not supported. We are replacing it with ', (fullTimeUnit + '').replace('day', 'date') + '.');\n delete d.day;\n d.date = func(TimeUnit.DATE);\n }\n return datetime_1.dateTimeExpr(d);\n}\nexports.fieldExpr = fieldExpr;\n/** Generate the complete raw domain. */\nfunction rawDomain(timeUnit, channel) {\n if (util_1.contains([channel_1.ROW, channel_1.COLUMN, channel_1.SHAPE, channel_1.COLOR], channel)) {\n return null;\n }\n switch (timeUnit) {\n case TimeUnit.SECONDS:\n return util_1.range(0, 60);\n case TimeUnit.MINUTES:\n return util_1.range(0, 60);\n case TimeUnit.HOURS:\n return util_1.range(0, 24);\n case TimeUnit.DAY:\n return util_1.range(0, 7);\n case TimeUnit.DATE:\n return util_1.range(1, 32);\n case TimeUnit.MONTH:\n return util_1.range(0, 12);\n case TimeUnit.QUARTER:\n return [0, 3, 6, 9];\n }\n return null;\n}\nexports.rawDomain = rawDomain;\n/** returns the smallest nice unit for scale.nice */\nfunction smallestUnit(timeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) {\n return 'second';\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) {\n return 'minute';\n }\n if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) {\n return 'hour';\n }\n if (containsTimeUnit(timeUnit, TimeUnit.DAY) ||\n containsTimeUnit(timeUnit, TimeUnit.DATE)) {\n return 'day';\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) {\n return 'month';\n }\n if (containsTimeUnit(timeUnit, TimeUnit.YEAR)) {\n return 'year';\n }\n return undefined;\n}\nexports.smallestUnit = smallestUnit;\n/** returns the template name used for axis labels for a time unit */\nfunction template(timeUnit, field, shortTimeLabels) {\n if (!timeUnit) {\n return undefined;\n }\n var dateComponents = [];\n if (containsTimeUnit(timeUnit, TimeUnit.YEAR)) {\n dateComponents.push(shortTimeLabels ? '%y' : '%Y');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.QUARTER)) {\n // special template for quarter\n dateComponents.push('\\'}}Q{{' + field + ' | quarter}}{{' + field + ' | time:\\'');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) {\n dateComponents.push(shortTimeLabels ? '%b' : '%B');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.DAY)) {\n dateComponents.push(shortTimeLabels ? '%a' : '%A');\n }\n else if (containsTimeUnit(timeUnit, TimeUnit.DATE)) {\n dateComponents.push('%d');\n }\n var timeComponents = [];\n if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) {\n timeComponents.push('%H');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) {\n timeComponents.push('%M');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) {\n timeComponents.push('%S');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MILLISECONDS)) {\n timeComponents.push('%L');\n }\n var out = [];\n if (dateComponents.length > 0) {\n out.push(dateComponents.join('-'));\n }\n if (timeComponents.length > 0) {\n out.push(timeComponents.join(':'));\n }\n if (out.length > 0) {\n // clean up empty formatting expressions that may have been generated by the quarter time unit\n var template_1 = '{{' + field + ' | time:\\'' + out.join(' ') + '\\'}}';\n // FIXME: Remove these RegExp Hacks!!!\n var escapedField = field.replace(/(\\[|\\])/g, '\\\\$1'); // excape field for use in Regex\n return template_1.replace(new RegExp('{{' + escapedField + ' \\\\| time:\\'\\'}}', 'g'), ''); // remove empty templates with Regex\n }\n else {\n return undefined;\n }\n}\nexports.template = template;\n//# sourceMappingURL=timeunit.js.map", + "/** Constants and utilities for data type */\n\"use strict\";\n(function (Type) {\n Type[Type[\"QUANTITATIVE\"] = 'quantitative'] = \"QUANTITATIVE\";\n Type[Type[\"ORDINAL\"] = 'ordinal'] = \"ORDINAL\";\n Type[Type[\"TEMPORAL\"] = 'temporal'] = \"TEMPORAL\";\n Type[Type[\"NOMINAL\"] = 'nominal'] = \"NOMINAL\";\n})(exports.Type || (exports.Type = {}));\nvar Type = exports.Type;\nexports.QUANTITATIVE = Type.QUANTITATIVE;\nexports.ORDINAL = Type.ORDINAL;\nexports.TEMPORAL = Type.TEMPORAL;\nexports.NOMINAL = Type.NOMINAL;\n/**\n * Mapping from full type names to short type names.\n * @type {Object}\n */\nexports.SHORT_TYPE = {\n quantitative: 'Q',\n temporal: 'T',\n nominal: 'N',\n ordinal: 'O'\n};\n/**\n * Mapping from short type names to full type names.\n * @type {Object}\n */\nexports.TYPE_FROM_SHORT_TYPE = {\n Q: exports.QUANTITATIVE,\n T: exports.TEMPORAL,\n O: exports.ORDINAL,\n N: exports.NOMINAL\n};\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nfunction getFullName(type) {\n var typeString = type; // force type as string so we can translate short types\n return exports.TYPE_FROM_SHORT_TYPE[typeString.toUpperCase()] ||\n typeString.toLowerCase();\n}\nexports.getFullName = getFullName;\n//# sourceMappingURL=type.js.map", + "/// \n/// \n\"use strict\";\nvar stringify = require('json-stable-stringify');\nvar util_1 = require('datalib/src/util');\nexports.keys = util_1.keys;\nexports.extend = util_1.extend;\nexports.duplicate = util_1.duplicate;\nexports.isArray = util_1.isArray;\nexports.vals = util_1.vals;\nexports.truncate = util_1.truncate;\nexports.toMap = util_1.toMap;\nexports.isObject = util_1.isObject;\nexports.isString = util_1.isString;\nexports.isNumber = util_1.isNumber;\nexports.isBoolean = util_1.isBoolean;\nvar util_2 = require('datalib/src/util');\nvar util_3 = require('datalib/src/util');\n/**\n * Creates an object composed of the picked object properties.\n *\n * Example: (from lodash)\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n * pick(object, ['a', 'c']);\n * // → { 'a': 1, 'c': 3 }\n *\n */\nfunction pick(obj, props) {\n var copy = {};\n props.forEach(function (prop) {\n if (obj.hasOwnProperty(prop)) {\n copy[prop] = obj[prop];\n }\n });\n return copy;\n}\nexports.pick = pick;\n// Copied from datalib\nfunction range(start, stop, step) {\n if (arguments.length < 3) {\n step = 1;\n if (arguments.length < 2) {\n stop = start;\n start = 0;\n }\n }\n if ((stop - start) / step === Infinity) {\n throw new Error('Infinite range');\n }\n var range = [], i = -1, j;\n if (step < 0) {\n /* tslint:disable */\n while ((j = start + step * ++i) > stop) {\n range.push(j);\n }\n }\n else {\n while ((j = start + step * ++i) < stop) {\n range.push(j);\n }\n }\n return range;\n}\nexports.range = range;\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 */\nfunction omit(obj, props) {\n var copy = util_2.duplicate(obj);\n props.forEach(function (prop) {\n delete copy[prop];\n });\n return copy;\n}\nexports.omit = omit;\nfunction hash(a) {\n if (util_3.isString(a) || util_3.isNumber(a) || util_3.isBoolean(a)) {\n return String(a);\n }\n return stringify(a);\n}\nexports.hash = hash;\nfunction contains(array, item) {\n return array.indexOf(item) > -1;\n}\nexports.contains = contains;\n/** Returns the array without the elements in item */\nfunction without(array, excludedItems) {\n return array.filter(function (item) {\n return !contains(excludedItems, item);\n });\n}\nexports.without = without;\nfunction union(array, other) {\n return array.concat(without(other, array));\n}\nexports.union = union;\nfunction forEach(obj, f, thisArg) {\n if (obj.forEach) {\n obj.forEach.call(thisArg, f);\n }\n else {\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n f.call(thisArg, obj[k], k, obj);\n }\n }\n }\n}\nexports.forEach = forEach;\nfunction reduce(obj, f, init, thisArg) {\n if (obj.reduce) {\n return obj.reduce.call(thisArg, f, init);\n }\n else {\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n init = f.call(thisArg, init, obj[k], k, obj);\n }\n }\n return init;\n }\n}\nexports.reduce = reduce;\nfunction map(obj, f, thisArg) {\n if (obj.map) {\n return obj.map.call(thisArg, f);\n }\n else {\n var output = [];\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n output.push(f.call(thisArg, obj[k], k, obj));\n }\n }\n return output;\n }\n}\nexports.map = map;\nfunction some(arr, f) {\n var i = 0;\n for (var k = 0; k < arr.length; k++) {\n if (f(arr[k], k, i++)) {\n return true;\n }\n }\n return false;\n}\nexports.some = some;\nfunction every(arr, f) {\n var i = 0;\n for (var k = 0; k < arr.length; k++) {\n if (!f(arr[k], k, i++)) {\n return false;\n }\n }\n return true;\n}\nexports.every = every;\nfunction flatten(arrays) {\n return [].concat.apply([], arrays);\n}\nexports.flatten = flatten;\nfunction mergeDeep(dest) {\n var src = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n src[_i - 1] = arguments[_i];\n }\n for (var i = 0; i < src.length; i++) {\n dest = deepMerge_(dest, src[i]);\n }\n return dest;\n}\nexports.mergeDeep = mergeDeep;\n;\n// recursively merges src into dest\nfunction deepMerge_(dest, src) {\n if (typeof src !== 'object' || src === null) {\n return dest;\n }\n for (var p in src) {\n if (!src.hasOwnProperty(p)) {\n continue;\n }\n if (src[p] === undefined) {\n continue;\n }\n if (typeof src[p] !== 'object' || src[p] === null) {\n dest[p] = src[p];\n }\n else if (typeof dest[p] !== 'object' || dest[p] === null) {\n dest[p] = mergeDeep(src[p].constructor === Array ? [] : {}, src[p]);\n }\n else {\n mergeDeep(dest[p], src[p]);\n }\n }\n return dest;\n}\nfunction unique(values, f) {\n var results = [];\n var u = {}, v, i, n;\n for (i = 0, n = values.length; i < n; ++i) {\n v = f ? f(values[i]) : values[i];\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(values[i]);\n }\n return results;\n}\nexports.unique = unique;\n;\nfunction warning(message) {\n console.warn('[VL Warning]', message);\n}\nexports.warning = warning;\nfunction error(message) {\n console.error('[VL Error]', message);\n}\nexports.error = error;\n/**\n * Returns true if the two dicitonaries disagree. Applies only to defioned values.\n */\nfunction differ(dict, other) {\n for (var key in dict) {\n if (dict.hasOwnProperty(key)) {\n if (other[key] && dict[key] && other[key] !== dict[key]) {\n return true;\n }\n }\n }\n return false;\n}\nexports.differ = differ;\n//# sourceMappingURL=util.js.map" + ] +} \ No newline at end of file diff --git a/compassql.min.js b/compassql.min.js new file mode 100644 index 00000000..82ce33fb --- /dev/null +++ b/compassql.min.js @@ -0,0 +1,6 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.cql=e()}}(function(){var e;return function r(e,t,n){function i(o,c){if(!t[o]){if(!e[o]){var u="function"==typeof require&&require;if(!c&&u)return u(o,!0);if(a)return a(o,!0);var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}var l=t[o]={exports:{}};e[o][0].call(l.exports,function(r){var t=e[o][1][r];return i(t?t:r)},l,l.exports,r,e,t,n)}return t[o].exports}for(var a="function"==typeof require&&require,o=0;or-n?n:i},c.ceil=function(r){return e(r=new Date(r-1)),t(r,1),r},c.offset=function(e,r){return t(e=new Date(+e),null==r?1:Math.floor(r)),e},c.range=function(r,n,i){var a=[];if(r=new Date(r-1),n=new Date(+n),i=null==i?1:Math.floor(i),!(n>r&&i>0))return a;for(t(r,1),e(r),n>r&&a.push(new Date(+r));t(r,i),e(r),n>r;)a.push(new Date(+r));return a},c.filter=function(n){return r(function(r){for(;e(r),!n(r);)r.setTime(r-1)},function(e,r){for(;--r>=0;)for(;t(e,1),!n(e););})},n&&(c.count=function(r,t){return i.setTime(+r),a.setTime(+t),e(i),e(a),Math.floor(n(i,a))},c.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?c.filter(o?function(r){return o(r)%e===0}:function(r){return c.count(0,r)%e===0}):c:null}),c}function t(e){return r(function(r){r.setHours(0,0,0,0),r.setDate(r.getDate()-(r.getDay()+7-e)%7)},function(e,r){e.setDate(e.getDate()+7*r)},function(e,r){return(r-e-6e4*(r.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function n(e){return r(function(r){r.setUTCHours(0,0,0,0),r.setUTCDate(r.getUTCDate()-(r.getUTCDay()+7-e)%7)},function(e,r){e.setUTCDate(e.getUTCDate()+7*r)},function(e,r){return(r-e)/6048e5})}var i=new Date,a=new Date,o=r(function(){},function(e,r){e.setTime(+e+r)},function(e,r){return r-e});o.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?r(function(r){r.setTime(Math.floor(r/e)*e)},function(r,t){r.setTime(+r+t*e)},function(r,t){return(t-r)/e}):o:null};var c=r(function(e){e.setMilliseconds(0)},function(e,r){e.setTime(+e+1e3*r)},function(e,r){return(r-e)/1e3},function(e){return e.getSeconds()}),u=r(function(e){e.setSeconds(0,0)},function(e,r){e.setTime(+e+6e4*r)},function(e,r){return(r-e)/6e4},function(e){return e.getMinutes()}),s=r(function(e){e.setMinutes(0,0,0)},function(e,r){e.setTime(+e+36e5*r)},function(e,r){return(r-e)/36e5},function(e){return e.getHours()}),l=r(function(e){e.setHours(0,0,0,0)},function(e,r){e.setDate(e.getDate()+r)},function(e,r){return(r-e-6e4*(r.getTimezoneOffset()-e.getTimezoneOffset()))/864e5},function(e){return e.getDate()-1}),p=t(0),E=t(1),f=t(2),T=t(3),S=t(4),d=t(5),A=t(6),y=r(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,r){e.setMonth(e.getMonth()+r)},function(e,r){return r.getMonth()-e.getMonth()+12*(r.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),I=r(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,r){e.setFullYear(e.getFullYear()+r)},function(e,r){return r.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}),g=r(function(e){e.setUTCMilliseconds(0)},function(e,r){e.setTime(+e+1e3*r)},function(e,r){return(r-e)/1e3},function(e){return e.getUTCSeconds()}),h=r(function(e){e.setUTCSeconds(0,0)},function(e,r){e.setTime(+e+6e4*r)},function(e,r){return(r-e)/6e4},function(e){return e.getUTCMinutes()}),N=r(function(e){e.setUTCMinutes(0,0,0)},function(e,r){e.setTime(+e+36e5*r)},function(e,r){return(r-e)/36e5},function(e){return e.getUTCHours()}),L=r(function(e){e.setUTCHours(0,0,0,0)},function(e,r){e.setUTCDate(e.getUTCDate()+r)},function(e,r){return(r-e)/864e5},function(e){return e.getUTCDate()-1}),O=n(0),m=n(1),C=n(2),_=n(3),v=n(4),R=n(5),P=n(6),D=r(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,r){e.setUTCMonth(e.getUTCMonth()+r)},function(e,r){return r.getUTCMonth()-e.getUTCMonth()+12*(r.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),M=r(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r)},function(e,r){return r.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}),U=o.range,G=c.range,x=u.range,F=s.range,X=l.range,b=p.range,B=E.range,H=f.range,k=T.range,w=S.range,Y=d.range,W=A.range,K=p.range,Q=y.range,V=I.range,Z=o,q=U,z=g.range,j=h.range,$=N.range,J=L.range,ee=O.range,re=m.range,te=C.range,ne=_.range,ie=v.range,ae=R.range,oe=P.range,ce=O.range,ue=D.range,se=M.range,le="0.1.1";e.version=le,e.milliseconds=U,e.seconds=G,e.minutes=x,e.hours=F,e.days=X,e.sundays=b,e.mondays=B,e.tuesdays=H,e.wednesdays=k,e.thursdays=w,e.fridays=Y,e.saturdays=W,e.weeks=K,e.months=Q,e.years=V,e.utcMillisecond=Z,e.utcMilliseconds=q,e.utcSeconds=z,e.utcMinutes=j,e.utcHours=$,e.utcDays=J,e.utcSundays=ee,e.utcMondays=re,e.utcTuesdays=te,e.utcWednesdays=ne,e.utcThursdays=ie,e.utcFridays=ae,e.utcSaturdays=oe,e.utcWeeks=ce,e.utcMonths=ue,e.utcYears=se,e.millisecond=o,e.second=c,e.minute=u,e.hour=s,e.day=l,e.sunday=p,e.monday=E,e.tuesday=f,e.wednesday=T,e.thursday=S,e.friday=d,e.saturday=A,e.week=p,e.month=y,e.year=I,e.utcSecond=g,e.utcMinute=h,e.utcHour=N,e.utcDay=L,e.utcSunday=O,e.utcMonday=m,e.utcTuesday=C,e.utcWednesday=_,e.utcThursday=v,e.utcFriday=R,e.utcSaturday=P,e.utcWeek=O,e.utcMonth=D,e.utcYear=M,e.interval=r})},{}],3:[function(e,r,t){function n(e){if(!e)throw Error("Missing binning options.");var r,t,n,c,u,s,l,p=e.maxbins||15,E=e.base||10,f=Math.log(E),T=e.div||[5,2],S=e.min,d=e.max,A=d-S;if(e.step)r=e.step;else if(e.steps)r=e.steps[Math.min(e.steps.length-1,i(e.steps,A/p,0,e.steps.length))];else{for(t=Math.ceil(Math.log(p)/f),n=e.minstep||0,r=Math.max(n,Math.pow(E,Math.round(Math.log(A)/f)-t));Math.ceil(A/r)>p;)r*=E;for(s=0;s=n&&p>=A/u&&(r=u)}return u=Math.log(r),c=u>=0?0:~~(-u/f)+1,l=Math.pow(E,-c-1),S=Math.min(S,Math.floor(S/r+l)*r),d=Math.ceil(d/r)*r,{start:S,stop:d,step:r,unit:{precision:c},value:a,index:o}}function i(e,r,t,n){for(;n>t;){var i=t+n>>>1;s.cmp(e[i],r)<0?t=i+1:n=i}return t}function a(e){return this.step*Math.floor(e/this.step+p)}function o(e){return Math.floor((e-this.start)/this.step+p)}function c(e){return this.unit.date(a.call(this,e))}function u(e){return o.call(this,this.unit.unit(e))}var s=e("../util"),l=e("../time"),p=1e-15;n.date=function(e){if(!e)throw Error("Missing date binning options.");var r=e.utc?l.utc:l,t=e.min,i=e.max,a=e.maxbins||20,o=e.minbins||4,s=+i-+t,p=e.unit?r[e.unit]:r.find(s,o,a),E=n({min:null!=p.min?p.min:p.unit(t),max:null!=p.max?p.max:p.unit(i),maxbins:a,minstep:p.minstep,steps:p.step});return E.unit=p,E.index=u,e.raw||(E.value=c),E},r.exports=n},{"../time":7,"../util":8}],4:[function(e,r,t){var n=e("./util"),i=r.exports;i.repeat=function(e,r){var t,n=Array(r);for(t=0;r>t;++t)n[t]=e;return n},i.zeros=function(e){return i.repeat(0,e)},i.range=function(e,r,t){if(arguments.length<3&&(t=1,arguments.length<2&&(r=e,e=0)),(r-e)/t==1/0)throw new Error("Infinite range");var n,i=[],a=-1;if(0>t)for(;(n=e+t*++a)>r;)i.push(n);else for(;(n=e+t*++a)=e&&r>=n?1/t:0},n.cdf=function(n){return e>n?0:n>r?1:(n-e)/t},n.icdf=function(r){return r>=0&&1>=r?e+r*t:NaN},n},i.random.integer=function(e,r){void 0===r&&(r=e,e=0);var t=r-e,n=function(){return e+Math.floor(t*Math.random())};return n.samples=function(e){return i.zeros(e).map(n)},n.pdf=function(n){return n===Math.floor(n)&&n>=e&&r>n?1/t:0},n.cdf=function(n){var i=Math.floor(n);return e>i?0:i>=r?1:(i-e+1)/t},n.icdf=function(r){return r>=0&&1>=r?e-1+Math.floor(r*t):NaN},n},i.random.normal=function(e,r){e=e||0,r=r||1;var t,n=function(){var n,i,a=0,o=0;if(void 0!==t)return a=t,t=void 0,a;do a=2*Math.random()-1,o=2*Math.random()-1,n=a*a+o*o;while(0===n||n>1);return i=Math.sqrt(-2*Math.log(n)/n),t=e+o*i*r,e+a*i*r};return n.samples=function(e){return i.zeros(e).map(n)},n.pdf=function(t){var n=Math.exp(Math.pow(t-e,2)/(-2*Math.pow(r,2)));return 1/(r*Math.sqrt(2*Math.PI))*n},n.cdf=function(t){var n,i=(t-e)/r,a=Math.abs(i);if(a>37)n=0;else{var o,c=Math.exp(-a*a/2);7.07106781186547>a?(o=.0352624965998911*a+.700383064443688,o=o*a+6.37396220353165,o=o*a+33.912866078383,o=o*a+112.079291497871,o=o*a+221.213596169931,o=o*a+220.206867912376,n=c*o,o=.0883883476483184*a+1.75566716318264,o=o*a+16.064177579207,o=o*a+86.7807322029461,o=o*a+296.564248779674,o=o*a+637.333633378831,o=o*a+793.826512519948,o=o*a+440.413735824752,n/=o):(o=a+.65,o=a+4/o,o=a+3/o,o=a+2/o,o=a+1/o,n=c/o/2.506628274631)}return i>0?1-n:n},n.icdf=function(t){if(0>=t||t>=1)return NaN;var n=2*t-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),a=2/(Math.PI*i)+Math.log(1-Math.pow(n,2))/2,o=Math.log(1-n*n)/i,c=(n>0?1:-1)*Math.sqrt(Math.sqrt(a*a-o)-a);return e+r*Math.SQRT2*c},n},i.random.bootstrap=function(e,r){var t=e.filter(n.isValid),a=t.length,o=r?i.random.normal(0,r):null,c=function(){return t[~~(Math.random()*a)]+(o?o():0)};return c.samples=function(e){return i.zeros(e).map(c)},c}},{"./util":8}],5:[function(e,r,t){function n(e,r){return r?void(e[s]=r):e&&e[s]||null}function i(e,r){e=u.array(e),r=u.$(r);var t,n,i;if(e[s]&&(t=r(e[s]),u.isString(t)))return t;for(n=0,i=e.length;!u.isValid(t)&&i>n;++n)t=r?r(e[n]):e[n];return u.isDate(t)?"date":u.isNumber(t)?"number":u.isBoolean(t)?"boolean":u.isString(t)?"string":null}function a(e,r){return e.length?(r=r||u.keys(e[0]),r.reduce(function(r,t){return r[t]=i(e,t),r},{})):void 0}function o(e,r){e=u.array(e),r=u.$(r);var t,n,i,a=["boolean","integer","number","date"];for(t=0;ti;++i)o.isValid(a[i])&&o.isValid(c[i])&&p.push(a[i]-c[i]);return s.z.test(p,e&&e.nullh||0)}function a(e,r,t,n){var i=n?r.map(o.$(t)):r,a=n?r.map(o.$(n)):t,c=s.count.valid(i),l=s.count.valid(a),p=u.random.normal(0,1),E=s.mean(i)-s.mean(a)-(e&&e.nullh||0),f=Math.sqrt(s.variance(i)/c+s.variance(a)/l);if(0===f)return 0===E?1:0;var T=E/f;return 2*p.cdf(-Math.abs(T))}var o=e("./util"),c=e("./import/type"),u=e("./generate"),s=r.exports;s.unique=function(e,r,t){r=o.$(r),t=t||[];var n,i,a,c={};for(i=0,a=e.length;a>i;++i)n=r?r(e[i]):e[i],n in c||(c[n]=1,t.push(n));return t},s.count=function(e){return e&&e.length||0},s.count.valid=function(e,r){r=o.$(r);var t,n,i,a=0;for(n=0,i=e.length;i>n;++n)t=r?r(e[n]):e[n],o.isValid(t)&&(a+=1);return a},s.count.missing=function(e,r){r=o.$(r);var t,n,i,a=0;for(n=0,i=e.length;i>n;++n)t=r?r(e[n]):e[n],null==t&&(a+=1);return a},s.count.distinct=function(e,r){r=o.$(r);var t,n,i,a={},c=0;for(n=0,i=e.length;i>n;++n)t=r?r(e[n]):e[n],t in a||(a[t]=1,c+=1);return c},s.count.map=function(e,r){r=o.$(r);var t,n,i,a={};for(n=0,i=e.length;i>n;++n)t=r?r(e[n]):e[n],a[t]=t in a?a[t]+1:1;return a},s.median=function(e,r){return r&&(e=e.map(o.$(r))),e=e.filter(o.isValid).sort(o.cmp),s.quantile(e,.5)},s.quartile=function(e,r){r&&(e=e.map(o.$(r))),e=e.filter(o.isValid).sort(o.cmp);var t=s.quantile;return[t(e,.25),t(e,.5),t(e,.75)]},s.quantile=function(e,r,t){void 0===t&&(t=r,r=o.identity),r=o.$(r);var n=(e.length-1)*t+1,i=Math.floor(n),a=+r(e[i-1]),c=n-i;return c?a+c*(r(e[i])-a):a},s.sum=function(e,r){r=o.$(r);for(var t,n=0,i=0,a=e.length;a>i;++i)t=r?r(e[i]):e[i],o.isValid(t)&&(n+=t);return n},s.mean=function(e,r){r=o.$(r);var t,n,i,a,c,u=0;for(n=0,a=0,i=e.length;i>n;++n)c=r?r(e[n]):e[n],o.isValid(c)&&(t=c-u,u+=t/++a);return u},s.mean.geometric=function(e,r){r=o.$(r);var t,n,i,a,c=1;for(a=0,t=0,n=e.length;n>a;++a)if(i=r?r(e[a]):e[a],o.isValid(i)){if(0>=i)throw Error("Geometric mean only defined for positive values.");c*=i,++t}return c=t>0?Math.pow(c,1/t):0},s.mean.harmonic=function(e,r){r=o.$(r);var t,n,i,a,c=0;for(a=0,t=0,n=e.length;n>a;++a)i=r?r(e[a]):e[a],o.isValid(i)&&(c+=1/i,++t);return t/c},s.variance=function(e,r){if(r=o.$(r),!o.isArray(e)||e.length<2)return 0;var t,n,i,a,c=0,u=0;for(n=0,i=0;na;++a)if(i=r?r(e[a]):e[a],o.isValid(i)){t=n=i;break}for(;c>a;++a)i=r?r(e[a]):e[a],o.isValid(i)&&(t>i&&(t=i),i>n&&(n=i));return[t,n]},s.extent.index=function(e,r){r=o.$(r);var t,n,i,a,c=-1,u=-1,s=e.length;for(a=0;s>a;++a)if(i=r?r(e[a]):e[a],o.isValid(i)){t=n=i,c=u=a;break}for(;s>a;++a)i=r?r(e[a]):e[a],o.isValid(i)&&(t>i&&(t=i,c=a),i>n&&(n=i,u=a));return[c,u]},s.dot=function(e,r,t){var n,i,a=0;if(t)for(r=o.$(r),t=o.$(t),n=0;na;++a)i=c?r(u[a])-t(s[a]):u[a]-s[a],f+=p?i*i:Math.pow(Math.abs(i),l);return p?Math.sqrt(f):Math.pow(f,1/l)},s.cohensd=function(e,r,t){var n=t?e.map(o.$(r)):e,i=t?e.map(o.$(t)):r,a=s.mean(n),c=s.mean(i),u=s.count.valid(n),l=s.count.valid(i);if(0>=u+l-2)return 0;var p=s.variance(n),E=s.variance(i),f=Math.sqrt(((u-1)*p+(l-1)*E)/(u+l-2));return 0===f?0:(a-c)/f},s.covariance=function(e,r,t){var n,i,a,c,u,l=t?e.map(o.$(r)):e,p=t?e.map(o.$(t)):r,E=l.length,f=s.mean(l),T=s.mean(p),S=0,d=0;if(E!==p.length)throw Error("Input lengths must match.");for(n=0;E>n;++n)if(i=l[n],c=o.isValid(i),a=p[n],u=o.isValid(a),c&&u)S+=(i-f)*(a-T),++d;else if(c||u)throw Error("Valid values must align.");return S/(d-1)},s.rank=function(e,r){r=o.$(r)||o.identity;var t,n,i,a=e.map(function(e,t){return{idx:t,val:r(e)}}).sort(o.comparator("val")),c=e.length,u=Array(c),s=-1,l={};for(t=0;c>t;++t){if(n=a[t].val,0>s&&l===n)s=t-1;else if(s>-1&&l!==n){for(i=1+(t-1+s)/2;t>s;++s)u[a[s].idx]=i;s=-1}u[a[t].idx]=t+1,l=n}if(s>-1)for(i=1+(c-1+s)/2;c>s;++s)u[a[s].idx]=i;return u},s.cor=function(e,r,t){var n=t;t=n?e.map(o.$(t)):r,r=n?e.map(o.$(r)):e;var i=s.dot(r,t),a=s.mean(r),c=s.mean(t),u=s.stdev(r),l=s.stdev(t),p=e.length;return(i-p*a*c)/((p-1)*u*l)},s.cor.rank=function(e,r,t){var n,i,a,o=t?s.rank(e,r):s.rank(e),c=t?s.rank(e,t):s.rank(r),u=e.length;for(n=0,i=0;u>n;++n)a=o[n]-c[n],i+=a*a;return 1-6*i/(u*(u*u-1))},s.cor.dist=function(e,r,t){var n,i,a,c,u=t?e.map(o.$(r)):e,l=t?e.map(o.$(t)):r,p=s.dist.mat(u),E=s.dist.mat(l),f=p.length;for(n=0,i=0,a=0,c=0;f>n;++n)i+=p[n]*p[n],a+=E[n]*E[n],c+=p[n]*E[n];return Math.sqrt(c/Math.sqrt(i*a))},s.linearRegression=function(e,r,t){var n,i,a=t?e.map(o.$(r)):e,c=t?e.map(o.$(t)):r,u=a.length,l=s.covariance(a,c),p=s.stdev(a),E=s.stdev(c),f=l/(p*p),T=s.mean(c)-f*s.mean(a),S={slope:f,intercept:T,R:l/(p*E),rss:0};for(i=0;u>i;++i)o.isValid(a[i])&&o.isValid(c[i])&&(n=f*a[i]+T-c[i],S.rss+=n*n);return S},s.bootstrap={},s.bootstrap.ci=function(e,r,t,n,i){var a,c,l,p,E,f,T;for(o.isFunction(r)||o.isString(r)?(a=e.map(o.$(r)),c=t,l=n,p=i):(a=e,c=r,l=t,p=n),c=c?+c:1e3,l=l||.05,E=u.random.bootstrap(a,p),T=0,f=Array(c);c>T;++T)f[T]=s.mean(E.samples(a.length));return f.sort(o.numcmp),[s.quantile(f,l/2),s.quantile(f,1-l/2)]},s.z={},s.z.ci=function(e,r,t){var n=e,i=r;(o.isFunction(r)||o.isString(r))&&(n=e.map(o.$(r)),i=t),i=i||.05;var a=.05===i?1.96:u.random.normal(0,1).icdf(1-i/2),c=s.mean(n),l=s.stdev(n)/Math.sqrt(s.count.valid(n));return[c-a*l,c+a*l]},s.z.test=function(e,r,t,c){return o.isFunction(t)||o.isString(t)?(c&&c.paired?i:a)(c,e,r,t):o.isArray(r)?(t&&t.paired?i:a)(t,e,r):o.isFunction(r)||o.isString(r)?n(t,e,r):n(r,e)},s.dist.mat=function(e){var r,t,n,i=e.length,a=i*i,o=Array(a),c=u.zeros(i),s=0;for(t=0;i>t;++t)for(o[t*i+t]=0,n=t+1;i>n;++n)o[t*i+n]=r=Math.abs(e[t]-e[n]),o[n*i+t]=r,c[t]+=r,c[n]+=r;for(t=0;i>t;++t)s+=c[t],c[t]/=i;for(s/=a,t=0;i>t;++t)for(n=t;i>n;++n)o[t*i+n]+=s-c[t]-c[n],o[n*i+t]=o[t*i+n];return o},s.entropy=function(e,r){r=o.$(r);var t,n,i=0,a=0,c=e.length;for(t=0;c>t;++t)i+=r?r(e[t]):e[t];if(0===i)return 0;for(t=0;c>t;++t)n=(r?r(e[t]):e[t])/i,n&&(a+=n*Math.log(n));return-a/Math.LN2},s.mutual=function(e,r,t,n){var i,a,c,u=n?e.map(o.$(r)):e,s=n?e.map(o.$(t)):r,l=n?e.map(o.$(n)):t,p={},E={},f=l.length,T=0,S=0,d=0;for(c=0;f>c;++c)p[u[c]]=0,E[s[c]]=0;for(c=0;f>c;++c)p[u[c]]+=l[c],E[s[c]]+=l[c],T+=l[c];for(a=1/(T*Math.LN2),c=0;f>c;++c)0!==l[c]&&(i=T*l[c]/(p[u[c]]*E[s[c]]),S+=l[c]*a*Math.log(i),d+=l[c]*a*Math.log(l[c]/T));return[S,1+S/d]},s.mutual.info=function(e,r,t,n){return s.mutual(e,r,t,n)[0]},s.mutual.dist=function(e,r,t,n){return s.mutual(e,r,t,n)[1]},s.profile=function(e,r){var t,n,i,a,u,l=0,p=0,E=0,f=0,T=null,S=null,d=0,A=[],y={};for(i=0;iu)&&(T=u),(null===S||u>S)&&(S=u),t=u-l,l+=t/++p,d+=t*(u-l),A.push(u));return d/=p-1,n=Math.sqrt(d),A.sort(o.cmp),{type:c(e,r),unique:y,count:e.length,valid:p,missing:E,distinct:f,min:T,max:S,mean:l,stdev:n,median:a=s.quantile(A,.5),q1:s.quantile(A,.25),q3:s.quantile(A,.75),modeskew:0===n?0:(l-a)/n}},s.summary=function(e,r){r=r||o.keys(e[0]);var t=r.map(function(r){var t=s.profile(e,o.$(r));return t.field=r,t});return t.__summary__=!0,t}},{"./generate":4,"./import/type":5,"./util":8}],7:[function(e,r,t){function n(e){return s.setTime(+e),s}function i(e,r,t,n,i,a){var o={type:e,date:r,unit:t};return n?o.step=n:o.minstep=1,null!=i&&(o.min=i),null!=a&&(o.max=a),o}function a(e,r,t,n,a,o){return i(e,function(e){return r.offset(t,e)},function(e){return r.count(t,e)},n,a,o)}function o(e,r,t,n){var i,a,o,c=T[0];for(i=1,a=T.length;a>i;++i)if(c=T[i],r>c[0]){if(o=r/c[0],o>n)return e[T[i-1][1]];if(o>=t)return e[c[1]]}return e[T[a-1][1]]}function c(e){var r,t,n={};for(r=0,t=e.length;t>r;++r)n[e[r].type]=e[r];return n.find=function(r,t,n){return o(e,r,t,n)},n}var u=e("d3-time"),s=new Date,l=new Date(0,0,1).setFullYear(0),p=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),E=[a("second",u.second,l),a("minute",u.minute,l),a("hour",u.hour,l),a("day",u.day,l,[1,7]),a("month",u.month,l,[1,3,6]),a("year",u.year,l),i("seconds",function(e){return new Date(1970,0,1,0,0,e)},function(e){return n(e).getSeconds()},null,0,59),i("minutes",function(e){return new Date(1970,0,1,0,e)},function(e){return n(e).getMinutes()},null,0,59),i("hours",function(e){return new Date(1970,0,1,e)},function(e){return n(e).getHours()},null,0,23),i("weekdays",function(e){return new Date(1970,0,4+e)},function(e){return n(e).getDay()},[1],0,6),i("dates",function(e){return new Date(1970,0,e)},function(e){return n(e).getDate()},[1],1,31),i("months",function(e){return new Date(1970,e%12,1)},function(e){return n(e).getMonth()},[1],0,11)],f=[a("second",u.utcSecond,p),a("minute",u.utcMinute,p),a("hour",u.utcHour,p),a("day",u.utcDay,p,[1,7]),a("month",u.utcMonth,p,[1,3,6]),a("year",u.utcYear,p),i("seconds",function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return n(e).getUTCSeconds()},null,0,59),i("minutes",function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return n(e).getUTCMinutes()},null,0,59),i("hours",function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return n(e).getUTCHours()},null,0,23),i("weekdays",function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return n(e).getUTCDay()},[1],0,6),i("dates",function(e){return new Date(Date.UTC(1970,0,e))},function(e){return n(e).getUTCDate()},[1],1,31),i("months",function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return n(e).getUTCMonth()},[1],0,11)],T=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];r.exports=c(E),r.exports.utc=c(f)},{"d3-time":2}],8:[function(e,r,t){(function(e){function t(e,r){var t,n="";for(t=0;e>t;++t)n+=r;return n}function n(e,r,t){var n=0,i=e.split(u);return e=t?(i=i.reverse()).filter(function(e){return n+=e.length,r>=n}).reverse():i.filter(function(e){return n+=e.length,r>=n}),e.length?e.join("").trim():i[0].slice(0,r)}var i=r.exports,a="__name__";i.namedfunc=function(e,r){return r[a]=e,r},i.name=function(e){return null==e?null:e[a]},i.identity=function(e){return e},i["true"]=i.namedfunc("true",function(){return!0}),i["false"]=i.namedfunc("false",function(){return!1}),i.duplicate=function(e){return JSON.parse(JSON.stringify(e))},i.equal=function(e,r){return JSON.stringify(e)===JSON.stringify(r)},i.extend=function(e){for(var r,t,n=1,i=arguments.length;i>n;++n){r=arguments[n];for(t in r)e[t]=r[t]}return e},i.length=function(e){return null!=e&&null!=e.length?e.length:null},i.keys=function(e){var r,t=[];for(r in e)t.push(r);return t},i.vals=function(e){var r,t=[];for(r in e)t.push(e[r]);return t},i.toMap=function(e,r){return(r=i.$(r))?e.reduce(function(e,t){return e[r(t)]=1,e},{}):e.reduce(function(e,r){return e[r]=1,e},{})},i.keystr=function(e){var r=e.length;if(!r)return"";for(var t=String(e[0]),n=1;r>n;++n)t+="|"+String(e[n]);return t};var o=Object.prototype.toString;i.isObject=function(e){return e===Object(e)},i.isFunction=function(e){return"[object Function]"===o.call(e)},i.isString=function(e){return"string"==typeof value||"[object String]"===o.call(e)},i.isArray=Array.isArray||function(e){return"[object Array]"===o.call(e)},i.isNumber=function(e){return"number"==typeof e||"[object Number]"===o.call(e)},i.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==o.call(e)},i.isDate=function(e){return"[object Date]"===o.call(e)},i.isValid=function(e){return null!=e&&e===e},i.isBuffer="function"==typeof e&&e.isBuffer||i["false"],i.number=function(e){return null==e||""===e?null:+e},i["boolean"]=function(e){return null==e||""===e?null:"false"===e?!1:!!e},i.date=function(e,r){var t=r?r:Date;return null==e||""===e?null:t.parse(e)},i.array=function(e){return null!=e?i.isArray(e)?e:[e]:[]},i.str=function(e){return i.isArray(e)?"["+e.map(i.str)+"]":i.isObject(e)||i.isString(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e};var c=/\[(.*?)\]|[^.\[]+/g;i.field=function(e){return String(e).match(c).map(function(e){return"["!==e[0]?e:"'"!==e[1]&&'"'!==e[1]?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,"$1")})},i.accessor=function(e){return null==e||i.isFunction(e)?e:i.namedfunc(e,Function("x","return x["+i.field(e).map(i.str).join("][")+"];"))},i.$=i.accessor,i.mutator=function(e){var r;return i.isString(e)&&(r=i.field(e)).length>1?function(e,t){for(var n=0;ni;++i){if(o=e[i],c=o(t),u=o(n),u>c)return-1*r[i];if(c>u)return r[i]}return 0}},i.cmp=function(e,r){return r>e?-1:e>r?1:e>=r?0:null===e?-1:null===r?1:NaN},i.numcmp=function(e,r){return e-r},i.stablesort=function(e,r,t){var n=e.reduce(function(e,r,n){return e[t(r)]=n,e},{});return e.sort(function(e,i){var a=r(e),o=r(i);return o>a?-1:a>o?1:n[t(e)]-n[t(i)]}),e},i.permute=function(e){for(var r,t,n=e.length;n;)t=Math.floor(Math.random()*n--),r=e[n],e[n]=e[t],e[t]=r},i.pad=function(e,r,n,i){i=i||" ";var a=r-e.length;if(0>=a)return e;switch(n){case"left":return t(a,i)+e;case"middle":case"center":return t(Math.floor(a/2),i)+e+t(Math.ceil(a/2),i);default:return e+t(a,i)}},i.truncate=function(e,r,t,i,a){var o=e.length;if(r>=o)return e;a=void 0!==a?String(a):"…";var c=Math.max(0,r-a.length);switch(t){case"left":return a+(i?n(e,c,1):e.slice(o-c));case"middle":case"center":var u=Math.ceil(c/2),s=Math.floor(c/2);return(i?n(e,u):e.slice(0,u))+a+(i?n(e,s,1):e.slice(o-s));default:return(i?n(e,c):e.slice(0,c))+a}};var u=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/}).call(this,e("buffer").Buffer)},{buffer:1}],9:[function(e,r,t){"use strict";var n=e("vega-lite/src/channel"),i=e("vega-lite/src/aggregate"),a=e("vega-lite/src/mark"),o=e("vega-lite/src/scale"),c=e("vega-lite/src/sort"),u=e("vega-lite/src/timeunit"),s=e("vega-lite/src/type"),l=e("./property");t.DEFAULT_QUERY_CONFIG={verbose:!1,defaultSpecConfig:{overlay:{line:!0},scale:{useRawDomain:!0}},propertyPrecedence:l.DEFAULT_PROPERTY_PRECEDENCE,marks:[a.Mark.POINT,a.Mark.BAR,a.Mark.LINE,a.Mark.AREA,a.Mark.TICK],channels:[n.X,n.Y,n.ROW,n.COLUMN,n.SIZE,n.COLOR],aggregates:[void 0,i.AggregateOp.MEAN],timeUnits:[void 0,u.TimeUnit.YEAR,u.TimeUnit.MONTH,u.TimeUnit.DATE,u.TimeUnit.MINUTES,u.TimeUnit.SECONDS],types:[s.Type.NOMINAL,s.Type.ORDINAL,s.Type.QUANTITATIVE,s.Type.TEMPORAL],maxBinsList:[5,10,20],axisAxisColors:[void 0],axisAxisWidths:[void 0],axisLayers:["front","back"],axisOffsets:[void 0],axisOrients:[void 0],axisGridColors:[void 0],axisGridDashes:[void 0],axisGridOpacities:[void 0],axisGridWidths:[void 0],axisFormats:[void 0],axisLabelAngles:[void 0],axisLabelMaxLengths:[void 0],axisSubDivides:[void 0],axisTicks:[void 0],axisTickColors:[void 0],axisTickLabelColors:[void 0],axisTickLabelFonts:[void 0],axisTickLabelFontSizes:[void 0],axisTickPaddings:[void 0],axisTickSizes:[void 0],axisTickSizeMajors:[void 0],axisTickSizeMinors:[void 0],axisTickSizeEnds:[void 0],axisTickWidths:[void 0],axisValuesList:[void 0],axisTitles:[void 0],axisTitleColors:[void 0],axisTitleFonts:[void 0],axisTitleFontWeights:[void 0],axisTitleFontSizes:[void 0],axisTitleOffsets:[void 0],axisTitleMaxLengths:[void 0],axisCharacterWidths:[void 0],legendOrients:["left","right"],legendOffsets:[void 0],legendValuesList:[void 0],legendFormats:[void 0],legendLabelAligns:[void 0],legendLabelBaselines:[void 0],legendLabelColors:[void 0],legendLabelFonts:[void 0],legendLabelFontSizes:[void 0],legendSymbolColors:[void 0],legendSymbolShapes:[void 0],legendSymbolSizes:[void 0],legendSymbolStrokeWidths:[void 0],legendTitles:[void 0],legendTitleColors:[void 0],legendTitleFonts:[void 0],legendTitleFontSizes:[void 0],legendTitleFontWeights:[void 0],sorts:[c.SortOrder.ASCENDING,c.SortOrder.DESCENDING],sortOps:[i.AggregateOp.MIN,i.AggregateOp.MEAN],sortOrders:[c.SortOrder.ASCENDING,c.SortOrder.DESCENDING],scaleBandSizes:[17,21],scaleDomains:[void 0],scaleExponents:[1],scaleRanges:[void 0],scaleTypes:[void 0,o.ScaleType.LOG],numberOrdinalProportion:.05,numberOrdinalLimit:50,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitFacetOverPositionalChannels:!0,omitMultipleNonPositionalChannels:!0,omitNonSumStack:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,preferredBinAxis:n.Channel.X,preferredTemporalAxis:n.Channel.X,preferredOrdinalAxis:n.Channel.Y,preferredNominalAxis:n.Channel.Y,preferredFacet:n.Channel.ROW,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,smallBandSizeForHighCardinalityOrFacet:{maxCardinality:10,bandSize:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:"category20"},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7}},{"./property":21,"vega-lite/src/aggregate":42,"vega-lite/src/channel":45,"vega-lite/src/mark":50,"vega-lite/src/scale":51,"vega-lite/src/sort":52,"vega-lite/src/timeunit":54,"vega-lite/src/type":55}],10:[function(e,r,t){"use strict";var n=function(){function e(e){this.constraint=e}return e.prototype.name=function(){return this.constraint.name},e.prototype.description=function(){return this.constraint.description},e.prototype.properties=function(){return this.constraint.properties},e.prototype.strict=function(){return this.constraint.strict},e}();t.AbstractConstraintModel=n},{}],11:[function(e,r,t){"use strict";var n=e("./encoding"),i=e("./spec");t.encoding=n,t.spec=i},{"./encoding":12,"./spec":13}],12:[function(e,r,t){"use strict";function n(e,r,n,i,a,o){for(var c=t.ENCODING_CONSTRAINTS_BY_PROPERTY[e]||[],u=i.getEncodingQueryByIndex(n),s=0;s=n}},{name:"timeUnitAppliedForTemporal",description:"Time unit should be applied to temporal field only.",properties:[s.Property.TYPE,s.Property.TIMEUNIT],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,r,t){return!e.timeUnit||e.type===c.Type.TEMPORAL}},{name:"timeUnitShouldHaveVariation",description:"A particular time unit should be applied only if they produce unique values.",properties:[s.Property.TIMEUNIT,s.Property.TYPE],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return e.timeUnit&&e.type===c.Type.TEMPORAL?r.timeUnitHasVariation(e):!0}},{name:"scalePropertiesSupportedByScaleType",description:"Scale properties must be supported by correct scale type",properties:s.SCALE_PROPERTIES.concat([s.Property.SCALE,s.Property.TYPE]),allowEnumSpecForProperties:!0,strict:!0,satisfy:function(e,r,t){if(e.scale){var n=e.scale,i=f.scaleType(e);if(void 0===i)return!0;for(var a in n)if(s.SUPPORTED_SCALE_PROPERTY_INDEX[a]&&!E.contains(s.SUPPORTED_SCALE_PROPERTY_INDEX[a],i))return!1}return!0}},{name:"typeMatchesPrimitiveType",description:"Data type should be supported by field's primitive type.",properties:[s.Property.FIELD,s.Property.TYPE],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,r,t){var n=r.primitiveType(e.field),i=e.type;switch(n){case p.PrimitiveType.BOOLEAN:case p.PrimitiveType.STRING:return i!==c.Type.QUANTITATIVE&&i!==c.Type.TEMPORAL;case p.PrimitiveType.NUMBER:case p.PrimitiveType.INTEGER:return i!==c.Type.TEMPORAL;case p.PrimitiveType.DATE:return i===c.Type.TEMPORAL;case null:return!1}throw new Error("Not implemented")}},{name:"typeMatchesSchemaType",description:"Enumerated data type of a field should match the field's type in the schema.",properties:[s.Property.FIELD,s.Property.TYPE],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return r.type(e.field)===e.type}},{name:"maxCardinalityForCategoricalColor",description:"Categorical channel should not have too high cardinality",properties:[s.Property.CHANNEL,s.Property.FIELD],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return e.channel===a.Channel.COLOR&&e.type===c.Type.NOMINAL?r.cardinality(e)<=t.maxCardinalityForCategoricalColor:!0}},{name:"maxCardinalityForFacet",description:"Row/column channel should not have too high cardinality",properties:[s.Property.CHANNEL,s.Property.FIELD,s.Property.BIN,s.Property.TIMEUNIT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return e.channel===a.Channel.ROW||e.channel===a.Channel.COLUMN?r.cardinality(e)<=t.maxCardinalityForFacet:!0}},{name:"maxCardinalityForShape",description:"Shape channel should not have too high cardinality",properties:[s.Property.CHANNEL,s.Property.FIELD,s.Property.BIN,s.Property.TIMEUNIT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return e.channel===a.Channel.SHAPE?r.cardinality(e)<=t.maxCardinalityForShape:!0}},{name:"dataTypeAndFunctionMatchScaleType",description:"Scale type must match data type",properties:[s.Property.TYPE,s.Property.SCALE,s.Property.SCALE_TYPE,s.Property.TIMEUNIT,s.Property.BIN],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,r,t){if(e.scale){var n=e.type,i=f.scaleType(e);if(E.contains([c.Type.ORDINAL,c.Type.NOMINAL],n))return E.contains([o.ScaleType.ORDINAL,void 0],i);if(n===c.Type.TEMPORAL)return e.timeUnit?E.contains([o.ScaleType.TIME,o.ScaleType.UTC,o.ScaleType.ORDINAL,void 0],i):E.contains([o.ScaleType.TIME,o.ScaleType.UTC,void 0],i);if(n===c.Type.QUANTITATIVE)return e.bin?E.contains([o.ScaleType.LINEAR,void 0],i):E.contains([o.ScaleType.LOG,o.ScaleType.POW,o.ScaleType.SQRT,o.ScaleType.QUANTILE,o.ScaleType.QUANTIZE,o.ScaleType.LINEAR,void 0],i)}return!0}}].map(function(e){return new T(e)}),t.ENCODING_CONSTRAINT_INDEX=t.ENCODING_CONSTRAINTS.reduce(function(e,r){return e[r.name()]=r,e},{}),t.ENCODING_CONSTRAINTS_BY_PROPERTY=t.ENCODING_CONSTRAINTS.reduce(function(e,r){return r.properties().forEach(function(t){e[t]=e[t]||[],e[t].push(r)}),e},{}),t.checkEncoding=n},{"../enumspec":16,"../property":21,"../query/encoding":22,"../schema":34,"../util":36,"./base":10,"vega-lite/src/channel":45,"vega-lite/src/scale":51,"vega-lite/src/type":55}],13:[function(e,r,t){"use strict";function n(e,r,n,i,a){for(var o=t.SPEC_CONSTRAINTS_BY_PROPERTY[e]||[],c=0;c1))return!1}return!0}},{name:"omitNonPositionalOverPositionalChannels",description:"Do not use non-positional channels unless all positional channels are used",properties:[E.Property.CHANNEL],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return T.some(o.NONSPATIAL_CHANNELS,function(r){return e.channelUsed(r)})?e.channelUsed(o.Channel.X)&&e.channelUsed(o.Channel.Y):!0}},{name:"omitRaw",description:"Omit raw plots.",properties:[E.Property.AGGREGATE,E.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return!!e.isAggregate()}},{name:"omitRawContinuousFieldForAggregatePlot",description:"Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)",properties:[E.Property.AGGREGATE,E.Property.AUTOCOUNT,E.Property.TIMEUNIT,E.Property.BIN,E.Property.TYPE],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,r,t){return e.isAggregate()?T.every(e.getEncodings(),function(e){return e.type===s.Type.TEMPORAL?!!e.timeUnit:e.type===s.Type.QUANTITATIVE?!!e.bin||!!e.aggregate||!!e.autoCount:!0}):!0}},{name:"omitRawDetail",description:"Do not use detail channel with raw plot.",properties:[E.Property.CHANNEL,E.Property.AGGREGATE,E.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,r,t){return e.isAggregate()?!0:T.every(e.getEncodings(),function(e){return e.channel!==o.Channel.DETAIL})}},{name:"omitRepeatedField",description:"Each field should be mapped to only one channel",properties:[E.Property.FIELD],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,r,t){var n={};return T.every(e.getEncodings(),function(e){return e.field&&!p.isEnumSpec(e.field)?n[e.field]?!1:(n[e.field]=!0,!0):!0})}},{name:"omitVerticalDotPlot",description:"Do not output vertical dot plot.",properties:[E.Property.CHANNEL],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,r,t){var n=e.getEncodings();return 1!==n.length||n[0].channel!==o.Channel.Y}},{name:"hasAppropriateGraphicTypeForMark",description:"Has appropriate graphic type for mark",properties:[E.Property.CHANNEL,E.Property.MARK,E.Property.TYPE,E.Property.TIMEUNIT,E.Property.BIN,E.Property.AGGREGATE,E.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){var n=e.getMark();switch(n){case c.Mark.AREA:case c.Mark.LINE:if(e.isAggregate()){var i=e.getEncodingQueryByChannel(o.Channel.X),a=e.getEncodingQueryByChannel(o.Channel.Y),u=i&&S.isMeasure(i),l=a&&S.isMeasure(a);return i&&a&&u!==l&&!(!u&&i.type===s.Type.NOMINAL)&&!(!l&&a.type===s.Type.NOMINAL)}return!0;case c.Mark.TEXT:return!0;case c.Mark.BAR:case c.Mark.TICK:return e.channelUsed(o.Channel.SIZE)?!1:e.isMeasure(o.Channel.X)!==e.isMeasure(o.Channel.Y);case c.Mark.CIRCLE:case c.Mark.POINT:case c.Mark.SQUARE:case c.Mark.RULE:return!0}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+n)}},{name:"omitNonSumStack",description:"Stacked plot should use summative aggregation such as sum, count, or distinct",properties:[E.Property.CHANNEL,E.Property.MARK,E.Property.AGGREGATE,E.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){var n=e.stack();if(n){var i=e.getEncodingQueryByChannel(n.fieldChannel);return T.contains(a.SUM_OPS,i.aggregate)||!!i.autoCount}return!0}},{name:"omitTableWithOcclusionIfAutoAddCount",description:"Plots without aggregation or autocount where x and y are both dimensions should be omitted if autoAddCount is enabled as they often lead to occlusion",properties:[E.Property.CHANNEL,E.Property.TYPE,E.Property.TIMEUNIT,E.Property.BIN,E.Property.AGGREGATE,E.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,r,t){return!(t.autoAddCount&&e.isDimension(o.Channel.X)&&e.isDimension(o.Channel.Y))||e.isAggregate()}}].map(function(e){return new d(e)}),t.SPEC_CONSTRAINT_INDEX=t.SPEC_CONSTRAINTS.reduce(function(e,r){return e[r.name()]=r,e},{}),t.SPEC_CONSTRAINTS_BY_PROPERTY=t.SPEC_CONSTRAINTS.reduce(function(e,r){return r.properties().forEach(function(t){e[t]=e[t]||[],e[t].push(r)}),e},{}),t.checkSpec=n},{"../enumspec":16,"../property":21,"../query/encoding":22,"../util":36,"./base":10,"vega-lite/src/aggregate":42,"vega-lite/src/channel":45,"vega-lite/src/mark":50,"vega-lite/src/scale":51,"vega-lite/src/type":55}],14:[function(e,r,t){"use strict";t.version="0.5.2";var n=e("./util");t.constraint=e("./constraint/constraint"),t.enumerate=e("./enumerator"),t.enumSpec=e("./enumspec");var i=e("./generate");t.generate=i.generate,t.model=e("./model"),t.nest=e("./nest"),t.property=e("./property");var a=e("./query/query"),o=e("./query/query");t.query=n.extend(o.query,a),t.ranking=e("./ranking/ranking"),t.schema=e("./schema"),t.util=e("./util")},{"./constraint/constraint":11,"./enumerator":15,"./enumspec":16,"./generate":18,"./model":19,"./nest":20,"./property":21,"./query/query":24,"./ranking/ranking":33,"./schema":34,"./util":36}],15:[function(e,r,t){"use strict";function n(e){return function(r,t,n){return function(o,c){function u(l){if(l===s.length)return void o.push(c.duplicate());var p=s[l],E=r.encodings[p][e],f=c.getEncodingQueryByIndex(p),T=c.getEncodingProperty(p,e);f.autoCount!==!1&&T?(E["enum"].forEach(function(r){null===r&&(r=void 0),c.setEncodingProperty(p,e,r,E);var o=i.checkEncoding(e,E,p,c,t,n);if(!o){var s=a.checkSpec(e,E,c,t,n);s||u(l+1)}}),c.resetEncodingProperty(p,e,E)):u(l+1)}var s=r.encodingIndicesByProperty[e];return u(0),o}}}var i=e("./constraint/encoding"),a=e("./constraint/spec"),o=e("./property");t.ENUMERATOR_INDEX={},t.ENUMERATOR_INDEX[o.Property.MARK]=function(e,r,t){return function(n,i){var c=i.getMark();return c["enum"].forEach(function(c){i.setMark(c);var u=a.checkSpec(o.Property.MARK,e.mark,i,r,t);u||n.push(i.duplicate())}),i.resetMark(),n}},o.ENCODING_PROPERTIES.forEach(function(e){t.ENUMERATOR_INDEX[e]=n(e)}),o.NESTED_ENCODING_PROPERTIES.forEach(function(e){t.ENUMERATOR_INDEX[e.property]=n(e.property)}),t.EncodingPropertyGeneratorFactory=n},{"./constraint/encoding":12,"./constraint/spec":13,"./property":21}],16:[function(e,r,t){"use strict";function n(e){return e===t.SHORT_ENUM_SPEC||void 0!==e&&(!!e["enum"]||!!e.name)&&!a.isArray(e)}function i(e,r,n){return a.extend({},{name:r,"enum":n},e===t.SHORT_ENUM_SPEC?{}:e)}var a=e("./util");!function(e){e[e.ENUMSPEC="?"]="ENUMSPEC"}(t.ShortEnumSpec||(t.ShortEnumSpec={}));var o=t.ShortEnumSpec;t.SHORT_ENUM_SPEC=o.ENUMSPEC,t.isEnumSpec=n,t.initEnumSpec=i},{"./util":36}],17:[function(e,r,t){"use strict";var n=e("./property"),i=e("./util"),a=function(){function e(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty={}}return e.prototype.setEncodingProperty=function(e,r,t){var n=this._encodings,i=n[e]=n[e]||{};i[r]=t;var a=this._encodingIndicesByProperty;return(a[r]=a[r]||[]).push(e),this},e.prototype.hasProperty=function(e){if(n.isEncodingProperty(e))return!!this.encodingIndicesByProperty[e];if(e===n.Property.MARK)return!!this.mark;throw new Error("Unimplemented for property "+e)},e.prototype.isEmpty=function(){return!this.mark&&0===i.keys(this.encodingIndicesByProperty).length},e.prototype.setMark=function(e){return this._mark=e,this},Object.defineProperty(e.prototype,"mark",{get:function(){return this._mark},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encodings",{get:function(){return this._encodings},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"encodingIndicesByProperty",{get:function(){return this._encodingIndicesByProperty},enumerable:!0,configurable:!0}),e}();t.EnumSpecIndex=a},{"./property":21,"./util":36}],18:[function(e,r,t){"use strict";function n(e,r,t){void 0===t&&(t=a.DEFAULT_QUERY_CONFIG);var n=o.SpecQueryModel.build(e,r,t),u=n.enumSpecIndex,s=[n];return t.propertyPrecedence.forEach(function(e){if(u.hasProperty(e)){var n=i.ENUMERATOR_INDEX[e](u,r,t);s=s.reduce(n,[])}}),null!==t.nominalColorScaleForHighCardinality||null!==t.smallBandSizeForHighCardinalityOrFacet||null!==t.xAxisOnTopForHighYCardinalityWithoutColumn?c.stylize(s,r,t):s}var i=e("../src/enumerator"),a=e("./config"),o=e("./model"),c=e("./stylize");t.generate=n},{"../src/enumerator":15,"./config":9,"./model":19,"./stylize":35}],19:[function(e,r,t){"use strict";function n(e){switch(e){case c.Property.MARK:return"m";case c.Property.CHANNEL:return"c";case c.Property.AGGREGATE:return"a";case c.Property.AUTOCOUNT:return"#";case c.Property.BIN:return"b";case c.Property.BIN_MAXBINS:return"b-mb";case c.Property.SORT:return"so";case c.Property.SORT_FIELD:return"so-f";case c.Property.SORT_OP:return"so-op";case c.Property.SORT_ORDER:return"so-or";case c.Property.SCALE:return"s";case c.Property.SCALE_BANDSIZE:return"s-bs";case c.Property.SCALE_CLAMP:return"s-c";case c.Property.SCALE_DOMAIN:return"s-d";case c.Property.SCALE_EXPONENT:return"s-e";case c.Property.SCALE_NICE:return"s-n";case c.Property.SCALE_RANGE:return"s-ra";case c.Property.SCALE_ROUND:return"s-r";case c.Property.SCALE_TYPE:return"s-t";case c.Property.SCALE_USERAWDOMAIN:return"s-u";case c.Property.SCALE_ZERO:return"s-z";case c.Property.AXIS:return"ax";case c.Property.AXIS_AXISCOLOR:return"ax-ac";case c.Property.AXIS_AXISWIDTH:return"ax-aw";case c.Property.AXIS_LAYER:return"ax-lay";case c.Property.AXIS_OFFSET:return"ax-of";case c.Property.AXIS_ORIENT:return"ax-or";case c.Property.AXIS_GRID:return"ax-g";case c.Property.AXIS_GRIDCOLOR:return"ax-gc";case c.Property.AXIS_GRIDDASH:return"ax-gd";case c.Property.AXIS_GRIDOPACITY:return"ax-go";case c.Property.AXIS_GRIDWIDTH:return"ax-gw";case c.Property.AXIS_LABELS:return"ax-lab";case c.Property.AXIS_FORMAT:return"ax-f";case c.Property.AXIS_LABELANGLE:return"ax-laba";case c.Property.AXIS_LABELMAXLENGTH:return"ax-labm";case c.Property.AXIS_SHORTTIMELABELS:return"ax-stl";case c.Property.AXIS_SUBDIVIDE:return"ax-sub";case c.Property.AXIS_TICKS:return"ax-t";case c.Property.AXIS_TICKCOLOR:return"ax-tc";case c.Property.AXIS_TICKLABELCOLOR:return"ax-tlc";case c.Property.AXIS_TICKLABELFONT:return"ax-tlf";case c.Property.AXIS_TICKLABELFONTSIZE:return"ax-tlfs";case c.Property.AXIS_TICKPADDING:return"ax-tp";case c.Property.AXIS_TICKSIZE:return"ax-ts";case c.Property.AXIS_TICKSIZEMAJOR:return"ax-tsma";case c.Property.AXIS_TICKSIZEMINOR:return"ax-tsmi";case c.Property.AXIS_TICKSIZEEND:return"ax-tse";case c.Property.AXIS_TICKWIDTH:return"ax-tw";case c.Property.AXIS_VALUES:return"ax-v";case c.Property.AXIS_TITLE:return"ax-ti";case c.Property.AXIS_TITLECOLOR:return"ax-tic";case c.Property.AXIS_TITLEFONT:return"ax-tif";case c.Property.AXIS_TITLEFONTSIZE:return"ax-tifs";case c.Property.AXIS_TITLEFONTWEIGHT:return"ax-tifw";case c.Property.AXIS_TITLEOFFSET:return"ax-tio";case c.Property.AXIS_TITLEMAXLENGTH:return"ax-timl";case c.Property.AXIS_CHARACTERWIDTH:return"ax-cw";case c.Property.LEGEND:return"l";case c.Property.LEGEND_ORIENT:return"l-or";case c.Property.LEGEND_OFFSET:return"l-of";case c.Property.LEGEND_VALUES:return"l-v";case c.Property.LEGEND_FORMAT:return"l-f";case c.Property.LEGEND_LABELALIGN:return"l-la";case c.Property.LEGEND_LABELBASELINE:return"l-lb";case c.Property.LEGEND_LABELCOLOR:return"l-lc";case c.Property.LEGEND_LABELFONT:return"l-lf";case c.Property.LEGEND_LABELFONTSIZE:return"l-lfs";case c.Property.LEGEND_SHORTTIMELABELS:return"l-stl";case c.Property.LEGEND_SYMBOLCOLOR:return"l-syc";case c.Property.LEGEND_SYMBOLSHAPE:return"l-sysh";case c.Property.LEGEND_SYMBOLSIZE:return"l-sysi";case c.Property.LEGEND_SYMBOLSTROKEWIDTH:return"l-sysw";case c.Property.LEGEND_TITLE:return"l-ti";case c.Property.LEGEND_TITLECOLOR:return"l-tic";case c.Property.LEGEND_TITLEFONT:return"l-tif";case c.Property.LEGEND_TITLEFONTSIZE:return"l-tifs";case c.Property.LEGEND_TITLEFONTWEIGHT:return"l-tifw";case c.Property.TIMEUNIT:return"tu";case c.Property.FIELD:return"f";case c.Property.TYPE:return"t"}throw new Error("Default name undefined")}function i(e,r,t){switch(e){case c.Property.FIELD:case c.Property.SORT_FIELD:return r.fields();case c.Property.AXIS:case c.Property.AXIS_GRID:case c.Property.AXIS_LABELS:case c.Property.AXIS_SHORTTIMELABELS:case c.Property.BIN:case c.Property.LEGEND:case c.Property.LEGEND_SHORTTIMELABELS:case c.Property.SCALE:case c.Property.SCALE_CLAMP:case c.Property.SCALE_NICE:case c.Property.SCALE_ROUND:case c.Property.SCALE_USERAWDOMAIN:case c.Property.SCALE_ZERO:case c.Property.AUTOCOUNT:return[!1,!0];case c.Property.AGGREGATE:return t.aggregates;case c.Property.AXIS_AXISCOLOR:return t.axisAxisColors;case c.Property.AXIS_AXISWIDTH:return t.axisAxisWidths;case c.Property.AXIS_LAYER:return t.axisLayers;case c.Property.AXIS_OFFSET:return t.axisOffsets;case c.Property.AXIS_ORIENT:return t.axisOrients;case c.Property.AXIS_GRIDCOLOR:return t.axisGridColors;case c.Property.AXIS_GRIDDASH:return t.axisGridDashes;case c.Property.AXIS_GRIDOPACITY:return t.axisGridOpacities;case c.Property.AXIS_GRIDWIDTH:return t.axisGridWidths;case c.Property.AXIS_FORMAT:return t.axisFormats;case c.Property.AXIS_LABELANGLE:return t.axisLabelAngles;case c.Property.AXIS_LABELMAXLENGTH:return t.axisLabelMaxLengths;case c.Property.AXIS_SUBDIVIDE:return t.axisSubDivides;case c.Property.AXIS_TICKS:return t.axisTicks;case c.Property.AXIS_TICKCOLOR:return t.axisTickColors;case c.Property.AXIS_TICKLABELCOLOR:return t.axisTickLabelColors;case c.Property.AXIS_TICKLABELFONT:return t.axisTickLabelFonts;case c.Property.AXIS_TICKLABELFONTSIZE:return t.axisTickLabelFontSizes;case c.Property.AXIS_TICKPADDING:return t.axisTickPaddings;case c.Property.AXIS_TICKSIZE:return t.axisTickSizes;case c.Property.AXIS_TICKSIZEMAJOR:return t.axisTickSizeMajors;case c.Property.AXIS_TICKSIZEMINOR:return t.axisTickSizeMinors;case c.Property.AXIS_TICKSIZEEND:return t.axisTickSizeEnds;case c.Property.AXIS_TICKWIDTH:return t.axisTickWidths;case c.Property.AXIS_VALUES:return t.axisValuesList;case c.Property.AXIS_TITLE:return t.axisTitles;case c.Property.AXIS_TITLECOLOR:return t.axisTitleColors;case c.Property.AXIS_TITLEFONT:return t.axisTitleFonts;case c.Property.AXIS_TITLEFONTWEIGHT:return t.axisTitleFontWeights;case c.Property.AXIS_TITLEFONTSIZE:return t.axisTitleFontSizes;case c.Property.AXIS_TITLEOFFSET:return t.axisTitleOffsets;case c.Property.AXIS_TITLEMAXLENGTH:return t.axisTitleMaxLengths;case c.Property.AXIS_CHARACTERWIDTH:return t.axisCharacterWidths;case c.Property.BIN_MAXBINS:return t.maxBinsList;case c.Property.CHANNEL:return t.channels;case c.Property.MARK:return t.marks;case c.Property.LEGEND_ORIENT:return t.legendOrients;case c.Property.LEGEND_OFFSET:return t.legendOffsets;case c.Property.LEGEND_VALUES:return t.legendValuesList;case c.Property.LEGEND_FORMAT:return t.legendFormats;case c.Property.LEGEND_LABELALIGN:return t.legendLabelAligns;case c.Property.LEGEND_LABELBASELINE:return t.legendLabelBaselines;case c.Property.LEGEND_LABELCOLOR:return t.legendLabelColors;case c.Property.LEGEND_LABELFONT:return t.legendLabelFonts;case c.Property.LEGEND_LABELFONTSIZE:return t.legendLabelFontSizes;case c.Property.LEGEND_SYMBOLCOLOR:return t.legendSymbolColors;case c.Property.LEGEND_SYMBOLSHAPE:return t.legendSymbolShapes;case c.Property.LEGEND_SYMBOLSIZE:return t.legendSymbolSizes;case c.Property.LEGEND_SYMBOLSTROKEWIDTH:return t.legendSymbolStrokeWidths;case c.Property.LEGEND_TITLE:return t.legendTitles;case c.Property.LEGEND_TITLECOLOR:return t.legendTitleColors;case c.Property.LEGEND_TITLEFONT:return t.legendTitleFonts;case c.Property.LEGEND_TITLEFONTSIZE:return t.legendTitleFontSizes;case c.Property.LEGEND_TITLEFONTWEIGHT:return t.legendTitleFontWeights;case c.Property.SORT:return t.sorts;case c.Property.SORT_OP:return t.sortOps;case c.Property.SORT_ORDER:return t.sortOrders;case c.Property.SCALE_BANDSIZE:return t.scaleBandSizes;case c.Property.SCALE_DOMAIN:return t.scaleDomains;case c.Property.SCALE_EXPONENT:return t.scaleExponents;case c.Property.SCALE_RANGE:return t.scaleRanges;case c.Property.SCALE_TYPE:return t.scaleTypes;case c.Property.TIMEUNIT:return t.timeUnits;case c.Property.TYPE:return t.types}throw new Error("No default enumValues for "+e)}var a=e("vega-lite/src/aggregate"),o=e("vega-lite/src/type"),c=e("./property"),u=e("./enumspec"),s=e("./enumspecindex"),l=e("./query/spec"),p=e("./query/encoding"),E=e("./query/shorthand"),f=e("./util");t.getDefaultName=n,t.getDefaultEnumValues=i;var T=function(){function e(e,r,t,n,i){this._rankingScore={},this._spec=e,this._channelCount=e.encodings.reduce(function(e,r){return u.isEnumSpec(r.channel)||r.autoCount===!1||(e[r.channel]=1),e},{}),this._enumSpecIndex=r,this._enumSpecAssignment=i,this._opt=n,this._schema=t}return e.build=function(r,t,a){var l=new s.EnumSpecIndex;if(u.isEnumSpec(r.mark)){var p=n(c.Property.MARK);r.mark=u.initEnumSpec(r.mark,p,a.marks),l.setMark(r.mark)}if(r.encodings.forEach(function(e,r){void 0!==e.autoCount&&(console.warn("A field with autoCount should not be included as autoCount meant to be an internal object."),e.type=o.Type.QUANTITATIVE),void 0===e.type&&(e.type=u.SHORT_ENUM_SPEC),c.ENCODING_PROPERTIES.forEach(function(o){if(u.isEnumSpec(e[o])){var c=n(o)+r,s=i(o,t,a),p=e[o]=u.initEnumSpec(e[o],c,s);l.setEncodingProperty(r,o,p)}}),c.NESTED_ENCODING_PROPERTIES.forEach(function(o){var c=e[o.parent];if(c){var s=o.property,p=o.child;if(u.isEnumSpec(c[p])){var E=n(s)+r,f=i(s,t,a),T=c[p]=u.initEnumSpec(c[p],E,f);l.setEncodingProperty(r,s,T)}}})}),a.autoAddCount){var E={channel:{name:n(c.Property.CHANNEL)+r.encodings.length,"enum":i(c.Property.CHANNEL,t,a)},autoCount:{name:n(c.Property.AUTOCOUNT)+r.encodings.length,"enum":[!1,!0]},type:o.Type.QUANTITATIVE};r.encodings.push(E);var f=r.encodings.length-1;l.setEncodingProperty(f,c.Property.CHANNEL,E.channel),l.setEncodingProperty(f,c.Property.AUTOCOUNT,E.autoCount)}return new e(r,l,t,a,{})},Object.defineProperty(e.prototype,"enumSpecIndex",{get:function(){return this._enumSpecIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this._schema},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"specQuery",{get:function(){return this._spec},enumerable:!0,configurable:!0}),e.prototype.duplicate=function(){return new e(f.duplicate(this._spec),this._enumSpecIndex,this._schema,this._opt,f.duplicate(this._enumSpecAssignment))},e.prototype.setMark=function(e){var r=this._spec.mark.name;this._enumSpecAssignment[r]=this._spec.mark=e},e.prototype.resetMark=function(){var e=this._spec.mark=this._enumSpecIndex.mark;delete this._enumSpecAssignment[e.name]},e.prototype.getMark=function(){return this._spec.mark},e.prototype.getEncodingProperty=function(e,r){var t=this._spec.encodings[e],n=c.getNestedEncodingProperty(r);return n?t[n.parent][n.child]:t[r]},e.prototype.setEncodingProperty=function(e,r,t,n){var i=this._spec.encodings[e],a=c.getNestedEncodingProperty(r);r===c.Property.CHANNEL&&i.channel&&!u.isEnumSpec(i.channel)&&this._channelCount[i.channel]--,a?i[a.parent][a.child]=t:c.hasNestedProperty(r)&&t===!0?i[r]=f.extend({},i[r],{"enum":void 0,name:void 0}):i[r]=t,this._enumSpecAssignment[n.name]=t,r===c.Property.CHANNEL&&(this._channelCount[t]=(this._channelCount[t]||0)+1)},e.prototype.resetEncodingProperty=function(e,r,t){var n=this._spec.encodings[e],i=c.getNestedEncodingProperty(r);r===c.Property.CHANNEL&&this._channelCount[n.channel]--,i?n[i.parent][i.child]=t:n[r]=t,delete this._enumSpecAssignment[t.name]},e.prototype.channelUsed=function(e){return this._channelCount[e]>0},e.prototype.stack=function(){ +return l.stack(this._spec)},e.prototype.getEncodings=function(){return this._spec.encodings.filter(function(e){return e.autoCount!==!1})},e.prototype.getEncodingQueryByChannel=function(e){for(var r=0;r0?p.duplicate(i[e-1]):{}),a.push(e>0?p.duplicate(a[e-1]):{});var t=r.nest[e].groupBy;if(u.isArray(t)){t.forEach(function(r){E.isExtendedGroupBy(r)?(i[e][r.property]=!0,a[e][r.property]=r.replace):i[e][r]=!0});var n=p.keys(a[e]).reduce(function(r,t){return r[t]=f.getReplacer(a[e][t]),r},{});o.push(n)}},s=0;s"+e}).join(";")+"]"}return e.property}return e}).join(","):e}var a=e("datalib/src/util"),o=e("../util");t.REPLACE_BLANK_FIELDS={"*":""},t.REPLACE_XY_CHANNELS={x:"xy",y:"xy"},t.REPLACE_FACET_CHANNELS={row:"facet",column:"facet"},t.REPLACE_MARK_STYLE_CHANNELS={color:"style",opacity:"style",shape:"style",size:"style"},t.isExtendedGroupBy=n,t.toString=i},{"../util":36,"datalib/src/util":8}],24:[function(e,r,t){"use strict";function n(e,r,t){e=s.extend({},i(e),{config:s.extend({},a.DEFAULT_QUERY_CONFIG,t,e.config)});var n=o.generate(e.spec,r,e.config),l=c.nest(n,e),p=u.rank(l,e,r,0);return{query:e,result:p}}function i(e){if(e.groupBy){var r={groupBy:e.groupBy};e.orderBy&&(r.orderGroupBy=e.orderBy);var t={spec:s.duplicate(e.spec),nest:[r]};return e.chooseBy&&(t.chooseBy=e.chooseBy),e.config&&(t.config=e.config),t}return s.duplicate(e)}var a=e("../config"),o=e("../generate"),c=e("../nest"),u=e("../ranking/ranking"),s=e("../util");t.encoding=e("./encoding"),t.groupBy=e("./groupby"),t.shorthand=e("./shorthand"),t.spec=e("./spec"),t.transform=e("./transform"),t.query=n,t.normalize=i},{"../config":9,"../generate":18,"../nest":20,"../ranking/ranking":33,"../util":36,"./encoding":22,"./groupby":23,"./shorthand":25,"./spec":26,"./transform":27}],25:[function(e,r,t){"use strict";function n(e){return function(r){return void 0!==e[r]?e[r]:r}}function i(e,r){return S.isEnumSpec(e)?S.SHORT_ENUM_SPEC:r?r(e):e}function a(e,r,n){void 0===r&&(r=t.INCLUDE_ALL),void 0===n&&(n={});var i=T.fromSpec(e);return o(i)}function o(e,r,n){void 0===r&&(r=t.INCLUDE_ALL),void 0===n&&(n={});var a=[];if(r[d.Property.MARK]&&a.push(i(e.mark,n[d.Property.MARK])),e.transform&&(r[d.Property.CALCULATE]&&void 0!==e.transform.calculate&&a.push("calculate:"+u(e.transform.calculate)),r[d.Property.FILTER]&&void 0!==e.transform.filter&&a.push("filter:"+c(e.transform.filter)),r[d.Property.FILTERINVALID]&&void 0!==e.transform.filterInvalid&&a.push("filterInvalid:"+e.transform.filterInvalid)),r[d.Property.STACK]){var o=T.stack(e);if(o){var p=A.extend({},r,{type:!1}),E=l(o.fieldEncQ,p,n),f=l(o.groupByEncQ,p,n);a.push("stack={field:"+E+","+(f?"by:"+f+",":"")+"offset:"+o.offset+"}")}}return a.push(e.encodings.reduce(function(e,t){if(t.autoCount!==!1){var i=s(t,r,n);i&&e.push(i)}return e},[]).sort().join("|")),a.join("|")}function c(e){if(e instanceof Array){var r=e.map(c);return r.length>1?"("+r.join(") && (")+")":r[0]}return"string"==typeof e?e:p.expression(e)}function u(e){return e.map(function(e){return"{"+e.field+":"+e.expr+"}"}).join(",")}function s(e,r,n){void 0===r&&(r=t.INCLUDE_ALL),void 0===n&&(n={});var a=[];r[d.Property.CHANNEL]&&a.push(i(e.channel,n[d.Property.CHANNEL]));var o=l(e,r,n);return o&&a.push(o),a.join(":")}function l(e,r,n){void 0===r&&(r=t.INCLUDE_ALL),void 0===n&&(n={});var a=null,o=[];if(r[d.Property.AGGREGATE]&&e.autoCount===!1)return"-";if(r[d.Property.AGGREGATE]&&e.aggregate&&!S.isEnumSpec(e.aggregate))a=i(e.aggregate,n[d.Property.AGGREGATE]);else if(r[d.Property.AGGREGATE]&&e.autoCount&&!S.isEnumSpec(e.autoCount))a=i("count",n[d.Property.AGGREGATE]);else if(r[d.Property.TIMEUNIT]&&e.timeUnit&&!S.isEnumSpec(e.timeUnit))a=i(e.timeUnit,n[d.Property.TIMEUNIT]);else if(r[d.Property.BIN]&&e.bin&&!S.isEnumSpec(e.bin))a="bin",r[d.Property.BIN_MAXBINS]&&e.bin.maxbins&&o.push({key:"maxbins",value:i(e.bin.maxbins,n[d.Property.BIN_MAXBINS])});else for(var c=0,u=[d.Property.AGGREGATE,d.Property.AUTOCOUNT,d.Property.TIMEUNIT,d.Property.BIN];c0&&o.push({key:t+"",value:JSON.stringify(c)})}else e[t]!==!1&&null!==e[t]||o.push({key:t+"",value:!1})},p=0,T=[d.Property.SCALE,d.Property.SORT,d.Property.AXIS,d.Property.LEGEND];pr.score?o:r},null);l.push(n)}),l}e.TYPE_CHANNEL="typeChannel",e.init=r,e.featurize=t,e.getScore=n}(n=t.TypeChannelScore||(t.TypeChannelScore={}));var l;!function(e){function r(e){void 0===e&&(e={}),e=c.extend({},a.DEFAULT_QUERY_CONFIG,e);var r={},t=[{feature:s.BIN_Q,opt:"preferredBinAxis"},{feature:s.T,opt:"preferredTemporalAxis"},{feature:s.TIMEUNIT_T,opt:"preferredTemporalAxis"},{feature:s.TIMEUNIT_O,opt:"preferredTemporalAxis"},{feature:s.O,opt:"preferredOrdinalAxis"},{feature:s.N,opt:"preferredNominalAxis"}];return t.forEach(function(t){e[t.opt]===i.Channel.X?r[t.feature+"_"+i.Channel.Y]=-.01:e[t.opt]===i.Channel.Y&&(r[t.feature+"_"+i.Channel.X]=-.01)}),r}function t(e,r){return e+"_"+r}function n(r,n,i){return r.getEncodings().reduce(function(r,n){var i=s.getExtendedType(n),a=t(i,n.channel),o=u.getFeatureScore(e.PREFERRED_AXIS,a);return o&&r.push(o),r},[])}e.PREFERRED_AXIS="preferredAxis",e.init=r,e.featurize=t,e.getScore=n}(l=t.PreferredAxisScore||(t.PreferredAxisScore={}));var p;!function(e){function r(e){e=c.extend({},a.DEFAULT_QUERY_CONFIG,e);var r={};return e.preferredFacet===i.Channel.ROW?r[i.Channel.COLUMN]=-.01:e.preferredFacet===i.Channel.COLUMN&&(r[i.Channel.ROW]=-.01),r}function t(r,t,n){return r.getEncodings().reduce(function(r,t){var n=u.getFeatureScore(e.PREFERRED_FACET,t.channel);return n&&r.push(n), +r},[])}e.PREFERRED_FACET="preferredFacet",e.init=r,e.getScore=t}(p=t.PreferredFacetScore||(t.PreferredFacetScore={}));var E;!function(e){function r(){return{bar_size:-2,tick_size:-2}}function t(r,t,n){var i=r.getMark();return r.getEncodings().reduce(function(r,t){var n=i+"_"+t.channel,a=u.getFeatureScore(e.MARK_CHANNEL,n);return a&&r.push(a),r},[])}e.MARK_CHANNEL="markChannel",e.init=r,e.getScore=t}(E=t.MarkChannelScore||(t.MarkChannelScore={}));var f;!function(e){function r(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}function t(r,t,n){return r.isAggregate()&&r.getEncodings().reduce(function(r,t){if(!t.aggregate&&!t.autoCount){var n=u.getFeatureScore(e.DIMENSION,t.channel+"");if(n.score>r.score)return n}return r},{type:e.DIMENSION,feature:"No Dimension",score:-5}),[]}e.DIMENSION="dimension",e.init=r,e.getScore=t}(f=t.DimensionScore||(t.DimensionScore={}))},{"../../config":9,"../../query/shorthand":25,"../../util":36,"./effectiveness":30,"./type":32,"vega-lite/src/channel":45}],30:[function(e,r,t){"use strict";function n(e,r){var n=t.FEATURE_INDEX[e][r];return void 0!==n?{score:n,type:e,feature:r}:null}function i(e){u.push(e),t.FEATURE_INDEX[e.type]=e.init()}function a(e,r,t){var n=u.reduce(function(n,i){var a=i.getScore(e,r,t);return n.concat(a)},[]);return{score:n.reduce(function(e,r){return e+r.score},0),features:n}}var o=e("./channel"),c=e("./mark");t.FEATURE_INDEX={};var u=[];t.getFeatureScore=n,t.addFeatureFactory=i,i({type:o.TypeChannelScore.TYPE_CHANNEL,init:o.TypeChannelScore.init,getScore:o.TypeChannelScore.getScore}),i({type:o.PreferredAxisScore.PREFERRED_AXIS,init:o.PreferredAxisScore.init,getScore:o.PreferredAxisScore.getScore}),i({type:o.PreferredFacetScore.PREFERRED_FACET,init:o.PreferredFacetScore.init,getScore:o.PreferredFacetScore.getScore}),i({type:o.MarkChannelScore.MARK_CHANNEL,init:o.MarkChannelScore.init,getScore:o.MarkChannelScore.getScore}),i({type:c.MarkScore.MARK_SCORE,init:c.MarkScore.init,getScore:c.MarkScore.getScore}),Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=a},{"./channel":29,"./mark":31}],31:[function(e,r,t){"use strict";var n,i=e("vega-lite/src/channel"),a=e("vega-lite/src/mark"),o=e("../../util"),c=e("./effectiveness"),u=e("./type");!function(e){function r(e,r,t,n){return e+"_"+r+"_"+t+"_"+n}function t(){var e=[u.Q,u.T],t=[u.BIN_Q,u.TIMEUNIT_O,u.O,u.N],n=t.concat([u.NONE]),i={};return e.forEach(function(t){e.forEach(function(e){var n={point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(t,e,!0,a);i[o]=n});var a={point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(a,function(n,a){var o=r(t,e,!1,a);i[o]=n})})}),e.forEach(function(e){n.forEach(function(t){var n={tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!0,a);i[o]=n;var c=r(t,e,!0,a);i[c]=n})}),[u.TIMEUNIT_T].forEach(function(t){var n={point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!0,a);i[o]=n;var c=r(t,e,!0,a);i[c]=n})}),[u.NONE,u.N,u.O].forEach(function(t){var n={bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n;var c=r(t,e,!1,a);i[c]=n})}),[u.BIN_Q].forEach(function(t){var n={bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n;var c=r(t,e,!1,a);i[c]=n})}),[u.TIMEUNIT_T,u.TIMEUNIT_O].forEach(function(t){var n={line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n;var c=r(t,e,!1,a);i[c]=n})})}),[u.TIMEUNIT_T].forEach(function(e){[u.TIMEUNIT_T].forEach(function(t){var n={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!0,a);i[o]=n}),o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n})}),n.forEach(function(t){var n={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!0,a);i[o]=n}),o.forEach(n,function(n,a){var o=r(t,e,!0,a);i[o]=n}),o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n}),o.forEach(n,function(n,a){var o=r(t,e,!1,a);i[o]=n})})}),n.forEach(function(e){n.forEach(function(t){var n={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};o.forEach(n,function(n,a){var o=r(e,t,!0,a);i[o]=n}),o.forEach(n,function(n,a){var o=r(e,t,!1,a);i[o]=n})})}),i}function n(r,t,n){var o=r.getMark();o!==a.Mark.CIRCLE&&o!==a.Mark.SQUARE||(o=a.Mark.POINT);var s=r.getEncodingQueryByChannel(i.Channel.X),l=s?u.getExtendedType(s):u.NONE,p=r.getEncodingQueryByChannel(i.Channel.Y),E=p?u.getExtendedType(p):u.NONE,f=!r.isAggregate(),T=l+"_"+E+"_"+f+"_"+o,S=c.getFeatureScore(e.MARK_SCORE,T);return[S]}e.MARK_SCORE="markScore",e.featurize=r,e.init=t,e.getScore=n}(n=t.MarkScore||(t.MarkScore={}))},{"../../util":36,"./effectiveness":30,"./type":32,"vega-lite/src/channel":45,"vega-lite/src/mark":50}],32:[function(e,r,t){"use strict";function n(e){return e.bin?c.BIN_Q:e.timeUnit?o.scaleType(e)===i.ScaleType.ORDINAL?c.TIMEUNIT_O:c.TIMEUNIT_T:e.type}var i=e("vega-lite/src/scale"),a=e("vega-lite/src/type"),o=e("../../query/encoding");!function(e){e[e.Q=a.Type.QUANTITATIVE]="Q",e[e.BIN_Q="bin_"+a.Type.QUANTITATIVE]="BIN_Q",e[e.T=a.Type.TEMPORAL]="T",e[e.TIMEUNIT_T="timeUnit_time"]="TIMEUNIT_T",e[e.TIMEUNIT_O="timeUnit_"+a.Type.ORDINAL]="TIMEUNIT_O",e[e.O=a.Type.ORDINAL]="O",e[e.N=a.Type.NOMINAL]="N",e[e.NONE="-"]="NONE"}(t.ExtendedType||(t.ExtendedType={}));var c=t.ExtendedType;t.Q=c.Q,t.BIN_Q=c.BIN_Q,t.T=c.T,t.TIMEUNIT_T=c.TIMEUNIT_T,t.TIMEUNIT_O=c.TIMEUNIT_O,t.O=c.O,t.N=c.N,t.NONE=c.NONE,t.getExtendedType=n},{"../../query/encoding":22,"vega-lite/src/scale":51,"vega-lite/src/type":55}],33:[function(e,r,t){"use strict";function n(e,r){s[e]=r}function i(e){return s[e]}function a(e,r,t,n){return r.nest&&n!==r.nest.length?(e.items.forEach(function(e){a(e,r,t,n+1)}),r.nest[n].orderGroupBy&&e.items.sort(u(r.nest[n].orderGroupBy,t,r.config))):(r.orderBy||r.chooseBy)&&(e.items.sort(c(r.orderBy||r.chooseBy,t,r.config)),r.chooseBy&&e.items.length>0&&e.items.splice(1)),e}function o(e,r,t,n){if(void 0!==e.getRankingScore(r))return e.getRankingScore(r);var a=i(r),o=a(e,t,n);return e.setRankingScore(r,o),o}function c(e,r,t){return function(n,i){return o(i,e,r,t).score-o(n,e,r,t).score}}function u(e,r,t){return function(n,i){var a=n.getTopSpecQueryModel(),c=i.getTopSpecQueryModel();return o(c,e,r,t).score-o(a,e,r,t).score}}t.effectiveness=e("./effectiveness/effectiveness"),t.aggregation=e("./aggregation");var s={};t.register=n,t.get=i,t.rank=a,t.comparator=c,t.groupComparator=u,t.EFFECTIVENESS="effectiveness",n(t.EFFECTIVENESS,t.effectiveness["default"]),n(t.aggregation.name,t.aggregation.score)},{"./aggregation":28,"./effectiveness/effectiveness":30}],34:[function(e,r,t){"use strict";function n(e,r){var t=E({min:r.min,max:r.max,maxbins:e}),n=T.extend({},r);return n.unique=a(t,r.unique),n.distinct=(t.stop-t.start)/t.step,n.min=t.start,n.max=t.stop,n}function i(e,r){var t=T.extend({},r),n={};return T.keys(r.unique).forEach(function(t){var i,a="null"===t?null:new Date(t);i=null===a?null:isNaN(a.getTime())?"Invalid Date":(e===s.TimeUnit.DAY?a.getDay():s.convert(e,a)).toString(),n[i]=(n[i]||0)+r.unique[t]}),t.unique=n,t.distinct=T.keys(n).length,t}function a(e,r){var t={};for(var n in r){var i=void 0;i=null===n?null:isNaN(Number(n))?NaN:e.value(Number(n)),t[i]=(t[i]||0)+r[n]}return t}function o(e,r){return r.reduce(function(r,t){return e[t]?r+1:r},0)}var c=e("vega-lite/src/type"),u=e("vega-lite/src/bin"),s=e("vega-lite/src/timeunit"),l=e("datalib/src/stats"),p=e("datalib/src/import/type"),E=e("datalib/src/bins/bins"),f=e("./config"),T=e("./util"),S=function(){function e(e){this.fieldSchemas=e,this.fieldSchemaIndex=e.reduce(function(e,r){return e[r.field]=r,e},{})}return e.build=function(r,t){void 0===t&&(t={}),t=T.extend({},f.DEFAULT_QUERY_CONFIG,t);var a=l.summary(r),o=p.inferAll(r),u=a.map(function(e){var n,i=e.field,a=o[i],u=e.distinct;if(a===d.NUMBER)n=c.Type.QUANTITATIVE;else if(a===d.INTEGER)n=ue.max.getTime()&&(e.max=new Date(l))}}else n=c.Type.NOMINAL;return{field:i,type:n,primitiveType:a,stats:e,timeStats:{},binStats:{}}}),s={nominal:0,ordinal:1,temporal:2,quantitative:3};u.sort(function(e,r){return s[e.type]s[r.type]?1:e.field.localeCompare(r.field)});for(var E=0,S=u;En.smallBandSizeForHighCardinalityOrFacet.maxCardinality)&&(void 0===i.scale&&(i.scale={}),i.scale&&E.contains([s.ScaleType.ORDINAL,void 0],p.scaleType(i))&&(i.scale.bandSize||(i.scale.bandSize=12)));var a=t[u.Channel.X];return void 0!==a&&(t[u.Channel.COLUMN]||r.cardinality(a)>n.smallBandSizeForHighCardinalityOrFacet.maxCardinality)&&(void 0===a.scale&&(a.scale={}),a.scale&&E.contains([s.ScaleType.ORDINAL,void 0],p.scaleType(a))&&(a.scale.bandSize||(a.scale.bandSize=12))),e}function a(e,r,t,n){t[u.Channel.COLOR]=e.getEncodingQueryByChannel(u.Channel.COLOR);var i=t[u.Channel.COLOR];return void 0!==i&&i.type===l.Type.NOMINAL&&r.cardinality(i)>n.nominalColorScaleForHighCardinality.maxCardinality&&(void 0===i.scale&&(i.scale={}),i.scale&&(i.scale.range||(i.scale.range=n.nominalColorScaleForHighCardinality.palette))),e}function o(e,r,t,n){if([u.Channel.COLUMN,u.Channel.X,u.Channel.Y].forEach(function(r){t[r]=e.getEncodingQueryByChannel(r)}),void 0===t[u.Channel.COLUMN]){var i=t[u.Channel.X],a=t[u.Channel.Y];void 0!==a&&a.field&&p.scaleType(a)===s.ScaleType.ORDINAL&&void 0!==i&&r.cardinality(a)>n.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(void 0===i.axis&&(i.axis={}),i.axis&&!i.axis.orient&&(i.axis.orient=c.AxisOrient.TOP))}return e}var c=e("vega-lite/src/axis"),u=e("vega-lite/src/channel"),s=e("vega-lite/src/scale"),l=e("vega-lite/src/type"),p=e("./query/encoding"),E=e("./util");t.stylize=n,t.smallBandSizeForHighCardinalityOrFacet=i,t.nominalColorScaleForHighCardinality=a,t.xAxisOnTopForHighYCardinalityWithoutColumn=o},{"./query/encoding":22,"./util":36,"vega-lite/src/axis":43,"vega-lite/src/channel":45,"vega-lite/src/scale":51,"vega-lite/src/type":55}],36:[function(e,r,t){"use strict";function n(e,r){return-1!==e.indexOf(r)}function i(e,r){var t,n=0;for(t in e)if(!r(e[t],t,n++))return!1;return!0}function a(e,r,t){if(e.forEach)e.forEach.call(t,r);else for(var n in e)r.call(t,e[n],n,e)}function o(e,r){var t,n=0;for(t in e)if(r(e[t],t,n++))return!0;return!1}function c(e,r){return e.map(function(e){return s.isArray(e)?c(e,r):r(e)})}function u(e,r){return e.filter(function(e){return!n(r,e)})}var s=e("datalib/src/util"),l=e("datalib/src/util");t.keys=l.keys,t.duplicate=l.duplicate,t.extend=l.extend,t.isObject=l.isObject,t.isArray=l.isArray,t.contains=n,t.every=i,t.forEach=a,t.some=o,t.nestedMap=c,t.without=u},{"datalib/src/util":8}],37:[function(e,r,t){(function(e){function t(e,r){var t,n="";for(t=0;e>t;++t)n+=r;return n}function n(e,r,t){var n=0,i=e.split(u);return e=t?(i=i.reverse()).filter(function(e){return n+=e.length,r>=n}).reverse():i.filter(function(e){return n+=e.length,r>=n}),e.length?e.join("").trim():i[0].slice(0,r)}var i=r.exports,a="__name__";i.namedfunc=function(e,r){return r[a]=e,r},i.name=function(e){return null==e?null:e[a]},i.identity=function(e){return e},i["true"]=i.namedfunc("true",function(){return!0}),i["false"]=i.namedfunc("false",function(){return!1}),i.duplicate=function(e){return JSON.parse(JSON.stringify(e))},i.equal=function(e,r){return JSON.stringify(e)===JSON.stringify(r)},i.extend=function(e){for(var r,t,n=1,i=arguments.length;i>n;++n){r=arguments[n];for(t in r)e[t]=r[t]}return e},i.length=function(e){return null!=e&&null!=e.length?e.length:null},i.keys=function(e){var r,t=[];for(r in e)t.push(r);return t},i.vals=function(e){var r,t=[];for(r in e)t.push(e[r]);return t},i.toMap=function(e,r){return(r=i.$(r))?e.reduce(function(e,t){return e[r(t)]=1,e},{}):e.reduce(function(e,r){return e[r]=1,e},{})},i.keystr=function(e){var r=e.length;if(!r)return"";for(var t=String(e[0]),n=1;r>n;++n)t+="|"+String(e[n]);return t};var o=Object.prototype.toString;i.isObject=function(e){return e===Object(e)},i.isFunction=function(e){return"[object Function]"===o.call(e)},i.isString=function(e){return"string"==typeof value||"[object String]"===o.call(e)},i.isArray=Array.isArray||function(e){return"[object Array]"===o.call(e)},i.isNumber=function(e){return"number"==typeof e||"[object Number]"===o.call(e)},i.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==o.call(e)},i.isDate=function(e){return"[object Date]"===o.call(e)},i.isValid=function(e){return null!=e&&e===e},i.isBuffer="function"==typeof e&&e.isBuffer||i["false"],i.number=function(e){return null==e||""===e?null:+e},i["boolean"]=function(e){return null==e||""===e?null:"false"===e?!1:!!e},i.date=function(e,r){var t=r?r:Date;return null==e||""===e?null:t.parse(e)},i.array=function(e){return null!=e?i.isArray(e)?e:[e]:[]},i.str=function(e){return i.isArray(e)?"["+e.map(i.str)+"]":i.isObject(e)||i.isString(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e};var c=/\[(.*?)\]|[^.\[]+/g;i.field=function(e){return String(e).match(c).map(function(e){return"["!==e[0]?e:"'"!==e[1]&&'"'!==e[1]?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,"$1")})},i.accessor=function(e){return null==e||i.isFunction(e)?e:i.namedfunc(e,Function("x","return x["+i.field(e).map(i.str).join("][")+"];"))},i.$=i.accessor,i.mutator=function(e){var r;return i.isString(e)&&(r=i.field(e)).length>1?function(e,t){for(var n=0;na;++a)if(c=e[a],u=i.cmp(c(t),c(n)))return u*r[a];return 0}},i.cmp=function(e,r){return(r>e||null==e)&&null!=r?-1:(e>r||null==r)&&null!=e?1:(r=r instanceof Date?+r:r,(e=e instanceof Date?+e:e)!==e&&r===r?-1:r!==r&&e===e?1:0)},i.numcmp=function(e,r){return e-r},i.stablesort=function(e,r,t){var n=e.reduce(function(e,r,n){return e[t(r)]=n,e},{});return e.sort(function(e,i){var a=r(e),o=r(i);return o>a?-1:a>o?1:n[t(e)]-n[t(i)]}),e},i.permute=function(e){for(var r,t,n=e.length;n;)t=Math.floor(Math.random()*n--),r=e[n],e[n]=e[t],e[t]=r},i.pad=function(e,r,n,i){i=i||" ";var a=r-e.length;if(0>=a)return e;switch(n){case"left":return t(a,i)+e;case"middle":case"center":return t(Math.floor(a/2),i)+e+t(Math.ceil(a/2),i);default:return e+t(a,i)}},i.truncate=function(e,r,t,i,a){var o=e.length;if(r>=o)return e;a=void 0!==a?String(a):"…";var c=Math.max(0,r-a.length);switch(t){case"left":return a+(i?n(e,c,1):e.slice(o-c));case"middle":case"center":var u=Math.ceil(c/2),s=Math.floor(c/2);return(i?n(e,u):e.slice(0,u))+a+(i?n(e,s,1):e.slice(o-s));default:return(i?n(e,c):e.slice(0,c))+a}};var u=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/}).call(this,e("buffer").Buffer)},{buffer:1}],38:[function(e,r,t){var n="undefined"!=typeof JSON?JSON:e("jsonify");r.exports=function(e,r){r||(r={}),"function"==typeof r&&(r={cmp:r});var t=r.space||"";"number"==typeof t&&(t=Array(t+1).join(" "));var o="boolean"==typeof r.cycles?r.cycles:!1,c=r.replacer||function(e,r){return r},u=r.cmp&&function(e){return function(r){return function(t,n){var i={key:t,value:r[t]},a={key:n,value:r[n]};return e(i,a)}}}(r.cmp),s=[];return function l(e,r,p,E){var f=t?"\n"+new Array(E+1).join(t):"",T=t?": ":":";if(p&&p.toJSON&&"function"==typeof p.toJSON&&(p=p.toJSON()),p=c.call(e,r,p),void 0!==p){if("object"!=typeof p||null===p)return n.stringify(p);if(i(p)){for(var S=[],d=0;d="0"&&"9">=i;)r+=i,s();if("."===i)for(r+=".";s()&&i>="0"&&"9">=i;)r+=i;if("e"===i||"E"===i)for(r+=i,s(),"-"!==i&&"+"!==i||(r+=i,s());i>="0"&&"9">=i;)r+=i,s();return e=+r,isFinite(e)?e:void u("Bad number")},p=function(){var e,r,t,n="";if('"'===i)for(;s();){if('"'===i)return s(),n;if("\\"===i)if(s(),"u"===i){for(t=0,r=0;4>r&&(e=parseInt(s(),16),isFinite(e));r+=1)t=16*t+e;n+=String.fromCharCode(t)}else{if("string"!=typeof c[i])break;n+=c[i]}else n+=i}u("Bad string")},E=function(){for(;i&&" ">=i;)s()},f=function(){switch(i){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}u("Unexpected '"+i+"'")},T=function(){var e=[];if("["===i){if(s("["),E(),"]"===i)return s("]"),e;for(;i;){if(e.push(o()),E(),"]"===i)return s("]"),e;s(","),E()}}u("Bad array")},S=function(){var e,r={};if("{"===i){if(s("{"),E(),"}"===i)return s("}"),r;for(;i;){if(e=p(),E(),s(":"),Object.hasOwnProperty.call(r,e)&&u('Duplicate key "'+e+'"'),r[e]=o(),E(),"}"===i)return s("}"),r;s(","),E()}}u("Bad object")};o=function(){switch(E(),i){case"{":return S();case"[":return T();case'"':return p();case"-":return l();default:return i>="0"&&"9">=i?l():f()}},r.exports=function(e,r){var t;return a=e,n=0,i=" ",t=o(),E(),i&&u("Syntax error"),"function"==typeof r?function c(e,t){var n,i,a=e[t];if(a&&"object"==typeof a)for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(i=c(a,n),void 0!==i?a[n]=i:delete a[n]);return r.call(e,t,a)}({"":t},""):t}},{}],41:[function(e,r,t){function n(e){return u.lastIndex=0,u.test(e)?'"'+e.replace(u,function(e){var r=s[e];return"string"==typeof r?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function i(e,r){var t,u,s,l,p,E=a,f=r[e];switch(f&&"object"==typeof f&&"function"==typeof f.toJSON&&(f=f.toJSON(e)),"function"==typeof c&&(f=c.call(r,e,f)),typeof f){case"string":return n(f);case"number":return isFinite(f)?String(f):"null";case"boolean":case"null":return String(f);case"object":if(!f)return"null";if(a+=o,p=[],"[object Array]"===Object.prototype.toString.apply(f)){for(l=f.length,t=0;l>t;t+=1)p[t]=i(t,f)||"null";return s=0===p.length?"[]":a?"[\n"+a+p.join(",\n"+a)+"\n"+E+"]":"["+p.join(",")+"]",a=E,s}if(c&&"object"==typeof c)for(l=c.length,t=0;l>t;t+=1)u=c[t],"string"==typeof u&&(s=i(u,f),s&&p.push(n(u)+(a?": ":":")+s));else for(u in f)Object.prototype.hasOwnProperty.call(f,u)&&(s=i(u,f),s&&p.push(n(u)+(a?": ":":")+s));return s=0===p.length?"{}":a?"{\n"+a+p.join(",\n"+a)+"\n"+E+"}":"{"+p.join(",")+"}",a=E,s}}var a,o,c,u=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};r.exports=function(e,r,t){var n;if(a="",o="","number"==typeof t)for(n=0;t>n;n+=1)o+=" ";else"string"==typeof t&&(o=t);if(c=r,r&&"function"!=typeof r&&("object"!=typeof r||"number"!=typeof r.length))throw new Error("JSON.stringify");return i("",{"":e})}},{}],42:[function(e,r,t){"use strict";!function(e){e[e.VALUES="values"]="VALUES",e[e.COUNT="count"]="COUNT",e[e.VALID="valid"]="VALID",e[e.MISSING="missing"]="MISSING",e[e.DISTINCT="distinct"]="DISTINCT",e[e.SUM="sum"]="SUM",e[e.MEAN="mean"]="MEAN",e[e.AVERAGE="average"]="AVERAGE",e[e.VARIANCE="variance"]="VARIANCE",e[e.VARIANCEP="variancep"]="VARIANCEP",e[e.STDEV="stdev"]="STDEV",e[e.STDEVP="stdevp"]="STDEVP",e[e.MEDIAN="median"]="MEDIAN",e[e.Q1="q1"]="Q1",e[e.Q3="q3"]="Q3",e[e.MODESKEW="modeskew"]="MODESKEW",e[e.MIN="min"]="MIN",e[e.MAX="max"]="MAX",e[e.ARGMIN="argmin"]="ARGMIN",e[e.ARGMAX="argmax"]="ARGMAX"}(t.AggregateOp||(t.AggregateOp={}));var n=t.AggregateOp;t.AGGREGATE_OPS=[n.VALUES,n.COUNT,n.VALID,n.MISSING,n.DISTINCT,n.SUM,n.MEAN,n.AVERAGE,n.VARIANCE,n.VARIANCEP,n.STDEV,n.STDEVP,n.MEDIAN,n.Q1,n.Q3,n.MODESKEW,n.MIN,n.MAX,n.ARGMIN,n.ARGMAX],t.SUM_OPS=[n.COUNT,n.SUM,n.DISTINCT],t.SHARED_DOMAIN_OPS=[n.MEAN,n.AVERAGE,n.STDEV,n.STDEVP,n.MEDIAN,n.Q1,n.Q3,n.MIN,n.MAX]},{}],43:[function(e,r,t){"use strict";!function(e){e[e.TOP="top"]="TOP",e[e.RIGHT="right"]="RIGHT",e[e.LEFT="left"]="LEFT",e[e.BOTTOM="bottom"]="BOTTOM"}(t.AxisOrient||(t.AxisOrient={}));t.AxisOrient;t.defaultAxisConfig={offset:void 0,grid:void 0,labels:!0,labelMaxLength:25,tickSize:void 0,characterWidth:6},t.defaultFacetAxisConfig={axisWidth:0,labels:!0,grid:!1,tickSize:0}},{}],44:[function(e,r,t){"use strict";function n(e){switch(e){case i.ROW:case i.COLUMN:case i.SIZE:case i.SHAPE:return 6;default:return 10}}var i=e("./channel");t.autoMaxBins=n},{"./channel":45}],45:[function(e,r,t){"use strict";function n(e,r){return!!i(e)[r]}function i(e){switch(e){case t.X:case t.Y:case t.COLOR:case t.DETAIL:case t.ORDER:case t.OPACITY:case t.ROW:case t.COLUMN:return{point:!0,tick:!0,rule:!0,circle:!0,square:!0,bar:!0,line:!0,area:!0,text:!0};case t.X2:case t.Y2:return{rule:!0,bar:!0,area:!0};case t.SIZE:return{point:!0,tick:!0,rule:!0,circle:!0,square:!0,bar:!0,text:!0};case t.SHAPE:return{point:!0};case t.TEXT:return{text:!0};case t.PATH:return{line:!0}}return{}}function a(e){switch(e){case t.X:case t.Y:case t.COLOR:case t.OPACITY:case t.LABEL:case t.DETAIL:return{measure:!0,dimension:!0};case t.ROW:case t.COLUMN:case t.SHAPE:return{measure:!1,dimension:!0};case t.X2:case t.Y2:case t.SIZE:case t.TEXT:return{measure:!0,dimension:!1};case t.PATH:return{measure:!1,dimension:!0}}throw new Error("Invalid encoding channel"+e)}function o(e){return!c.contains([t.DETAIL,t.PATH,t.TEXT,t.LABEL,t.ORDER],e)}var c=e("./util");!function(e){e[e.X="x"]="X",e[e.Y="y"]="Y",e[e.X2="x2"]="X2",e[e.Y2="y2"]="Y2",e[e.ROW="row"]="ROW",e[e.COLUMN="column"]="COLUMN",e[e.SHAPE="shape"]="SHAPE",e[e.SIZE="size"]="SIZE",e[e.COLOR="color"]="COLOR",e[e.TEXT="text"]="TEXT",e[e.DETAIL="detail"]="DETAIL",e[e.LABEL="label"]="LABEL",e[e.PATH="path"]="PATH",e[e.ORDER="order"]="ORDER",e[e.OPACITY="opacity"]="OPACITY"}(t.Channel||(t.Channel={}));var u=t.Channel;t.X=u.X,t.Y=u.Y,t.X2=u.X2,t.Y2=u.Y2,t.ROW=u.ROW,t.COLUMN=u.COLUMN,t.SHAPE=u.SHAPE,t.SIZE=u.SIZE,t.COLOR=u.COLOR,t.TEXT=u.TEXT,t.DETAIL=u.DETAIL,t.LABEL=u.LABEL,t.PATH=u.PATH,t.ORDER=u.ORDER,t.OPACITY=u.OPACITY,t.CHANNELS=[t.X,t.Y,t.X2,t.Y2,t.ROW,t.COLUMN,t.SIZE,t.SHAPE,t.COLOR,t.PATH,t.ORDER,t.OPACITY,t.TEXT,t.DETAIL,t.LABEL],t.UNIT_CHANNELS=c.without(t.CHANNELS,[t.ROW,t.COLUMN]),t.UNIT_SCALE_CHANNELS=c.without(t.UNIT_CHANNELS,[t.PATH,t.ORDER,t.DETAIL,t.TEXT,t.LABEL,t.X2,t.Y2]),t.NONSPATIAL_CHANNELS=c.without(t.UNIT_CHANNELS,[t.X,t.Y,t.X2,t.Y2]),t.NONSPATIAL_SCALE_CHANNELS=c.without(t.UNIT_SCALE_CHANNELS,[t.X,t.Y,t.X2,t.Y2]),t.STACK_GROUP_CHANNELS=[t.COLOR,t.DETAIL,t.ORDER,t.OPACITY,t.SIZE],t.supportMark=n,t.getSupportedMark=i,t.getSupportedRole=a,t.hasScale=o},{"./util":56}],46:[function(e,r,t){"use strict";function n(e){return!!(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds)}function i(e){return u.isNumber(e)?e-1+"":(console.warn("Potentially invalid quarter",e),e)}function a(e){if(u.isNumber(e))return e-1+"";var r=e.toLowerCase(),n=t.MONTHS.indexOf(r);if(-1!==n)return n+"";var i=r.substr(0,3),a=t.SHORT_MONTHS.indexOf(i);return-1!==a?a+"":(console.warn("Potentially invalid month",e),e)}function o(e){if(u.isNumber(e))return e%7+"";var r=e.toLowerCase(),n=t.DAYS.indexOf(r);if(-1!==n)return n+"";var i=r.substr(0,3),a=t.SHORT_DAYS.indexOf(i);return-1!==a?a+"":(console.warn("Potentially invalid day",e),e)}function c(e,r){void 0===r&&(r=!1);var t=[];if(r&&void 0!==e.day)for(var n=0,c=["year","quarter","month","date"];n0)}function o(e){return d.some(S.CHANNELS,function(r){return!(!a(e,r)||!e[r].aggregate)})}function c(e){return e&&(!!e.x&&!!e.x2||!!e.y&&!!e.y2)}function u(e){var r=[];return S.CHANNELS.forEach(function(t){a(e,t)&&(d.isArray(e[t])?e[t].forEach(function(e){r.push(e)}):r.push(e[t]))}),r}function s(e,r,t){l(S.CHANNELS,e,r,t)}function l(e,r,t,n){var i=0;e.forEach(function(e){a(r,e)&&(d.isArray(r[e])?r[e].forEach(function(r){t.call(n,r,e,i++)}):t.call(n,r[e],e,i++))})}function p(e,r,t){return E(S.CHANNELS,e,r,t)}function E(e,r,t,n){var i=[];return e.forEach(function(e){a(r,e)&&(d.isArray(r[e])?r[e].forEach(function(r){i.push(t.call(n,r,e))}):i.push(t.call(n,r[e],e)))}),i}function f(e,r,t,n){return T(S.CHANNELS,e,r,t,n)}function T(e,r,t,n,i){var o=n;return S.CHANNELS.forEach(function(e){a(r,e)&&(d.isArray(r[e])?r[e].forEach(function(r){o=t.call(i,o,r,e)}):o=t.call(i,o,r[e],e))}),o}var S=e("./channel"),d=e("./util");t.countRetinal=n,t.channels=i,t.has=a,t.isAggregate=o,t.isRanged=c,t.fieldDefs=u,t.forEach=s,t.channelMappingForEach=l,t.map=p,t.channelMappingMap=E,t.reduce=f,t.channelMappingReduce=T},{"./channel":45,"./util":56}],48:[function(e,r,t){"use strict";function n(e,r){void 0===r&&(r={});var t=e.field,n=r.prefix,i=r.suffix;if(u(e))t="count";else{var a=r.fn;r.nofn||(e.bin?(a="bin",i=r.binSuffix||(r.scaleType===p.ScaleType.ORDINAL?"range":"start")):!r.noAggregate&&e.aggregate?a=String(e.aggregate):e.timeUnit&&(a=String(e.timeUnit))),a&&(t=a+"_"+t)}return i&&(t=t+"_"+i),n&&(t=n+"_"+t),r.datum&&(t='datum["'+t+'"]'),t}function i(e){return f.contains([E.NOMINAL,E.ORDINAL],e.type)||!!e.bin||e.type===E.TEMPORAL&&!!e.timeUnit}function a(e){return e&&e.field&&i(e)}function o(e){return e&&e.field&&!i(e)}function c(){return{field:"*",aggregate:l.AggregateOp.COUNT,type:E.QUANTITATIVE}}function u(e){return e.aggregate===l.AggregateOp.COUNT}function s(e,r){if(null!=e.title)return e.title;if(u(e))return r.countTitle;var t=e.aggregate||e.timeUnit||e.bin&&"bin";return t?t.toString().toUpperCase()+"("+e.field+")":e.field}var l=e("./aggregate"),p=e("./scale"),E=e("./type"),f=e("./util");t.field=n,t.isDimension=a,t.isMeasure=o,t.count=c,t.isCount=u,t.title=s},{"./aggregate":42,"./scale":51,"./type":55,"./util":56}],49:[function(e,r,t){"use strict";function n(e){return e&&!!e.field&&void 0!==e.equal}function i(e){return!!(e&&e.field&&p.isArray(e.range)&&2===e.range.length)}function a(e){return e&&!!e.field&&p.isArray(e["in"])}function o(e){if(p.isString(e))return e;var r=e.timeUnit?"time("+l.fieldExpr(e.timeUnit,e.field)+")":s.field(e,{datum:!0});if(n(e))return r+"==="+c(e.equal,e.timeUnit); +if(a(e))return"indexof(["+e["in"].map(function(r){return c(r,e.timeUnit)}).join(",")+"], "+r+") !== -1";if(i(e)){var t=e.range[0],o=e.range[1];if(null!==t&&null!==o)return"inrange("+r+", "+c(t,e.timeUnit)+", "+c(o,e.timeUnit)+")";if(null!==t)return r+" >= "+t;if(null!==o)return r+" <= "+o}}function c(e,r){if(u.isDateTime(e)){var t=u.dateTimeExpr(e,!0);return"time("+t+")"}if(l.isSingleTimeUnit(r)){var n={};n[r]=e;var t=u.dateTimeExpr(n,!0);return"time("+t+")"}return JSON.stringify(e)}var u=e("./datetime"),s=e("./fielddef"),l=e("./timeunit"),p=e("./util");t.isEqualFilter=n,t.isRangeFilter=i,t.isInFilter=a,t.expression=o},{"./datetime":46,"./fielddef":48,"./timeunit":54,"./util":56}],50:[function(e,r,t){"use strict";!function(e){e[e.AREA="area"]="AREA",e[e.BAR="bar"]="BAR",e[e.LINE="line"]="LINE",e[e.POINT="point"]="POINT",e[e.TEXT="text"]="TEXT",e[e.TICK="tick"]="TICK",e[e.RULE="rule"]="RULE",e[e.CIRCLE="circle"]="CIRCLE",e[e.SQUARE="square"]="SQUARE",e[e.ERRORBAR="errorBar"]="ERRORBAR"}(t.Mark||(t.Mark={}));var n=t.Mark;t.AREA=n.AREA,t.BAR=n.BAR,t.LINE=n.LINE,t.POINT=n.POINT,t.TEXT=n.TEXT,t.TICK=n.TICK,t.RULE=n.RULE,t.CIRCLE=n.CIRCLE,t.SQUARE=n.SQUARE,t.ERRORBAR=n.ERRORBAR,t.PRIMITIVE_MARKS=[t.AREA,t.BAR,t.LINE,t.POINT,t.TEXT,t.TICK,t.RULE,t.CIRCLE,t.SQUARE]},{}],51:[function(e,r,t){"use strict";!function(e){e[e.LINEAR="linear"]="LINEAR",e[e.LOG="log"]="LOG",e[e.POW="pow"]="POW",e[e.SQRT="sqrt"]="SQRT",e[e.QUANTILE="quantile"]="QUANTILE",e[e.QUANTIZE="quantize"]="QUANTIZE",e[e.ORDINAL="ordinal"]="ORDINAL",e[e.TIME="time"]="TIME",e[e.UTC="utc"]="UTC"}(t.ScaleType||(t.ScaleType={}));t.ScaleType;!function(e){e[e.SECOND="second"]="SECOND",e[e.MINUTE="minute"]="MINUTE",e[e.HOUR="hour"]="HOUR",e[e.DAY="day"]="DAY",e[e.WEEK="week"]="WEEK",e[e.MONTH="month"]="MONTH",e[e.YEAR="year"]="YEAR"}(t.NiceTime||(t.NiceTime={}));t.NiceTime;!function(e){e[e.FIT="fit"]="FIT"}(t.BandSize||(t.BandSize={}));var n=t.BandSize;t.BANDSIZE_FIT=n.FIT,t.defaultScaleConfig={round:!0,textBandWidth:90,bandSize:21,padding:.1,useRawDomain:!1,opacity:[.3,.8],nominalColorRange:"category10",sequentialColorRange:["#AFC6A3","#09622A"],shapeRange:"shapes",fontSizeRange:[8,40],ruleSizeRange:[1,5],tickSizeRange:[1,20]},t.defaultFacetScaleConfig={round:!0,padding:16}},{}],52:[function(e,r,t){"use strict";function n(e){return!!e&&!!e.field&&!!e.op}!function(e){e[e.ASCENDING="ascending"]="ASCENDING",e[e.DESCENDING="descending"]="DESCENDING",e[e.NONE="none"]="NONE"}(t.SortOrder||(t.SortOrder={}));t.SortOrder;t.isSortField=n},{}],53:[function(e,r,t){"use strict";function n(e,r,t){var n=t&&t.mark?t.mark.stacked:void 0;if(c.contains([u.NONE,null,!1],n))return null;if(!c.contains([o.BAR,o.AREA],e))return null;if(!a.isAggregate(r))return null;var s=i.STACK_GROUP_CHANNELS.reduce(function(e,t){return a.has(r,t)&&!r[t].aggregate&&e.push(t),e},[]);if(0===s.length)return null;var l=a.has(r,i.X),p=a.has(r,i.Y),E=l&&!!r.x.aggregate,f=p&&!!r.y.aggregate;return E!==f?{groupbyChannel:E?p?i.Y:null:l?i.X:null,fieldChannel:E?i.X:i.Y,stackByChannels:s,offset:n||u.ZERO}:null}var i=e("./channel"),a=e("./encoding"),o=e("./mark"),c=e("./util");!function(e){e[e.ZERO="zero"]="ZERO",e[e.CENTER="center"]="CENTER",e[e.NORMALIZE="normalize"]="NORMALIZE",e[e.NONE="none"]="NONE"}(t.StackOffset||(t.StackOffset={}));var u=t.StackOffset;t.stack=n},{"./channel":45,"./encoding":47,"./mark":50,"./util":56}],54:[function(e,r,t){"use strict";function n(e){return!!A[e]}function i(e,r){var n=new Date(0,0,1,0,0,0,0);return t.SINGLE_TIMEUNITS.forEach(function(t){if(o(e,t))switch(t){case d.DAY:throw new Error("Cannot convert to TimeUnits containing 'day'");case d.YEAR:n.setFullYear(r.getFullYear());break;case d.QUARTER:n.setMonth(3*Math.floor(r.getMonth()/3));break;case d.MONTH:n.setMonth(r.getMonth());break;case d.DATE:n.setDate(r.getDate());break;case d.HOURS:n.setHours(r.getHours());break;case d.MINUTES:n.setMinutes(r.getMinutes());break;case d.SECONDS:n.setSeconds(r.getSeconds());break;case d.MILLISECONDS:n.setMilliseconds(r.getMilliseconds())}}),n}function a(e){return!!y[e]}function o(e,r){var t=e.toString(),n=r.toString(),i=t.indexOf(n);return i>-1&&(r!==d.SECONDS||0===i||"i"!==t.charAt(i-1))}function c(e){switch(e){case d.HOURS:case d.DAY:case d.MONTH:case d.QUARTER:return T.ScaleType.ORDINAL}return T.ScaleType.TIME}function u(e,r){function n(e){return e===d.QUARTER?"floor(month("+i+")/3)":e+"("+i+")"}var i='datum["'+r+'"]',a=t.SINGLE_TIMEUNITS.reduce(function(r,t){return o(e,t)&&(r[t]=n(t)),r},{});return a.day&&S.keys(a).length>1&&(console.warn('Time unit "'+e+'" is not supported. We are replacing it with ',(e+"").replace("day","date")+"."),delete a.day,a.date=n(d.DATE)),f.dateTimeExpr(a)}function s(e,r){if(S.contains([E.ROW,E.COLUMN,E.SHAPE,E.COLOR],r))return null;switch(e){case d.SECONDS:return S.range(0,60);case d.MINUTES:return S.range(0,60);case d.HOURS:return S.range(0,24);case d.DAY:return S.range(0,7);case d.DATE:return S.range(1,32);case d.MONTH:return S.range(0,12);case d.QUARTER:return[0,3,6,9]}return null}function l(e){return e?o(e,d.SECONDS)?"second":o(e,d.MINUTES)?"minute":o(e,d.HOURS)?"hour":o(e,d.DAY)||o(e,d.DATE)?"day":o(e,d.MONTH)?"month":o(e,d.YEAR)?"year":void 0:void 0}function p(e,r,t){if(e){var n=[];o(e,d.YEAR)&&n.push(t?"%y":"%Y"),o(e,d.QUARTER)&&n.push("'}}Q{{"+r+" | quarter}}{{"+r+" | time:'"),o(e,d.MONTH)&&n.push(t?"%b":"%B"),o(e,d.DAY)?n.push(t?"%a":"%A"):o(e,d.DATE)&&n.push("%d");var i=[];o(e,d.HOURS)&&i.push("%H"),o(e,d.MINUTES)&&i.push("%M"),o(e,d.SECONDS)&&i.push("%S"),o(e,d.MILLISECONDS)&&i.push("%L");var a=[];if(n.length>0&&a.push(n.join("-")),i.length>0&&a.push(i.join(":")),a.length>0){var c="{{"+r+" | time:'"+a.join(" ")+"'}}",u=r.replace(/(\[|\])/g,"\\$1");return c.replace(new RegExp("{{"+u+" \\| time:''}}","g"),"")}}}var E=e("./channel"),f=e("./datetime"),T=e("./scale"),S=e("./util");!function(e){e[e.YEAR="year"]="YEAR",e[e.MONTH="month"]="MONTH",e[e.DAY="day"]="DAY",e[e.DATE="date"]="DATE",e[e.HOURS="hours"]="HOURS",e[e.MINUTES="minutes"]="MINUTES",e[e.SECONDS="seconds"]="SECONDS",e[e.MILLISECONDS="milliseconds"]="MILLISECONDS",e[e.YEARMONTH="yearmonth"]="YEARMONTH",e[e.YEARMONTHDATE="yearmonthdate"]="YEARMONTHDATE",e[e.YEARMONTHDATEHOURS="yearmonthdatehours"]="YEARMONTHDATEHOURS",e[e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes"]="YEARMONTHDATEHOURSMINUTES",e[e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds"]="YEARMONTHDATEHOURSMINUTESSECONDS",e[e.HOURSMINUTES="hoursminutes"]="HOURSMINUTES",e[e.HOURSMINUTESSECONDS="hoursminutesseconds"]="HOURSMINUTESSECONDS",e[e.MINUTESSECONDS="minutesseconds"]="MINUTESSECONDS",e[e.SECONDSMILLISECONDS="secondsmilliseconds"]="SECONDSMILLISECONDS",e[e.QUARTER="quarter"]="QUARTER",e[e.YEARQUARTER="yearquarter"]="YEARQUARTER",e[e.QUARTERMONTH="quartermonth"]="QUARTERMONTH",e[e.YEARQUARTERMONTH="yearquartermonth"]="YEARQUARTERMONTH"}(t.TimeUnit||(t.TimeUnit={}));var d=t.TimeUnit;t.SINGLE_TIMEUNITS=[d.YEAR,d.QUARTER,d.MONTH,d.DAY,d.DATE,d.HOURS,d.MINUTES,d.SECONDS,d.MILLISECONDS];var A=t.SINGLE_TIMEUNITS.reduce(function(e,r){return e[r]=!0,e},{});t.isSingleTimeUnit=n,t.convert=i,t.MULTI_TIMEUNITS=[d.YEARQUARTER,d.YEARQUARTERMONTH,d.YEARMONTH,d.YEARMONTHDATE,d.YEARMONTHDATEHOURS,d.YEARMONTHDATEHOURSMINUTES,d.YEARMONTHDATEHOURSMINUTESSECONDS,d.QUARTERMONTH,d.HOURSMINUTES,d.HOURSMINUTESSECONDS,d.MINUTESSECONDS,d.SECONDSMILLISECONDS];var y=t.MULTI_TIMEUNITS.reduce(function(e,r){return e[r]=!0,e},{});t.isMultiTimeUnit=a,t.TIMEUNITS=t.SINGLE_TIMEUNITS.concat(t.MULTI_TIMEUNITS),t.containsTimeUnit=o,t.defaultScaleType=c,t.fieldExpr=u,t.rawDomain=s,t.smallestUnit=l,t.template=p},{"./channel":45,"./datetime":46,"./scale":51,"./util":56}],55:[function(e,r,t){"use strict";function n(e){var r=e;return t.TYPE_FROM_SHORT_TYPE[r.toUpperCase()]||r.toLowerCase()}!function(e){e[e.QUANTITATIVE="quantitative"]="QUANTITATIVE",e[e.ORDINAL="ordinal"]="ORDINAL",e[e.TEMPORAL="temporal"]="TEMPORAL",e[e.NOMINAL="nominal"]="NOMINAL"}(t.Type||(t.Type={}));var i=t.Type;t.QUANTITATIVE=i.QUANTITATIVE,t.ORDINAL=i.ORDINAL,t.TEMPORAL=i.TEMPORAL,t.NOMINAL=i.NOMINAL,t.SHORT_TYPE={quantitative:"Q",temporal:"T",nominal:"N",ordinal:"O"},t.TYPE_FROM_SHORT_TYPE={Q:t.QUANTITATIVE,T:t.TEMPORAL,O:t.ORDINAL,N:t.NOMINAL},t.getFullName=n},{}],56:[function(e,r,t){"use strict";function n(e,r){var t={};return r.forEach(function(r){e.hasOwnProperty(r)&&(t[r]=e[r])}),t}function i(e,r,t){if(arguments.length<3&&(t=1,arguments.length<2&&(r=e,e=0)),(r-e)/t===1/0)throw new Error("Infinite range");var n,i=[],a=-1;if(0>t)for(;(n=e+t*++a)>r;)i.push(n);else for(;(n=e+t*++a)-1}function u(e,r){return e.filter(function(e){return!c(r,e)})}function s(e,r){return e.concat(u(r,e))}function l(e,r,t){if(e.forEach)e.forEach.call(t,r);else for(var n in e)e.hasOwnProperty(n)&&r.call(t,e[n],n,e)}function p(e,r,t,n){if(e.reduce)return e.reduce.call(n,r,t);for(var i in e)e.hasOwnProperty(i)&&(t=r.call(n,t,e[i],i,e));return t}function E(e,r,t){if(e.map)return e.map.call(t,r);var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(r.call(t,e[i],i,e));return n}function f(e,r){for(var t=0,n=0;nn;++n)t=r?r(e[n]):e[n],t in o||(o[t]=1,a.push(e[n]));return a}function I(e){console.warn("[VL Warning]",e)}function g(e){console.error("[VL Error]",e)}function h(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r[t]&&e[t]&&r[t]!==e[t])return!0;return!1}var N=e("json-stable-stringify"),L=e("datalib/src/util");t.keys=L.keys,t.extend=L.extend,t.duplicate=L.duplicate,t.isArray=L.isArray,t.vals=L.vals,t.truncate=L.truncate,t.toMap=L.toMap,t.isObject=L.isObject,t.isString=L.isString,t.isNumber=L.isNumber,t.isBoolean=L.isBoolean;var O=e("datalib/src/util"),m=e("datalib/src/util");t.pick=n,t.range=i,t.omit=a,t.hash=o,t.contains=c,t.without=u,t.union=s,t.forEach=l,t.reduce=p,t.map=E,t.some=f,t.every=T,t.flatten=S,t.mergeDeep=d,t.unique=y,t.warning=I,t.error=g,t.differ=h},{"datalib/src/util":37,"json-stable-stringify":38}]},{},[14])(14)}); +//# sourceMappingURL=compassql.min.js.map diff --git a/compassql.min.js.map b/compassql.min.js.map new file mode 100644 index 00000000..ec139027 --- /dev/null +++ b/compassql.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["compassql.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","cql","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","2","factory","d3_time","newInterval","floori","offseti","count","field","interval","date","Date","floor","round","d0","d1","ceil","offset","step","Math","range","start","stop","push","filter","test","setTime","end","t0","t1","every","isFinite","d","weekday","setHours","setDate","getDate","getDay","getTimezoneOffset","utcWeekday","setUTCHours","setUTCDate","getUTCDate","getUTCDay","millisecond","k","second","setMilliseconds","getSeconds","minute","setSeconds","getMinutes","hour","setMinutes","getHours","day","sunday","monday","tuesday","wednesday","thursday","friday","saturday","month","setMonth","getMonth","getFullYear","year","setFullYear","utcSecond","setUTCMilliseconds","getUTCSeconds","utcMinute","setUTCSeconds","getUTCMinutes","utcHour","setUTCMinutes","getUTCHours","utcDay","utcSunday","utcMonday","utcTuesday","utcWednesday","utcThursday","utcFriday","utcSaturday","utcMonth","setUTCMonth","getUTCMonth","getUTCFullYear","utcYear","setUTCFullYear","milliseconds","seconds","minutes","hours","days","sundays","mondays","tuesdays","wednesdays","thursdays","fridays","saturdays","weeks","months","years","utcMillisecond","utcMilliseconds","utcSeconds","utcMinutes","utcHours","utcDays","utcSundays","utcMondays","utcTuesdays","utcWednesdays","utcThursdays","utcFridays","utcSaturdays","utcWeeks","utcMonths","utcYears","version","week","utcWeek","3","bins","opt","level","minstep","precision","v","eps","maxb","maxbins","base","logb","log","div","min","max","span","steps","bisect","pow","unit","value","index","x","lo","hi","mid","util","cmp","EPSILON","date_value","date_index","time","units","utc","dmin","dmax","minb","minbins","find","spec","raw","../time","../util","4","gen","repeat","val","Array","zeros","arguments","Infinity","j","random","uniform","undefined","samples","map","pdf","cdf","icdf","p","NaN","integer","b","normal","mean","stdev","next","rds","c","y","sqrt","exp","PI","cd","z","Z","abs","sum","SQRT2","bootstrap","domain","smooth","isValid","len","err","./util","5","annotation","data","types","TYPES","type","values","array","$","isString","isDate","isNumber","isBoolean","typeAll","fields","keys","reduce","infer","TESTS","splice","inferAll","PARSERS","boolean","number","string","isNaN","parse","all","parsers","6","ztest1","X","nullH","nullh","gaussian","mu","stats","SE","valid","ztestP","Y","n1","n2","diffs","ztest2","meanDiff","variance","unique","results","missing","distinct","median","sort","quantile","quartile","q","identity","H","h","delta","geometric","harmonic","isArray","M2","modeskew","avg","med","std","extent","dot","dist","isFunction","L2","cohensd","x1","x2","s1","s2","covariance","vx","vy","xm","ym","rank","idx","comparator","tie","cor","fn","mua","mub","sda","sdb","ra","rb","aa","bb","ab","A","mat","B","linearRegression","res","xy","sx","sy","slope","icept","fit","intercept","R","rss","ci","N","alpha","bs","means","numcmp","paired","m","M","entropy","counts","LN2","mutual","px","py","I","info","profile","sd","vals","q1","q3","summary","__summary__","./generate","./import/type","7","tempDate","entry","create","STEPS","toUnitMap","baseDate","utcBaseDate","UTC","locale","d3-time","8","Buffer","strrep","str","truncateOnWord","rev","cnt","tok","split","truncate_word_re","reverse","w","join","trim","slice","FNAME","namedfunc","name","duplicate","obj","JSON","stringify","equal","extend","toMap","list","keystr","String","toString","Object","prototype","isObject","isBuffer","format","replace","field_re","match","accessor","Function","mutator","$func","op","$valid","$length","$in","sign","stablesort","sortBy","keyFn","indices","sa","sb","permute","swap","pad","pos","padchar","truncate","word","ellipsis","l1","l2","buffer","9","channel_1","aggregate_1","mark_1","scale_1","sort_1","timeunit_1","type_1","property_1","DEFAULT_QUERY_CONFIG","verbose","defaultSpecConfig","overlay","line","scale","useRawDomain","propertyPrecedence","DEFAULT_PROPERTY_PRECEDENCE","marks","Mark","POINT","BAR","LINE","AREA","TICK","channels","ROW","COLUMN","SIZE","COLOR","aggregates","AggregateOp","MEAN","timeUnits","TimeUnit","YEAR","MONTH","DATE","MINUTES","SECONDS","Type","NOMINAL","ORDINAL","QUANTITATIVE","TEMPORAL","maxBinsList","axisAxisColors","axisAxisWidths","axisLayers","axisOffsets","axisOrients","axisGridColors","axisGridDashes","axisGridOpacities","axisGridWidths","axisFormats","axisLabelAngles","axisLabelMaxLengths","axisSubDivides","axisTicks","axisTickColors","axisTickLabelColors","axisTickLabelFonts","axisTickLabelFontSizes","axisTickPaddings","axisTickSizes","axisTickSizeMajors","axisTickSizeMinors","axisTickSizeEnds","axisTickWidths","axisValuesList","axisTitles","axisTitleColors","axisTitleFonts","axisTitleFontWeights","axisTitleFontSizes","axisTitleOffsets","axisTitleMaxLengths","axisCharacterWidths","legendOrients","legendOffsets","legendValuesList","legendFormats","legendLabelAligns","legendLabelBaselines","legendLabelColors","legendLabelFonts","legendLabelFontSizes","legendSymbolColors","legendSymbolShapes","legendSymbolSizes","legendSymbolStrokeWidths","legendTitles","legendTitleColors","legendTitleFonts","legendTitleFontSizes","legendTitleFontWeights","sorts","SortOrder","ASCENDING","DESCENDING","sortOps","MIN","sortOrders","scaleBandSizes","scaleDomains","scaleExponents","scaleRanges","scaleTypes","ScaleType","LOG","numberOrdinalProportion","numberOrdinalLimit","autoAddCount","hasAppropriateGraphicTypeForMark","omitAggregate","omitAggregatePlotWithDimensionOnlyOnFacet","omitAggregatePlotWithoutDimension","omitBarLineAreaWithOcclusion","omitBarTickWithSize","omitFacetOverPositionalChannels","omitMultipleNonPositionalChannels","omitNonSumStack","omitRaw","omitRawContinuousFieldForAggregatePlot","omitRepeatedField","omitNonPositionalOverPositionalChannels","omitTableWithOcclusionIfAutoAddCount","omitVerticalDotPlot","preferredBinAxis","Channel","preferredTemporalAxis","preferredOrdinalAxis","preferredNominalAxis","preferredFacet","maxCardinalityForCategoricalColor","maxCardinalityForFacet","maxCardinalityForShape","timeUnitShouldHaveVariation","typeMatchesSchemaType","smallBandSizeForHighCardinalityOrFacet","maxCardinality","bandSize","nominalColorScaleForHighCardinality","palette","xAxisOnTopForHighYCardinalityWithoutColumn","maxGoodCardinalityForFacet","maxGoodCardinalityForColor","./property","vega-lite/src/aggregate","vega-lite/src/channel","vega-lite/src/mark","vega-lite/src/scale","vega-lite/src/sort","vega-lite/src/timeunit","vega-lite/src/type","10","AbstractConstraintModel","constraint","description","properties","strict","11","_encoding","_spec","encoding","./encoding","./spec","12","checkEncoding","prop","enumSpec","specM","schema","encodingConstraints","ENCODING_CONSTRAINTS_BY_PROPERTY","encQ","getEncodingQueryByIndex","satisfy","violatedConstraint","console","toShorthand","__extends","__","constructor","hasOwnProperty","base_1","enumspec_1","schema_1","util_1","encoding_1","EncodingConstraintModel","_super","hasAllRequiredPropertiesSpecific","nestedEncProp","getNestedEncodingProperty","parent_1","parent","child","isEnumSpec","allowEnumSpecForProperties","ENCODING_CONSTRAINTS","Property","TYPE","AGGREGATE","aggregate","BIN","bin","CHANNEL","TIMEUNIT","channel","supportedRole","getSupportedRole","isDimension","dimension","isMeasure","measure","SCALE","SCALE_ZERO","zero","AUTOCOUNT","numFn","autoCount","timeUnit","timeUnitHasVariation","SCALE_PROPERTIES","concat","sType","scaleType","scaleProp","SUPPORTED_SCALE_PROPERTY_INDEX","contains","FIELD","primitiveType","PrimitiveType","BOOLEAN","STRING","NUMBER","INTEGER","cardinality","SHAPE","SCALE_TYPE","TIME","LINEAR","POW","SQRT","QUANTILE","QUANTIZE","ec","ENCODING_CONSTRAINT_INDEX","forEach","../enumspec","../property","../query/encoding","../schema","./base","13","checkSpec","specConstraints","SPEC_CONSTRAINTS_BY_PROPERTY","encoding_2","SpecConstraintModel","specConstraint","MARK","getMark","child_1","getEncodings","isEncodingProperty","SPEC_CONSTRAINTS","usedChannel","mark","encodings","_i","encodings_1","hasAutoCount","some","neverHaveAutoCount","enumSpecIndex","encodingIndicesByProperty","supportMark","channelUsed","TEXT","CIRCLE","SQUARE","RULE","isAggregate","hasNonFacetDim_1","hasDim_1","encodings_2","nonPositionChannelCount","NONSPATIAL_CHANNELS","DETAIL","usedField","xEncQ","getEncodingQueryByChannel","yEncQ","xIsMeasure","yIsMeasure","stack","measureEncQ","fieldChannel","SUM_OPS","sc","SPEC_CONSTRAINT_INDEX","14","enumerate","generate_1","generate","model","nest","property","cqlQuery","query_1","query","ranking","./constraint/constraint","./enumerator","./enumspec","./model","./nest","./query/query","./ranking/ranking","./schema","15","EncodingPropertyGeneratorFactory","answerSet","jobIndex","propEnumSpec","getEncodingProperty","propVal","setEncodingProperty","violatedEncodingConstraint","violatedSpecConstraint","spec_1","resetEncodingProperty","ENUMERATOR_INDEX","markEnumSpec","setMark","resetMark","ENCODING_PROPERTIES","NESTED_ENCODING_PROPERTIES","nestedProp","./constraint/encoding","./constraint/spec","16","SHORT_ENUM_SPEC","initEnumSpec","defaultName","defaultEnumValues","enum","ShortEnumSpec","ENUMSPEC","17","EnumSpecIndex","_mark","_encodings","_encodingIndicesByProperty","encodingsIndex","encIndex","hasProperty","isEmpty","defineProperty","get","enumerable","configurable","18","specQ","config_1","model_1","SpecQueryModel","build","reducer","enumerator_1","stylize_1","stylize","../src/enumerator","./config","./stylize","19","getDefaultName","BIN_MAXBINS","SORT","SORT_FIELD","SORT_OP","SORT_ORDER","SCALE_BANDSIZE","SCALE_CLAMP","SCALE_DOMAIN","SCALE_EXPONENT","SCALE_NICE","SCALE_RANGE","SCALE_ROUND","SCALE_USERAWDOMAIN","AXIS","AXIS_AXISCOLOR","AXIS_AXISWIDTH","AXIS_LAYER","AXIS_OFFSET","AXIS_ORIENT","AXIS_GRID","AXIS_GRIDCOLOR","AXIS_GRIDDASH","AXIS_GRIDOPACITY","AXIS_GRIDWIDTH","AXIS_LABELS","AXIS_FORMAT","AXIS_LABELANGLE","AXIS_LABELMAXLENGTH","AXIS_SHORTTIMELABELS","AXIS_SUBDIVIDE","AXIS_TICKS","AXIS_TICKCOLOR","AXIS_TICKLABELCOLOR","AXIS_TICKLABELFONT","AXIS_TICKLABELFONTSIZE","AXIS_TICKPADDING","AXIS_TICKSIZE","AXIS_TICKSIZEMAJOR","AXIS_TICKSIZEMINOR","AXIS_TICKSIZEEND","AXIS_TICKWIDTH","AXIS_VALUES","AXIS_TITLE","AXIS_TITLECOLOR","AXIS_TITLEFONT","AXIS_TITLEFONTSIZE","AXIS_TITLEFONTWEIGHT","AXIS_TITLEOFFSET","AXIS_TITLEMAXLENGTH","AXIS_CHARACTERWIDTH","LEGEND","LEGEND_ORIENT","LEGEND_OFFSET","LEGEND_VALUES","LEGEND_FORMAT","LEGEND_LABELALIGN","LEGEND_LABELBASELINE","LEGEND_LABELCOLOR","LEGEND_LABELFONT","LEGEND_LABELFONTSIZE","LEGEND_SHORTTIMELABELS","LEGEND_SYMBOLCOLOR","LEGEND_SYMBOLSHAPE","LEGEND_SYMBOLSIZE","LEGEND_SYMBOLSTROKEWIDTH","LEGEND_TITLE","LEGEND_TITLECOLOR","LEGEND_TITLEFONT","LEGEND_TITLEFONTSIZE","LEGEND_TITLEFONTWEIGHT","getDefaultEnumValues","enumspecindex_1","shorthand_1","enumSpecAssignment","_rankingScore","_channelCount","_enumSpecIndex","_enumSpecAssignment","_opt","_schema","name_1","warn","defaultEnumSpecName","propObj","countEncQ","hasNestedProperty","fieldDef","COUNT","PROPERTIES","toSpec","transform","config","getRankingScore","rankingName","setRankingScore","score","SpecQueryModelGroup","path","items","groupBy","orderGroupBy","_name","_path","_items","_groupBy","_orderGroupBy","getTopSpecQueryModel","topItem","set","./enumspecindex","./query/encoding","./query/shorthand","./query/spec","20","registerKeyFn","groupRegistry","specModels","rootGroup_1","groupIndex_1","includes_1","replaces_1","replacers_1","_loop_1","util_2","grpBy","groupby_1","isExtendedGroupBy","replaceFnIndex","fnIndex","getReplacer","group","key","specQuery","channelType","OPACITY","PATH","ORDER","stringifyStack","_stack","FIELD_TRANSFORM","ENCODING","TRANSPOSE","SPEC","./query/groupby","datalib/src/util","21","FILTER","CALCULATE","FILTERINVALID","STACK","ENCODING_INDEX","NESTED_ENCODING_INDEX","getNestedEncodingPropertyChildren","NESTED_ENCODING_PROPERTY_PARENT_INDEX","isNestedEncodingProperty","SUPPORTED_SCALE_PROPERTY","supportedScaleType","22","defaultScaleType","23","replaceIndex","valFrom","valTo","valsFrom","REPLACE_BLANK_FIELDS","*","REPLACE_XY_CHANNELS","REPLACE_FACET_CHANNELS","row","column","REPLACE_MARK_STYLE_CHANNELS","color","opacity","shape","size","24","normalize","nestedAnswerSet","nest_1","result","ranking_1","nest_2","orderBy","normalizedQ","chooseBy","shorthand","../config","../generate","../nest","../ranking/ranking","./groupby","./shorthand","./transform","25","vlSpec","vlspec","include","INCLUDE_ALL","fromSpec","parts","calculate","filterInvalid","includeExceptType","fieldEncQ","groupby","groupByEncQ","encQs","_filter","filters","filter_1","expression","formulaArr","calculateItem","expr","fieldDefStr","props","_a","nestedPropParent","nestedProps","nestedPropChildren","_b","_c","fieldAndParams","typeShort","substr","vega-lite/src/filter","26","channelDef","ENCODING_PROPERTIES_1","stacked","stack_1","StackOffset","NONE","stackByChannels","STACK_GROUP_CHANNELS","xIsAggregate","yIsAggregate","groupbyChannel","ZERO","vega-lite/src/stack","27","28","feature","aggregationQualityFeature","features","isRawContinuous","29","TypeChannelScore","effectiveness_1","init","SCORE","ORDERED_TYPE_CHANNEL_SCORE","text","detail","Q","BIN_Q","T","TIMEUNIT_T","TIMEUNIT_O","O","featurize","NOMINAL_TYPE_CHANNEL_SCORE","getScore","encodingQueryByField","fieldKey","bestFieldFeature","best","getExtendedType","featureScore","getFeatureScore","TYPE_CHANNEL","PreferredAxisScore","preferredAxes","preferredAxis","PREFERRED_AXIS","PreferredFacetScore","PREFERRED_FACET","MarkChannelScore","bar_size","tick_size","featureScores","MARK_CHANNEL","DimensionScore","maxFScore","DIMENSION","../../config","../../query/shorthand","../../util","./effectiveness","./type","30","FEATURE_INDEX","addFeatureFactory","FEATURE_FACTORIES","default_1","scores","MarkScore","MARK_SCORE","./channel","./mark","31","xType","yType","hasOcclusion","MEASURES","DISCRETE","DISCRETE_OR_NONE","occludedQQMark","point","tick","rect","bar","area","rule","noOccludedQQMark","occludedDimensionMeasureMark","feature2","noOccludedQxN","noOccludedQxBinQ","ttMark","tdMark","ddMark","isOccluded","32","ExtendedType","../../query/encoding","33","register","rankingRegistry","subgroup","groupComparator","m1","m2","g1","g2","effectiveness","aggregation","EFFECTIVENESS","./aggregation","./effectiveness/effectiveness","34","binSummary","dlBin","binUnique","timeSummary","timeunit","dateString","getTime","DAY","convert","oldUnique","newUnique","bucket","Number","invalidCount","prev","cur","bin_1","stats_1","type_2","Schema","fieldSchemas","fieldSchemaIndex","fieldSchema","summaries","timeStats","binStats","order","nominal","ordinal","temporal","quantitative","localeCompare","fieldSchemas_1","_d","augmentTimeUnitDomain","excludeInvalid","autoMaxBins","HOURS","QUARTER","MILLISECONDS","dateEncQ","fullTimeUnit","SINGLE_TIMEUNITS_1","SINGLE_TIMEUNITS","singleUnit","containsTimeUnit","datalib/src/bins/bins","datalib/src/import/type","datalib/src/stats","vega-lite/src/bin","35","encQIndex","colorEncQ","axis","orient","axis_1","AxisOrient","TOP","vega-lite/src/axis","36","item","indexOf","arr","thisArg","nestedMap","without","excludedItems","37","38","json","opts","space","cycles","replacer","node","aobj","bobj","seen","indent","colonSeparator","toJSON","out","TypeError","objectKeys","keyValue","","has","jsonify","39","./lib/parse","./lib/stringify","40","at","ch","escapee","\"","\\","/","error","message","charAt","hex","uffff","parseInt","fromCharCode","white","object","source","reviver","walk","holder","41","quote","escapable","lastIndex","meta","charCodeAt","partial","mind","gap","rep","apply","\b","\t","\n","\f","\r","42","AGGREGATE_OPS","VALUES","VALID","MISSING","DISTINCT","SUM","AVERAGE","VARIANCE","VARIANCEP","STDEV","STDEVP","MEDIAN","Q1","Q3","MODESKEW","MAX","ARGMIN","ARGMAX","SHARED_DOMAIN_OPS","43","defaultAxisConfig","grid","labels","labelMaxLength","tickSize","characterWidth","defaultFacetAxisConfig","axisWidth","44","45","getSupportedMark","circle","square","X2","Y2","LABEL","hasScale","CHANNELS","UNIT_CHANNELS","UNIT_SCALE_CHANNELS","NONSPATIAL_SCALE_CHANNELS","46","isDateTime","quarter","normalizeQuarter","normalizeMonth","lowerM","toLowerCase","monthIndex","MONTHS","shortM","shortMonthIndex","SHORT_MONTHS","normalizeDay","lowerD","dayIndex","DAYS","shortD","shortDayIndex","SHORT_DAYS","dateTimeExpr","47","countRetinal","channelEncoding","isRanged","y2","fieldDefs","channelMappingForEach","mapping","channelMappingMap","channelMappingReduce","48","prefix","suffix","isCount","nofn","binSuffix","noAggregate","datum","_isFieldDimension","title","countTitle","toUpperCase","./aggregate","./scale","49","isEqualFilter","isRangeFilter","isInFilter","fieldExpr","fielddef_1","valueExpr","lower","upper","datetime_1","isSingleTimeUnit","datetime","./datetime","./fielddef","./timeunit","50","ERRORBAR","PRIMITIVE_MARKS","51","NiceTime","BandSize","BANDSIZE_FIT","FIT","defaultScaleConfig","textBandWidth","padding","nominalColorRange","sequentialColorRange","shapeRange","fontSizeRange","ruleSizeRange","tickSizeRange","defaultFacetScaleConfig","52","isSortField","53","hasXField","hasYField","54","SINGLE_TIMEUNIT_INDEX","getMilliseconds","isMultiTimeUnit","MULTI_TIMEUNIT_INDEX","fullTimeUnitStr","timeUnitStr","func","fieldRef","tu","rawDomain","smallestUnit","template","shortTimeLabels","dateComponents","timeComponents","template_1","escapedField","RegExp","MULTI_TIMEUNITS","YEARQUARTER","YEARQUARTERMONTH","YEARMONTH","YEARMONTHDATE","YEARMONTHDATEHOURS","YEARMONTHDATEHOURSMINUTES","YEARMONTHDATEHOURSMINUTESSECONDS","QUARTERMONTH","HOURSMINUTES","HOURSMINUTESSECONDS","MINUTESSECONDS","SECONDSMILLISECONDS","TIMEUNITS","55","getFullName","typeString","TYPE_FROM_SHORT_TYPE","SHORT_TYPE","56","pick","copy","omit","hash","util_3","union","other","output","flatten","arrays","mergeDeep","dest","src","deepMerge_","warning","differ","dict","json-stable-stringify"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,gBAAVC,UAAoC,mBAATC,QAAsBA,OAAOD,QAAQD,QAAS,IAAmB,kBAATG,SAAqBA,OAAOC,IAAKD,UAAUH,OAAO,CAAC,GAAIK,EAAkCA,GAAb,mBAATC,QAAwBA,OAA+B,mBAATC,QAAwBA,OAA6B,mBAAPC,MAAsBA,KAAYC,KAAKJ,EAAEK,IAAMV,MAAO,WAAW,GAAIG,EAAsB,OAAO,SAAUQ,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATC,UAAqBA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGI,EAAE,MAAOA,GAA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C7DA,EAASA,EAA+B,qBAAI,uBAAyB,uBACrEA,EAASA,EAAiC,uBAAI,yBAA2B,0BAC1E7oB,EAAQ6oB,WAAa7oB,EAAQ6oB,aAChC,IAAIA,GAAW7oB,EAAQ6oB,QA2FvB7oB,GAAQo5B,kBAAoBA,EAC5Bp5B,EAAQsxB,qBACJzI,EAASM,QACTN,EAASI,IACTJ,EAASkL,YACTlL,EAASO,SACTP,EAASE,UACTF,EAASkB,UACTlB,EAAS8B,MACT9B,EAASC,KACTD,EAASmL,KACTnL,EAASoL,WACTpL,EAASqL,QACTrL,EAASsL,WACTtL,EAASe,MACTf,EAASuL,eACTvL,EAASwL,YACTxL,EAASyL,aACTzL,EAAS0L,eACT1L,EAAS2L,WACT3L,EAAS4L,YACT5L,EAAS6L,YACT7L,EAASuC,WACTvC,EAAS8L,mBACT9L,EAASgB,WACThB,EAAS+L,KACT/L,EAASgM,eACThM,EAASiM,eACTjM,EAASmO,oBACTnO,EAAS2M,YACT3M,EAASqM,UACTrM,EAASsM,eACTtM,EAASuM,cACTvM,EAASwM,iBACTxM,EAASyM,eACTzM,EAAS4M,gBACT5M,EAAS6M,oBACT7M,EAAS0M,YACT1M,EAASkM,WACTlM,EAASmM,YACTnM,EAASoM,YACTpM,EAAS8M,qBACT9M,EAAS+M,eACT/M,EAASiN,eACTjN,EAASkN,oBACTlN,EAASmN,mBACTnN,EAASoN,uBACTpN,EAASqN,iBACTrN,EAASgN,WACThN,EAASsN,cACTtN,EAASyN,iBACTzN,EAASuN,mBACTvN,EAASwN,mBACTxN,EAAS0N,eACT1N,EAAS4N,WACT5N,EAAS6N,gBACT7N,EAAS8N,eACT9N,EAAS+N,mBACT/N,EAASgO,qBACThO,EAASkO,oBACTlO,EAASiO,iBACTjO,EAAS2N,YACT3N,EAASoO,OACTpO,EAASqO,cACTrO,EAASsO,cACTtO,EAASuO,cACTvO,EAASwO,cACTxO,EAASyO,kBACTzO,EAAS0O,qBACT1O,EAAS2O,kBACT3O,EAAS4O,iBACT5O,EAAS6O,qBACT7O,EAAS8O,uBACT9O,EAAS+O,mBACT/O,EAASgP,mBACThP,EAASiP,kBACTjP,EAASkP,yBACTlP,EAASmP,aACTnP,EAASoP,kBACTpP,EAASqP,iBACTrP,EAASsP,qBACTtP,EAASuP,wBAEbp4B,EAAQod,6BAEJyL,EAASC,KACTD,EAAS8B,MAMT9B,EAASI,IACTJ,EAASO,SACTP,EAASE,UACTF,EAASkB,UACTlB,EAASmL,KACTnL,EAASoL,WACTpL,EAASqL,QACTrL,EAASsL,WAETtL,EAASkL,YAETlL,EAASM,QACTN,EAAS6D,KACT7D,EAASe,MACTf,EAAS+L,KACT/L,EAASoO,OAGTpO,EAASuL,eACTvL,EAASwL,YACTxL,EAASyL,aACTzL,EAAS0L,eACT1L,EAAS2L,WACT3L,EAAS4L,YACT5L,EAAS6L,YACT7L,EAASuC,WACTvC,EAAS8L,mBACT9L,EAASgB,WAEThB,EAASgM,eACThM,EAASiM,eACTjM,EAASmO,oBACTnO,EAAS2M,YACT3M,EAASqM,UACTrM,EAASsM,eACTtM,EAASuM,cACTvM,EAASwM,iBACTxM,EAASyM,eACTzM,EAAS4M,gBACT5M,EAAS6M,oBACT7M,EAAS0M,YACT1M,EAASkM,WACTlM,EAASmM,YACTnM,EAASoM,YACTpM,EAAS8M,qBACT9M,EAAS+M,eACT/M,EAASiN,eACTjN,EAASkN,oBACTlN,EAASmN,mBACTnN,EAASoN,uBACTpN,EAASqN,iBACTrN,EAASgN,WACThN,EAASsN,cACTtN,EAASyN,iBACTzN,EAASuN,mBACTvN,EAASwN,mBACTxN,EAAS0N,eACT1N,EAAS4N,WACT5N,EAAS6N,gBACT7N,EAAS8N,eACT9N,EAAS+N,mBACT/N,EAASgO,qBACThO,EAASkO,oBACTlO,EAASiO,iBACTjO,EAAS2N,YAET3N,EAASqO,cACTrO,EAASsO,cACTtO,EAASuO,cACTvO,EAASwO,cACTxO,EAASyO,kBACTzO,EAAS0O,qBACT1O,EAAS2O,kBACT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