diff --git a/compassql.js b/compassql.js new file mode 100644 index 00000000..53355d7c --- /dev/null +++ b/compassql.js @@ -0,0 +1,7001 @@ +(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: '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_1.isMeasure(xEncQ); + var yIsMeasure = yEncQ && encoding_1.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: 'omitTableWithOcclusion', + description: 'Raw Plots with x and y are both dimensions should be omitted 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 (specM.isDimension(channel_1.Channel.X) && + specM.isDimension(channel_1.Channel.Y) && + !specM.isAggregate() // TODO: refactor based on statistics + ) { + return false; + } + return true; + } + }, + { + name: 'scaleZeroMustMatchScaleType', + description: 'ScaleZero should not be used with LOG, ORDINAL, TIME and UTC', + properties: [property_1.Property.SCALE, property_1.Property.TYPE, property_1.Property.SCALE_TYPE, property_1.Property.SCALE_ZERO], + allowEnumSpecForProperties: false, + strict: true, + satisfy: function (specM, schema, opt) { + var encodings = specM.getEncodings(); + for (var _i = 0, encodings_4 = encodings; _i < encodings_4.length; _i++) { + var encQ = encodings_4[_i]; + if (encQ.scale) { + var scale = encQ.scale; + var sType = encoding_1.scaleType(scale.type, encQ.timeUnit, encQ.type); + if (util_1.contains([scale_1.ScaleType.LOG, scale_1.ScaleType.ORDINAL, scale_1.ScaleType.TIME, scale_1.ScaleType.UTC], sType) && + (scale.zero === true)) { + 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":34,"./base":10,"vega-lite/src/aggregate":44,"vega-lite/src/channel":46,"vega-lite/src/mark":49,"vega-lite/src/scale":50,"vega-lite/src/type":53}],14:[function(require,module,exports){ +"use strict"; +exports.version = '0.3.1'; +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.modelGroup = require('./modelgroup'); +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":17,"./model":18,"./modelgroup":19,"./nest":20,"./property":21,"./query/query":24,"./ranking/ranking":32,"./schema":33,"./util":34}],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.values.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.values.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.values || !!prop.name) && !util_1.isArray(prop)); +} +exports.isEnumSpec = isEnumSpec; +function initEnumSpec(prop, defaultName, defaultEnumValues) { + return util_1.extend({}, { + name: defaultName, + values: defaultEnumValues + }, prop); +} +exports.initEnumSpec = initEnumSpec; + +},{"./util":34}],17:[function(require,module,exports){ +"use strict"; +var enumerator_1 = require('../src/enumerator'); +var config_1 = require('./config'); +var model_1 = require('./model'); +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 type + if (model_1.hasPropertyIndex(enumSpecIndex, prop)) { + // update answerset + var reducer = enumerator_1.ENUMERATOR_INDEX[prop](enumSpecIndex, schema, opt); + answerSet = answerSet.reduce(reducer, []); + } + }); + return answerSet; +} +exports.generate = generate; + +},{"../src/enumerator":15,"./config":9,"./model":18}],18:[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 property_2 = require('./property'); +var spec_1 = require('./query/spec'); +var encoding_1 = require('./query/encoding'); +var shorthand_1 = require('./query/shorthand'); +var util_1 = require('./util'); +function hasPropertyIndex(enumSpecIndex, prop) { + if (property_2.isEncodingProperty(prop)) { + return !!enumSpecIndex.encodingIndicesByProperty[prop]; + } + if (prop === property_1.Property.MARK) { + return !!enumSpecIndex.mark; + } + /* istanbul ignore next */ + throw new Error('Unimplemented for property ' + prop); +} +exports.hasPropertyIndex = hasPropertyIndex; +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.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.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: + return schema.fields(); + // True, False for boolean values + case property_1.Property.BIN: + 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.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.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; +function setEnumSpecIndex(enumSpecIndex, index, prop, enumSpec) { + var encodingsIndex = enumSpecIndex.encodings; + // Init encoding index and set prop + var encIndex = encodingsIndex[index] = encodingsIndex[index] || {}; + encIndex[prop] = enumSpec; + // Initialize indicesByProperty[prop] and add index + var encodingIndicesByProperty = enumSpecIndex.encodingIndicesByProperty; + (encodingIndicesByProperty[prop] = encodingIndicesByProperty[prop] || []).push(index); +} +/** + * 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 = { encodings: {}, encodingIndicesByProperty: {} }; + // 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.mark = 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. + setEnumSpecIndex(enumSpecIndex, 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. + setEnumSpecIndex(enumSpecIndex, index, prop, enumSpec); + } + } + }); + }); + // AUTO COUNT + // Add Auto Count Field + if (opt.autoAddCount) { + var countEncQ = { + channel: { + name: getDefaultName(property_1.Property.CHANNEL) + specQ.encodings.length, + values: getDefaultEnumValues(property_1.Property.CHANNEL, schema, opt) + }, + autoCount: { + name: getDefaultName(property_1.Property.AUTOCOUNT) + specQ.encodings.length, + values: [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. + setEnumSpecIndex(enumSpecIndex, index, property_1.Property.CHANNEL, countEncQ.channel); + setEnumSpecIndex(enumSpecIndex, 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 + { values: 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.SCALE, property_1.Property.TIMEUNIT, property_1.Property.FIELD, property_1.Property.TYPE]; + 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]; + } + } + 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; + +},{"./enumspec":16,"./property":21,"./query/encoding":22,"./query/shorthand":25,"./query/spec":26,"./util":34,"vega-lite/src/aggregate":44,"vega-lite/src/type":53}],19:[function(require,module,exports){ +"use strict"; +function isSpecQueryModelGroup(item) { + return item.hasOwnProperty('items'); +} +exports.isSpecQueryModelGroup = isSpecQueryModelGroup; +function getTopItem(g) { + var topItem = g.items[0]; + if (isSpecQueryModelGroup(topItem)) { + return getTopItem(topItem); + } + else { + return topItem; + } +} +exports.getTopItem = getTopItem; + +},{}],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 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) { + var rootGroup = { name: '', path: '', items: [] }; + var groupIndex = {}; + if (query.nest) { + // 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; + 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[path]) { + groupIndex[path] = { + name: key, + path: path, + items: [] + }; + group.items.push(groupIndex[path]); + } + group = groupIndex[path]; + } + group.items.push(specM); + }); + } + else { + rootGroup.items = specModels; + } + return rootGroup; +} +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,"./query/groupby":23,"./query/shorthand":25,"./query/spec":26,"./util":34,"datalib/src/util":8,"vega-lite/src/channel":46}],21:[function(require,module,exports){ +"use strict"; +(function (Property) { + // TODO: Filter (Field, Value?) + Property[Property["MARK"] = 'mark'] = "MARK"; + // 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"; + // TODO: Sort + // - 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"; + // TODO: AXIS_* + // - Legend + Property[Property["LEGEND"] = 'legend'] = "LEGEND"; +})(exports.Property || (exports.Property = {})); +var Property = exports.Property; +function hasNestedProperty(prop) { + switch (prop) { + case Property.BIN: + case Property.SCALE: + // TODO: AXIS, LEGEND + return true; + case Property.MARK: + 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: + 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.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 +]; +exports.DEFAULT_PROPERTY_PRECEDENCE = [ + // Projection + Property.TYPE, + Property.FIELD, + // Field Transform + Property.BIN, + Property.TIMEUNIT, + Property.AGGREGATE, + Property.AUTOCOUNT, + // Nested Transform Property + Property.BIN_MAXBINS, + // Encoding + Property.CHANNEL, + Property.MARK, + Property.SCALE, + // Nested Encoding Property + 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 +]; +exports.NESTED_ENCODING_PROPERTIES = [ + { + property: Property.BIN_MAXBINS, + parent: 'bin', + child: 'maxbins' + }, + { + 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' + } +]; +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>); +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; + +},{}],22:[function(require,module,exports){ +"use strict"; +var timeunit_1 = require('vega-lite/src/timeunit'); +var type_1 = require('vega-lite/src/type'); +var scale_1 = require('vega-lite/src/scale'); +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 +} +exports.isDimension = isDimension; +function isMeasure(encQ) { + return (encQ.type === type_1.Type.QUANTITATIVE && !encQ.bin) || + (encQ.type === type_1.Type.TEMPORAL && !encQ.timeUnit); +} +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(scaleType, timeUnit, type) { + if (scaleType !== undefined) { + return scaleType; + } + 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(); + } +} +exports.scaleType = scaleType; + +},{"../enumspec":16,"../util":34,"vega-lite/src/scale":50,"vega-lite/src/timeunit":52,"vega-lite/src/type":53}],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":34,"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":17,"../nest":20,"../ranking/ranking":32,"../util":34,"./encoding":22,"./groupby":23,"./shorthand":25,"./spec":26,"./transform":27}],25:[function(require,module,exports){ +"use strict"; +var type_1 = require('vega-lite/src/type'); +var spec_1 = require('./spec'); +var enumspec_1 = require('../enumspec'); +var property_1 = require('../property'); +var util_1 = 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 = property_1.DEFAULT_PROPERTY_PRECEDENCE.reduce(function (m, prop) { + m[prop] = true; + return m; +}, {}); +/** + * 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])); + } + // TODO: transform + // TODO: stack Property + var _stack = spec_1.stack(specQ); + if (_stack) { + // TODO: use shorthandValue once we have proper stack property + parts.push('stack=' + _stack.offset); + } + parts.push(specQ.encodings.map(function (encQ) { return encoding(encQ, include, replace); }) + .filter(function (encQStr) { return !!encQStr; }) + .sort() // sort at the end to ignore order + .join('|')); + return parts.join('|'); +} +exports.spec = spec; +/** + * 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: axis, legend + var _loop_1 = function(nestedPropParent) { + if (include[nestedPropParent]) { + if (encQ[nestedPropParent] && !enumspec_1.isEnumSpec(encQ[nestedPropParent])) { + 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_1.keys(nestedPropChildren).length > 0) { + props.push({ + key: nestedPropParent + '', + value: JSON.stringify(nestedPropChildren) + }); + } + } + else if (encQ[nestedPropParent] === false || encQ[nestedPropParent] === null) { + props.push({ + key: nestedPropParent + '', + value: false + }); + } + } + }; + for (var _b = 0, _c = [property_1.Property.SCALE]; _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":34,"./spec":26,"vega-lite/src/type":53}],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), + fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y, + stackByChannels: stackByChannels, + offset: stacked || stack_1.StackOffset.ZERO + }; + } + return null; +} +exports.stack = stack; + +},{"../enumspec":16,"../property":21,"../util":34,"vega-lite/src/channel":46,"vega-lite/src/mark":49,"vega-lite/src/stack":51}],27:[function(require,module,exports){ +"use strict"; + +},{}],28:[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.45, + 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.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 + [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.O].forEach(function (type) { + [channel_1.Channel.ROW, channel_1.Channel.COLUMN].forEach(function (channel) { + SCORE[featurize(type, channel)] += 0.25; + }); + }); + var NOMINAL_TYPE_CHANNEL_SCORE = { + x: 0, + y: 0, + color: -0.5, + shape: -0.6, + 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 = effectiveness_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: 'bin_' + type_1.Q, + opt: 'preferredBinAxis' + }, { + feature: type_1.T, + 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 = effectiveness_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":34,"./effectiveness":29,"./type":31,"vega-lite/src/channel":46}],29:[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 getExtendedType(encQ) { + return (encQ.bin ? 'bin_' : encQ.timeUnit ? 'timeUnit_' : '') + encQ.type; +} +exports.getExtendedType = getExtendedType; +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":28,"./mark":30}],30:[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 DIMENSIONS = [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.O, type_1.N]; + var DIMENSIONS_OR_NONE = DIMENSIONS.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, + 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 + DIMENSIONS_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; + }); + }); + // no occlusion + [type_1.NONE, type_1.N].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.O].forEach(function (yType) { + 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; + }); + }); + }); + // DxD + DIMENSIONS_OR_NONE.forEach(function (xType) { + DIMENSIONS_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 ? effectiveness_1.getExtendedType(xEncQ) : '-'; + var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y); + var yType = yEncQ ? effectiveness_1.getExtendedType(yEncQ) : '-'; + 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":34,"./effectiveness":29,"./type":31,"vega-lite/src/channel":46,"vega-lite/src/mark":49}],31:[function(require,module,exports){ +"use strict"; +var type_1 = require('vega-lite/src/type'); +/** + * 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"; + ExtendedType[ExtendedType["TIMEUNIT_T"] = 'timeUnit_' + type_1.Type.TEMPORAL] = "TIMEUNIT_T"; + 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.O = ExtendedType.O; +exports.N = ExtendedType.N; +exports.NONE = ExtendedType.NONE; + +},{"vega-lite/src/type":53}],32:[function(require,module,exports){ +"use strict"; +var modelgroup_1 = require('../modelgroup'); +exports.effectiveness = require('./effectiveness/effectiveness'); +/** + * 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) { + // for chooseBy -- only keep the top-item + group.items = [group.items[0]]; + } + } + } + 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 = modelgroup_1.getTopItem(g1); + var m2 = modelgroup_1.getTopItem(g2); + 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); + +},{"../modelgroup":19,"./effectiveness/effectiveness":29}],33:[function(require,module,exports){ +"use strict"; +var type_1 = require('vega-lite/src/type'); +var bin_1 = require('vega-lite/src/bin'); +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 + if (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; + } + else { + type = type_1.Type.NOMINAL; + } + return { + field: field, + type: type, + primitiveType: primitiveType, + stats: summary + }; + }); + // 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); + } + }); + var schema = new Schema(fieldSchemas); + // calculate preset bins + for (var _i = 0, fieldSchemas_1 = fieldSchemas; _i < fieldSchemas_1.length; _i++) { + var fieldSchema = fieldSchemas_1[_i]; + if (fieldSchema.type === type_1.Type.QUANTITATIVE) { + fieldSchema.binStats = {}; + 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) { + // need to get min/max of date data + fieldSchema.stats.min = new Date(data[0][fieldSchema.field]); + fieldSchema.stats.max = new Date(data[0][fieldSchema.field]); + for (var i = 0; i < data.length; i++) { + var time = new Date(data[i][fieldSchema.field]).getTime(); + if (time < fieldSchema.stats.min.getTime()) { + fieldSchema.stats.min = new Date(time); + } + if (time > fieldSchema.stats.max.getTime()) { + fieldSchema.stats.max = new Date(time); + } + } + } + } + return schema; + }; + 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; + }; + Schema.prototype.cardinality = function (encQ) { + 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 fieldSchema_1 = this.fieldSchemaIndex[encQ.field]; + var maxbins = bin.maxbins; + if (!fieldSchema_1.binStats[maxbins]) { + // need to calculate + fieldSchema_1.binStats[maxbins] = binSummary(maxbins, fieldSchema_1.stats); + } + return fieldSchema_1.binStats[maxbins].distinct; + } + else if (encQ.timeUnit) { + return 1; // FIXME + } + var fieldSchema = this.fieldSchemaIndex[encQ.field]; + return fieldSchema ? fieldSchema.stats.distinct : null; + }; + 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 with the correct distinct property given a max number of bins + */ +function binSummary(maxbins, summary) { + var bin = dlBin({ + min: summary.min, + max: summary.max, + maxbins: maxbins + }); + var binSum = util_1.extend({}, summary); + binSum.distinct = (bin.stop - bin.start) / bin.step; + return binSum; +} +(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":34,"datalib/src/bins/bins":3,"datalib/src/import/type":5,"datalib/src/stats":6,"vega-lite/src/bin":45,"vega-lite/src/type":53}],34:[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}],35:[function(require,module,exports){ +arguments[4][2][0].apply(exports,arguments) +},{"dup":2}],36:[function(require,module,exports){ +arguments[4][3][0].apply(exports,arguments) +},{"../time":38,"../util":39,"dup":3}],37:[function(require,module,exports){ +arguments[4][4][0].apply(exports,arguments) +},{"./util":39,"dup":4}],38:[function(require,module,exports){ +arguments[4][7][0].apply(exports,arguments) +},{"d3-time":35,"dup":7}],39:[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; +}; + +},{}],43:[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}); +}; + +},{}],44:[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, +]; +// TODO: move supportedTypes, supportedEnums from schema to here + +},{}],45:[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":46}],46:[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":54}],47:[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":54}],48:[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":46,"./util":54}],49:[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]; + +},{}],50:[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 +}; + +},{}],51:[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":46,"./encoding":48,"./mark":49,"./util":54}],52:[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"; + 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; +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 this RegExp Hack!!! + return template_1.replace(new RegExp('{{' + field + ' \\| time:\'\'}}', 'g'), ''); + } + else { + return undefined; + } +} +exports.template = template; + +},{"./channel":46,"./datetime":47,"./scale":50,"./util":54}],53:[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; + +},{}],54:[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 generate_1 = require('datalib/src/generate'); +exports.range = generate_1.range; +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; +/** + * 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; +} +// FIXME remove this +var dlBin = require('datalib/src/bins/bins'); +function getbins(stats, maxbins) { + return dlBin({ + min: stats.min, + max: stats.max, + maxbins: maxbins + }); +} +exports.getbins = getbins; +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/bins/bins":36,"datalib/src/generate":37,"datalib/src/util":39,"json-stable-stringify":40}]},{},[14])(14) +}); +//# sourceMappingURL=compassql.js.map diff --git a/compassql.js.map b/compassql.js.map new file mode 100644 index 00000000..56f5c7bb --- /dev/null +++ b/compassql.js.map @@ -0,0 +1,113 @@ +{ + "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/generate.js", + "src/model.js", + "src/modelgroup.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/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/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/bin.js", + "../vega-lite/src/channel.js", + "../vega-lite/src/datetime.js", + "../vega-lite/src/encoding.js", + "../vega-lite/src/mark.js", + "../vega-lite/src/scale.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;;ACxDA;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;;ACxQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvjBA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;AC/JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;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;;AClKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvFA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;ACvMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;;AChEA;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;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;ACrOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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", + "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: '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_1.isMeasure(xEncQ);\n var yIsMeasure = yEncQ && encoding_1.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: 'omitTableWithOcclusion',\n description: 'Raw Plots with x and y are both dimensions should be omitted 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 (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 return true;\n }\n },\n {\n name: 'scaleZeroMustMatchScaleType',\n description: 'ScaleZero should not be used with LOG, ORDINAL, TIME and UTC',\n properties: [property_1.Property.SCALE, property_1.Property.TYPE, property_1.Property.SCALE_TYPE, property_1.Property.SCALE_ZERO],\n allowEnumSpecForProperties: false,\n strict: true,\n satisfy: function (specM, schema, opt) {\n var encodings = specM.getEncodings();\n for (var _i = 0, encodings_4 = encodings; _i < encodings_4.length; _i++) {\n var encQ = encodings_4[_i];\n if (encQ.scale) {\n var scale = encQ.scale;\n var sType = encoding_1.scaleType(scale.type, encQ.timeUnit, encQ.type);\n if (util_1.contains([scale_1.ScaleType.LOG, scale_1.ScaleType.ORDINAL, scale_1.ScaleType.TIME, scale_1.ScaleType.UTC], sType) &&\n (scale.zero === true)) {\n return false;\n }\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.3.1';\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.modelGroup = require('./modelgroup');\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.values.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.values.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.values || !!prop.name) && !util_1.isArray(prop));\n}\nexports.isEnumSpec = isEnumSpec;\nfunction initEnumSpec(prop, defaultName, defaultEnumValues) {\n return util_1.extend({}, {\n name: defaultName,\n values: defaultEnumValues\n }, prop);\n}\nexports.initEnumSpec = initEnumSpec;\n//# sourceMappingURL=enumspec.js.map", + "\"use strict\";\nvar enumerator_1 = require('../src/enumerator');\nvar config_1 = require('./config');\nvar model_1 = require('./model');\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 type\n if (model_1.hasPropertyIndex(enumSpecIndex, prop)) {\n // update answerset\n var reducer = enumerator_1.ENUMERATOR_INDEX[prop](enumSpecIndex, schema, opt);\n answerSet = answerSet.reduce(reducer, []);\n }\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 property_2 = require('./property');\nvar spec_1 = require('./query/spec');\nvar encoding_1 = require('./query/encoding');\nvar shorthand_1 = require('./query/shorthand');\nvar util_1 = require('./util');\nfunction hasPropertyIndex(enumSpecIndex, prop) {\n if (property_2.isEncodingProperty(prop)) {\n return !!enumSpecIndex.encodingIndicesByProperty[prop];\n }\n if (prop === property_1.Property.MARK) {\n return !!enumSpecIndex.mark;\n }\n /* istanbul ignore next */\n throw new Error('Unimplemented for property ' + prop);\n}\nexports.hasPropertyIndex = hasPropertyIndex;\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.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.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:\n return schema.fields();\n // True, False for boolean values\n case property_1.Property.BIN:\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.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.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;\nfunction setEnumSpecIndex(enumSpecIndex, index, prop, enumSpec) {\n var encodingsIndex = enumSpecIndex.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 = enumSpecIndex.encodingIndicesByProperty;\n (encodingIndicesByProperty[prop] = encodingIndicesByProperty[prop] || []).push(index);\n}\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 = { encodings: {}, encodingIndicesByProperty: {} };\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.mark = 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 setEnumSpecIndex(enumSpecIndex, 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 setEnumSpecIndex(enumSpecIndex, 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 values: getDefaultEnumValues(property_1.Property.CHANNEL, schema, opt)\n },\n autoCount: {\n name: getDefaultName(property_1.Property.AUTOCOUNT) + specQ.encodings.length,\n values: [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 setEnumSpecIndex(enumSpecIndex, index, property_1.Property.CHANNEL, countEncQ.channel);\n setEnumSpecIndex(enumSpecIndex, 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 { values: 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.SCALE, property_1.Property.TIMEUNIT, property_1.Property.FIELD, property_1.Property.TYPE];\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 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;\n//# sourceMappingURL=model.js.map", + "\"use strict\";\nfunction isSpecQueryModelGroup(item) {\n return item.hasOwnProperty('items');\n}\nexports.isSpecQueryModelGroup = isSpecQueryModelGroup;\nfunction getTopItem(g) {\n var topItem = g.items[0];\n if (isSpecQueryModelGroup(topItem)) {\n return getTopItem(topItem);\n }\n else {\n return topItem;\n }\n}\nexports.getTopItem = getTopItem;\n//# sourceMappingURL=modelgroup.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 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 var rootGroup = { name: '', path: '', items: [] };\n var groupIndex = {};\n if (query.nest) {\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;\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[path]) {\n groupIndex[path] = {\n name: key,\n path: path,\n items: []\n };\n group.items.push(groupIndex[path]);\n }\n group = groupIndex[path];\n }\n group.items.push(specM);\n });\n }\n else {\n rootGroup.items = specModels;\n }\n return rootGroup;\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\";\n(function (Property) {\n // TODO: Filter (Field, Value?)\n Property[Property[\"MARK\"] = 'mark'] = \"MARK\";\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 // TODO: Sort\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 // TODO: AXIS_*\n // - Legend\n Property[Property[\"LEGEND\"] = 'legend'] = \"LEGEND\";\n})(exports.Property || (exports.Property = {}));\nvar Property = exports.Property;\nfunction hasNestedProperty(prop) {\n switch (prop) {\n case Property.BIN:\n case Property.SCALE:\n // TODO: AXIS, LEGEND\n return true;\n case Property.MARK:\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 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.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];\nexports.DEFAULT_PROPERTY_PRECEDENCE = [\n // Projection\n Property.TYPE,\n Property.FIELD,\n // Field Transform\n Property.BIN,\n Property.TIMEUNIT,\n Property.AGGREGATE,\n Property.AUTOCOUNT,\n // Nested Transform Property\n Property.BIN_MAXBINS,\n // Encoding\n Property.CHANNEL,\n Property.MARK,\n Property.SCALE,\n // Nested Encoding Property\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];\nexports.NESTED_ENCODING_PROPERTIES = [\n {\n property: Property.BIN_MAXBINS,\n parent: 'bin',\n child: 'maxbins'\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];\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>);\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;\n//# sourceMappingURL=property.js.map", + "\"use strict\";\nvar timeunit_1 = require('vega-lite/src/timeunit');\nvar type_1 = require('vega-lite/src/type');\nvar scale_1 = require('vega-lite/src/scale');\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}\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}\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(scaleType, timeUnit, type) {\n if (scaleType !== undefined) {\n return scaleType;\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();\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 type_1 = require('vega-lite/src/type');\nvar spec_1 = require('./spec');\nvar enumspec_1 = require('../enumspec');\nvar property_1 = require('../property');\nvar util_1 = 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 = property_1.DEFAULT_PROPERTY_PRECEDENCE.reduce(function (m, prop) {\n m[prop] = true;\n return m;\n}, {});\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 // TODO: transform\n // TODO: stack Property\n var _stack = spec_1.stack(specQ);\n if (_stack) {\n // TODO: use shorthandValue once we have proper stack property\n parts.push('stack=' + _stack.offset);\n }\n parts.push(specQ.encodings.map(function (encQ) { return encoding(encQ, include, replace); })\n .filter(function (encQStr) { return !!encQStr; })\n .sort() // sort at the end to ignore order\n .join('|'));\n return parts.join('|');\n}\nexports.spec = spec;\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: axis, legend\n var _loop_1 = function(nestedPropParent) {\n if (include[nestedPropParent]) {\n if (encQ[nestedPropParent] && !enumspec_1.isEnumSpec(encQ[nestedPropParent])) {\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_1.keys(nestedPropChildren).length > 0) {\n props.push({\n key: nestedPropParent + '',\n value: JSON.stringify(nestedPropChildren)\n });\n }\n }\n else if (encQ[nestedPropParent] === false || encQ[nestedPropParent] === null) {\n props.push({\n key: nestedPropParent + '',\n value: false\n });\n }\n }\n };\n for (var _b = 0, _c = [property_1.Property.SCALE]; _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 fieldChannel: xIsAggregate ? channel_1.X : channel_1.Y,\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 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.45,\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.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\n [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.O].forEach(function (type) {\n [channel_1.Channel.ROW, channel_1.Channel.COLUMN].forEach(function (channel) {\n SCORE[featurize(type, channel)] += 0.25;\n });\n });\n var NOMINAL_TYPE_CHANNEL_SCORE = {\n x: 0,\n y: 0,\n color: -0.5,\n shape: -0.6,\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 = effectiveness_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: 'bin_' + type_1.Q,\n opt: 'preferredBinAxis'\n }, {\n feature: type_1.T,\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 = effectiveness_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 getExtendedType(encQ) {\n return (encQ.bin ? 'bin_' : encQ.timeUnit ? 'timeUnit_' : '') + encQ.type;\n}\nexports.getExtendedType = getExtendedType;\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 DIMENSIONS = [type_1.BIN_Q, type_1.TIMEUNIT_T, type_1.O, type_1.N];\n var DIMENSIONS_OR_NONE = DIMENSIONS.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 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 DIMENSIONS_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 // no occlusion\n [type_1.NONE, type_1.N].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.O].forEach(function (yType) {\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 // DxD\n DIMENSIONS_OR_NONE.forEach(function (xType) {\n DIMENSIONS_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 ? effectiveness_1.getExtendedType(xEncQ) : '-';\n var yEncQ = specM.getEncodingQueryByChannel(channel_1.Channel.Y);\n var yType = yEncQ ? effectiveness_1.getExtendedType(yEncQ) : '-';\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 type_1 = require('vega-lite/src/type');\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 ExtendedType[ExtendedType[\"TIMEUNIT_T\"] = 'timeUnit_' + type_1.Type.TEMPORAL] = \"TIMEUNIT_T\";\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.O = ExtendedType.O;\nexports.N = ExtendedType.N;\nexports.NONE = ExtendedType.NONE;\n//# sourceMappingURL=type.js.map", + "\"use strict\";\nvar modelgroup_1 = require('../modelgroup');\nexports.effectiveness = require('./effectiveness/effectiveness');\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 // for chooseBy -- only keep the top-item\n group.items = [group.items[0]];\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 = modelgroup_1.getTopItem(g1);\n var m2 = modelgroup_1.getTopItem(g2);\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);\n//# sourceMappingURL=ranking.js.map", + "\"use strict\";\nvar type_1 = require('vega-lite/src/type');\nvar bin_1 = require('vega-lite/src/bin');\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\n if (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 }\n else {\n type = type_1.Type.NOMINAL;\n }\n return {\n field: field,\n type: type,\n primitiveType: primitiveType,\n stats: summary\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 var schema = new Schema(fieldSchemas);\n // calculate preset bins\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 fieldSchema.binStats = {};\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 // need to get min/max of date data\n fieldSchema.stats.min = new Date(data[0][fieldSchema.field]);\n fieldSchema.stats.max = new Date(data[0][fieldSchema.field]);\n for (var i = 0; i < data.length; i++) {\n var time = new Date(data[i][fieldSchema.field]).getTime();\n if (time < fieldSchema.stats.min.getTime()) {\n fieldSchema.stats.min = new Date(time);\n }\n if (time > fieldSchema.stats.max.getTime()) {\n fieldSchema.stats.max = new Date(time);\n }\n }\n }\n }\n return schema;\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 Schema.prototype.cardinality = function (encQ) {\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 fieldSchema_1 = this.fieldSchemaIndex[encQ.field];\n var maxbins = bin.maxbins;\n if (!fieldSchema_1.binStats[maxbins]) {\n // need to calculate\n fieldSchema_1.binStats[maxbins] = binSummary(maxbins, fieldSchema_1.stats);\n }\n return fieldSchema_1.binStats[maxbins].distinct;\n }\n else if (encQ.timeUnit) {\n return 1; // FIXME\n }\n var fieldSchema = this.fieldSchemaIndex[encQ.field];\n return fieldSchema ? fieldSchema.stats.distinct : null;\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 with the correct distinct property given a 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 var binSum = util_1.extend({}, summary);\n binSum.distinct = (bin.stop - bin.start) / bin.step;\n return binSum;\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 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// TODO: move supportedTypes, supportedEnums from schema to here\n//# sourceMappingURL=aggregate.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", + "\"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\";\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 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;\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 this RegExp Hack!!!\n return template_1.replace(new RegExp('{{' + field + ' \\\\| time:\\'\\'}}', 'g'), '');\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 generate_1 = require('datalib/src/generate');\nexports.range = generate_1.range;\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/**\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}\n// FIXME remove this\nvar dlBin = require('datalib/src/bins/bins');\nfunction getbins(stats, maxbins) {\n return dlBin({\n min: stats.min,\n max: stats.max,\n maxbins: maxbins\n });\n}\nexports.getbins = getbins;\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..140bdf0d --- /dev/null +++ b/compassql.min.js @@ -0,0 +1,5 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.cql=e()}}(function(){var e;return function n(e,t,r){function i(a,u){if(!t[a]){if(!e[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var l=t[a]={exports:{}};e[a][0].call(l.exports,function(n){var t=e[a][1][n];return i(t?t:n)},l,l.exports,n,e,t,r)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;an-r?r:i},u.ceil=function(n){return e(n=new Date(n-1)),t(n,1),n},u.offset=function(e,n){return t(e=new Date(+e),null==n?1:Math.floor(n)),e},u.range=function(n,r,i){var o=[];if(n=new Date(n-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>n&&i>0))return o;for(t(n,1),e(n),r>n&&o.push(new Date(+n));t(n,i),e(n),r>n;)o.push(new Date(+n));return o},u.filter=function(r){return n(function(n){for(;e(n),!r(n);)n.setTime(n-1)},function(e,n){for(;--n>=0;)for(;t(e,1),!r(e););})},r&&(u.count=function(n,t){return i.setTime(+n),o.setTime(+t),e(i),e(o),Math.floor(r(i,o))},u.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?u.filter(a?function(n){return a(n)%e===0}:function(n){return u.count(0,n)%e===0}):u:null}),u}function t(e){return n(function(n){n.setHours(0,0,0,0),n.setDate(n.getDate()-(n.getDay()+7-e)%7)},function(e,n){e.setDate(e.getDate()+7*n)},function(e,n){return(n-e-6e4*(n.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return n(function(n){n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7)},function(e,n){e.setUTCDate(e.getUTCDate()+7*n)},function(e,n){return(n-e)/6048e5})}var i=new Date,o=new Date,a=n(function(){},function(e,n){e.setTime(+e+n)},function(e,n){return n-e});a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n(function(n){n.setTime(Math.floor(n/e)*e)},function(n,t){n.setTime(+n+t*e)},function(n,t){return(t-n)/e}):a:null};var u=n(function(e){e.setMilliseconds(0)},function(e,n){e.setTime(+e+1e3*n)},function(e,n){return(n-e)/1e3},function(e){return e.getSeconds()}),c=n(function(e){e.setSeconds(0,0)},function(e,n){e.setTime(+e+6e4*n)},function(e,n){return(n-e)/6e4},function(e){return e.getMinutes()}),s=n(function(e){e.setMinutes(0,0,0)},function(e,n){e.setTime(+e+36e5*n)},function(e,n){return(n-e)/36e5},function(e){return e.getHours()}),l=n(function(e){e.setHours(0,0,0,0)},function(e,n){e.setDate(e.getDate()+n)},function(e,n){return(n-e-6e4*(n.getTimezoneOffset()-e.getTimezoneOffset()))/864e5},function(e){return e.getDate()-1}),f=t(0),p=t(1),E=t(2),d=t(3),y=t(4),h=t(5),g=t(6),m=n(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,n){e.setMonth(e.getMonth()+n)},function(e,n){return n.getMonth()-e.getMonth()+12*(n.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),T=n(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,n){e.setFullYear(e.getFullYear()+n)},function(e,n){return n.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}),A=n(function(e){e.setUTCMilliseconds(0)},function(e,n){e.setTime(+e+1e3*n)},function(e,n){return(n-e)/1e3},function(e){return e.getUTCSeconds()}),N=n(function(e){e.setUTCSeconds(0,0)},function(e,n){e.setTime(+e+6e4*n)},function(e,n){return(n-e)/6e4},function(e){return e.getUTCMinutes()}),S=n(function(e){e.setUTCMinutes(0,0,0)},function(e,n){e.setTime(+e+36e5*n)},function(e,n){return(n-e)/36e5},function(e){return e.getUTCHours()}),v=n(function(e){e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCDate(e.getUTCDate()+n)},function(e,n){return(n-e)/864e5},function(e){return e.getUTCDate()-1}),C=r(0),I=r(1),O=r(2),R=r(3),M=r(4),P=r(5),L=r(6),U=n(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,n){e.setUTCMonth(e.getUTCMonth()+n)},function(e,n){return n.getUTCMonth()-e.getUTCMonth()+12*(n.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),D=n(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n)},function(e,n){return n.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}),_=a.range,b=u.range,k=c.range,w=s.range,x=l.range,F=f.range,B=p.range,Y=E.range,H=d.range,G=y.range,Q=h.range,X=g.range,q=f.range,j=m.range,V=T.range,$=a,W=_,z=A.range,K=N.range,Z=S.range,J=v.range,ee=C.range,ne=I.range,te=O.range,re=R.range,ie=M.range,oe=P.range,ae=L.range,ue=C.range,ce=U.range,se=D.range,le="0.1.1";e.version=le,e.milliseconds=_,e.seconds=b,e.minutes=k,e.hours=w,e.days=x,e.sundays=F,e.mondays=B,e.tuesdays=Y,e.wednesdays=H,e.thursdays=G,e.fridays=Q,e.saturdays=X,e.weeks=q,e.months=j,e.years=V,e.utcMillisecond=$,e.utcMilliseconds=W,e.utcSeconds=z,e.utcMinutes=K,e.utcHours=Z,e.utcDays=J,e.utcSundays=ee,e.utcMondays=ne,e.utcTuesdays=te,e.utcWednesdays=re,e.utcThursdays=ie,e.utcFridays=oe,e.utcSaturdays=ae,e.utcWeeks=ue,e.utcMonths=ce,e.utcYears=se,e.millisecond=a,e.second=u,e.minute=c,e.hour=s,e.day=l,e.sunday=f,e.monday=p,e.tuesday=E,e.wednesday=d,e.thursday=y,e.friday=h,e.saturday=g,e.week=f,e.month=m,e.year=T,e.utcSecond=A,e.utcMinute=N,e.utcHour=S,e.utcDay=v,e.utcSunday=C,e.utcMonday=I,e.utcTuesday=O,e.utcWednesday=R,e.utcThursday=M,e.utcFriday=P,e.utcSaturday=L,e.utcWeek=C,e.utcMonth=U,e.utcYear=D,e.interval=n})},{}],3:[function(e,n,t){function r(e){if(!e)throw Error("Missing binning options.");var n,t,r,u,c,s,l,f=e.maxbins||15,p=e.base||10,E=Math.log(p),d=e.div||[5,2],y=e.min,h=e.max,g=h-y;if(e.step)n=e.step;else if(e.steps)n=e.steps[Math.min(e.steps.length-1,i(e.steps,g/f,0,e.steps.length))];else{for(t=Math.ceil(Math.log(f)/E),r=e.minstep||0,n=Math.max(r,Math.pow(p,Math.round(Math.log(g)/E)-t));Math.ceil(g/n)>f;)n*=p;for(s=0;s=r&&f>=g/c&&(n=c)}return c=Math.log(n),u=c>=0?0:~~(-c/E)+1,l=Math.pow(p,-u-1),y=Math.min(y,Math.floor(y/n+l)*n),h=Math.ceil(h/n)*n,{start:y,stop:h,step:n,unit:{precision:u},value:o,index:a}}function i(e,n,t,r){for(;r>t;){var i=t+r>>>1;s.cmp(e[i],n)<0?t=i+1:r=i}return t}function o(e){return this.step*Math.floor(e/this.step+f)}function a(e){return Math.floor((e-this.start)/this.step+f)}function u(e){return this.unit.date(o.call(this,e))}function c(e){return a.call(this,this.unit.unit(e))}var s=e("../util"),l=e("../time"),f=1e-15;r.date=function(e){if(!e)throw Error("Missing date binning options.");var n=e.utc?l.utc:l,t=e.min,i=e.max,o=e.maxbins||20,a=e.minbins||4,s=+i-+t,f=e.unit?n[e.unit]:n.find(s,a,o),p=r({min:null!=f.min?f.min:f.unit(t),max:null!=f.max?f.max:f.unit(i),maxbins:o,minstep:f.minstep,steps:f.step});return p.unit=f,p.index=c,e.raw||(p.value=u),p},n.exports=r},{"../time":7,"../util":8}],4:[function(e,n,t){var r=e("./util"),i=n.exports;i.repeat=function(e,n){var t,r=Array(n);for(t=0;n>t;++t)r[t]=e;return r},i.zeros=function(e){return i.repeat(0,e)},i.range=function(e,n,t){if(arguments.length<3&&(t=1,arguments.length<2&&(n=e,e=0)),(n-e)/t==1/0)throw new Error("Infinite range");var r,i=[],o=-1;if(0>t)for(;(r=e+t*++o)>n;)i.push(r);else for(;(r=e+t*++o)=e&&n>=r?1/t:0},r.cdf=function(r){return e>r?0:r>n?1:(r-e)/t},r.icdf=function(n){return n>=0&&1>=n?e+n*t:NaN},r},i.random.integer=function(e,n){void 0===n&&(n=e,e=0);var t=n-e,r=function(){return e+Math.floor(t*Math.random())};return r.samples=function(e){return i.zeros(e).map(r)},r.pdf=function(r){return r===Math.floor(r)&&r>=e&&n>r?1/t:0},r.cdf=function(r){var i=Math.floor(r);return e>i?0:i>=n?1:(i-e+1)/t},r.icdf=function(n){return n>=0&&1>=n?e-1+Math.floor(n*t):NaN},r},i.random.normal=function(e,n){e=e||0,n=n||1;var t,r=function(){var r,i,o=0,a=0;if(void 0!==t)return o=t,t=void 0,o;do o=2*Math.random()-1,a=2*Math.random()-1,r=o*o+a*a;while(0===r||r>1);return i=Math.sqrt(-2*Math.log(r)/r),t=e+a*i*n,e+o*i*n};return r.samples=function(e){return i.zeros(e).map(r)},r.pdf=function(t){var r=Math.exp(Math.pow(t-e,2)/(-2*Math.pow(n,2)));return 1/(n*Math.sqrt(2*Math.PI))*r},r.cdf=function(t){var r,i=(t-e)/n,o=Math.abs(i);if(o>37)r=0;else{var a,u=Math.exp(-o*o/2);7.07106781186547>o?(a=.0352624965998911*o+.700383064443688,a=a*o+6.37396220353165,a=a*o+33.912866078383,a=a*o+112.079291497871,a=a*o+221.213596169931,a=a*o+220.206867912376,r=u*a,a=.0883883476483184*o+1.75566716318264,a=a*o+16.064177579207,a=a*o+86.7807322029461,a=a*o+296.564248779674,a=a*o+637.333633378831,a=a*o+793.826512519948,a=a*o+440.413735824752,r/=a):(a=o+.65,a=o+4/a,a=o+3/a,a=o+2/a,a=o+1/a,r=u/a/2.506628274631)}return i>0?1-r:r},r.icdf=function(t){if(0>=t||t>=1)return NaN;var r=2*t-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),o=2/(Math.PI*i)+Math.log(1-Math.pow(r,2))/2,a=Math.log(1-r*r)/i,u=(r>0?1:-1)*Math.sqrt(Math.sqrt(o*o-a)-o);return e+n*Math.SQRT2*u},r},i.random.bootstrap=function(e,n){var t=e.filter(r.isValid),o=t.length,a=n?i.random.normal(0,n):null,u=function(){return t[~~(Math.random()*o)]+(a?a():0)};return u.samples=function(e){return i.zeros(e).map(u)},u}},{"./util":8}],5:[function(e,n,t){function r(e,n){return n?void(e[s]=n):e&&e[s]||null}function i(e,n){e=c.array(e),n=c.$(n);var t,r,i;if(e[s]&&(t=n(e[s]),c.isString(t)))return t;for(r=0,i=e.length;!c.isValid(t)&&i>r;++r)t=n?n(e[r]):e[r];return c.isDate(t)?"date":c.isNumber(t)?"number":c.isBoolean(t)?"boolean":c.isString(t)?"string":null}function o(e,n){return e.length?(n=n||c.keys(e[0]),n.reduce(function(n,t){return n[t]=i(e,t),n},{})):void 0}function a(e,n){e=c.array(e),n=c.$(n);var t,r,i,o=["boolean","integer","number","date"];for(t=0;ti;++i)a.isValid(o[i])&&a.isValid(u[i])&&f.push(o[i]-u[i]);return s.z.test(f,e&&e.nullh||0)}function o(e,n,t,r){var i=r?n.map(a.$(t)):n,o=r?n.map(a.$(r)):t,u=s.count.valid(i),l=s.count.valid(o),f=c.random.normal(0,1),p=s.mean(i)-s.mean(o)-(e&&e.nullh||0),E=Math.sqrt(s.variance(i)/u+s.variance(o)/l);if(0===E)return 0===p?1:0;var d=p/E;return 2*f.cdf(-Math.abs(d))}var a=e("./util"),u=e("./import/type"),c=e("./generate"),s=n.exports;s.unique=function(e,n,t){n=a.$(n),t=t||[];var r,i,o,u={};for(i=0,o=e.length;o>i;++i)r=n?n(e[i]):e[i],r in u||(u[r]=1,t.push(r));return t},s.count=function(e){return e&&e.length||0},s.count.valid=function(e,n){n=a.$(n);var t,r,i,o=0;for(r=0,i=e.length;i>r;++r)t=n?n(e[r]):e[r],a.isValid(t)&&(o+=1);return o},s.count.missing=function(e,n){n=a.$(n);var t,r,i,o=0;for(r=0,i=e.length;i>r;++r)t=n?n(e[r]):e[r],null==t&&(o+=1);return o},s.count.distinct=function(e,n){n=a.$(n);var t,r,i,o={},u=0;for(r=0,i=e.length;i>r;++r)t=n?n(e[r]):e[r],t in o||(o[t]=1,u+=1);return u},s.count.map=function(e,n){n=a.$(n);var t,r,i,o={};for(r=0,i=e.length;i>r;++r)t=n?n(e[r]):e[r],o[t]=t in o?o[t]+1:1;return o},s.median=function(e,n){return n&&(e=e.map(a.$(n))),e=e.filter(a.isValid).sort(a.cmp),s.quantile(e,.5)},s.quartile=function(e,n){n&&(e=e.map(a.$(n))),e=e.filter(a.isValid).sort(a.cmp);var t=s.quantile;return[t(e,.25),t(e,.5),t(e,.75)]},s.quantile=function(e,n,t){void 0===t&&(t=n,n=a.identity),n=a.$(n);var r=(e.length-1)*t+1,i=Math.floor(r),o=+n(e[i-1]),u=r-i;return u?o+u*(n(e[i])-o):o},s.sum=function(e,n){n=a.$(n);for(var t,r=0,i=0,o=e.length;o>i;++i)t=n?n(e[i]):e[i],a.isValid(t)&&(r+=t);return r},s.mean=function(e,n){n=a.$(n);var t,r,i,o,u,c=0;for(r=0,o=0,i=e.length;i>r;++r)u=n?n(e[r]):e[r],a.isValid(u)&&(t=u-c,c+=t/++o);return c},s.mean.geometric=function(e,n){n=a.$(n);var t,r,i,o,u=1;for(o=0,t=0,r=e.length;r>o;++o)if(i=n?n(e[o]):e[o],a.isValid(i)){if(0>=i)throw Error("Geometric mean only defined for positive values.");u*=i,++t}return u=t>0?Math.pow(u,1/t):0},s.mean.harmonic=function(e,n){n=a.$(n);var t,r,i,o,u=0;for(o=0,t=0,r=e.length;r>o;++o)i=n?n(e[o]):e[o],a.isValid(i)&&(u+=1/i,++t);return t/u},s.variance=function(e,n){if(n=a.$(n),!a.isArray(e)||e.length<2)return 0;var t,r,i,o,u=0,c=0;for(r=0,i=0;ro;++o)if(i=n?n(e[o]):e[o],a.isValid(i)){t=r=i;break}for(;u>o;++o)i=n?n(e[o]):e[o],a.isValid(i)&&(t>i&&(t=i),i>r&&(r=i));return[t,r]},s.extent.index=function(e,n){n=a.$(n);var t,r,i,o,u=-1,c=-1,s=e.length;for(o=0;s>o;++o)if(i=n?n(e[o]):e[o],a.isValid(i)){t=r=i,u=c=o;break}for(;s>o;++o)i=n?n(e[o]):e[o],a.isValid(i)&&(t>i&&(t=i,u=o),i>r&&(r=i,c=o));return[u,c]},s.dot=function(e,n,t){var r,i,o=0;if(t)for(n=a.$(n),t=a.$(t),r=0;ro;++o)i=u?n(c[o])-t(s[o]):c[o]-s[o],E+=f?i*i:Math.pow(Math.abs(i),l);return f?Math.sqrt(E):Math.pow(E,1/l)},s.cohensd=function(e,n,t){var r=t?e.map(a.$(n)):e,i=t?e.map(a.$(t)):n,o=s.mean(r),u=s.mean(i),c=s.count.valid(r),l=s.count.valid(i);if(0>=c+l-2)return 0;var f=s.variance(r),p=s.variance(i),E=Math.sqrt(((c-1)*f+(l-1)*p)/(c+l-2));return 0===E?0:(o-u)/E},s.covariance=function(e,n,t){var r,i,o,u,c,l=t?e.map(a.$(n)):e,f=t?e.map(a.$(t)):n,p=l.length,E=s.mean(l),d=s.mean(f),y=0,h=0;if(p!==f.length)throw Error("Input lengths must match.");for(r=0;p>r;++r)if(i=l[r],u=a.isValid(i),o=f[r],c=a.isValid(o),u&&c)y+=(i-E)*(o-d),++h;else if(u||c)throw Error("Valid values must align.");return y/(h-1)},s.rank=function(e,n){n=a.$(n)||a.identity;var t,r,i,o=e.map(function(e,t){return{idx:t,val:n(e)}}).sort(a.comparator("val")),u=e.length,c=Array(u),s=-1,l={};for(t=0;u>t;++t){if(r=o[t].val,0>s&&l===r)s=t-1;else if(s>-1&&l!==r){for(i=1+(t-1+s)/2;t>s;++s)c[o[s].idx]=i;s=-1}c[o[t].idx]=t+1,l=r}if(s>-1)for(i=1+(u-1+s)/2;u>s;++s)c[o[s].idx]=i;return c},s.cor=function(e,n,t){var r=t;t=r?e.map(a.$(t)):n,n=r?e.map(a.$(n)):e;var i=s.dot(n,t),o=s.mean(n),u=s.mean(t),c=s.stdev(n),l=s.stdev(t),f=e.length;return(i-f*o*u)/((f-1)*c*l)},s.cor.rank=function(e,n,t){var r,i,o,a=t?s.rank(e,n):s.rank(e),u=t?s.rank(e,t):s.rank(n),c=e.length;for(r=0,i=0;c>r;++r)o=a[r]-u[r],i+=o*o;return 1-6*i/(c*(c*c-1))},s.cor.dist=function(e,n,t){var r,i,o,u,c=t?e.map(a.$(n)):e,l=t?e.map(a.$(t)):n,f=s.dist.mat(c),p=s.dist.mat(l),E=f.length;for(r=0,i=0,o=0,u=0;E>r;++r)i+=f[r]*f[r],o+=p[r]*p[r],u+=f[r]*p[r];return Math.sqrt(u/Math.sqrt(i*o))},s.linearRegression=function(e,n,t){var r,i,o=t?e.map(a.$(n)):e,u=t?e.map(a.$(t)):n,c=o.length,l=s.covariance(o,u),f=s.stdev(o),p=s.stdev(u),E=l/(f*f),d=s.mean(u)-E*s.mean(o),y={slope:E,intercept:d,R:l/(f*p),rss:0};for(i=0;c>i;++i)a.isValid(o[i])&&a.isValid(u[i])&&(r=E*o[i]+d-u[i],y.rss+=r*r);return y},s.bootstrap={},s.bootstrap.ci=function(e,n,t,r,i){var o,u,l,f,p,E,d;for(a.isFunction(n)||a.isString(n)?(o=e.map(a.$(n)),u=t,l=r,f=i):(o=e,u=n,l=t,f=r),u=u?+u:1e3,l=l||.05,p=c.random.bootstrap(o,f),d=0,E=Array(u);u>d;++d)E[d]=s.mean(p.samples(o.length));return E.sort(a.numcmp),[s.quantile(E,l/2),s.quantile(E,1-l/2)]},s.z={},s.z.ci=function(e,n,t){var r=e,i=n;(a.isFunction(n)||a.isString(n))&&(r=e.map(a.$(n)),i=t),i=i||.05;var o=.05===i?1.96:c.random.normal(0,1).icdf(1-i/2),u=s.mean(r),l=s.stdev(r)/Math.sqrt(s.count.valid(r));return[u-o*l,u+o*l]},s.z.test=function(e,n,t,u){return a.isFunction(t)||a.isString(t)?(u&&u.paired?i:o)(u,e,n,t):a.isArray(n)?(t&&t.paired?i:o)(t,e,n):a.isFunction(n)||a.isString(n)?r(t,e,n):r(n,e)},s.dist.mat=function(e){var n,t,r,i=e.length,o=i*i,a=Array(o),u=c.zeros(i),s=0;for(t=0;i>t;++t)for(a[t*i+t]=0,r=t+1;i>r;++r)a[t*i+r]=n=Math.abs(e[t]-e[r]),a[r*i+t]=n,u[t]+=n,u[r]+=n;for(t=0;i>t;++t)s+=u[t],u[t]/=i;for(s/=o,t=0;i>t;++t)for(r=t;i>r;++r)a[t*i+r]+=s-u[t]-u[r],a[r*i+t]=a[t*i+r];return a},s.entropy=function(e,n){n=a.$(n);var t,r,i=0,o=0,u=e.length;for(t=0;u>t;++t)i+=n?n(e[t]):e[t];if(0===i)return 0;for(t=0;u>t;++t)r=(n?n(e[t]):e[t])/i,r&&(o+=r*Math.log(r));return-o/Math.LN2},s.mutual=function(e,n,t,r){var i,o,u,c=r?e.map(a.$(n)):e,s=r?e.map(a.$(t)):n,l=r?e.map(a.$(r)):t,f={},p={},E=l.length,d=0,y=0,h=0;for(u=0;E>u;++u)f[c[u]]=0,p[s[u]]=0;for(u=0;E>u;++u)f[c[u]]+=l[u],p[s[u]]+=l[u],d+=l[u];for(o=1/(d*Math.LN2),u=0;E>u;++u)0!==l[u]&&(i=d*l[u]/(f[c[u]]*p[s[u]]),y+=l[u]*o*Math.log(i),h+=l[u]*o*Math.log(l[u]/d));return[y,1+y/h]},s.mutual.info=function(e,n,t,r){return s.mutual(e,n,t,r)[0]},s.mutual.dist=function(e,n,t,r){return s.mutual(e,n,t,r)[1]},s.profile=function(e,n){var t,r,i,o,c,l=0,f=0,p=0,E=0,d=null,y=null,h=0,g=[],m={};for(i=0;ic)&&(d=c),(null===y||c>y)&&(y=c),t=c-l,l+=t/++f,h+=t*(c-l),g.push(c));return h/=f-1,r=Math.sqrt(h),g.sort(a.cmp),{type:u(e,n),unique:m,count:e.length,valid:f,missing:p,distinct:E,min:d,max:y,mean:l,stdev:r,median:o=s.quantile(g,.5),q1:s.quantile(g,.25),q3:s.quantile(g,.75),modeskew:0===r?0:(l-o)/r}},s.summary=function(e,n){n=n||a.keys(e[0]);var t=n.map(function(n){var t=s.profile(e,a.$(n));return t.field=n,t});return t.__summary__=!0,t}},{"./generate":4,"./import/type":5,"./util":8}],7:[function(e,n,t){function r(e){return s.setTime(+e),s}function i(e,n,t,r,i,o){var a={type:e,date:n,unit:t};return r?a.step=r:a.minstep=1,null!=i&&(a.min=i),null!=o&&(a.max=o),a}function o(e,n,t,r,o,a){return i(e,function(e){return n.offset(t,e)},function(e){return n.count(t,e)},r,o,a)}function a(e,n,t,r){var i,o,a,u=d[0];for(i=1,o=d.length;o>i;++i)if(u=d[i],n>u[0]){if(a=n/u[0],a>r)return e[d[i-1][1]];if(a>=t)return e[u[1]]}return e[d[o-1][1]]}function u(e){var n,t,r={};for(n=0,t=e.length;t>n;++n)r[e[n].type]=e[n];return r.find=function(n,t,r){return a(e,n,t,r)},r}var c=e("d3-time"),s=new Date,l=new Date(0,0,1).setFullYear(0),f=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),p=[o("second",c.second,l),o("minute",c.minute,l),o("hour",c.hour,l),o("day",c.day,l,[1,7]),o("month",c.month,l,[1,3,6]),o("year",c.year,l),i("seconds",function(e){return new Date(1970,0,1,0,0,e)},function(e){return r(e).getSeconds()},null,0,59),i("minutes",function(e){return new Date(1970,0,1,0,e)},function(e){return r(e).getMinutes()},null,0,59),i("hours",function(e){return new Date(1970,0,1,e)},function(e){return r(e).getHours()},null,0,23),i("weekdays",function(e){return new Date(1970,0,4+e)},function(e){return r(e).getDay()},[1],0,6),i("dates",function(e){return new Date(1970,0,e)},function(e){return r(e).getDate()},[1],1,31),i("months",function(e){return new Date(1970,e%12,1)},function(e){return r(e).getMonth()},[1],0,11)],E=[o("second",c.utcSecond,f),o("minute",c.utcMinute,f),o("hour",c.utcHour,f),o("day",c.utcDay,f,[1,7]),o("month",c.utcMonth,f,[1,3,6]),o("year",c.utcYear,f),i("seconds",function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return r(e).getUTCSeconds()},null,0,59),i("minutes",function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return r(e).getUTCMinutes()},null,0,59),i("hours",function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return r(e).getUTCHours()},null,0,23),i("weekdays",function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return r(e).getUTCDay()},[1],0,6),i("dates",function(e){return new Date(Date.UTC(1970,0,e))},function(e){return r(e).getUTCDate()},[1],1,31),i("months",function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return r(e).getUTCMonth()},[1],0,11)],d=[[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]];n.exports=u(p),n.exports.utc=u(E)},{"d3-time":2}],8:[function(e,n,t){(function(e){function t(e,n){var t,r="";for(t=0;e>t;++t)r+=n;return r}function r(e,n,t){var r=0,i=e.split(c);return e=t?(i=i.reverse()).filter(function(e){return r+=e.length,n>=r}).reverse():i.filter(function(e){return r+=e.length,n>=r}),e.length?e.join("").trim():i[0].slice(0,n)}var i=n.exports,o="__name__";i.namedfunc=function(e,n){return n[o]=e,n},i.name=function(e){return null==e?null:e[o]},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,n){return JSON.stringify(e)===JSON.stringify(n)},i.extend=function(e){for(var n,t,r=1,i=arguments.length;i>r;++r){n=arguments[r];for(t in n)e[t]=n[t]}return e},i.length=function(e){return null!=e&&null!=e.length?e.length:null},i.keys=function(e){var n,t=[];for(n in e)t.push(n);return t},i.vals=function(e){var n,t=[];for(n in e)t.push(e[n]);return t},i.toMap=function(e,n){return(n=i.$(n))?e.reduce(function(e,t){return e[n(t)]=1,e},{}):e.reduce(function(e,n){return e[n]=1,e},{})},i.keystr=function(e){var n=e.length;if(!n)return"";for(var t=String(e[0]),r=1;n>r;++r)t+="|"+String(e[r]);return t};var a=Object.prototype.toString;i.isObject=function(e){return e===Object(e)},i.isFunction=function(e){return"[object Function]"===a.call(e)},i.isString=function(e){return"string"==typeof value||"[object String]"===a.call(e)},i.isArray=Array.isArray||function(e){return"[object Array]"===a.call(e)},i.isNumber=function(e){return"number"==typeof e||"[object Number]"===a.call(e)},i.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==a.call(e)},i.isDate=function(e){return"[object Date]"===a.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,n){var t=n?n: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 u=/\[(.*?)\]|[^.\[]+/g;i.field=function(e){return String(e).match(u).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 n;return i.isString(e)&&(n=i.field(e)).length>1?function(e,t){for(var r=0;ri;++i){if(a=e[i],u=a(t),c=a(r),c>u)return-1*n[i];if(u>c)return n[i]}return 0}},i.cmp=function(e,n){return n>e?-1:e>n?1:e>=n?0:null===e?-1:null===n?1:NaN},i.numcmp=function(e,n){return e-n},i.stablesort=function(e,n,t){var r=e.reduce(function(e,n,r){return e[t(n)]=r,e},{});return e.sort(function(e,i){var o=n(e),a=n(i);return a>o?-1:o>a?1:r[t(e)]-r[t(i)]}),e},i.permute=function(e){for(var n,t,r=e.length;r;)t=Math.floor(Math.random()*r--),n=e[r],e[r]=e[t],e[t]=n},i.pad=function(e,n,r,i){i=i||" ";var o=n-e.length;if(0>=o)return e;switch(r){case"left":return t(o,i)+e;case"middle":case"center":return t(Math.floor(o/2),i)+e+t(Math.ceil(o/2),i);default:return e+t(o,i)}},i.truncate=function(e,n,t,i,o){var a=e.length;if(n>=a)return e;o=void 0!==o?String(o):"…";var u=Math.max(0,n-o.length);switch(t){case"left":return o+(i?r(e,u,1):e.slice(a-u));case"middle":case"center":var c=Math.ceil(u/2),s=Math.floor(u/2);return(i?r(e,c):e.slice(0,c))+o+(i?r(e,s,1):e.slice(a-s));default:return(i?r(e,u):e.slice(0,u))+o}};var c=/([\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,n,t){"use strict";var r=e("vega-lite/src/channel"),i=e("vega-lite/src/aggregate"),o=e("vega-lite/src/mark"),a=e("vega-lite/src/scale"),u=e("vega-lite/src/timeunit"),c=e("vega-lite/src/type"),s=e("./property");t.DEFAULT_QUERY_CONFIG={verbose:!1,defaultSpecConfig:{overlay:{line:!0},scale:{useRawDomain:!0}},propertyPrecedence:s.DEFAULT_PROPERTY_PRECEDENCE,marks:[o.Mark.POINT,o.Mark.BAR,o.Mark.LINE,o.Mark.AREA,o.Mark.TICK],channels:[r.X,r.Y,r.ROW,r.COLUMN,r.SIZE,r.COLOR],aggregates:[void 0,i.AggregateOp.MEAN],timeUnits:[void 0,u.TimeUnit.YEAR,u.TimeUnit.MONTH,u.TimeUnit.DAY,u.TimeUnit.DATE],types:[c.Type.NOMINAL,c.Type.ORDINAL,c.Type.QUANTITATIVE,c.Type.TEMPORAL],maxBinsList:[5,10,20],scaleBandSizes:[17,21],scaleDomains:[void 0],scaleExponents:[1],scaleRanges:[void 0],scaleTypes:[a.ScaleType.LINEAR,a.ScaleType.LOG],numberOrdinalProportion:.05,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitFacetOverPositionalChannels:!0,omitMultipleNonPositionalChannels:!0,omitNonSumStack:!0,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOverPositionalChannels:!0,omitTableWithOcclusion:!0,omitVerticalDotPlot:!1,preferredBinAxis:r.Channel.X,preferredTemporalAxis:r.Channel.X,preferredOrdinalAxis:r.Channel.Y,preferredNominalAxis:r.Channel.Y,preferredFacet:r.Channel.ROW,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:10,maxCardinalityForShape:6,typeMatchesSchemaType:!0,maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7}},{"./property":21,"vega-lite/src/aggregate":44,"vega-lite/src/channel":46,"vega-lite/src/mark":49,"vega-lite/src/scale":50,"vega-lite/src/timeunit":52,"vega-lite/src/type":53}],10:[function(e,n,t){"use strict";var r=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=r},{}],11:[function(e,n,t){"use strict";var r=e("./encoding"),i=e("./spec");t.encoding=r,t.spec=i},{"./encoding":12,"./spec":13}],12:[function(e,n,t){"use strict";function r(e,n,r,i,o,a){for(var u=t.ENCODING_CONSTRAINTS_BY_PROPERTY[e]||[],c=i.getEncodingQueryByIndex(r),s=0;s=r}},{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,n,t){return!e.timeUnit||e.type===u.Type.TEMPORAL}},{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,n,t){var r=n.primitiveType(e.field),i=e.type;switch(r){case f.PrimitiveType.BOOLEAN:case f.PrimitiveType.STRING:return i!==u.Type.QUANTITATIVE&&i!==u.Type.TEMPORAL;case f.PrimitiveType.NUMBER:case f.PrimitiveType.INTEGER:return i!==u.Type.TEMPORAL;case f.PrimitiveType.DATE:return i===u.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,n,t){return n.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,n,t){return e.channel===o.Channel.COLOR&&e.type===u.Type.NOMINAL?n.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,n,t){return e.channel===o.Channel.ROW||e.channel===o.Channel.COLUMN?n.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,n,t){return e.channel===o.Channel.SHAPE?n.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,n,t){if(e.scale){var r=e.type,i=E.scaleType(e.scale.type,e.timeUnit,r);if(p.contains([u.Type.ORDINAL,u.Type.NOMINAL],r))return p.contains([a.ScaleType.ORDINAL,void 0],i);if(r===u.Type.TEMPORAL)return e.timeUnit?p.contains([a.ScaleType.TIME,a.ScaleType.UTC,a.ScaleType.ORDINAL,void 0],i):p.contains([a.ScaleType.TIME,a.ScaleType.UTC,void 0],i);if(r===u.Type.QUANTITATIVE)return e.bin?p.contains([a.ScaleType.LINEAR,void 0],i):p.contains([a.ScaleType.LOG,a.ScaleType.POW,a.ScaleType.SQRT,a.ScaleType.QUANTILE,a.ScaleType.QUANTIZE,a.ScaleType.LINEAR,void 0],i)}return!0}}].map(function(e){return new d(e)}),t.ENCODING_CONSTRAINT_INDEX=t.ENCODING_CONSTRAINTS.reduce(function(e,n){return e[n.name()]=n,e},{}),t.ENCODING_CONSTRAINTS_BY_PROPERTY=t.ENCODING_CONSTRAINTS.reduce(function(e,n){return n.properties().forEach(function(t){e[t]=e[t]||[],e[t].push(n)}),e},{}),t.checkEncoding=r},{"../enumspec":16,"../property":21,"../query/encoding":22,"../schema":33,"../util":34,"./base":10,"vega-lite/src/channel":46,"vega-lite/src/scale":50,"vega-lite/src/type":53}],13:[function(e,n,t){"use strict";function r(e,n,r,i,o){for(var a=t.SPEC_CONSTRAINTS_BY_PROPERTY[e]||[],u=0;u1))return!1}return!0}},{name:"omitNonPositionalOverPositionalChannels",description:"Do not use non-positional channels unless all positional channels are used",properties:[p.Property.CHANNEL],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,n,t){return E.some(a.NONSPATIAL_CHANNELS,function(n){return e.channelUsed(n)})?e.channelUsed(a.Channel.X)&&e.channelUsed(a.Channel.Y):!0}},{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:[p.Property.AGGREGATE,p.Property.AUTOCOUNT,p.Property.TIMEUNIT,p.Property.BIN,p.Property.TYPE],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,n,t){return e.isAggregate()?E.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:[p.Property.CHANNEL,p.Property.AGGREGATE,p.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,n,t){return e.isAggregate()?!0:E.every(e.getEncodings(),function(e){return e.channel!==a.Channel.DETAIL})}},{name:"omitRepeatedField",description:"Each field should be mapped to only one channel",properties:[p.Property.FIELD],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,n,t){var r={};return E.every(e.getEncodings(),function(e){return e.field&&!f.isEnumSpec(e.field)?r[e.field]?!1:(r[e.field]=!0,!0):!0})}},{name:"omitVerticalDotPlot",description:"Do not output vertical dot plot.",properties:[p.Property.CHANNEL],allowEnumSpecForProperties:!0,strict:!1,satisfy:function(e,n,t){var r=e.getEncodings();return 1!==r.length||r[0].channel!==a.Channel.Y}},{name:"hasAppropriateGraphicTypeForMark",description:"Has appropriate graphic type for mark",properties:[p.Property.CHANNEL,p.Property.MARK,p.Property.TYPE,p.Property.TIMEUNIT,p.Property.BIN,p.Property.AGGREGATE,p.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,n,t){var r=e.getMark();switch(r){case u.Mark.AREA:case u.Mark.LINE:if(e.isAggregate()){var i=e.getEncodingQueryByChannel(a.Channel.X),o=e.getEncodingQueryByChannel(a.Channel.Y),c=i&&d.isMeasure(i),l=o&&d.isMeasure(o);return i&&o&&c!==l&&!(!c&&i.type===s.Type.NOMINAL)&&!(!l&&o.type===s.Type.NOMINAL)}return!0;case u.Mark.TEXT:return!0;case u.Mark.BAR:case u.Mark.TICK:return e.channelUsed(a.Channel.SIZE)?!1:e.isMeasure(a.Channel.X)!==e.isMeasure(a.Channel.Y);case u.Mark.CIRCLE:case u.Mark.POINT:case u.Mark.SQUARE:case u.Mark.RULE:return!0}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+r)}},{name:"omitNonSumStack",description:"Stacked plot should use summative aggregation such as sum, count, or distinct",properties:[p.Property.CHANNEL,p.Property.MARK,p.Property.AGGREGATE,p.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,n,t){var r=e.stack();if(r){var i=e.getEncodingQueryByChannel(r.fieldChannel);return E.contains(o.SUM_OPS,i.aggregate)||!!i.autoCount}return!0}},{name:"omitTableWithOcclusion",description:"Raw Plots with x and y are both dimensions should be omitted as they often lead to occlusion.",properties:[p.Property.CHANNEL,p.Property.TYPE,p.Property.TIMEUNIT,p.Property.BIN,p.Property.AGGREGATE,p.Property.AUTOCOUNT],allowEnumSpecForProperties:!1,strict:!1,satisfy:function(e,n,t){return!e.isDimension(a.Channel.X)||!e.isDimension(a.Channel.Y)||e.isAggregate()}},{name:"scaleZeroMustMatchScaleType",description:"ScaleZero should not be used with LOG, ORDINAL, TIME and UTC",properties:[p.Property.SCALE,p.Property.TYPE,p.Property.SCALE_TYPE,p.Property.SCALE_ZERO],allowEnumSpecForProperties:!1,strict:!0,satisfy:function(e,n,t){for(var r=e.getEncodings(),i=0,o=r;i0},e.prototype.stack=function(){return p.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 n=0;n0?l.duplicate(i[e-1]):{}),o.push(e>0?l.duplicate(o[e-1]):{});var t=n.nest[e].groupBy;if(c.isArray(t)){t.forEach(function(n){f.isExtendedGroupBy(n)?(i[e][n.property]=!0,o[e][n.property]=n.replace):i[e][n]=!0});var r=l.keys(o[e]).reduce(function(n,t){return n[t]=p.getReplacer(o[e][t]),n},{});a.push(r)}},s=0;s"+e}).join(";")+"]"}return e.property}return e}).join(","):e}var o=e("datalib/src/util"),a=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=r,t.toString=i},{"../util":34,"datalib/src/util":8}],24:[function(e,n,t){"use strict";function r(e,n,t){e=s.extend({},i(e),{config:s.extend({},o.DEFAULT_QUERY_CONFIG,t,e.config)});var r=a.generate(e.spec,n,e.config),l=u.nest(r,e),f=c.rank(l,e,n,0);return{query:e,result:f}}function i(e){if(e.groupBy){var n={groupBy:e.groupBy};e.orderBy&&(n.orderGroupBy=e.orderBy);var t={spec:s.duplicate(e.spec),nest:[n]};return e.chooseBy&&(t.chooseBy=e.chooseBy),e.config&&(t.config=e.config),t}return s.duplicate(e)}var o=e("../config"),a=e("../generate"),u=e("../nest"),c=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=r, +t.normalize=i},{"../config":9,"../generate":17,"../nest":20,"../ranking/ranking":32,"../util":34,"./encoding":22,"./groupby":23,"./shorthand":25,"./spec":26,"./transform":27}],25:[function(e,n,t){"use strict";function r(e){return function(n){return void 0!==e[n]?e[n]:n}}function i(e,n){return l.isEnumSpec(e)?l.SHORT_ENUM_SPEC:n?n(e):e}function o(e,n,r){void 0===n&&(n=t.INCLUDE_ALL),void 0===r&&(r={});var o=[];n[f.Property.MARK]&&o.push(i(e.mark,r[f.Property.MARK]));var u=s.stack(e);return u&&o.push("stack="+u.offset),o.push(e.encodings.map(function(e){return a(e,n,r)}).filter(function(e){return!!e}).sort().join("|")),o.join("|")}function a(e,n,r){void 0===n&&(n=t.INCLUDE_ALL),void 0===r&&(r={});var o=[];n[f.Property.CHANNEL]&&o.push(i(e.channel,r[f.Property.CHANNEL]));var a=u(e,n,r);return a&&o.push(a),o.join(":")}function u(e,n,r){void 0===n&&(n=t.INCLUDE_ALL),void 0===r&&(r={});var o=null,a=[];if(n[f.Property.AGGREGATE]&&e.autoCount===!1)return"-";if(n[f.Property.AGGREGATE]&&e.aggregate&&!l.isEnumSpec(e.aggregate))o=i(e.aggregate,r[f.Property.AGGREGATE]);else if(n[f.Property.AGGREGATE]&&e.autoCount&&!l.isEnumSpec(e.autoCount))o=i("count",r[f.Property.AGGREGATE]);else if(n[f.Property.TIMEUNIT]&&e.timeUnit&&!l.isEnumSpec(e.timeUnit))o=i(e.timeUnit,r[f.Property.TIMEUNIT]);else if(n[f.Property.BIN]&&e.bin&&!l.isEnumSpec(e.bin))o="bin",n[f.Property.BIN_MAXBINS]&&e.bin.maxbins&&a.push({key:"maxbins",value:i(e.bin.maxbins,r[f.Property.BIN_MAXBINS])});else for(var u=0,s=[f.Property.AGGREGATE,f.Property.AUTOCOUNT,f.Property.TIMEUNIT,f.Property.BIN];u0&&a.push({key:t+"",value:JSON.stringify(u)})}else e[t]!==!1&&null!==e[t]||a.push({key:t+"",value:!1})},y=0,h=[f.Property.SCALE];yn.score?a:n},null);s.push(r)}),s}e.TYPE_CHANNEL="typeChannel",e.init=n,e.featurize=t,e.getScore=r}(r=t.TypeChannelScore||(t.TypeChannelScore={}));var l;!function(e){function n(e){void 0===e&&(e={}),e=u.extend({},o.DEFAULT_QUERY_CONFIG,e);var n={},t=[{feature:"bin_"+s.Q,opt:"preferredBinAxis"},{feature:s.T,opt:"preferredTemporalAxis"},{feature:s.O,opt:"preferredOrdinalAxis"},{feature:s.N,opt:"preferredNominalAxis"}];return t.forEach(function(t){e[t.opt]===i.Channel.X?n[t.feature+"_"+i.Channel.Y]=-.01:e[t.opt]===i.Channel.Y&&(n[t.feature+"_"+i.Channel.X]=-.01)}),n}function t(e,n){return e+"_"+n}function r(n,r,i){return n.getEncodings().reduce(function(n,r){var i=c.getExtendedType(r),o=t(i,r.channel),a=c.getFeatureScore(e.PREFERRED_AXIS,o);return a&&n.push(a),n},[])}e.PREFERRED_AXIS="preferredAxis",e.init=n,e.featurize=t,e.getScore=r}(l=t.PreferredAxisScore||(t.PreferredAxisScore={}));var f;!function(e){function n(e){e=u.extend({},o.DEFAULT_QUERY_CONFIG,e);var n={};return e.preferredFacet===i.Channel.ROW?n[i.Channel.COLUMN]=-.01:e.preferredFacet===i.Channel.COLUMN&&(n[i.Channel.ROW]=-.01),n}function t(n,t,r){return n.getEncodings().reduce(function(n,t){var r=c.getFeatureScore(e.PREFERRED_FACET,t.channel);return r&&n.push(r),n},[])}e.PREFERRED_FACET="preferredFacet",e.init=n,e.getScore=t}(f=t.PreferredFacetScore||(t.PreferredFacetScore={}));var p;!function(e){function n(){return{bar_size:-2,tick_size:-2}}function t(n,t,r){var i=n.getMark();return n.getEncodings().reduce(function(n,t){var r=i+"_"+t.channel,o=c.getFeatureScore(e.MARK_CHANNEL,r);return o&&n.push(o),n},[])}e.MARK_CHANNEL="markChannel",e.init=n,e.getScore=t}(p=t.MarkChannelScore||(t.MarkChannelScore={}));var E;!function(e){function n(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}function t(n,t,r){return n.isAggregate()&&n.getEncodings().reduce(function(n,t){if(!t.aggregate&&!t.autoCount){var r=c.getFeatureScore(e.DIMENSION,t.channel+"");if(r.score>n.score)return r}return n},{type:e.DIMENSION,feature:"No Dimension",score:-5}),[]}e.DIMENSION="dimension",e.init=n,e.getScore=t}(E=t.DimensionScore||(t.DimensionScore={}))},{"../../config":9,"../../query/shorthand":25,"../../util":34,"./effectiveness":29,"./type":31,"vega-lite/src/channel":46}],29:[function(e,n,t){"use strict";function r(e,n){var r=t.FEATURE_INDEX[e][n];return void 0!==r?{score:r,type:e,feature:n}:null}function i(e){s.push(e),t.FEATURE_INDEX[e.type]=e.init()}function o(e){return(e.bin?"bin_":e.timeUnit?"timeUnit_":"")+e.type}function a(e,n,t){var r=s.reduce(function(r,i){var o=i.getScore(e,n,t);return r.concat(o)},[]);return{score:r.reduce(function(e,n){return e+n.score},0),features:r}}var u=e("./channel"),c=e("./mark");t.FEATURE_INDEX={};var s=[];t.getFeatureScore=r,t.addFeatureFactory=i,i({type:u.TypeChannelScore.TYPE_CHANNEL,init:u.TypeChannelScore.init,getScore:u.TypeChannelScore.getScore}),i({type:u.PreferredAxisScore.PREFERRED_AXIS,init:u.PreferredAxisScore.init,getScore:u.PreferredAxisScore.getScore}),i({type:u.PreferredFacetScore.PREFERRED_FACET,init:u.PreferredFacetScore.init,getScore:u.PreferredFacetScore.getScore}),i({type:u.MarkChannelScore.MARK_CHANNEL,init:u.MarkChannelScore.init,getScore:u.MarkChannelScore.getScore}),i({type:c.MarkScore.MARK_SCORE,init:c.MarkScore.init,getScore:c.MarkScore.getScore}),t.getExtendedType=o,Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=a},{"./channel":28,"./mark":30}],30:[function(e,n,t){"use strict";var r,i=e("vega-lite/src/channel"),o=e("vega-lite/src/mark"),a=e("../../util"),u=e("./effectiveness"),c=e("./type");!function(e){function n(e,n,t,r){return e+"_"+n+"_"+t+"_"+r}function t(){var e=[c.Q,c.T],t=[c.BIN_Q,c.TIMEUNIT_T,c.O,c.N],r=t.concat([c.NONE]),i={};return e.forEach(function(t){e.forEach(function(e){var r={point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5};a.forEach(r,function(r,o){var a=n(t,e,!0,o);i[a]=r});var o={point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5};a.forEach(o,function(r,o){var a=n(t,e,!1,o);i[a]=r})})}),e.forEach(function(e){r.forEach(function(t){var r={tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5};a.forEach(r,function(r,o){var a=n(e,t,!0,o);i[a]=r;var u=n(t,e,!0,o);i[u]=r})}),[c.NONE,c.N].forEach(function(t){var r={bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5};a.forEach(r,function(r,o){var a=n(e,t,!1,o);i[a]=r;var u=n(t,e,!1,o);i[u]=r})}),[c.BIN_Q].forEach(function(t){var r={bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5};a.forEach(r,function(r,o){var a=n(e,t,!1,o);i[a]=r;var u=n(t,e,!1,o);i[u]=r})}),[c.TIMEUNIT_T,c.O].forEach(function(t){var r={line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5};a.forEach(r,function(r,o){var a=n(e,t,!1,o);i[a]=r;var u=n(t,e,!1,o);i[u]=r})})}),r.forEach(function(e){r.forEach(function(t){var r={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};a.forEach(r,function(r,o){var a=n(e,t,!0,o);i[a]=r}),a.forEach(r,function(r,o){var a=n(e,t,!1,o);i[a]=r})})}),i}function r(n,t,r){var a=n.getMark();a!==o.Mark.CIRCLE&&a!==o.Mark.SQUARE||(a=o.Mark.POINT);var c=n.getEncodingQueryByChannel(i.Channel.X),s=c?u.getExtendedType(c):"-",l=n.getEncodingQueryByChannel(i.Channel.Y),f=l?u.getExtendedType(l):"-",p=!n.isAggregate(),E=s+"_"+f+"_"+p+"_"+a,d=u.getFeatureScore(e.MARK_SCORE,E);return[d]}e.MARK_SCORE="markScore",e.featurize=n,e.init=t,e.getScore=r}(r=t.MarkScore||(t.MarkScore={}))},{"../../util":34,"./effectiveness":29,"./type":31,"vega-lite/src/channel":46,"vega-lite/src/mark":49}],31:[function(e,n,t){"use strict";var r=e("vega-lite/src/type");!function(e){e[e.Q=r.Type.QUANTITATIVE]="Q",e[e.BIN_Q="bin_"+r.Type.QUANTITATIVE]="BIN_Q",e[e.T=r.Type.TEMPORAL]="T",e[e.TIMEUNIT_T="timeUnit_"+r.Type.TEMPORAL]="TIMEUNIT_T",e[e.O=r.Type.ORDINAL]="O",e[e.N=r.Type.NOMINAL]="N",e[e.NONE="-"]="NONE"}(t.ExtendedType||(t.ExtendedType={}));var i=t.ExtendedType;t.Q=i.Q,t.BIN_Q=i.BIN_Q,t.T=i.T,t.TIMEUNIT_T=i.TIMEUNIT_T,t.O=i.O,t.N=i.N,t.NONE=i.NONE},{"vega-lite/src/type":53}],32:[function(e,n,t){"use strict";function r(e,n){l[e]=n}function i(e){return l[e]}function o(e,n,t,r){return n.nest&&r!==n.nest.length?(e.items.forEach(function(e){o(e,n,t,r+1)}),n.nest[r].orderGroupBy&&e.items.sort(c(n.nest[r].orderGroupBy,t,n.config))):(n.orderBy||n.chooseBy)&&(e.items.sort(u(n.orderBy||n.chooseBy,t,n.config)),n.chooseBy&&(e.items=[e.items[0]])),e}function a(e,n,t,r){if(void 0!==e.getRankingScore(n))return e.getRankingScore(n);var o=i(n),a=o(e,t,r);return e.setRankingScore(n,a),a}function u(e,n,t){return function(r,i){return a(i,e,n,t).score-a(r,e,n,t).score}}function c(e,n,t){return function(r,i){var o=s.getTopItem(r),u=s.getTopItem(i);return a(u,e,n,t).score-a(o,e,n,t).score}}var s=e("../modelgroup");t.effectiveness=e("./effectiveness/effectiveness");var l={};t.register=r,t.get=i,t.rank=o,t.comparator=u,t.groupComparator=c,t.EFFECTIVENESS="effectiveness",r(t.EFFECTIVENESS,t.effectiveness["default"])},{"../modelgroup":19,"./effectiveness/effectiveness":29}],33:[function(e,n,t){"use strict";function r(e,n){var t=c({min:n.min,max:n.max,maxbins:e}),r=l.extend({},n);return r.distinct=(t.stop-t.start)/t.step,r}var i=e("vega-lite/src/type"),o=e("vega-lite/src/bin"),a=e("datalib/src/stats"),u=e("datalib/src/import/type"),c=e("datalib/src/bins/bins"),s=e("./config"),l=e("./util"),f=function(){function e(e){this.fieldSchemas=e,this.fieldSchemaIndex=e.reduce(function(e,n){return e[n.field]=n,e},{})}return e.build=function(n,t){void 0===t&&(t={}),t=l.extend({},s.DEFAULT_QUERY_CONFIG,t);var o=a.summary(n),c=u.inferAll(n),f=o.map(function(e){var n,r=e.field,o=c[r],a=e.distinct;return n=o===p.NUMBER?i.Type.QUANTITATIVE:o===p.INTEGER?a/e.countE[n.type]?1:e.field.localeCompare(n.field)});for(var d=new e(f),y=0,h=f;yg.stats.max.getTime()&&(g.stats.max=new Date(S))}}}return d},e.prototype.fields=function(){return this.fieldSchemas.map(function(e){return e.field})},e.prototype.primitiveType=function(e){return this.fieldSchemaIndex[e]?this.fieldSchemaIndex[e].primitiveType:null},e.prototype.type=function(e){return this.fieldSchemaIndex[e]?this.fieldSchemaIndex[e].type:null},e.prototype.cardinality=function(e){if(e.aggregate||e.autoCount)return 1;if(e.bin){var n;n="boolean"==typeof e.bin?{maxbins:o.autoMaxBins(e.channel)}:e.bin;var t=this.fieldSchemaIndex[e.field],i=n.maxbins;return t.binStats[i]||(t.binStats[i]=r(i,t.stats)),t.binStats[i].distinct}if(e.timeUnit)return 1;var a=this.fieldSchemaIndex[e.field];return a?a.stats.distinct:null},e.prototype.domain=function(e){var n=this.fieldSchemaIndex[e.field],t=l.keys(n.stats.unique);return n.type===i.Type.QUANTITATIVE||n.primitiveType===p.DATE?t=[n.stats.min,n.stats.max]:n.primitiveType!==p.INTEGER&&n.primitiveType!==p.NUMBER||(t=t.map(function(e){return+e})),t.sort()},e.prototype.stats=function(e){var n=this.fieldSchemaIndex[e.field];return n?n.stats:null},e}();t.Schema=f,function(e){e[e.STRING="string"]="STRING",e[e.NUMBER="number"]="NUMBER",e[e.INTEGER="integer"]="INTEGER",e[e.BOOLEAN="boolean"]="BOOLEAN",e[e.DATE="date"]="DATE"}(t.PrimitiveType||(t.PrimitiveType={}));var p=t.PrimitiveType},{"./config":9,"./util":34,"datalib/src/bins/bins":3,"datalib/src/import/type":5,"datalib/src/stats":6,"vega-lite/src/bin":45,"vega-lite/src/type":53}],34:[function(e,n,t){"use strict";function r(e,n){return-1!==e.indexOf(n)}function i(e,n){var t,r=0;for(t in e)if(!n(e[t],t,r++))return!1;return!0}function o(e,n,t){if(e.forEach)e.forEach.call(t,n);else for(var r in e)n.call(t,e[r],r,e)}function a(e,n){var t,r=0;for(t in e)if(n(e[t],t,r++))return!0;return!1}function u(e,n){return e.map(function(e){return s.isArray(e)?u(e,n):n(e)})}function c(e,n){return e.filter(function(e){return!r(n,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=r,t.every=i,t.forEach=o,t.some=a,t.nestedMap=u,t.without=c},{"datalib/src/util":8}],35:[function(e,n,t){arguments[4][2][0].apply(t,arguments)},{dup:2}],36:[function(e,n,t){arguments[4][3][0].apply(t,arguments)},{"../time":38,"../util":39,dup:3}],37:[function(e,n,t){arguments[4][4][0].apply(t,arguments)},{"./util":39,dup:4}],38:[function(e,n,t){arguments[4][7][0].apply(t,arguments)},{"d3-time":35,dup:7}],39:[function(e,n,t){(function(e){function t(e,n){var t,r="";for(t=0;e>t;++t)r+=n;return r}function r(e,n,t){var r=0,i=e.split(c);return e=t?(i=i.reverse()).filter(function(e){return r+=e.length,n>=r}).reverse():i.filter(function(e){return r+=e.length,n>=r}),e.length?e.join("").trim():i[0].slice(0,n)}var i=n.exports,o="__name__";i.namedfunc=function(e,n){return n[o]=e,n},i.name=function(e){return null==e?null:e[o]},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,n){return JSON.stringify(e)===JSON.stringify(n)},i.extend=function(e){for(var n,t,r=1,i=arguments.length;i>r;++r){n=arguments[r];for(t in n)e[t]=n[t]}return e},i.length=function(e){return null!=e&&null!=e.length?e.length:null},i.keys=function(e){var n,t=[];for(n in e)t.push(n);return t},i.vals=function(e){var n,t=[];for(n in e)t.push(e[n]);return t},i.toMap=function(e,n){return(n=i.$(n))?e.reduce(function(e,t){return e[n(t)]=1,e},{}):e.reduce(function(e,n){return e[n]=1,e},{})},i.keystr=function(e){var n=e.length;if(!n)return"";for(var t=String(e[0]),r=1;n>r;++r)t+="|"+String(e[r]);return t};var a=Object.prototype.toString;i.isObject=function(e){return e===Object(e)},i.isFunction=function(e){return"[object Function]"===a.call(e)},i.isString=function(e){return"string"==typeof value||"[object String]"===a.call(e)},i.isArray=Array.isArray||function(e){return"[object Array]"===a.call(e)},i.isNumber=function(e){return"number"==typeof e||"[object Number]"===a.call(e)},i.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==a.call(e)},i.isDate=function(e){return"[object Date]"===a.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,n){var t=n?n: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 u=/\[(.*?)\]|[^.\[]+/g;i.field=function(e){return String(e).match(u).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 n;return i.isString(e)&&(n=i.field(e)).length>1?function(e,t){for(var r=0;ro;++o)if(u=e[o],c=i.cmp(u(t),u(r)))return c*n[o];return 0}},i.cmp=function(e,n){return(n>e||null==e)&&null!=n?-1:(e>n||null==n)&&null!=e?1:(n=n instanceof Date?+n:n,(e=e instanceof Date?+e:e)!==e&&n===n?-1:n!==n&&e===e?1:0)},i.numcmp=function(e,n){return e-n},i.stablesort=function(e,n,t){var r=e.reduce(function(e,n,r){return e[t(n)]=r,e},{});return e.sort(function(e,i){var o=n(e),a=n(i);return a>o?-1:o>a?1:r[t(e)]-r[t(i)]}),e},i.permute=function(e){for(var n,t,r=e.length;r;)t=Math.floor(Math.random()*r--),n=e[r],e[r]=e[t],e[t]=n},i.pad=function(e,n,r,i){i=i||" ";var o=n-e.length;if(0>=o)return e;switch(r){case"left":return t(o,i)+e;case"middle":case"center":return t(Math.floor(o/2),i)+e+t(Math.ceil(o/2),i);default:return e+t(o,i)}},i.truncate=function(e,n,t,i,o){var a=e.length;if(n>=a)return e;o=void 0!==o?String(o):"…";var u=Math.max(0,n-o.length);switch(t){case"left":return o+(i?r(e,u,1):e.slice(a-u));case"middle":case"center":var c=Math.ceil(u/2),s=Math.floor(u/2);return(i?r(e,c):e.slice(0,c))+o+(i?r(e,s,1):e.slice(a-s));default:return(i?r(e,u):e.slice(0,u))+o}};var c=/([\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}],40:[function(e,n,t){var r="undefined"!=typeof JSON?JSON:e("jsonify");n.exports=function(e,n){n||(n={}),"function"==typeof n&&(n={cmp:n});var t=n.space||"";"number"==typeof t&&(t=Array(t+1).join(" "));var a="boolean"==typeof n.cycles?n.cycles:!1,u=n.replacer||function(e,n){return n},c=n.cmp&&function(e){return function(n){return function(t,r){var i={key:t,value:n[t]},o={key:r,value:n[r]};return e(i,o)}}}(n.cmp),s=[];return function l(e,n,f,p){var E=t?"\n"+new Array(p+1).join(t):"",d=t?": ":":";if(f&&f.toJSON&&"function"==typeof f.toJSON&&(f=f.toJSON()),f=u.call(e,n,f),void 0!==f){if("object"!=typeof f||null===f)return r.stringify(f);if(i(f)){for(var y=[],h=0;h="0"&&"9">=i;)n+=i,s();if("."===i)for(n+=".";s()&&i>="0"&&"9">=i;)n+=i;if("e"===i||"E"===i)for(n+=i,s(),"-"!==i&&"+"!==i||(n+=i,s());i>="0"&&"9">=i;)n+=i,s();return e=+n,isFinite(e)?e:void c("Bad number")},f=function(){var e,n,t,r="";if('"'===i)for(;s();){if('"'===i)return s(),r;if("\\"===i)if(s(),"u"===i){for(t=0,n=0;4>n&&(e=parseInt(s(),16),isFinite(e));n+=1)t=16*t+e;r+=String.fromCharCode(t)}else{if("string"!=typeof u[i])break;r+=u[i]}else r+=i}c("Bad string")},p=function(){for(;i&&" ">=i;)s()},E=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}c("Unexpected '"+i+"'")},d=function(){var e=[];if("["===i){if(s("["),p(),"]"===i)return s("]"),e;for(;i;){if(e.push(a()),p(),"]"===i)return s("]"),e;s(","),p()}}c("Bad array")},y=function(){var e,n={};if("{"===i){if(s("{"),p(),"}"===i)return s("}"),n;for(;i;){if(e=f(),p(),s(":"),Object.hasOwnProperty.call(n,e)&&c('Duplicate key "'+e+'"'),n[e]=a(),p(),"}"===i)return s("}"),n;s(","),p()}}c("Bad object")};a=function(){switch(p(),i){case"{":return y();case"[":return d();case'"':return f();case"-":return l();default:return i>="0"&&"9">=i?l():E()}},n.exports=function(e,n){var t;return o=e,r=0,i=" ",t=a(),p(),i&&c("Syntax error"),"function"==typeof n?function u(e,t){var r,i,o=e[t];if(o&&"object"==typeof o)for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(i=u(o,r),void 0!==i?o[r]=i:delete o[r]);return n.call(e,t,o)}({"":t},""):t}},{}],43:[function(e,n,t){function r(e){return c.lastIndex=0,c.test(e)?'"'+e.replace(c,function(e){var n=s[e];return"string"==typeof n?n:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function i(e,n){var t,c,s,l,f,p=o,E=n[e];switch(E&&"object"==typeof E&&"function"==typeof E.toJSON&&(E=E.toJSON(e)),"function"==typeof u&&(E=u.call(n,e,E)),typeof E){case"string":return r(E);case"number":return isFinite(E)?String(E):"null";case"boolean":case"null":return String(E);case"object":if(!E)return"null";if(o+=a,f=[],"[object Array]"===Object.prototype.toString.apply(E)){for(l=E.length,t=0;l>t;t+=1)f[t]=i(t,E)||"null";return s=0===f.length?"[]":o?"[\n"+o+f.join(",\n"+o)+"\n"+p+"]":"["+f.join(",")+"]",o=p,s}if(u&&"object"==typeof u)for(l=u.length,t=0;l>t;t+=1)c=u[t],"string"==typeof c&&(s=i(c,E),s&&f.push(r(c)+(o?": ":":")+s));else for(c in E)Object.prototype.hasOwnProperty.call(E,c)&&(s=i(c,E),s&&f.push(r(c)+(o?": ":":")+s));return s=0===f.length?"{}":o?"{\n"+o+f.join(",\n"+o)+"\n"+p+"}":"{"+f.join(",")+"}",o=p,s}}var o,a,u,c=/[\\\"\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",'"':'\\"',"\\":"\\\\"};n.exports=function(e,n,t){var r;if(o="",a="","number"==typeof t)for(r=0;t>r;r+=1)a+=" ";else"string"==typeof t&&(a=t);if(u=n,n&&"function"!=typeof n&&("object"!=typeof n||"number"!=typeof n.length))throw new Error("JSON.stringify");return i("",{"":e})}},{}],44:[function(e,n,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 r=t.AggregateOp;t.AGGREGATE_OPS=[r.VALUES,r.COUNT,r.VALID,r.MISSING,r.DISTINCT,r.SUM,r.MEAN,r.AVERAGE,r.VARIANCE,r.VARIANCEP,r.STDEV,r.STDEVP,r.MEDIAN,r.Q1,r.Q3,r.MODESKEW,r.MIN,r.MAX,r.ARGMIN,r.ARGMAX],t.SUM_OPS=[r.COUNT,r.SUM,r.DISTINCT],t.SHARED_DOMAIN_OPS=[r.MEAN,r.AVERAGE,r.STDEV,r.STDEVP,r.MEDIAN,r.Q1,r.Q3,r.MIN,r.MAX]},{}],45:[function(e,n,t){"use strict";function r(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=r},{"./channel":46}],46:[function(e,n,t){"use strict";function r(e,n){return!!i(e)[n]}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 o(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 a(e){return!u.contains([t.DETAIL,t.PATH,t.TEXT,t.LABEL,t.ORDER],e)}var u=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 c=t.Channel;t.X=c.X,t.Y=c.Y,t.X2=c.X2,t.Y2=c.Y2,t.ROW=c.ROW,t.COLUMN=c.COLUMN,t.SHAPE=c.SHAPE,t.SIZE=c.SIZE,t.COLOR=c.COLOR,t.TEXT=c.TEXT,t.DETAIL=c.DETAIL,t.LABEL=c.LABEL,t.PATH=c.PATH,t.ORDER=c.ORDER,t.OPACITY=c.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=u.without(t.CHANNELS,[t.ROW,t.COLUMN]),t.UNIT_SCALE_CHANNELS=u.without(t.UNIT_CHANNELS,[t.PATH,t.ORDER,t.DETAIL,t.TEXT,t.LABEL,t.X2,t.Y2]),t.NONSPATIAL_CHANNELS=u.without(t.UNIT_CHANNELS,[t.X,t.Y,t.X2,t.Y2]),t.NONSPATIAL_SCALE_CHANNELS=u.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=r,t.getSupportedMark=i,t.getSupportedRole=o,t.hasScale=a},{"./util":54}],47:[function(e,n,t){"use strict";function r(e){return!!(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds)}function i(e){return c.isNumber(e)?e-1+"":(console.warn("Potentially invalid quarter",e),e)}function o(e){if(c.isNumber(e))return e-1+"";var n=e.toLowerCase(),r=t.MONTHS.indexOf(n);if(-1!==r)return r+"";var i=n.substr(0,3),o=t.SHORT_MONTHS.indexOf(i);return-1!==o?o+"":(console.warn("Potentially invalid month",e),e)}function a(e){if(c.isNumber(e))return e%7+"";var n=e.toLowerCase(),r=t.DAYS.indexOf(n);if(-1!==r)return r+"";var i=n.substr(0,3),o=t.SHORT_DAYS.indexOf(i);return-1!==o?o+"":(console.warn("Potentially invalid day",e),e)}function u(e,n){void 0===n&&(n=!1);var t=[];if(n&&void 0!==e.day)for(var r=0,u=["year","quarter","month","date"];r0)}function a(e){return h.some(y.CHANNELS,function(n){return!(!o(e,n)||!e[n].aggregate)})}function u(e){return e&&(!!e.x&&!!e.x2||!!e.y&&!!e.y2)}function c(e){var n=[];return y.CHANNELS.forEach(function(t){o(e,t)&&(h.isArray(e[t])?e[t].forEach(function(e){n.push(e)}):n.push(e[t]))}),n}function s(e,n,t){l(y.CHANNELS,e,n,t)}function l(e,n,t,r){var i=0;e.forEach(function(e){o(n,e)&&(h.isArray(n[e])?n[e].forEach(function(n){t.call(r,n,e,i++)}):t.call(r,n[e],e,i++))})}function f(e,n,t){return p(y.CHANNELS,e,n,t)}function p(e,n,t,r){var i=[];return e.forEach(function(e){o(n,e)&&(h.isArray(n[e])?n[e].forEach(function(n){i.push(t.call(r,n,e))}):i.push(t.call(r,n[e],e)))}),i}function E(e,n,t,r){return d(y.CHANNELS,e,n,t,r)}function d(e,n,t,r,i){var a=r;return y.CHANNELS.forEach(function(e){o(n,e)&&(h.isArray(n[e])?n[e].forEach(function(n){a=t.call(i,a,n,e)}):a=t.call(i,a,n[e],e)); +}),a}var y=e("./channel"),h=e("./util");t.countRetinal=r,t.channels=i,t.has=o,t.isAggregate=a,t.isRanged=u,t.fieldDefs=c,t.forEach=s,t.channelMappingForEach=l,t.map=f,t.channelMappingMap=p,t.reduce=E,t.channelMappingReduce=d},{"./channel":46,"./util":54}],49:[function(e,n,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 r=t.Mark;t.AREA=r.AREA,t.BAR=r.BAR,t.LINE=r.LINE,t.POINT=r.POINT,t.TEXT=r.TEXT,t.TICK=r.TICK,t.RULE=r.RULE,t.CIRCLE=r.CIRCLE,t.SQUARE=r.SQUARE,t.ERRORBAR=r.ERRORBAR,t.PRIMITIVE_MARKS=[t.AREA,t.BAR,t.LINE,t.POINT,t.TEXT,t.TICK,t.RULE,t.CIRCLE,t.SQUARE]},{}],50:[function(e,n,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 r=t.BandSize;t.BANDSIZE_FIT=r.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}},{}],51:[function(e,n,t){"use strict";function r(e,n,t){var r=t&&t.mark?t.mark.stacked:void 0;if(u.contains([c.NONE,null,!1],r))return null;if(!u.contains([a.BAR,a.AREA],e))return null;if(!o.isAggregate(n))return null;var s=i.STACK_GROUP_CHANNELS.reduce(function(e,t){return o.has(n,t)&&!n[t].aggregate&&e.push(t),e},[]);if(0===s.length)return null;var l=o.has(n,i.X),f=o.has(n,i.Y),p=l&&!!n.x.aggregate,E=f&&!!n.y.aggregate;return p!==E?{groupbyChannel:p?f?i.Y:null:l?i.X:null,fieldChannel:p?i.X:i.Y,stackByChannels:s,offset:r||c.ZERO}:null}var i=e("./channel"),o=e("./encoding"),a=e("./mark"),u=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 c=t.StackOffset;t.stack=r},{"./channel":46,"./encoding":48,"./mark":49,"./util":54}],52:[function(e,n,t){"use strict";function r(e){return!!h[e]}function i(e){return!!g[e]}function o(e,n){var t=e.toString(),r=n.toString(),i=t.indexOf(r);return i>-1&&(n!==y.SECONDS||0===i||"i"!==t.charAt(i-1))}function a(e){switch(e){case y.HOURS:case y.DAY:case y.MONTH:case y.QUARTER:return E.ScaleType.ORDINAL}return E.ScaleType.TIME}function u(e,n){function r(e){return e===y.QUARTER?"floor(month("+i+")/3)":e+"("+i+")"}var i="datum."+n,a=t.SINGLE_TIMEUNITS.reduce(function(n,t){return o(e,t)&&(n[t]=r(t)),n},{});return a.day&&d.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=r(y.DATE)),p.dateTimeExpr(a)}function c(e,n){if(d.contains([f.ROW,f.COLUMN,f.SHAPE,f.COLOR],n))return null;switch(e){case y.SECONDS:return d.range(0,60);case y.MINUTES:return d.range(0,60);case y.HOURS:return d.range(0,24);case y.DAY:return d.range(0,7);case y.DATE:return d.range(1,32);case y.MONTH:return d.range(0,12);case y.QUARTER:return[0,3,6,9]}return null}function s(e){return e?o(e,y.SECONDS)?"second":o(e,y.MINUTES)?"minute":o(e,y.HOURS)?"hour":o(e,y.DAY)||o(e,y.DATE)?"day":o(e,y.MONTH)?"month":o(e,y.YEAR)?"year":void 0:void 0}function l(e,n,t){if(e){var r=[];o(e,y.YEAR)&&r.push(t?"%y":"%Y"),o(e,y.QUARTER)&&r.push("'}}Q{{"+n+" | quarter}}{{"+n+" | time:'"),o(e,y.MONTH)&&r.push(t?"%b":"%B"),o(e,y.DAY)?r.push(t?"%a":"%A"):o(e,y.DATE)&&r.push("%d");var i=[];o(e,y.HOURS)&&i.push("%H"),o(e,y.MINUTES)&&i.push("%M"),o(e,y.SECONDS)&&i.push("%S"),o(e,y.MILLISECONDS)&&i.push("%L");var a=[];if(r.length>0&&a.push(r.join("-")),i.length>0&&a.push(i.join(":")),a.length>0){var u="{{"+n+" | time:'"+a.join(" ")+"'}}";return u.replace(new RegExp("{{"+n+" \\| time:''}}","g"),"")}}}var f=e("./channel"),p=e("./datetime"),E=e("./scale"),d=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 y=t.TimeUnit;t.SINGLE_TIMEUNITS=[y.YEAR,y.QUARTER,y.MONTH,y.DAY,y.DATE,y.HOURS,y.MINUTES,y.SECONDS,y.MILLISECONDS];var h=t.SINGLE_TIMEUNITS.reduce(function(e,n){return e[n]=!0,e},{});t.isSingleTimeUnit=r,t.MULTI_TIMEUNITS=[y.YEARQUARTER,y.YEARQUARTERMONTH,y.YEARMONTH,y.YEARMONTHDATE,y.YEARMONTHDATEHOURS,y.YEARMONTHDATEHOURSMINUTES,y.YEARMONTHDATEHOURSMINUTESSECONDS,y.QUARTERMONTH,y.HOURSMINUTES,y.HOURSMINUTESSECONDS,y.MINUTESSECONDS,y.SECONDSMILLISECONDS];var g=t.MULTI_TIMEUNITS.reduce(function(e,n){return e[n]=!0,e},{});t.isMultiTimeUnit=i,t.TIMEUNITS=t.SINGLE_TIMEUNITS.concat(t.MULTI_TIMEUNITS),t.containsTimeUnit=o,t.defaultScaleType=a,t.fieldExpr=u,t.rawDomain=c,t.smallestUnit=s,t.template=l},{"./channel":46,"./datetime":47,"./scale":50,"./util":54}],53:[function(e,n,t){"use strict";function r(e){var n=e;return t.TYPE_FROM_SHORT_TYPE[n.toUpperCase()]||n.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=r},{}],54:[function(e,n,t){"use strict";function r(e,n){var t={};return n.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function i(e,n){var t=C.duplicate(e);return n.forEach(function(e){delete t[e]}),t}function o(e){return O.isString(e)||O.isNumber(e)||O.isBoolean(e)?String(e):S(e)}function a(e,n){return e.indexOf(n)>-1}function u(e,n){return e.filter(function(e){return!a(n,e)})}function c(e,n){return e.concat(u(n,e))}function s(e,n,t){if(e.forEach)e.forEach.call(t,n);else for(var r in e)e.hasOwnProperty(r)&&n.call(t,e[r],r,e)}function l(e,n,t,r){if(e.reduce)return e.reduce.call(r,n,t);for(var i in e)e.hasOwnProperty(i)&&(t=n.call(r,t,e[i],i,e));return t}function f(e,n,t){if(e.map)return e.map.call(t,n);var r=[];for(var i in e)e.hasOwnProperty(i)&&r.push(n.call(t,e[i],i,e));return r}function p(e,n){for(var t=0,r=0;rr;++r)t=n?n(e[r]):e[r],t in a||(a[t]=1,o.push(e[r]));return o}function T(e){console.warn("[VL Warning]",e)}function A(e){console.error("[VL Error]",e)}function N(e,n){for(var t in e)if(e.hasOwnProperty(t)&&n[t]&&e[t]&&n[t]!==e[t])return!0;return!1}var S=e("json-stable-stringify"),v=e("datalib/src/util");t.keys=v.keys,t.extend=v.extend,t.duplicate=v.duplicate,t.isArray=v.isArray,t.vals=v.vals,t.truncate=v.truncate,t.toMap=v.toMap,t.isObject=v.isObject,t.isString=v.isString,t.isNumber=v.isNumber,t.isBoolean=v.isBoolean;var C=e("datalib/src/util"),I=e("datalib/src/generate");t.range=I.range;var O=e("datalib/src/util");t.pick=r,t.omit=i,t.hash=o,t.contains=a,t.without=u,t.union=c,t.forEach=s,t.reduce=l,t.map=f,t.some=p,t.every=E,t.flatten=d,t.mergeDeep=y;var R=e("datalib/src/bins/bins");t.getbins=g,t.unique=m,t.warning=T,t.error=A,t.differ=N},{"datalib/src/bins/bins":36,"datalib/src/generate":37,"datalib/src/util":39,"json-stable-stringify":40}]},{},[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..e7194fcc --- /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","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","DAY","DATE","Type","NOMINAL","ORDINAL","QUANTITATIVE","TEMPORAL","maxBinsList","scaleBandSizes","scaleDomains","scaleExponents","scaleRanges","scaleTypes","ScaleType","LINEAR","LOG","numberOrdinalProportion","autoAddCount","hasAppropriateGraphicTypeForMark","omitAggregatePlotWithDimensionOnlyOnFacet","omitBarLineAreaWithOcclusion","omitBarTickWithSize","omitFacetOverPositionalChannels","omitMultipleNonPositionalChannels","omitNonSumStack","omitRawContinuousFieldForAggregatePlot","omitRepeatedField","omitNonPositionalOverPositionalChannels","omitTableWithOcclusion","omitVerticalDotPlot","preferredBinAxis","Channel","preferredTemporalAxis","preferredOrdinalAxis","preferredNominalAxis","preferredFacet","maxCardinalityForCategoricalColor","maxCardinalityForFacet","maxCardinalityForShape","typeMatchesSchemaType","maxGoodCardinalityForFacet","maxGoodCardinalityForColor","./property","vega-lite/src/aggregate","vega-lite/src/channel","vega-lite/src/mark","vega-lite/src/scale","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","AUTOCOUNT","numFn","autoCount","timeUnit","FIELD","primitiveType","PrimitiveType","BOOLEAN","STRING","NUMBER","INTEGER","cardinality","SHAPE","SCALE","SCALE_TYPE","sType","scaleType","contains","TIME","POW","SQRT","QUANTILE","QUANTIZE","ec","ENCODING_CONSTRAINT_INDEX","forEach","../enumspec","../property","../query/encoding","../schema","./base","13","checkSpec","specConstraints","SPEC_CONSTRAINTS_BY_PROPERTY","SpecConstraintModel","specConstraint","MARK","getMark","child_1","getEncodings","isEncodingProperty","SPEC_CONSTRAINTS","usedChannel","SCALE_ZERO","mark","encodings","_i","encodings_1","zero","encodings_2","hasAutoCount","some","neverHaveAutoCount","enumSpecIndex","encodingIndicesByProperty","supportMark","channelUsed","TEXT","CIRCLE","SQUARE","RULE","isAggregate","hasNonFacetDim_1","hasDim_1","encodings_3","nonPositionChannelCount","NONSPATIAL_CHANNELS","DETAIL","usedField","xEncQ","getEncodingQueryByChannel","yEncQ","xIsMeasure","yIsMeasure","stack","measureEncQ","fieldChannel","SUM_OPS","encodings_4","sc","SPEC_CONSTRAINT_INDEX","14","enumerate","generate_1","generate","model","modelGroup","nest","property","cqlQuery","query_1","query","ranking","./constraint/constraint","./enumerator","./enumspec","./model","./modelgroup","./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","ShortEnumSpec","ENUMSPEC","17","specQ","config_1","model_1","SpecQueryModel","build","hasPropertyIndex","reducer","enumerator_1","../src/enumerator","./config","18","property_2","getDefaultName","BIN_MAXBINS","SCALE_BANDSIZE","SCALE_CLAMP","SCALE_DOMAIN","SCALE_EXPONENT","SCALE_NICE","SCALE_RANGE","SCALE_ROUND","SCALE_USERAWDOMAIN","getDefaultEnumValues","setEnumSpecIndex","encodingsIndex","encIndex","shorthand_1","enumSpecAssignment","_rankingScore","_channelCount","_enumSpecIndex","_enumSpecAssignment","_opt","_schema","name_1","warn","defaultEnumSpecName","propObj","countEncQ","defineProperty","get","enumerable","configurable","hasNestedProperty","fieldDef","COUNT","PROPERTIES","toSpec","transform","config","getRankingScore","rankingName","setRankingScore","score","./query/encoding","./query/shorthand","./query/spec","19","isSpecQueryModelGroup","item","getTopItem","topItem","items","20","registerKeyFn","groupRegistry","specModels","rootGroup","path","groupIndex","includes_1","replaces_1","replacers_1","_loop_1","util_2","groupBy","grpBy","groupby_1","isExtendedGroupBy","replaceFnIndex","fnIndex","getReplacer","group","orderGroupBy","key","specQuery","channelType","OPACITY","PATH","ORDER","stringifyStack","_stack","FIELD_TRANSFORM","ENCODING","TRANSPOSE","SPEC","./query/groupby","datalib/src/util","21","ENCODING_INDEX","NESTED_ENCODING_INDEX","getNestedEncodingPropertyChildren","NESTED_ENCODING_PROPERTY_PARENT_INDEX","isNestedEncodingProperty","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","include","INCLUDE_ALL","parts","encQStr","fieldDefStr","props","_a","nestedPropParent","nestedProps","nestedPropChildren","_b","_c","fieldAndParams","typeShort","substr","26","fromSpec","channelDef","ENCODING_PROPERTIES_1","AXIS","LEGEND","stacked","stack_1","StackOffset","NONE","stackByChannels","STACK_GROUP_CHANNELS","xIsAggregate","yIsAggregate","groupbyChannel","ZERO","vega-lite/src/stack","27","28","TypeChannelScore","effectiveness_1","init","SCORE","ORDERED_TYPE_CHANNEL_SCORE","text","detail","Q","BIN_Q","T","TIMEUNIT_T","O","featurize","NOMINAL_TYPE_CHANNEL_SCORE","getScore","encodingQueryByField","fieldKey","features","encQs","bestFieldFeature","best","getExtendedType","feature","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","29","FEATURE_INDEX","addFeatureFactory","FEATURE_FACTORIES","default_1","scores","concat","MarkScore","MARK_SCORE","./channel","./mark","30","xType","yType","hasOcclusion","MEASURES","DIMENSIONS","DIMENSIONS_OR_NONE","occludedQQMark","point","tick","bar","area","rule","noOccludedQQMark","occludedDimensionMeasureMark","feature2","noOccludedQxN","noOccludedQxBinQ","ddMark","rect","isOccluded","31","ExtendedType","32","register","rankingRegistry","subgroup","groupComparator","m1","m2","g1","g2","modelgroup_1","effectiveness","EFFECTIVENESS","../modelgroup","./effectiveness/effectiveness","33","binSummary","dlBin","binSum","bin_1","stats_1","type_2","Schema","fieldSchemas","fieldSchemaIndex","fieldSchema","summaries","order","nominal","ordinal","temporal","quantitative","localeCompare","fieldSchemas_1","binStats","getTime","autoMaxBins","fieldSchema_1","datalib/src/bins/bins","datalib/src/import/type","datalib/src/stats","vega-lite/src/bin","34","indexOf","arr","thisArg","nestedMap","without","excludedItems","35","apply","dup","36","37","38","39","40","json","opts","space","cycles","replacer","node","aobj","bobj","seen","indent","colonSeparator","toJSON","out","TypeError","objectKeys","keyValue","","has","jsonify","41","./lib/parse","./lib/stringify","42","at","ch","escapee","\"","\\","/","error","message","charAt","hex","uffff","parseInt","fromCharCode","white","object","source","reviver","walk","holder","43","quote","escapable","lastIndex","meta","charCodeAt","partial","mind","gap","rep","\b","\t","\n","\f","\r","44","AGGREGATE_OPS","VALUES","VALID","MISSING","DISTINCT","SUM","AVERAGE","VARIANCE","VARIANCEP","STDEV","STDEVP","MEDIAN","Q1","Q3","MODESKEW","MIN","MAX","ARGMIN","ARGMAX","SHARED_DOMAIN_OPS","45","46","getSupportedMark","circle","square","X2","Y2","LABEL","hasScale","CHANNELS","UNIT_CHANNELS","UNIT_SCALE_CHANNELS","NONSPATIAL_SCALE_CHANNELS","47","isDateTime","quarter","normalizeQuarter","normalizeMonth","lowerM","toLowerCase","monthIndex","MONTHS","shortM","shortMonthIndex","SHORT_MONTHS","normalizeDay","lowerD","dayIndex","DAYS","shortD","shortDayIndex","SHORT_DAYS","dateTimeExpr","48","countRetinal","channelEncoding","isRanged","y2","fieldDefs","channelMappingForEach","mapping","channelMappingMap","channelMappingReduce","49","ERRORBAR","PRIMITIVE_MARKS","50","NiceTime","BandSize","BANDSIZE_FIT","FIT","defaultScaleConfig","textBandWidth","bandSize","padding","nominalColorRange","sequentialColorRange","shapeRange","fontSizeRange","ruleSizeRange","tickSizeRange","defaultFacetScaleConfig","51","hasXField","hasYField","52","isSingleTimeUnit","SINGLE_TIMEUNIT_INDEX","isMultiTimeUnit","MULTI_TIMEUNIT_INDEX","containsTimeUnit","fullTimeUnit","fullTimeUnitStr","timeUnitStr","SECONDS","HOURS","QUARTER","fieldExpr","func","fieldRef","SINGLE_TIMEUNITS","_d","tu","datetime_1","rawDomain","MINUTES","smallestUnit","template","shortTimeLabels","dateComponents","timeComponents","MILLISECONDS","template_1","RegExp","MULTI_TIMEUNITS","YEARQUARTER","YEARQUARTERMONTH","YEARMONTH","YEARMONTHDATE","YEARMONTHDATEHOURS","YEARMONTHDATEHOURSMINUTES","YEARMONTHDATEHOURSMINUTESSECONDS","QUARTERMONTH","HOURSMINUTES","HOURSMINUTESSECONDS","MINUTESSECONDS","SECONDSMILLISECONDS","TIMEUNITS","./datetime","./scale","53","getFullName","typeString","TYPE_FROM_SHORT_TYPE","toUpperCase","SHORT_TYPE","54","pick","copy","omit","hash","util_3","union","other","output","flatten","arrays","mergeDeep","dest","src","deepMerge_","getbins","warning","differ","dict","datalib/src/generate","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,GAAEJ,GAAE,EAAI,IAAIhB,GAAE,GAAIqB,OAAM,uBAAuBL,EAAE,IAAK,MAAMhB,GAAEsB,KAAK,mBAAmBtB,EAAE,GAAIuB,GAAEV,EAAEG,IAAIf,WAAYW,GAAEI,GAAG,GAAGQ,KAAKD,EAAEtB,QAAQ,SAASU,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEtB,QAAQU,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGf,QAAkD,IAAI,GAA1CmB,GAAkB,kBAATD,UAAqBA,QAAgBH,EAAE,EAAEA,EAAEF,EAAEW,OAAOT,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKW,GAAG,SAASP,EAAQjB,EAAOD,SAE5zB0B,GAAG,SAASR,EAAQjB,EAAOD,IAChC,SAAUM,EAAQqB,G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