// https://d3js.org/d3-scale/ v2.2.2 Copyright 2019 Mike Bostock
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-collection'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) :
        typeof define === 'function' && define.amd ? define(['exports', 'd3-collection', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) :
            (factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
}(this, (function (exports,d3Collection,d3Array,d3Interpolate,d3Format,d3Time,d3TimeFormat) { 'use strict';

    function initRange(domain, range) {
        switch (arguments.length) {
            case 0: break;
            case 1: this.range(domain); break;
            default: this.range(range).domain(domain); break;
        }
        return this;
    }

    function initInterpolator(domain, interpolator) {
        switch (arguments.length) {
            case 0: break;
            case 1: this.interpolator(domain); break;
            default: this.interpolator(interpolator).domain(domain); break;
        }
        return this;
    }

    var array = Array.prototype;

    var map = array.map;
    var slice = array.slice;

    var implicit = {name: "implicit"};

    function ordinal() {
        var index = d3Collection.map(),
            domain = [],
            range = [],
            unknown = implicit;

        function scale(d) {
            var key = d + "", i = index.get(key);
            if (!i) {
                if (unknown !== implicit) return unknown;
                index.set(key, i = domain.push(d));
            }
            return range[(i - 1) % range.length];
        }

        scale.domain = function(_) {
            if (!arguments.length) return domain.slice();
            domain = [], index = d3Collection.map();
            var i = -1, n = _.length, d, key;
            while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
            return scale;
        };

        scale.range = function(_) {
            return arguments.length ? (range = slice.call(_), scale) : range.slice();
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        scale.copy = function() {
            return ordinal(domain, range).unknown(unknown);
        };

        initRange.apply(scale, arguments);

        return scale;
    }

    function band() {
        var scale = ordinal().unknown(undefined),
            domain = scale.domain,
            ordinalRange = scale.range,
            range = [0, 1],
            step,
            bandwidth,
            round = false,
            paddingInner = 0,
            paddingOuter = 0,
            align = 0.5;

        delete scale.unknown;

        function rescale() {
            var n = domain().length,
                reverse = range[1] < range[0],
                start = range[reverse - 0],
                stop = range[1 - reverse];
            step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
            if (round) step = Math.floor(step);
            start += (stop - start - step * (n - paddingInner)) * align;
            bandwidth = step * (1 - paddingInner);
            if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
            var values = d3Array.range(n).map(function(i) { return start + step * i; });
            return ordinalRange(reverse ? values.reverse() : values);
        }

        scale.domain = function(_) {
            return arguments.length ? (domain(_), rescale()) : domain();
        };

        scale.range = function(_) {
            return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();
        };

        scale.rangeRound = function(_) {
            return range = [+_[0], +_[1]], round = true, rescale();
        };

        scale.bandwidth = function() {
            return bandwidth;
        };

        scale.step = function() {
            return step;
        };

        scale.round = function(_) {
            return arguments.length ? (round = !!_, rescale()) : round;
        };

        scale.padding = function(_) {
            return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
        };

        scale.paddingInner = function(_) {
            return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
        };

        scale.paddingOuter = function(_) {
            return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
        };

        scale.align = function(_) {
            return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
        };

        scale.copy = function() {
            return band(domain(), range)
                .round(round)
                .paddingInner(paddingInner)
                .paddingOuter(paddingOuter)
                .align(align);
        };

        return initRange.apply(rescale(), arguments);
    }

    function pointish(scale) {
        var copy = scale.copy;

        scale.padding = scale.paddingOuter;
        delete scale.paddingInner;
        delete scale.paddingOuter;

        scale.copy = function() {
            return pointish(copy());
        };

        return scale;
    }

    function point() {
        return pointish(band.apply(null, arguments).paddingInner(1));
    }

    function constant(x) {
        return function() {
            return x;
        };
    }

    function number(x) {
        return +x;
    }

    var unit = [0, 1];

    function identity(x) {
        return x;
    }

    function normalize(a, b) {
        return (b -= (a = +a))
            ? function(x) { return (x - a) / b; }
            : constant(isNaN(b) ? NaN : 0.5);
    }

    function clamper(domain) {
        var a = domain[0], b = domain[domain.length - 1], t;
        if (a > b) t = a, a = b, b = t;
        return function(x) { return Math.max(a, Math.min(b, x)); };
    }

// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
    function bimap(domain, range, interpolate) {
        var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
        if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
        else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
        return function(x) { return r0(d0(x)); };
    }

    function polymap(domain, range, interpolate) {
        var j = Math.min(domain.length, range.length) - 1,
            d = new Array(j),
            r = new Array(j),
            i = -1;

        // Reverse descending domains.
        if (domain[j] < domain[0]) {
            domain = domain.slice().reverse();
            range = range.slice().reverse();
        }

        while (++i < j) {
            d[i] = normalize(domain[i], domain[i + 1]);
            r[i] = interpolate(range[i], range[i + 1]);
        }

        return function(x) {
            var i = d3Array.bisect(domain, x, 1, j) - 1;
            return r[i](d[i](x));
        };
    }

    function copy(source, target) {
        return target
            .domain(source.domain())
            .range(source.range())
            .interpolate(source.interpolate())
            .clamp(source.clamp())
            .unknown(source.unknown());
    }

    function transformer() {
        var domain = unit,
            range = unit,
            interpolate = d3Interpolate.interpolate,
            transform,
            untransform,
            unknown,
            clamp = identity,
            piecewise,
            output,
            input;

        function rescale() {
            piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
            output = input = null;
            return scale;
        }

        function scale(x) {
            return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
        }

        scale.invert = function(y) {
            return clamp(untransform((input || (input = piecewise(range, domain.map(transform), d3Interpolate.interpolateNumber)))(y)));
        };

        scale.domain = function(_) {
            return arguments.length ? (domain = map.call(_, number), clamp === identity || (clamp = clamper(domain)), rescale()) : domain.slice();
        };

        scale.range = function(_) {
            return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
        };

        scale.rangeRound = function(_) {
            return range = slice.call(_), interpolate = d3Interpolate.interpolateRound, rescale();
        };

        scale.clamp = function(_) {
            return arguments.length ? (clamp = _ ? clamper(domain) : identity, scale) : clamp !== identity;
        };

        scale.interpolate = function(_) {
            return arguments.length ? (interpolate = _, rescale()) : interpolate;
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        return function(t, u) {
            transform = t, untransform = u;
            return rescale();
        };
    }

    function continuous(transform, untransform) {
        return transformer()(transform, untransform);
    }

    function tickFormat(start, stop, count, specifier) {
        var step = d3Array.tickStep(start, stop, count),
            precision;
        specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier);
        switch (specifier.type) {
            case "s": {
                var value = Math.max(Math.abs(start), Math.abs(stop));
                if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision;
                return d3Format.formatPrefix(specifier, value);
            }
            case "":
            case "e":
            case "g":
            case "p":
            case "r": {
                if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
                break;
            }
            case "f":
            case "%": {
                if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
                break;
            }
        }
        return d3Format.format(specifier);
    }

    function linearish(scale) {
        var domain = scale.domain;

        scale.ticks = function(count) {
            var d = domain();
            return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count);
        };

        scale.tickFormat = function(count, specifier) {
            var d = domain();
            return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
        };

        scale.nice = function(count) {
            if (count == null) count = 10;

            var d = domain(),
                i0 = 0,
                i1 = d.length - 1,
                start = d[i0],
                stop = d[i1],
                step;

            if (stop < start) {
                step = start, start = stop, stop = step;
                step = i0, i0 = i1, i1 = step;
            }

            step = d3Array.tickIncrement(start, stop, count);

            if (step > 0) {
                start = Math.floor(start / step) * step;
                stop = Math.ceil(stop / step) * step;
                step = d3Array.tickIncrement(start, stop, count);
            } else if (step < 0) {
                start = Math.ceil(start * step) / step;
                stop = Math.floor(stop * step) / step;
                step = d3Array.tickIncrement(start, stop, count);
            }

            if (step > 0) {
                d[i0] = Math.floor(start / step) * step;
                d[i1] = Math.ceil(stop / step) * step;
                domain(d);
            } else if (step < 0) {
                d[i0] = Math.ceil(start * step) / step;
                d[i1] = Math.floor(stop * step) / step;
                domain(d);
            }

            return scale;
        };

        return scale;
    }

    function linear() {
        var scale = continuous(identity, identity);

        scale.copy = function() {
            return copy(scale, linear());
        };

        initRange.apply(scale, arguments);

        return linearish(scale);
    }

    function identity$1(domain) {
        var unknown;

        function scale(x) {
            return isNaN(x = +x) ? unknown : x;
        }

        scale.invert = scale;

        scale.domain = scale.range = function(_) {
            return arguments.length ? (domain = map.call(_, number), scale) : domain.slice();
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        scale.copy = function() {
            return identity$1(domain).unknown(unknown);
        };

        domain = arguments.length ? map.call(domain, number) : [0, 1];

        return linearish(scale);
    }

    function nice(domain, interval) {
        domain = domain.slice();

        var i0 = 0,
            i1 = domain.length - 1,
            x0 = domain[i0],
            x1 = domain[i1],
            t;

        if (x1 < x0) {
            t = i0, i0 = i1, i1 = t;
            t = x0, x0 = x1, x1 = t;
        }

        domain[i0] = interval.floor(x0);
        domain[i1] = interval.ceil(x1);
        return domain;
    }

    function transformLog(x) {
        return Math.log(x);
    }

    function transformExp(x) {
        return Math.exp(x);
    }

    function transformLogn(x) {
        return -Math.log(-x);
    }

    function transformExpn(x) {
        return -Math.exp(-x);
    }

    function pow10(x) {
        return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
    }

    function powp(base) {
        return base === 10 ? pow10
            : base === Math.E ? Math.exp
                : function(x) { return Math.pow(base, x); };
    }

    function logp(base) {
        return base === Math.E ? Math.log
            : base === 10 && Math.log10
            || base === 2 && Math.log2
            || (base = Math.log(base), function(x) { return Math.log(x) / base; });
    }

    function reflect(f) {
        return function(x) {
            return -f(-x);
        };
    }

    function loggish(transform) {
        var scale = transform(transformLog, transformExp),
            domain = scale.domain,
            base = 10,
            logs,
            pows;

        function rescale() {
            logs = logp(base), pows = powp(base);
            if (domain()[0] < 0) {
                logs = reflect(logs), pows = reflect(pows);
                transform(transformLogn, transformExpn);
            } else {
                transform(transformLog, transformExp);
            }
            return scale;
        }

        scale.base = function(_) {
            return arguments.length ? (base = +_, rescale()) : base;
        };

        scale.domain = function(_) {
            return arguments.length ? (domain(_), rescale()) : domain();
        };

        scale.ticks = function(count) {
            var d = domain(),
                u = d[0],
                v = d[d.length - 1],
                r;

            if (r = v < u) i = u, u = v, v = i;

            var i = logs(u),
                j = logs(v),
                p,
                k,
                t,
                n = count == null ? 10 : +count,
                z = [];

            if (!(base % 1) && j - i < n) {
                i = Math.round(i) - 1, j = Math.round(j) + 1;
                if (u > 0) for (; i < j; ++i) {
                    for (k = 1, p = pows(i); k < base; ++k) {
                        t = p * k;
                        if (t < u) continue;
                        if (t > v) break;
                        z.push(t);
                    }
                } else for (; i < j; ++i) {
                    for (k = base - 1, p = pows(i); k >= 1; --k) {
                        t = p * k;
                        if (t < u) continue;
                        if (t > v) break;
                        z.push(t);
                    }
                }
            } else {
                z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows);
            }

            return r ? z.reverse() : z;
        };

        scale.tickFormat = function(count, specifier) {
            if (specifier == null) specifier = base === 10 ? ".0e" : ",";
            if (typeof specifier !== "function") specifier = d3Format.format(specifier);
            if (count === Infinity) return specifier;
            if (count == null) count = 10;
            var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
            return function(d) {
                var i = d / pows(Math.round(logs(d)));
                if (i * base < base - 0.5) i *= base;
                return i <= k ? specifier(d) : "";
            };
        };

        scale.nice = function() {
            return domain(nice(domain(), {
                floor: function(x) { return pows(Math.floor(logs(x))); },
                ceil: function(x) { return pows(Math.ceil(logs(x))); }
            }));
        };

        return scale;
    }

    function log() {
        var scale = loggish(transformer()).domain([1, 10]);

        scale.copy = function() {
            return copy(scale, log()).base(scale.base());
        };

        initRange.apply(scale, arguments);

        return scale;
    }

    function transformSymlog(c) {
        return function(x) {
            return Math.sign(x) * Math.log1p(Math.abs(x / c));
        };
    }

    function transformSymexp(c) {
        return function(x) {
            return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
        };
    }

    function symlogish(transform) {
        var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));

        scale.constant = function(_) {
            return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
        };

        return linearish(scale);
    }

    function symlog() {
        var scale = symlogish(transformer());

        scale.copy = function() {
            return copy(scale, symlog()).constant(scale.constant());
        };

        return initRange.apply(scale, arguments);
    }

    function transformPow(exponent) {
        return function(x) {
            return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
        };
    }

    function transformSqrt(x) {
        return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
    }

    function transformSquare(x) {
        return x < 0 ? -x * x : x * x;
    }

    function powish(transform) {
        var scale = transform(identity, identity),
            exponent = 1;

        function rescale() {
            return exponent === 1 ? transform(identity, identity)
                : exponent === 0.5 ? transform(transformSqrt, transformSquare)
                    : transform(transformPow(exponent), transformPow(1 / exponent));
        }

        scale.exponent = function(_) {
            return arguments.length ? (exponent = +_, rescale()) : exponent;
        };

        return linearish(scale);
    }

    function pow() {
        var scale = powish(transformer());

        scale.copy = function() {
            return copy(scale, pow()).exponent(scale.exponent());
        };

        initRange.apply(scale, arguments);

        return scale;
    }

    function sqrt() {
        return pow.apply(null, arguments).exponent(0.5);
    }

    function quantile() {
        var domain = [],
            range = [],
            thresholds = [],
            unknown;

        function rescale() {
            var i = 0, n = Math.max(1, range.length);
            thresholds = new Array(n - 1);
            while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n);
            return scale;
        }

        function scale(x) {
            return isNaN(x = +x) ? unknown : range[d3Array.bisect(thresholds, x)];
        }

        scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return i < 0 ? [NaN, NaN] : [
                i > 0 ? thresholds[i - 1] : domain[0],
                i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
            ];
        };

        scale.domain = function(_) {
            if (!arguments.length) return domain.slice();
            domain = [];
            for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
            domain.sort(d3Array.ascending);
            return rescale();
        };

        scale.range = function(_) {
            return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        scale.quantiles = function() {
            return thresholds.slice();
        };

        scale.copy = function() {
            return quantile()
                .domain(domain)
                .range(range)
                .unknown(unknown);
        };

        return initRange.apply(scale, arguments);
    }

    function quantize() {
        var x0 = 0,
            x1 = 1,
            n = 1,
            domain = [0.5],
            range = [0, 1],
            unknown;

        function scale(x) {
            return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown;
        }

        function rescale() {
            var i = -1;
            domain = new Array(n);
            while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
            return scale;
        }

        scale.domain = function(_) {
            return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
        };

        scale.range = function(_) {
            return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice();
        };

        scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return i < 0 ? [NaN, NaN]
                : i < 1 ? [x0, domain[0]]
                    : i >= n ? [domain[n - 1], x1]
                        : [domain[i - 1], domain[i]];
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : scale;
        };

        scale.thresholds = function() {
            return domain.slice();
        };

        scale.copy = function() {
            return quantize()
                .domain([x0, x1])
                .range(range)
                .unknown(unknown);
        };

        return initRange.apply(linearish(scale), arguments);
    }

    function threshold() {
        var domain = [0.5],
            range = [0, 1],
            unknown,
            n = 1;

        function scale(x) {
            return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown;
        }

        scale.domain = function(_) {
            return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
        };

        scale.range = function(_) {
            return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
        };

        scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return [domain[i - 1], domain[i]];
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        scale.copy = function() {
            return threshold()
                .domain(domain)
                .range(range)
                .unknown(unknown);
        };

        return initRange.apply(scale, arguments);
    }

    var durationSecond = 1000,
        durationMinute = durationSecond * 60,
        durationHour = durationMinute * 60,
        durationDay = durationHour * 24,
        durationWeek = durationDay * 7,
        durationMonth = durationDay * 30,
        durationYear = durationDay * 365;

    function date(t) {
        return new Date(t);
    }

    function number$1(t) {
        return t instanceof Date ? +t : +new Date(+t);
    }

    function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
        var scale = continuous(identity, identity),
            invert = scale.invert,
            domain = scale.domain;

        var formatMillisecond = format(".%L"),
            formatSecond = format(":%S"),
            formatMinute = format("%I:%M"),
            formatHour = format("%I %p"),
            formatDay = format("%a %d"),
            formatWeek = format("%b %d"),
            formatMonth = format("%B"),
            formatYear = format("%Y");

        var tickIntervals = [
            [second,  1,      durationSecond],
            [second,  5,  5 * durationSecond],
            [second, 15, 15 * durationSecond],
            [second, 30, 30 * durationSecond],
            [minute,  1,      durationMinute],
            [minute,  5,  5 * durationMinute],
            [minute, 15, 15 * durationMinute],
            [minute, 30, 30 * durationMinute],
            [  hour,  1,      durationHour  ],
            [  hour,  3,  3 * durationHour  ],
            [  hour,  6,  6 * durationHour  ],
            [  hour, 12, 12 * durationHour  ],
            [   day,  1,      durationDay   ],
            [   day,  2,  2 * durationDay   ],
            [  week,  1,      durationWeek  ],
            [ month,  1,      durationMonth ],
            [ month,  3,  3 * durationMonth ],
            [  year,  1,      durationYear  ]
        ];

        function tickFormat(date) {
            return (second(date) < date ? formatMillisecond
                : minute(date) < date ? formatSecond
                    : hour(date) < date ? formatMinute
                        : day(date) < date ? formatHour
                            : month(date) < date ? (week(date) < date ? formatDay : formatWeek)
                                : year(date) < date ? formatMonth
                                    : formatYear)(date);
        }

        function tickInterval(interval, start, stop, step) {
            if (interval == null) interval = 10;

            // If a desired tick count is specified, pick a reasonable tick interval
            // based on the extent of the domain and a rough estimate of tick size.
            // Otherwise, assume interval is already a time interval and use it.
            if (typeof interval === "number") {
                var target = Math.abs(stop - start) / interval,
                    i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target);
                if (i === tickIntervals.length) {
                    step = d3Array.tickStep(start / durationYear, stop / durationYear, interval);
                    interval = year;
                } else if (i) {
                    i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
                    step = i[1];
                    interval = i[0];
                } else {
                    step = Math.max(d3Array.tickStep(start, stop, interval), 1);
                    interval = millisecond;
                }
            }

            return step == null ? interval : interval.every(step);
        }

        scale.invert = function(y) {
            return new Date(invert(y));
        };

        scale.domain = function(_) {
            return arguments.length ? domain(map.call(_, number$1)) : domain().map(date);
        };

        scale.ticks = function(interval, step) {
            var d = domain(),
                t0 = d[0],
                t1 = d[d.length - 1],
                r = t1 < t0,
                t;
            if (r) t = t0, t0 = t1, t1 = t;
            t = tickInterval(interval, t0, t1, step);
            t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
            return r ? t.reverse() : t;
        };

        scale.tickFormat = function(count, specifier) {
            return specifier == null ? tickFormat : format(specifier);
        };

        scale.nice = function(interval, step) {
            var d = domain();
            return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
                ? domain(nice(d, interval))
                : scale;
        };

        scale.copy = function() {
            return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
        };

        return scale;
    }

    function time() {
        return initRange.apply(calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
    }

    function utcTime() {
        return initRange.apply(calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
    }

    function transformer$1() {
        var x0 = 0,
            x1 = 1,
            t0,
            t1,
            k10,
            transform,
            interpolator = identity,
            clamp = false,
            unknown;

        function scale(x) {
            return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
        }

        scale.domain = function(_) {
            return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
        };

        scale.clamp = function(_) {
            return arguments.length ? (clamp = !!_, scale) : clamp;
        };

        scale.interpolator = function(_) {
            return arguments.length ? (interpolator = _, scale) : interpolator;
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        return function(t) {
            transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
            return scale;
        };
    }

    function copy$1(source, target) {
        return target
            .domain(source.domain())
            .interpolator(source.interpolator())
            .clamp(source.clamp())
            .unknown(source.unknown());
    }

    function sequential() {
        var scale = linearish(transformer$1()(identity));

        scale.copy = function() {
            return copy$1(scale, sequential());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function sequentialLog() {
        var scale = loggish(transformer$1()).domain([1, 10]);

        scale.copy = function() {
            return copy$1(scale, sequentialLog()).base(scale.base());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function sequentialSymlog() {
        var scale = symlogish(transformer$1());

        scale.copy = function() {
            return copy$1(scale, sequentialSymlog()).constant(scale.constant());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function sequentialPow() {
        var scale = powish(transformer$1());

        scale.copy = function() {
            return copy$1(scale, sequentialPow()).exponent(scale.exponent());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function sequentialSqrt() {
        return sequentialPow.apply(null, arguments).exponent(0.5);
    }

    function sequentialQuantile() {
        var domain = [],
            interpolator = identity;

        function scale(x) {
            if (!isNaN(x = +x)) return interpolator((d3Array.bisect(domain, x) - 1) / (domain.length - 1));
        }

        scale.domain = function(_) {
            if (!arguments.length) return domain.slice();
            domain = [];
            for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
            domain.sort(d3Array.ascending);
            return scale;
        };

        scale.interpolator = function(_) {
            return arguments.length ? (interpolator = _, scale) : interpolator;
        };

        scale.copy = function() {
            return sequentialQuantile(interpolator).domain(domain);
        };

        return initInterpolator.apply(scale, arguments);
    }

    function transformer$2() {
        var x0 = 0,
            x1 = 0.5,
            x2 = 1,
            t0,
            t1,
            t2,
            k10,
            k21,
            interpolator = identity,
            transform,
            clamp = false,
            unknown;

        function scale(x) {
            return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (x < t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
        }

        scale.domain = function(_) {
            return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), t2 = transform(x2 = +_[2]), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), scale) : [x0, x1, x2];
        };

        scale.clamp = function(_) {
            return arguments.length ? (clamp = !!_, scale) : clamp;
        };

        scale.interpolator = function(_) {
            return arguments.length ? (interpolator = _, scale) : interpolator;
        };

        scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        };

        return function(t) {
            transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1);
            return scale;
        };
    }

    function diverging() {
        var scale = linearish(transformer$2()(identity));

        scale.copy = function() {
            return copy$1(scale, diverging());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function divergingLog() {
        var scale = loggish(transformer$2()).domain([0.1, 1, 10]);

        scale.copy = function() {
            return copy$1(scale, divergingLog()).base(scale.base());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function divergingSymlog() {
        var scale = symlogish(transformer$2());

        scale.copy = function() {
            return copy$1(scale, divergingSymlog()).constant(scale.constant());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function divergingPow() {
        var scale = powish(transformer$2());

        scale.copy = function() {
            return copy$1(scale, divergingPow()).exponent(scale.exponent());
        };

        return initInterpolator.apply(scale, arguments);
    }

    function divergingSqrt() {
        return divergingPow.apply(null, arguments).exponent(0.5);
    }

    exports.scaleBand = band;
    exports.scalePoint = point;
    exports.scaleIdentity = identity$1;
    exports.scaleLinear = linear;
    exports.scaleLog = log;
    exports.scaleSymlog = symlog;
    exports.scaleOrdinal = ordinal;
    exports.scaleImplicit = implicit;
    exports.scalePow = pow;
    exports.scaleSqrt = sqrt;
    exports.scaleQuantile = quantile;
    exports.scaleQuantize = quantize;
    exports.scaleThreshold = threshold;
    exports.scaleTime = time;
    exports.scaleUtc = utcTime;
    exports.scaleSequential = sequential;
    exports.scaleSequentialLog = sequentialLog;
    exports.scaleSequentialPow = sequentialPow;
    exports.scaleSequentialSqrt = sequentialSqrt;
    exports.scaleSequentialSymlog = sequentialSymlog;
    exports.scaleSequentialQuantile = sequentialQuantile;
    exports.scaleDiverging = diverging;
    exports.scaleDivergingLog = divergingLog;
    exports.scaleDivergingPow = divergingPow;
    exports.scaleDivergingSqrt = divergingSqrt;
    exports.scaleDivergingSymlog = divergingSymlog;
    exports.tickFormat = tickFormat;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
