require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({"@antv/g2plot":[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.G2 = void 0;
var tslib_1 = require("tslib");
// 通用配置
tslib_1.__exportStar(require("./interface/config"), exports);
var layer_1 = require("./base/layer");
Object.defineProperty(exports, "Layer", { enumerable: true, get: function () { return layer_1.default; } });
var view_layer_1 = require("./base/view-layer");
Object.defineProperty(exports, "ViewLayer", { enumerable: true, get: function () { return view_layer_1.default; } });
var plot_1 = require("./base/plot");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return plot_1.default; } });
// 图形
tslib_1.__exportStar(require("./plots"), exports);
var progress_1 = require("./sparkline/progress");
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return progress_1.default; } });
var ring_progress_1 = require("./sparkline/ring-progress");
Object.defineProperty(exports, "RingProgress", { enumerable: true, get: function () { return ring_progress_1.default; } });
var tiny_column_1 = require("./sparkline/tiny-column");
Object.defineProperty(exports, "TinyColumn", { enumerable: true, get: function () { return tiny_column_1.default; } });
var tiny_area_1 = require("./sparkline/tiny-area");
Object.defineProperty(exports, "TinyArea", { enumerable: true, get: function () { return tiny_area_1.default; } });
var tiny_line_1 = require("./sparkline/tiny-line");
Object.defineProperty(exports, "TinyLine", { enumerable: true, get: function () { return tiny_line_1.default; } });
// 混合图形
var dual_line_1 = require("./combo/dual-line");
Object.defineProperty(exports, "DualLine", { enumerable: true, get: function () { return dual_line_1.default; } });
var column_line_1 = require("./combo/column-line");
Object.defineProperty(exports, "ColumnLine", { enumerable: true, get: function () { return column_line_1.default; } });
var groupedColumn_line_1 = require("./combo/groupedColumn-line");
Object.defineProperty(exports, "GroupedColumnLine", { enumerable: true, get: function () { return groupedColumn_line_1.default; } });
var stackedColumn_line_1 = require("./combo/stackedColumn-line");
Object.defineProperty(exports, "StackedColumnLine", { enumerable: true, get: function () { return stackedColumn_line_1.default; } });
// 主题
var theme_1 = require("./theme");
Object.defineProperty(exports, "registerTheme", { enumerable: true, get: function () { return theme_1.registerTheme; } });
Object.defineProperty(exports, "registerGlobalTheme", { enumerable: true, get: function () { return theme_1.registerGlobalTheme; } });
var constraints_1 = require("./util/responsive/constraints");
Object.defineProperty(exports, "registerResponsiveConstraint", { enumerable: true, get: function () { return constraints_1.registerResponsiveConstraint; } });
var rules_1 = require("./util/responsive/rules");
Object.defineProperty(exports, "registerResponsiveRule", { enumerable: true, get: function () { return rules_1.registerResponsiveRule; } });
var theme_2 = require("./util/responsive/theme");
Object.defineProperty(exports, "registerResponsiveTheme", { enumerable: true, get: function () { return theme_2.registerResponsiveTheme; } });
Object.defineProperty(exports, "getResponsiveTheme", { enumerable: true, get: function () { return theme_2.getResponsiveTheme; } });
var state_manager_1 = require("./util/state-manager");
Object.defineProperty(exports, "StateManager", { enumerable: true, get: function () { return state_manager_1.default; } });
// 导出 g2 上层需要使用
var G2 = tslib_1.__importStar(require("@antv/g2"));
exports.G2 = G2;

},{"./base/layer":393,"./base/plot":394,"./base/view-layer":395,"./combo/column-line":397,"./combo/dual-line":399,"./combo/groupedColumn-line":401,"./combo/stackedColumn-line":403,"./interface/config":449,"./plots":544,"./sparkline/progress":651,"./sparkline/ring-progress":654,"./sparkline/tiny-area":657,"./sparkline/tiny-column":660,"./sparkline/tiny-line":664,"./theme":669,"./util/responsive/constraints":690,"./util/responsive/rules":699,"./util/responsive/theme":711,"./util/state-manager":713,"@antv/g2":309,"tslib":894}],1:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
    throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
    throw new Error('clearTimeout has not been defined');
}
(function () {
    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
        }
    } catch (e) {
        cachedSetTimeout = defaultSetTimout;
    }
    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
        }
    } catch (e) {
        cachedClearTimeout = defaultClearTimeout;
    }
} ())
function runTimeout(fun) {
    if (cachedSetTimeout === setTimeout) {
        //normal enviroments in sane situations
        return setTimeout(fun, 0);
    }
    // if setTimeout wasn't available but was latter defined
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
        cachedSetTimeout = setTimeout;
        return setTimeout(fun, 0);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedSetTimeout(fun, 0);
    } catch(e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
            return cachedSetTimeout.call(null, fun, 0);
        } catch(e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
            return cachedSetTimeout.call(this, fun, 0);
        }
    }


}
function runClearTimeout(marker) {
    if (cachedClearTimeout === clearTimeout) {
        //normal enviroments in sane situations
        return clearTimeout(marker);
    }
    // if clearTimeout wasn't available but was latter defined
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
        cachedClearTimeout = clearTimeout;
        return clearTimeout(marker);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedClearTimeout(marker);
    } catch (e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
            return cachedClearTimeout.call(null, marker);
        } catch (e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
            return cachedClearTimeout.call(this, marker);
        }
    }



}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
    if (!draining || !currentQueue) {
        return;
    }
    draining = false;
    if (currentQueue.length) {
        queue = currentQueue.concat(queue);
    } else {
        queueIndex = -1;
    }
    if (queue.length) {
        drainQueue();
    }
}

function drainQueue() {
    if (draining) {
        return;
    }
    var timeout = runTimeout(cleanUpNextTick);
    draining = true;

    var len = queue.length;
    while(len) {
        currentQueue = queue;
        queue = [];
        while (++queueIndex < len) {
            if (currentQueue) {
                currentQueue[queueIndex].run();
            }
        }
        queueIndex = -1;
        len = queue.length;
    }
    currentQueue = null;
    draining = false;
    runClearTimeout(timeout);
}

process.nextTick = function (fun) {
    var args = new Array(arguments.length - 1);
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            args[i - 1] = arguments[i];
        }
    }
    queue.push(new Item(fun, args));
    if (queue.length === 1 && !draining) {
        runTimeout(drainQueue);
    }
};

// v8 likes predictible objects
function Item(fun, array) {
    this.fun = fun;
    this.array = array;
}
Item.prototype.run = function () {
    this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) { return [] }

process.binding = function (name) {
    throw new Error('process.binding is not supported');
};

process.cwd = function () { return '/' };
process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };

},{}],2:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("@antv/util");
var constant_1 = require("../constant");
var Adjust = /** @class */ (function () {
    function Adjust(cfg) {
        var xField = cfg.xField, yField = cfg.yField, _a = cfg.adjustNames, adjustNames = _a === void 0 ? ['x', 'y'] : _a;
        this.adjustNames = adjustNames;
        this.xField = xField;
        this.yField = yField;
    }
    /**
     * 查看维度是否是 adjust 字段
     * @param dim
     */
    Adjust.prototype.isAdjust = function (dim) {
        return this.adjustNames.indexOf(dim) >= 0;
    };
    Adjust.prototype.getAdjustRange = function (dim, dimValue, values) {
        var yField = this.yField;
        var index = values.indexOf(dimValue);
        var length = values.length;
        var pre;
        var next;
        // 没有 y 字段，但是需要根据 y 调整
        if (!yField && this.isAdjust('y')) {
            pre = 0;
            next = 1;
        }
        else if (length > 1) {
            // 如果以其开头，则取之，否则取他前面一个
            pre = values[index === 0 ? 0 : index - 1];
            // 如果以其结尾，则取之，否则取他后面一个
            next = values[index === length - 1 ? length - 1 : index + 1];
            if (index !== 0) {
                pre += (dimValue - pre) / 2;
            }
            else {
                pre -= (next - dimValue) / 2;
            }
            if (index !== length - 1) {
                next -= (next - dimValue) / 2;
            }
            else {
                next += (dimValue - values[length - 2]) / 2;
            }
        }
        else {
            pre = dimValue === 0 ? 0 : dimValue - 0.5;
            next = dimValue === 0 ? 1 : dimValue + 0.5;
        }
        return {
            pre: pre,
            next: next,
        };
    };
    Adjust.prototype.adjustData = function (groupedDataArray, mergedData) {
        var _this = this;
        // 所有调整维度的值数组
        var dimValuesMap = this.getDimValues(mergedData);
        // 按照每一个分组来进行调整
        _.each(groupedDataArray, function (dataArray, index) {
            // 遍历所有数据集合
            // 每个分组中，分别按照不同的 dim 进行调整
            _.each(dimValuesMap, function (values, dim) {
                // 根据不同的度量分别调整位置
                _this.adjustDim(dim, values, dataArray, index);
            });
        });
    };
    /**
     * 对数据进行分组adjustData
     * @param data 数据
     * @param dim 分组的字段
     * @return 分组结果
     */
    Adjust.prototype.groupData = function (data, dim) {
        // 补齐数据空数据为默认值
        _.each(data, function (record) {
            if (record[dim] === undefined) {
                record[dim] = constant_1.DEFAULT_Y;
            }
        });
        // 按照 dim 维度分组
        return _.groupBy(data, dim);
    };
    /** @override */
    Adjust.prototype.adjustDim = function (dim, values, data, index) { };
    /**
     * 获取可调整度量对应的值
     * @param mergedData 数据
     * @return 值的映射
     */
    Adjust.prototype.getDimValues = function (mergedData) {
        var _a = this, xField = _a.xField, yField = _a.yField;
        var dimValuesMap = {};
        // 所有的维度
        var dims = [];
        if (xField && this.isAdjust('x')) {
            dims.push(xField);
        }
        if (yField && this.isAdjust('y')) {
            dims.push(yField);
        }
        dims.forEach(function (dim) {
            // 在每个维度上，所有的值
            dimValuesMap[dim] = _.valuesOfKey(mergedData, dim).sort(function (v1, v2) { return v1 - v2; });
        });
        // 只有一维的情况下，同时调整 y，赋予默认值
        if (!yField && this.isAdjust('y')) {
            var dim = 'y';
            dimValuesMap[dim] = [constant_1.DEFAULT_Y, 1]; // 默认分布在 y 轴的 0 与 1 之间
        }
        return dimValuesMap;
    };
    return Adjust;
}());
exports.default = Adjust;

},{"../constant":7,"@antv/util":803}],3:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _ = require("@antv/util");
var constant_1 = require("../constant");
var adjust_1 = require("./adjust");
var Dodge = /** @class */ (function (_super) {
    tslib_1.__extends(Dodge, _super);
    function Dodge(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.cacheMap = {};
        _this.adjustDataArray = [];
        _this.mergeData = [];
        var _a = cfg.marginRatio, marginRatio = _a === void 0 ? constant_1.MARGIN_RATIO : _a, _b = cfg.dodgeRatio, dodgeRatio = _b === void 0 ? constant_1.DODGE_RATIO : _b, dodgeBy = cfg.dodgeBy;
        _this.marginRatio = marginRatio;
        _this.dodgeRatio = dodgeRatio;
        _this.dodgeBy = dodgeBy;
        return _this;
    }
    Dodge.prototype.process = function (groupDataArray) {
        var groupedDataArray = _.clone(groupDataArray);
        // 将数据数组展开一层
        var mergeData = _.flatten(groupedDataArray);
        var dodgeBy = this.dodgeBy;
        // 如果指定了分组 dim 的字段
        var adjustDataArray = dodgeBy ? _.group(mergeData, dodgeBy) : groupedDataArray;
        this.cacheMap = {};
        this.adjustDataArray = adjustDataArray;
        this.mergeData = mergeData;
        this.adjustData(adjustDataArray, mergeData);
        this.adjustDataArray = [];
        this.mergeData = [];
        return groupedDataArray;
    };
    Dodge.prototype.adjustDim = function (dim, values, data, frameIndex) {
        var _this = this;
        var map = this.getDistribution(dim);
        var groupData = this.groupData(data, dim); // 根据值分组
        _.each(groupData, function (group, key) {
            var range;
            // xField 中只有一个值，不需要做 dodge
            if (values.length === 1) {
                range = {
                    pre: values[0] - 1,
                    next: values[0] + 1,
                };
            }
            else {
                // 如果有多个，则需要获取调整的范围
                range = _this.getAdjustRange(dim, parseFloat(key), values);
            }
            _.each(group, function (d) {
                var value = d[dim];
                var valueArr = map[value];
                var valIndex = valueArr.indexOf(frameIndex);
                d[dim] = _this.getDodgeOffset(range, valIndex, valueArr.length);
            });
        });
        return [];
    };
    Dodge.prototype.getDodgeOffset = function (range, idx, len) {
        var _a = this, dodgeRatio = _a.dodgeRatio, marginRatio = _a.marginRatio;
        var pre = range.pre, next = range.next;
        var tickLength = next - pre;
        var width = (tickLength * dodgeRatio) / len;
        var margin = marginRatio * width;
        var offset = (1 / 2) * (tickLength - len * width - (len - 1) * margin) +
            ((idx + 1) * width + idx * margin) -
            (1 / 2) * width -
            (1 / 2) * tickLength;
        return (pre + next) / 2 + offset;
    };
    Dodge.prototype.getDistribution = function (dim) {
        var groupedDataArray = this.adjustDataArray;
        var cacheMap = this.cacheMap;
        var map = cacheMap[dim];
        if (!map) {
            map = {};
            _.each(groupedDataArray, function (data, index) {
                var values = _.valuesOfKey(data, dim);
                if (!values.length) {
                    values.push(0);
                }
                _.each(values, function (val) {
                    if (!map[val]) {
                        map[val] = [];
                    }
                    map[val].push(index);
                });
            });
            cacheMap[dim] = map;
        }
        return map;
    };
    return Dodge;
}(adjust_1.default));
exports.default = Dodge;

},{"../constant":7,"./adjust":2,"@antv/util":803,"tslib":894}],4:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _ = require("@antv/util");
var constant_1 = require("../constant");
var adjust_1 = require("./adjust");
function randomNumber(min, max) {
    return (max - min) * Math.random() + min;
}
var Jitter = /** @class */ (function (_super) {
    tslib_1.__extends(Jitter, _super);
    function Jitter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Jitter.prototype.process = function (groupDataArray) {
        var groupedDataArray = _.clone(groupDataArray);
        // 之前分组之后的数据，然后有合并回去（和分组前可以理解成是一样的）
        var mergeData = _.flatten(groupedDataArray);
        // 返回值
        this.adjustData(groupedDataArray, mergeData);
        return groupedDataArray;
    };
    /**
     * 当前数据分组（index）中，按照维度 dim 进行 jitter 调整
     * @param dim
     * @param values
     * @param dataArray
     */
    Jitter.prototype.adjustDim = function (dim, values, dataArray) {
        var _this = this;
        // 在每一个分组中，将数据再按照 dim 分组，用于散列
        var groupDataArray = this.groupData(dataArray, dim);
        return _.each(groupDataArray, function (data, dimValue) {
            return _this.adjustGroup(data, dim, parseFloat(dimValue), values);
        });
    };
    // 随机出来的字段值
    Jitter.prototype.getAdjustOffset = function (range) {
        var pre = range.pre, next = range.next;
        // 随机的范围
        var margin = (next - pre) * constant_1.GAP;
        return randomNumber(pre + margin, next - margin);
    };
    // adjust group data
    Jitter.prototype.adjustGroup = function (group, dim, dimValue, values) {
        var _this = this;
        // 调整范围
        var range = this.getAdjustRange(dim, dimValue, values);
        _.each(group, function (data) {
            data[dim] = _this.getAdjustOffset(range); // 获取调整的位置
        });
        return group;
    };
    return Jitter;
}(adjust_1.default));
exports.default = Jitter;

},{"../constant":7,"./adjust":2,"@antv/util":803,"tslib":894}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _ = require("@antv/util");
var adjust_1 = require("./adjust");
var Cache = _.Cache;
var Stack = /** @class */ (function (_super) {
    tslib_1.__extends(Stack, _super);
    function Stack(cfg) {
        var _this = _super.call(this, cfg) || this;
        var _a = cfg.adjustNames, adjustNames = _a === void 0 ? ['y'] : _a, _b = cfg.height, height = _b === void 0 ? NaN : _b, _c = cfg.size, size = _c === void 0 ? 10 : _c, _d = cfg.reverseOrder, reverseOrder = _d === void 0 ? false : _d;
        _this.adjustNames = adjustNames;
        _this.height = height;
        _this.size = size;
        _this.reverseOrder = reverseOrder;
        return _this;
    }
    /**
     * 方法入参是经过数据分组、数据数字化之后的二维数组
     * @param groupDataArray 分组之后的数据
     */
    Stack.prototype.process = function (groupDataArray) {
        var _a = this, yField = _a.yField, reverseOrder = _a.reverseOrder;
        // 如果有指定 y 字段，那么按照 y 字段来 stack
        // 否则，按照高度均分
        var d = yField ? this.processStack(groupDataArray) : this.processOneDimStack(groupDataArray);
        return reverseOrder ? this.reverse(d) : d;
    };
    Stack.prototype.reverse = function (groupedDataArray) {
        return groupedDataArray.slice(0).reverse();
    };
    Stack.prototype.processStack = function (groupDataArray) {
        var _a = this, xField = _a.xField, yField = _a.yField, reverseOrder = _a.reverseOrder;
        // 层叠顺序翻转
        var groupedDataArray = reverseOrder ? this.reverse(groupDataArray) : groupDataArray;
        // 用来缓存，正数和负数的堆叠问题
        var positive = new Cache();
        var negative = new Cache();
        return groupedDataArray.map(function (dataArray) {
            return dataArray.map(function (data) {
                var _a;
                var x = _.get(data, xField, 0);
                var y = _.get(data, yField);
                var xKey = x.toString();
                // todo 是否应该取 _origin？因为 y 可能取到的值不正确，比如先 symmetric，再 stack！
                y = _.isArray(y) ? y[1] : y;
                if (!_.isNil(y)) {
                    var cache = y >= 0 ? positive : negative;
                    if (!cache.has(xKey)) {
                        cache.set(xKey, 0);
                    }
                    var xValue = cache.get(xKey);
                    var newXValue = y + xValue;
                    // 存起来
                    cache.set(xKey, newXValue);
                    return tslib_1.__assign(tslib_1.__assign({}, data), (_a = {}, _a[yField] = [xValue, newXValue], _a));
                }
                // 没有修改，则直接返回
                return data;
            });
        });
    };
    Stack.prototype.processOneDimStack = function (groupDataArray) {
        var _this = this;
        var _a = this, xField = _a.xField, height = _a.height, reverseOrder = _a.reverseOrder;
        var yField = 'y';
        // 如果层叠的顺序翻转
        var groupedDataArray = reverseOrder ? this.reverse(groupDataArray) : groupDataArray;
        // 缓存累加数据
        var cache = new Cache();
        return groupedDataArray.map(function (dataArray) {
            return dataArray.map(function (data) {
                var _a;
                var size = _this.size;
                var xValue = data[xField];
                // todo 没有看到这个 stack 计算原理
                var stackHeight = (size * 2) / height;
                if (!cache.has(xValue)) {
                    cache.set(xValue, stackHeight / 2); // 初始值大小
                }
                var stackValue = cache.get(xValue);
                // 增加一层 stackHeight
                cache.set(xValue, stackValue + stackHeight);
                return tslib_1.__assign(tslib_1.__assign({}, data), (_a = {}, _a[yField] = stackValue, _a));
            });
        });
    };
    return Stack;
}(adjust_1.default));
exports.default = Stack;

},{"./adjust":2,"@antv/util":803,"tslib":894}],6:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _ = require("@antv/util");
var adjust_1 = require("./adjust");
var Symmetric = /** @class */ (function (_super) {
    tslib_1.__extends(Symmetric, _super);
    function Symmetric() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Symmetric.prototype.process = function (groupDataArray) {
        var mergeData = _.flatten(groupDataArray);
        var _a = this, xField = _a.xField, yField = _a.yField;
        // 每个 x 值对应的 最大值
        var cache = this.getXValuesMaxMap(mergeData);
        // 所有数据的最大的值
        var max = Math.max.apply(Math, Object.keys(cache).map(function (key) { return cache[key]; }));
        return _.map(groupDataArray, function (dataArray) {
            return _.map(dataArray, function (data) {
                var _a, _b;
                var yValue = data[yField];
                var xValue = data[xField];
                // 数组处理逻辑
                if (_.isArray(yValue)) {
                    var off_1 = (max - cache[xValue]) / 2;
                    return tslib_1.__assign(tslib_1.__assign({}, data), (_a = {}, _a[yField] = _.map(yValue, function (y) { return off_1 + y; }), _a));
                }
                // 非数组处理逻辑
                var offset = (max - yValue) / 2;
                return tslib_1.__assign(tslib_1.__assign({}, data), (_b = {}, _b[yField] = [offset, yValue + offset], _b));
            });
        });
    };
    // 获取每个 x 对应的最大的值
    Symmetric.prototype.getXValuesMaxMap = function (mergeData) {
        var _this = this;
        var _a = this, xField = _a.xField, yField = _a.yField;
        // 根据 xField 的值进行分组
        var groupDataArray = _.groupBy(mergeData, function (data) { return data[xField]; });
        // 获取每个 xField 值中的最大值
        return _.mapValues(groupDataArray, function (dataArray) { return _this.getDimMaxValue(dataArray, yField); });
    };
    Symmetric.prototype.getDimMaxValue = function (mergeData, dim) {
        // 所有的 value 值
        var dimValues = _.map(mergeData, function (data) { return _.get(data, dim, []); });
        // 将数组打平（dim value 有可能是数组，比如 stack 之后的）
        var flattenValues = _.flatten(dimValues);
        // 求出数组的最大值
        return Math.max.apply(Math, flattenValues);
    };
    return Symmetric;
}(adjust_1.default));
exports.default = Symmetric;

},{"./adjust":2,"@antv/util":803,"tslib":894}],7:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_Y = 0; // 默认的 y 的值
// 偏移之后，间距
exports.MARGIN_RATIO = 1 / 2;
exports.DODGE_RATIO = 1 / 2;
// 散点分开之后，距离边界的距离
exports.GAP = 0.05;

},{}],8:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var adjust_1 = require("./adjusts/adjust");
exports.Adjust = adjust_1.default;
var ADJUST_MAP = {};
/**
 * 根据类型获取 Adjust 类
 * @param type
 */
var getAdjust = function (type) {
    return ADJUST_MAP[type.toLowerCase()];
};
exports.getAdjust = getAdjust;
/**
 * 注册自定义 Adjust
 * @param type
 * @param ctor
 */
var registerAdjust = function (type, ctor) {
    // 注册的时候，需要校验 type 重名，不区分大小写
    if (getAdjust(type)) {
        throw new Error("Adjust type '" + type + "' existed.");
    }
    // 存储到 map 中
    ADJUST_MAP[type.toLowerCase()] = ctor;
};
exports.registerAdjust = registerAdjust;

},{"./adjusts/adjust":2}],9:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var factory_1 = require("./factory");
exports.getAdjust = factory_1.getAdjust;
exports.registerAdjust = factory_1.registerAdjust;
var adjust_1 = require("./adjusts/adjust");
exports.Adjust = adjust_1.default;
var dodge_1 = require("./adjusts/dodge");
var jitter_1 = require("./adjusts/jitter");
var stack_1 = require("./adjusts/stack");
var symmetric_1 = require("./adjusts/symmetric");
// 注册内置的 adjust
factory_1.registerAdjust('Dodge', dodge_1.default);
factory_1.registerAdjust('Jitter', jitter_1.default);
factory_1.registerAdjust('Stack', stack_1.default);
factory_1.registerAdjust('Symmetric', symmetric_1.default);

},{"./adjusts/adjust":2,"./adjusts/dodge":3,"./adjusts/jitter":4,"./adjusts/stack":5,"./adjusts/symmetric":6,"./factory":8}],10:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
// todo 这个到底目的是什么？
var toScaleString = function (scale, value) {
    if (util_1.isString(value)) {
        return value;
    }
    return scale.invert(scale.scale(value));
};
/**
 * 所有视觉通道属性的基类
 * @class Base
 */
var Attribute = /** @class */ (function () {
    function Attribute(cfg) {
        this.names = [];
        this.scales = [];
        this.linear = false;
        this.values = [];
        this.callback = function () { return []; };
        // 解析配置
        this._parseCfg(cfg);
    }
    /**
     * 映射的值组成的数组
     * @param params 对应 scale 顺序的值传入
     */
    Attribute.prototype.mapping = function () {
        var _this = this;
        var params = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            params[_i] = arguments[_i];
        }
        var values = params.map(function (param, idx) {
            return _this._toOriginParam(param, _this.scales[idx]);
        });
        return this.callback.apply(this, values);
    };
    /**
     * 如果进行线性映射，返回对应的映射值
     * @param percent
     */
    Attribute.prototype.getLinearValue = function (percent) {
        // 分段数量
        var steps = this.values.length - 1;
        var step = Math.floor(steps * percent);
        var leftPercent = steps * percent - step;
        // todo 不懂这个逻辑
        var start = this.values[step];
        var end = step === steps ? start : this.values[step + 1];
        // 线性方程
        return start + (end - start) * leftPercent;
    };
    /**
     * 根据度量获取属性名
     */
    Attribute.prototype.getNames = function () {
        var scales = this.scales;
        var names = this.names;
        var length = Math.min(scales.length, names.length);
        var rst = [];
        for (var i = 0; i < length; i += 1) {
            rst.push(names[i]);
        }
        return rst;
    };
    /**
     * 获取所有的维度名
     */
    Attribute.prototype.getFields = function () {
        return this.scales.map(function (scale) { return scale.field; });
    };
    /**
     * 根据名称获取度量
     * @param name
     */
    Attribute.prototype.getScale = function (name) {
        return this.scales[this.names.indexOf(name)];
    };
    /**
     * 默认的回调函数（用户没有自定义 callback，或者用户自定义 callback 返回空的时候，使用 values 映射）
     * @param params
     */
    Attribute.prototype.defaultCallback = function () {
        var _this = this;
        var params = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            params[_i] = arguments[_i];
        }
        // 没有 params 的情况，是指没有指定 fields，直接返回配置的 values 常量
        if (params.length === 0) {
            return this.values;
        }
        return params.map(function (param, idx) {
            var scale = _this.scales[idx];
            return scale.type === 'identity' ? scale.values[0] : _this._getAttributeValue(scale, param);
        });
    };
    // 解析配置
    Attribute.prototype._parseCfg = function (cfg) {
        var _this = this;
        var _a = cfg.type, type = _a === void 0 ? 'base' : _a, _b = cfg.names, names = _b === void 0 ? [] : _b, _c = cfg.scales, scales = _c === void 0 ? [] : _c, _d = cfg.values, values = _d === void 0 ? [] : _d, callback = cfg.callback;
        this.type = type;
        this.scales = scales;
        this.values = values;
        this.names = names;
        // 构造 callback 方法
        this.callback = function () {
            var params = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                params[_i] = arguments[_i];
            }
            /**
             * 当用户设置的 callback 返回 null 时, 应该返回默认 callback 中的值
             */
            if (callback) {
                // 使用用户返回的值处理
                var ret = callback.apply(void 0, params);
                if (!util_1.isNil(ret)) {
                    return [ret];
                }
            }
            // 没有 callback 或者用户 callback 返回值为空，则使用默认的逻辑处理
            return _this.defaultCallback.apply(_this, params);
        };
    };
    // 获取属性值，将值映射到视觉通道
    Attribute.prototype._getAttributeValue = function (scale, value) {
        // 如果是非线性的字段，直接从 values 中取值即可
        if (scale.isCategory && !this.linear) {
            // 离散 scale 变换成索引
            var idx = scale.translate(value);
            return this.values[idx % this.values.length];
        }
        // 线性则使用线性值
        var percent = scale.scale(value);
        return this.getLinearValue(percent);
    };
    /**
     * 通过 scale 拿到数据对应的原始的参数
     * @param param
     * @param scale
     * @private
     */
    Attribute.prototype._toOriginParam = function (param, scale) {
        // 是线性，直接返回
        // 非线性，使用 scale 变换
        return !scale.isLinear
            ? util_1.isArray(param)
                ? param.map(function (p) { return toScaleString(scale, p); })
                : toScaleString(scale, param)
            : param;
    };
    return Attribute;
}());
exports.default = Attribute;

},{"@antv/util":803}],11:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var color_util_1 = require("@antv/color-util");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var Color = /** @class */ (function (_super) {
    tslib_1.__extends(Color, _super);
    function Color(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'color';
        _this.names = ['color'];
        if (util_1.isString(_this.values)) {
            _this.linear = true;
        }
        _this.gradient = color_util_1.default.gradient(_this.values);
        return _this;
    }
    /**
     * @override
     */
    Color.prototype.getLinearValue = function (percent) {
        return this.gradient(percent);
    };
    return Color;
}(base_1.default));
exports.default = Color;

},{"./base":10,"@antv/color-util":19,"@antv/util":803,"tslib":894}],12:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var Opacity = /** @class */ (function (_super) {
    tslib_1.__extends(Opacity, _super);
    function Opacity(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'opacity';
        _this.names = ['opacity'];
        return _this;
    }
    return Opacity;
}(base_1.default));
exports.default = Opacity;

},{"./base":10,"tslib":894}],13:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var Position = /** @class */ (function (_super) {
    tslib_1.__extends(Position, _super);
    function Position(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.names = ['x', 'y'];
        _this.type = 'position';
        return _this;
    }
    Position.prototype.mapping = function (x, y) {
        var _a = this.scales, scaleX = _a[0], scaleY = _a[1];
        if (util_1.isNil(x) || util_1.isNil(y)) {
            return [];
        }
        return [
            util_1.isArray(x) ? x.map(function (xi) { return scaleX.scale(xi); }) : scaleX.scale(x),
            util_1.isArray(y) ? y.map(function (yi) { return scaleY.scale(yi); }) : scaleY.scale(y),
        ];
    };
    return Position;
}(base_1.default));
exports.default = Position;

},{"./base":10,"@antv/util":803,"tslib":894}],14:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var Shape = /** @class */ (function (_super) {
    tslib_1.__extends(Shape, _super);
    function Shape(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'shape';
        _this.names = ['shape'];
        return _this;
    }
    /**
     * @override
     */
    Shape.prototype.getLinearValue = function (percent) {
        var idx = Math.round((this.values.length - 1) * percent);
        return this.values[idx];
    };
    return Shape;
}(base_1.default));
exports.default = Shape;

},{"./base":10,"tslib":894}],15:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var Size = /** @class */ (function (_super) {
    tslib_1.__extends(Size, _super);
    function Size(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'size';
        _this.names = ['size'];
        return _this;
    }
    return Size;
}(base_1.default));
exports.default = Size;

},{"./base":10,"tslib":894}],16:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./attributes/base");
exports.Attribute = base_1.default;
// 所有的 attribute map
var ATTRIBUTE_MAP = {};
/**
 * 通过类型获得 Attribute 类
 * @param type
 */
var getAttribute = function (type) {
    return ATTRIBUTE_MAP[type.toLowerCase()];
};
exports.getAttribute = getAttribute;
var registerAttribute = function (type, ctor) {
    // 注册的时候，需要校验 type 重名，不区分大小写
    if (getAttribute(type)) {
        throw new Error("Attribute type '" + type + "' existed.");
    }
    // 存储到 map 中
    ATTRIBUTE_MAP[type.toLowerCase()] = ctor;
};
exports.registerAttribute = registerAttribute;
tslib_1.__exportStar(require("./interface"), exports);

},{"./attributes/base":10,"./interface":18,"tslib":894}],17:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./attributes/base");
exports.Attribute = base_1.default;
var color_1 = require("./attributes/color");
exports.Color = color_1.default;
var opacity_1 = require("./attributes/opacity");
exports.Opacity = opacity_1.default;
var position_1 = require("./attributes/position");
exports.Position = position_1.default;
var shape_1 = require("./attributes/shape");
exports.Shape = shape_1.default;
var size_1 = require("./attributes/size");
exports.Size = size_1.default;
var factory_1 = require("./factory");
exports.getAttribute = factory_1.getAttribute;
exports.registerAttribute = factory_1.registerAttribute;
factory_1.registerAttribute('Color', color_1.default);
factory_1.registerAttribute('Opacity', opacity_1.default);
factory_1.registerAttribute('Position', position_1.default);
factory_1.registerAttribute('Shape', shape_1.default);
factory_1.registerAttribute('Size', size_1.default);
tslib_1.__exportStar(require("./interface"), exports);

},{"./attributes/base":10,"./attributes/color":11,"./attributes/opacity":12,"./attributes/position":13,"./attributes/shape":14,"./attributes/size":15,"./factory":16,"./interface":18,"tslib":894}],18:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var scale_1 = require("@antv/scale");
exports.Scale = scale_1.Scale;

},{"@antv/scale":747}],19:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
var isGradientColor = function (val) { return /^[r,R,L,l]{1}[\s]*\(/.test(val); };
// 创建辅助 tag 取颜色
var createTmp = function () {
    var i = document.createElement('i');
    i.title = 'Web Colour Picker';
    i.style.display = 'none';
    document.body.appendChild(i);
    return i;
};
// 获取颜色之间的插值
var getValue = function (start, end, percent, index) {
    return start[index] + (end[index] - start[index]) * percent;
};
// 数组转换成颜色
function arr2rgb(arr) {
    return "#" + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
}
// rgb 颜色转换成数组
var rgb2arr = function (str) {
    return [
        parseInt(str.substr(1, 2), 16),
        parseInt(str.substr(3, 2), 16),
        parseInt(str.substr(5, 2), 16),
    ];
};
// 将数值从 0-255 转换成16进制字符串
var toHex = function (value) {
    var x16Value = Math.round(value).toString(16);
    return x16Value.length === 1 ? "0" + x16Value : x16Value;
};
// 计算颜色
var calColor = function (points, percent) {
    var fixedPercent = isNaN(Number(percent)) || percent < 0 ? 0 :
        percent > 1 ? 1 :
            Number(percent);
    var steps = points.length - 1;
    var step = Math.floor(steps * fixedPercent);
    var left = steps * fixedPercent - step;
    var start = points[step];
    var end = step === steps ? start : points[step + 1];
    return arr2rgb([
        getValue(start, end, left, 0),
        getValue(start, end, left, 1),
        getValue(start, end, left, 2),
    ]);
};
// 用于给 toRGB 的缓存（使用 memoize 方法替换）
// const colorCache = {};
var iEl;
/**
 * 将颜色转换到 rgb 的格式
 * @param {color} color 颜色
 * @return 将颜色转换到 '#ffffff' 的格式
 */
var toRGB = function (color) {
    // 如果已经是 rgb的格式
    if (color[0] === '#' && color.length === 7) {
        return color;
    }
    if (!iEl) {
        // 防止防止在页头报错
        iEl = createTmp();
    }
    iEl.style.color = color;
    var rst = document.defaultView.getComputedStyle(iEl, '').getPropertyValue('color');
    var matches = RGB_REG.exec(rst);
    var cArray = matches[1].split(/\s*,\s*/).map(function (s) { return Number(s); });
    rst = arr2rgb(cArray);
    return rst;
};
/**
 * 获取渐变函数
 * @param colors 多个颜色
 * @return 颜色值
 */
var gradient = function (colors) {
    var colorArray = util_1.isString(colors) ? colors.split('-') : colors;
    var points = util_1.map(colorArray, function (color) {
        return rgb2arr(color.indexOf('#') === -1 ? toRGB(color) : color);
    });
    // 返回一个函数
    return function (percent) {
        return calColor(points, percent);
    };
};
var toCSSGradient = function (gradientColor) {
    if (isGradientColor(gradientColor)) {
        var cssColor_1;
        var steps = void 0;
        if (gradientColor[0] === 'l') {
            // 线性渐变
            var arr = regexLG.exec(gradientColor);
            var angle = +arr[1] + 90; // css 和 g 的渐变起始角度不同
            steps = arr[2];
            cssColor_1 = "linear-gradient(" + angle + "deg, ";
        }
        else if (gradientColor[0] === 'r') {
            // 径向渐变
            cssColor_1 = 'radial-gradient(';
            var arr = regexRG.exec(gradientColor);
            steps = arr[4];
        }
        var colorStops_1 = steps.match(regexColorStop);
        util_1.each(colorStops_1, function (item, index) {
            var itemArr = item.split(':');
            cssColor_1 += itemArr[1] + " " + itemArr[0] * 100 + "%";
            if (index !== (colorStops_1.length - 1)) {
                cssColor_1 += ', ';
            }
        });
        cssColor_1 += ')';
        return cssColor_1;
    }
    return gradientColor;
};
exports.default = {
    rgb2arr: rgb2arr,
    gradient: gradient,
    toRGB: util_1.memoize(toRGB),
    toCSSGradient: toCSSGradient,
};

},{"@antv/util":803}],20:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var util_1 = require("@antv/util");
var LOCATION_FIELD_MAP = {
    none: [],
    point: ['x', 'y'],
    region: ['start', 'end'],
    points: ['points'],
    circle: ['center', 'radius', 'startAngle', 'endAngle'],
};
var Component = /** @class */ (function (_super) {
    tslib_1.__extends(Component, _super);
    function Component(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.initCfg();
        return _this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    Component.prototype.getDefaultCfg = function () {
        return {
            id: '',
            name: '',
            type: '',
            locationType: 'none',
            offsetX: 0,
            offsetY: 0,
            animate: false,
            capture: true,
            updateAutoRender: false,
            animateOption: {
                appear: null,
                update: {
                    duration: 400,
                    easing: 'easeQuadInOut',
                },
                enter: {
                    duration: 400,
                    easing: 'easeQuadInOut',
                },
                leave: {
                    duration: 350,
                    easing: 'easeQuadIn',
                },
            },
            events: null,
            defaultCfg: {},
            visible: true,
        };
    };
    /**
     * 清理组件的内容，一般配合 render 使用
     * @example
     * axis.clear();
     * axis.render();
     */
    Component.prototype.clear = function () { };
    /**
     * 更新组件
     * @param {object} cfg 更新属性
     */
    Component.prototype.update = function (cfg) {
        var _this = this;
        var defaultCfg = this.get('defaultCfg');
        util_1.each(cfg, function (value, name) {
            var originCfg = _this.get(name);
            var newCfg = value;
            if (originCfg !== value) {
                // 判断两者是否相等，主要是进行 null 的判定
                if (util_1.isObject(value) && defaultCfg[name]) {
                    // 新设置的属性与默认值进行合并
                    newCfg = util_1.deepMix({}, defaultCfg[name], value);
                }
                _this.set(name, newCfg);
            }
        });
        this.updateInner(cfg);
        this.afterUpdate(cfg);
    };
    // 更新内部
    Component.prototype.updateInner = function (cfg) {
    };
    Component.prototype.afterUpdate = function (cfg) {
        // 更新时考虑显示、隐藏
        if (util_1.hasKey(cfg, 'visible')) {
            if (cfg.visible) {
                this.show();
            }
            else {
                this.hide();
            }
        }
        // 更新时考虑capture
        if (util_1.hasKey(cfg, 'capture')) {
            this.setCapture(cfg.capture);
        }
    };
    Component.prototype.getLayoutBBox = function () {
        return this.getBBox(); // 默认返回 getBBox，不同的组件内部单独实现
    };
    Component.prototype.getLocationType = function () {
        return this.get('locationType');
    };
    Component.prototype.getOffset = function () {
        return {
            offsetX: this.get('offsetX'),
            offsetY: this.get('offsetY'),
        };
    };
    // 默认使用 update
    Component.prototype.setOffset = function (offsetX, offsetY) {
        this.update({
            offsetX: offsetX,
            offsetY: offsetY,
        });
    };
    Component.prototype.setLocation = function (cfg) {
        var location = tslib_1.__assign({}, cfg);
        this.update(location);
    };
    // 实现 ILocation 接口的 getLocation
    Component.prototype.getLocation = function () {
        var _this = this;
        var location = {};
        var locationType = this.get('locationType');
        var fields = LOCATION_FIELD_MAP[locationType];
        util_1.each(fields, function (field) {
            location[field] = _this.get(field);
        });
        return location;
    };
    Component.prototype.isList = function () {
        return false;
    };
    Component.prototype.isSlider = function () {
        return false;
    };
    /**
     * @protected
     * 初始化，用于具体的组件继承
     */
    Component.prototype.init = function () { };
    // 将组件默认的配置项设置合并到传入的配置项
    Component.prototype.initCfg = function () {
        var _this = this;
        var defaultCfg = this.get('defaultCfg');
        util_1.each(defaultCfg, function (value, name) {
            var cfg = _this.get(name);
            if (util_1.isObject(cfg)) {
                var newCfg = util_1.deepMix({}, value, cfg);
                _this.set(name, newCfg);
            }
        });
    };
    return Component;
}(g_base_1.Base));
exports.default = Component;

},{"@antv/g-base":115,"@antv/util":803,"tslib":894}],21:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var event_1 = require("../util/event");
var matrix_1 = require("../util/matrix");
var util_2 = require("../util/util");
var component_1 = require("./component");
var STATUS_UPDATE = 'update_status';
var COPY_PROPERTIES = ['visible', 'tip', 'delegateObject']; // 更新对象时需要复制的属性
var COPY_PROPERTIES_EXCLUDES = ['container', 'group', 'shapesMap', 'isRegister', 'isUpdating', 'destroyed']; // 更新子组件时排除的属性
var GroupComponent = /** @class */ (function (_super) {
    tslib_1.__extends(GroupComponent, _super);
    function GroupComponent() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupComponent.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { container: null, 
            /**
             * @private
             * 缓存图形的 Map
             */
            shapesMap: {}, group: null, capture: true, 
            /**
             * @private 组件或者图形是否允许注册
             * @type {false}
             */
            isRegister: false, 
            /**
             * @private 是否正在更新
             * @type {false}
             */
            isUpdating: false, 
            /**
             * @private
             * 是否初始状态，一旦 render，update 后，这个状态就变成 false, clear 后恢复
             */
            isInit: true });
    };
    GroupComponent.prototype.remove = function () {
        this.clear();
        var group = this.get('group');
        group.remove();
    };
    GroupComponent.prototype.clear = function () {
        var group = this.get('group');
        group.clear();
        this.set('shapesMap', {});
        this.clearOffScreenCache();
        this.set('isInit', true);
    };
    GroupComponent.prototype.getChildComponentById = function (id) {
        var group = this.getElementById(id);
        var inst = group && group.get('component');
        return inst;
    };
    GroupComponent.prototype.getElementById = function (id) {
        return this.get('shapesMap')[id];
    };
    GroupComponent.prototype.getElementByLocalId = function (localId) {
        var id = this.getElementId(localId);
        return this.getElementById(id);
    };
    GroupComponent.prototype.getElementsByName = function (name) {
        var rst = [];
        util_1.each(this.get('shapesMap'), function (elem) {
            if (elem.get('name') === name) {
                rst.push(elem);
            }
        });
        return rst;
    };
    GroupComponent.prototype.getContainer = function () {
        return this.get('container');
    };
    GroupComponent.prototype.updateInner = function (cfg) {
        // this.updateInner();
        // this.set('isUpdating', false);
        this.offScreenRender();
        if (this.get('updateAutoRender')) {
            this.render();
        }
    };
    GroupComponent.prototype.render = function () {
        var offScreenGroup = this.get('offScreenGroup');
        if (!offScreenGroup) {
            offScreenGroup = this.offScreenRender();
        }
        var group = this.get('group');
        this.updateElements(offScreenGroup, group);
        this.deleteElements();
        this.applyOffset();
        if (!this.get('eventInitted')) {
            this.initEvent();
            this.set('eventInitted', true);
        }
        this.set('isInit', false);
    };
    GroupComponent.prototype.show = function () {
        var group = this.get('group');
        group.show();
        this.set('visible', true);
    };
    GroupComponent.prototype.hide = function () {
        var group = this.get('group');
        group.hide();
        this.set('visible', false);
    };
    GroupComponent.prototype.setCapture = function (capture) {
        var group = this.get('group');
        group.set('capture', capture);
        this.set('capture', capture);
    };
    GroupComponent.prototype.destroy = function () {
        this.removeEvent();
        this.remove();
        _super.prototype.destroy.call(this);
    };
    GroupComponent.prototype.getBBox = function () {
        return this.get('group').getCanvasBBox();
    };
    GroupComponent.prototype.getLayoutBBox = function () {
        var group = this.get('group');
        // 防止被 clear 了，offScreenBBox 不存在
        var bbox = this.getInnerLayoutBBox();
        var matrix = group.getTotalMatrix();
        if (matrix) {
            bbox = matrix_1.applyMatrix2BBox(matrix, bbox);
        }
        return bbox; // 默认返回 getBBox，不同的组件内部单独实现
    };
    // 复写 on, off, emit 透传到 group
    GroupComponent.prototype.on = function (evt, callback, once) {
        var group = this.get('group');
        group.on(evt, callback, once);
        return this;
    };
    GroupComponent.prototype.off = function (evt, callback) {
        var group = this.get('group');
        group && group.off(evt, callback);
        return this;
    };
    GroupComponent.prototype.emit = function (eventName, eventObject) {
        var group = this.get('group');
        group.emit(eventName, eventObject);
    };
    GroupComponent.prototype.init = function () {
        _super.prototype.init.call(this);
        if (!this.get('group')) {
            this.initGroup();
        }
        this.offScreenRender(); // 绘制离屏 group
    };
    // 获取组件内部布局占的包围盒
    GroupComponent.prototype.getInnerLayoutBBox = function () {
        return this.get('offScreenBBox') || this.get('group').getBBox();
    };
    // 抛出委托对象
    GroupComponent.prototype.delegateEmit = function (eventName, eventObject) {
        var group = this.get('group');
        eventObject.target = group;
        group.emit(eventName, eventObject);
        event_1.propagationDelegate(group, eventName, eventObject);
    };
    // 创建离屏的 group ,不添加在 canvas 中
    GroupComponent.prototype.createOffScreenGroup = function () {
        var group = this.get('group');
        var GroupClass = group.getGroupBase(); // 获取分组的构造函数
        var newGroup = new GroupClass({
            delegateObject: this.getDelegateObject(),
        });
        return newGroup;
    };
    // 应用 offset
    GroupComponent.prototype.applyOffset = function () {
        var offsetX = this.get('offsetX');
        var offsetY = this.get('offsetY');
        this.moveElementTo(this.get('group'), {
            x: offsetX,
            y: offsetY,
        });
    };
    GroupComponent.prototype.initGroup = function () {
        var container = this.get('container');
        this.set('group', container.addGroup({
            id: this.get('id'),
            name: this.get('name'),
            capture: this.get('capture'),
            visible: this.get('visible'),
            isComponent: true,
            component: this,
            delegateObject: this.getDelegateObject(),
        }));
    };
    // 离屏渲染
    GroupComponent.prototype.offScreenRender = function () {
        this.clearOffScreenCache();
        var offScreenGroup = this.createOffScreenGroup();
        this.renderInner(offScreenGroup);
        this.set('offScreenGroup', offScreenGroup);
        // 包含包围盒的 bbox
        this.set('offScreenBBox', util_2.getBBoxWithClip(offScreenGroup));
        return offScreenGroup;
    };
    /**
     * @protected
     * 在组件上添加分组，主要解决 isReigeter 的问题
     * @param {IGroup} parent 父元素
     * @param {object} cfg    分组的配置项
     */
    GroupComponent.prototype.addGroup = function (parent, cfg) {
        this.appendDelegateObject(parent, cfg);
        var group = parent.addGroup(cfg);
        if (this.get('isRegister')) {
            this.registerElement(group);
        }
        return group;
    };
    /**
     * @protected
     * 在组件上添加图形，主要解决 isReigeter 的问题
     * @param {IGroup} parent 父元素
     * @param {object} cfg    分组的配置项
     */
    GroupComponent.prototype.addShape = function (parent, cfg) {
        this.appendDelegateObject(parent, cfg);
        var shape = parent.addShape(cfg);
        if (this.get('isRegister')) {
            this.registerElement(shape);
        }
        return shape;
    };
    /**
     * 在组件上添加子组件
     *
     * @param parent 父元素
     * @param cfg 子组件配置项
     */
    GroupComponent.prototype.addComponent = function (parent, cfg) {
        var id = cfg.id, Ctor = cfg.component, restCfg = tslib_1.__rest(cfg, ["id", "component"]);
        // @ts-ignore
        var inst = new Ctor(tslib_1.__assign(tslib_1.__assign({}, restCfg), { id: id, container: parent, updateAutoRender: this.get('updateAutoRender') }));
        inst.init();
        inst.render();
        if (this.get('isRegister')) {
            this.registerElement(inst.get('group'));
        }
        return inst;
    };
    GroupComponent.prototype.initEvent = function () { };
    GroupComponent.prototype.removeEvent = function () {
        var group = this.get('group');
        group.off();
    };
    GroupComponent.prototype.getElementId = function (localId) {
        var id = this.get('id'); // 组件的 Id
        var name = this.get('name'); // 组件的名称
        return id + "-" + name + "-" + localId;
    };
    GroupComponent.prototype.registerElement = function (element) {
        var id = element.get('id');
        this.get('shapesMap')[id] = element;
    };
    GroupComponent.prototype.unregisterElement = function (element) {
        var id = element.get('id');
        delete this.get('shapesMap')[id];
    };
    // 移动元素
    GroupComponent.prototype.moveElementTo = function (element, point) {
        var matrix = matrix_1.getMatrixByTranslate(point);
        element.attr('matrix', matrix);
    };
    /**
     * 图形元素新出现时的动画，默认图形从透明度 0 到当前透明度
     * @protected
     * @param {string} elmentName 图形元素名称
     * @param {IElement} newElement  新的图形元素
     * @param {object} animateCfg 动画的配置项
     */
    GroupComponent.prototype.addAnimation = function (elmentName, newElement, animateCfg) {
        // 缓存透明度
        var originOpacity = newElement.attr('opacity');
        if (util_1.isNil(originOpacity)) {
            originOpacity = 1;
        }
        newElement.attr('opacity', 0);
        newElement.animate({ opacity: originOpacity }, animateCfg);
    };
    /**
     * 图形元素新出现时的动画，默认图形从透明度 0 到当前透明度
     * @protected
     * @param {string} elmentName 图形元素名称
     * @param {IElement} originElement 要删除的图形元素
     * @param {object} animateCfg 动画的配置项
     */
    GroupComponent.prototype.removeAnimation = function (elementName, originElement, animateCfg) {
        originElement.animate({ opacity: 0 }, animateCfg);
    };
    /**
     * 图形元素的更新动画
     * @param {string} elmentName 图形元素名称
     * @param {IElement} originElement 现有的图形元素
     * @param {object} newAttrs  新的图形元素
     * @param {object} animateCfg 动画的配置项
     */
    GroupComponent.prototype.updateAnimation = function (elementName, originElement, newAttrs, animateCfg) {
        originElement.animate(newAttrs, animateCfg);
    };
    // 更新组件的图形
    GroupComponent.prototype.updateElements = function (newGroup, originGroup) {
        var _this = this;
        var animate = this.get('animate');
        var animateOption = this.get('animateOption');
        var children = newGroup.getChildren().slice(0); // 创建一个新数组，防止添加到 originGroup 时， children 变动
        var preElement; // 前面已经匹配到的图形元素，用于
        util_1.each(children, function (element) {
            var elementId = element.get('id');
            var originElement = _this.getElementById(elementId);
            var elementName = element.get('name');
            if (originElement) {
                if (element.get('isComponent')) {
                    // 嵌套子组件更新
                    var childComponent = element.get('component');
                    var origChildComponent = originElement.get('component');
                    var newCfg = util_1.pick(childComponent.cfg, util_1.difference(util_1.keys(childComponent.cfg), COPY_PROPERTIES_EXCLUDES));
                    origChildComponent.update(newCfg);
                    originElement.set(STATUS_UPDATE, 'update');
                }
                else {
                    var replaceAttrs = _this.getReplaceAttrs(originElement, element);
                    // 更新
                    if (animate && animateOption.update) {
                        // 没有动画
                        _this.updateAnimation(elementName, originElement, replaceAttrs, animateOption.update);
                    }
                    else {
                        // originElement.attrs = replaceAttrs; // 直接替换
                        originElement.attr(replaceAttrs);
                    }
                    // 如果是分组，则继续执行
                    if (element.isGroup()) {
                        _this.updateElements(element, originElement);
                    }
                    // 复制属性
                    util_1.each(COPY_PROPERTIES, function (name) {
                        originElement.set(name, element.get(name));
                    });
                    util_2.updateClip(originElement, element);
                    preElement = originElement;
                    // 执行完更新后设置状态位为更新
                    originElement.set(STATUS_UPDATE, 'update');
                }
            }
            else {
                // 没有对应的图形，则插入当前图形
                originGroup.add(element); // 应该在 group 加个 insertAt 的方法
                var siblings = originGroup.getChildren(); // 兄弟节点
                siblings.splice(siblings.length - 1, 1); // 先从数组中移除，然后放到合适的位置
                if (preElement) {
                    // 前面已经有更新的图形或者插入的图形，则在这个图形后面插入
                    var index = siblings.indexOf(preElement);
                    siblings.splice(index + 1, 0, element); // 在已经更新的图形元素后面插入
                }
                else {
                    siblings.unshift(element);
                }
                _this.registerElement(element); // 注册节点
                element.set(STATUS_UPDATE, 'add'); // 执行完更新后设置状态位为添加
                if (element.get('isComponent')) {
                    // 直接新增子组件container属性，实例不变
                    var childComponent = element.get('component');
                    childComponent.set('container', originGroup);
                }
                else if (element.isGroup()) {
                    // 如果元素是新增加的元素，则遍历注册所有的子节点
                    _this.registerNewGroup(element);
                }
                preElement = element;
                if (animate) {
                    var animateCfg = _this.get('isInit') ? animateOption.appear : animateOption.enter;
                    if (animateCfg) {
                        _this.addAnimation(elementName, element, animateCfg);
                    }
                }
            }
        });
    };
    GroupComponent.prototype.clearUpdateStatus = function (group) {
        var children = group.getChildren();
        util_1.each(children, function (el) {
            el.set(STATUS_UPDATE, null); // 清理掉更新状态
        });
    };
    // 清理离屏缓存
    GroupComponent.prototype.clearOffScreenCache = function () {
        var offScreenGroup = this.get('offScreenGroup');
        if (offScreenGroup) {
            // 销毁原先的离线 Group
            offScreenGroup.destroy();
        }
        this.set('offScreenGroup', null);
        this.set('offScreenBBox', null);
    };
    // private updateInner() {
    //   const group = this.get('group');
    //   const newGroup = this.createOffScreenGroup();
    //   this.renderInner(newGroup);
    //   this.applyOffset();
    //   this.updateElements(newGroup, group);
    //   this.deleteElements();
    //   newGroup.destroy(); // 销毁虚拟分组
    // }
    // 获取发生委托时的对象，在事件中抛出
    GroupComponent.prototype.getDelegateObject = function () {
        var _a;
        var name = this.get('name');
        var delegateObject = (_a = {},
            _a[name] = this,
            _a.component = this,
            _a);
        return delegateObject;
    };
    // 附加委托信息，用于事件
    GroupComponent.prototype.appendDelegateObject = function (parent, cfg) {
        var parentObject = parent.get('delegateObject');
        if (!cfg.delegateObject) {
            cfg.delegateObject = {};
        }
        util_1.mix(cfg.delegateObject, parentObject); // 将父元素上的委托信息复制到自身
    };
    // 获取需要替换的属性，如果原先图形元素存在，而新图形不存在，则设置 undefined
    GroupComponent.prototype.getReplaceAttrs = function (originElement, newElement) {
        var originAttrs = originElement.attr();
        var newAttrs = newElement.attr();
        util_1.each(originAttrs, function (v, k) {
            if (newAttrs[k] === undefined) {
                newAttrs[k] = undefined;
            }
        });
        return newAttrs;
    };
    GroupComponent.prototype.registerNewGroup = function (group) {
        var _this = this;
        var children = group.getChildren();
        util_1.each(children, function (element) {
            _this.registerElement(element); // 注册节点
            element.set(STATUS_UPDATE, 'add'); // 执行完更新后设置状态位为添加
            if (element.isGroup()) {
                _this.registerNewGroup(element);
            }
        });
    };
    // 移除多余的元素
    GroupComponent.prototype.deleteElements = function () {
        var _this = this;
        var shapesMap = this.get('shapesMap');
        var deleteArray = [];
        // 遍历获取需要删除的图形元素
        util_1.each(shapesMap, function (element, id) {
            if (!element.get(STATUS_UPDATE) || element.destroyed) {
                deleteArray.push([id, element]);
            }
            else {
                element.set(STATUS_UPDATE, null); // 清理掉更新状态
            }
        });
        var animate = this.get('animate');
        var animateOption = this.get('animateOption');
        // 删除图形元素
        util_1.each(deleteArray, function (item) {
            var id = item[0], element = item[1];
            if (!element.destroyed) {
                var elementName = element.get('name');
                if (animate && animateOption.leave) {
                    // 需要动画结束时移除图形
                    var callbackAnimCfg = util_1.mix({
                        callback: function () {
                            _this.removeElement(element);
                        },
                    }, animateOption.leave);
                    _this.removeAnimation(elementName, element, callbackAnimCfg);
                }
                else {
                    _this.removeElement(element);
                }
            }
            delete shapesMap[id]; // 从缓存中移除
        });
    };
    GroupComponent.prototype.removeElement = function (element) {
        if (element.get('isGroup')) {
            var component = element.get('component');
            if (component) {
                component.destroy();
            }
        }
        element.remove();
    };
    return GroupComponent;
}(component_1.default));
exports.default = GroupComponent;

},{"../util/event":70,"../util/matrix":73,"../util/util":77,"./component":20,"@antv/util":803,"tslib":894}],22:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dom_util_1 = require("@antv/dom-util");
var util_1 = require("@antv/util");
var util_2 = require("../util/util");
var component_1 = require("./component");
var HtmlComponent = /** @class */ (function (_super) {
    tslib_1.__extends(HtmlComponent, _super);
    function HtmlComponent() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    HtmlComponent.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { container: null, containerTpl: '<div></div>', updateAutoRender: true, containerClassName: '', parent: null });
        return cfg;
    };
    HtmlComponent.prototype.getContainer = function () {
        return this.get('container');
    };
    /**
     * 显示组件
     */
    HtmlComponent.prototype.show = function () {
        var container = this.get('container');
        container.style.display = '';
        this.set('visible', true);
    };
    /**
     * 隐藏组件
     */
    HtmlComponent.prototype.hide = function () {
        var container = this.get('container');
        container.style.display = 'none';
        this.set('visible', false);
    };
    /**
     * 是否允许捕捉事件
     * @param capture 事件捕捉
     */
    HtmlComponent.prototype.setCapture = function (capture) {
        var container = this.getContainer();
        var value = capture ? 'auto' : 'none';
        container.style.pointerEvents = value;
        this.set('capture', capture);
    };
    HtmlComponent.prototype.getBBox = function () {
        var container = this.getContainer();
        var x = parseFloat(container.style.left) || 0;
        var y = parseFloat(container.style.top) || 0;
        return util_2.createBBox(x, y, container.clientWidth, container.clientHeight);
    };
    HtmlComponent.prototype.clear = function () {
        var container = this.get('container');
        util_2.clearDom(container);
    };
    HtmlComponent.prototype.destroy = function () {
        this.removeEvent();
        this.removeDom();
        _super.prototype.destroy.call(this);
    };
    /**
     * 复写 init，主要是初始化 DOM 和事件
     */
    HtmlComponent.prototype.init = function () {
        _super.prototype.init.call(this);
        this.initContainer();
        this.initDom();
        this.resetStyles(); // 初始化样式
        this.applyStyles(); // 应用样式
        this.initEvent();
        this.initCapture();
        this.initVisible();
    };
    HtmlComponent.prototype.initCapture = function () {
        this.setCapture(this.get('capture'));
    };
    HtmlComponent.prototype.initVisible = function () {
        if (!this.get('visible')) {
            // 设置初始显示状态
            this.hide();
        }
        else {
            this.show();
        }
    };
    HtmlComponent.prototype.initDom = function () {
    };
    HtmlComponent.prototype.initContainer = function () {
        var container = this.get('container');
        if (util_1.isNil(container)) {
            // 未指定 container 则创建
            container = this.createDom();
            var parent_1 = this.get('parent');
            if (util_1.isString(parent_1)) {
                parent_1 = document.getElementById(parent_1);
                this.set('parent', parent_1);
            }
            parent_1.appendChild(container);
            this.set('container', container);
        }
        else if (util_1.isString(container)) {
            // 用户传入的 id, 作为 container
            container = document.getElementById(container);
            this.set('container', container);
        } // else container 是 DOM
        if (!this.get('parent')) {
            this.set('parent', container.parentNode);
        }
    };
    // 样式需要进行合并，不能单纯的替换，否则使用非常不方便
    HtmlComponent.prototype.resetStyles = function () {
        var style = this.get('domStyles');
        var defaultStyles = this.get('defaultStyles');
        if (!style) {
            style = defaultStyles;
        }
        else {
            style = util_1.deepMix({}, defaultStyles, style);
        }
        this.set('domStyles', style);
    };
    // 应用所有的样式
    HtmlComponent.prototype.applyStyles = function () {
        var domStyles = this.get('domStyles');
        if (!domStyles) {
            return;
        }
        var container = this.getContainer();
        this.applyChildrenStyles(container, domStyles);
        var containerClassName = this.get('containerClassName');
        if (containerClassName && util_2.hasClass(container, containerClassName)) {
            var containerCss = domStyles[containerClassName];
            dom_util_1.modifyCSS(container, containerCss);
        }
    };
    HtmlComponent.prototype.applyChildrenStyles = function (element, styles) {
        util_1.each(styles, function (style, name) {
            var elements = element.getElementsByClassName(name);
            util_1.each(elements, function (el) {
                dom_util_1.modifyCSS(el, style);
            });
        });
    };
    // 应用到单个 DOM
    HtmlComponent.prototype.applyStyle = function (cssName, dom) {
        var domStyles = this.get('domStyles');
        dom_util_1.modifyCSS(dom, domStyles[cssName]);
    };
    /**
     * @protected
     */
    HtmlComponent.prototype.createDom = function () {
        var containerTpl = this.get('containerTpl');
        return dom_util_1.createDom(containerTpl);
    };
    /**
     * @protected
     * 初始化事件
     */
    HtmlComponent.prototype.initEvent = function () { };
    /**
     * @protected
     * 清理 DOM
     */
    HtmlComponent.prototype.removeDom = function () {
        var container = this.get('container');
        container && container.parentNode.removeChild(container);
    };
    /**
     * @protected
     * 清理事件
     */
    HtmlComponent.prototype.removeEvent = function () { };
    HtmlComponent.prototype.updateInner = function (cfg) {
        // 更新样式
        if (util_1.hasKey(cfg, 'domStyles')) {
            this.resetStyles();
            this.applyStyles();
        }
        // 只要属性发生变化，都调整一些位置
        this.resetPosition();
    };
    HtmlComponent.prototype.resetPosition = function () { };
    ;
    return HtmlComponent;
}(component_1.default));
exports.default = HtmlComponent;

},{"../util/util":77,"./component":20,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],23:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var util_1 = require("../util/util");
var ArcAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(ArcAnnotation, _super);
    function ArcAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    ArcAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'arc', locationType: 'circle', center: null, radius: 100, startAngle: -Math.PI / 2, endAngle: (Math.PI * 3) / 2, style: {
                stroke: '#999',
                lineWidth: 1,
            } });
    };
    ArcAnnotation.prototype.renderInner = function (group) {
        this.renderArc(group);
    };
    ArcAnnotation.prototype.getArcPath = function () {
        var _a = this.getLocation(), center = _a.center, radius = _a.radius, startAngle = _a.startAngle, endAngle = _a.endAngle;
        var startPoint = util_1.getCirclePoint(center, radius, startAngle);
        var endPoint = util_1.getCirclePoint(center, radius, endAngle);
        var largeFlag = endAngle - startAngle > Math.PI ? 1 : 0;
        var path = [['M', startPoint.x, startPoint.y]];
        if (endAngle - startAngle === Math.PI * 2) {
            // 整个圆是分割成两个圆
            var middlePoint = util_1.getCirclePoint(center, radius, startAngle + Math.PI);
            path.push(['A', radius, radius, 0, largeFlag, 1, middlePoint.x, middlePoint.y]);
            path.push(['A', radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
        }
        else {
            path.push(['A', radius, radius, 0, largeFlag, 1, endPoint.x, endPoint.y]);
        }
        return path;
    };
    // 绘制 arc
    ArcAnnotation.prototype.renderArc = function (group) {
        // 也可以 通过 get('center') 类似的方式逐个获取
        var path = this.getArcPath();
        var style = this.get('style');
        this.addShape(group, {
            type: 'path',
            id: this.getElementId('arc'),
            name: 'annotation-arc',
            attrs: tslib_1.__assign({ path: path }, style),
        });
    };
    return ArcAnnotation;
}(group_component_1.default));
exports.default = ArcAnnotation;

},{"../abstract/group-component":21,"../util/util":77,"tslib":894}],24:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var graphic_1 = require("../util/graphic");
var matrix_1 = require("../util/matrix");
var theme_1 = require("../util/theme");
var DataMarkerAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(DataMarkerAnnotation, _super);
    function DataMarkerAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    DataMarkerAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'dataMarker', locationType: 'point', x: 0, y: 0, point: {}, line: {}, text: {}, direction: 'upward', autoAdjust: true, coordinateBBox: null, defaultCfg: {
                point: {
                    display: true,
                    style: {
                        r: 3,
                        fill: '#FFFFFF',
                        stroke: '#1890FF',
                        lineWidth: 2,
                    },
                },
                line: {
                    display: true,
                    length: 20,
                    style: {
                        stroke: theme_1.default.lineColor,
                        lineWidth: 1,
                    },
                },
                text: {
                    content: '',
                    display: true,
                    style: {
                        fill: theme_1.default.textColor,
                        opacity: 0.65,
                        fontSize: 12,
                        textAlign: 'start',
                        fontFamily: theme_1.default.fontFamily,
                    },
                },
            } });
    };
    DataMarkerAnnotation.prototype.renderInner = function (group) {
        if (util_1.get(this.get('line'), 'display')) {
            this.renderLine(group);
        }
        if (util_1.get(this.get('text'), 'display')) {
            this.renderText(group);
        }
        if (util_1.get(this.get('point'), 'display')) {
            this.renderPoint(group);
        }
        if (this.get('autoAdjust')) {
            this.autoAdjust(group);
        }
    };
    DataMarkerAnnotation.prototype.applyOffset = function () {
        this.moveElementTo(this.get('group'), {
            x: this.get('x') + this.get('offsetX'),
            y: this.get('y') + this.get('offsetY'),
        });
    };
    DataMarkerAnnotation.prototype.renderPoint = function (group) {
        var point = this.getShapeAttrs().point;
        this.addShape(group, {
            type: 'circle',
            id: this.getElementId('point'),
            name: 'annotation-point',
            attrs: point,
        });
    };
    DataMarkerAnnotation.prototype.renderLine = function (group) {
        var line = this.getShapeAttrs().line;
        this.addShape(group, {
            type: 'path',
            id: this.getElementId('line'),
            name: 'annotation-line',
            attrs: line,
        });
    };
    DataMarkerAnnotation.prototype.renderText = function (group) {
        var textAttrs = this.getShapeAttrs().text;
        var x = textAttrs.x, y = textAttrs.y, text = textAttrs.text, style = tslib_1.__rest(textAttrs, ["x", "y", "text"]);
        var _a = this.get('text'), background = _a.background, maxLength = _a.maxLength, autoEllipsis = _a.autoEllipsis, isVertival = _a.isVertival, ellipsisPosition = _a.ellipsisPosition;
        var tagCfg = {
            x: x,
            y: y,
            id: this.getElementId('text'),
            name: 'annotation-text',
            content: text,
            style: style,
            background: background,
            maxLength: maxLength,
            autoEllipsis: autoEllipsis,
            isVertival: isVertival,
            ellipsisPosition: ellipsisPosition,
        };
        graphic_1.renderTag(group, tagCfg);
    };
    DataMarkerAnnotation.prototype.autoAdjust = function (group) {
        var direction = this.get('direction');
        var x = this.get('x');
        var y = this.get('y');
        var lineLength = util_1.get(this.get('line'), 'length', 0);
        var coordinateBBox = this.get('coordinateBBox');
        var _a = group.getBBox(), minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;
        var textGroup = group.findById(this.getElementId('text-group'));
        var textShape = group.findById(this.getElementId('text'));
        var lineShape = group.findById(this.getElementId('line'));
        if (!coordinateBBox) {
            return;
        }
        if (textGroup) {
            if (x + minX <= coordinateBBox.minX) {
                // 左侧超出
                var overflow = coordinateBBox.minX - (x + minX);
                matrix_1.applyTranslate(textGroup, textGroup.attr('x') + overflow, textGroup.attr('y'));
            }
            if (x + maxX >= coordinateBBox.maxX) {
                // 右侧超出
                var overflow = x + maxX - coordinateBBox.maxX;
                matrix_1.applyTranslate(textGroup, textGroup.attr('x') - overflow, textGroup.attr('y'));
            }
        }
        if ((direction === 'upward' && y + minY <= coordinateBBox.minY) ||
            (direction !== 'upward' && y + maxY >= coordinateBBox.maxY)) {
            // 上方或者下方超出
            var textBaseline = void 0;
            var factor = void 0;
            if (direction === 'upward' && y + minY <= coordinateBBox.minY) {
                textBaseline = 'top';
                factor = 1;
            }
            else {
                textBaseline = 'bottom';
                factor = -1;
            }
            textShape.attr('textBaseline', textBaseline);
            if (lineShape) {
                lineShape.attr('path', [
                    ['M', 0, 0],
                    ['L', 0, lineLength * factor],
                ]);
            }
            matrix_1.applyTranslate(textGroup, textGroup.attr('x'), (lineLength + 2) * factor);
        }
    };
    DataMarkerAnnotation.prototype.getShapeAttrs = function () {
        var lineDisplay = util_1.get(this.get('line'), 'display');
        var pointStyle = util_1.get(this.get('point'), 'style', {});
        var lineStyle = util_1.get(this.get('line'), 'style', {});
        var textStyle = util_1.get(this.get('text'), 'style', {});
        var direction = this.get('direction');
        var lineLength = lineDisplay ? util_1.get(this.get('line'), 'length', 0) : 0;
        var factor = direction === 'upward' ? -1 : 1;
        return {
            point: tslib_1.__assign({ x: 0, y: 0 }, pointStyle),
            line: tslib_1.__assign({ path: [
                    ['M', 0, 0],
                    ['L', 0, lineLength * factor],
                ] }, lineStyle),
            text: tslib_1.__assign({ x: 0, y: (lineLength + 2) * factor, text: util_1.get(this.get('text'), 'content', ''), textBaseline: direction === 'upward' ? 'bottom' : 'top' }, textStyle),
        };
    };
    return DataMarkerAnnotation;
}(group_component_1.default));
exports.default = DataMarkerAnnotation;

},{"../abstract/group-component":21,"../util/graphic":71,"../util/matrix":73,"../util/theme":76,"@antv/util":803,"tslib":894}],25:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var theme_1 = require("../util/theme");
var util_2 = require("../util/util");
var graphic_1 = require("../util/graphic");
var DataRegionAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(DataRegionAnnotation, _super);
    function DataRegionAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    DataRegionAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'dataRegion', locationType: 'points', points: [], lineLength: 0, region: {}, text: {}, defaultCfg: {
                region: {
                    style: {
                        lineWidth: 0,
                        fill: theme_1.default.regionColor,
                        opacity: 0.4,
                    },
                },
                text: {
                    content: '',
                    style: {
                        textAlign: 'center',
                        textBaseline: 'bottom',
                        fontSize: 12,
                        fill: theme_1.default.textColor,
                        fontFamily: theme_1.default.fontFamily,
                    },
                },
            } });
    };
    DataRegionAnnotation.prototype.renderInner = function (group) {
        var regionStyle = util_1.get(this.get('region'), 'style', {});
        var textStyle = util_1.get(this.get('text'), 'style', {});
        var lineLength = this.get('lineLength') || 0;
        var points = this.get('points');
        if (!points.length) {
            return;
        }
        var bbox = util_2.pointsToBBox(points);
        // render region
        var path = [];
        path.push(['M', points[0].x, bbox.minY - lineLength]);
        points.forEach(function (point) {
            path.push(['L', point.x, point.y]);
        });
        path.push(['L', points[points.length - 1].x, points[points.length - 1].y - lineLength]);
        this.addShape(group, {
            type: 'path',
            id: this.getElementId('region'),
            name: 'annotation-region',
            attrs: tslib_1.__assign({ path: path }, regionStyle),
        });
        // render text
        var textCfg = tslib_1.__assign({ id: this.getElementId('text'), name: 'annotation-text', x: (bbox.minX + bbox.maxX) / 2, y: bbox.minY - lineLength }, this.get('text'));
        graphic_1.renderTag(group, textCfg);
    };
    return DataRegionAnnotation;
}(group_component_1.default));
exports.default = DataRegionAnnotation;

},{"../abstract/group-component":21,"../util/graphic":71,"../util/theme":76,"../util/util":77,"@antv/util":803,"tslib":894}],26:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var util_1 = require("../util/util");
var ImageAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(ImageAnnotation, _super);
    function ImageAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    ImageAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'image', locationType: 'region', start: null, end: null, src: null, style: {} });
    };
    ImageAnnotation.prototype.renderInner = function (group) {
        this.renderImage(group);
    };
    ImageAnnotation.prototype.getImageAttrs = function () {
        var start = this.get('start');
        var end = this.get('end');
        var style = this.get('style');
        var bbox = util_1.regionToBBox({ start: start, end: end });
        var src = this.get('src');
        return tslib_1.__assign({ x: bbox.x, y: bbox.y, img: src, width: bbox.width, height: bbox.height }, style);
    };
    // 绘制图片
    ImageAnnotation.prototype.renderImage = function (group) {
        this.addShape(group, {
            type: 'image',
            id: this.getElementId('image'),
            name: 'annotation-image',
            attrs: this.getImageAttrs(),
        });
    };
    return ImageAnnotation;
}(group_component_1.default));
exports.default = ImageAnnotation;

},{"../abstract/group-component":21,"../util/util":77,"tslib":894}],27:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });
var text_1 = require("./text");
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.default; } });
var arc_1 = require("./arc");
Object.defineProperty(exports, "Arc", { enumerable: true, get: function () { return arc_1.default; } });
var region_1 = require("./region");
Object.defineProperty(exports, "Region", { enumerable: true, get: function () { return region_1.default; } });
var image_1 = require("./image");
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_1.default; } });
var data_marker_1 = require("./data-marker");
Object.defineProperty(exports, "DataMarker", { enumerable: true, get: function () { return data_marker_1.default; } });
var data_region_1 = require("./data-region");
Object.defineProperty(exports, "DataRegion", { enumerable: true, get: function () { return data_region_1.default; } });
var region_filter_1 = require("./region-filter");
Object.defineProperty(exports, "RegionFilter", { enumerable: true, get: function () { return region_filter_1.default; } });

},{"./arc":23,"./data-marker":24,"./data-region":25,"./image":26,"./line":28,"./region":30,"./region-filter":29,"./text":31}],28:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var graphic_1 = require("../util/graphic");
var theme_1 = require("../util/theme");
var util_2 = require("../util/util");
var LineAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(LineAnnotation, _super);
    function LineAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    LineAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'line', locationType: 'region', start: null, end: null, style: {}, text: null, defaultCfg: {
                style: {
                    fill: theme_1.default.textColor,
                    fontSize: 12,
                    textAlign: 'center',
                    textBaseline: 'bottom',
                    fontFamily: theme_1.default.fontFamily,
                },
                text: {
                    position: 'center',
                    autoRotate: true,
                    content: null,
                    offsetX: 0,
                    offsetY: 0,
                    style: {
                        stroke: theme_1.default.lineColor,
                        lineWidth: 1,
                    },
                },
            } });
    };
    LineAnnotation.prototype.renderInner = function (group) {
        this.renderLine(group);
        if (this.get('text')) {
            this.renderLabel(group);
        }
    };
    // 绘制线
    LineAnnotation.prototype.renderLine = function (group) {
        var start = this.get('start');
        var end = this.get('end');
        var style = this.get('style');
        this.addShape(group, {
            type: 'line',
            id: this.getElementId('line'),
            name: 'annotation-line',
            attrs: tslib_1.__assign({ x1: start.x, y1: start.y, x2: end.x, y2: end.y }, style),
        });
    };
    // 获取 label 的位置
    LineAnnotation.prototype.getLabelPoint = function (start, end, position) {
        var percent;
        if (position === 'start') {
            percent = 0;
        }
        else if (position === 'center') {
            percent = 0.5;
        }
        else if (util_1.isString(position) && position.indexOf('%') !== -1) {
            percent = parseInt(position, 10) / 100;
        }
        else if (util_1.isNumber(position)) {
            percent = position;
        }
        else {
            percent = 1;
        }
        if (percent > 1 || percent < 0) {
            percent = 1;
        }
        return {
            x: util_2.getValueByPercent(start.x, end.x, percent),
            y: util_2.getValueByPercent(start.y, end.y, percent),
        };
    };
    // 绘制 label
    LineAnnotation.prototype.renderLabel = function (group) {
        var text = this.get('text');
        var start = this.get('start');
        var end = this.get('end');
        var position = text.position, content = text.content, style = text.style, offsetX = text.offsetX, offsetY = text.offsetY, autoRotate = text.autoRotate, maxLength = text.maxLength, autoEllipsis = text.autoEllipsis, ellipsisPosition = text.ellipsisPosition, background = text.background, _a = text.isVertical, isVertical = _a === void 0 ? false : _a;
        var point = this.getLabelPoint(start, end, position);
        var x = point.x + offsetX;
        var y = point.y + offsetY;
        var cfg = {
            id: this.getElementId('line-text'),
            name: 'annotation-line-text',
            x: x,
            y: y,
            content: content,
            style: style,
            maxLength: maxLength,
            autoEllipsis: autoEllipsis,
            ellipsisPosition: ellipsisPosition,
            background: background,
            isVertical: isVertical,
        };
        // 如果自动旋转
        if (autoRotate) {
            var vector = [end.x - start.x, end.y - start.y];
            cfg.rotate = Math.atan2(vector[1], vector[0]);
        }
        graphic_1.renderTag(group, cfg);
    };
    return LineAnnotation;
}(group_component_1.default));
exports.default = LineAnnotation;

},{"../abstract/group-component":21,"../util/graphic":71,"../util/theme":76,"../util/util":77,"@antv/util":803,"tslib":894}],29:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var util_2 = require("../util/util");
var RegionFilterAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(RegionFilterAnnotation, _super);
    function RegionFilterAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    RegionFilterAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'regionFilter', locationType: 'region', start: null, end: null, color: null, shape: [] });
    };
    RegionFilterAnnotation.prototype.renderInner = function (group) {
        var _this = this;
        var start = this.get('start');
        var end = this.get('end');
        // 1. add region layer
        var layer = this.addGroup(group, {
            id: this.getElementId('region-filter'),
            capture: false,
        });
        // 2. clone shape & color it
        util_1.each(this.get('shapes'), function (shape, shapeIdx) {
            var type = shape.get('type');
            var attrs = util_1.clone(shape.attr());
            _this.adjustShapeAttrs(attrs);
            _this.addShape(layer, {
                id: _this.getElementId("shape-" + type + "-" + shapeIdx),
                capture: false,
                type: type,
                attrs: attrs,
            });
        });
        // 3. clip
        var clipBBox = util_2.regionToBBox({ start: start, end: end });
        layer.setClip({
            type: 'rect',
            attrs: {
                x: clipBBox.minX,
                y: clipBBox.minY,
                width: clipBBox.width,
                height: clipBBox.height,
            },
        });
    };
    RegionFilterAnnotation.prototype.adjustShapeAttrs = function (attr) {
        var color = this.get('color');
        if (attr.fill) {
            attr.fill = attr.fillStyle = color;
        }
        attr.stroke = attr.strokeStyle = color;
    };
    return RegionFilterAnnotation;
}(group_component_1.default));
exports.default = RegionFilterAnnotation;

},{"../abstract/group-component":21,"../util/util":77,"@antv/util":803,"tslib":894}],30:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var theme_1 = require("../util/theme");
var util_1 = require("../util/util");
var RegionAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(RegionAnnotation, _super);
    function RegionAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    RegionAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'region', locationType: 'region', start: null, end: null, style: {}, defaultCfg: {
                style: {
                    lineWidth: 0,
                    fill: theme_1.default.regionColor,
                    opacity: 0.4,
                },
            } });
    };
    RegionAnnotation.prototype.renderInner = function (group) {
        this.renderRegion(group);
    };
    RegionAnnotation.prototype.renderRegion = function (group) {
        var start = this.get('start');
        var end = this.get('end');
        var style = this.get('style');
        var bbox = util_1.regionToBBox({ start: start, end: end });
        this.addShape(group, {
            type: 'rect',
            id: this.getElementId('region'),
            name: 'annotation-region',
            attrs: tslib_1.__assign({ x: bbox.x, y: bbox.y, width: bbox.width, height: bbox.height }, style),
        });
    };
    return RegionAnnotation;
}(group_component_1.default));
exports.default = RegionAnnotation;

},{"../abstract/group-component":21,"../util/theme":76,"../util/util":77,"tslib":894}],31:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var graphic_1 = require("../util/graphic");
var matrix_1 = require("../util/matrix");
var theme_1 = require("../util/theme");
var TextAnnotation = /** @class */ (function (_super) {
    tslib_1.__extends(TextAnnotation, _super);
    function TextAnnotation() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    TextAnnotation.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'annotation', type: 'text', locationType: 'point', x: 0, y: 0, content: '', rotate: null, style: {}, background: null, maxLength: null, autoEllipsis: true, isVertical: false, ellipsisPosition: 'tail', defaultCfg: {
                style: {
                    fill: theme_1.default.textColor,
                    fontSize: 12,
                    textAlign: 'center',
                    textBaseline: 'middle',
                    fontFamily: theme_1.default.fontFamily,
                },
            } });
    };
    // 复写 setLocation 方法，不需要重新创建 text
    TextAnnotation.prototype.setLocation = function (location) {
        this.set('x', location.x);
        this.set('y', location.y);
        this.resetLocation();
    };
    TextAnnotation.prototype.renderInner = function (group) {
        var _a = this.getLocation(), x = _a.x, y = _a.y;
        var content = this.get('content');
        var style = this.get('style');
        var id = this.getElementId('text');
        var name = this.get('name') + "-text";
        var maxLength = this.get('maxLength');
        var autoEllipsis = this.get('autoEllipsis');
        var isVertical = this.get('isVertical');
        var ellipsisPosition = this.get('ellipsisPosition');
        var background = this.get('background');
        var rotate = this.get('rotate');
        var cfg = {
            id: id,
            name: name,
            x: x,
            y: y,
            content: content,
            style: style,
            maxLength: maxLength,
            autoEllipsis: autoEllipsis,
            isVertical: isVertical,
            ellipsisPosition: ellipsisPosition,
            background: background,
            rotate: rotate,
        };
        graphic_1.renderTag(group, cfg);
    };
    TextAnnotation.prototype.resetLocation = function () {
        var textGroup = this.getElementByLocalId('text-group');
        if (textGroup) {
            var _a = this.getLocation(), x = _a.x, y = _a.y;
            var rotate = this.get('rotate');
            matrix_1.applyTranslate(textGroup, x, y);
            matrix_1.applyRotate(textGroup, rotate, x, y);
        }
    };
    return TextAnnotation;
}(group_component_1.default));
exports.default = TextAnnotation;

},{"../abstract/group-component":21,"../util/graphic":71,"../util/matrix":73,"../util/theme":76,"tslib":894}],32:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var matrix_1 = require("../util/matrix");
var state_1 = require("../util/state");
var theme_1 = require("../util/theme");
var AxisBase = /** @class */ (function (_super) {
    tslib_1.__extends(AxisBase, _super);
    function AxisBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AxisBase.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'axis', ticks: [], line: {}, tickLine: {}, subTickLine: null, title: null, 
            /**
             * 文本标签的配置项
             */
            label: {}, 
            /**
             * 垂直于坐标轴方向的因子，决定文本、title、tickLine 在坐标轴的哪一侧
             */
            verticalFactor: 1, 
            // 垂直方向限制的长度，对文本自适应有很大影响
            verticalLimitLength: null, overlapOrder: ['autoRotate', 'autoEllipsis', 'autoHide'], tickStates: {}, defaultCfg: {
                line: {
                    // @type {Attrs} 坐标轴线的图形属性,如果设置成null，则不显示轴线
                    style: {
                        lineWidth: 1,
                        stroke: theme_1.default.lineColor,
                    },
                },
                tickLine: {
                    // @type {Attrs} 标注坐标线的图形属性
                    style: {
                        lineWidth: 1,
                        stroke: theme_1.default.lineColor,
                    },
                    alignTick: true,
                    length: 5,
                    displayWithLabel: true,
                },
                subTickLine: {
                    // @type {Attrs} 标注坐标线的图形属性
                    style: {
                        lineWidth: 1,
                        stroke: theme_1.default.lineColor,
                    },
                    count: 4,
                    length: 2,
                },
                label: {
                    autoRotate: true,
                    autoHide: false,
                    autoEllipsis: false,
                    style: {
                        fontSize: 12,
                        fill: theme_1.default.textColor,
                        textBaseline: 'middle',
                        fontFamily: theme_1.default.fontFamily,
                        fontWeight: 'normal',
                    },
                    offset: 10,
                },
                title: {
                    autoRotate: true,
                    spacing: 5,
                    position: 'center',
                    style: {
                        fontSize: 12,
                        fill: theme_1.default.textColor,
                        textBaseline: 'middle',
                        fontFamily: theme_1.default.fontFamily,
                        textAlign: 'center',
                    },
                },
                tickStates: {
                    active: {
                        labelStyle: {
                            fontWeight: 500,
                        },
                        tickLineStyle: {
                            lineWidth: 2,
                        },
                    },
                    inactive: {
                        labelStyle: {
                            fill: theme_1.default.uncheckedColor,
                        },
                    },
                },
            } });
    };
    /**
     * 绘制组件
     */
    AxisBase.prototype.renderInner = function (group) {
        if (this.get('line')) {
            this.drawLine(group);
        }
        // drawTicks 包括 drawLabels 和 drawTickLines
        this.drawTicks(group);
        if (this.get('title')) {
            this.drawTitle(group);
        }
    };
    // 实现 IList 接口
    AxisBase.prototype.isList = function () {
        return true;
    };
    /**
     * 获取图例项
     * @return {ListItem[]} 列表项集合
     */
    AxisBase.prototype.getItems = function () {
        return this.get('ticks');
    };
    /**
     * 设置列表项
     * @param {ListItem[]} items 列表项集合
     */
    AxisBase.prototype.setItems = function (items) {
        this.update({
            ticks: items,
        });
    };
    /**
     * 更新列表项
     * @param {ListItem} item 列表项
     * @param {object}   cfg  列表项
     */
    AxisBase.prototype.updateItem = function (item, cfg) {
        util_1.mix(item, cfg);
        this.clear(); // 由于单个图例项变化，会引起全局变化，所以全部更新
        this.render();
    };
    /**
     * 清空列表
     */
    AxisBase.prototype.clearItems = function () {
        var itemGroup = this.getElementByLocalId('label-group');
        itemGroup && itemGroup.clear();
    };
    /**
     * 设置列表项的状态
     * @param {ListItem} item  列表项
     * @param {string}   state 状态名
     * @param {boolean}  value 状态值, true, false
     */
    AxisBase.prototype.setItemState = function (item, state, value) {
        item[state] = value;
        this.updateTickStates(item); // 应用状态样式
    };
    /**
     * 是否存在指定的状态
     * @param {ListItem} item  列表项
     * @param {boolean} state 状态名
     */
    AxisBase.prototype.hasState = function (item, state) {
        return !!item[state];
    };
    AxisBase.prototype.getItemStates = function (item) {
        var tickStates = this.get('tickStates');
        var rst = [];
        util_1.each(tickStates, function (v, k) {
            if (item[k]) {
                // item.selected
                rst.push(k);
            }
        });
        return rst;
    };
    /**
     * 清楚所有列表项的状态
     * @param {string} state 状态值
     */
    AxisBase.prototype.clearItemsState = function (state) {
        var _this = this;
        var items = this.getItemsByState(state);
        util_1.each(items, function (item) {
            _this.setItemState(item, state, false);
        });
    };
    /**
     * 根据状态获取图例项
     * @param  {string}     state [description]
     * @return {ListItem[]}       [description]
     */
    AxisBase.prototype.getItemsByState = function (state) {
        var _this = this;
        var items = this.getItems();
        return util_1.filter(items, function (item) {
            return _this.hasState(item, state);
        });
    };
    AxisBase.prototype.getSidePoint = function (point, offset) {
        var self = this;
        var vector = self.getSideVector(offset, point);
        return {
            x: point.x + vector[0],
            y: point.y + vector[1],
        };
    };
    AxisBase.prototype.getTextAnchor = function (vector) {
        var align;
        if (util_1.isNumberEqual(vector[0], 0)) {
            align = 'center';
        }
        else if (vector[0] > 0) {
            align = 'start';
        }
        else if (vector[0] < 0) {
            align = 'end';
        }
        return align;
    };
    AxisBase.prototype.processOverlap = function (labelGroup) { };
    // 绘制坐标轴线
    AxisBase.prototype.drawLine = function (group) {
        var path = this.getLinePath();
        var line = this.get('line'); // line 的判空在调用 drawLine 之前，不在这里判定
        this.addShape(group, {
            type: 'path',
            id: this.getElementId('line'),
            name: 'axis-line',
            attrs: util_1.mix({
                path: path,
            }, line.style),
        });
    };
    AxisBase.prototype.getTickLineItems = function (ticks) {
        var _this = this;
        var tickLineItems = [];
        var tickLine = this.get('tickLine');
        var alignTick = tickLine.alignTick;
        var tickLineLength = tickLine.length;
        var tickSegment = 1;
        var tickCount = ticks.length;
        if (tickCount >= 2) {
            tickSegment = ticks[1].value - ticks[0].value;
        }
        util_1.each(ticks, function (tick) {
            var point = tick.point;
            if (!alignTick) {
                // tickLine 不同 tick 对齐时需要调整 point
                point = _this.getTickPoint(tick.value - tickSegment / 2);
            }
            var endPoint = _this.getSidePoint(point, tickLineLength);
            tickLineItems.push({
                startPoint: point,
                tickValue: tick.value,
                endPoint: endPoint,
                tickId: tick.id,
                id: "tickline-" + tick.id,
            });
        });
        // 如果 tickLine 不居中对齐，则需要在最后面补充一个 tickLine
        // if (!alignTick && tickCount > 0) {
        //   const tick = ticks[tickCount - 1];
        //   const point = this.getTickPoint(tick.value + tickSegment / 2);
        // }
        return tickLineItems;
    };
    AxisBase.prototype.getSubTickLineItems = function (tickLineItems) {
        var subTickLineItems = [];
        var subTickLine = this.get('subTickLine');
        var subCount = subTickLine.count;
        var tickLineCount = tickLineItems.length;
        // 刻度线的数量大于 2 时，才绘制子刻度
        if (tickLineCount >= 2) {
            for (var i = 0; i < tickLineCount - 1; i++) {
                var pre = tickLineItems[i];
                var next = tickLineItems[i + 1];
                for (var j = 0; j < subCount; j++) {
                    var percent = (j + 1) / (subCount + 1);
                    var tickValue = (1 - percent) * pre.tickValue + percent * next.tickValue;
                    var point = this.getTickPoint(tickValue);
                    var endPoint = this.getSidePoint(point, subTickLine.length);
                    subTickLineItems.push({
                        startPoint: point,
                        endPoint: endPoint,
                        tickValue: tickValue,
                        id: "sub-" + pre.id + "-" + j,
                    });
                }
            }
        }
        return subTickLineItems;
    };
    AxisBase.prototype.getTickLineAttrs = function (tickItem, type) {
        var tickLineStyle = this.get(type).style;
        var startPoint = tickItem.startPoint, endPoint = tickItem.endPoint;
        var attrs = util_1.mix({
            x1: startPoint.x,
            y1: startPoint.y,
            x2: endPoint.x,
            y2: endPoint.y,
        }, tickLineStyle);
        return attrs;
    };
    // 绘制坐标轴刻度线
    AxisBase.prototype.drawTick = function (tickItem, tickLineGroup, type) {
        this.addShape(tickLineGroup, {
            type: 'line',
            id: this.getElementId(tickItem.id),
            name: "axis-" + type,
            attrs: this.getTickLineAttrs(tickItem, type),
        });
    };
    // 绘制坐标轴刻度线，包括子刻度线
    AxisBase.prototype.drawTickLines = function (group) {
        var _this = this;
        var ticks = this.get('ticks');
        var subTickLine = this.get('subTickLine');
        var tickLineItems = this.getTickLineItems(ticks);
        var tickLineGroup = this.addGroup(group, {
            name: 'axis-tickline-group',
            id: this.getElementId('tickline-group'),
        });
        var tickCfg = this.get('tickLine');
        util_1.each(tickLineItems, function (item) {
            if (tickCfg.displayWithLabel) {
                // 如果跟随 label 显示，则检测是否存在对应的 label
                var labelId = _this.getElementId("label-" + item.tickId);
                if (group.findById(labelId)) {
                    _this.drawTick(item, tickLineGroup, 'tickLine');
                }
            }
            else {
                _this.drawTick(item, tickLineGroup, 'tickLine');
            }
        });
        if (subTickLine) {
            var subTickLineItems = this.getSubTickLineItems(tickLineItems);
            util_1.each(subTickLineItems, function (item) {
                _this.drawTick(item, tickLineGroup, 'subTickLine');
            });
        }
    };
    // 预处理 ticks 确定位置和补充 id
    AxisBase.prototype.processTicks = function () {
        var _this = this;
        var ticks = this.get('ticks');
        util_1.each(ticks, function (tick) {
            tick.point = _this.getTickPoint(tick.value);
            // 补充 tick 的 id，为动画和更新做准备
            if (util_1.isNil(tick.id)) {
                // 默认使用 tick.name 作为id
                tick.id = tick.name;
            }
        });
    };
    // 绘制 ticks 包括文本和 tickLine
    AxisBase.prototype.drawTicks = function (group) {
        var _this = this;
        this.processTicks();
        if (this.get('label')) {
            this.drawLabels(group);
        }
        if (this.get('tickLine')) {
            this.drawTickLines(group);
        }
        var ticks = this.get('ticks');
        util_1.each(ticks, function (tick) {
            _this.applyTickStates(tick, group);
        });
    };
    // 获取 label 的配置项
    AxisBase.prototype.getLabelAttrs = function (tick, index) {
        var labelCfg = this.get('label');
        var offset = labelCfg.offset, style = labelCfg.style, rotate = labelCfg.rotate, formatter = labelCfg.formatter;
        var point = this.getSidePoint(tick.point, offset);
        var vector = this.getSideVector(offset, point);
        var text = formatter ? formatter(tick.name, tick, index) : tick.name;
        var attrs = util_1.mix({
            x: point.x,
            y: point.y,
            text: text,
            textAlign: this.getTextAnchor(vector),
        }, style);
        if (rotate) {
            attrs.matrix = matrix_1.getMatrixByAngle(point, rotate);
        }
        return attrs;
    };
    // 绘制文本
    AxisBase.prototype.drawLabels = function (group) {
        var _this = this;
        var ticks = this.get('ticks');
        var labelGroup = this.addGroup(group, {
            name: 'axis-label-group',
            id: this.getElementId('label-group'),
        });
        util_1.each(ticks, function (tick, index) {
            _this.addShape(labelGroup, {
                type: 'text',
                name: 'axis-label',
                id: _this.getElementId("label-" + tick.id),
                attrs: _this.getLabelAttrs(tick, index),
                delegateObject: {
                    tick: tick,
                    item: tick,
                    index: index,
                },
            });
        });
        this.processOverlap(labelGroup);
    };
    // 标题的属性
    AxisBase.prototype.getTitleAttrs = function () {
        var titleCfg = this.get('title');
        var style = titleCfg.style, position = titleCfg.position, offset = titleCfg.offset, _a = titleCfg.spacing, spacing = _a === void 0 ? 0 : _a, autoRotate = titleCfg.autoRotate;
        var titleHeight = style.fontSize;
        var percent = 0.5;
        if (position === 'start') {
            percent = 0;
        }
        else if (position === 'end') {
            percent = 1;
        }
        var point = this.getTickPoint(percent); // 标题对应的坐标轴上的点
        // 如果没有指定 titleOffset 也没有渲染 label，这里需要自动计算 offset
        var titlePoint = this.getSidePoint(point, offset || spacing + titleHeight / 2); // 标题的点
        var attrs = util_1.mix({
            x: titlePoint.x,
            y: titlePoint.y,
            text: titleCfg.text,
        }, style);
        var rotate = titleCfg.rotate; // rotate 是角度值
        var angle = rotate;
        if (util_1.isNil(rotate) && autoRotate) {
            // 用户没有设定旋转角度，同时设置自动旋转
            var vector = this.getAxisVector(point);
            var v1 = [1, 0]; // 水平方向的向量
            angle = matrix_util_1.ext.angleTo(vector, v1, true);
        }
        if (angle) {
            var matrix = matrix_1.getMatrixByAngle(titlePoint, angle);
            attrs.matrix = matrix;
        }
        return attrs;
    };
    // 绘制标题
    AxisBase.prototype.drawTitle = function (group) {
        this.addShape(group, {
            type: 'text',
            id: this.getElementId('title'),
            name: 'axis-title',
            attrs: this.getTitleAttrs(),
        });
    };
    AxisBase.prototype.applyTickStates = function (tick, group) {
        var states = this.getItemStates(tick);
        if (states.length) {
            var tickStates = this.get('tickStates');
            // 分别更新 label 和 tickLine
            var labelId = this.getElementId("label-" + tick.id);
            var labelShape = group.findById(labelId);
            if (labelShape) {
                var labelStateStyle = state_1.getStatesStyle(tick, 'label', tickStates);
                labelStateStyle && labelShape.attr(labelStateStyle);
            }
            var tickLineId = this.getElementId("tickline-" + tick.id);
            var tickLineShape = group.findById(tickLineId);
            if (tickLineShape) {
                var tickLineStateStyle = state_1.getStatesStyle(tick, 'tickLine', tickStates);
                tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
            }
        }
    };
    AxisBase.prototype.updateTickStates = function (tick) {
        var states = this.getItemStates(tick);
        var tickStates = this.get('tickStates');
        var labelCfg = this.get('label');
        var labelShape = this.getElementByLocalId("label-" + tick.id);
        var tickLineCfg = this.get('tickLine');
        var tickLineShape = this.getElementByLocalId("tickline-" + tick.id);
        if (states.length) {
            if (labelShape) {
                var labelStateStyle = state_1.getStatesStyle(tick, 'label', tickStates);
                labelStateStyle && labelShape.attr(labelStateStyle);
            }
            if (tickLineShape) {
                var tickLineStateStyle = state_1.getStatesStyle(tick, 'tickLine', tickStates);
                tickLineStateStyle && tickLineShape.attr(tickLineStateStyle);
            }
        }
        else {
            if (labelShape) {
                labelShape.attr(labelCfg.style);
            }
            if (tickLineShape) {
                tickLineShape.attr(tickLineCfg.style);
            }
        }
    };
    return AxisBase;
}(group_component_1.default));
exports.default = AxisBase;

},{"../abstract/group-component":21,"../util/matrix":73,"../util/state":74,"../util/theme":76,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],33:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var base_1 = require("./base");
var Circle = /** @class */ (function (_super) {
    tslib_1.__extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'circle', locationType: 'circle', center: null, radius: null, startAngle: -Math.PI / 2, endAngle: (Math.PI * 3) / 2 });
    };
    Circle.prototype.getLinePath = function () {
        var center = this.get('center');
        var x = center.x;
        var y = center.y;
        var rx = this.get('radius');
        var ry = rx;
        var startAngle = this.get('startAngle');
        var endAngle = this.get('endAngle');
        var path = [];
        if (Math.abs(endAngle - startAngle) === Math.PI * 2) {
            path = [['M', x, y - ry], ['A', rx, ry, 0, 1, 1, x, y + ry], ['A', rx, ry, 0, 1, 1, x, y - ry], ['Z']];
        }
        else {
            var startPoint = this.getCirclePoint(startAngle);
            var endPoint = this.getCirclePoint(endAngle);
            var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
            var sweep = startAngle > endAngle ? 0 : 1;
            path = [
                ['M', x, y],
                ['L', startPoint.x, startPoint.y],
                ['A', rx, ry, 0, large, sweep, endPoint.x, endPoint.y],
                ['L', x, y],
            ];
        }
        return path;
    };
    Circle.prototype.getTickPoint = function (tickValue) {
        var startAngle = this.get('startAngle');
        var endAngle = this.get('endAngle');
        var angle = startAngle + (endAngle - startAngle) * tickValue;
        return this.getCirclePoint(angle);
    };
    // 获取垂直于坐标轴的向量
    Circle.prototype.getSideVector = function (offset, point) {
        var center = this.get('center');
        var vector = [point.x - center.x, point.y - center.y];
        var factor = this.get('verticalFactor');
        var vecLen = matrix_util_1.vec2.length(vector);
        matrix_util_1.vec2.scale(vector, vector, (factor * offset) / vecLen);
        return vector;
    };
    // 获取沿坐标轴方向的向量
    Circle.prototype.getAxisVector = function (point) {
        var center = this.get('center');
        var vector = [point.x - center.x, point.y - center.y];
        return [vector[1], -1 * vector[0]]; // 获取顺时针方向的向量
    };
    // 根据圆心和半径获取点
    Circle.prototype.getCirclePoint = function (angle, radius) {
        var center = this.get('center');
        radius = radius || this.get('radius');
        return {
            x: center.x + Math.cos(angle) * radius,
            y: center.y + Math.sin(angle) * radius,
        };
    };
    return Circle;
}(base_1.default));
exports.default = Circle;

},{"./base":32,"@antv/matrix-util":717,"tslib":894}],34:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });
var circle_1 = require("./circle");
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.default; } });
var base_1 = require("./base");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } });

},{"./base":32,"./circle":33,"./line":35}],35:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var OverlapUtil = require("./overlap");
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Line.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'line', locationType: 'region', 
            /**
             * 起始点, x, y
             * @type {object}
             */
            start: null, 
            /**
             * 结束点, x, y
             * @type {object}
             */
            end: null });
    };
    // 获取坐标轴线的 path
    Line.prototype.getLinePath = function () {
        var start = this.get('start');
        var end = this.get('end');
        var path = [];
        path.push(['M', start.x, start.y]);
        path.push(['L', end.x, end.y]);
        return path;
    };
    // 重新计算 layout bbox，考虑到 line 不显示
    Line.prototype.getInnerLayoutBBox = function () {
        var start = this.get('start');
        var end = this.get('end');
        var bbox = _super.prototype.getInnerLayoutBBox.call(this);
        var minX = Math.min(start.x, end.x, bbox.x);
        var minY = Math.min(start.y, end.y, bbox.y);
        var maxX = Math.max(start.x, end.x, bbox.maxX);
        var maxY = Math.max(start.y, end.y, bbox.maxY);
        return {
            x: minX,
            y: minY,
            minX: minX,
            minY: minY,
            maxX: maxX,
            maxY: maxY,
            width: maxX - minX,
            height: maxY - minY,
        };
    };
    Line.prototype.isVertical = function () {
        var start = this.get('start');
        var end = this.get('end');
        return util_1.isNumberEqual(start.x, end.x);
    };
    Line.prototype.isHorizontal = function () {
        var start = this.get('start');
        var end = this.get('end');
        return util_1.isNumberEqual(start.y, end.y);
    };
    Line.prototype.getTickPoint = function (tickValue) {
        var self = this;
        var start = self.get('start');
        var end = self.get('end');
        var regionX = end.x - start.x;
        var regionY = end.y - start.y;
        return {
            x: start.x + regionX * tickValue,
            y: start.y + regionY * tickValue,
        };
    };
    // 直线坐标轴下任一点的向量方向都相同
    Line.prototype.getSideVector = function (offset) {
        var axisVector = this.getAxisVector();
        var normal = matrix_util_1.vec2.normalize([0, 0], axisVector);
        var factor = this.get('verticalFactor');
        var verticalVector = [normal[1], normal[0] * -1]; // 垂直方向，逆时针方向
        return matrix_util_1.vec2.scale([0, 0], verticalVector, offset * factor);
    };
    // 获取坐标轴的向量
    Line.prototype.getAxisVector = function () {
        var start = this.get('start');
        var end = this.get('end');
        return [end.x - start.x, end.y - start.y];
    };
    Line.prototype.processOverlap = function (labelGroup) {
        var _this = this;
        var isVertical = this.isVertical();
        var isHorizontal = this.isHorizontal();
        // 非垂直，或者非水平时不处理遮挡问题
        if (!isVertical && !isHorizontal) {
            return;
        }
        var labelCfg = this.get('label');
        var titleCfg = this.get('title');
        var verticalLimitLength = this.get('verticalLimitLength');
        var labelOffset = labelCfg.offset;
        var limitLength = verticalLimitLength;
        var titleHeight = 0;
        var titleSpacing = 0;
        if (titleCfg) {
            titleHeight = titleCfg.style.fontSize;
            titleSpacing = titleCfg.spacing;
        }
        if (limitLength) {
            limitLength = limitLength - labelOffset - titleSpacing - titleHeight;
        }
        var overlapOrder = this.get('overlapOrder');
        util_1.each(overlapOrder, function (name) {
            if (labelCfg[name]) {
                _this.autoProcessOverlap(name, labelCfg[name], labelGroup, limitLength);
            }
        });
        if (titleCfg) {
            // 调整 title 的 offset
            var bbox = labelGroup.getBBox();
            var length_1 = isVertical ? bbox.width : bbox.height;
            if (util_1.isNil(titleCfg.offset)) {
                // 如果用户没有设置 offset，则自动计算
                titleCfg.offset = labelOffset + length_1 + titleSpacing + titleHeight / 2;
            }
        }
    };
    Line.prototype.autoProcessOverlap = function (name, value, labelGroup, limitLength) {
        var _this = this;
        var isVertical = this.isVertical();
        var hasAdjusted = false;
        var util = OverlapUtil[name];
        if (value === true) {
            // 默认使用固定角度的旋转方案
            hasAdjusted = util.getDefault()(isVertical, labelGroup, limitLength);
        }
        else if (util_1.isFunction(value)) {
            // 用户可以传入回调函数
            hasAdjusted = value(isVertical, labelGroup, limitLength);
        }
        else if (util[value]) {
            // 按照名称执行旋转函数
            hasAdjusted = util[value](isVertical, labelGroup, limitLength);
        }
        if (name === 'autoRotate') {
            // 文本旋转后，文本的对齐方式可能就不合适了
            if (hasAdjusted) {
                var labels = labelGroup.getChildren();
                var verticalFactor_1 = this.get('verticalFactor');
                util_1.each(labels, function (label) {
                    var textAlign = label.attr('textAlign');
                    if (textAlign === 'center') {
                        // 居中的文本需要调整旋转度
                        var newAlign = verticalFactor_1 > 0 ? 'end' : 'start';
                        label.attr('textAlign', newAlign);
                    }
                });
            }
        }
        else if (name === 'autoHide') {
            var children = labelGroup.getChildren().slice(0); // 复制数组，删除时不会出错
            util_1.each(children, function (label) {
                if (!label.get('visible')) {
                    if (_this.get('isRegister')) {
                        // 已经注册过了，则删除
                        _this.unregisterElement(label);
                    }
                    label.remove(); // 防止 label 数量太多，所以统一删除
                }
            });
        }
    };
    return Line;
}(base_1.default));
exports.default = Line;

},{"./base":32,"./overlap":39,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],36:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ellipsisMiddle = exports.ellipsisTail = exports.ellipsisHead = exports.getDefault = void 0;
var util_1 = require("@antv/util");
var label_1 = require("../../util/label");
function ellipseLabels(isVertical, labelGroup, limitLength, position) {
    var children = labelGroup.getChildren();
    var ellipsised = false;
    util_1.each(children, function (label) {
        var rst = label_1.ellipsisLabel(isVertical, label, limitLength, position);
        ellipsised = ellipsised || rst;
    });
    return ellipsised;
}
function getDefault() {
    return ellipsisTail;
}
exports.getDefault = getDefault;
function ellipsisHead(isVertical, labelGroup, limitLength) {
    return ellipseLabels(isVertical, labelGroup, limitLength, 'head');
}
exports.ellipsisHead = ellipsisHead;
function ellipsisTail(isVertical, labelGroup, limitLength) {
    return ellipseLabels(isVertical, labelGroup, limitLength, 'tail');
}
exports.ellipsisTail = ellipsisTail;
function ellipsisMiddle(isVertical, labelGroup, limitLength) {
    return ellipseLabels(isVertical, labelGroup, limitLength, 'middle');
}
exports.ellipsisMiddle = ellipsisMiddle;

},{"../../util/label":72,"@antv/util":803}],37:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.equidistance = exports.reserveBoth = exports.reserveLast = exports.reserveFirst = exports.getDefault = void 0;
var label_1 = require("../../util/label");
// 文本是否旋转
function isRotate(label) {
    var matrix = label.attr('matrix');
    return matrix && matrix[0] !== 1; // 仅在这个场景下判定
}
// autohide 不再考虑超出限制
// function isOutLimit(isVertical: boolean, label: IElement, limitLength: number) {
//   if (!limitLength) {
//     // 如果没限制 limitLength 则直接返回 false
//     return false;
//   }
//   const canvasBBox = label.getCanvasBBox();
//   let isOut = false;
//   if (isVertical) {
//     isOut = canvasBBox.width > limitLength;
//   } else {
//     isOut = canvasBBox.height > limitLength;
//   }
//   return isOut;
// }
// 是否重叠
function isOverlap(isVertical, rotated, preBox, curBox, reversed) {
    if (reversed === void 0) { reversed = false; }
    var overlap = false;
    if (isVertical) {
        // 垂直时检测边高
        overlap = Math.abs(preBox.y - curBox.y) < preBox.height;
    }
    else {
        // 水平时检测
        if (rotated) {
            // 如果旋转了，则检测两者 x 之间的间距是否小于前一个的高度
            var height = reversed ? curBox.height : preBox.height;
            overlap = Math.abs(preBox.x - curBox.x) < height;
        }
        else {
            // 检测两者是否 x 方向重合
            var width = reversed ? curBox.width : preBox.width;
            overlap = Math.abs(preBox.x - curBox.x) < width;
        }
    }
    return overlap;
}
// 保留第一个或者最后一个
function reserveOne(isVertical, labelsGroup, reversed) {
    var labels = labelsGroup.getChildren().slice(); // 复制数组
    if (!labels.length) {
        return false;
    }
    var hasHide = false;
    if (reversed) {
        // 翻转
        labels.reverse();
    }
    var count = labels.length;
    var first = labels[0];
    var rotated = isRotate(first);
    var preBox = first.getBBox();
    for (var i = 1; i < count; i++) {
        var label = labels[i];
        var curBBox = label.getBBox();
        // 不再考虑超出限制，而仅仅根据是否重叠进行隐藏 isOutLimit(isVertical, label, limitLength) ||
        var isHide = isOverlap(isVertical, rotated, preBox, curBBox, reversed);
        if (isHide) {
            label.hide();
            hasHide = true;
        }
        else {
            preBox = curBBox;
        }
    }
    return hasHide;
}
function getDefault() {
    return equidistance;
}
exports.getDefault = getDefault;
/**
 * 保证首个 label 可见，即使超过 limitLength 也不隐藏
 * @param {boolean} isVertical  是否垂直
 * @param {IGroup}  labelsGroup label 的分组
 */
function reserveFirst(isVertical, labelsGroup) {
    return reserveOne(isVertical, labelsGroup, false);
}
exports.reserveFirst = reserveFirst;
/**
 * 保证最后一个 label 可见，即使超过 limitLength 也不隐藏
 * @param {boolean} isVertical  是否垂直
 * @param {IGroup}  labelsGroup label 的分组
 */
function reserveLast(isVertical, labelsGroup) {
    return reserveOne(isVertical, labelsGroup, true);
}
exports.reserveLast = reserveLast;
/**
 * 保证第一个最后一个 label 可见，即使超过 limitLength 也不隐藏
 * @param {boolean} isVertical  是否垂直
 * @param {IGroup}  labelsGroup label 的分组
 */
function reserveBoth(isVertical, labelsGroup) {
    var labels = labelsGroup.getChildren().slice(); // 复制数组
    if (labels.length <= 2) {
        // 如果数量小于或等于 2 则直接返回
        return false;
    }
    var hasHide = false;
    var count = labels.length;
    var first = labels[0];
    var last = labels[count - 1];
    var rotated = isRotate(first);
    var preBox = first.getBBox();
    var preLabel = first;
    // 按照先保存第一个的逻辑循环一遍，最后一个不参与循环
    for (var i = 1; i < count - 1; i++) {
        var label = labels[i];
        var curBBox = label.getBBox();
        // 废弃 isOutLimit(isVertical, label, limitLength) ||
        var isHide = isOverlap(isVertical, rotated, preBox, curBBox);
        if (isHide) {
            label.hide();
            hasHide = true;
        }
        else {
            preBox = curBBox;
            preLabel = label;
        }
    }
    var lastBBox = last.getBBox();
    var overlap = isOverlap(isVertical, rotated, preBox, lastBBox); // 不检测超出 limit
    if (overlap) {
        // 发生冲突，则隐藏前一个保留后一个
        preLabel.hide();
        hasHide = true;
    }
    return hasHide;
}
exports.reserveBoth = reserveBoth;
/**
 * 保证 label 均匀显示，主要解决文本层叠的问题，对于 limitLength 不处理
 * @param {boolean} isVertical  是否垂直
 * @param {IGroup}  labelsGroup label 的分组
 */
function equidistance(isVertical, labelsGroup) {
    var labels = labelsGroup.getChildren().slice(); // 复制数组
    if (labels.length < 2) {
        // 如果数量小于 2 则直接返回，等于 2 时可能也会重合
        return false;
    }
    var hasHide = false;
    var first = labels[0];
    var firstBBox = first.getBBox();
    var second = labels[1];
    var rotated = isRotate(first);
    var count = labels.length;
    var interval = 0; // 不重叠的坐标文本间距个数
    if (isVertical) {
        // 垂直的坐标轴计算垂直方向的间距
        var distance = Math.abs(second.attr('y') - first.attr('y'));
        interval = firstBBox.height / distance;
    }
    else {
        // 水平坐标轴
        if (rotated) {
            var distance = Math.abs(second.attr('x') - first.attr('x'));
            interval = firstBBox.width / distance;
        }
        else {
            var maxWidth = label_1.getMaxLabelWidth(labels);
            var distance = Math.abs(second.attr('x') - first.attr('x'));
            interval = maxWidth / distance;
        }
    }
    // interval > 1 时需要对 label 进行隐藏
    if (interval > 1) {
        interval = Math.ceil(interval);
        for (var i = 0; i < count; i++) {
            if (i % interval !== 0) {
                // 仅保留被整除的 label
                labels[i].hide();
                hasHide = true;
            }
        }
    }
    return hasHide;
}
exports.equidistance = equidistance;

},{"../../util/label":72}],38:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unfixedAngle = exports.fixedAngle = exports.getDefault = void 0;
var util_1 = require("@antv/util");
var label_1 = require("../../util/label");
var matrix_1 = require("../../util/matrix");
var theme_1 = require("../../util/theme");
// 统一设置文本的角度
function setLabelsAngle(labels, angle) {
    util_1.each(labels, function (label) {
        var x = label.attr('x');
        var y = label.attr('y');
        var matrix = matrix_1.getMatrixByAngle({ x: x, y: y }, angle);
        label.attr('matrix', matrix);
    });
}
// 旋转文本
function labelRotate(isVertical, labelsGroup, limitLength, getAngle) {
    var labels = labelsGroup.getChildren();
    if (!labels.length) {
        return false;
    }
    if (!isVertical && labels.length < 2) {
        // 水平时至少有两个时才旋转
        return false;
    }
    var maxWidth = label_1.getMaxLabelWidth(labels);
    var isOverlap = false;
    if (isVertical) {
        // limitLength 为 0 或者 null 时不生效
        isOverlap = !!limitLength && maxWidth > limitLength;
    }
    else {
        // 同 limitLength 无关
        var tickWidth = Math.abs(labels[1].attr('x') - labels[0].attr('x'));
        isOverlap = maxWidth > tickWidth;
    }
    if (isOverlap) {
        var angle = getAngle(limitLength, maxWidth);
        setLabelsAngle(labels, angle);
    }
    return isOverlap;
}
function getDefault() {
    return fixedAngle;
}
exports.getDefault = getDefault;
/**
 * 固定角度旋转文本
 * @param  {boolean} isVertical  是否垂直方向
 * @param  {IGroup}  labelsGroup 文本的 group
 * @param  {number}  limitLength 限定长度
 * @return {boolean}             是否发生了旋转
 */
function fixedAngle(isVertical, labelsGroup, limitLength) {
    return labelRotate(isVertical, labelsGroup, limitLength, function () {
        return isVertical ? theme_1.default.verticalAxisRotate : theme_1.default.horizontalAxisRotate;
    });
}
exports.fixedAngle = fixedAngle;
/**
 * 非固定角度旋转文本
 * @param  {boolean} isVertical  是否垂直方向
 * @param  {IGroup}  labelsGroup 文本的 group
 * @param  {number}  limitLength 限定长度
 * @return {boolean}             是否发生了旋转
 */
function unfixedAngle(isVertical, labelsGroup, limitLength) {
    return labelRotate(isVertical, labelsGroup, limitLength, function (length, maxWidth) {
        if (!length) {
            // 如果没有设置 limitLength，则使用固定的角度旋转
            return isVertical ? theme_1.default.verticalAxisRotate : theme_1.default.horizontalAxisRotate;
        }
        if (isVertical) {
            // 垂直时不需要判定 limitLength > maxWidth ，因为此时不会 overlap
            return -Math.acos(length / maxWidth);
        }
        else {
            var angle = 0;
            if (length > maxWidth) {
                // 需要判定，asin 的参数 -1， 1
                angle = Math.PI / 4;
            }
            else {
                angle = Math.asin(length / maxWidth);
                if (angle > Math.PI / 4) {
                    // 大于 Math.PI / 4 时没意义
                    angle = Math.PI / 4;
                }
            }
            return angle;
        }
    });
}
exports.unfixedAngle = unfixedAngle;

},{"../../util/label":72,"../../util/matrix":73,"../../util/theme":76,"@antv/util":803}],39:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.autoEllipsis = exports.autoRotate = exports.autoHide = void 0;
var autoEllipsis = require("./auto-ellipsis");
exports.autoEllipsis = autoEllipsis;
var autoHide = require("./auto-hide");
exports.autoHide = autoHide;
var autoRotate = require("./auto-rotate");
exports.autoRotate = autoRotate;

},{"./auto-ellipsis":36,"./auto-hide":37,"./auto-rotate":38}],40:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var matrix_1 = require("../util/matrix");
var theme_1 = require("../util/theme");
var util_2 = require("../util/util");
var CrosshairBase = /** @class */ (function (_super) {
    tslib_1.__extends(CrosshairBase, _super);
    function CrosshairBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CrosshairBase.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'crosshair', type: 'base', line: {}, text: null, textBackground: {}, capture: false, defaultCfg: {
                line: {
                    style: {
                        lineWidth: 1,
                        stroke: theme_1.default.lineColor,
                    },
                },
                text: {
                    position: 'start',
                    offset: 10,
                    autoRotate: false,
                    content: null,
                    style: {
                        fill: theme_1.default.textColor,
                        textAlign: 'center',
                        textBaseline: 'middle',
                        fontFamily: theme_1.default.fontFamily,
                    },
                },
                textBackground: {
                    padding: 5,
                    style: {
                        stroke: theme_1.default.lineColor,
                    },
                },
            } });
    };
    CrosshairBase.prototype.renderInner = function (group) {
        if (this.get('line')) {
            this.renderLine(group);
        }
        if (this.get('text')) {
            this.renderText(group);
            this.renderBackground(group);
        }
    };
    CrosshairBase.prototype.renderText = function (group) {
        var text = this.get('text');
        var style = text.style, autoRotate = text.autoRotate, content = text.content;
        if (!util_1.isNil(content)) {
            var textPoint = this.getTextPoint();
            var matrix = null;
            if (autoRotate) {
                var angle = this.getRotateAngle();
                matrix = matrix_1.getMatrixByAngle(textPoint, angle);
            }
            this.addShape(group, {
                type: 'text',
                name: 'crosshair-text',
                id: this.getElementId('text'),
                attrs: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, textPoint), { text: content, matrix: matrix }), style),
            });
        }
    };
    CrosshairBase.prototype.renderLine = function (group) {
        var path = this.getLinePath();
        var line = this.get('line');
        var style = line.style;
        this.addShape(group, {
            type: 'path',
            name: 'crosshair-line',
            id: this.getElementId('line'),
            attrs: tslib_1.__assign({ path: path }, style),
        });
    };
    // 绘制文本的背景
    CrosshairBase.prototype.renderBackground = function (group) {
        var textId = this.getElementId('text');
        var textShape = group.findById(textId); // 查找文本
        var textBackground = this.get('textBackground');
        if (textBackground && textShape) {
            var textBBox = textShape.getBBox();
            var padding = util_2.formatPadding(textBackground.padding); // 用户传入的 padding 格式不定
            var style = textBackground.style;
            var backgroundShape = this.addShape(group, {
                type: 'rect',
                name: 'crosshair-text-background',
                id: this.getElementId('text-background'),
                attrs: tslib_1.__assign({ x: textBBox.x - padding[3], y: textBBox.y - padding[0], width: textBBox.width + padding[1] + padding[3], height: textBBox.height + padding[0] + padding[2], matrix: textShape.attr('matrix') }, style),
            });
            backgroundShape.toBack();
        }
    };
    return CrosshairBase;
}(group_component_1.default));
exports.default = CrosshairBase;

},{"../abstract/group-component":21,"../util/matrix":73,"../util/theme":76,"../util/util":77,"@antv/util":803,"tslib":894}],41:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util/util");
var base_1 = require("./base");
var LineCrosshair = /** @class */ (function (_super) {
    tslib_1.__extends(LineCrosshair, _super);
    function LineCrosshair() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LineCrosshair.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'circle', locationType: 'circle', center: null, radius: 100, startAngle: -Math.PI / 2, endAngle: (Math.PI * 3) / 2 });
    };
    LineCrosshair.prototype.getRotateAngle = function () {
        var _a = this.getLocation(), startAngle = _a.startAngle, endAngle = _a.endAngle;
        var position = this.get('text').position;
        var tangentAngle = position === 'start' ? startAngle + Math.PI / 2 : endAngle - Math.PI / 2;
        return tangentAngle;
    };
    LineCrosshair.prototype.getTextPoint = function () {
        var text = this.get('text');
        var position = text.position, offset = text.offset;
        var _a = this.getLocation(), center = _a.center, radius = _a.radius, startAngle = _a.startAngle, endAngle = _a.endAngle;
        var angle = position === 'start' ? startAngle : endAngle;
        var tangentAngle = this.getRotateAngle() - Math.PI;
        var point = util_1.getCirclePoint(center, radius, angle);
        // 这个地方其实应该求切线向量然后在乘以 offset，但是太啰嗦了，直接给出结果
        // const tangent = [Math.cos(tangentAngle), Math.sin(tangentAngle)];
        // const offsetVector = vec2.scale([], tangent, offset);
        var offsetX = Math.cos(tangentAngle) * offset;
        var offsetY = Math.sin(tangentAngle) * offset;
        return {
            x: point.x + offsetX,
            y: point.y + offsetY,
        };
    };
    LineCrosshair.prototype.getLinePath = function () {
        var _a = this.getLocation(), center = _a.center, radius = _a.radius, startAngle = _a.startAngle, endAngle = _a.endAngle;
        var path = null;
        if (endAngle - startAngle === Math.PI * 2) {
            // 整圆
            var x = center.x, y = center.y;
            path = [
                ['M', x, y - radius],
                ['A', radius, radius, 0, 1, 1, x, y + radius],
                ['A', radius, radius, 0, 1, 1, x, y - radius],
                ['Z'],
            ];
        }
        else {
            var startPoint = util_1.getCirclePoint(center, radius, startAngle);
            var endPoint = util_1.getCirclePoint(center, radius, endAngle);
            var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
            var sweep = startAngle > endAngle ? 0 : 1;
            path = [
                ['M', startPoint.x, startPoint.y],
                ['A', radius, radius, 0, large, sweep, endPoint.x, endPoint.y],
            ];
        }
        return path;
    };
    return LineCrosshair;
}(base_1.default));
exports.default = LineCrosshair;

},{"../util/util":77,"./base":40,"tslib":894}],42:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CROSSHAIR_TEXT = exports.CROSSHAIR_LINE = exports.CONTAINER_CLASS = void 0;
exports.CONTAINER_CLASS = 'g2-crosshair';
exports.CROSSHAIR_LINE = exports.CONTAINER_CLASS + "-line";
exports.CROSSHAIR_TEXT = exports.CONTAINER_CLASS + "-text";

},{}],43:[function(require,module,exports){
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../util/theme");
// tooltip 相关 dom 的 css 类名
var CssConst = require("./css-const");
exports.default = (_a = {},
    // css style for tooltip
    _a["" + CssConst.CONTAINER_CLASS] = {
        position: 'relative'
    },
    _a["" + CssConst.CROSSHAIR_LINE] = {
        position: 'absolute',
        backgroundColor: 'rgba(0, 0, 0, 0.25)',
    },
    _a["" + CssConst.CROSSHAIR_TEXT] = {
        position: 'absolute',
        color: theme_1.default.textColor,
        fontFamily: theme_1.default.fontFamily,
    },
    _a);

},{"../util/theme":76,"./css-const":42}],44:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dom_util_1 = require("@antv/dom-util");
var util_1 = require("@antv/util");
var util_2 = require("../util/util");
var html_component_1 = require("../abstract/html-component");
var CssConst = require("./css-const");
var html_theme_1 = require("./html-theme");
var HtmlCrosshair = /** @class */ (function (_super) {
    tslib_1.__extends(HtmlCrosshair, _super);
    function HtmlCrosshair() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    HtmlCrosshair.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'crosshair', type: 'html', locationType: 'region', start: { x: 0, y: 0 }, end: { x: 0, y: 0 }, capture: false, text: null, containerTpl: "<div class=\"" + CssConst.CONTAINER_CLASS + "\"></div>", crosshairTpl: "<div class=\"" + CssConst.CROSSHAIR_LINE + "\"></div>", textTpl: "<span class=\"" + CssConst.CROSSHAIR_TEXT + "\">{content}</span>", domStyles: null, containerClassName: CssConst.CONTAINER_CLASS, defaultStyles: html_theme_1.default, defaultCfg: {
                text: {
                    position: 'start',
                    content: null,
                    align: 'center',
                    offset: 10
                }
            } });
    };
    HtmlCrosshair.prototype.render = function () {
        this.resetText();
        this.resetPosition();
    };
    // 绘制 crosshair
    HtmlCrosshair.prototype.initCrossHair = function () {
        var container = this.getContainer();
        var crosshairTpl = this.get('crosshairTpl');
        var crosshairEl = dom_util_1.createDom(crosshairTpl);
        container.appendChild(crosshairEl);
        this.applyStyle(CssConst.CROSSHAIR_LINE, crosshairEl);
        this.set('crosshairEl', crosshairEl);
    };
    // 获取文本的位置
    HtmlCrosshair.prototype.getTextPoint = function () {
        var _a = this.getLocation(), start = _a.start, end = _a.end;
        var _b = this.get('text'), position = _b.position, offset = _b.offset;
        return util_2.getTextPoint(start, end, position, offset);
    };
    // 设置 text
    HtmlCrosshair.prototype.resetText = function () {
        var text = this.get('text');
        var textEl = this.get('textEl');
        if (text) {
            var content = text.content;
            if (!textEl) {
                var container = this.getContainer();
                var textTpl = util_1.substitute(this.get('textTpl'), text);
                textEl = dom_util_1.createDom(textTpl);
                container.appendChild(textEl);
                this.applyStyle(CssConst.CROSSHAIR_TEXT, textEl);
                this.set('textEl', textEl);
            }
            textEl.innerHTML = content;
        }
        else if (textEl) {
            textEl.remove();
        }
    };
    // 是否垂直
    HtmlCrosshair.prototype.isVertical = function (start, end) {
        return start.x === end.x;
    };
    // 重新调整位置
    HtmlCrosshair.prototype.resetPosition = function () {
        var crosshairEl = this.get('crosshairEl');
        if (!crosshairEl) {
            this.initCrossHair();
            crosshairEl = this.get('crosshairEl');
        }
        var start = this.get('start');
        var end = this.get('end');
        var minX = Math.min(start.x, end.x);
        var minY = Math.min(start.y, end.y);
        if (this.isVertical(start, end)) {
            dom_util_1.modifyCSS(crosshairEl, {
                width: '1px',
                height: util_2.toPx(Math.abs(end.y - start.y))
            });
        }
        else {
            dom_util_1.modifyCSS(crosshairEl, {
                height: '1px',
                width: util_2.toPx(Math.abs(end.x - start.x))
            });
        }
        dom_util_1.modifyCSS(crosshairEl, {
            top: util_2.toPx(minY),
            left: util_2.toPx(minX)
        });
        this.alignText();
    };
    HtmlCrosshair.prototype.alignText = function () {
        // 重新设置 text 位置
        var textEl = this.get('textEl');
        if (textEl) {
            var align = this.get('text').align;
            var clientWidth = textEl.clientWidth;
            var point = this.getTextPoint();
            switch (align) {
                case 'center':
                    point.x = point.x - clientWidth / 2;
                    break;
                case 'right':
                    point.x = point.x - clientWidth;
                case 'left':
                    break;
            }
            dom_util_1.modifyCSS(textEl, {
                top: util_2.toPx(point.y),
                left: util_2.toPx(point.x)
            });
        }
    };
    HtmlCrosshair.prototype.updateInner = function (cfg) {
        if (util_1.hasKey(cfg, 'text')) {
            this.resetText();
        }
        _super.prototype.updateInner.call(this, cfg);
    };
    return HtmlCrosshair;
}(html_component_1.default));
exports.default = HtmlCrosshair;

},{"../abstract/html-component":22,"../util/util":77,"./css-const":42,"./html-theme":43,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],45:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });
var circle_1 = require("./circle");
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.default; } });
var base_1 = require("./base");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } });
var html_1 = require("./html");
Object.defineProperty(exports, "Html", { enumerable: true, get: function () { return html_1.default; } });

},{"./base":40,"./circle":41,"./html":44,"./line":46}],46:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util/util");
var base_1 = require("./base");
var LineCrosshair = /** @class */ (function (_super) {
    tslib_1.__extends(LineCrosshair, _super);
    function LineCrosshair() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LineCrosshair.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'line', locationType: 'region', start: null, end: null });
    };
    // 直线的文本需要同直线垂直
    LineCrosshair.prototype.getRotateAngle = function () {
        var _a = this.getLocation(), start = _a.start, end = _a.end;
        var position = this.get('text').position;
        var angle = Math.atan2(end.y - start.y, end.x - start.x);
        var tangentAngle = position === 'start' ? angle - Math.PI / 2 : angle + Math.PI / 2;
        return tangentAngle;
    };
    LineCrosshair.prototype.getTextPoint = function () {
        var _a = this.getLocation(), start = _a.start, end = _a.end;
        var _b = this.get('text'), position = _b.position, offset = _b.offset;
        return util_1.getTextPoint(start, end, position, offset);
    };
    LineCrosshair.prototype.getLinePath = function () {
        var _a = this.getLocation(), start = _a.start, end = _a.end;
        return [
            ['M', start.x, start.y],
            ['L', end.x, end.y],
        ];
    };
    return LineCrosshair;
}(base_1.default));
exports.default = LineCrosshair;

},{"../util/util":77,"./base":40,"tslib":894}],47:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var theme_1 = require("../util/theme");
var GridBase = /** @class */ (function (_super) {
    tslib_1.__extends(GridBase, _super);
    function GridBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GridBase.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'grid', line: {}, alternateColor: null, capture: false, items: [], closed: false, defaultCfg: {
                line: {
                    type: 'line',
                    style: {
                        lineWidth: 1,
                        stroke: theme_1.default.lineColor,
                    },
                },
            } });
    };
    /**
     * 获取栅格线的类型
     * @return {string} 栅格线类型
     */
    GridBase.prototype.getLineType = function () {
        var line = this.get('line') || this.get('defaultCfg').line;
        return line.type;
    };
    GridBase.prototype.renderInner = function (group) {
        this.drawGrid(group);
    };
    GridBase.prototype.getAlternatePath = function (prePoints, points) {
        var regionPath = this.getGridPath(prePoints);
        var reversePoints = points.slice(0).reverse();
        var nextPath = this.getGridPath(reversePoints, true);
        var closed = this.get('closed');
        if (closed) {
            regionPath = regionPath.concat(nextPath);
        }
        else {
            nextPath[0][0] = 'L'; // 更新第一个节点
            regionPath = regionPath.concat(nextPath);
            regionPath.push(['Z']);
        }
        return regionPath;
    };
    // 获取路径的配置项
    GridBase.prototype.getPathStyle = function () {
        return this.get('line').style;
    };
    // 绘制栅格
    GridBase.prototype.drawGrid = function (group) {
        var _this = this;
        var line = this.get('line');
        var items = this.get('items');
        var alternateColor = this.get('alternateColor');
        var preItem = null;
        util_1.each(items, function (item, index) {
            var id = item.id || index;
            // 绘制栅格线
            if (line) {
                var style = _this.getPathStyle();
                var lineId = _this.getElementId("line-" + id);
                var gridPath = _this.getGridPath(item.points);
                _this.addShape(group, {
                    type: 'path',
                    name: 'grid-line',
                    id: lineId,
                    attrs: util_1.mix({
                        path: gridPath,
                    }, style),
                });
            }
            // 如果存在 alternateColor 则绘制矩形
            // 从第二个栅格线开始绘制
            if (alternateColor && index > 0) {
                var regionId = _this.getElementId("region-" + id);
                var isEven = index % 2 === 0;
                if (util_1.isString(alternateColor)) {
                    // 如果颜色是单值，则是仅绘制偶数时的区域
                    if (isEven) {
                        _this.drawAlternateRegion(regionId, group, preItem.points, item.points, alternateColor);
                    }
                }
                else {
                    var color = isEven ? alternateColor[1] : alternateColor[0];
                    _this.drawAlternateRegion(regionId, group, preItem.points, item.points, color);
                }
            }
            preItem = item;
        });
    };
    // 绘制栅格线间的间隔
    GridBase.prototype.drawAlternateRegion = function (id, group, prePoints, points, color) {
        var regionPath = this.getAlternatePath(prePoints, points);
        this.addShape(group, {
            type: 'path',
            id: id,
            name: 'grid-region',
            attrs: {
                path: regionPath,
                fill: color,
            },
        });
    };
    return GridBase;
}(group_component_1.default));
exports.default = GridBase;

},{"../abstract/group-component":21,"../util/theme":76,"@antv/util":803,"tslib":894}],48:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
function distance(x1, y1, x2, y2) {
    var dx = x2 - x1;
    var dy = y2 - y1;
    return Math.sqrt(dx * dx + dy * dy);
}
var Circle = /** @class */ (function (_super) {
    tslib_1.__extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'circle', 
            /**
             * 中心点
             * @type {object}
             */
            center: null, 
            /**
             * 栅格线是否封闭
             * @type {true}
             */
            closed: true });
    };
    Circle.prototype.getGridPath = function (points, reversed) {
        var lineType = this.getLineType();
        var closed = this.get('closed');
        var path = [];
        if (points.length) {
            // 防止出错
            if (lineType === 'circle') {
                var center = this.get('center');
                var firstPoint = points[0];
                var radius_1 = distance(center.x, center.y, firstPoint.x, firstPoint.y);
                var sweepFlag_1 = reversed ? 0 : 1; // 顺时针还是逆时针
                if (closed) {
                    // 封闭时，绘制整个圆
                    path.push(['M', center.x, center.y - radius_1]);
                    path.push(['A', radius_1, radius_1, 0, 0, sweepFlag_1, center.x, center.y + radius_1]);
                    path.push(['A', radius_1, radius_1, 0, 0, sweepFlag_1, center.x, center.y - radius_1]);
                    path.push(['Z']);
                }
                else {
                    util_1.each(points, function (point, index) {
                        if (index === 0) {
                            path.push(['M', point.x, point.y]);
                        }
                        else {
                            path.push(['A', radius_1, radius_1, 0, 0, sweepFlag_1, point.x, point.y]);
                        }
                    });
                }
            }
            else {
                util_1.each(points, function (point, index) {
                    if (index === 0) {
                        path.push(['M', point.x, point.y]);
                    }
                    else {
                        path.push(['L', point.x, point.y]);
                    }
                });
                if (closed) {
                    path.push(['Z']);
                }
            }
        }
        return path;
    };
    return Circle;
}(base_1.default));
exports.default = Circle;

},{"./base":47,"@antv/util":803,"tslib":894}],49:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } });
var circle_1 = require("./circle");
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.default; } });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });

},{"./base":47,"./circle":48,"./line":50}],50:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Line.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'line' });
    };
    Line.prototype.getGridPath = function (points) {
        var path = [];
        util_1.each(points, function (point, index) {
            if (index === 0) {
                path.push(['M', point.x, point.y]);
            }
            else {
                path.push(['L', point.x, point.y]);
            }
        });
        return path;
    };
    return Line;
}(base_1.default));
exports.default = Line;

},{"./base":47,"@antv/util":803,"tslib":894}],51:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Crosshair = exports.Tooltip = exports.Legend = exports.Grid = exports.Annotation = exports.Axis = void 0;
var Annotation = require("./annotation");
exports.Annotation = Annotation;
var Axis = require("./axis");
exports.Axis = Axis;
var Crosshair = require("./crosshair");
exports.Crosshair = Crosshair;
var Grid = require("./grid");
exports.Grid = Grid;
var Legend = require("./legend");
exports.Legend = Legend;
var Tooltip = require("./tooltip");
exports.Tooltip = Tooltip;
var component_1 = require("./abstract/component");
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return component_1.default; } });
var group_component_1 = require("./abstract/group-component");
Object.defineProperty(exports, "GroupComponent", { enumerable: true, get: function () { return group_component_1.default; } });
var html_component_1 = require("./abstract/html-component");
Object.defineProperty(exports, "HtmlComponent", { enumerable: true, get: function () { return html_component_1.default; } });
var slider_1 = require("./slider");
Object.defineProperty(exports, "Slider", { enumerable: true, get: function () { return slider_1.Slider; } });
var scrollbar_1 = require("./scrollbar");
Object.defineProperty(exports, "Scrollbar", { enumerable: true, get: function () { return scrollbar_1.Scrollbar; } });

},{"./abstract/component":20,"./abstract/group-component":21,"./abstract/html-component":22,"./annotation":27,"./axis":34,"./crosshair":45,"./grid":49,"./legend":55,"./scrollbar":56,"./slider":60,"./tooltip":65}],52:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var util_1 = require("../util/util");
var LegendBase = /** @class */ (function (_super) {
    tslib_1.__extends(LegendBase, _super);
    function LegendBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LegendBase.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'legend', 
            /**
             * 布局方式： horizontal，vertical
             * @type {String}
             */
            layout: 'horizontal', locationType: 'point', x: 0, y: 0, offsetX: 0, offsetY: 0, title: null, background: null });
    };
    LegendBase.prototype.getLayoutBBox = function () {
        var bbox = _super.prototype.getLayoutBBox.call(this);
        var x = this.get('x');
        var y = this.get('y');
        var offsetX = this.get('offsetX');
        var offsetY = this.get('offsetY');
        var maxWidth = this.get('maxWidth');
        var maxHeight = this.get('maxHeight');
        var minX = x + offsetX;
        var minY = y + offsetY;
        var width = bbox.maxX - minX;
        var height = bbox.maxY - minY;
        if (maxWidth) {
            width = Math.min(width, maxWidth);
        }
        if (maxHeight) {
            height = Math.min(height, maxHeight);
        }
        return util_1.createBBox(minX, minY, width, height);
    };
    LegendBase.prototype.setLocation = function (cfg) {
        this.set('x', cfg.x);
        this.set('y', cfg.y);
        this.resetLocation();
    };
    LegendBase.prototype.resetLocation = function () {
        var x = this.get('x');
        var y = this.get('y');
        var offsetX = this.get('offsetX');
        var offsetY = this.get('offsetY');
        this.moveElementTo(this.get('group'), {
            x: x + offsetX,
            y: y + offsetY,
        });
    };
    LegendBase.prototype.applyOffset = function () {
        this.resetLocation();
    };
    // 获取当前绘制的点
    LegendBase.prototype.getDrawPoint = function () {
        return this.get('currentPoint');
    };
    LegendBase.prototype.setDrawPoint = function (point) {
        return this.set('currentPoint', point);
    };
    // 复写父类定义的绘制方法
    LegendBase.prototype.renderInner = function (group) {
        this.resetDraw();
        if (this.get('title')) {
            this.drawTitle(group);
        }
        this.drawLegendContent(group);
        if (this.get('background')) {
            this.drawBackground(group);
        }
        // this.resetLocation(); // 在顶层已经在处理偏移时一起处理了
    };
    // 绘制背景
    LegendBase.prototype.drawBackground = function (group) {
        var background = this.get('background');
        var bbox = group.getBBox();
        var padding = util_1.formatPadding(background.padding);
        var attrs = tslib_1.__assign({ 
            // 背景从 (0,0) 开始绘制
            x: 0, y: 0, width: bbox.width + padding[1] + padding[3], height: bbox.height + padding[0] + padding[2] }, background.style);
        var backgroundShape = this.addShape(group, {
            type: 'rect',
            id: this.getElementId('background'),
            name: 'legend-background',
            attrs: attrs,
        });
        backgroundShape.toBack();
    };
    // 绘制标题，标题在图例项的上面
    LegendBase.prototype.drawTitle = function (group) {
        var currentPoint = this.get('currentPoint');
        var titleCfg = this.get('title');
        var spacing = titleCfg.spacing, style = titleCfg.style, text = titleCfg.text;
        var shape = this.addShape(group, {
            type: 'text',
            id: this.getElementId('title'),
            name: 'legend-title',
            attrs: tslib_1.__assign({ text: text, x: currentPoint.x, y: currentPoint.y }, style),
        });
        var bbox = shape.getBBox();
        // 标题单独在一行
        this.set('currentPoint', { x: currentPoint.x, y: bbox.maxY + spacing });
    };
    // 重置绘制时开始的位置，如果绘制边框，考虑边框的 padding
    LegendBase.prototype.resetDraw = function () {
        var background = this.get('background');
        var currentPoint = { x: 0, y: 0 };
        if (background) {
            var padding = util_1.formatPadding(background.padding);
            currentPoint.x = padding[3]; // 左边 padding
            currentPoint.y = padding[0]; // 上面 padding
        }
        this.set('currentPoint', currentPoint); // 设置绘制的初始位置
    };
    return LegendBase;
}(group_component_1.default));
exports.default = LegendBase;

},{"../abstract/group-component":21,"../util/util":77,"tslib":894}],53:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var label_1 = require("../util/label");
var matrix_1 = require("../util/matrix");
var state_1 = require("../util/state");
var theme_1 = require("../util/theme");
var base_1 = require("./base");
var Category = /** @class */ (function (_super) {
    tslib_1.__extends(Category, _super);
    function Category() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.currentPageIndex = 1;
        _this.totalPagesCnt = 1;
        _this.pageWidth = 0;
        _this.pageHeight = 0;
        _this.startX = 0;
        _this.startY = 0;
        _this.onNavigationBack = function () {
            var itemGroup = _this.getElementByLocalId('item-group');
            if (_this.currentPageIndex > 1) {
                _this.currentPageIndex -= 1;
                _this.updateNavigation();
                var matrix = _this.getCurrentNavigationMatrix();
                if (_this.get('animate')) {
                    itemGroup.animate({
                        matrix: matrix,
                    }, 100);
                }
                else {
                    itemGroup.attr({ matrix: matrix });
                }
            }
        };
        _this.onNavigationAfter = function () {
            var itemGroup = _this.getElementByLocalId('item-group');
            if (_this.currentPageIndex < _this.totalPagesCnt) {
                _this.currentPageIndex += 1;
                _this.updateNavigation();
                var matrix = _this.getCurrentNavigationMatrix();
                if (_this.get('animate')) {
                    itemGroup.animate({
                        matrix: matrix,
                    }, 100);
                }
                else {
                    itemGroup.attr({ matrix: matrix });
                }
            }
        };
        return _this;
    }
    Category.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'legend', type: 'category', itemSpacing: 24, maxItemWidth: null, itemWidth: null, itemHeight: null, itemName: {}, itemValue: null, maxWidth: null, maxHeight: null, marker: {}, items: [], itemStates: {}, itemBackground: {}, defaultCfg: {
                title: {
                    spacing: 5,
                    style: {
                        fill: theme_1.default.textColor,
                        fontSize: 12,
                        textAlign: 'start',
                        textBaseline: 'top',
                    },
                },
                background: {
                    padding: 5,
                    style: {
                        stroke: theme_1.default.lineColor,
                    },
                },
                itemBackground: {
                    style: {
                        opacity: 0,
                        fill: '#fff',
                    },
                },
                itemName: {
                    spacing: 16,
                    style: {
                        fill: theme_1.default.textColor,
                        fontSize: 12,
                        textAlign: 'start',
                        textBaseline: 'middle',
                    },
                },
                marker: {
                    spacing: 8,
                    style: {
                        r: 6,
                        symbol: 'circle',
                    },
                },
                itemValue: {
                    alignRight: false,
                    formatter: null,
                    style: {
                        fill: theme_1.default.textColor,
                        fontSize: 12,
                        textAlign: 'start',
                        textBaseline: 'middle',
                    },
                },
                itemStates: {
                    active: {
                        nameStyle: {
                            opacity: 0.8,
                        },
                    },
                    unchecked: {
                        nameStyle: {
                            fill: theme_1.default.uncheckedColor,
                        },
                        markerStyle: {
                            fill: theme_1.default.uncheckedColor,
                            stroke: theme_1.default.uncheckedColor,
                        },
                    },
                    inactive: {
                        nameStyle: {
                            fill: theme_1.default.uncheckedColor,
                        },
                        markerStyle: {
                            opacity: 0.2,
                        },
                    },
                },
            } });
    };
    // 实现 IList 接口
    Category.prototype.isList = function () {
        return true;
    };
    /**
     * 获取图例项
     * @return {ListItem[]} 列表项集合
     */
    Category.prototype.getItems = function () {
        return this.get('items');
    };
    /**
     * 设置列表项
     * @param {ListItem[]} items 列表项集合
     */
    Category.prototype.setItems = function (items) {
        this.update({
            items: items,
        });
    };
    /**
     * 更新列表项
     * @param {ListItem} item 列表项
     * @param {object}   cfg  列表项
     */
    Category.prototype.updateItem = function (item, cfg) {
        util_1.mix(item, cfg);
        this.clear(); // 由于单个图例项变化，会引起全局变化，所以全部更新
        this.render();
    };
    /**
     * 清空列表
     */
    Category.prototype.clearItems = function () {
        var itemGroup = this.getElementByLocalId('item-group');
        itemGroup && itemGroup.clear();
    };
    /**
     * 设置列表项的状态
     * @param {ListItem} item  列表项
     * @param {string}   state 状态名
     * @param {boolean}  value 状态值, true, false
     */
    Category.prototype.setItemState = function (item, state, value) {
        item[state] = value;
        var itemElement = this.getElementByLocalId("item-" + item.id);
        if (itemElement) {
            var items = this.getItems();
            var index = items.indexOf(item);
            var offsetGroup = this.createOffScreenGroup(); // 离屏的 group
            var newElement = this.drawItem(item, index, this.getItemHeight(), offsetGroup);
            this.updateElements(newElement, itemElement); // 更新整个分组
            this.clearUpdateStatus(itemElement); // 清理更新状态，防止出现 bug
        }
    };
    /**
     * 是否存在指定的状态
     * @param {ListItem} item  列表项
     * @param {boolean} state 状态名
     */
    Category.prototype.hasState = function (item, state) {
        return !!item[state];
    };
    Category.prototype.getItemStates = function (item) {
        var itemStates = this.get('itemStates');
        var rst = [];
        util_1.each(itemStates, function (v, k) {
            if (item[k]) {
                // item.selected
                rst.push(k);
            }
        });
        return rst;
    };
    /**
     * 清楚所有列表项的状态
     * @param {string} state 状态值
     */
    Category.prototype.clearItemsState = function (state) {
        var _this = this;
        var items = this.getItemsByState(state);
        util_1.each(items, function (item) {
            _this.setItemState(item, state, false);
        });
    };
    /**
     * 根据状态获取图例项
     * @param  {string}     state [description]
     * @return {ListItem[]}       [description]
     */
    Category.prototype.getItemsByState = function (state) {
        var _this = this;
        var items = this.getItems();
        return util_1.filter(items, function (item) {
            return _this.hasState(item, state);
        });
    };
    // 绘制 legend 的选项
    Category.prototype.drawLegendContent = function (group) {
        this.processItems();
        this.drawItems(group);
    };
    // 防止未设置 id
    Category.prototype.processItems = function () {
        var items = this.get('items');
        util_1.each(items, function (item) {
            if (!item.id) {
                // 如果没有设置 id，默认使用 name
                item.id = item.name;
            }
        });
    };
    // 绘制所有的图例选项
    Category.prototype.drawItems = function (group) {
        var _this = this;
        var itemContainerGroup = this.addGroup(group, {
            id: this.getElementId('item-container-group'),
            name: 'legend-item-container-group',
        });
        var itemGroup = this.addGroup(itemContainerGroup, {
            id: this.getElementId('item-group'),
            name: 'legend-item-group',
        });
        var itemHeight = this.getItemHeight();
        var itemWidth = this.get('itemWidth');
        var itemSpacing = this.get('itemSpacing');
        var currentPoint = this.get('currentPoint');
        var startX = currentPoint.x;
        var startY = currentPoint.y;
        var layout = this.get('layout');
        var items = this.get('items');
        var wrapped = false;
        var pageWidth = 0;
        var maxWidth = this.get('maxWidth'); // 最大宽度，会导致 layout : 'horizontal' 时自动换行
        var maxHeight = this.get('maxHeight'); // 最大高度，会导致出现分页
        // 暂时不考虑分页
        util_1.each(items, function (item, index) {
            var subGroup = _this.drawItem(item, index, itemHeight, itemGroup);
            var bbox = subGroup.getBBox();
            var width = itemWidth || bbox.width;
            if (width > pageWidth) {
                pageWidth = width;
            }
            if (layout === 'horizontal') {
                // 如果水平布局
                if (maxWidth && maxWidth < currentPoint.x + width - startX) {
                    // 检测是否换行
                    wrapped = true;
                    currentPoint.x = startX;
                    currentPoint.y += itemHeight;
                }
                _this.moveElementTo(subGroup, currentPoint);
                currentPoint.x += width + itemSpacing;
            }
            else {
                // 如果垂直布局
                if (maxHeight && maxHeight < currentPoint.y + itemHeight - startY) {
                    // 换行
                    wrapped = true;
                    currentPoint.x += pageWidth + itemSpacing;
                    currentPoint.y = startY;
                    pageWidth = 0;
                }
                _this.moveElementTo(subGroup, currentPoint);
                currentPoint.y += itemHeight; // itemSpacing 仅影响水平间距
            }
        });
        if (wrapped && this.get('flipPage')) {
            this.pageHeight = 0;
            this.pageWidth = 0;
            this.totalPagesCnt = 1;
            this.startX = startX;
            this.startY = startY;
            this.adjustNavigation(group, itemGroup);
        }
    };
    // 获取图例项的高度，如果未定义，则按照 name 的高度计算
    Category.prototype.getItemHeight = function () {
        var itemHeight = this.get('itemHeight');
        if (!itemHeight) {
            var nameCfg = this.get('itemName');
            if (nameCfg) {
                itemHeight = nameCfg.style.fontSize + 8;
            }
        }
        return itemHeight;
    };
    // 绘制 marker
    Category.prototype.drawMarker = function (container, markerCfg, item, itemHeight) {
        var markerAttrs = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: 0, y: itemHeight / 2 }, markerCfg.style), { symbol: util_1.get(item.marker, 'symbol', 'circle') }), util_1.get(item.marker, 'style', {}));
        var shape = this.addShape(container, {
            type: 'marker',
            id: this.getElementId("item-" + item.id + "-marker"),
            name: 'legend-item-marker',
            attrs: markerAttrs,
        });
        var bbox = shape.getBBox();
        shape.attr('x', bbox.width / 2); // marker 需要左对齐，所以不能占用左侧的空间
        var _a = shape.attr(), stroke = _a.stroke, fill = _a.fill;
        if (stroke) {
            shape.set('isStroke', true);
        }
        if (fill) {
            shape.set('isFill', true);
        }
        return shape;
    };
    // 绘制文本
    Category.prototype.drawItemText = function (container, textName, cfg, item, itemHeight, xPosition, index) {
        var formatter = cfg.formatter;
        var attrs = tslib_1.__assign({ x: xPosition, y: itemHeight / 2, text: formatter ? formatter(item[textName], item, index) : item[textName] }, cfg.style);
        return this.addShape(container, {
            type: 'text',
            id: this.getElementId("item-" + item.id + "-" + textName),
            name: "legend-item-" + textName,
            attrs: attrs,
        });
    };
    // 绘制图例项
    Category.prototype.drawItem = function (item, index, itemHeight, itemGroup) {
        var groupId = "item-" + item.id;
        // 设置单独的 Group 用于 setClip
        var subContainer = this.addGroup(itemGroup, {
            name: 'legend-item-container',
            id: this.getElementId("item-container-" + groupId),
            delegateObject: {
                item: item,
                index: index,
            },
        });
        var subGroup = this.addGroup(subContainer, {
            name: 'legend-item',
            id: this.getElementId(groupId),
            delegateObject: {
                item: item,
                index: index,
            },
        });
        var marker = this.get('marker');
        var itemName = this.get('itemName');
        var itemValue = this.get('itemValue');
        var itemBackground = this.get('itemBackground');
        var itemWidth = this.getLimitItemWidth();
        var curX = 0; // 记录当前 x 的位置
        if (marker) {
            var markerShape = this.drawMarker(subGroup, marker, item, itemHeight);
            curX = markerShape.getBBox().maxX + marker.spacing;
        }
        if (itemName) {
            var nameShape = this.drawItemText(subGroup, 'name', itemName, item, itemHeight, curX, index);
            if (itemWidth) {
                // 设置了 item 的最大宽度限制，并且超出了，进行省略处理
                label_1.ellipsisLabel(true, nameShape, util_1.clamp(itemWidth - curX, 0, itemWidth));
            }
            curX = nameShape.getBBox().maxX + itemName.spacing;
        }
        if (itemValue) {
            var valueShape = this.drawItemText(subGroup, 'value', itemValue, item, itemHeight, curX, index);
            if (itemWidth) {
                if (itemValue.alignRight) {
                    valueShape.attr({
                        textAlign: 'right',
                        x: itemWidth,
                    });
                    label_1.ellipsisLabel(true, valueShape, util_1.clamp(itemWidth - curX, 0, itemWidth), 'head');
                }
                else {
                    label_1.ellipsisLabel(true, valueShape, util_1.clamp(itemWidth - curX, 0, itemWidth));
                }
            }
        }
        // 添加透明的背景，便于拾取和包围盒计算
        if (itemBackground) {
            var bbox = subGroup.getBBox();
            var backShape = this.addShape(subGroup, {
                type: 'rect',
                name: 'legend-item-background',
                id: this.getElementId(groupId + "-background"),
                attrs: tslib_1.__assign({ x: 0, y: 0, width: bbox.width, height: itemHeight }, itemBackground.style),
            });
            backShape.toBack();
        }
        this.applyItemStates(item, subGroup);
        return subGroup;
    };
    // 加上分页器并重新排序 items
    Category.prototype.adjustNavigation = function (container, itemGroup) {
        var _this = this;
        var startX = this.startX;
        var startY = this.startY;
        var layout = this.get('layout');
        var subGroups = itemGroup.findAll(function (item) { return item.get('name') === 'legend-item'; });
        var maxWidth = this.get('maxWidth');
        var maxHeight = this.get('maxHeight');
        var itemWidth = this.get('itemWidth');
        var itemSpacing = this.get('itemSpacing');
        var itemHeight = this.getItemHeight();
        var navigation = this.drawNavigation(container, layout, '00/00', 12);
        var navigationBBox = navigation.getBBox();
        var currentPoint = { x: startX, y: startY };
        var pages = 1;
        var widthLimit = 0;
        var pageWidth = 0;
        var maxItemWidth = 0;
        if (layout === 'horizontal') {
            this.pageHeight = itemHeight;
            util_1.each(subGroups, function (item) {
                var bbox = item.getBBox();
                var width = itemWidth || bbox.width;
                if ((widthLimit && widthLimit < currentPoint.x + width + itemSpacing) ||
                    maxWidth < currentPoint.x + width + itemSpacing + navigationBBox.width) {
                    if (pages === 1) {
                        widthLimit = currentPoint.x + itemSpacing;
                        _this.pageWidth = widthLimit;
                        _this.moveElementTo(navigation, {
                            x: maxWidth - itemSpacing - navigationBBox.width - navigationBBox.minX,
                            y: currentPoint.y + itemHeight / 2 - navigationBBox.height / 2 - navigationBBox.minY,
                        });
                    }
                    pages += 1;
                    currentPoint.x = startX;
                    currentPoint.y += itemHeight;
                }
                _this.moveElementTo(item, currentPoint);
                item.getParent().setClip({
                    type: 'rect',
                    attrs: {
                        x: currentPoint.x,
                        y: currentPoint.y,
                        width: width + itemSpacing,
                        height: itemHeight,
                    },
                });
                currentPoint.x += width + itemSpacing;
            });
        }
        else {
            util_1.each(subGroups, function (item) {
                var bbox = item.getBBox();
                if (bbox.width > pageWidth) {
                    pageWidth = bbox.width;
                }
            });
            maxItemWidth = pageWidth;
            pageWidth += itemSpacing;
            if (maxWidth) {
                // maxWidth 限制加上
                pageWidth = Math.min(maxWidth, pageWidth);
                maxItemWidth = Math.min(maxWidth, maxItemWidth);
            }
            this.pageWidth = pageWidth;
            this.pageHeight = maxHeight - Math.max(navigationBBox.height, itemHeight);
            var cntPerPage_1 = Math.floor(this.pageHeight / itemHeight);
            util_1.each(subGroups, function (item, index) {
                if (index !== 0 && index % cntPerPage_1 === 0) {
                    pages += 1;
                    currentPoint.x += pageWidth;
                    currentPoint.y = startY;
                }
                _this.moveElementTo(item, currentPoint);
                item.getParent().setClip({
                    type: 'rect',
                    attrs: {
                        x: currentPoint.x,
                        y: currentPoint.y,
                        width: pageWidth,
                        height: itemHeight,
                    },
                });
                currentPoint.y += itemHeight;
            });
            this.totalPagesCnt = pages;
            this.moveElementTo(navigation, {
                x: startX + maxItemWidth / 2 - navigationBBox.width / 2 - navigationBBox.minX,
                y: maxHeight - navigationBBox.height - navigationBBox.minY,
            });
        }
        if (this.pageHeight && this.pageWidth) {
            // 为了使固定的 clip 生效，clip 设置在 itemContainerGroup 上，itemGroup 需要在翻页时会设置 matrix
            itemGroup.getParent().setClip({
                type: 'rect',
                attrs: {
                    x: this.startX,
                    y: this.startY,
                    width: this.pageWidth,
                    height: this.pageHeight,
                },
            });
        }
        this.totalPagesCnt = pages;
        if (this.currentPageIndex > this.totalPagesCnt) {
            this.currentPageIndex = 1;
        }
        this.updateNavigation(navigation);
        // update initial matrix
        itemGroup.attr('matrix', this.getCurrentNavigationMatrix());
    };
    Category.prototype.drawNavigation = function (group, layout, text, size) {
        var currentPoint = { x: 0, y: 0 };
        var subGroup = this.addGroup(group, {
            id: this.getElementId('navigation-group'),
            name: 'legend-navigation',
        });
        var leftArrow = this.drawArrow(subGroup, currentPoint, 'navigation-arrow-left', layout === 'horizontal' ? 'up' : 'left', size);
        leftArrow.on('click', this.onNavigationBack);
        var leftArrowBBox = leftArrow.getBBox();
        currentPoint.x += leftArrowBBox.width + 2;
        var textShape = this.addShape(subGroup, {
            type: 'text',
            id: this.getElementId('navigation-text'),
            name: 'navigation-text',
            attrs: {
                x: currentPoint.x,
                y: currentPoint.y + size / 2,
                text: text,
                fontSize: 12,
                fill: '#ccc',
                textBaseline: 'middle',
            },
        });
        var textBBox = textShape.getBBox();
        currentPoint.x += textBBox.width + 2;
        var rightArrow = this.drawArrow(subGroup, currentPoint, 'navigation-arrow-right', layout === 'horizontal' ? 'down' : 'right', size);
        rightArrow.on('click', this.onNavigationAfter);
        return subGroup;
    };
    Category.prototype.updateNavigation = function (navigation) {
        var text = this.currentPageIndex + "/" + this.totalPagesCnt;
        var textShape = navigation ? navigation.getChildren()[1] : this.getElementByLocalId('navigation-text');
        var leftArrow = navigation
            ? navigation.findById(this.getElementId('navigation-arrow-left'))
            : this.getElementByLocalId('navigation-arrow-left');
        var rightArrow = navigation
            ? navigation.findById(this.getElementId('navigation-arrow-right'))
            : this.getElementByLocalId('navigation-arrow-right');
        var origBBox = textShape.getBBox();
        textShape.attr('text', text);
        var newBBox = textShape.getBBox();
        textShape.attr('x', textShape.attr('x') - (newBBox.width - origBBox.width) / 2);
        leftArrow.attr('opacity', this.currentPageIndex === 1 ? 0.45 : 1);
        leftArrow.attr('cursor', this.currentPageIndex === 1 ? 'not-allowed' : 'pointer');
        rightArrow.attr('opacity', this.currentPageIndex === this.totalPagesCnt ? 0.45 : 1);
        rightArrow.attr('cursor', this.currentPageIndex === this.totalPagesCnt ? 'not-allowed' : 'pointer');
    };
    Category.prototype.drawArrow = function (group, currentPoint, name, direction, size) {
        var x = currentPoint.x, y = currentPoint.y;
        var rotateMap = {
            right: (90 * Math.PI) / 180,
            left: ((360 - 90) * Math.PI) / 180,
            up: 0,
            down: (180 * Math.PI) / 180,
        };
        var shape = this.addShape(group, {
            type: 'path',
            id: this.getElementId(name),
            name: name,
            attrs: {
                path: [['M', x + size / 2, y], ['L', x, y + size], ['L', x + size, y + size], ['Z']],
                fill: '#000',
                cursor: 'pointer',
            },
        });
        shape.attr('matrix', matrix_1.getMatrixByAngle({ x: x + size / 2, y: y + size / 2 }, rotateMap[direction]));
        return shape;
    };
    Category.prototype.getCurrentNavigationMatrix = function () {
        var _a = this, currentPageIndex = _a.currentPageIndex, pageWidth = _a.pageWidth, pageHeight = _a.pageHeight;
        var layout = this.get('layout');
        var translate = layout === 'horizontal'
            ? {
                x: 0,
                y: pageHeight * (1 - currentPageIndex),
            }
            : {
                x: pageWidth * (1 - currentPageIndex),
                y: 0,
            };
        return matrix_1.getMatrixByTranslate(translate);
    };
    // 附加状态对应的样式
    Category.prototype.applyItemStates = function (item, subGroup) {
        var states = this.getItemStates(item);
        var hasStates = states.length > 0;
        if (hasStates) {
            var children = subGroup.getChildren();
            var itemStates_1 = this.get('itemStates');
            util_1.each(children, function (element) {
                var name = element.get('name');
                var elName = name.split('-')[2]; // marker, name, value
                var statesStyle = state_1.getStatesStyle(item, elName, itemStates_1);
                if (statesStyle) {
                    element.attr(statesStyle);
                    if (elName === 'marker' && !(element.get('isStroke') && element.get('isFill'))) {
                        // 如果 marker 是单填充或者单描边的话，就不要额外添加 stroke 或这 fill 属性，否则会影响 unchecked 后的显示
                        if (element.get('isStroke')) {
                            element.attr('fill', null);
                        }
                        if (element.get('isFill')) {
                            element.attr('stroke', null);
                        }
                    }
                }
            });
        }
    };
    // 获取 itemWidth 的最终设置
    Category.prototype.getLimitItemWidth = function () {
        var itemWidth = this.get('itemWidth');
        var maxItemWidth = this.get('maxItemWidth');
        if (maxItemWidth) {
            // 设置了最大宽度
            if (itemWidth) {
                maxItemWidth = itemWidth <= maxItemWidth ? itemWidth : maxItemWidth;
            }
        }
        else if (itemWidth) {
            maxItemWidth = itemWidth;
        }
        return maxItemWidth;
    };
    return Category;
}(base_1.default));
exports.default = Category;

},{"../util/label":72,"../util/matrix":73,"../util/state":74,"../util/theme":76,"./base":52,"@antv/util":803,"tslib":894}],54:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var theme_1 = require("../util/theme");
var util_2 = require("../util/util");
var base_1 = require("./base");
var HANDLER_HEIGHT_RATIO = 1.4;
var HANDLER_TRIANGLE_RATIO = 0.4;
var ContinueLegend = /** @class */ (function (_super) {
    tslib_1.__extends(ContinueLegend, _super);
    function ContinueLegend() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ContinueLegend.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { type: 'continue', min: 0, max: 100, value: null, colors: [], track: {}, rail: {}, label: {}, handler: {}, slidable: true, tip: null, step: null, maxWidth: null, maxHeight: null, defaultCfg: {
                label: {
                    align: 'rail',
                    spacing: 5,
                    formatter: null,
                    style: {
                        fontSize: 12,
                        fill: theme_1.default.textColor,
                        textBaseline: 'middle',
                        fontFamily: theme_1.default.fontFamily,
                    },
                },
                handler: {
                    size: 10,
                    style: {
                        fill: '#fff',
                        stroke: '#333',
                    },
                },
                track: {},
                rail: {
                    type: 'color',
                    size: 20,
                    defaultLength: 100,
                    style: {
                        fill: '#DCDEE2',
                    },
                },
                title: {
                    spacing: 5,
                    style: {
                        fill: theme_1.default.textColor,
                        fontSize: 12,
                        textAlign: 'start',
                        textBaseline: 'top',
                    },
                },
            } });
    };
    ContinueLegend.prototype.isSlider = function () {
        return true;
    };
    // 实现 IList 接口
    ContinueLegend.prototype.getValue = function () {
        return this.getCurrentValue();
    };
    ContinueLegend.prototype.getRange = function () {
        return {
            min: this.get('min'),
            max: this.get('max'),
        };
    };
    // 改变 range
    ContinueLegend.prototype.setRange = function (min, max) {
        this.update({
            min: min,
            max: max,
        });
    };
    ContinueLegend.prototype.setValue = function (value) {
        var originValue = this.getValue();
        this.set('value', value);
        var group = this.get('group');
        this.resetTrackClip();
        if (this.get('slidable')) {
            this.resetHandlers(group);
        }
        this.delegateEmit('valuechanged', {
            originValue: originValue,
            value: value,
        });
    };
    ContinueLegend.prototype.initEvent = function () {
        var group = this.get('group');
        this.bindSliderEvent(group);
        this.bindRailEvent(group);
        this.bindTrackEvent(group);
    };
    ContinueLegend.prototype.drawLegendContent = function (group) {
        this.drawRail(group);
        this.drawLabels(group);
        this.fixedElements(group); // 调整各个图形位置，适应宽高的限制
        this.resetTrack(group);
        this.resetTrackClip(group);
        if (this.get('slidable')) {
            this.resetHandlers(group);
        }
    };
    ContinueLegend.prototype.bindSliderEvent = function (group) {
        this.bindHandlersEvent(group);
    };
    ContinueLegend.prototype.bindHandlersEvent = function (group) {
        var _this = this;
        group.on('legend-handler-min:drag', function (ev) {
            var minValue = _this.getValueByCanvasPoint(ev.x, ev.y);
            var currentValue = _this.getCurrentValue();
            var maxValue = currentValue[1];
            if (maxValue < minValue) {
                // 如果小于最小值，则调整最小值
                maxValue = minValue;
            }
            _this.setValue([minValue, maxValue]);
        });
        group.on('legend-handler-max:drag', function (ev) {
            var maxValue = _this.getValueByCanvasPoint(ev.x, ev.y);
            var currentValue = _this.getCurrentValue();
            var minValue = currentValue[0];
            if (minValue > maxValue) {
                // 如果小于最小值，则调整最小值
                minValue = maxValue;
            }
            _this.setValue([minValue, maxValue]);
        });
    };
    ContinueLegend.prototype.bindRailEvent = function (group) { };
    ContinueLegend.prototype.bindTrackEvent = function (group) {
        var _this = this;
        var prePoint = null;
        group.on('legend-track:dragstart', function (ev) {
            prePoint = {
                x: ev.x,
                y: ev.y,
            };
        });
        group.on('legend-track:drag', function (ev) {
            if (!prePoint) {
                return;
            }
            var preValue = _this.getValueByCanvasPoint(prePoint.x, prePoint.y);
            var curValue = _this.getValueByCanvasPoint(ev.x, ev.y);
            var currentValue = _this.getCurrentValue();
            var curDiff = currentValue[1] - currentValue[0];
            var range = _this.getRange();
            var dValue = curValue - preValue;
            if (dValue < 0) {
                // 减小, 同时未出边界
                if (currentValue[0] + dValue > range.min) {
                    _this.setValue([currentValue[0] + dValue, currentValue[1] + dValue]);
                }
                else {
                    _this.setValue([range.min, range.min + curDiff]);
                }
                //  && ||
            }
            else if (dValue > 0) {
                if (dValue > 0 && currentValue[1] + dValue < range.max) {
                    _this.setValue([currentValue[0] + dValue, currentValue[1] + dValue]);
                }
                else {
                    _this.setValue([range.max - curDiff, range.max]);
                }
            }
            prePoint = {
                x: ev.x,
                y: ev.y,
            };
        });
        group.on('legend-track:dragend', function (ev) {
            prePoint = null;
        });
    };
    ContinueLegend.prototype.drawLabels = function (group) {
        this.drawLabel('min', group);
        this.drawLabel('max', group);
    };
    ContinueLegend.prototype.drawLabel = function (name, group) {
        var labelCfg = this.get('label');
        var style = labelCfg.style;
        var labelAlign = labelCfg.align;
        var value = this.get(name);
        var alignAttrs = this.getLabelAlignAttrs(name, labelAlign);
        var localId = "label-" + name;
        this.addShape(group, {
            type: 'text',
            id: this.getElementId(localId),
            name: "legend-label-" + name,
            attrs: tslib_1.__assign(tslib_1.__assign({ x: 0, y: 0, text: value }, style), alignAttrs),
        });
    };
    // 获取文本的对齐方式，为了自适应真实操碎了心
    ContinueLegend.prototype.getLabelAlignAttrs = function (name, align) {
        var isVertical = this.isVertical();
        var textAlign = 'center';
        var textBaseline = 'middle';
        if (isVertical) {
            // 垂直布局的所有的文本都左对齐
            textAlign = 'start';
            if (align !== 'rail') {
                if (name === 'min') {
                    textBaseline = 'top';
                }
                else {
                    textBaseline = 'bottom';
                }
            }
            else {
                textBaseline = 'top';
            }
        }
        else {
            if (align !== 'rail') {
                textBaseline = 'top';
                if (name === 'min') {
                    textAlign = 'start';
                }
                else {
                    textAlign = 'end';
                }
            }
            else {
                textAlign = 'start';
                textBaseline = 'middle';
            }
        }
        return {
            textAlign: textAlign,
            textBaseline: textBaseline,
        };
    };
    ContinueLegend.prototype.getRailPath = function (x, y, w, h) {
        var railCfg = this.get('rail');
        var size = railCfg.size, defaultLength = railCfg.defaultLength, type = railCfg.type;
        var isVertical = this.isVertical();
        var length = defaultLength;
        var width = w;
        var height = h;
        if (!width) {
            width = isVertical ? size : length;
        }
        if (!height) {
            height = isVertical ? length : size;
        }
        var path = [];
        if (type === 'color') {
            path.push(['M', x, y]);
            path.push(['L', x + width, y]);
            path.push(['L', x + width, y + height]);
            path.push(['L', x, y + height]);
            path.push(['Z']);
        }
        else {
            path.push(['M', x + width, y]);
            path.push(['L', x + width, y + height]);
            path.push(['L', x, y + height]);
            path.push(['Z']);
        }
        return path;
    };
    ContinueLegend.prototype.drawRail = function (group) {
        var railCfg = this.get('rail');
        var style = railCfg.style;
        this.addShape(group, {
            type: 'path',
            id: this.getElementId('rail'),
            name: 'legend-rail',
            attrs: tslib_1.__assign({ path: this.getRailPath(0, 0) }, style),
        });
    };
    // 将传入的颜色转换成渐变色
    ContinueLegend.prototype.getTrackColor = function (colors) {
        var count = colors.length;
        if (!count) {
            return null;
        }
        if (count === 1) {
            return colors[0];
        }
        var color; // 最终形态 l(0) 0:colors[0] 0.5:colors[1] 1:colors[2];
        if (this.isVertical()) {
            // 根据方向设置渐变方向
            color = 'l(90)';
        }
        else {
            color = 'l(0)';
        }
        for (var i = 0; i < count; i++) {
            var percent = i / (count - 1);
            color += " " + percent + ":" + colors[i];
        }
        return color;
    };
    ContinueLegend.prototype.getTrackPath = function (group) {
        var railShape = this.getRailShape(group);
        var path = railShape.attr('path');
        return util_1.clone(path);
    };
    ContinueLegend.prototype.getClipTrackAttrs = function (group) {
        var value = this.getCurrentValue();
        var min = value[0], max = value[1];
        var railBBox = this.getRailBBox(group);
        var startPoint = this.getPointByValue(min, group);
        var endPoint = this.getPointByValue(max, group);
        var isVertical = this.isVertical();
        var x;
        var y;
        var width;
        var height;
        if (isVertical) {
            x = railBBox.minX;
            y = startPoint.y;
            width = railBBox.width;
            height = endPoint.y - startPoint.y;
        }
        else {
            x = startPoint.x;
            y = railBBox.minY;
            width = endPoint.x - startPoint.x;
            height = railBBox.height;
        }
        return {
            x: x,
            y: y,
            width: width,
            height: height,
        };
    };
    // 获取 track 的属性，由 path 和 颜色构成
    ContinueLegend.prototype.getTrackAttrs = function (group) {
        var trackCfg = this.get('track');
        var colors = this.get('colors');
        var path = this.getTrackPath(group);
        return util_1.mix({
            path: path,
            fill: this.getTrackColor(colors),
        }, trackCfg.style);
    };
    ContinueLegend.prototype.resetTrackClip = function (group) {
        var container = group || this.get('group');
        var trackId = this.getElementId('track');
        var trackShape = container.findById(trackId);
        var clipShape = trackShape.getClip();
        var attrs = this.getClipTrackAttrs(group);
        if (!clipShape) {
            trackShape.setClip({
                type: 'rect',
                attrs: attrs,
            });
        }
        else {
            clipShape.attr(attrs);
        }
    };
    ContinueLegend.prototype.resetTrack = function (group) {
        var trackId = this.getElementId('track');
        var trackShape = group.findById(trackId);
        var trackAttrs = this.getTrackAttrs(group);
        if (trackShape) {
            trackShape.attr(trackAttrs);
        }
        else {
            this.addShape(group, {
                type: 'path',
                id: trackId,
                draggable: this.get('slidable'),
                name: 'legend-track',
                attrs: trackAttrs,
            });
        }
    };
    ContinueLegend.prototype.getPointByValue = function (value, group) {
        var _a = this.getRange(), min = _a.min, max = _a.max;
        var percent = (value - min) / (max - min);
        var bbox = this.getRailBBox(group);
        var isVertcal = this.isVertical();
        var point = { x: 0, y: 0 };
        if (isVertcal) {
            point.x = bbox.minX + bbox.width / 2;
            point.y = util_2.getValueByPercent(bbox.minY, bbox.maxY, percent);
        }
        else {
            point.x = util_2.getValueByPercent(bbox.minX, bbox.maxX, percent);
            point.y = bbox.minY + bbox.height / 2;
        }
        return point;
    };
    ContinueLegend.prototype.getRailShape = function (group) {
        var container = group || this.get('group');
        return container.findById(this.getElementId('rail'));
    };
    // 获取滑轨的宽高信息
    ContinueLegend.prototype.getRailBBox = function (group) {
        var railShape = this.getRailShape(group);
        var bbox = railShape.getBBox();
        return bbox;
    };
    ContinueLegend.prototype.getRailCanvasBBox = function () {
        var container = this.get('group');
        var railShape = container.findById(this.getElementId('rail'));
        var bbox = railShape.getCanvasBBox();
        return bbox;
    };
    // 是否垂直
    ContinueLegend.prototype.isVertical = function () {
        return this.get('layout') === 'vertical';
    };
    // 用于交互时
    ContinueLegend.prototype.getValueByCanvasPoint = function (x, y) {
        var _a = this.getRange(), min = _a.min, max = _a.max;
        var bbox = this.getRailCanvasBBox(); // 因为 x, y 是画布坐标
        var isVertcal = this.isVertical();
        var step = this.get('step');
        var percent;
        if (isVertcal) {
            // 垂直时计算 y
            percent = (y - bbox.minY) / bbox.height;
        }
        else {
            // 水平时计算 x
            percent = (x - bbox.minX) / bbox.width;
        }
        var value = util_2.getValueByPercent(min, max, percent);
        if (step) {
            var count = Math.round((value - min) / step);
            value = min + count * step; // 移动到最近的
        }
        if (value > max) {
            value = max;
        }
        if (value < min) {
            value = min;
        }
        return value;
    };
    // 当前选中的范围
    ContinueLegend.prototype.getCurrentValue = function () {
        var value = this.get('value');
        if (!value) {
            // 如果没有定义，取最大范围
            value = [this.get('min'), this.get('max')];
        }
        return value;
    };
    // 重置滑块 handler
    ContinueLegend.prototype.resetHandlers = function (group) {
        var currentValue = this.getCurrentValue();
        var min = currentValue[0], max = currentValue[1];
        this.resetHandler(group, 'min', min);
        this.resetHandler(group, 'max', max);
    };
    // 获取滑块的 path
    ContinueLegend.prototype.getHandlerPath = function (handlerCfg, point) {
        var isVertical = this.isVertical();
        var path = [];
        var width = handlerCfg.size;
        var x = point.x, y = point.y;
        var height = width * HANDLER_HEIGHT_RATIO;
        var halfWidth = width / 2;
        var oneSixthWidth = width / 6;
        if (isVertical) {
            /**
             * 竖直情况下的滑块 handler，左侧顶点是 x,y
             *  /----|
             *    -- |
             *    -- |
             *  \----|
             */
            var triangleX = x + height * HANDLER_TRIANGLE_RATIO;
            path.push(['M', x, y]);
            path.push(['L', triangleX, y + halfWidth]);
            path.push(['L', x + height, y + halfWidth]);
            path.push(['L', x + height, y - halfWidth]);
            path.push(['L', triangleX, y - halfWidth]);
            path.push(['Z']);
            // 绘制两条横线
            path.push(['M', triangleX, y + oneSixthWidth]);
            path.push(['L', x + height - 2, y + oneSixthWidth]);
            path.push(['M', triangleX, y - oneSixthWidth]);
            path.push(['L', x + height - 2, y - oneSixthWidth]);
        }
        else {
            /**
             * 水平情况下的滑块，上面顶点处是 x,y
             *  /   \
             * | | | |
             * | | | |
             *  -----
             */
            var triangleY = y + height * HANDLER_TRIANGLE_RATIO;
            path.push(['M', x, y]);
            path.push(['L', x - halfWidth, triangleY]);
            path.push(['L', x - halfWidth, y + height]);
            path.push(['L', x + halfWidth, y + height]);
            path.push(['L', x + halfWidth, triangleY]);
            path.push(['Z']);
            // 绘制两条竖线
            path.push(['M', x - oneSixthWidth, triangleY]);
            path.push(['L', x - oneSixthWidth, y + height - 2]);
            path.push(['M', x + oneSixthWidth, triangleY]);
            path.push(['L', x + oneSixthWidth, y + height - 2]);
        }
        return path;
    };
    // 调整 handler 的位置，如果未存在则绘制
    ContinueLegend.prototype.resetHandler = function (group, name, value) {
        var point = this.getPointByValue(value, group);
        var handlerCfg = this.get('handler');
        var path = this.getHandlerPath(handlerCfg, point);
        var id = this.getElementId("handler-" + name);
        var handlerShape = group.findById(id);
        var isVertical = this.isVertical();
        if (handlerShape) {
            handlerShape.attr('path', path);
        }
        else {
            this.addShape(group, {
                type: 'path',
                name: "legend-handler-" + name,
                draggable: true,
                id: id,
                attrs: tslib_1.__assign(tslib_1.__assign({ path: path }, handlerCfg.style), { cursor: isVertical ? 'ns-resize' : 'ew-resize' }),
            });
        }
    };
    // 当设置了 maxWidth, maxHeight 时调整 rail 的宽度，
    // 文本的位置
    ContinueLegend.prototype.fixedElements = function (group) {
        var railShape = group.findById(this.getElementId('rail'));
        var minLabel = group.findById(this.getElementId('label-min'));
        var maxLabel = group.findById(this.getElementId('label-max'));
        var startPoint = this.getDrawPoint();
        if (this.isVertical()) {
            // 横向布局
            this.fixedVertail(minLabel, maxLabel, railShape, startPoint);
        }
        else {
            // 水平布局
            this.fixedHorizontal(minLabel, maxLabel, railShape, startPoint);
        }
    };
    ContinueLegend.prototype.fitRailLength = function (minLabelBBox, maxLabelBBox, railBBox, railShape) {
        var isVertical = this.isVertical();
        var lengthField = isVertical ? 'height' : 'width';
        var labelCfg = this.get('label');
        var labelAlign = labelCfg.align;
        var spacing = labelCfg.spacing;
        var maxLength = this.get("max" + util_1.upperFirst(lengthField)); // get('maxWidth')
        if (maxLength) {
            var elementsLength = labelAlign === 'rail'
                ? railBBox[lengthField] + minLabelBBox[lengthField] + maxLabelBBox[lengthField] + spacing * 2
                : railBBox[lengthField];
            var diff = elementsLength - maxLength;
            if (diff > 0) {
                // 大于限制的长度
                this.changeRailLength(railShape, lengthField, railBBox[lengthField] - diff);
            }
        }
    };
    ContinueLegend.prototype.changeRailLength = function (railShape, lengthField, length) {
        var bbox = railShape.getBBox();
        var path;
        if (lengthField === 'height') {
            path = this.getRailPath(bbox.x, bbox.y, bbox.width, length);
        }
        else {
            path = this.getRailPath(bbox.x, bbox.y, length, bbox.height);
        }
        railShape.attr('path', path);
    };
    ContinueLegend.prototype.changeRailPosition = function (railShape, x, y) {
        var bbox = railShape.getBBox();
        var path = this.getRailPath(x, y, bbox.width, bbox.height);
        railShape.attr('path', path);
    };
    ContinueLegend.prototype.fixedHorizontal = function (minLabel, maxLabel, railShape, startPoint) {
        var labelCfg = this.get('label');
        var labelAlign = labelCfg.align;
        var spacing = labelCfg.spacing;
        var railBBox = railShape.getBBox();
        var minLabelBBox = minLabel.getBBox();
        var maxLabelBBox = maxLabel.getBBox();
        var railHeight = railBBox.height; // 取 rail 的高度，作为高度
        this.fitRailLength(minLabelBBox, maxLabelBBox, railBBox, railShape);
        railBBox = railShape.getBBox();
        if (labelAlign === 'rail') {
            // 沿着 rail 方向
            minLabel.attr({
                x: startPoint.x,
                y: startPoint.y + railHeight / 2,
            });
            this.changeRailPosition(railShape, startPoint.x + minLabelBBox.width + spacing, startPoint.y);
            maxLabel.attr({
                x: startPoint.x + minLabelBBox.width + railBBox.width + spacing * 2,
                y: startPoint.y + railHeight / 2,
            });
        }
        else if (labelAlign === 'top') {
            minLabel.attr({
                x: startPoint.x,
                y: startPoint.y,
            });
            maxLabel.attr({
                x: startPoint.x + railBBox.width,
                y: startPoint.y,
            });
            this.changeRailPosition(railShape, startPoint.x, startPoint.y + minLabelBBox.height + spacing);
        }
        else {
            this.changeRailPosition(railShape, startPoint.x, startPoint.y);
            minLabel.attr({
                x: startPoint.x,
                y: startPoint.y + railBBox.height + spacing,
            });
            maxLabel.attr({
                x: startPoint.x + railBBox.width,
                y: startPoint.y + railBBox.height + spacing,
            });
        }
    };
    ContinueLegend.prototype.fixedVertail = function (minLabel, maxLabel, railShape, startPoint) {
        var labelCfg = this.get('label');
        var labelAlign = labelCfg.align;
        var spacing = labelCfg.spacing;
        var railBBox = railShape.getBBox();
        var minLabelBBox = minLabel.getBBox();
        var maxLabelBBox = maxLabel.getBBox();
        this.fitRailLength(minLabelBBox, maxLabelBBox, railBBox, railShape);
        railBBox = railShape.getBBox();
        if (labelAlign === 'rail') {
            // 沿着 rail 方向
            minLabel.attr({
                x: startPoint.x,
                y: startPoint.y,
            });
            this.changeRailPosition(railShape, startPoint.x, startPoint.y + minLabelBBox.height + spacing);
            maxLabel.attr({
                x: startPoint.x,
                y: startPoint.y + minLabelBBox.height + railBBox.height + spacing * 2,
            });
        }
        else if (labelAlign === 'right') {
            minLabel.attr({
                x: startPoint.x + railBBox.width + spacing,
                y: startPoint.y,
            });
            this.changeRailPosition(railShape, startPoint.x, startPoint.y);
            maxLabel.attr({
                x: startPoint.x + railBBox.width + spacing,
                y: startPoint.y + railBBox.height,
            });
        }
        else {
            // left
            var maxLabelWidth = Math.max(minLabelBBox.width, maxLabelBBox.width);
            minLabel.attr({
                x: startPoint.x,
                y: startPoint.y,
            });
            this.changeRailPosition(railShape, startPoint.x + maxLabelWidth + spacing, startPoint.y);
            maxLabel.attr({
                x: startPoint.x,
                y: startPoint.y + railBBox.height,
            });
        }
    };
    return ContinueLegend;
}(base_1.default));
exports.default = ContinueLegend;

},{"../util/theme":76,"../util/util":77,"./base":52,"@antv/util":803,"tslib":894}],55:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var category_1 = require("./category");
Object.defineProperty(exports, "Category", { enumerable: true, get: function () { return category_1.default; } });
var continuous_1 = require("./continuous");
Object.defineProperty(exports, "Continuous", { enumerable: true, get: function () { return continuous_1.default; } });
var base_1 = require("./base");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } });

},{"./base":52,"./category":53,"./continuous":54}],56:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./scrollbar"), exports);

},{"./scrollbar":57,"tslib":894}],57:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scrollbar = exports.DEFAULT_THEME = void 0;
var tslib_1 = require("tslib");
var dom_util_1 = require("@antv/dom-util");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var DEFAULT_STYLE = {
    trackColor: 'rgba(0,0,0,0)',
    thumbColor: 'rgba(0,0,0,0.15)',
    size: 8,
    lineCap: 'round',
};
exports.DEFAULT_THEME = {
    // 默认样式
    default: DEFAULT_STYLE,
    // 鼠标 hover 的样式
    hover: {
        thumbColor: 'rgba(0,0,0,0.2)',
    },
};
var Scrollbar = /** @class */ (function (_super) {
    tslib_1.__extends(Scrollbar, _super);
    function Scrollbar() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.clearEvents = util_1.noop;
        _this.onStartEvent = function (isMobile) { return function (e) {
            _this.isMobile = isMobile;
            e.originalEvent.preventDefault();
            var clientX = isMobile ? util_1.get(e.originalEvent, 'touches.0.clientX') : e.clientX;
            var clientY = isMobile ? util_1.get(e.originalEvent, 'touches.0.clientY') : e.clientY;
            // 将开始的点记录下来
            _this.startPos = _this.cfg.isHorizontal ? clientX : clientY;
            _this.bindLaterEvent();
        }; };
        _this.bindLaterEvent = function () {
            var containerDOM = _this.getContainerDOM();
            var events = [];
            if (_this.isMobile) {
                events = [
                    dom_util_1.addEventListener(containerDOM, 'touchmove', _this.onMouseMove),
                    dom_util_1.addEventListener(containerDOM, 'touchend', _this.onMouseUp),
                    dom_util_1.addEventListener(containerDOM, 'touchcancel', _this.onMouseUp),
                ];
            }
            else {
                events = [
                    dom_util_1.addEventListener(containerDOM, 'mousemove', _this.onMouseMove),
                    dom_util_1.addEventListener(containerDOM, 'mouseup', _this.onMouseUp),
                    // 为了保证划出 canvas containerDom 时还没触发 mouseup
                    dom_util_1.addEventListener(containerDOM, 'mouseleave', _this.onMouseUp),
                ];
            }
            _this.clearEvents = function () {
                events.forEach(function (e) {
                    e.remove();
                });
            };
        };
        // 拖拽滑块的事件回调
        // 这里是 dom 原生事件，绑定在 dom 元素上的
        _this.onMouseMove = function (e) {
            var _a = _this.cfg, isHorizontal = _a.isHorizontal, thumbOffset = _a.thumbOffset;
            e.preventDefault();
            var clientX = _this.isMobile ? util_1.get(e, 'touches.0.clientX') : e.clientX;
            var clientY = _this.isMobile ? util_1.get(e, 'touches.0.clientY') : e.clientY;
            // 鼠标松开的位置
            var endPos = isHorizontal ? clientX : clientY;
            // 滑块需要移动的距离, 由于这里是对滑块监听，所以移动的距离就是 diffDis, 如果监听对象是 container dom，则需要算比例
            var diff = endPos - _this.startPos;
            // 更新 _startPos
            _this.startPos = endPos;
            _this.updateThumbOffset(thumbOffset + diff);
        };
        _this.onMouseUp = function (e) {
            e.preventDefault();
            _this.clearEvents();
        };
        // 点击滑道的事件回调,移动滑块位置
        _this.onTrackClick = function (e) {
            var _a = _this.cfg, isHorizontal = _a.isHorizontal, x = _a.x, y = _a.y, thumbLen = _a.thumbLen;
            var containerDOM = _this.getContainerDOM();
            var rect = containerDOM.getBoundingClientRect();
            var clientX = e.clientX, clientY = e.clientY;
            var offset = isHorizontal ? clientX - rect.left - x - thumbLen / 2 : clientY - rect.top - y - thumbLen / 2;
            var newOffset = _this.validateRange(offset);
            _this.updateThumbOffset(newOffset);
        };
        _this.onThumbMouseOver = function () {
            var thumbColor = _this.cfg.theme.hover.thumbColor;
            _this.getElementByLocalId('thumb').attr('stroke', thumbColor);
            _this.draw();
        };
        _this.onThumbMouseOut = function () {
            var thumbColor = _this.cfg.theme.default.thumbColor;
            _this.getElementByLocalId('thumb').attr('stroke', thumbColor);
            _this.draw();
        };
        return _this;
    }
    Scrollbar.prototype.setRange = function (min, max) {
        this.set('minLimit', min);
        this.set('maxLimit', max);
        var curValue = this.getValue();
        var newValue = util_1.clamp(curValue, min, max);
        if (curValue !== newValue && !this.get('isInit')) {
            this.setValue(newValue);
        }
    };
    Scrollbar.prototype.getRange = function () {
        var min = this.get('minLimit') || 0;
        var max = this.get('maxLimit') || 1;
        return { min: min, max: max };
    };
    Scrollbar.prototype.setValue = function (value) {
        var range = this.getRange();
        var originalValue = this.getValue();
        this.update({
            thumbOffset: (this.get('trackLen') - this.get('thumbLen')) * util_1.clamp(value, range.min, range.max),
        });
        this.delegateEmit('valuechange', {
            originalValue: originalValue,
            value: this.getValue(),
        });
    };
    Scrollbar.prototype.getValue = function () {
        return util_1.clamp(this.get('thumbOffset') / (this.get('trackLen') - this.get('thumbLen')), 0, 1);
    };
    Scrollbar.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'scrollbar', isHorizontal: true, minThumbLen: 20, thumbOffset: 0, theme: exports.DEFAULT_THEME });
    };
    Scrollbar.prototype.renderInner = function (group) {
        this.renderTrackShape(group);
        this.renderThumbShape(group);
    };
    Scrollbar.prototype.applyOffset = function () {
        this.moveElementTo(this.get('group'), {
            x: this.get('x'),
            y: this.get('y'),
        });
    };
    Scrollbar.prototype.initEvent = function () {
        this.bindEvents();
    };
    // 创建滑道的 shape
    Scrollbar.prototype.renderTrackShape = function (group) {
        var _a = this.cfg, trackLen = _a.trackLen, _b = _a.theme, theme = _b === void 0 ? { default: {} } : _b;
        var _c = theme.default, lineCap = _c.lineCap, trackColor = _c.trackColor, size = _c.size;
        var attrs = this.get('isHorizontal')
            ? {
                x1: 0 + size / 2,
                y1: size / 2,
                x2: trackLen - size / 2,
                y2: size / 2,
                lineWidth: size,
                stroke: trackColor,
                lineCap: lineCap,
            }
            : {
                x1: size / 2,
                y1: 0 + size / 2,
                x2: size / 2,
                y2: trackLen - size / 2,
                lineWidth: size,
                stroke: trackColor,
                lineCap: lineCap,
            };
        return this.addShape(group, {
            id: this.getElementId('track'),
            name: 'track',
            type: 'line',
            attrs: attrs,
        });
    };
    // 创建滑块的 shape
    Scrollbar.prototype.renderThumbShape = function (group) {
        var _a = this.cfg, thumbOffset = _a.thumbOffset, thumbLen = _a.thumbLen, _b = _a.theme, theme = _b === void 0 ? { default: {} } : _b;
        var _c = theme.default, size = _c.size, lineCap = _c.lineCap, thumbColor = _c.thumbColor;
        var attrs = this.get('isHorizontal')
            ? {
                x1: thumbOffset + size / 2,
                y1: size / 2,
                x2: thumbOffset + thumbLen - size / 2,
                y2: size / 2,
                lineWidth: size,
                stroke: thumbColor,
                lineCap: lineCap,
                cursor: 'default',
            }
            : {
                x1: size / 2,
                y1: thumbOffset + size / 2,
                x2: size / 2,
                y2: thumbOffset + thumbLen - size / 2,
                lineWidth: size,
                stroke: thumbColor,
                lineCap: lineCap,
                cursor: 'default',
            };
        return this.addShape(group, {
            id: this.getElementId('thumb'),
            name: 'thumb',
            type: 'line',
            attrs: attrs,
        });
    };
    Scrollbar.prototype.bindEvents = function () {
        var group = this.get('group');
        group.on('mousedown', this.onStartEvent(false));
        group.on('mouseup', this.onMouseUp);
        group.on('touchstart', this.onStartEvent(true));
        group.on('touchend', this.onMouseUp);
        var trackShape = group.findById(this.getElementId('track'));
        trackShape.on('click', this.onTrackClick);
        var thumbShape = group.findById(this.getElementId('thumb'));
        thumbShape.on('mouseover', this.onThumbMouseOver);
        thumbShape.on('mouseout', this.onThumbMouseOut);
    };
    Scrollbar.prototype.getContainerDOM = function () {
        var container = this.get('container');
        var canvas = container && container.get('canvas');
        return canvas && canvas.get('container');
    };
    Scrollbar.prototype.validateRange = function (offset) {
        var _a = this.cfg, thumbLen = _a.thumbLen, trackLen = _a.trackLen;
        var newOffset = offset;
        if (offset + thumbLen > trackLen) {
            newOffset = trackLen - thumbLen;
        }
        else if (offset + thumbLen < thumbLen) {
            newOffset = 0;
        }
        return newOffset;
    };
    Scrollbar.prototype.draw = function () {
        var container = this.get('container');
        var canvas = container && container.get('canvas');
        if (canvas) {
            canvas.draw();
        }
    };
    Scrollbar.prototype.updateThumbOffset = function (offset) {
        var _a = this.cfg, thumbOffset = _a.thumbOffset, isHorizontal = _a.isHorizontal, thumbLen = _a.thumbLen, size = _a.size;
        var newOffset = this.validateRange(offset);
        if (newOffset === thumbOffset) {
            // 如果更新后的 offset 与原值相同，则不改变
            return;
        }
        var thumbShape = this.getElementByLocalId('thumb');
        if (isHorizontal) {
            thumbShape.attr({
                x1: newOffset + size / 2,
                x2: newOffset + thumbLen - size / 2,
            });
        }
        else {
            thumbShape.attr({
                y1: newOffset + size / 2,
                y2: newOffset + thumbLen - size / 2,
            });
        }
        this.emitOffsetChange(newOffset);
    };
    Scrollbar.prototype.emitOffsetChange = function (offset) {
        var _a = this.cfg, originalValue = _a.thumbOffset, trackLen = _a.trackLen, thumbLen = _a.thumbLen;
        this.cfg.thumbOffset = offset;
        // 发送事件
        this.emit('scrollchange', {
            thumbOffset: offset,
            ratio: util_1.clamp(offset / (trackLen - thumbLen), 0, 1),
        });
        this.delegateEmit('valuechange', {
            originalValue: originalValue,
            value: offset,
        });
    };
    return Scrollbar;
}(group_component_1.default));
exports.Scrollbar = Scrollbar;

},{"../abstract/group-component":21,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],58:[function(require,module,exports){
"use strict";
/**
 * 一些默认的样式配置
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SLIDER_CHANGE = exports.TEXT_STYLE = exports.HANDLER_STYLE = exports.DEFAULT_HANDLER_WIDTH = exports.FOREGROUND_STYLE = exports.BACKGROUND_STYLE = void 0;
exports.BACKGROUND_STYLE = {
    fill: '#416180',
    opacity: 0.05,
};
exports.FOREGROUND_STYLE = {
    fill: '#5B8FF9',
    opacity: 0.15,
    cursor: 'move',
};
exports.DEFAULT_HANDLER_WIDTH = 10;
exports.HANDLER_STYLE = {
    width: exports.DEFAULT_HANDLER_WIDTH,
    height: 24,
};
exports.TEXT_STYLE = {
    textBaseline: 'middle',
    fill: '#000',
    opacity: 0.45,
};
exports.SLIDER_CHANGE = 'sliderchange';

},{}],59:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Handler = void 0;
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var DEFAULT_STYLE = {
    fill: '#F7F7F7',
    stroke: '#BFBFBF',
    radius: 2,
    opacity: 1,
    cursor: 'ew-resize',
    // 高亮的颜色
    highLightFill: '#FFF',
};
var Handler = /** @class */ (function (_super) {
    tslib_1.__extends(Handler, _super);
    function Handler() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Handler.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'handler', x: 0, y: 0, width: 10, height: 24, style: DEFAULT_STYLE });
    };
    Handler.prototype.renderInner = function (group) {
        var _a = this.cfg, width = _a.width, height = _a.height, style = _a.style;
        var fill = style.fill, stroke = style.stroke, radius = style.radius, opacity = style.opacity, cursor = style.cursor;
        // 按钮框框
        this.addShape(group, {
            type: 'rect',
            id: this.getElementId('background'),
            attrs: {
                x: 0,
                y: 0,
                width: width,
                height: height,
                fill: fill,
                stroke: stroke,
                radius: radius,
                opacity: opacity,
                cursor: cursor,
            },
        });
        // 两根竖线
        var x1 = (1 / 3) * width;
        var x2 = (2 / 3) * width;
        var y1 = (1 / 4) * height;
        var y2 = (3 / 4) * height;
        this.addShape(group, {
            id: this.getElementId('line-left'),
            type: 'line',
            attrs: {
                x1: x1,
                y1: y1,
                x2: x1,
                y2: y2,
                stroke: stroke,
                cursor: cursor,
            },
        });
        this.addShape(group, {
            id: this.getElementId('line-right'),
            type: 'line',
            attrs: {
                x1: x2,
                y1: y1,
                x2: x2,
                y2: y2,
                stroke: stroke,
                cursor: cursor,
            },
        });
    };
    Handler.prototype.applyOffset = function () {
        this.moveElementTo(this.get('group'), {
            x: this.get('x'),
            y: this.get('y'),
        });
    };
    Handler.prototype.initEvent = function () {
        this.bindEvents();
    };
    Handler.prototype.bindEvents = function () {
        var _this = this;
        this.get('group').on('mouseenter', function () {
            var highLightFill = _this.get('style').highLightFill;
            _this.getElementByLocalId('background').attr('fill', highLightFill);
            _this.draw();
        });
        this.get('group').on('mouseleave', function () {
            var fill = _this.get('style').fill;
            _this.getElementByLocalId('background').attr('fill', fill);
            _this.draw();
        });
    };
    Handler.prototype.draw = function () {
        var canvas = this.get('container').get('canvas');
        if (canvas) {
            canvas.draw();
        }
    };
    return Handler;
}(group_component_1.default));
exports.Handler = Handler;
exports.default = Handler;

},{"../abstract/group-component":21,"tslib":894}],60:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var slider_1 = require("./slider");
Object.defineProperty(exports, "Slider", { enumerable: true, get: function () { return slider_1.Slider; } });

},{"./slider":61}],61:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Slider = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var group_component_1 = require("../abstract/group-component");
var trend_1 = require("../trend/trend");
var constant_1 = require("./constant");
var handler_1 = require("./handler");
var Slider = /** @class */ (function (_super) {
    tslib_1.__extends(Slider, _super);
    function Slider() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onMouseDown = function (target) { return function (e) {
            _this.currentTarget = target;
            // 取出原生事件
            var event = e.originalEvent;
            // 2. 存储当前点击位置
            event.stopPropagation();
            event.preventDefault();
            // 兼容移动端获取数据
            _this.prevX = util_1.get(event, 'touches.0.pageX', event.pageX);
            _this.prevY = util_1.get(event, 'touches.0.pageY', event.pageY);
            // 3. 开始滑动的时候，绑定 move 和 up 事件
            var containerDOM = _this.getContainerDOM();
            containerDOM.addEventListener('mousemove', _this.onMouseMove);
            containerDOM.addEventListener('mouseup', _this.onMouseUp);
            containerDOM.addEventListener('mouseleave', _this.onMouseUp);
            // 移动端事件
            containerDOM.addEventListener('touchmove', _this.onMouseMove);
            containerDOM.addEventListener('touchend', _this.onMouseUp);
            containerDOM.addEventListener('touchcancel', _this.onMouseUp);
        }; };
        _this.onMouseMove = function (event) {
            var width = _this.cfg.width;
            var originValue = [_this.get('start'), _this.get('end')];
            // 滑动过程中，计算偏移，更新滑块，然后 emit 数据出去
            event.stopPropagation();
            event.preventDefault();
            var x = util_1.get(event, 'touches.0.pageX', event.pageX);
            var y = util_1.get(event, 'touches.0.pageY', event.pageY);
            // 横向的 slider 只处理 x
            var offsetX = x - _this.prevX;
            var offsetXRange = _this.adjustOffsetRange(offsetX / width);
            // 更新 start end range 范围
            _this.updateStartEnd(offsetXRange);
            // 更新 ui
            _this.updateUI(_this.getElementByLocalId('foreground'), _this.getElementByLocalId('minText'), _this.getElementByLocalId('maxText'));
            _this.prevX = x;
            _this.prevY = y;
            _this.draw();
            // 因为存储的 start、end 可能不一定是按大小存储的，所以排序一下，对外是 end >= start
            _this.emit(constant_1.SLIDER_CHANGE, [_this.get('start'), _this.get('end')].sort());
            _this.delegateEmit('valuechanged', {
                originValue: originValue,
                value: [_this.get('start'), _this.get('end')],
            });
        };
        _this.onMouseUp = function () {
            // 结束之后，取消绑定的事件
            if (_this.currentTarget) {
                _this.currentTarget = undefined;
            }
            var containerDOM = _this.getContainerDOM();
            if (containerDOM) {
                containerDOM.removeEventListener('mousemove', _this.onMouseMove);
                containerDOM.removeEventListener('mouseup', _this.onMouseUp);
                // 防止滑动到 canvas 外部之后，状态丢失
                containerDOM.removeEventListener('mouseleave', _this.onMouseUp);
                // 移动端事件
                containerDOM.removeEventListener('touchmove', _this.onMouseMove);
                containerDOM.removeEventListener('touchend', _this.onMouseUp);
                containerDOM.removeEventListener('touchcancel', _this.onMouseUp);
            }
        };
        return _this;
    }
    Slider.prototype.setRange = function (min, max) {
        this.set('minLimit', min);
        this.set('maxLimit', max);
        var oldStart = this.get('start');
        var oldEnd = this.get('end');
        var newStart = util_1.clamp(oldStart, min, max);
        var newEnd = util_1.clamp(oldEnd, min, max);
        if (!this.get('isInit') && (oldStart !== newStart || oldEnd !== newEnd)) {
            this.setValue([newStart, newEnd]);
        }
    };
    Slider.prototype.getRange = function () {
        return {
            min: this.get('minLimit') || 0,
            max: this.get('maxLimit') || 1,
        };
    };
    Slider.prototype.setValue = function (value) {
        var range = this.getRange();
        if (util_1.isArray(value) && value.length === 2) {
            var originValue = [this.get('start'), this.get('end')];
            this.update({
                start: util_1.clamp(value[0], range.min, range.max),
                end: util_1.clamp(value[1], range.min, range.max),
            });
            if (!this.get('updateAutoRender')) {
                this.render();
            }
            this.delegateEmit('valuechanged', {
                originValue: originValue,
                value: value,
            });
        }
    };
    Slider.prototype.getValue = function () {
        return [this.get('start'), this.get('end')];
    };
    Slider.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'slider', x: 0, y: 0, width: 100, height: 16, backgroundStyle: {}, foregroundStyle: {}, handlerStyle: {}, textStyle: {}, defaultCfg: {
                backgroundStyle: constant_1.BACKGROUND_STYLE,
                foregroundStyle: constant_1.FOREGROUND_STYLE,
                handlerStyle: constant_1.HANDLER_STYLE,
                textStyle: constant_1.TEXT_STYLE,
            } });
    };
    Slider.prototype.update = function (cfg) {
        var start = cfg.start, end = cfg.end;
        var validCfg = tslib_1.__assign({}, cfg);
        if (!util_1.isNil(start)) {
            validCfg.start = util_1.clamp(start, 0, 1);
        }
        if (!util_1.isNil(end)) {
            validCfg.end = util_1.clamp(end, 0, 1);
        }
        _super.prototype.update.call(this, validCfg);
        this.minHandler = this.getChildComponentById(this.getElementId('minHandler'));
        this.maxHandler = this.getChildComponentById(this.getElementId('maxHandler'));
    };
    Slider.prototype.init = function () {
        this.set('start', util_1.clamp(this.get('start'), 0, 1));
        this.set('end', util_1.clamp(this.get('end'), 0, 1));
        _super.prototype.init.call(this);
    };
    Slider.prototype.renderInner = function (group) {
        var _a = this.cfg, start = _a.start, end = _a.end, width = _a.width, height = _a.height, _b = _a.trendCfg, trendCfg = _b === void 0 ? {} : _b, minText = _a.minText, maxText = _a.maxText, _c = _a.backgroundStyle, backgroundStyle = _c === void 0 ? {} : _c, _d = _a.foregroundStyle, foregroundStyle = _d === void 0 ? {} : _d, _e = _a.textStyle, textStyle = _e === void 0 ? {} : _e, _f = _a.handlerStyle, handlerStyle = _f === void 0 ? {} : _f;
        var min = start * width;
        var max = end * width;
        // 趋势图数据
        if (util_1.size(util_1.get(trendCfg, 'data'))) {
            this.addComponent(group, tslib_1.__assign({ component: trend_1.Trend, id: this.getElementId('trend'), x: 0, y: 0, width: width,
                height: height }, trendCfg));
        }
        // 1. 背景
        this.addShape(group, {
            id: this.getElementId('background'),
            type: 'rect',
            attrs: tslib_1.__assign({ x: 0, y: 0, width: width,
                height: height }, backgroundStyle),
        });
        // 2. 左右文字
        var minTextShape = this.addShape(group, {
            id: this.getElementId('minText'),
            type: 'text',
            attrs: tslib_1.__assign({ 
                // x: 0,
                y: height / 2, textAlign: 'right', text: minText, silent: false }, textStyle),
        });
        var maxTextShape = this.addShape(group, {
            id: this.getElementId('maxText'),
            type: 'text',
            attrs: tslib_1.__assign({ 
                // x: 0,
                y: height / 2, textAlign: 'left', text: maxText, silent: false }, textStyle),
        });
        // 3. 前景 选中背景框
        var foregroundShape = this.addShape(group, {
            id: this.getElementId('foreground'),
            name: 'foreground',
            type: 'rect',
            attrs: tslib_1.__assign({ 
                // x: 0,
                y: 0, 
                // width: 0,
                height: height }, foregroundStyle),
        });
        // 滑块相关的大小信息
        // const handlerWidth = get(handlerStyle, 'width', 10);
        var handlerHeight = util_1.get(handlerStyle, 'height', 24);
        // 4. 左右滑块
        this.minHandler = this.addComponent(group, tslib_1.__assign({ component: handler_1.Handler, id: this.getElementId('minHandler'), name: 'handler-min', x: 0, y: (height - handlerHeight) / 2, width: width, height: handlerHeight, cursor: 'ew-resize' }, handlerStyle));
        this.maxHandler = this.addComponent(group, tslib_1.__assign({ component: handler_1.Handler, id: this.getElementId('maxHandler'), name: 'handler-max', x: 0, y: (height - handlerHeight) / 2, width: width, height: handlerHeight, cursor: 'ew-resize' }, handlerStyle));
        this.updateUI(foregroundShape, minTextShape, maxTextShape);
    };
    Slider.prototype.applyOffset = function () {
        this.moveElementTo(this.get('group'), {
            x: this.get('x'),
            y: this.get('y'),
        });
    };
    Slider.prototype.initEvent = function () {
        this.bindEvents();
    };
    Slider.prototype.updateUI = function (foregroundShape, minTextShape, maxTextShape) {
        var _a = this.cfg, start = _a.start, end = _a.end, width = _a.width, minText = _a.minText, maxText = _a.maxText, handlerStyle = _a.handlerStyle;
        var min = start * width;
        var max = end * width;
        // 1. foreground
        foregroundShape.attr('x', min);
        foregroundShape.attr('width', max - min);
        // 滑块相关的大小信息
        var handlerWidth = util_1.get(handlerStyle, 'width', constant_1.DEFAULT_HANDLER_WIDTH);
        // 设置文本
        minTextShape.attr('text', minText);
        maxTextShape.attr('text', maxText);
        var _b = this._dodgeText([min, max], minTextShape, maxTextShape), minAttrs = _b[0], maxAttrs = _b[1];
        // 2. 左侧滑块和文字位置
        if (this.minHandler) {
            this.minHandler.update({
                x: min - handlerWidth / 2,
            });
            if (!this.get('updateAutoRender')) {
                this.minHandler.render();
            }
        }
        util_1.each(minAttrs, function (v, k) { return minTextShape.attr(k, v); });
        // 3. 右侧滑块和文字位置
        if (this.maxHandler) {
            this.maxHandler.update({
                x: max - handlerWidth / 2,
            });
            if (!this.get('updateAutoRender')) {
                this.maxHandler.render();
            }
        }
        util_1.each(maxAttrs, function (v, k) { return maxTextShape.attr(k, v); });
    };
    Slider.prototype.bindEvents = function () {
        var group = this.get('group');
        group.on('handler-min:mousedown', this.onMouseDown('minHandler'));
        group.on('handler-min:touchstart', this.onMouseDown('minHandler'));
        // 2. 右滑块的滑动
        group.on('handler-max:mousedown', this.onMouseDown('maxHandler'));
        group.on('handler-max:touchstart', this.onMouseDown('maxHandler'));
        // 3. 前景选中区域
        var foreground = group.findById(this.getElementId('foreground'));
        foreground.on('mousedown', this.onMouseDown('foreground'));
        foreground.on('touchstart', this.onMouseDown('foreground'));
    };
    /**
     * 调整 offsetRange，因为一些范围的限制
     * @param offsetRange
     */
    Slider.prototype.adjustOffsetRange = function (offsetRange) {
        var _a = this.cfg, start = _a.start, end = _a.end;
        // 针对不同的滑动组件，处理的方式不同
        switch (this.currentTarget) {
            case 'minHandler': {
                var min = 0 - start;
                var max = 1 - start;
                return Math.min(max, Math.max(min, offsetRange));
            }
            case 'maxHandler': {
                var min = 0 - end;
                var max = 1 - end;
                return Math.min(max, Math.max(min, offsetRange));
            }
            case 'foreground': {
                var min = 0 - start;
                var max = 1 - end;
                return Math.min(max, Math.max(min, offsetRange));
            }
        }
    };
    Slider.prototype.updateStartEnd = function (offsetRange) {
        var _a = this.cfg, start = _a.start, end = _a.end;
        // 操作不同的组件，反馈不一样
        switch (this.currentTarget) {
            case 'minHandler':
                start += offsetRange;
                break;
            case 'maxHandler':
                end += offsetRange;
                break;
            case 'foreground':
                start += offsetRange;
                end += offsetRange;
                break;
        }
        this.set('start', start);
        this.set('end', end);
    };
    /**
     * 调整 text 的位置，自动躲避
     * 根据位置，调整返回新的位置
     * @param range
     */
    Slider.prototype._dodgeText = function (range, minTextShape, maxTextShape) {
        var _a, _b;
        var _c = this.cfg, handlerStyle = _c.handlerStyle, width = _c.width;
        var PADDING = 2;
        var handlerWidth = util_1.get(handlerStyle, 'width', constant_1.DEFAULT_HANDLER_WIDTH);
        var min = range[0], max = range[1];
        var sorted = false;
        // 如果交换了位置，则对应的 min max 也交互
        if (min > max) {
            _a = [max, min], min = _a[0], max = _a[1];
            _b = [maxTextShape, minTextShape], minTextShape = _b[0], maxTextShape = _b[1];
            sorted = true;
        }
        // 避让规则，优先显示在两侧，只有显示不下的时候，才显示在中间
        var minBBox = minTextShape.getBBox();
        var maxBBox = maxTextShape.getBBox();
        var minAttrs = minBBox.width > min - PADDING
            ? { x: min + handlerWidth / 2 + PADDING, textAlign: 'left' }
            : { x: min - handlerWidth / 2 - PADDING, textAlign: 'right' };
        var maxAttrs = maxBBox.width > width - max - PADDING
            ? { x: max - handlerWidth / 2 - PADDING, textAlign: 'right' }
            : { x: max + handlerWidth / 2 + PADDING, textAlign: 'left' };
        return !sorted ? [minAttrs, maxAttrs] : [maxAttrs, minAttrs];
    };
    Slider.prototype.draw = function () {
        var container = this.get('container');
        var canvas = container && container.get('canvas');
        if (canvas) {
            canvas.draw();
        }
    };
    Slider.prototype.getContainerDOM = function () {
        var container = this.get('container');
        var canvas = container && container.get('canvas');
        return canvas && canvas.get('container');
    };
    return Slider;
}(group_component_1.default));
exports.Slider = Slider;
exports.default = Slider;

},{"../abstract/group-component":21,"../trend/trend":68,"./constant":58,"./handler":59,"@antv/util":803,"tslib":894}],62:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CROSSHAIR_Y = exports.CROSSHAIR_X = exports.NAME_CLASS = exports.VALUE_CLASS = exports.MARKER_CLASS = exports.LIST_ITEM_CLASS = exports.LIST_CLASS = exports.TITLE_CLASS = exports.CONTAINER_CLASS = void 0;
exports.CONTAINER_CLASS = 'g2-tooltip';
exports.TITLE_CLASS = 'g2-tooltip-title';
exports.LIST_CLASS = 'g2-tooltip-list';
exports.LIST_ITEM_CLASS = 'g2-tooltip-list-item';
exports.MARKER_CLASS = 'g2-tooltip-marker';
exports.VALUE_CLASS = 'g2-tooltip-value';
exports.NAME_CLASS = 'g2-tooltip-name';
exports.CROSSHAIR_X = 'g2-tooltip-crosshair-x';
exports.CROSSHAIR_Y = 'g2-tooltip-crosshair-y';

},{}],63:[function(require,module,exports){
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../util/theme");
// tooltip 相关 dom 的 css 类名
var CssConst = require("./css-const");
exports.default = (_a = {},
    // css style for tooltip
    _a["" + CssConst.CONTAINER_CLASS] = {
        position: 'absolute',
        visibility: 'visible',
        // @2018-07-25 by blue.lb 这里去掉浮动，火狐上存在样式错位
        // whiteSpace: 'nowrap',
        zIndex: 8,
        transition: 'visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), ' +
            'left 0.4s cubic-bezier(0.23, 1, 0.32, 1), ' +
            'top 0.4s cubic-bezier(0.23, 1, 0.32, 1)',
        backgroundColor: 'rgba(255, 255, 255, 0.9)',
        boxShadow: '0px 0px 10px #aeaeae',
        borderRadius: '3px',
        color: 'rgb(87, 87, 87)',
        fontSize: '12px',
        fontFamily: theme_1.default.fontFamily,
        lineHeight: '20px',
        padding: '10px 10px 6px 10px',
    },
    _a["" + CssConst.TITLE_CLASS] = {
        marginBottom: '4px',
    },
    _a["" + CssConst.LIST_CLASS] = {
        margin: '0px',
        listStyleType: 'none',
        padding: '0px',
    },
    _a["" + CssConst.LIST_ITEM_CLASS] = {
        listStyleType: 'none',
        marginBottom: '4px',
    },
    _a["" + CssConst.MARKER_CLASS] = {
        width: '8px',
        height: '8px',
        borderRadius: '50%',
        display: 'inline-block',
        marginRight: '8px',
    },
    _a["" + CssConst.VALUE_CLASS] = {
        display: 'inline-block',
        float: 'right',
        marginLeft: '30px',
    },
    _a["" + CssConst.CROSSHAIR_X] = {
        position: 'absolute',
        width: '1px',
        backgroundColor: 'rgba(0, 0, 0, 0.25)',
    },
    _a["" + CssConst.CROSSHAIR_Y] = {
        position: 'absolute',
        height: '1px',
        backgroundColor: 'rgba(0, 0, 0, 0.25)',
    },
    _a);

},{"../util/theme":76,"./css-const":62}],64:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var color_util_1 = require("@antv/color-util");
var dom_util_1 = require("@antv/dom-util");
var util_1 = require("@antv/util");
var html_component_1 = require("../abstract/html-component");
var util_2 = require("../util/util");
var CssConst = require("./css-const");
var html_theme_1 = require("./html-theme");
var align_1 = require("../util/align");
function hasOneKey(obj, keys) {
    var result = false;
    util_1.each(keys, function (key) {
        if (util_1.hasKey(obj, key)) {
            result = true;
            return false;
        }
    });
    return result;
}
var Tooltip = /** @class */ (function (_super) {
    tslib_1.__extends(Tooltip, _super);
    function Tooltip() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Tooltip.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'tooltip', type: 'html', x: 0, y: 0, items: [], customContent: null, containerTpl: "<div class=\"" + CssConst.CONTAINER_CLASS + "\"><div class=\"" + CssConst.TITLE_CLASS + "\"></div><ul class=\"" + CssConst.LIST_CLASS + "\"></ul></div>", itemTpl: "<li class=\"" + CssConst.LIST_ITEM_CLASS + "\" data-index={index}>\n          <span class=\"" + CssConst.MARKER_CLASS + "\" style=\"background:{color}\"></span>\n          <span class=\"" + CssConst.NAME_CLASS + "\">{name}</span>:\n          <span class=\"" + CssConst.VALUE_CLASS + "\">{value}</span>\n        </li>", xCrosshairTpl: "<div class=\"" + CssConst.CROSSHAIR_X + "\"></div>", yCrosshairTpl: "<div class=\"" + CssConst.CROSSHAIR_Y + "\"></div>", title: null, showTitle: true, 
            /**
             * tooltip 限制的区域
             * @type {Region}
             */
            region: null, 
            // crosshair 的限制区域
            crosshairsRegion: null, containerClassName: CssConst.CONTAINER_CLASS, 
            // x, y, xy
            crosshairs: null, offset: 10, position: 'right', domStyles: null, defaultStyles: html_theme_1.default });
    };
    // tooltip 渲染时，渲染 title，items 和 corosshairs
    Tooltip.prototype.render = function () {
        if (this.get('customContent')) {
            this.renderCustomContent();
        }
        else {
            this.resetTitle();
            this.renderItems();
        }
        // 绘制完成后，再定位
        this.resetPosition();
    };
    // 复写清空函数，因为有模板的存在，所以默认的写法不合适
    Tooltip.prototype.clear = function () {
        // 由于 crosshair 没有在 container 内，所以需要单独清理
        this.clearCrosshairs();
        this.setTitle(''); // 清空标题
        this.clearItemDoms();
    };
    Tooltip.prototype.show = function () {
        var container = this.getContainer();
        if (!container || this.destroyed) {
            // 防止容器不存在或者被销毁时报错
            return;
        }
        this.set('visible', true);
        dom_util_1.modifyCSS(container, {
            visibility: 'visible',
        });
        this.setCrossHairsVisible(true);
    };
    Tooltip.prototype.hide = function () {
        var container = this.getContainer();
        // relative: https://github.com/antvis/g2/issues/1221
        if (!container || this.destroyed) {
            return;
        }
        this.set('visible', false);
        dom_util_1.modifyCSS(container, {
            visibility: 'hidden',
        });
        this.setCrossHairsVisible(false);
    };
    // 实现 IPointLocation 的接口
    Tooltip.prototype.getLocation = function () {
        return { x: this.get('x'), y: this.get('y') };
    };
    // 实现 IPointLocation 的接口
    Tooltip.prototype.setLocation = function (point) {
        this.set('x', point.x);
        this.set('y', point.y);
        this.resetPosition();
    };
    Tooltip.prototype.setCrossHairsVisible = function (visible) {
        var display = visible ? '' : 'none';
        var xCrosshairDom = this.get('xCrosshairDom');
        var yCrosshairDom = this.get('yCrosshairDom');
        xCrosshairDom &&
            dom_util_1.modifyCSS(xCrosshairDom, {
                display: display,
            });
        yCrosshairDom &&
            dom_util_1.modifyCSS(yCrosshairDom, {
                display: display,
            });
    };
    // 如有 customContent 则根据 customContent 设置 container
    Tooltip.prototype.initContainer = function () {
        _super.prototype.initContainer.call(this);
        if (this.get('customContent')) {
            if (this.get('container')) {
                this.get('container').remove();
            }
            var container = this.getHtmlContentNode();
            this.get('parent').appendChild(container);
            this.set('container', container);
            this.resetStyles();
            this.applyStyles();
        }
    };
    // 更新属性的同时，可能会引起 DOM 的变化，这里对可能引起 DOM 变化的场景做了处理
    Tooltip.prototype.updateInner = function (cfg) {
        if (this.get('customContent')) {
            this.renderCustomContent();
        }
        else {
            // 更新标题
            if (hasOneKey(cfg, ['title', 'showTitle'])) {
                this.resetTitle();
            }
            // 更新内容
            if (util_1.hasKey(cfg, 'items')) {
                this.renderItems();
            }
        }
        _super.prototype.updateInner.call(this, cfg);
    };
    Tooltip.prototype.initDom = function () {
        this.cacheDoms();
    };
    // 清理 DOM
    Tooltip.prototype.removeDom = function () {
        _super.prototype.removeDom.call(this);
        this.clearCrosshairs();
    };
    // 调整位置
    Tooltip.prototype.resetPosition = function () {
        var x = this.get('x');
        var y = this.get('y');
        var offset = this.get('offset');
        var _a = this.getOffset(), offsetX = _a.offsetX, offsetY = _a.offsetY;
        var position = this.get('position');
        var region = this.get('region');
        var container = this.getContainer();
        var bbox = this.getBBox();
        var width = bbox.width, height = bbox.height;
        var limitBox;
        if (region) {
            // 不限制位置
            limitBox = util_2.regionToBBox(region);
        }
        var point = align_1.getAlignPoint(x, y, offset, width, height, position, limitBox);
        dom_util_1.modifyCSS(container, {
            left: util_2.toPx(point.x + offsetX),
            top: util_2.toPx(point.y + offsetY),
        });
        this.resetCrosshairs();
    };
    // 根据 customContent 渲染
    Tooltip.prototype.renderCustomContent = function () {
        var node = this.getHtmlContentNode();
        var parent = this.get('parent');
        var curContainer = this.get('container');
        if (curContainer && curContainer.parentNode === parent) {
            parent.replaceChild(node, curContainer);
        }
        else {
            parent.appendChild(node);
        }
        this.set('container', node);
        this.resetStyles();
        this.applyStyles();
    };
    Tooltip.prototype.getHtmlContentNode = function () {
        var node;
        var customContent = this.get('customContent');
        if (customContent) {
            var elem = customContent(this.get('title'), this.get('items'));
            if (util_1.isElement(elem)) {
                node = elem;
            }
            else {
                node = dom_util_1.createDom(elem);
            }
        }
        return node;
    };
    // 缓存模板设置的各种 DOM
    Tooltip.prototype.cacheDoms = function () {
        var container = this.getContainer();
        var titleDom = container.getElementsByClassName(CssConst.TITLE_CLASS)[0];
        var listDom = container.getElementsByClassName(CssConst.LIST_CLASS)[0];
        this.set('titleDom', titleDom);
        this.set('listDom', listDom);
    };
    // 重置 title
    Tooltip.prototype.resetTitle = function () {
        var title = this.get('title');
        var showTitle = this.get('showTitle');
        if (showTitle && title) {
            this.setTitle(title);
        }
        else {
            this.setTitle('');
        }
    };
    // 设置 title 文本
    Tooltip.prototype.setTitle = function (text) {
        var titleDom = this.get('titleDom');
        if (titleDom) {
            titleDom.innerText = text;
        }
    };
    // 终止 crosshair
    Tooltip.prototype.resetCrosshairs = function () {
        var crosshairsRegion = this.get('crosshairsRegion');
        var crosshairs = this.get('crosshairs');
        if (!crosshairsRegion || !crosshairs) {
            // 不显示 crosshair，都移除，没有设定 region 也都移除掉
            this.clearCrosshairs();
        }
        else {
            var crosshairBox = util_2.regionToBBox(crosshairsRegion);
            var xCrosshairDom = this.get('xCrosshairDom');
            var yCrosshairDom = this.get('yCrosshairDom');
            if (crosshairs === 'x') {
                this.resetCrosshair('x', crosshairBox);
                // 仅显示 x 的 crosshair，y 移除
                if (yCrosshairDom) {
                    yCrosshairDom.remove();
                    this.set('yCrosshairDom', null);
                }
            }
            else if (crosshairs === 'y') {
                this.resetCrosshair('y', crosshairBox);
                // 仅显示 y 的 crosshair，x 移除
                if (xCrosshairDom) {
                    xCrosshairDom.remove();
                    this.set('xCrosshairDom', null);
                }
            }
            else {
                this.resetCrosshair('x', crosshairBox);
                this.resetCrosshair('y', crosshairBox);
            }
            this.setCrossHairsVisible(this.get('visible'));
        }
    };
    // 设定 crosshair 的位置，需要区分 x,y
    Tooltip.prototype.resetCrosshair = function (name, bbox) {
        var croshairDom = this.checkCrosshair(name);
        var value = this.get(name);
        if (name === 'x') {
            dom_util_1.modifyCSS(croshairDom, {
                left: util_2.toPx(value),
                top: util_2.toPx(bbox.y),
                height: util_2.toPx(bbox.height),
            });
        }
        else {
            dom_util_1.modifyCSS(croshairDom, {
                top: util_2.toPx(value),
                left: util_2.toPx(bbox.x),
                width: util_2.toPx(bbox.width),
            });
        }
    };
    // 如果 crosshair 对应的 dom 不存在，则创建
    Tooltip.prototype.checkCrosshair = function (name) {
        var domName = name + "CrosshairDom";
        var tplName = name + "CrosshairTpl";
        var constName = "CROSSHAIR_" + name.toUpperCase();
        var styleName = CssConst[constName];
        var croshairDom = this.get(domName);
        var parent = this.get('parent');
        if (!croshairDom) {
            croshairDom = dom_util_1.createDom(this.get(tplName)); // 创建
            this.applyStyle(styleName, croshairDom); // 设置初始样式
            parent.appendChild(croshairDom); // 添加到跟 tooltip 同级的目录下
            this.set(domName, croshairDom);
        }
        return croshairDom;
    };
    Tooltip.prototype.renderItems = function () {
        this.clearItemDoms();
        var items = this.get('items');
        var itemTpl = this.get('itemTpl');
        var listDom = this.get('listDom');
        if (listDom) {
            util_1.each(items, function (item) {
                var color = color_util_1.default.toCSSGradient(item.color);
                var substituteObj = tslib_1.__assign(tslib_1.__assign({}, item), { color: color });
                var domStr = util_1.substitute(itemTpl, substituteObj);
                var itemDom = dom_util_1.createDom(domStr);
                listDom.appendChild(itemDom);
            });
            this.applyChildrenStyles(listDom, this.get('domStyles'));
        }
    };
    Tooltip.prototype.clearItemDoms = function () {
        if (this.get('listDom')) {
            util_2.clearDom(this.get('listDom'));
        }
    };
    Tooltip.prototype.clearCrosshairs = function () {
        var xCrosshairDom = this.get('xCrosshairDom');
        var yCrosshairDom = this.get('yCrosshairDom');
        xCrosshairDom && xCrosshairDom.remove();
        yCrosshairDom && yCrosshairDom.remove();
        this.set('xCrosshairDom', null);
        this.set('yCrosshairDom', null);
    };
    return Tooltip;
}(html_component_1.default));
exports.default = Tooltip;

},{"../abstract/html-component":22,"../util/align":69,"../util/util":77,"./css-const":62,"./html-theme":63,"@antv/color-util":19,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],65:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var html_1 = require("./html");
Object.defineProperty(exports, "Html", { enumerable: true, get: function () { return html_1.default; } });

},{"./html":64}],66:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AREA_STYLE = exports.LINE_STYLE = exports.BACKGROUND_STYLE = void 0;
exports.BACKGROUND_STYLE = {
    // fill: 'red',
    opacity: 0,
};
exports.LINE_STYLE = {
    stroke: '#C5C5C5',
    strokeOpacity: 0.85,
};
exports.AREA_STYLE = {
    fill: '#CACED4',
    opacity: 0.85,
};

},{}],67:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.linePathToAreaPath = exports.dataToPath = exports.getSmoothLinePath = exports.getLinePath = void 0;
var tslib_1 = require("tslib");
var path_util_1 = require("@antv/path-util");
var scale_1 = require("@antv/scale");
var util_1 = require("@antv/util");
/**
 * 点数组转 path
 * @param points
 */
function pointsToPath(points) {
    return util_1.map(points, function (p, idx) {
        var command = idx === 0 ? 'M' : 'L';
        var x = p[0], y = p[1];
        return [command, x, y];
    });
}
/**
 * 将点连接成路径 path
 * @param points
 */
function getLinePath(points) {
    return pointsToPath(points);
}
exports.getLinePath = getLinePath;
/**
 * 将点连成平滑的曲线
 * @param points
 */
function getSmoothLinePath(points) {
    if (points.length <= 2) {
        // 两点以内直接绘制成路径
        return getLinePath(points);
    }
    var data = [];
    util_1.each(points, function (p) {
        // 当前点和上一个点一样的时候，忽略掉
        if (!util_1.isEqual(p, data.slice(data.length - 2))) {
            data.push(p[0], p[1]);
        }
    });
    // const constraint = [ // 范围
    //   [ 0, 0 ],
    //   [ 1, 1 ],
    // ];
    var path = path_util_1.catmullRom2Bezier(data, false);
    var _a = util_1.head(points), x = _a[0], y = _a[1];
    path.unshift(['M', x, y]);
    return path;
}
exports.getSmoothLinePath = getSmoothLinePath;
/**
 * 将数据转成 path，利用 scale 的归一化能力
 * @param data
 * @param width
 * @param height
 * @param smooth
 */
function dataToPath(data, width, height, smooth) {
    if (smooth === void 0) { smooth = true; }
    // 利用 scale 来获取 y 上的映射
    var y = new scale_1.Linear({
        values: data,
    });
    var x = new scale_1.Category({
        values: util_1.map(data, function (v, idx) { return idx; }),
    });
    var points = util_1.map(data, function (v, idx) {
        return [x.scale(idx) * width, height - y.scale(v) * height];
    });
    return smooth ? getSmoothLinePath(points) : getLinePath(points);
}
exports.dataToPath = dataToPath;
/**
 * 线 path 转 area path
 * @param path
 * @param width
 * @param height
 */
function linePathToAreaPath(path, width, height) {
    var areaPath = tslib_1.__spreadArrays(path);
    areaPath.push(['L', width, 0]);
    areaPath.push(['L', 0, height]);
    areaPath.push(['Z']);
    return areaPath;
}
exports.linePathToAreaPath = linePathToAreaPath;

},{"@antv/path-util":724,"@antv/scale":747,"@antv/util":803,"tslib":894}],68:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Trend = void 0;
var tslib_1 = require("tslib");
var group_component_1 = require("../abstract/group-component");
var constant_1 = require("./constant");
var path_1 = require("./path");
var Trend = /** @class */ (function (_super) {
    tslib_1.__extends(Trend, _super);
    function Trend() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Trend.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'trend', x: 0, y: 0, width: 200, height: 16, smooth: true, isArea: false, data: [], backgroundStyle: constant_1.BACKGROUND_STYLE, lineStyle: constant_1.LINE_STYLE, areaStyle: constant_1.AREA_STYLE });
    };
    Trend.prototype.renderInner = function (group) {
        var _a = this.cfg, width = _a.width, height = _a.height, data = _a.data, smooth = _a.smooth, isArea = _a.isArea, backgroundStyle = _a.backgroundStyle, lineStyle = _a.lineStyle, areaStyle = _a.areaStyle;
        // 背景
        this.addShape(group, {
            id: this.getElementId('background'),
            type: 'rect',
            attrs: tslib_1.__assign({ x: 0, y: 0, width: width,
                height: height }, backgroundStyle),
        });
        var path = path_1.dataToPath(data, width, height, smooth);
        // 线
        this.addShape(group, {
            id: this.getElementId('line'),
            type: 'path',
            attrs: tslib_1.__assign({ path: path }, lineStyle),
        });
        // area
        // 在 path 的基础上，增加两个坐标点
        if (isArea) {
            var areaPath = path_1.linePathToAreaPath(path, width, height);
            this.addShape(group, {
                id: this.getElementId('area'),
                type: 'path',
                attrs: tslib_1.__assign({ path: areaPath }, areaStyle),
            });
        }
    };
    Trend.prototype.applyOffset = function () {
        var _a = this.cfg, x = _a.x, y = _a.y;
        // 统一移动到对应的位置
        this.moveElementTo(this.get('group'), {
            x: x,
            y: y,
        });
    };
    return Trend;
}(group_component_1.default));
exports.Trend = Trend;
exports.default = Trend;

},{"../abstract/group-component":21,"./constant":66,"./path":67,"tslib":894}],69:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAlignPoint = exports.getPointByPosition = exports.getOutSides = void 0;
// 检测各边是否超出
function getOutSides(x, y, width, height, limitBox) {
    var hits = {
        left: x < limitBox.x,
        right: x + width > limitBox.x + limitBox.width,
        top: y < limitBox.y,
        bottom: y + height > limitBox.y + limitBox.height,
    };
    return hits;
}
exports.getOutSides = getOutSides;
function getPointByPosition(x, y, offset, width, height, position) {
    var px = x;
    var py = y;
    switch (position) {
        case 'left': // left center
            px = x - width - offset;
            py = y - height / 2;
            break;
        case 'right':
            px = x + offset;
            py = y - height / 2;
            break;
        case 'top':
            px = x - width / 2;
            py = y - height - offset;
            break;
        case 'bottom':
            // bottom
            px = x - width / 2;
            py = y + offset;
            break;
        default:
            // auto, 在 top-right
            px = x + offset;
            py = y - height - offset;
            break;
    }
    return {
        x: px,
        y: py,
    };
}
exports.getPointByPosition = getPointByPosition;
function getAlignPoint(x, y, offset, width, height, position, limitBox) {
    var point = getPointByPosition(x, y, offset, width, height, position);
    if (limitBox) {
        var outSides = getOutSides(point.x, point.y, width, height, limitBox);
        if (position === 'auto') {
            // 如果是 auto，默认 tooltip 在右上角，仅需要判定右侧和上测冲突即可
            if (outSides.right) {
                point.x = Math.max(0, x - width - offset);
            }
            if (outSides.top) {
                point.y = Math.max(0, y - height - offset);
            }
        }
        else if (position === 'top' || position === 'bottom') {
            if (outSides.left) {
                // 左侧躲避
                point.x = limitBox.x;
            }
            if (outSides.right) {
                // 右侧躲避
                point.x = limitBox.x + limitBox.width - width;
            }
            if (position === 'top' && outSides.top) {
                // 如果上面对齐检测上面，不检测下面
                point.y = y + offset;
            }
            if (position === 'bottom' && outSides.bottom) {
                point.y = y - height - offset;
            }
        }
        else {
            // 检测左右位置
            if (outSides.top) {
                point.y = limitBox.y;
            }
            if (outSides.bottom) {
                point.y = limitBox.y + limitBox.height - height;
            }
            if (position === 'left' && outSides.left) {
                point.x = x + offset;
            }
            if (position === 'right' && outSides.right) {
                point.x = x - width - offset;
            }
        }
    }
    return point;
}
exports.getAlignPoint = getAlignPoint;

},{}],70:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.propagationDelegate = void 0;
var graph_event_1 = require("@antv/g-base/lib/event/graph-event");
/**
 *
 * @param group 分组
 * @param eventName 事件名
 * @param eventObject 事件对象
 */
function propagationDelegate(group, eventName, eventObject) {
    var event = new graph_event_1.default(eventName, eventObject);
    event.target = group;
    event.propagationPath.push(group); // 从当前 group 开始触发 delegation
    group.emitDelegation(eventName, event);
    var parent = group.getParent();
    // 执行冒泡
    while (parent) {
        // 委托事件要先触发
        parent.emitDelegation(eventName, event);
        event.propagationPath.push(parent);
        parent = parent.getParent();
    }
}
exports.propagationDelegate = propagationDelegate;

},{"@antv/g-base/lib/event/graph-event":114}],71:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderTag = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var label_1 = require("./label");
var matrix_1 = require("./matrix");
var util_2 = require("./util");
function renderTag(container, tagCfg) {
    var x = tagCfg.x, y = tagCfg.y, content = tagCfg.content, style = tagCfg.style, id = tagCfg.id, name = tagCfg.name, rotate = tagCfg.rotate, maxLength = tagCfg.maxLength, autoEllipsis = tagCfg.autoEllipsis, isVertical = tagCfg.isVertical, ellipsisPosition = tagCfg.ellipsisPosition, background = tagCfg.background;
    var tagGroup = container.addGroup({
        id: id + "-group",
        name: name + "-group",
        attrs: {
            x: x,
            y: y,
        }
    });
    // Text shape
    var text = tagGroup.addShape({
        type: 'text',
        id: id,
        name: name,
        attrs: tslib_1.__assign({ x: 0, y: 0, text: content }, style),
    });
    // maxLength 应包含 background 中的 padding 值
    var padding = util_2.formatPadding(util_1.get(background, 'padding', 0));
    if (maxLength && autoEllipsis) {
        var maxTextLength = maxLength - (padding[1] + padding[3]);
        // 超出自动省略
        label_1.ellipsisLabel(!isVertical, text, maxTextLength, ellipsisPosition);
    }
    if (background) {
        // 渲染文本背景
        var backgroundStyle = util_1.get(background, 'style', {});
        var _a = text.getCanvasBBox(), minX = _a.minX, minY = _a.minY, width = _a.width, height = _a.height;
        var tagBg = tagGroup.addShape('rect', {
            id: id + "-bg",
            name: id + "-bg",
            attrs: tslib_1.__assign({ x: minX - padding[3], y: minY - padding[0], width: width + padding[1] + padding[3], height: height + padding[0] + padding[2] }, backgroundStyle),
        });
        tagBg.toBack();
    }
    matrix_1.applyTranslate(tagGroup, x, y);
    matrix_1.applyRotate(tagGroup, rotate, x, y);
}
exports.renderTag = renderTag;

},{"./label":72,"./matrix":73,"./util":77,"@antv/util":803,"tslib":894}],72:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ellipsisLabel = exports.testLabel = exports.getLabelLength = exports.getMaxLabelWidth = void 0;
var util_1 = require("@antv/util");
var text_1 = require("./text");
var ELLIPSIS_CODE = '\u2026';
var ELLIPSIS_CODE_LENGTH = 2; // 省略号的长度
/** 获取最长的 label */
function getMaxLabelWidth(labels) {
    var max = 0;
    util_1.each(labels, function (label) {
        var bbox = label.getBBox();
        var width = bbox.width;
        if (max < width) {
            max = width;
        }
    });
    return max;
}
exports.getMaxLabelWidth = getMaxLabelWidth;
/** 获取label长度 */
function getLabelLength(isVertical, label) {
    var bbox = label.getCanvasBBox();
    return isVertical ? bbox.width : bbox.height;
}
exports.getLabelLength = getLabelLength;
/* label长度是否超过约束值 */
function testLabel(label, limitLength) {
    return label.getBBox().width < limitLength;
}
exports.testLabel = testLabel;
/** 处理 text shape 的自动省略 */
function ellipsisLabel(isVertical, label, limitLength, position) {
    if (position === void 0) { position = 'tail'; }
    var text = label.attr('text');
    var labelLength = getLabelLength(isVertical, label);
    var codeLength = text_1.strLen(text);
    var ellipsised = false;
    if (limitLength < labelLength) {
        var reseveLength = Math.floor((limitLength / labelLength) * codeLength) - ELLIPSIS_CODE_LENGTH; // 计算出来的应该保存的长度
        var newText = void 0;
        if (reseveLength >= 0) {
            newText = text_1.ellipsisString(text, reseveLength, position);
        }
        else {
            newText = ELLIPSIS_CODE;
        }
        if (newText) {
            label.attr('text', newText);
            ellipsised = true;
        }
    }
    if (ellipsised) {
        label.set('tip', text);
    }
    else {
        label.set('tip', null);
    }
    return ellipsised;
}
exports.ellipsisLabel = ellipsisLabel;

},{"./text":75,"@antv/util":803}],73:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyTranslate = exports.applyRotate = exports.applyMatrix2BBox = exports.getAngleByMatrix = exports.getMatrixByTranslate = exports.getMatrixByAngle = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var identityMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
function getMatrixByAngle(point, angle, matrix) {
    if (matrix === void 0) { matrix = identityMatrix; }
    if (!angle) {
        // 角度为 0 或者 null 时返回 null
        return null;
    }
    var m = matrix_util_1.ext.transform(matrix, [
        ['t', -point.x, -point.y],
        ['r', angle],
        ['t', point.x, point.y],
    ]);
    return m;
}
exports.getMatrixByAngle = getMatrixByAngle;
function getMatrixByTranslate(point, currentMatrix) {
    if (!point.x && !point.y) {
        // 0，0 或者 nan 的情况下返回 null
        return null;
    }
    return matrix_util_1.ext.transform(currentMatrix || identityMatrix, [['t', point.x, point.y]]);
}
exports.getMatrixByTranslate = getMatrixByTranslate;
// 从矩阵获取旋转的角度
function getAngleByMatrix(matrix) {
    var xVector = [1, 0, 0];
    var out = [0, 0, 0];
    matrix_util_1.vec3.transformMat3(out, xVector, matrix);
    return Math.atan2(out[1], out[0]);
}
exports.getAngleByMatrix = getAngleByMatrix;
// 矩阵 * 向量
function multiplyVec2(matrix, v) {
    var out = [0, 0];
    matrix_util_1.vec2.transformMat3(out, v, matrix);
    return out;
}
function applyMatrix2BBox(matrix, bbox) {
    var topLeft = multiplyVec2(matrix, [bbox.minX, bbox.minY]);
    var topRight = multiplyVec2(matrix, [bbox.maxX, bbox.minY]);
    var bottomLeft = multiplyVec2(matrix, [bbox.minX, bbox.maxY]);
    var bottomRight = multiplyVec2(matrix, [bbox.maxX, bbox.maxY]);
    var minX = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
    var maxX = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
    var minY = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
    var maxY = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
    return {
        x: minX,
        y: minY,
        minX: minX,
        minY: minY,
        maxX: maxX,
        maxY: maxY,
        width: maxX - minX,
        height: maxY - minY,
    };
}
exports.applyMatrix2BBox = applyMatrix2BBox;
function applyRotate(shape, rotate, x, y) {
    if (rotate) {
        var matrix = getMatrixByAngle({ x: x, y: y }, rotate, shape.getMatrix());
        shape.setMatrix(matrix);
    }
}
exports.applyRotate = applyRotate;
function applyTranslate(shape, x, y) {
    var translateMatrix = getMatrixByTranslate({ x: x, y: y });
    shape.attr('matrix', translateMatrix);
}
exports.applyTranslate = applyTranslate;

},{"@antv/matrix-util":717}],74:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStatesStyle = void 0;
var util_1 = require("@antv/util");
// 获取多个状态量的合并值
function getStatesStyle(item, elementName, stateStyles) {
    var styleName = elementName + "Style"; // activeStyle
    var styles = null;
    util_1.each(stateStyles, function (v, state) {
        if (item[state] && v[styleName]) {
            if (!styles) {
                styles = {};
            }
            util_1.mix(styles, v[styleName]); // 合并样式
        }
    });
    return styles;
}
exports.getStatesStyle = getStatesStyle;

},{"@antv/util":803}],75:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ellipsisString = exports.charAtLength = exports.strLen = void 0;
var ELLIPSIS_CODE = '\u2026';
/** 获取字符串长度 */
function strLen(str) {
    var len = 0;
    for (var i = 0; i < str.length; i++) {
        len += charAtLength(str, i);
    }
    return len;
}
exports.strLen = strLen;
/** 是否属于ASCII编码范畴 */
function charAtLength(str, i) {
    if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
        return 1;
    }
    else {
        return 2;
    }
}
exports.charAtLength = charAtLength;
/** 文本省略 */
function ellipsisString(str, reseveLength, position) {
    if (position === void 0) { position = 'tail'; }
    var count = str.length;
    var rst = '';
    if (position === 'tail') {
        for (var i = 0, index = 0; i < reseveLength;) {
            var charLength = charAtLength(str, index);
            if (i + charLength <= reseveLength) {
                rst += str[index];
                i += charAtLength(str, index);
                index++;
            }
            else {
                break;
            }
        }
        rst += ELLIPSIS_CODE;
    }
    else if (position === 'head') {
        for (var i = 0, index = count - 1; i < reseveLength;) {
            var charLength = charAtLength(str, index);
            if (i + charLength <= reseveLength) {
                rst += str[index];
                i += charAtLength(str, index);
                index--;
            }
            else {
                break;
            }
        }
        rst = ELLIPSIS_CODE + rst;
    }
    else {
        var startStr = '';
        var endStr = '';
        for (var i = 0, startIndex = 0, endIndex = count - 1; i < reseveLength;) {
            var startCodeLen = charAtLength(str, startIndex);
            var hasAdd = false; // 设置标志位，防止头尾都没有附加字符
            if (startCodeLen + i <= reseveLength) {
                startStr += str[startIndex];
                startIndex++;
                i += startCodeLen;
                hasAdd = true;
            }
            var endCodeLen = charAtLength(str, endIndex);
            if (endCodeLen + i <= reseveLength) {
                endStr = str[endIndex] + endStr;
                i += endCodeLen;
                endIndex--;
                hasAdd = true;
            }
            if (!hasAdd) {
                // 如果都没有增加字符，说明都不适合则中断
                break;
            }
        }
        rst = startStr + ELLIPSIS_CODE + endStr;
    }
    return rst;
}
exports.ellipsisString = ellipsisString;

},{}],76:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
    fontFamily: "\n  \"-apple-system\", BlinkMacSystemFont, \"Segoe UI\", Roboto,\"Helvetica Neue\",\n  Helvetica, \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\",\n  SimSun, \"sans-serif\"",
    textColor: '#2C3542',
    activeTextColor: '#333333',
    uncheckedColor: '#D8D8D8',
    lineColor: '#416180',
    regionColor: '#CCD7EB',
    verticalAxisRotate: -Math.PI / 4,
    horizontalAxisRotate: Math.PI / 4,
};

},{}],77:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTextPoint = exports.toPx = exports.updateClip = exports.getBBoxWithClip = exports.mergeBBox = exports.intersectBBox = exports.near = exports.wait = exports.distance = exports.getCirclePoint = exports.getValueByPercent = exports.createBBox = exports.pointsToBBox = exports.regionToBBox = exports.hasClass = exports.clearDom = exports.formatPadding = void 0;
var util_1 = require("@antv/util");
function formatPadding(padding) {
    var top = 0;
    var left = 0;
    var right = 0;
    var bottom = 0;
    if (util_1.isNumber(padding)) {
        top = left = right = bottom = padding;
    }
    else if (util_1.isArray(padding)) {
        top = padding[0];
        right = !util_1.isNil(padding[1]) ? padding[1] : padding[0];
        bottom = !util_1.isNil(padding[2]) ? padding[2] : padding[0];
        left = !util_1.isNil(padding[3]) ? padding[3] : right;
    }
    return [top, right, bottom, left];
}
exports.formatPadding = formatPadding;
function clearDom(container) {
    var children = container.childNodes;
    var length = children.length;
    for (var i = length - 1; i >= 0; i--) {
        container.removeChild(children[i]);
    }
}
exports.clearDom = clearDom;
function hasClass(elements, cName) {
    return !!elements.className.match(new RegExp("(\\s|^)" + cName + "(\\s|$)"));
}
exports.hasClass = hasClass;
function regionToBBox(region) {
    var start = region.start, end = region.end;
    var minX = Math.min(start.x, end.x);
    var minY = Math.min(start.y, end.y);
    var maxX = Math.max(start.x, end.x);
    var maxY = Math.max(start.y, end.y);
    return {
        x: minX,
        y: minY,
        minX: minX,
        minY: minY,
        maxX: maxX,
        maxY: maxY,
        width: maxX - minX,
        height: maxY - minY,
    };
}
exports.regionToBBox = regionToBBox;
function pointsToBBox(points) {
    var xs = points.map(function (point) { return point.x; });
    var ys = points.map(function (point) { return point.y; });
    var minX = Math.min.apply(Math, xs);
    var minY = Math.min.apply(Math, ys);
    var maxX = Math.max.apply(Math, xs);
    var maxY = Math.max.apply(Math, ys);
    return {
        x: minX,
        y: minY,
        minX: minX,
        minY: minY,
        maxX: maxX,
        maxY: maxY,
        width: maxX - minX,
        height: maxY - minY,
    };
}
exports.pointsToBBox = pointsToBBox;
function createBBox(x, y, width, height) {
    return {
        x: x,
        y: y,
        width: width,
        height: height,
        minX: x,
        minY: y,
        maxX: x + width,
        maxY: y + height,
    };
}
exports.createBBox = createBBox;
function getValueByPercent(min, max, percent) {
    return (1 - percent) * min + max * percent;
}
exports.getValueByPercent = getValueByPercent;
function getCirclePoint(center, radius, angle) {
    return {
        x: center.x + Math.cos(angle) * radius,
        y: center.y + Math.sin(angle) * radius,
    };
}
exports.getCirclePoint = getCirclePoint;
function distance(p1, p2) {
    var dx = p2.x - p1.x;
    var dy = p2.y - p1.y;
    return Math.sqrt(dx * dx + dy * dy);
}
exports.distance = distance;
exports.wait = function (interval) {
    return new Promise(function (resolve) {
        setTimeout(resolve, interval);
    });
};
exports.near = function (x, y) {
    return [x, y].includes(Infinity) ? Math.abs(x) === Math.abs(y) : Math.abs(x - y) < Math.pow(Number.EPSILON, 0.5);
};
function intersectBBox(box1, box2) {
    var minX = Math.max(box1.minX, box2.minX);
    var minY = Math.max(box1.minY, box2.minY);
    var maxX = Math.min(box1.maxX, box2.maxX);
    var maxY = Math.min(box1.maxY, box2.maxY);
    return createBBox(minX, minY, maxX - minX, maxY - minY);
}
exports.intersectBBox = intersectBBox;
function mergeBBox(box1, box2) {
    var minX = Math.min(box1.minX, box2.minX);
    var minY = Math.min(box1.minY, box2.minY);
    var maxX = Math.max(box1.maxX, box2.maxX);
    var maxY = Math.max(box1.maxY, box2.maxY);
    return createBBox(minX, minY, maxX - minX, maxY - minY);
}
exports.mergeBBox = mergeBBox;
function getBBoxWithClip(element) {
    var clipShape = element.getClip();
    var clipBBox = clipShape && clipShape.getBBox();
    var bbox;
    if (!element.isGroup()) {
        // 如果是普通的图形
        bbox = element.getBBox();
    }
    else {
        var minX_1 = Infinity;
        var maxX_1 = -Infinity;
        var minY_1 = Infinity;
        var maxY_1 = -Infinity;
        var children = element.getChildren();
        if (children.length > 0) {
            util_1.each(children, function (child) {
                if (child.get('visible')) {
                    // 如果分组没有子元素，则直接跳过
                    if (child.isGroup() && child.get('children').length === 0) {
                        return true;
                    }
                    var box = getBBoxWithClip(child);
                    // 计算 4 个顶点
                    var leftTop = child.applyToMatrix([box.minX, box.minY, 1]);
                    var leftBottom = child.applyToMatrix([box.minX, box.maxY, 1]);
                    var rightTop = child.applyToMatrix([box.maxX, box.minY, 1]);
                    var rightBottom = child.applyToMatrix([box.maxX, box.maxY, 1]);
                    // 从中取最小的范围
                    var boxMinX = Math.min(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
                    var boxMaxX = Math.max(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
                    var boxMinY = Math.min(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
                    var boxMaxY = Math.max(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
                    if (boxMinX < minX_1) {
                        minX_1 = boxMinX;
                    }
                    if (boxMaxX > maxX_1) {
                        maxX_1 = boxMaxX;
                    }
                    if (boxMinY < minY_1) {
                        minY_1 = boxMinY;
                    }
                    if (boxMaxY > maxY_1) {
                        maxY_1 = boxMaxY;
                    }
                }
            });
        }
        else {
            minX_1 = 0;
            maxX_1 = 0;
            minY_1 = 0;
            maxY_1 = 0;
        }
        bbox = createBBox(minX_1, minY_1, maxX_1 - minX_1, maxY_1 - minY_1);
    }
    if (clipBBox) {
        return intersectBBox(bbox, clipBBox);
    }
    else {
        return bbox;
    }
}
exports.getBBoxWithClip = getBBoxWithClip;
function updateClip(element, newElement) {
    if (!element.getClip() && !newElement.getClip()) {
        // 两者都没有 clip
        return;
    }
    var newClipShape = newElement.getClip();
    if (!newClipShape) {
        // 新的 element 没有 clip
        element.setClip(null); // 移除 clip
        return;
    }
    var clipCfg = {
        type: newClipShape.get('type'),
        attrs: newClipShape.attr(),
    };
    element.setClip(clipCfg);
}
exports.updateClip = updateClip;
function toPx(number) {
    return number + "px";
}
exports.toPx = toPx;
function getTextPoint(start, end, position, offset) {
    var lineLength = distance(start, end);
    var offsetPercent = offset / lineLength; // 计算间距同线的比例，用于计算最终的位置
    var percent = 0;
    if (position === 'start') {
        percent = 0 - offsetPercent;
    }
    else if (position === 'end') {
        percent = 1 + offsetPercent;
    }
    return {
        x: getValueByPercent(start.x, end.x, percent),
        y: getValueByPercent(start.y, end.y, percent),
    };
}
exports.getTextPoint = getTextPoint;

},{"@antv/util":803}],78:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
/**
 * Coordinate Base Class
 */
var Coordinate = /** @class */ (function () {
    function Coordinate(cfg) {
        // 自身属性
        this.type = 'coordinate';
        this.isRect = false;
        this.isHelix = false;
        this.isPolar = false;
        this.isReflectX = false;
        this.isReflectY = false;
        var start = cfg.start, end = cfg.end, _a = cfg.matrix, matrix = _a === void 0 ? [1, 0, 0, 0, 1, 0, 0, 0, 1] : _a, _b = cfg.isTransposed, isTransposed = _b === void 0 ? false : _b;
        this.start = start;
        this.end = end;
        this.matrix = matrix;
        this.originalMatrix = tslib_1.__spreadArrays(matrix); // 去除引用
        this.isTransposed = isTransposed;
    }
    /**
     * 初始化流程
     */
    Coordinate.prototype.initial = function () {
        // center、width、height
        this.center = {
            x: (this.start.x + this.end.x) / 2,
            y: (this.start.y + this.end.y) / 2,
        };
        this.width = Math.abs(this.end.x - this.start.x);
        this.height = Math.abs(this.end.y - this.start.y);
    };
    /**
     * 更新配置
     * @param cfg
     */
    Coordinate.prototype.update = function (cfg) {
        util_1.assign(this, cfg);
        this.initial();
    };
    Coordinate.prototype.convertDim = function (percent, dim) {
        var _a;
        var _b = this[dim], start = _b.start, end = _b.end;
        // 交换
        if (this.isReflect(dim)) {
            _a = [end, start], start = _a[0], end = _a[1];
        }
        return start + percent * (end - start);
    };
    Coordinate.prototype.invertDim = function (value, dim) {
        var _a;
        var _b = this[dim], start = _b.start, end = _b.end;
        // 交换
        if (this.isReflect(dim)) {
            _a = [end, start], start = _a[0], end = _a[1];
        }
        return (value - start) / (end - start);
    };
    /**
     * 将坐标点进行矩阵变换
     * @param x   对应 x 轴画布坐标
     * @param y   对应 y 轴画布坐标
     * @param tag 默认为 0，可取值 0, 1
     * @return    返回变换后的三阶向量 [x, y, z]
     */
    Coordinate.prototype.applyMatrix = function (x, y, tag) {
        if (tag === void 0) { tag = 0; }
        var matrix = this.matrix;
        var vector = [x, y, tag];
        matrix_util_1.vec3.transformMat3(vector, vector, matrix);
        return vector;
    };
    /**
     * 将坐标点进行矩阵逆变换
     * @param x   对应 x 轴画布坐标
     * @param y   对应 y 轴画布坐标
     * @param tag 默认为 0，可取值 0, 1
     * @return    返回矩阵逆变换后的三阶向量 [x, y, z]
     */
    Coordinate.prototype.invertMatrix = function (x, y, tag) {
        if (tag === void 0) { tag = 0; }
        var matrix = this.matrix;
        var inverted = matrix_util_1.mat3.invert([0, 0, 0, 0, 0, 0, 0, 0, 0], matrix);
        var vector = [x, y, tag];
        if (inverted) {
            // 如果为空则不进行矩阵变化，防止报错
            matrix_util_1.vec3.transformMat3(vector, vector, inverted);
        }
        return vector;
    };
    /**
     * 将归一化的坐标点数据转换为画布坐标，并根据坐标系当前矩阵进行变换
     * @param point 归一化的坐标点
     * @return      返回进行矩阵变换后的画布坐标
     */
    Coordinate.prototype.convert = function (point) {
        var _a = this.convertPoint(point), x = _a.x, y = _a.y;
        var vector = this.applyMatrix(x, y, 1);
        return {
            x: vector[0],
            y: vector[1],
        };
    };
    /**
     * 将进行过矩阵变换画布坐标转换为归一化坐标
     * @param point 画布坐标
     * @return      返回归一化的坐标点
     */
    Coordinate.prototype.invert = function (point) {
        var vector = this.invertMatrix(point.x, point.y, 1);
        return this.invertPoint({
            x: vector[0],
            y: vector[1],
        });
    };
    /**
     * 坐标系旋转变换
     * @param  radian 旋转弧度
     * @return        返回坐标系对象
     */
    Coordinate.prototype.rotate = function (radian) {
        var matrix = this.matrix;
        var center = this.center;
        matrix_util_1.ext.leftTranslate(matrix, matrix, [-center.x, -center.y]);
        matrix_util_1.ext.leftRotate(matrix, matrix, radian);
        matrix_util_1.ext.leftTranslate(matrix, matrix, [center.x, center.y]);
        return this;
    };
    /**
     * 坐标系反射变换
     * @param dim 反射维度
     * @return    返回坐标系对象
     */
    Coordinate.prototype.reflect = function (dim) {
        if (dim === 'x') {
            this.isReflectX = !this.isReflectX;
        }
        else {
            this.isReflectY = !this.isReflectY;
        }
        return this;
    };
    /**
     * 坐标系比例变换
     * @param s1 x 方向缩放比例
     * @param s2 y 方向缩放比例
     * @return     返回坐标系对象
     */
    Coordinate.prototype.scale = function (s1, s2) {
        var matrix = this.matrix;
        var center = this.center;
        matrix_util_1.ext.leftTranslate(matrix, matrix, [-center.x, -center.y]);
        matrix_util_1.ext.leftScale(matrix, matrix, [s1, s2]);
        matrix_util_1.ext.leftTranslate(matrix, matrix, [center.x, center.y]);
        return this;
    };
    /**
     * 坐标系平移变换
     * @param x x 方向平移像素
     * @param y y 方向平移像素
     * @return    返回坐标系对象
     */
    Coordinate.prototype.translate = function (x, y) {
        var matrix = this.matrix;
        matrix_util_1.ext.leftTranslate(matrix, matrix, [x, y]);
        return this;
    };
    /**
     * 将坐标系 x y 两个轴进行转置
     * @return 返回坐标系对象
     */
    Coordinate.prototype.transpose = function () {
        this.isTransposed = !this.isTransposed;
        return this;
    };
    Coordinate.prototype.getCenter = function () {
        return this.center;
    };
    Coordinate.prototype.getWidth = function () {
        return this.width;
    };
    Coordinate.prototype.getHeight = function () {
        return this.height;
    };
    Coordinate.prototype.getRadius = function () {
        return this.radius;
    };
    /**
     * whether has reflect
     * @param dim
     */
    Coordinate.prototype.isReflect = function (dim) {
        return dim === 'x' ? this.isReflectX : this.isReflectY;
    };
    /**
     * 重置 matrix
     * @param matrix 如果传入，则使用，否则使用构造函数中传入的默认 matrix
     */
    Coordinate.prototype.resetMatrix = function (matrix) {
        // 去除引用关系
        this.matrix = matrix ? matrix : tslib_1.__spreadArrays(this.originalMatrix);
    };
    return Coordinate;
}());
exports.default = Coordinate;

},{"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],79:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
/**
 * 笛卡尔坐标系
 * https://www.zhihu.com/question/20665303
 */
var Cartesian = /** @class */ (function (_super) {
    tslib_1.__extends(Cartesian, _super);
    function Cartesian(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.isRect = true;
        _this.type = 'cartesian';
        _this.initial();
        return _this;
    }
    Cartesian.prototype.initial = function () {
        _super.prototype.initial.call(this);
        var start = this.start;
        var end = this.end;
        this.x = {
            start: start.x,
            end: end.x,
        };
        this.y = {
            start: start.y,
            end: end.y,
        };
    };
    Cartesian.prototype.convertPoint = function (point) {
        var _a;
        var x = point.x, y = point.y;
        // 交换
        if (this.isTransposed) {
            _a = [y, x], x = _a[0], y = _a[1];
        }
        return {
            x: this.convertDim(x, 'x'),
            y: this.convertDim(y, 'y'),
        };
    };
    Cartesian.prototype.invertPoint = function (point) {
        var _a;
        var x = this.invertDim(point.x, 'x');
        var y = this.invertDim(point.y, 'y');
        if (this.isTransposed) {
            _a = [y, x], x = _a[0], y = _a[1];
        }
        return { x: x, y: y };
    };
    return Cartesian;
}(base_1.default));
exports.default = Cartesian;

},{"./base":78,"tslib":894}],80:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var base_1 = require("./base");
/**
 * 螺旋坐标系
 */
var Helix = /** @class */ (function (_super) {
    tslib_1.__extends(Helix, _super);
    function Helix(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.isHelix = true;
        _this.type = 'helix';
        var _a = cfg.startAngle, startAngle = _a === void 0 ? 1.25 * Math.PI : _a, _b = cfg.endAngle, endAngle = _b === void 0 ? 7.25 * Math.PI : _b, _c = cfg.innerRadius, innerRadius = _c === void 0 ? 0 : _c, radius = cfg.radius;
        _this.startAngle = startAngle;
        _this.endAngle = endAngle;
        _this.innerRadius = innerRadius;
        _this.radius = radius;
        _this.initial();
        return _this;
    }
    Helix.prototype.initial = function () {
        _super.prototype.initial.call(this);
        var index = (this.endAngle - this.startAngle) / (2 * Math.PI) + 1; // 螺线圈数
        var maxRadius = Math.min(this.width, this.height) / 2;
        if (this.radius && this.radius >= 0 && this.radius <= 1) {
            maxRadius = maxRadius * this.radius;
        }
        this.d = Math.floor((maxRadius * (1 - this.innerRadius)) / index);
        this.a = this.d / (Math.PI * 2); // 螺线系数
        this.x = {
            start: this.startAngle,
            end: this.endAngle,
        };
        this.y = {
            start: this.innerRadius * maxRadius,
            end: this.innerRadius * maxRadius + this.d * 0.99,
        };
    };
    /**
     * 将百分比数据变成屏幕坐标
     * @param point 归一化的点坐标
     * @return      返回对应的屏幕坐标
     */
    Helix.prototype.convertPoint = function (point) {
        var _a;
        var x = point.x, y = point.y;
        if (this.isTransposed) {
            _a = [y, x], x = _a[0], y = _a[1];
        }
        var thi = this.convertDim(x, 'x');
        var r = this.a * thi;
        var newY = this.convertDim(y, 'y');
        return {
            x: this.center.x + Math.cos(thi) * (r + newY),
            y: this.center.y + Math.sin(thi) * (r + newY),
        };
    };
    /**
     * 将屏幕坐标点还原成百分比数据
     * @param point 屏幕坐标
     * @return      返回对应的归一化后的数据
     */
    Helix.prototype.invertPoint = function (point) {
        var _a;
        var d = this.d + this.y.start;
        var v = matrix_util_1.vec2.subtract([0, 0], [point.x, point.y], [this.center.x, this.center.y]);
        var thi = matrix_util_1.ext.angleTo(v, [1, 0], true);
        var rMin = thi * this.a; // 坐标与原点的连线在第一圈上的交点，最小r值
        if (matrix_util_1.vec2.length(v) < rMin) {
            // 坐标与原点的连线不可能小于最小r值，但不排除因小数计算产生的略小于rMin的情况
            rMin = matrix_util_1.vec2.length(v);
        }
        var index = Math.floor((matrix_util_1.vec2.length(v) - rMin) / d); // 当前点位于第index圈
        thi = 2 * index * Math.PI + thi;
        var r = this.a * thi;
        var newY = matrix_util_1.vec2.length(v) - r;
        newY = util_1.isNumberEqual(newY, 0) ? 0 : newY;
        var x = this.invertDim(thi, 'x');
        var y = this.invertDim(newY, 'y');
        x = util_1.isNumberEqual(x, 0) ? 0 : x;
        y = util_1.isNumberEqual(y, 0) ? 0 : y;
        if (this.isTransposed) {
            _a = [y, x], x = _a[0], y = _a[1];
        }
        return { x: x, y: y };
    };
    return Helix;
}(base_1.default));
exports.default = Helix;

},{"./base":78,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],81:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var Polar = /** @class */ (function (_super) {
    tslib_1.__extends(Polar, _super);
    function Polar(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.isPolar = true;
        _this.type = 'polar';
        var _a = cfg.startAngle, startAngle = _a === void 0 ? -Math.PI / 2 : _a, _b = cfg.endAngle, endAngle = _b === void 0 ? (Math.PI * 3) / 2 : _b, _c = cfg.innerRadius, innerRadius = _c === void 0 ? 0 : _c, radius = cfg.radius;
        _this.startAngle = startAngle;
        _this.endAngle = endAngle;
        _this.innerRadius = innerRadius;
        _this.radius = radius;
        _this.initial();
        return _this;
    }
    Polar.prototype.initial = function () {
        _super.prototype.initial.call(this);
        while (this.endAngle < this.startAngle) {
            this.endAngle += Math.PI * 2;
        }
        var oneBox = this.getOneBox();
        var oneWidth = oneBox.maxX - oneBox.minX;
        var oneHeight = oneBox.maxY - oneBox.minY;
        var left = Math.abs(oneBox.minX) / oneWidth;
        var top = Math.abs(oneBox.minY) / oneHeight;
        var maxRadius;
        if (this.height / oneHeight > this.width / oneWidth) {
            // width 为主
            maxRadius = this.width / oneWidth;
            this.circleCenter = {
                x: this.center.x - (0.5 - left) * this.width,
                y: this.center.y - (0.5 - top) * maxRadius * oneHeight,
            };
        }
        else {
            // height 为主
            maxRadius = this.height / oneHeight;
            this.circleCenter = {
                x: this.center.x - (0.5 - left) * maxRadius * oneWidth,
                y: this.center.y - (0.5 - top) * this.height,
            };
        }
        this.polarRadius = this.radius;
        if (!this.radius) {
            this.polarRadius = maxRadius;
        }
        else if (this.radius > 0 && this.radius <= 1) {
            this.polarRadius = maxRadius * this.radius;
        }
        else if (this.radius <= 0 || this.radius > maxRadius) {
            this.polarRadius = maxRadius;
        }
        this.x = {
            start: this.startAngle,
            end: this.endAngle,
        };
        this.y = {
            start: this.innerRadius * this.polarRadius,
            end: this.polarRadius,
        };
    };
    Polar.prototype.getRadius = function () {
        return this.polarRadius;
    };
    Polar.prototype.convertPoint = function (point) {
        var _a;
        var center = this.getCenter();
        var x = point.x, y = point.y;
        if (this.isTransposed) {
            _a = [y, x], x = _a[0], y = _a[1];
        }
        x = this.convertDim(x, 'x');
        y = this.convertDim(y, 'y');
        return {
            x: center.x + Math.cos(x) * y,
            y: center.y + Math.sin(x) * y,
        };
    };
    Polar.prototype.invertPoint = function (point) {
        var center = this.getCenter();
        var vPoint = [point.x - center.x, point.y - center.y];
        var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
        matrix_util_1.ext.leftRotate(m, m, this.startAngle);
        var vStart3 = [1, 0, 0];
        matrix_util_1.vec3.transformMat3(vStart3, vStart3, m);
        var vStart2 = [vStart3[0], vStart3[1]];
        var angle = matrix_util_1.ext.angleTo(vStart2, vPoint, this.endAngle < this.startAngle);
        if (util_1.isNumberEqual(angle, Math.PI * 2)) {
            angle = 0;
        }
        var radius = matrix_util_1.vec2.length(vPoint);
        var xPercent = angle / (this.endAngle - this.startAngle);
        xPercent = this.endAngle - this.startAngle > 0 ? xPercent : -xPercent;
        var yPercent = this.invertDim(radius, 'y');
        var rst = { x: 0, y: 0 };
        rst.x = this.isTransposed ? yPercent : xPercent;
        rst.y = this.isTransposed ? xPercent : yPercent;
        return rst;
    };
    Polar.prototype.getCenter = function () {
        return this.circleCenter;
    };
    Polar.prototype.getOneBox = function () {
        var startAngle = this.startAngle;
        var endAngle = this.endAngle;
        if (Math.abs(endAngle - startAngle) >= Math.PI * 2) {
            return {
                minX: -1,
                maxX: 1,
                minY: -1,
                maxY: 1,
            };
        }
        var xs = [0, Math.cos(startAngle), Math.cos(endAngle)];
        var ys = [0, Math.sin(startAngle), Math.sin(endAngle)];
        for (var i = Math.min(startAngle, endAngle); i < Math.max(startAngle, endAngle); i += Math.PI / 18) {
            xs.push(Math.cos(i));
            ys.push(Math.sin(i));
        }
        return {
            minX: Math.min.apply(Math, xs),
            maxX: Math.max.apply(Math, xs),
            minY: Math.min.apply(Math, ys),
            maxY: Math.max.apply(Math, ys),
        };
    };
    return Polar;
}(base_1.default));
exports.default = Polar;

},{"./base":78,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],82:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 所有的 Coordinate map
var COORDINATE_MAP = {};
/**
 * 通过类型获得 coordinate 类
 * @param type
 */
exports.getCoordinate = function (type) {
    return COORDINATE_MAP[type.toLowerCase()];
};
/**
 * 注册 coordinate 类
 * @param type
 * @param ctor
 */
exports.registerCoordinate = function (type, ctor) {
    // 存储到 map 中
    COORDINATE_MAP[type.toLowerCase()] = ctor;
};

},{}],83:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./coord/base");
exports.Coordinate = base_1.default;
var cartesian_1 = require("./coord/cartesian");
var helix_1 = require("./coord/helix");
var polar_1 = require("./coord/polar");
var factory_1 = require("./factory");
exports.getCoordinate = factory_1.getCoordinate;
exports.registerCoordinate = factory_1.registerCoordinate;
factory_1.registerCoordinate('rect', cartesian_1.default);
factory_1.registerCoordinate('cartesian', cartesian_1.default);
factory_1.registerCoordinate('polar', polar_1.default);
factory_1.registerCoordinate('helix', helix_1.default);

},{"./coord/base":78,"./coord/cartesian":79,"./coord/helix":80,"./coord/polar":81,"./factory":82}],84:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function addEventListener(target, eventType, callback) {
    if (target) {
        if (typeof target.addEventListener === 'function') {
            target.addEventListener(eventType, callback, false);
            return {
                remove: function () {
                    target.removeEventListener(eventType, callback, false);
                },
            };
            // @ts-ignore
        }
        if (typeof target.attachEvent === 'function') {
            // @ts-ignore
            target.attachEvent('on' + eventType, callback);
            return {
                remove: function () {
                    // @ts-ignore
                    target.detachEvent('on' + eventType, callback);
                },
            };
        }
    }
}
exports.default = addEventListener;

},{}],85:[function(require,module,exports){
"use strict";
/**
 * 创建DOM 节点
 * @param  {String} str Dom 字符串
 * @return {HTMLElement}  DOM 节点
 */
Object.defineProperty(exports, "__esModule", { value: true });
var TABLE;
var TABLE_TR;
var FRAGMENT_REG;
var CONTAINERS;
function initConstants() {
    TABLE = document.createElement('table');
    TABLE_TR = document.createElement('tr');
    FRAGMENT_REG = /^\s*<(\w+|!)[^>]*>/;
    CONTAINERS = {
        tr: document.createElement('tbody'),
        tbody: TABLE,
        thead: TABLE,
        tfoot: TABLE,
        td: TABLE_TR,
        th: TABLE_TR,
        '*': document.createElement('div'),
    };
}
function createDom(str) {
    if (!TABLE) {
        initConstants();
    }
    var name = FRAGMENT_REG.test(str) && RegExp.$1;
    if (!name || !(name in CONTAINERS)) {
        name = '*';
    }
    var container = CONTAINERS[name];
    str = str.replace(/(^\s*)|(\s*$)/g, '');
    container.innerHTML = '' + str;
    var dom = container.childNodes[0];
    container.removeChild(dom);
    return dom;
}
exports.default = createDom;

},{}],86:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_style_1 = require("./get-style");
function getHeight(el, defaultValue) {
    var height = get_style_1.default(el, 'height', defaultValue);
    if (height === 'auto') {
        height = el.offsetHeight;
    }
    return parseFloat(height);
}
exports.default = getHeight;

},{"./get-style":90}],87:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_style_1 = require("./get-style");
var get_height_1 = require("./get-height");
function getOuterHeight(el, defaultValue) {
    var height = get_height_1.default(el, defaultValue);
    var bTop = parseFloat(get_style_1.default(el, 'borderTopWidth')) || 0;
    var pTop = parseFloat(get_style_1.default(el, 'paddingTop')) || 0;
    var pBottom = parseFloat(get_style_1.default(el, 'paddingBottom')) || 0;
    var bBottom = parseFloat(get_style_1.default(el, 'borderBottomWidth')) || 0;
    var mTop = parseFloat(get_style_1.default(el, 'marginTop')) || 0;
    var mBottom = parseFloat(get_style_1.default(el, 'marginBottom')) || 0;
    return height + bTop + bBottom + pTop + pBottom + mTop + mBottom;
}
exports.default = getOuterHeight;

},{"./get-height":86,"./get-style":90}],88:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_style_1 = require("./get-style");
var get_width_1 = require("./get-width");
function getOuterWidth(el, defaultValue) {
    var width = get_width_1.default(el, defaultValue);
    var bLeft = parseFloat(get_style_1.default(el, 'borderLeftWidth')) || 0;
    var pLeft = parseFloat(get_style_1.default(el, 'paddingLeft')) || 0;
    var pRight = parseFloat(get_style_1.default(el, 'paddingRight')) || 0;
    var bRight = parseFloat(get_style_1.default(el, 'borderRightWidth')) || 0;
    var mRight = parseFloat(get_style_1.default(el, 'marginRight')) || 0;
    var mLeft = parseFloat(get_style_1.default(el, 'marginLeft')) || 0;
    return width + bLeft + bRight + pLeft + pRight + mLeft + mRight;
}
exports.default = getOuterWidth;

},{"./get-style":90,"./get-width":91}],89:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getRatio() {
    return window.devicePixelRatio ? window.devicePixelRatio : 2;
}
exports.default = getRatio;

},{}],90:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 获取样式
 * @param  {Object} dom DOM节点
 * @param  {String} name 样式名
 * @param  {Any} defaultValue 默认值
 * @return {String} 属性值
 */
function getStyle(dom, name, defaultValue) {
    var v;
    try {
        v = window.getComputedStyle ?
            window.getComputedStyle(dom, null)[name] :
            dom.style[name]; // 一般不会走到这个逻辑，dom.style 获取的是标签 style 属性，也不准确
    }
    catch (e) {
        // do nothing
    }
    finally {
        v = v === undefined ? defaultValue : v;
    }
    return v;
}
exports.default = getStyle;

},{}],91:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_style_1 = require("./get-style");
function getHeight(el, defaultValue) {
    var width = get_style_1.default(el, 'width', defaultValue);
    if (width === 'auto') {
        width = el.offsetWidth;
    }
    return parseFloat(width);
}
exports.default = getHeight;

},{"./get-style":90}],92:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// dom
var add_event_listener_1 = require("./add-event-listener");
exports.addEventListener = add_event_listener_1.default;
var create_dom_1 = require("./create-dom");
exports.createDom = create_dom_1.default;
var get_height_1 = require("./get-height");
exports.getHeight = get_height_1.default;
var get_outer_height_1 = require("./get-outer-height");
exports.getOuterHeight = get_outer_height_1.default;
var get_outer_width_1 = require("./get-outer-width");
exports.getOuterWidth = get_outer_width_1.default;
var get_ratio_1 = require("./get-ratio");
exports.getRatio = get_ratio_1.default;
var get_style_1 = require("./get-style");
exports.getStyle = get_style_1.default;
var get_width_1 = require("./get-width");
exports.getWidth = get_width_1.default;
var modify_css_1 = require("./modify-css");
exports.modifyCSS = modify_css_1.default;

},{"./add-event-listener":84,"./create-dom":85,"./get-height":86,"./get-outer-height":87,"./get-outer-width":88,"./get-ratio":89,"./get-style":90,"./get-width":91,"./modify-css":93}],93:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function modifyCSS(dom, css) {
    if (dom) {
        for (var key in css) {
            if (css.hasOwnProperty(key)) {
                dom.style[key] = css[key];
            }
        }
    }
    return dom;
}
exports.default = modifyCSS;

},{}],94:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WILDCARD = '*';
/* event-emitter */
var EventEmitter = /** @class */ (function () {
    function EventEmitter() {
        this._events = {};
    }
    /**
     * 监听一个事件
     * @param evt
     * @param callback
     * @param once
     */
    EventEmitter.prototype.on = function (evt, callback, once) {
        if (!this._events[evt]) {
            this._events[evt] = [];
        }
        this._events[evt].push({
            callback: callback,
            once: !!once,
        });
        return this;
    };
    /**
     * 监听一个事件一次
     * @param evt
     * @param callback
     */
    EventEmitter.prototype.once = function (evt, callback) {
        this.on(evt, callback, true);
        return this;
    };
    /**
     * 触发一个事件
     * @param evt
     * @param args
     */
    EventEmitter.prototype.emit = function (evt) {
        var _this = this;
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        var events = this._events[evt] || [];
        var wildcardEvents = this._events[WILDCARD] || [];
        // 实际的处理 emit 方法
        var doEmit = function (es) {
            var length = es.length;
            for (var i = 0; i < length; i++) {
                if (!es[i]) {
                    continue;
                }
                var _a = es[i], callback = _a.callback, once = _a.once;
                if (once) {
                    es.splice(i, 1);
                    if (es.length === 0) {
                        delete _this._events[evt];
                    }
                    length--;
                    i--;
                }
                callback.apply(_this, args);
            }
        };
        doEmit(events);
        doEmit(wildcardEvents);
    };
    /**
     * 取消监听一个事件，或者一个channel
     * @param evt
     * @param callback
     */
    EventEmitter.prototype.off = function (evt, callback) {
        if (!evt) {
            // evt 为空全部清除
            this._events = {};
        }
        else {
            if (!callback) {
                // evt 存在，callback 为空，清除事件所有方法
                delete this._events[evt];
            }
            else {
                // evt 存在，callback 存在，清除匹配的
                var events = this._events[evt] || [];
                var length_1 = events.length;
                for (var i = 0; i < length_1; i++) {
                    if (events[i].callback === callback) {
                        events.splice(i, 1);
                        length_1--;
                        i--;
                    }
                }
                if (events.length === 0) {
                    delete this._events[evt];
                }
            }
        }
        return this;
    };
    /* 当前所有的事件 */
    EventEmitter.prototype.getEvents = function () {
        return this._events;
    };
    return EventEmitter;
}());
exports.default = EventEmitter;

},{}],95:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = require("@antv/event-emitter");
var util_1 = require("../util/util");
var Base = /** @class */ (function (_super) {
    tslib_1.__extends(Base, _super);
    function Base(cfg) {
        var _this = _super.call(this) || this;
        /**
         * 是否被销毁
         * @type {boolean}
         */
        _this.destroyed = false;
        var defaultCfg = _this.getDefaultCfg();
        _this.cfg = util_1.mix(defaultCfg, cfg);
        return _this;
    }
    /**
     * @protected
     * 默认的配置项
     * @returns {object} 默认的配置项
     */
    Base.prototype.getDefaultCfg = function () {
        return {};
    };
    // 实现接口的方法
    Base.prototype.get = function (name) {
        return this.cfg[name];
    };
    // 实现接口的方法
    Base.prototype.set = function (name, value) {
        this.cfg[name] = value;
    };
    // 实现接口的方法
    Base.prototype.destroy = function () {
        this.cfg = {
            destroyed: true,
        };
        this.off();
        this.destroyed = true;
    };
    return Base;
}(event_emitter_1.default));
exports.default = Base;

},{"../util/util":123,"@antv/event-emitter":94,"tslib":894}],96:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var detect_browser_1 = require("detect-browser");
var container_1 = require("./container");
var util_1 = require("../util/util");
var timeline_1 = require("../animate/timeline");
var event_contoller_1 = require("../event/event-contoller");
var PX_SUFFIX = 'px';
var browser = detect_browser_1.detect();
var isFirefox = browser && browser.name === 'firefox';
var Canvas = /** @class */ (function (_super) {
    tslib_1.__extends(Canvas, _super);
    function Canvas(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.initContainer();
        _this.initDom();
        _this.initEvents();
        _this.initTimeline();
        return _this;
    }
    Canvas.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        // set default cursor style for canvas
        cfg['cursor'] = 'default';
        // CSS transform 目前尚未经过长时间验证，为了避免影响上层业务，默认关闭，上层按需开启
        cfg['supportCSSTransform'] = false;
        return cfg;
    };
    /**
     * @protected
     * 初始化容器
     */
    Canvas.prototype.initContainer = function () {
        var container = this.get('container');
        if (util_1.isString(container)) {
            container = document.getElementById(container);
            this.set('container', container);
        }
    };
    /**
     * @protected
     * 初始化 DOM
     */
    Canvas.prototype.initDom = function () {
        var el = this.createDom();
        this.set('el', el);
        // 附加到容器
        var container = this.get('container');
        container.appendChild(el);
        // 设置初始宽度
        this.setDOMSize(this.get('width'), this.get('height'));
    };
    /**
     * @protected
     * 初始化绑定的事件
     */
    Canvas.prototype.initEvents = function () {
        var eventController = new event_contoller_1.default({
            canvas: this,
        });
        eventController.init();
        this.set('eventController', eventController);
    };
    /**
     * @protected
     * 初始化时间轴
     */
    Canvas.prototype.initTimeline = function () {
        var timeline = new timeline_1.default(this);
        this.set('timeline', timeline);
    };
    /**
     * @protected
     * 修改画布对应的 DOM 的大小
     * @param {number} width  宽度
     * @param {number} height 高度
     */
    Canvas.prototype.setDOMSize = function (width, height) {
        var el = this.get('el');
        if (util_1.isBrowser) {
            el.style.width = width + PX_SUFFIX;
            el.style.height = height + PX_SUFFIX;
        }
    };
    // 实现接口
    Canvas.prototype.changeSize = function (width, height) {
        this.setDOMSize(width, height);
        this.set('width', width);
        this.set('height', height);
        this.onCanvasChange('changeSize');
    };
    /**
     * 获取当前的渲染引擎
     * @return {Renderer} 返回当前的渲染引擎
     */
    Canvas.prototype.getRenderer = function () {
        return this.get('renderer');
    };
    /**
     * 获取画布的 cursor 样式
     * @return {Cursor}
     */
    Canvas.prototype.getCursor = function () {
        return this.get('cursor');
    };
    /**
     * 设置画布的 cursor 样式
     * @param {Cursor} cursor  cursor 样式
     */
    Canvas.prototype.setCursor = function (cursor) {
        this.set('cursor', cursor);
        var el = this.get('el');
        if (util_1.isBrowser && el) {
            // 直接设置样式，不等待鼠标移动时再设置
            el.style.cursor = cursor;
        }
    };
    // 实现接口
    Canvas.prototype.getPointByEvent = function (ev) {
        var supportCSSTransform = this.get('supportCSSTransform');
        if (supportCSSTransform) {
            // For Firefox <= 38
            if (isFirefox && !util_1.isNil(ev.layerX) && ev.layerX !== ev.offsetX) {
                return {
                    x: ev.layerX,
                    y: ev.layerY,
                };
            }
            if (!util_1.isNil(ev.offsetX)) {
                // For IE6+, Firefox >= 39, Chrome, Safari, Opera
                return {
                    x: ev.offsetX,
                    y: ev.offsetY,
                };
            }
        }
        // should calculate by self for other cases, like Safari in ios
        // TODO: support CSS transform
        var _a = this.getClientByEvent(ev), clientX = _a.x, clientY = _a.y;
        return this.getPointByClient(clientX, clientY);
    };
    // 获取 touch 事件的 clientX 和 clientY 需要单独处理
    Canvas.prototype.getClientByEvent = function (ev) {
        var clientInfo = ev;
        if (ev.touches) {
            if (ev.type === 'touchend') {
                clientInfo = ev.changedTouches[0];
            }
            else {
                clientInfo = ev.touches[0];
            }
        }
        return {
            x: clientInfo.clientX,
            y: clientInfo.clientY,
        };
    };
    // 实现接口
    Canvas.prototype.getPointByClient = function (clientX, clientY) {
        var el = this.get('el');
        var bbox = el.getBoundingClientRect();
        return {
            x: clientX - bbox.left,
            y: clientY - bbox.top,
        };
    };
    // 实现接口
    Canvas.prototype.getClientByPoint = function (x, y) {
        var el = this.get('el');
        var bbox = el.getBoundingClientRect();
        return {
            x: x + bbox.left,
            y: y + bbox.top,
        };
    };
    // 实现接口
    Canvas.prototype.draw = function () { };
    /**
     * @protected
     * 销毁 DOM 容器
     */
    Canvas.prototype.removeDom = function () {
        var el = this.get('el');
        el.parentNode.removeChild(el);
    };
    /**
     * @protected
     * 清理所有的事件
     */
    Canvas.prototype.clearEvents = function () {
        var eventController = this.get('eventController');
        eventController.destroy();
    };
    Canvas.prototype.isCanvas = function () {
        return true;
    };
    Canvas.prototype.getParent = function () {
        return null;
    };
    Canvas.prototype.destroy = function () {
        var timeline = this.get('timeline');
        if (this.get('destroyed')) {
            return;
        }
        this.clear();
        // 同初始化时相反顺序调用
        if (timeline) {
            // 画布销毁时自动停止动画
            timeline.stop();
        }
        this.clearEvents();
        this.removeDom();
        _super.prototype.destroy.call(this);
    };
    return Canvas;
}(container_1.default));
exports.default = Canvas;

},{"../animate/timeline":101,"../event/event-contoller":113,"../util/util":123,"./container":97,"detect-browser":880,"tslib":894}],97:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var element_1 = require("./element");
var util_1 = require("../util/util");
var SHAPE_MAP = {};
var INDEX = '_INDEX';
function afterAdd(element) {
    if (element.isGroup()) {
        if (element.isEntityGroup() || element.get('children').length) {
            element.onCanvasChange('add');
        }
    }
    else {
        element.onCanvasChange('add');
    }
}
/**
 * 设置 canvas
 * @param {IElement} element 元素
 * @param {ICanvas}  canvas  画布
 */
function setCanvas(element, canvas) {
    element.set('canvas', canvas);
    if (element.isGroup()) {
        var children = element.get('children');
        if (children.length) {
            children.forEach(function (child) {
                setCanvas(child, canvas);
            });
        }
    }
}
/**
 * 设置 timeline
 * @param {IElement} element  元素
 * @param {Timeline} timeline 时间轴
 */
function setTimeline(element, timeline) {
    element.set('timeline', timeline);
    if (element.isGroup()) {
        var children = element.get('children');
        if (children.length) {
            children.forEach(function (child) {
                setTimeline(child, timeline);
            });
        }
    }
}
function contains(container, element) {
    var children = container.getChildren();
    return children.indexOf(element) >= 0;
}
function removeChild(container, element, destroy) {
    if (destroy === void 0) { destroy = true; }
    // 不再调用 element.remove() 方法，会出现循环调用
    if (destroy) {
        element.destroy();
    }
    else {
        element.set('parent', null);
        element.set('canvas', null);
    }
    util_1.removeFromArray(container.getChildren(), element);
}
function getComparer(compare) {
    return function (left, right) {
        var result = compare(left, right);
        return result === 0 ? left[INDEX] - right[INDEX] : result;
    };
}
var Container = /** @class */ (function (_super) {
    tslib_1.__extends(Container, _super);
    function Container() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Container.prototype.isCanvas = function () {
        return false;
    };
    // 根据子节点确定 BBox
    Container.prototype.getBBox = function () {
        // 所有的值可能在画布的可视区外
        var minX = Infinity;
        var maxX = -Infinity;
        var minY = Infinity;
        var maxY = -Infinity;
        var xArr = [];
        var yArr = [];
        // 将可见元素、图形以及不为空的图形分组筛选出来，用于包围盒合并
        var children = this.getChildren().filter(function (child) {
            return child.get('visible') && (!child.isGroup() || (child.isGroup() && child.getChildren().length > 0));
        });
        if (children.length > 0) {
            util_1.each(children, function (child) {
                var box = child.getBBox();
                xArr.push(box.minX, box.maxX);
                yArr.push(box.minY, box.maxY);
            });
            minX = Math.min.apply(null, xArr);
            maxX = Math.max.apply(null, xArr);
            minY = Math.min.apply(null, yArr);
            maxY = Math.max.apply(null, yArr);
        }
        else {
            minX = 0;
            maxX = 0;
            minY = 0;
            maxY = 0;
        }
        var box = {
            x: minX,
            y: minY,
            minX: minX,
            minY: minY,
            maxX: maxX,
            maxY: maxY,
            width: maxX - minX,
            height: maxY - minY,
        };
        return box;
    };
    // 获取画布的包围盒
    Container.prototype.getCanvasBBox = function () {
        var minX = Infinity;
        var maxX = -Infinity;
        var minY = Infinity;
        var maxY = -Infinity;
        var xArr = [];
        var yArr = [];
        // 将可见元素、图形以及不为空的图形分组筛选出来，用于包围盒合并
        var children = this.getChildren().filter(function (child) {
            return child.get('visible') && (!child.isGroup() || (child.isGroup() && child.getChildren().length > 0));
        });
        if (children.length > 0) {
            util_1.each(children, function (child) {
                var box = child.getCanvasBBox();
                xArr.push(box.minX, box.maxX);
                yArr.push(box.minY, box.maxY);
            });
            minX = Math.min.apply(null, xArr);
            maxX = Math.max.apply(null, xArr);
            minY = Math.min.apply(null, yArr);
            maxY = Math.max.apply(null, yArr);
        }
        else {
            minX = 0;
            maxX = 0;
            minY = 0;
            maxY = 0;
        }
        var box = {
            x: minX,
            y: minY,
            minX: minX,
            minY: minY,
            maxX: maxX,
            maxY: maxY,
            width: maxX - minX,
            height: maxY - minY,
        };
        return box;
    };
    Container.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        cfg['children'] = [];
        return cfg;
    };
    Container.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        if (name === 'matrix') {
            var totalMatrix = this.getTotalMatrix();
            this._applyChildrenMarix(totalMatrix);
        }
    };
    // 不但应用到自己身上还要应用于子元素
    Container.prototype.applyMatrix = function (matrix) {
        var preTotalMatrix = this.getTotalMatrix();
        _super.prototype.applyMatrix.call(this, matrix);
        var totalMatrix = this.getTotalMatrix();
        // totalMatrix 没有发生变化时，这里仅考虑两者都为 null 时
        // 不继续向下传递矩阵
        if (totalMatrix === preTotalMatrix) {
            return;
        }
        this._applyChildrenMarix(totalMatrix);
    };
    // 在子元素上设置矩阵
    Container.prototype._applyChildrenMarix = function (totalMatrix) {
        var children = this.getChildren();
        util_1.each(children, function (child) {
            child.applyMatrix(totalMatrix);
        });
    };
    // 兼容老版本的接口
    Container.prototype.addShape = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var type = args[0];
        var cfg = args[1];
        if (util_1.isObject(type)) {
            cfg = type;
        }
        else {
            cfg['type'] = type;
        }
        var shapeType = SHAPE_MAP[cfg.type];
        if (!shapeType) {
            shapeType = util_1.upperFirst(cfg.type);
            SHAPE_MAP[cfg.type] = shapeType;
        }
        var ShapeBase = this.getShapeBase();
        var shape = new ShapeBase[shapeType](cfg);
        this.add(shape);
        return shape;
    };
    Container.prototype.addGroup = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var groupClass = args[0], cfg = args[1];
        var group;
        if (util_1.isFunction(groupClass)) {
            if (cfg) {
                group = new groupClass(cfg);
            }
            else {
                group = new groupClass({
                    // canvas,
                    parent: this,
                });
            }
        }
        else {
            var tmpCfg = groupClass || {};
            var TmpGroupClass = this.getGroupBase();
            group = new TmpGroupClass(tmpCfg);
        }
        this.add(group);
        return group;
    };
    Container.prototype.getCanvas = function () {
        var canvas;
        if (this.isCanvas()) {
            canvas = this;
        }
        else {
            canvas = this.get('canvas');
        }
        return canvas;
    };
    Container.prototype.getShape = function (x, y, ev) {
        // 如果不支持拾取，则直接返回
        if (!util_1.isAllowCapture(this)) {
            return null;
        }
        var children = this.getChildren();
        var shape;
        // 如果容器是 group
        if (!this.isCanvas()) {
            var v = [x, y, 1];
            // 将 x, y 转换成对应于 group 的局部坐标
            v = this.invertFromMatrix(v);
            if (!this.isClipped(v[0], v[1])) {
                shape = this._findShape(children, v[0], v[1], ev);
            }
        }
        else {
            shape = this._findShape(children, x, y, ev);
        }
        return shape;
    };
    Container.prototype._findShape = function (children, x, y, ev) {
        var shape = null;
        for (var i = children.length - 1; i >= 0; i--) {
            var child = children[i];
            if (util_1.isAllowCapture(child)) {
                if (child.isGroup()) {
                    shape = child.getShape(x, y, ev);
                }
                else if (child.isHit(x, y)) {
                    shape = child;
                }
            }
            if (shape) {
                break;
            }
        }
        return shape;
    };
    Container.prototype.add = function (element) {
        var canvas = this.getCanvas();
        var children = this.getChildren();
        var timeline = this.get('timeline');
        var preParent = element.getParent();
        if (preParent) {
            removeChild(preParent, element, false);
        }
        element.set('parent', this);
        if (canvas) {
            setCanvas(element, canvas);
        }
        if (timeline) {
            setTimeline(element, timeline);
        }
        children.push(element);
        afterAdd(element);
        this._applyElementMatrix(element);
    };
    // 将当前容器的矩阵应用到子元素
    Container.prototype._applyElementMatrix = function (element) {
        var totalMatrix = this.getTotalMatrix();
        // 添加图形或者分组时，需要把当前图元的矩阵设置进去
        if (totalMatrix) {
            element.applyMatrix(totalMatrix);
        }
    };
    Container.prototype.getChildren = function () {
        return this.get('children');
    };
    Container.prototype.sort = function () {
        var children = this.getChildren();
        // 稳定排序
        util_1.each(children, function (child, index) {
            child[INDEX] = index;
            return child;
        });
        children.sort(getComparer(function (obj1, obj2) {
            return obj1.get('zIndex') - obj2.get('zIndex');
        }));
        this.onCanvasChange('sort');
    };
    Container.prototype.clear = function () {
        this.set('clearing', true);
        if (this.destroyed) {
            return;
        }
        var children = this.getChildren();
        for (var i = children.length - 1; i >= 0; i--) {
            children[i].destroy(); // 销毁子元素
        }
        this.set('children', []);
        this.onCanvasChange('clear');
        this.set('clearing', false);
    };
    Container.prototype.destroy = function () {
        if (this.get('destroyed')) {
            return;
        }
        this.clear();
        _super.prototype.destroy.call(this);
    };
    /**
     * 获取第一个子元素
     * @return {IElement} 第一个元素
     */
    Container.prototype.getFirst = function () {
        return this.getChildByIndex(0);
    };
    /**
     * 获取最后一个子元素
     * @return {IElement} 元素
     */
    Container.prototype.getLast = function () {
        var children = this.getChildren();
        return this.getChildByIndex(children.length - 1);
    };
    /**
     * 根据索引获取子元素
     * @return {IElement} 第一个元素
     */
    Container.prototype.getChildByIndex = function (index) {
        var children = this.getChildren();
        return children[index];
    };
    /**
     * 子元素的数量
     * @return {number} 子元素数量
     */
    Container.prototype.getCount = function () {
        var children = this.getChildren();
        return children.length;
    };
    /**
     * 是否包含对应元素
     * @param {IElement} element 元素
     * @return {boolean}
     */
    Container.prototype.contain = function (element) {
        var children = this.getChildren();
        return children.indexOf(element) > -1;
    };
    /**
     * 移除对应子元素
     * @param {IElement} element 子元素
     * @param {boolean} destroy 是否销毁子元素，默认为 true
     */
    Container.prototype.removeChild = function (element, destroy) {
        if (destroy === void 0) { destroy = true; }
        if (this.contain(element)) {
            element.remove(destroy);
        }
    };
    /**
     * 查找所有匹配的元素
     * @param  {ElementFilterFn}   fn  匹配函数
     * @return {IElement[]} 元素数组
     */
    Container.prototype.findAll = function (fn) {
        var rst = [];
        var children = this.getChildren();
        util_1.each(children, function (element) {
            if (fn(element)) {
                rst.push(element);
            }
            if (element.isGroup()) {
                rst = rst.concat(element.findAll(fn));
            }
        });
        return rst;
    };
    /**
     * 查找元素，找到第一个返回
     * @param  {ElementFilterFn} fn    匹配函数
     * @return {IElement|null} 元素，可以为空
     */
    Container.prototype.find = function (fn) {
        var rst = null;
        var children = this.getChildren();
        util_1.each(children, function (element) {
            if (fn(element)) {
                rst = element;
            }
            else if (element.isGroup()) {
                rst = element.find(fn);
            }
            if (rst) {
                return false;
            }
        });
        return rst;
    };
    /**
     * 根据 ID 查找元素
     * @param {string} id 元素 id
     * @return {IElement|null} 元素
     */
    Container.prototype.findById = function (id) {
        return this.find(function (element) {
            return element.get('id') === id;
        });
    };
    /**
     * 该方法即将废弃，不建议使用
     * 根据 className 查找元素
     * TODO: 该方式定义暂时只给 G6 3.3 以后的版本使用，待 G6 中的 findByClassName 方法移除后，G 也需要同步移除
     * @param {string} className 元素 className
     * @return {IElement | null} 元素
     */
    Container.prototype.findByClassName = function (className) {
        return this.find(function (element) {
            return element.get('className') === className;
        });
    };
    /**
     * 根据 name 查找元素列表
     * @param {string}      name 元素名称
     * @return {IElement[]} 元素
     */
    Container.prototype.findAllByName = function (name) {
        return this.findAll(function (element) {
            return element.get('name') === name;
        });
    };
    return Container;
}(element_1.default));
exports.default = Container;

},{"../util/util":123,"./element":98,"tslib":894}],98:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var matrix_util_1 = require("@antv/matrix-util");
var util_2 = require("../util/util");
var matrix_1 = require("../util/matrix");
var base_1 = require("./base");
var MATRIX = 'matrix';
var CLONE_CFGS = ['zIndex', 'capture', 'visible', 'type'];
// 可以在 toAttrs 中设置，但不属于绘图属性的字段
var RESERVED_PORPS = ['repeat'];
var DELEGATION_SPLIT = ':';
var WILDCARD = '*';
// 需要考虑数组嵌套数组的场景
// 数组嵌套对象的场景不考虑
function _cloneArrayAttr(arr) {
    var result = [];
    for (var i = 0; i < arr.length; i++) {
        if (util_1.isArray(arr[i])) {
            result.push([].concat(arr[i]));
        }
        else {
            result.push(arr[i]);
        }
    }
    return result;
}
function getFormatFromAttrs(toAttrs, shape) {
    var fromAttrs = {};
    var attrs = shape.attrs;
    for (var k in toAttrs) {
        fromAttrs[k] = attrs[k];
    }
    return fromAttrs;
}
function getFormatToAttrs(props, shape) {
    var toAttrs = {};
    var attrs = shape.attr();
    util_1.each(props, function (v, k) {
        if (RESERVED_PORPS.indexOf(k) === -1 && !util_1.isEqual(attrs[k], v)) {
            toAttrs[k] = v;
        }
    });
    return toAttrs;
}
function checkExistedAttrs(animations, animation) {
    if (animation.onFrame) {
        return animations;
    }
    var startTime = animation.startTime, delay = animation.delay, duration = animation.duration;
    var hasOwnProperty = Object.prototype.hasOwnProperty;
    util_1.each(animations, function (item) {
        // 后一个动画开始执行的时间 < 前一个动画的结束时间 && 后一个动画的执行时间 > 前一个动画的延迟
        if (startTime + delay < item.startTime + item.delay + item.duration && duration > item.delay) {
            util_1.each(animation.toAttrs, function (v, k) {
                if (hasOwnProperty.call(item.toAttrs, k)) {
                    delete item.toAttrs[k];
                    delete item.fromAttrs[k];
                }
            });
        }
    });
    return animations;
}
var Element = /** @class */ (function (_super) {
    tslib_1.__extends(Element, _super);
    function Element(cfg) {
        var _this = _super.call(this, cfg) || this;
        /**
         * @protected
         * 图形属性
         * @type {ShapeAttrs}
         */
        _this.attrs = {};
        var attrs = _this.getDefaultAttrs();
        util_1.mix(attrs, cfg.attrs);
        _this.attrs = attrs;
        _this.initAttrs(attrs);
        _this.initAnimate(); // 初始化动画
        return _this;
    }
    // override
    Element.prototype.getDefaultCfg = function () {
        return {
            visible: true,
            capture: true,
            zIndex: 0,
        };
    };
    /**
     * @protected
     * 获取默认的属相
     */
    Element.prototype.getDefaultAttrs = function () {
        return {
            matrix: this.getDefaultMatrix(),
            opacity: 1,
        };
    };
    /**
     * @protected
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    Element.prototype.onCanvasChange = function (changeType) { };
    /**
     * @protected
     * 初始化属性，有些属性需要加工
     * @param {object} attrs 属性值
     */
    Element.prototype.initAttrs = function (attrs) { };
    /**
     * @protected
     * 初始化动画
     */
    Element.prototype.initAnimate = function () {
        this.set('animable', true);
        this.set('animating', false);
    };
    Element.prototype.isGroup = function () {
        return false;
    };
    Element.prototype.getParent = function () {
        return this.get('parent');
    };
    Element.prototype.getCanvas = function () {
        return this.get('canvas');
    };
    Element.prototype.attr = function () {
        var _a;
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var name = args[0], value = args[1];
        if (!name)
            return this.attrs;
        if (util_1.isObject(name)) {
            for (var k in name) {
                this.setAttr(k, name[k]);
            }
            this.afterAttrsChange(name);
            return this;
        }
        if (args.length === 2) {
            this.setAttr(name, value);
            this.afterAttrsChange((_a = {},
                _a[name] = value,
                _a));
            return this;
        }
        return this.attrs[name];
    };
    // 是否被裁剪，被裁剪则不显示，不参与拾取
    Element.prototype.isClipped = function (refX, refY) {
        var clip = this.getClip();
        return clip && !clip.isHit(refX, refY);
    };
    /**
     * 内部设置属性值的接口
     * @param {string} name 属性名
     * @param {any} value 属性值
     */
    Element.prototype.setAttr = function (name, value) {
        var originValue = this.attrs[name];
        if (originValue !== value) {
            this.attrs[name] = value;
            this.onAttrChange(name, value, originValue);
        }
    };
    /**
     * @protected
     * 属性值发生改变
     * @param {string} name 属性名
     * @param {any} value 属性值
     * @param {any} originValue 属性值
     */
    Element.prototype.onAttrChange = function (name, value, originValue) {
        if (name === 'matrix') {
            this.set('totalMatrix', null);
        }
    };
    /**
     * 属性更改后需要做的事情
     * @protected
     */
    Element.prototype.afterAttrsChange = function (targetAttrs) {
        this.onCanvasChange('attr');
    };
    Element.prototype.show = function () {
        // 不是高频操作直接使用 set
        this.set('visible', true);
        this.onCanvasChange('show');
        return this;
    };
    Element.prototype.hide = function () {
        // 不是高频操作直接使用 set
        this.set('visible', false);
        this.onCanvasChange('hide');
        return this;
    };
    Element.prototype.setZIndex = function (zIndex) {
        this.set('zIndex', zIndex);
        var parent = this.getParent();
        if (parent) {
            // 改变 zIndex 不应该立即触发渲染 (调用 onCanvasChange('zIndex'))，需要经过 sort 再触发
            parent.sort();
        }
        return this;
    };
    Element.prototype.toFront = function () {
        var parent = this.getParent();
        if (!parent) {
            return;
        }
        var children = parent.getChildren();
        var el = this.get('el');
        var index = children.indexOf(this);
        children.splice(index, 1);
        children.push(this);
        this.onCanvasChange('zIndex');
    };
    Element.prototype.toBack = function () {
        var parent = this.getParent();
        if (!parent) {
            return;
        }
        var children = parent.getChildren();
        var el = this.get('el');
        var index = children.indexOf(this);
        children.splice(index, 1);
        children.unshift(this);
        this.onCanvasChange('zIndex');
    };
    Element.prototype.remove = function (destroy) {
        if (destroy === void 0) { destroy = true; }
        var parent = this.getParent();
        if (parent) {
            util_2.removeFromArray(parent.getChildren(), this);
            if (!parent.get('clearing')) {
                // 如果父元素正在清理，当前元素不触发 remove
                this.onCanvasChange('remove');
            }
        }
        else {
            this.onCanvasChange('remove');
        }
        if (destroy) {
            this.destroy();
        }
    };
    Element.prototype.resetMatrix = function () {
        this.attr(MATRIX, this.getDefaultMatrix());
        this.onCanvasChange('matrix');
    };
    Element.prototype.getMatrix = function () {
        return this.attr(MATRIX);
    };
    Element.prototype.setMatrix = function (m) {
        this.attr(MATRIX, m);
        this.onCanvasChange('matrix');
    };
    // 获取总的 matrix
    Element.prototype.getTotalMatrix = function () {
        var totalMatrix = this.get('totalMatrix');
        if (!totalMatrix) {
            var currentMatrix = this.attr('matrix');
            var parentMatrix = this.get('parentMatrix');
            if (parentMatrix && currentMatrix) {
                totalMatrix = matrix_1.multiplyMatrix(parentMatrix, currentMatrix);
            }
            else {
                totalMatrix = currentMatrix || parentMatrix;
            }
            this.set('totalMatrix', totalMatrix);
        }
        return totalMatrix;
    };
    // 上层分组设置 matrix
    Element.prototype.applyMatrix = function (matrix) {
        var currentMatrix = this.attr('matrix');
        var totalMatrix = null;
        if (matrix && currentMatrix) {
            totalMatrix = matrix_1.multiplyMatrix(matrix, currentMatrix);
        }
        else {
            totalMatrix = currentMatrix || matrix;
        }
        this.set('totalMatrix', totalMatrix);
        this.set('parentMatrix', matrix);
    };
    /**
     * @protected
     * 获取默认的矩阵
     * @returns {number[]|null} 默认的矩阵
     */
    Element.prototype.getDefaultMatrix = function () {
        return null;
    };
    // 将向量应用设置的矩阵
    Element.prototype.applyToMatrix = function (v) {
        var matrix = this.attr('matrix');
        if (matrix) {
            return matrix_1.multiplyVec2(matrix, v);
        }
        return v;
    };
    // 根据设置的矩阵，将向量转换相对于图形/分组的位置
    Element.prototype.invertFromMatrix = function (v) {
        var matrix = this.attr('matrix');
        if (matrix) {
            var invertMatrix = matrix_1.invert(matrix);
            if (invertMatrix) {
                return matrix_1.multiplyVec2(invertMatrix, v);
            }
        }
        return v;
    };
    // 设置 clip
    Element.prototype.setClip = function (clipCfg) {
        var canvas = this.getCanvas();
        // 应该只设置当前元素的 clip，不应该去修改 clip 本身，方便 clip 被复用
        // TODO: setClip 的传参既 shape 配置，也支持 shape 对象
        // const preShape = this.get('clipShape');
        // if (preShape) {
        //   // 将之前的 clipShape 销毁
        //   preShape.destroy();
        // }
        var clipShape = null;
        // 如果配置项为 null，则不移除 clipShape
        if (clipCfg) {
            var ShapeBase = this.getShapeBase();
            var shapeType = util_1.upperFirst(clipCfg.type);
            var Cons = ShapeBase[shapeType];
            if (Cons) {
                clipShape = new Cons({
                    type: clipCfg.type,
                    isClipShape: true,
                    attrs: clipCfg.attrs,
                    canvas: canvas,
                });
            }
        }
        this.set('clipShape', clipShape);
        this.onCanvasChange('clip');
        return clipShape;
    };
    Element.prototype.getClip = function () {
        // 高频率调用的地方直接使用 this.cfg.xxx
        var clipShape = this.cfg.clipShape;
        // 未设置时返回 Null，保证一致性
        if (!clipShape) {
            return null;
        }
        return clipShape;
    };
    Element.prototype.clone = function () {
        var _this = this;
        var originAttrs = this.attrs;
        var attrs = {};
        util_1.each(originAttrs, function (i, k) {
            if (util_1.isArray(originAttrs[k])) {
                attrs[k] = _cloneArrayAttr(originAttrs[k]);
            }
            else {
                attrs[k] = originAttrs[k];
            }
        });
        var cons = this.constructor;
        // @ts-ignore
        var clone = new cons({ attrs: attrs });
        util_1.each(CLONE_CFGS, function (cfgName) {
            clone.set(cfgName, _this.get(cfgName));
        });
        return clone;
    };
    Element.prototype.destroy = function () {
        var destroyed = this.destroyed;
        if (destroyed) {
            return;
        }
        this.attrs = {};
        _super.prototype.destroy.call(this);
        // this.onCanvasChange('destroy');
    };
    /**
     * 是否处于动画暂停状态
     * @return {boolean} 是否处于动画暂停状态
     */
    Element.prototype.isAnimatePaused = function () {
        return this.get('_pause').isPaused;
    };
    /**
     * 执行动画，支持多种函数签名
     * 1. animate(toAttrs: ElementAttrs, duration: number, easing?: string, callback?: () => void, delay?: number)
     * 2. animate(onFrame: OnFrame, duration: number, easing?: string, callback?: () => void, delay?: number)
     * 3. animate(toAttrs: ElementAttrs, cfg: AnimateCfg)
     * 4. animate(onFrame: OnFrame, cfg: AnimateCfg)
     * 各个参数的含义为:
     *   toAttrs  动画最终状态
     *   onFrame  自定义帧动画函数
     *   duration 动画执行时间
     *   easing   动画缓动效果
     *   callback 动画执行后的回调
     *   delay    动画延迟时间
     */
    Element.prototype.animate = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        this.set('animating', true);
        var timeline = this.get('timeline');
        if (!timeline) {
            timeline = this.get('canvas').get('timeline');
            this.set('timeline', timeline);
        }
        var animations = this.get('animations') || [];
        // 初始化 tick
        if (!timeline.timer) {
            timeline.initTimer();
        }
        var toAttrs = args[0], duration = args[1], _a = args[2], easing = _a === void 0 ? 'easeLinear' : _a, _b = args[3], callback = _b === void 0 ? util_1.noop : _b, _c = args[4], delay = _c === void 0 ? 0 : _c;
        var onFrame;
        var repeat;
        var pauseCallback;
        var resumeCallback;
        var animateCfg;
        // 第二个参数，既可以是动画最终状态 toAttrs，也可以是自定义帧动画函数 onFrame
        if (util_1.isFunction(toAttrs)) {
            onFrame = toAttrs;
            toAttrs = {};
        }
        else if (util_1.isObject(toAttrs) && toAttrs.onFrame) {
            // 兼容 3.0 中的写法，onFrame 和 repeat 可在 toAttrs 中设置
            onFrame = toAttrs.onFrame;
            repeat = toAttrs.repeat;
        }
        // 第二个参数，既可以是执行时间 duration，也可以是动画参数 animateCfg
        if (util_1.isObject(duration)) {
            animateCfg = duration;
            duration = animateCfg.duration;
            easing = animateCfg.easing || 'easeLinear';
            delay = animateCfg.delay || 0;
            // animateCfg 中的设置优先级更高
            repeat = animateCfg.repeat || repeat || false;
            callback = animateCfg.callback || util_1.noop;
            pauseCallback = animateCfg.pauseCallback || util_1.noop;
            resumeCallback = animateCfg.resumeCallback || util_1.noop;
        }
        else {
            // 第四个参数，既可以是回调函数 callback，也可以是延迟时间 delay
            if (util_1.isNumber(callback)) {
                delay = callback;
                callback = null;
            }
            // 第三个参数，既可以是缓动参数 easing，也可以是回调函数 callback
            if (util_1.isFunction(easing)) {
                callback = easing;
                easing = 'easeLinear';
            }
            else {
                easing = easing || 'easeLinear';
            }
        }
        var formatToAttrs = getFormatToAttrs(toAttrs, this);
        var animation = {
            fromAttrs: getFormatFromAttrs(formatToAttrs, this),
            toAttrs: formatToAttrs,
            duration: duration,
            easing: easing,
            repeat: repeat,
            callback: callback,
            pauseCallback: pauseCallback,
            resumeCallback: resumeCallback,
            delay: delay,
            startTime: timeline.getTime(),
            id: util_1.uniqueId(),
            onFrame: onFrame,
            pathFormatted: false,
        };
        // 如果动画元素队列中已经有这个图形了
        if (animations.length > 0) {
            // 先检查是否需要合并属性。若有相同的动画，将该属性从前一个动画中删除,直接用后一个动画中
            animations = checkExistedAttrs(animations, animation);
        }
        else {
            // 否则将图形添加到动画元素队列
            timeline.addAnimator(this);
        }
        animations.push(animation);
        this.set('animations', animations);
        this.set('_pause', { isPaused: false });
    };
    /**
     * 停止动画
     * @param {boolean} toEnd 是否到动画的最终状态
     */
    Element.prototype.stopAnimate = function (toEnd) {
        var _this = this;
        if (toEnd === void 0) { toEnd = true; }
        var animations = this.get('animations');
        util_1.each(animations, function (animation) {
            // 将动画执行到最后一帧
            if (toEnd) {
                if (animation.onFrame) {
                    _this.attr(animation.onFrame(1));
                }
                else {
                    _this.attr(animation.toAttrs);
                }
            }
            if (animation.callback) {
                // 动画停止时的回调
                animation.callback();
            }
        });
        this.set('animating', false);
        this.set('animations', []);
    };
    /**
     * 暂停动画
     */
    Element.prototype.pauseAnimate = function () {
        var timeline = this.get('timeline');
        var animations = this.get('animations');
        var pauseTime = timeline.getTime();
        util_1.each(animations, function (animation) {
            animation._paused = true;
            animation._pauseTime = pauseTime;
            if (animation.pauseCallback) {
                // 动画暂停时的回调
                animation.pauseCallback();
            }
        });
        // 记录下是在什么时候暂停的
        this.set('_pause', {
            isPaused: true,
            pauseTime: pauseTime,
        });
        return this;
    };
    /**
     * 恢复动画
     */
    Element.prototype.resumeAnimate = function () {
        var timeline = this.get('timeline');
        var current = timeline.getTime();
        var animations = this.get('animations');
        var pauseTime = this.get('_pause').pauseTime;
        // 之后更新属性需要计算动画已经执行的时长，如果暂停了，就把初始时间调后
        util_1.each(animations, function (animation) {
            animation.startTime = animation.startTime + (current - pauseTime);
            animation._paused = false;
            animation._pauseTime = null;
            if (animation.resumeCallback) {
                animation.resumeCallback();
            }
        });
        this.set('_pause', {
            isPaused: false,
        });
        this.set('animations', animations);
        return this;
    };
    /**
     * 触发委托事件
     * @param  {string}     type 事件类型
     * @param  {GraphEvent} eventObj 事件对象
     */
    Element.prototype.emitDelegation = function (type, eventObj) {
        var _this = this;
        var paths = eventObj.propagationPath;
        var events = this.getEvents();
        var relativeShape;
        if (type === 'mouseenter') {
            relativeShape = eventObj.fromShape;
        }
        else if (type === 'mouseleave') {
            relativeShape = eventObj.toShape;
        }
        var _loop_1 = function (i) {
            var element = paths[i];
            // 暂定跟 name 绑定
            var name_1 = element.get('name');
            if (name_1) {
                // 第一个 mouseenter 和 mouseleave 的停止即可，因为后面的都是前面的 Parent
                if (
                // 只有 element 是 Group 或者 Canvas 的时候，才需要判断 isParent
                (element.isGroup() || (element.isCanvas && element.isCanvas())) &&
                    relativeShape &&
                    util_2.isParent(element, relativeShape)) {
                    return "break";
                }
                if (util_1.isArray(name_1)) {
                    util_1.each(name_1, function (subName) {
                        _this.emitDelegateEvent(element, subName, eventObj);
                    });
                }
                else {
                    this_1.emitDelegateEvent(element, name_1, eventObj);
                }
            }
        };
        var this_1 = this;
        // 至少有一个对象，且第一个对象为 shape
        for (var i = 0; i < paths.length; i++) {
            var state_1 = _loop_1(i);
            if (state_1 === "break")
                break;
        }
    };
    Element.prototype.emitDelegateEvent = function (element, name, eventObj) {
        var events = this.getEvents();
        // 事件委托的形式 name:type
        var eventName = name + DELEGATION_SPLIT + eventObj.type;
        if (events[eventName] || events[WILDCARD]) {
            // 对于通配符 *，事件名称 = 委托事件名称
            eventObj.name = eventName;
            eventObj.currentTarget = element;
            eventObj.delegateTarget = this;
            // 将委托事件的监听对象 delegateObject 挂载到事件对象上
            eventObj.delegateObject = element.get('delegateObject');
            this.emit(eventName, eventObj);
        }
    };
    /**
     * 移动元素
     * @param {number} translateX 水平移动距离
     * @param {number} translateY 垂直移动距离
     * @return {IElement} 元素
     */
    Element.prototype.translate = function (translateX, translateY) {
        if (translateX === void 0) { translateX = 0; }
        if (translateY === void 0) { translateY = 0; }
        var matrix = this.getMatrix();
        var newMatrix = matrix_util_1.ext.transform(matrix, [['t', translateX, translateY]]);
        this.setMatrix(newMatrix);
        return this;
    };
    /**
     * 移动元素到目标位置
     * @param {number} targetX 目标位置的水平坐标
     * @param {number} targetX 目标位置的垂直坐标
     * @return {IElement} 元素
     */
    Element.prototype.move = function (targetX, targetY) {
        var x = this.attr('x') || 0;
        var y = this.attr('y') || 0;
        this.translate(targetX - x, targetY - y);
        return this;
    };
    /**
     * 移动元素到目标位置，等价于 move 方法。由于 moveTo 的语义性更强，因此在文档中推荐使用 moveTo 方法
     * @param {number} targetX 目标位置的 x 轴坐标
     * @param {number} targetY 目标位置的 y 轴坐标
     * @return {IElement} 元素
     */
    Element.prototype.moveTo = function (targetX, targetY) {
        return this.move(targetX, targetY);
    };
    /**
     * 缩放元素
     * @param {number} ratioX 水平缩放比例
     * @param {number} ratioY 垂直缩放比例
     * @return {IElement} 元素
     */
    Element.prototype.scale = function (ratioX, ratioY) {
        var matrix = this.getMatrix();
        var newMatrix = matrix_util_1.ext.transform(matrix, [['s', ratioX, ratioY || ratioX]]);
        this.setMatrix(newMatrix);
        return this;
    };
    /**
     * 以画布左上角 (0, 0) 为中心旋转元素
     * @param {number} radian 旋转角度(弧度值)
     * @return {IElement} 元素
     */
    Element.prototype.rotate = function (radian) {
        var matrix = this.getMatrix();
        var newMatrix = matrix_util_1.ext.transform(matrix, [['r', radian]]);
        this.setMatrix(newMatrix);
        return this;
    };
    /**
     * 以起始点为中心旋转元素
     * @param {number} radian 旋转角度(弧度值)
     * @return {IElement} 元素
     */
    Element.prototype.rotateAtStart = function (rotate) {
        var _a = this.attr(), x = _a.x, y = _a.y;
        var matrix = this.getMatrix();
        var newMatrix = matrix_util_1.ext.transform(matrix, [
            ['t', -x, -y],
            ['r', rotate],
            ['t', x, y],
        ]);
        this.setMatrix(newMatrix);
        return this;
    };
    /**
     * 以任意点 (x, y) 为中心旋转元素
     * @param {number} radian 旋转角度(弧度值)
     * @return {IElement} 元素
     */
    Element.prototype.rotateAtPoint = function (x, y, rotate) {
        var matrix = this.getMatrix();
        var newMatrix = matrix_util_1.ext.transform(matrix, [
            ['t', -x, -y],
            ['r', rotate],
            ['t', x, y],
        ]);
        this.setMatrix(newMatrix);
        return this;
    };
    return Element;
}(base_1.default));
exports.default = Element;

},{"../util/matrix":119,"../util/util":123,"./base":95,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],99:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var container_1 = require("./container");
var AbstractGroup = /** @class */ (function (_super) {
    tslib_1.__extends(AbstractGroup, _super);
    function AbstractGroup() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AbstractGroup.prototype.isGroup = function () {
        return true;
    };
    AbstractGroup.prototype.isEntityGroup = function () {
        return false;
    };
    AbstractGroup.prototype.clone = function () {
        var clone = _super.prototype.clone.call(this);
        // 获取构造函数
        var children = this.getChildren();
        for (var i = 0; i < children.length; i++) {
            var child = children[i];
            clone.add(child.clone());
        }
        return clone;
    };
    return AbstractGroup;
}(container_1.default));
exports.default = AbstractGroup;

},{"./container":97,"tslib":894}],100:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var element_1 = require("./element");
var matrix_1 = require("../util/matrix");
var AbstractShape = /** @class */ (function (_super) {
    tslib_1.__extends(AbstractShape, _super);
    function AbstractShape(cfg) {
        return _super.call(this, cfg) || this;
    }
    // 是否在包围盒内
    AbstractShape.prototype._isInBBox = function (refX, refY) {
        var bbox = this.getBBox();
        return bbox.minX <= refX && bbox.maxX >= refX && bbox.minY <= refY && bbox.maxY >= refY;
    };
    /**
     * 属性更改后需要做的事情
     * @protected
     * @param {ShapeAttrs} targetAttrs 渲染的图像属性
     */
    AbstractShape.prototype.afterAttrsChange = function (targetAttrs) {
        _super.prototype.afterAttrsChange.call(this, targetAttrs);
        this.clearCacheBBox();
    };
    // 计算包围盒时，需要缓存，这是一个高频的操作
    AbstractShape.prototype.getBBox = function () {
        var bbox = this.get('bbox');
        if (!bbox) {
            bbox = this.calculateBBox();
            this.set('bbox', bbox);
        }
        return bbox;
    };
    // 计算相对于画布的包围盒
    AbstractShape.prototype.getCanvasBBox = function () {
        var canvasBox = this.get('canvasBox');
        if (!canvasBox) {
            canvasBox = this.calculateCanvasBBox();
            this.set('canvasBox', canvasBox);
        }
        return canvasBox;
    };
    AbstractShape.prototype.applyMatrix = function (matrix) {
        _super.prototype.applyMatrix.call(this, matrix);
        // 清理掉缓存的包围盒
        this.set('canvasBox', null);
    };
    /**
     * 计算相对于画布的包围盒，默认等同于 bbox
     * @return {BBox} 包围盒
     */
    AbstractShape.prototype.calculateCanvasBBox = function () {
        var bbox = this.getBBox();
        var totalMatrix = this.getTotalMatrix();
        var minX = bbox.minX, minY = bbox.minY, maxX = bbox.maxX, maxY = bbox.maxY;
        if (totalMatrix) {
            var topLeft = matrix_1.multiplyVec2(totalMatrix, [bbox.minX, bbox.minY]);
            var topRight = matrix_1.multiplyVec2(totalMatrix, [bbox.maxX, bbox.minY]);
            var bottomLeft = matrix_1.multiplyVec2(totalMatrix, [bbox.minX, bbox.maxY]);
            var bottomRight = matrix_1.multiplyVec2(totalMatrix, [bbox.maxX, bbox.maxY]);
            minX = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
            maxX = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);
            minY = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
            maxY = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);
        }
        var attrs = this.attrs;
        // 如果存在 shadow 则计算 shadow
        if (attrs.shadowColor) {
            var _a = attrs.shadowBlur, shadowBlur = _a === void 0 ? 0 : _a, _b = attrs.shadowOffsetX, shadowOffsetX = _b === void 0 ? 0 : _b, _c = attrs.shadowOffsetY, shadowOffsetY = _c === void 0 ? 0 : _c;
            var shadowLeft = minX - shadowBlur + shadowOffsetX;
            var shadowRight = maxX + shadowBlur + shadowOffsetX;
            var shadowTop = minY - shadowBlur + shadowOffsetY;
            var shadowBottom = maxY + shadowBlur + shadowOffsetY;
            minX = Math.min(minX, shadowLeft);
            maxX = Math.max(maxX, shadowRight);
            minY = Math.min(minY, shadowTop);
            maxY = Math.max(maxY, shadowBottom);
        }
        return {
            x: minX,
            y: minY,
            minX: minX,
            minY: minY,
            maxX: maxX,
            maxY: maxY,
            width: maxX - minX,
            height: maxY - minY,
        };
    };
    /**
     * @protected
     * 清理缓存的 bbox
     */
    AbstractShape.prototype.clearCacheBBox = function () {
        this.set('bbox', null);
        this.set('canvasBox', null);
    };
    // 实现接口
    AbstractShape.prototype.isClipShape = function () {
        return this.get('isClipShape');
    };
    /**
     * @protected
     * 不同的图形自己实现是否在图形内部的逻辑，要判断边和填充区域
     * @param  {number}  refX 相对于图形的坐标 x
     * @param  {number}  refY 相对于图形的坐标 Y
     * @return {boolean} 点是否在图形内部
     */
    AbstractShape.prototype.isInShape = function (refX, refY) {
        return false;
    };
    /**
     * 是否仅仅使用 BBox 检测就可以判定拾取到图形
     * 默认是 false，但是有些图形例如 image、marker 等都可直接使用 BBox 的检测而不需要使用图形拾取
     * @return {Boolean} 仅仅使用 BBox 进行拾取
     */
    AbstractShape.prototype.isOnlyHitBox = function () {
        return false;
    };
    // 不同的 Shape 各自实现
    AbstractShape.prototype.isHit = function (x, y) {
        var startArrowShape = this.get('startArrowShape');
        var endArrowShape = this.get('endArrowShape');
        var vec = [x, y, 1];
        vec = this.invertFromMatrix(vec);
        var refX = vec[0], refY = vec[1];
        var inBBox = this._isInBBox(refX, refY);
        // 跳过图形的拾取，在某些图形中可以省略一倍的检测成本
        if (this.isOnlyHitBox()) {
            return inBBox;
        }
        // 被裁减掉的和不在包围盒内的不进行计算
        if (inBBox && !this.isClipped(refX, refY)) {
            // 对图形进行拾取判断
            if (this.isInShape(refX, refY)) {
                return true;
            }
            // 对起始箭头进行拾取判断
            if (startArrowShape && startArrowShape.isHit(refX, refY)) {
                return true;
            }
            // 对结束箭头进行拾取判断
            if (endArrowShape && endArrowShape.isHit(refX, refY)) {
                return true;
            }
        }
        return false;
    };
    return AbstractShape;
}(element_1.default));
exports.default = AbstractShape;

},{"../util/matrix":119,"./element":98,"tslib":894}],101:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var d3Timer = require("d3-timer");
var d3Ease = require("d3-ease");
var d3_interpolate_1 = require("d3-interpolate"); // 目前整体动画只需要数值和数组的差值计算
var PathUtil = require("../util/path");
var color_1 = require("../util/color");
var IDENTITY_MATRIX = [1, 0, 0, 0, 1, 0, 0, 0, 1];
/**
 * 使用 ratio 进行插值计算来更新属性
 * @param {IElement}  shape    元素
 * @param {Animation} animation 动画
 * @param {number}    ratio    比例
 * @return {boolean}  动画是否执行完成
 */
function _update(shape, animation, ratio) {
    var cProps = {}; // 此刻属性
    var fromAttrs = animation.fromAttrs, toAttrs = animation.toAttrs;
    if (shape.destroyed) {
        return;
    }
    var interf; //  差值函数
    for (var k in toAttrs) {
        if (!util_1.isEqual(fromAttrs[k], toAttrs[k])) {
            if (k === 'path') {
                var toPath = toAttrs[k];
                var fromPath = fromAttrs[k];
                if (toPath.length > fromPath.length) {
                    toPath = PathUtil.parsePathString(toAttrs[k]); // 终点状态
                    fromPath = PathUtil.parsePathString(fromAttrs[k]); // 起始状态
                    fromPath = PathUtil.fillPathByDiff(fromPath, toPath);
                    fromPath = PathUtil.formatPath(fromPath, toPath);
                    animation.fromAttrs.path = fromPath;
                    animation.toAttrs.path = toPath;
                }
                else if (!animation.pathFormatted) {
                    toPath = PathUtil.parsePathString(toAttrs[k]);
                    fromPath = PathUtil.parsePathString(fromAttrs[k]);
                    fromPath = PathUtil.formatPath(fromPath, toPath);
                    animation.fromAttrs.path = fromPath;
                    animation.toAttrs.path = toPath;
                    animation.pathFormatted = true;
                }
                cProps[k] = [];
                for (var i = 0; i < toPath.length; i++) {
                    var toPathPoint = toPath[i];
                    var fromPathPoint = fromPath[i];
                    var cPathPoint = [];
                    for (var j = 0; j < toPathPoint.length; j++) {
                        if (util_1.isNumber(toPathPoint[j]) && fromPathPoint && util_1.isNumber(fromPathPoint[j])) {
                            interf = d3_interpolate_1.interpolate(fromPathPoint[j], toPathPoint[j]);
                            cPathPoint.push(interf(ratio));
                        }
                        else {
                            cPathPoint.push(toPathPoint[j]);
                        }
                    }
                    cProps[k].push(cPathPoint);
                }
            }
            else if (k === 'matrix') {
                /*
                 对矩阵进行插值时，需要保证矩阵不为空，为空则使用单位矩阵
                 TODO: 二维和三维场景下单位矩阵不同，之后 WebGL 版需要做进一步处理
                 */
                var matrixFn = d3_interpolate_1.interpolateArray(fromAttrs[k] || IDENTITY_MATRIX, toAttrs[k] || IDENTITY_MATRIX);
                var currentMatrix = matrixFn(ratio);
                cProps[k] = currentMatrix;
            }
            else if (color_1.isColorProp(k) && color_1.isGradientColor(toAttrs[k])) {
                cProps[k] = toAttrs[k];
            }
            else if (!util_1.isFunction(toAttrs[k])) {
                // 非函数类型的值才能做插值
                interf = d3_interpolate_1.interpolate(fromAttrs[k], toAttrs[k]);
                cProps[k] = interf(ratio);
            }
        }
    }
    shape.attr(cProps);
}
/**
 * 根据自定义帧动画函数 onFrame 来更新属性
 * @param {IElement}  shape    元素
 * @param {Animation} animation 动画
 * @param {number}    elapsed  动画执行时间(毫秒)
 * @return {boolean}  动画是否执行完成
 */
function update(shape, animation, elapsed) {
    var startTime = animation.startTime, delay = animation.delay;
    // 如果还没有开始执行或暂停，先不更新
    if (elapsed < startTime + delay || animation._paused) {
        return false;
    }
    var ratio;
    var duration = animation.duration;
    var easing = animation.easing;
    // 已执行时间
    elapsed = elapsed - startTime - animation.delay;
    if (animation.repeat) {
        // 如果动画重复执行，则 elapsed > duration，计算 ratio 时需取模
        ratio = (elapsed % duration) / duration;
        ratio = d3Ease[easing](ratio);
    }
    else {
        ratio = elapsed / duration;
        if (ratio < 1) {
            // 动画未执行完
            ratio = d3Ease[easing](ratio);
        }
        else {
            // 动画已执行完
            if (animation.onFrame) {
                shape.attr(animation.onFrame(1));
            }
            else {
                shape.attr(animation.toAttrs);
            }
            return true;
        }
    }
    if (animation.onFrame) {
        var attrs = animation.onFrame(ratio);
        shape.attr(attrs);
    }
    else {
        _update(shape, animation, ratio);
    }
    return false;
}
var Timeline = /** @class */ (function () {
    /**
     * 时间轴构造函数，依赖于画布
     * @param {}
     */
    function Timeline(canvas) {
        /**
         * 执行动画的元素列表
         * @type {IElement[]}
         */
        this.animators = [];
        /**
         * 当前时间
         * @type {number}
         */
        this.current = 0;
        /**
         * 定时器
         * @type {d3Timer.Timer}
         */
        this.timer = null;
        this.canvas = canvas;
    }
    /**
     * 初始化定时器
     */
    Timeline.prototype.initTimer = function () {
        var _this = this;
        var isFinished = false;
        var shape;
        var animations;
        var animation;
        this.timer = d3Timer.timer(function (elapsed) {
            _this.current = elapsed;
            if (_this.animators.length > 0) {
                for (var i = _this.animators.length - 1; i >= 0; i--) {
                    shape = _this.animators[i];
                    if (shape.destroyed) {
                        // 如果已经被销毁，直接移出队列
                        _this.removeAnimator(i);
                        continue;
                    }
                    if (!shape.isAnimatePaused()) {
                        animations = shape.get('animations');
                        for (var j = animations.length - 1; j >= 0; j--) {
                            animation = animations[j];
                            isFinished = update(shape, animation, elapsed);
                            if (isFinished) {
                                animations.splice(j, 1);
                                isFinished = false;
                                if (animation.callback) {
                                    animation.callback();
                                }
                            }
                        }
                    }
                    if (animations.length === 0) {
                        _this.removeAnimator(i);
                    }
                }
                var autoDraw = _this.canvas.get('autoDraw');
                // 非自动渲染模式下，手动调用 canvas.draw() 重新渲染
                if (!autoDraw) {
                    _this.canvas.draw();
                }
            }
        });
    };
    /**
     * 增加动画元素
     */
    Timeline.prototype.addAnimator = function (shape) {
        this.animators.push(shape);
    };
    /**
     * 移除动画元素
     */
    Timeline.prototype.removeAnimator = function (index) {
        this.animators.splice(index, 1);
    };
    /**
     * 是否有动画在执行
     */
    Timeline.prototype.isAnimating = function () {
        return !!this.animators.length;
    };
    /**
     * 停止定时器
     */
    Timeline.prototype.stop = function () {
        if (this.timer) {
            this.timer.stop();
        }
    };
    /**
     * 停止时间轴上所有元素的动画，并置空动画元素列表
     * @param {boolean} toEnd 是否到动画的最终状态，用来透传给动画元素的 stopAnimate 方法
     */
    Timeline.prototype.stopAllAnimations = function (toEnd) {
        if (toEnd === void 0) { toEnd = true; }
        this.animators.forEach(function (animator) {
            animator.stopAnimate(toEnd);
        });
        this.animators = [];
        this.canvas.draw();
    };
    /**
     * 获取当前时间
     */
    Timeline.prototype.getTime = function () {
        return this.current;
    };
    return Timeline;
}());
exports.default = Timeline;

},{"../util/color":118,"../util/path":121,"@antv/util":803,"d3-ease":876,"d3-interpolate":877,"d3-timer":879}],102:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function default_1(shape) {
    var _a = shape.attr(), x = _a.x, y = _a.y, r = _a.r;
    return {
        x: x - r,
        y: y - r,
        width: r * 2,
        height: r * 2,
    };
}
exports.default = default_1;

},{}],103:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function default_1(shape) {
    var attrs = shape.attr();
    var x = attrs.x, y = attrs.y, rx = attrs.rx, ry = attrs.ry;
    return {
        x: x - rx,
        y: y - ry,
        width: rx * 2,
        height: ry * 2,
    };
}
exports.default = default_1;

},{}],104:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var register_1 = require("./register");
exports.getBBoxMethod = register_1.getMethod;
var rect_1 = require("./rect");
var circle_1 = require("./circle");
var polyline_1 = require("./polyline");
var polygon_1 = require("./polygon");
var text_1 = require("./text");
var path_1 = require("./path");
var line_1 = require("./line");
var ellipse_1 = require("./ellipse");
register_1.register('rect', rect_1.default);
register_1.register('image', rect_1.default); // image 使用 rect 的包围盒计算
register_1.register('circle', circle_1.default);
register_1.register('marker', circle_1.default); // marker 使用 circle 的计算方案
register_1.register('polyline', polyline_1.default);
register_1.register('polygon', polygon_1.default);
register_1.register('text', text_1.default);
register_1.register('path', path_1.default);
register_1.register('line', line_1.default);
register_1.register('ellipse', ellipse_1.default);

},{"./circle":102,"./ellipse":103,"./line":105,"./path":106,"./polygon":107,"./polyline":108,"./rect":109,"./register":110,"./text":111}],105:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
function default_1(shape) {
    var attrs = shape.attr();
    var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2;
    var minX = Math.min(x1, x2);
    var maxX = Math.max(x1, x2);
    var minY = Math.min(y1, y2);
    var maxY = Math.max(y1, y2);
    var bbox = {
        minX: minX,
        maxX: maxX,
        minY: minY,
        maxY: maxY,
    };
    bbox = util_1.mergeArrowBBox(shape, bbox);
    return {
        x: bbox.minX,
        y: bbox.minY,
        width: bbox.maxX - bbox.minX,
        height: bbox.maxY - bbox.minY,
    };
}
exports.default = default_1;

},{"./util":112}],106:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var quadratic_1 = require("@antv/g-math/lib/quadratic");
var cubic_1 = require("@antv/g-math/lib/cubic");
var arc_1 = require("@antv/g-math/lib/arc");
var path_2_segments_1 = require("@antv/path-util/lib/path-2-segments");
var is_number_equal_1 = require("@antv/util/lib/is-number-equal");
var util_1 = require("./util");
function getPathBox(segments, lineWidth) {
    var xArr = [];
    var yArr = [];
    var segmentsWithAngle = [];
    for (var i = 0; i < segments.length; i++) {
        var segment = segments[i];
        var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint;
        var box = void 0;
        switch (segment.command) {
            case 'Q':
                box = quadratic_1.default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4]);
                break;
            case 'C':
                box = cubic_1.default.box(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6]);
                break;
            case 'A':
                var arcParams = segment.arcParams;
                box = arc_1.default.box(arcParams.cx, arcParams.cy, arcParams.rx, arcParams.ry, arcParams.xRotation, arcParams.startAngle, arcParams.endAngle);
                break;
            default:
                xArr.push(currentPoint[0]);
                yArr.push(currentPoint[1]);
                break;
        }
        if (box) {
            segment.box = box;
            xArr.push(box.x, box.x + box.width);
            yArr.push(box.y, box.y + box.height);
        }
        if (lineWidth && (segment.command === 'L' || segment.command === 'M') && segment.prePoint && segment.nextPoint) {
            segmentsWithAngle.push(segment);
        }
    }
    // bbox calculation should ignore NaN for path attribute
    // ref: https://github.com/antvis/g/issues/210
    xArr = xArr.filter(function (item) { return !Number.isNaN(item); });
    yArr = yArr.filter(function (item) { return !Number.isNaN(item); });
    var minX = Math.min.apply(null, xArr);
    var minY = Math.min.apply(null, yArr);
    var maxX = Math.max.apply(null, xArr);
    var maxY = Math.max.apply(null, yArr);
    if (segmentsWithAngle.length === 0) {
        return {
            x: minX,
            y: minY,
            width: maxX - minX,
            height: maxY - minY,
        };
    }
    for (var i = 0; i < segmentsWithAngle.length; i++) {
        var segment = segmentsWithAngle[i];
        var currentPoint = segment.currentPoint;
        var extra = void 0;
        if (currentPoint[0] === minX) {
            extra = getExtraFromSegmentWithAngle(segment, lineWidth);
            minX = minX - extra.xExtra;
        }
        else if (currentPoint[0] === maxX) {
            extra = getExtraFromSegmentWithAngle(segment, lineWidth);
            maxX = maxX + extra.xExtra;
        }
        if (currentPoint[1] === minY) {
            extra = getExtraFromSegmentWithAngle(segment, lineWidth);
            minY = minY - extra.yExtra;
        }
        else if (currentPoint[1] === maxY) {
            extra = getExtraFromSegmentWithAngle(segment, lineWidth);
            maxY = maxY + extra.yExtra;
        }
    }
    return {
        x: minX,
        y: minY,
        width: maxX - minX,
        height: maxY - minY,
    };
}
function getExtraFromSegmentWithAngle(segment, lineWidth) {
    var prePoint = segment.prePoint, currentPoint = segment.currentPoint, nextPoint = segment.nextPoint;
    var currentAndPre = Math.pow(currentPoint[0] - prePoint[0], 2) + Math.pow(currentPoint[1] - prePoint[1], 2);
    var currentAndNext = Math.pow(currentPoint[0] - nextPoint[0], 2) + Math.pow(currentPoint[1] - nextPoint[1], 2);
    var preAndNext = Math.pow(prePoint[0] - nextPoint[0], 2) + Math.pow(prePoint[1] - nextPoint[1], 2);
    // 以 currentPoint 为顶点的夹角
    var currentAngle = Math.acos((currentAndPre + currentAndNext - preAndNext) / (2 * Math.sqrt(currentAndPre) * Math.sqrt(currentAndNext)));
    // 夹角为空、 0 或 PI 时，不需要计算夹角处的额外宽度
    // 注意: 由于计算精度问题，夹角为 0 的情况计算出来的角度可能是一个很小的值，还需要判断其与 0 是否近似相等
    if (!currentAngle || Math.sin(currentAngle) === 0 || is_number_equal_1.default(currentAngle, 0)) {
        return {
            xExtra: 0,
            yExtra: 0,
        };
    }
    var xAngle = Math.abs(Math.atan2(nextPoint[1] - currentPoint[1], nextPoint[0] - currentPoint[0]));
    var yAngle = Math.abs(Math.atan2(nextPoint[0] - currentPoint[0], nextPoint[1] - currentPoint[1]));
    // 将夹角转为锐角
    xAngle = xAngle > Math.PI / 2 ? Math.PI - xAngle : xAngle;
    yAngle = yAngle > Math.PI / 2 ? Math.PI - yAngle : yAngle;
    // 这里不考虑在水平和垂直方向的投影，直接使用最大差值
    // 由于上层统一加减了二分之一线宽，这里需要进行弥补
    var extra = {
        // 水平方向投影
        xExtra: Math.cos(currentAngle / 2 - xAngle) * ((lineWidth / 2) * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0,
        // 垂直方向投影
        yExtra: Math.cos(yAngle - currentAngle / 2) * ((lineWidth / 2) * (1 / Math.sin(currentAngle / 2))) - lineWidth / 2 || 0,
    };
    return extra;
}
function default_1(shape) {
    var attrs = shape.attr();
    var path = attrs.path, stroke = attrs.stroke;
    var lineWidth = stroke ? attrs.lineWidth : 0; // 只有有 stroke 时，lineWidth 才生效
    var segments = shape.get('segments') || path_2_segments_1.default(path);
    var _a = getPathBox(segments, lineWidth), x = _a.x, y = _a.y, width = _a.width, height = _a.height;
    var bbox = {
        minX: x,
        minY: y,
        maxX: x + width,
        maxY: y + height,
    };
    bbox = util_1.mergeArrowBBox(shape, bbox);
    return {
        x: bbox.minX,
        y: bbox.minY,
        width: bbox.maxX - bbox.minX,
        height: bbox.maxY - bbox.minY,
    };
}
exports.default = default_1;

},{"./util":112,"@antv/g-math/lib/arc":168,"@antv/g-math/lib/cubic":170,"@antv/g-math/lib/quadratic":174,"@antv/path-util/lib/path-2-segments":731,"@antv/util/lib/is-number-equal":823}],107:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/g-math/lib/util");
function default_1(shape) {
    var attrs = shape.attr();
    var points = attrs.points;
    var xArr = [];
    var yArr = [];
    for (var i = 0; i < points.length; i++) {
        var point = points[i];
        xArr.push(point[0]);
        yArr.push(point[1]);
    }
    return util_1.getBBoxByArray(xArr, yArr);
}
exports.default = default_1;

},{"@antv/g-math/lib/util":176}],108:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/g-math/lib/util");
var util_2 = require("./util");
function default_1(shape) {
    var attrs = shape.attr();
    var points = attrs.points;
    var xArr = [];
    var yArr = [];
    for (var i = 0; i < points.length; i++) {
        var point = points[i];
        xArr.push(point[0]);
        yArr.push(point[1]);
    }
    var _a = util_1.getBBoxByArray(xArr, yArr), x = _a.x, y = _a.y, width = _a.width, height = _a.height;
    var bbox = {
        minX: x,
        minY: y,
        maxX: x + width,
        maxY: y + height,
    };
    bbox = util_2.mergeArrowBBox(shape, bbox);
    return {
        x: bbox.minX,
        y: bbox.minY,
        width: bbox.maxX - bbox.minX,
        height: bbox.maxY - bbox.minY,
    };
}
exports.default = default_1;

},{"./util":112,"@antv/g-math/lib/util":176}],109:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function default_1(shape) {
    var attrs = shape.attr();
    var x = attrs.x, y = attrs.y, width = attrs.width, height = attrs.height;
    return {
        x: x,
        y: y,
        width: width,
        height: height,
    };
}
exports.default = default_1;

},{}],110:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var cache = new Map();
/**
 * 注册计算包围盒的算法
 * @param type 方法名
 * @param method 方法
 */
function register(type, method) {
    cache.set(type, method);
}
exports.register = register;
/**
 * 获取计算包围盒的算法
 * @param type 方法名
 */
function getMethod(type) {
    return cache.get(type);
}
exports.getMethod = getMethod;

},{}],111:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var text_1 = require("../util/text");
function default_1(shape) {
    var attrs = shape.attr();
    var x = attrs.x, y = attrs.y, text = attrs.text, fontSize = attrs.fontSize, lineHeight = attrs.lineHeight;
    var font = attrs.font;
    if (!font) {
        // 如果未组装 font
        font = text_1.assembleFont(attrs);
    }
    var width = text_1.getTextWidth(text, font);
    var bbox;
    if (!width) {
        // 如果width不存在，四点共其实点
        bbox = {
            x: x,
            y: y,
            width: 0,
            height: 0,
        };
    }
    else {
        var textAlign = attrs.textAlign, textBaseline = attrs.textBaseline;
        var height = text_1.getTextHeight(text, fontSize, lineHeight); // attrs.height
        // 默认左右对齐：left, 默认上下对齐 bottom
        var point = {
            x: x,
            y: y - height,
        };
        if (textAlign) {
            if (textAlign === 'end' || textAlign === 'right') {
                point.x -= width;
            }
            else if (textAlign === 'center') {
                point.x -= width / 2;
            }
        }
        if (textBaseline) {
            if (textBaseline === 'top') {
                point.y += height;
            }
            else if (textBaseline === 'middle') {
                point.y += height / 2;
            }
        }
        bbox = {
            x: point.x,
            y: point.y,
            width: width,
            height: height,
        };
    }
    return bbox;
}
exports.default = default_1;

},{"../util/text":122}],112:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 合并包围盒
function mergeBBox(bbox1, bbox2) {
    if (!bbox1 || !bbox2) {
        return bbox1 || bbox2;
    }
    return {
        minX: Math.min(bbox1.minX, bbox2.minX),
        minY: Math.min(bbox1.minY, bbox2.minY),
        maxX: Math.max(bbox1.maxX, bbox2.maxX),
        maxY: Math.max(bbox1.maxY, bbox2.maxY),
    };
}
exports.mergeBBox = mergeBBox;
// 合并箭头的包围盒
function mergeArrowBBox(shape, bbox) {
    var startArrowShape = shape.get('startArrowShape');
    var endArrowShape = shape.get('endArrowShape');
    var startArrowBBox = null;
    var endArrowBBox = null;
    if (startArrowShape) {
        startArrowBBox = startArrowShape.getCanvasBBox();
        bbox = mergeBBox(bbox, startArrowBBox);
    }
    if (endArrowShape) {
        endArrowBBox = endArrowShape.getCanvasBBox();
        bbox = mergeBBox(bbox, endArrowBBox);
    }
    return bbox;
}
exports.mergeArrowBBox = mergeArrowBBox;

},{}],113:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @fileoverview 事件处理器
 * @author dxq613@gmail.com
 */
var graph_event_1 = require("./graph-event");
var util_1 = require("../util/util");
var CLICK_OFFSET = 40;
var LEFT_BTN_CODE = 0;
var DELEGATION_SPLIT = ':';
var EVENTS = [
    'mousedown',
    'mouseup',
    'dblclick',
    'mouseout',
    'mouseover',
    'mousemove',
    'mouseleave',
    'mouseenter',
    'touchstart',
    'touchmove',
    'touchend',
    'dragenter',
    'dragover',
    'dragleave',
    'drop',
    'contextmenu',
    'mousewheel',
];
// 是否有委托事件监听
function hasDelegation(events, type) {
    for (var key in events) {
        if (events.hasOwnProperty(key) && key.indexOf(DELEGATION_SPLIT + type) >= 0) {
            return true;
        }
    }
    return false;
}
// 触发目标事件，目标只能是 shape 或 canvas
function emitTargetEvent(target, type, eventObj) {
    eventObj.name = type;
    eventObj.target = target;
    eventObj.currentTarget = target;
    eventObj.delegateTarget = target;
    target.emit(type, eventObj);
}
// 事件冒泡, enter 和 leave 需要对 fromShape 和 toShape 进行判同
function bubbleEvent(container, type, eventObj) {
    if (eventObj.bubbles) {
        var relativeShape = void 0;
        var isOverEvent = false;
        if (type === 'mouseenter') {
            relativeShape = eventObj.fromShape;
            isOverEvent = true;
        }
        else if (type === 'mouseleave') {
            isOverEvent = true;
            relativeShape = eventObj.toShape;
        }
        // canvas 上的 mouseenter， mouseleave 事件，仅当进入或者移出 canvas 时触发
        if (container.isCanvas() && isOverEvent) {
            return;
        }
        // 如果相关图形同当前图形在同一个容器内，不触发事件
        if (relativeShape && util_1.isParent(container, relativeShape)) {
            // 阻止继续向上冒泡
            eventObj.bubbles = false;
            return;
        }
        // 事件名称可能在委托过程中被修改，因此事件冒泡时需要重新设置事件名称
        eventObj.name = type;
        eventObj.currentTarget = container;
        eventObj.delegateTarget = container;
        container.emit(type, eventObj);
    }
}
var EventController = /** @class */ (function () {
    function EventController(cfg) {
        var _this = this;
        // 正在被拖拽的图形
        this.draggingShape = null;
        this.dragging = false;
        // 当前鼠标/touch所在位置的图形
        this.currentShape = null;
        this.mousedownShape = null;
        this.mousedownPoint = null;
        // 统一处理所有的回调
        this._eventCallback = function (ev) {
            var type = ev.type;
            _this._triggerEvent(type, ev);
        };
        // 在 document 处理拖拽到画布外的事件，处理从图形上移除画布未被捕捉的问题
        this._onDocumentMove = function (ev) {
            var canvas = _this.canvas;
            var el = canvas.get('el');
            if (el !== ev.target) {
                // 不在 canvas 上移动
                if (_this.dragging || _this.currentShape) {
                    var pointInfo = _this._getPointInfo(ev);
                    // 还在拖拽过程中
                    if (_this.dragging) {
                        _this._emitEvent('drag', ev, pointInfo, _this.draggingShape);
                    }
                    // 说明从某个图形直接移动到了画布外面，
                    // 修复了 mouseleave 的 bug 后不再出现这种情况
                    // if (this.currentShape) {
                    //   this._emitEvent('mouseleave', ev, pointInfo, this.currentShape, this.currentShape, null);
                    //   this.currentShape = null;
                    // }
                }
            }
        };
        // 在 document 上处理拖拽到外面，释放鼠标时触发 dragend
        this._onDocumentMouseUp = function (ev) {
            var canvas = _this.canvas;
            var el = canvas.get('el');
            if (el !== ev.target) {
                // 不在 canvas 上移动
                if (_this.dragging) {
                    var pointInfo = _this._getPointInfo(ev);
                    if (_this.draggingShape) {
                        // 如果存在拖拽的图形，则也触发 drop 事件
                        _this._emitEvent('drop', ev, pointInfo, null);
                    }
                    _this._emitEvent('dragend', ev, pointInfo, _this.draggingShape);
                    _this._afterDrag(_this.draggingShape, pointInfo, ev);
                }
            }
        };
        this.canvas = cfg.canvas;
    }
    EventController.prototype.init = function () {
        this._bindEvents();
    };
    // 注册事件
    EventController.prototype._bindEvents = function () {
        var _this = this;
        var el = this.canvas.get('el');
        util_1.each(EVENTS, function (eventName) {
            el.addEventListener(eventName, _this._eventCallback);
        });
        if (document) {
            // 处理移动到外面没有触发 shape mouse leave 的事件
            // 处理拖拽到外部的问题
            document.addEventListener('mousemove', this._onDocumentMove);
            // 处理拖拽过程中在外部释放鼠标的问题
            document.addEventListener('mouseup', this._onDocumentMouseUp);
        }
    };
    // 清理事件
    EventController.prototype._clearEvents = function () {
        var _this = this;
        var el = this.canvas.get('el');
        util_1.each(EVENTS, function (eventName) {
            el.removeEventListener(eventName, _this._eventCallback);
        });
        if (document) {
            document.removeEventListener('mousemove', this._onDocumentMove);
            document.removeEventListener('mouseup', this._onDocumentMouseUp);
        }
    };
    EventController.prototype._getEventObj = function (type, event, point, target, fromShape, toShape) {
        var eventObj = new graph_event_1.default(type, event);
        eventObj.fromShape = fromShape;
        eventObj.toShape = toShape;
        eventObj.x = point.x;
        eventObj.y = point.y;
        eventObj.clientX = point.clientX;
        eventObj.clientY = point.clientY;
        eventObj.propagationPath.push(target);
        // 事件的x,y应该是基于画布左上角的，与canvas的matrix无关
        return eventObj;
    };
    // 根据点获取图形，提取成独立方法，便于后续优化
    EventController.prototype._getShape = function (point, ev) {
        return this.canvas.getShape(point.x, point.y, ev);
    };
    // 获取事件的当前点的信息
    EventController.prototype._getPointInfo = function (ev) {
        var canvas = this.canvas;
        var clientPoint = canvas.getClientByEvent(ev);
        var point = canvas.getPointByEvent(ev);
        return {
            x: point.x,
            y: point.y,
            clientX: clientPoint.x,
            clientY: clientPoint.y,
        };
    };
    // 触发事件
    EventController.prototype._triggerEvent = function (type, ev) {
        var pointInfo = this._getPointInfo(ev);
        // 每次都获取图形有一定成本，后期可以考虑进行缓存策略
        var shape = this._getShape(pointInfo, ev);
        var method = this["_on" + type];
        var leaveCanvas = false;
        if (method) {
            method.call(this, pointInfo, shape, ev);
        }
        else {
            var preShape = this.currentShape;
            // 如果进入、移出画布时存在图形，则要分别触发事件
            if (type === 'mouseenter' || type === 'dragenter' || type === 'mouseover') {
                this._emitEvent(type, ev, pointInfo, null, null, shape); // 先进入画布
                if (shape) {
                    this._emitEvent(type, ev, pointInfo, shape, null, shape); // 再触发图形的事件
                }
                if (type === 'mouseenter' && this.draggingShape) {
                    // 如果正在拖拽图形, 则触发 dragleave
                    this._emitEvent('dragenter', ev, pointInfo, null);
                }
            }
            else if (type === 'mouseleave' || type === 'dragleave' || type === 'mouseout') {
                leaveCanvas = true;
                if (preShape) {
                    this._emitEvent(type, ev, pointInfo, preShape, preShape, null); // 先触发图形的事件
                }
                this._emitEvent(type, ev, pointInfo, null, preShape, null); // 再触发离开画布事件
                if (type === 'mouseleave' && this.draggingShape) {
                    this._emitEvent('dragleave', ev, pointInfo, null);
                }
            }
            else {
                this._emitEvent(type, ev, pointInfo, shape, null, null); // 一般事件中不需要考虑 from, to
            }
        }
        if (!leaveCanvas) {
            this.currentShape = shape;
        }
        // 当鼠标从画布移动到 shape 或者从 preShape 移动到 shape 时，应用 shape 上的鼠标样式
        if (shape && !shape.get('destroyed')) {
            var canvas = this.canvas;
            var el = canvas.get('el');
            el.style.cursor = shape.attr('cursor') || canvas.get('cursor');
        }
    };
    // 记录下点击的位置、图形，便于拖拽事件、click 事件的判定
    EventController.prototype._onmousedown = function (pointInfo, shape, event) {
        // 只有鼠标左键的 mousedown 事件才会设置 mousedownShape 等属性，避免鼠标右键的 mousedown 事件引起其他事件发生
        if (event.button === LEFT_BTN_CODE) {
            this.mousedownShape = shape;
            this.mousedownPoint = pointInfo;
            this.mousedownTimeStamp = event.timeStamp;
        }
        this._emitEvent('mousedown', event, pointInfo, shape, null, null); // mousedown 不考虑fromShape, toShape
    };
    // mouseleave 和 mouseenter 都是成对存在的
    // mouseenter 和 mouseover 同时触发
    EventController.prototype._emitMouseoverEvents = function (event, pointInfo, fromShape, toShape) {
        var el = this.canvas.get('el');
        if (fromShape !== toShape) {
            if (fromShape) {
                this._emitEvent('mouseout', event, pointInfo, fromShape, fromShape, toShape);
                this._emitEvent('mouseleave', event, pointInfo, fromShape, fromShape, toShape);
                // 当鼠标从 fromShape 移动到画布上时，重置鼠标样式
                if (!toShape || toShape.get('destroyed')) {
                    el.style.cursor = this.canvas.get('cursor');
                }
            }
            if (toShape) {
                this._emitEvent('mouseover', event, pointInfo, toShape, fromShape, toShape);
                this._emitEvent('mouseenter', event, pointInfo, toShape, fromShape, toShape);
            }
        }
    };
    // dragover 不等同于 mouseover，而等同于 mousemove
    EventController.prototype._emitDragoverEvents = function (event, pointInfo, fromShape, toShape, isCanvasEmit) {
        if (toShape) {
            if (toShape !== fromShape) {
                if (fromShape) {
                    this._emitEvent('dragleave', event, pointInfo, fromShape, fromShape, toShape);
                }
                this._emitEvent('dragenter', event, pointInfo, toShape, fromShape, toShape);
            }
            if (!isCanvasEmit) {
                this._emitEvent('dragover', event, pointInfo, toShape);
            }
        }
        else if (fromShape) {
            // TODO: 此处判断有问题，当 drag 图形时，也会触发一次 dragleave 事件，因为此时 toShape 为 null，这不是所期望的
            // 经过空白区域
            this._emitEvent('dragleave', event, pointInfo, fromShape, fromShape, toShape);
        }
        if (isCanvasEmit) {
            this._emitEvent('dragover', event, pointInfo, toShape);
        }
    };
    // drag 完成后，需要做一些清理工作
    EventController.prototype._afterDrag = function (draggingShape, pointInfo, event) {
        if (draggingShape) {
            draggingShape.set('capture', true); // 恢复可以拾取
            this.draggingShape = null;
        }
        this.dragging = false;
        // drag 完成后，有可能 draggingShape 已经移动到了当前位置，所以不能直接取当前图形
        var shape = this._getShape(pointInfo, event);
        // 拖拽完成后，进行 enter，leave 的判定
        if (shape !== draggingShape) {
            this._emitMouseoverEvents(event, pointInfo, draggingShape, shape);
        }
        this.currentShape = shape; // 更新当前 shape，如果不处理当前图形的 mouseleave 事件可能会出问题
    };
    // 按键抬起时，会终止拖拽、触发点击
    EventController.prototype._onmouseup = function (pointInfo, shape, event) {
        // eevent.button === 0 表示鼠标左键事件，此处加上判断主要是为了避免右键鼠标会触发 mouseup 和 click 事件
        // ref: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
        if (event.button === LEFT_BTN_CODE) {
            var draggingShape = this.draggingShape;
            if (this.dragging) {
                // 存在可以拖拽的图形，同时拖拽到其他图形上时触发 drag 事件
                if (draggingShape) {
                    this._emitEvent('drop', event, pointInfo, shape);
                }
                this._emitEvent('dragend', event, pointInfo, draggingShape);
                this._afterDrag(draggingShape, pointInfo, event);
            }
            else {
                this._emitEvent('mouseup', event, pointInfo, shape); // 先触发 mouseup 再触发 click
                if (shape === this.mousedownShape) {
                    this._emitEvent('click', event, pointInfo, shape);
                }
                this.mousedownShape = null;
                this.mousedownPoint = null;
            }
        }
    };
    // 当触发浏览器的 dragover 事件时，不会再触发 mousemove ，所以这时候的 dragenter, dragleave 事件需要重新处理
    EventController.prototype._ondragover = function (pointInfo, shape, event) {
        event.preventDefault(); // 如果不对 dragover 进行 preventDefault，则不会在 canvas 上触发 drop 事件
        var preShape = this.currentShape;
        this._emitDragoverEvents(event, pointInfo, preShape, shape, true);
    };
    // 大量的图形事件，都通过 mousemove 模拟
    EventController.prototype._onmousemove = function (pointInfo, shape, event) {
        var canvas = this.canvas;
        var preShape = this.currentShape;
        var draggingShape = this.draggingShape;
        // 正在拖拽时
        if (this.dragging) {
            // 正在拖拽中
            if (draggingShape) {
                // 如果拖拽了 shape 会触发 dragenter, dragleave, dragover 和 drag 事件
                this._emitDragoverEvents(event, pointInfo, preShape, shape, false);
            }
            // 如果存在 draggingShape 则会在 draggingShape 上触发 drag 事件，冒泡到 canvas 上
            // 否则在 canvas 上触发 drag 事件
            this._emitEvent('drag', event, pointInfo, draggingShape);
        }
        else {
            var mousedownPoint = this.mousedownPoint;
            if (mousedownPoint) {
                // 当鼠标点击下去，同时移动时，进行 drag 判定
                var mousedownShape = this.mousedownShape;
                var now = event.timeStamp;
                var timeWindow = now - this.mousedownTimeStamp;
                var dx = mousedownPoint.clientX - pointInfo.clientX;
                var dy = mousedownPoint.clientY - pointInfo.clientY;
                var dist = dx * dx + dy * dy;
                if (timeWindow > 120 || dist > CLICK_OFFSET) {
                    if (mousedownShape && mousedownShape.get('draggable')) {
                        // 设置了 draggable 的 shape 才能触发 drag 相关的事件
                        draggingShape = this.mousedownShape; // 拖动鼠标点下时的 shape
                        draggingShape.set('capture', false); // 禁止继续拾取，否则无法进行 dragover,dragenter,dragleave,drop的判定
                        this.draggingShape = draggingShape;
                        this.dragging = true;
                        this._emitEvent('dragstart', event, pointInfo, draggingShape);
                        // 清理按下鼠标时缓存的值
                        this.mousedownShape = null;
                        this.mousedownPoint = null;
                    }
                    else if (!mousedownShape && canvas.get('draggable')) {
                        // 设置了 draggable 的 canvas 才能触发 drag 相关的事件
                        this.dragging = true;
                        this._emitEvent('dragstart', event, pointInfo, null);
                        // 清理按下鼠标时缓存的值
                        this.mousedownShape = null;
                        this.mousedownPoint = null;
                    }
                    else {
                        this._emitMouseoverEvents(event, pointInfo, preShape, shape);
                        this._emitEvent('mousemove', event, pointInfo, shape);
                    }
                }
                else {
                    this._emitMouseoverEvents(event, pointInfo, preShape, shape);
                    this._emitEvent('mousemove', event, pointInfo, shape);
                }
            }
            else {
                // 没有按键按下时，则直接触发 mouse over 相关的各种事件
                this._emitMouseoverEvents(event, pointInfo, preShape, shape);
                // 始终触发移动
                this._emitEvent('mousemove', event, pointInfo, shape);
            }
        }
    };
    // 触发事件
    EventController.prototype._emitEvent = function (type, event, pointInfo, shape, fromShape, toShape) {
        var eventObj = this._getEventObj(type, event, pointInfo, shape, fromShape, toShape);
        // 存在 shape 触发，则进行冒泡处理
        if (shape) {
            eventObj.shape = shape;
            // 触发 shape 上的事件
            emitTargetEvent(shape, type, eventObj);
            var parent_1 = shape.getParent();
            // 执行冒泡
            while (parent_1) {
                // 委托事件要先触发
                parent_1.emitDelegation(type, eventObj);
                // 事件冒泡停止，不能妨碍委托事件
                if (!eventObj.propagationStopped) {
                    bubbleEvent(parent_1, type, eventObj);
                }
                eventObj.propagationPath.push(parent_1);
                parent_1 = parent_1.getParent();
            }
        }
        else {
            // 如果没有 shape 直接在 canvas 上触发
            var canvas = this.canvas;
            // 直接触发 canvas 上的事件
            emitTargetEvent(canvas, type, eventObj);
        }
    };
    EventController.prototype.destroy = function () {
        // 清理事件
        this._clearEvents();
        // 清理缓存的对象
        this.canvas = null;
        this.currentShape = null;
        this.draggingShape = null;
        this.mousedownPoint = null;
        this.mousedownShape = null;
        this.mousedownTimeStamp = null;
    };
    return EventController;
}());
exports.default = EventController;

},{"../util/util":123,"./graph-event":114}],114:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GraphEvent = /** @class */ (function () {
    function GraphEvent(type, event) {
        /**
         * 是否允许冒泡
         * @type {boolean}
         */
        this.bubbles = true;
        /**
         * 触发对象
         * @type {object}
         */
        this.target = null;
        /**
         * 监听对象
         * @type {object}
         */
        this.currentTarget = null;
        /**
         * 委托对象
         * @type {object}
         */
        this.delegateTarget = null;
        /**
         * 委托事件监听对象的代理对象，即 ev.delegateObject = ev.currentTarget.get('delegateObject')
         * @type {object}
         */
        this.delegateObject = null;
        /**
         * 是否阻止了原生事件
         * @type {boolean}
         */
        this.defaultPrevented = false;
        /**
         * 是否阻止传播（向上冒泡）
         * @type {boolean}
         */
        this.propagationStopped = false;
        /**
         * 触发事件的图形
         * @type {IShape}
         */
        this.shape = null;
        /**
         * 开始触发事件的图形
         * @type {IShape}
         */
        this.fromShape = null;
        /**
         * 事件结束时的触发图形
         * @type {IShape}
         */
        this.toShape = null;
        // 触发事件的路径
        this.propagationPath = [];
        this.type = type;
        this.name = type;
        this.originalEvent = event;
        this.timeStamp = event.timeStamp;
    }
    /**
     * 阻止浏览器默认的行为
     */
    GraphEvent.prototype.preventDefault = function () {
        this.defaultPrevented = true;
        if (this.originalEvent.preventDefault) {
            this.originalEvent.preventDefault();
        }
    };
    /**
     * 阻止冒泡
     */
    GraphEvent.prototype.stopPropagation = function () {
        this.propagationStopped = true;
    };
    GraphEvent.prototype.toString = function () {
        var type = this.type;
        return "[Event (type=" + type + ")]";
    };
    GraphEvent.prototype.save = function () { };
    GraphEvent.prototype.restore = function () { };
    return GraphEvent;
}());
exports.default = GraphEvent;

},{}],115:[function(require,module,exports){
"use strict";
/**
 * @fileoverview G 的基础接口定义和所有的抽象类
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var PathUtil = require("./util/path");
exports.PathUtil = PathUtil;
var pkg = require('../package.json');
exports.version = pkg.version;
var graph_event_1 = require("./event/graph-event");
exports.Event = graph_event_1.default;
var base_1 = require("./abstract/base");
exports.Base = base_1.default;
var canvas_1 = require("./abstract/canvas");
exports.AbstractCanvas = canvas_1.default;
var group_1 = require("./abstract/group");
exports.AbstractGroup = group_1.default;
var shape_1 = require("./abstract/shape");
exports.AbstractShape = shape_1.default;

},{"../package.json":124,"./abstract/base":95,"./abstract/canvas":96,"./abstract/group":99,"./abstract/shape":100,"./event/graph-event":114,"./util/path":121}],116:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

},{}],117:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

},{}],118:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isColorProp = function (prop) { return ['fill', 'stroke', 'fillStyle', 'strokeStyle'].includes(prop); };
exports.isGradientColor = function (val) { return /^[r,R,L,l]{1}[\s]*\(/.test(val); };

},{}],119:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 矩阵运算，本来是要引入 gl-matrix, 但是考虑到 g-mobile 对大小有限制，同时 g-webgl 使用的 matrix 不一致
 * 所以，这里仅实现 2D 几个运算，上层自己引入 gl-matrix
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 3阶矩阵相乘
 * @param {number[]} a 矩阵1
 * @param {number[]} b 矩阵2
 */
function multiplyMatrix(a, b) {
    var out = [];
    var a00 = a[0];
    var a01 = a[1];
    var a02 = a[2];
    var a10 = a[3];
    var a11 = a[4];
    var a12 = a[5];
    var a20 = a[6];
    var a21 = a[7];
    var a22 = a[8];
    var b00 = b[0];
    var b01 = b[1];
    var b02 = b[2];
    var b10 = b[3];
    var b11 = b[4];
    var b12 = b[5];
    var b20 = b[6];
    var b21 = b[7];
    var b22 = b[8];
    out[0] = b00 * a00 + b01 * a10 + b02 * a20;
    out[1] = b00 * a01 + b01 * a11 + b02 * a21;
    out[2] = b00 * a02 + b01 * a12 + b02 * a22;
    out[3] = b10 * a00 + b11 * a10 + b12 * a20;
    out[4] = b10 * a01 + b11 * a11 + b12 * a21;
    out[5] = b10 * a02 + b11 * a12 + b12 * a22;
    out[6] = b20 * a00 + b21 * a10 + b22 * a20;
    out[7] = b20 * a01 + b21 * a11 + b22 * a21;
    out[8] = b20 * a02 + b21 * a12 + b22 * a22;
    return out;
}
exports.multiplyMatrix = multiplyMatrix;
/**
 * 3阶矩阵同2阶向量相乘
 * @param {number[]} m 矩阵
 * @param {number[]} v 二阶向量
 */
function multiplyVec2(m, v) {
    var out = [];
    var x = v[0];
    var y = v[1];
    out[0] = m[0] * x + m[3] * y + m[6];
    out[1] = m[1] * x + m[4] * y + m[7];
    return out;
}
exports.multiplyVec2 = multiplyVec2;
/**
 * 矩阵的逆
 * @param {number[]} a 矩阵
 */
function invert(a) {
    var out = [];
    var a00 = a[0];
    var a01 = a[1];
    var a02 = a[2];
    var a10 = a[3];
    var a11 = a[4];
    var a12 = a[5];
    var a20 = a[6];
    var a21 = a[7];
    var a22 = a[8];
    var b01 = a22 * a11 - a12 * a21;
    var b11 = -a22 * a10 + a12 * a20;
    var b21 = a21 * a10 - a11 * a20;
    // Calculate the determinant
    var det = a00 * b01 + a01 * b11 + a02 * b21;
    if (!det) {
        return null;
    }
    det = 1.0 / det;
    out[0] = b01 * det;
    out[1] = (-a22 * a01 + a02 * a21) * det;
    out[2] = (a12 * a01 - a02 * a11) * det;
    out[3] = b11 * det;
    out[4] = (a22 * a00 - a02 * a20) * det;
    out[5] = (-a12 * a00 + a02 * a10) * det;
    out[6] = b21 * det;
    out[7] = (-a21 * a00 + a01 * a20) * det;
    out[8] = (a11 * a00 - a01 * a10) * det;
    return out;
}
exports.invert = invert;

},{}],120:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 全局设置一个唯一离屏的 ctx，用于计算 isPointInPath
var offScreenCtx = null;
function getOffScreenContext() {
    if (!offScreenCtx) {
        var canvas = document.createElement('canvas');
        canvas.width = 1;
        canvas.height = 1;
        offScreenCtx = canvas.getContext('2d');
    }
    return offScreenCtx;
}
exports.getOffScreenContext = getOffScreenContext;

},{}],121:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var SPACES = '\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029';
var PATH_COMMAND = new RegExp("([a-z])[" + SPACES + ",]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[" + SPACES + "]*,?[" + SPACES + "]*)+)", 'ig');
var PATH_VALUES = new RegExp("(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[" + SPACES + "]*,?[" + SPACES + "]*", 'ig');
// Parse given path string into an array of arrays of path segments
var parsePathString = function (pathString) {
    if (!pathString) {
        return null;
    }
    if (util_1.isArray(pathString)) {
        return pathString;
    }
    var paramCounts = {
        a: 7,
        c: 6,
        o: 2,
        h: 1,
        l: 2,
        m: 2,
        r: 4,
        q: 4,
        s: 4,
        t: 2,
        v: 1,
        u: 3,
        z: 0,
    };
    var data = [];
    String(pathString).replace(PATH_COMMAND, function (a, b, c) {
        var params = [];
        var name = b.toLowerCase();
        c.replace(PATH_VALUES, function (a, b) {
            b && params.push(+b);
        });
        if (name === 'm' && params.length > 2) {
            data.push([b].concat(params.splice(0, 2)));
            name = 'l';
            b = b === 'm' ? 'l' : 'L';
        }
        if (name === 'o' && params.length === 1) {
            data.push([b, params[0]]);
        }
        if (name === 'r') {
            data.push([b].concat(params));
        }
        else {
            while (params.length >= paramCounts[name]) {
                data.push([b].concat(params.splice(0, paramCounts[name])));
                if (!paramCounts[name]) {
                    break;
                }
            }
        }
        return pathString;
    });
    return data;
};
exports.parsePathString = parsePathString;
// http://schepers.cc/getting-to-the-point
var catmullRomToBezier = function (crp, z) {
    var d = [];
    // @ts-ignore
    for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
        var p = [
            {
                x: +crp[i - 2],
                y: +crp[i - 1],
            },
            {
                x: +crp[i],
                y: +crp[i + 1],
            },
            {
                x: +crp[i + 2],
                y: +crp[i + 3],
            },
            {
                x: +crp[i + 4],
                y: +crp[i + 5],
            },
        ];
        if (z) {
            if (!i) {
                p[0] = {
                    x: +crp[iLen - 2],
                    y: +crp[iLen - 1],
                };
            }
            else if (iLen - 4 === i) {
                p[3] = {
                    x: +crp[0],
                    y: +crp[1],
                };
            }
            else if (iLen - 2 === i) {
                p[2] = {
                    x: +crp[0],
                    y: +crp[1],
                };
                p[3] = {
                    x: +crp[2],
                    y: +crp[3],
                };
            }
        }
        else {
            if (iLen - 4 === i) {
                p[3] = p[2];
            }
            else if (!i) {
                p[0] = {
                    x: +crp[i],
                    y: +crp[i + 1],
                };
            }
        }
        d.push([
            'C',
            (-p[0].x + 6 * p[1].x + p[2].x) / 6,
            (-p[0].y + 6 * p[1].y + p[2].y) / 6,
            (p[1].x + 6 * p[2].x - p[3].x) / 6,
            (p[1].y + 6 * p[2].y - p[3].y) / 6,
            p[2].x,
            p[2].y,
        ]);
    }
    return d;
};
exports.catmullRomToBezier = catmullRomToBezier;
var ellipsePath = function (x, y, rx, ry, a) {
    var res = [];
    if (a === null && ry === null) {
        ry = rx;
    }
    x = +x;
    y = +y;
    rx = +rx;
    ry = +ry;
    if (a !== null) {
        var rad = Math.PI / 180;
        var x1 = x + rx * Math.cos(-ry * rad);
        var x2 = x + rx * Math.cos(-a * rad);
        var y1 = y + rx * Math.sin(-ry * rad);
        var y2 = y + rx * Math.sin(-a * rad);
        res = [
            ['M', x1, y1],
            ['A', rx, rx, 0, +(a - ry > 180), 0, x2, y2],
        ];
    }
    else {
        res = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']];
    }
    return res;
};
var pathToAbsolute = function (pathArray) {
    pathArray = parsePathString(pathArray);
    if (!pathArray || !pathArray.length) {
        return [['M', 0, 0]];
    }
    var res = [];
    var x = 0;
    var y = 0;
    var mx = 0;
    var my = 0;
    var start = 0;
    var pa0;
    var dots;
    if (pathArray[0][0] === 'M') {
        x = +pathArray[0][1];
        y = +pathArray[0][2];
        mx = x;
        my = y;
        start++;
        res[0] = ['M', x, y];
    }
    var crz = pathArray.length === 3 &&
        pathArray[0][0] === 'M' &&
        pathArray[1][0].toUpperCase() === 'R' &&
        pathArray[2][0].toUpperCase() === 'Z';
    for (var r = void 0, pa = void 0, i = start, ii = pathArray.length; i < ii; i++) {
        res.push((r = []));
        pa = pathArray[i];
        pa0 = pa[0];
        if (pa0 !== pa0.toUpperCase()) {
            r[0] = pa0.toUpperCase();
            switch (r[0]) {
                case 'A':
                    r[1] = pa[1];
                    r[2] = pa[2];
                    r[3] = pa[3];
                    r[4] = pa[4];
                    r[5] = pa[5];
                    r[6] = +pa[6] + x;
                    r[7] = +pa[7] + y;
                    break;
                case 'V':
                    r[1] = +pa[1] + y;
                    break;
                case 'H':
                    r[1] = +pa[1] + x;
                    break;
                case 'R':
                    dots = [x, y].concat(pa.slice(1));
                    for (var j = 2, jj = dots.length; j < jj; j++) {
                        dots[j] = +dots[j] + x;
                        dots[++j] = +dots[j] + y;
                    }
                    res.pop();
                    res = res.concat(catmullRomToBezier(dots, crz));
                    break;
                case 'O':
                    res.pop();
                    dots = ellipsePath(x, y, pa[1], pa[2]);
                    dots.push(dots[0]);
                    res = res.concat(dots);
                    break;
                case 'U':
                    res.pop();
                    res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
                    r = ['U'].concat(res[res.length - 1].slice(-2));
                    break;
                case 'M':
                    mx = +pa[1] + x;
                    my = +pa[2] + y;
                    break; // for lint
                default:
                    for (var j = 1, jj = pa.length; j < jj; j++) {
                        r[j] = +pa[j] + (j % 2 ? x : y);
                    }
            }
        }
        else if (pa0 === 'R') {
            dots = [x, y].concat(pa.slice(1));
            res.pop();
            res = res.concat(catmullRomToBezier(dots, crz));
            r = ['R'].concat(pa.slice(-2));
        }
        else if (pa0 === 'O') {
            res.pop();
            dots = ellipsePath(x, y, pa[1], pa[2]);
            dots.push(dots[0]);
            res = res.concat(dots);
        }
        else if (pa0 === 'U') {
            res.pop();
            res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
            r = ['U'].concat(res[res.length - 1].slice(-2));
        }
        else {
            for (var k = 0, kk = pa.length; k < kk; k++) {
                r[k] = pa[k];
            }
        }
        pa0 = pa0.toUpperCase();
        if (pa0 !== 'O') {
            switch (r[0]) {
                case 'Z':
                    x = +mx;
                    y = +my;
                    break;
                case 'H':
                    x = r[1];
                    break;
                case 'V':
                    y = r[1];
                    break;
                case 'M':
                    mx = r[r.length - 2];
                    my = r[r.length - 1];
                    break; // for lint
                default:
                    x = r[r.length - 2];
                    y = r[r.length - 1];
            }
        }
    }
    return res;
};
exports.pathToAbsolute = pathToAbsolute;
var l2c = function (x1, y1, x2, y2) {
    return [x1, y1, x2, y2, x2, y2];
};
var q2c = function (x1, y1, ax, ay, x2, y2) {
    var _13 = 1 / 3;
    var _23 = 2 / 3;
    return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2];
};
var a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
    // for more information of where this math came from visit:
    // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
    if (rx === ry) {
        rx += 1;
    }
    var _120 = (Math.PI * 120) / 180;
    var rad = (Math.PI / 180) * (+angle || 0);
    var res = [];
    var xy;
    var f1;
    var f2;
    var cx;
    var cy;
    var rotate = function (x, y, rad) {
        var X = x * Math.cos(rad) - y * Math.sin(rad);
        var Y = x * Math.sin(rad) + y * Math.cos(rad);
        return {
            x: X,
            y: Y,
        };
    };
    if (!recursive) {
        xy = rotate(x1, y1, -rad);
        x1 = xy.x;
        y1 = xy.y;
        xy = rotate(x2, y2, -rad);
        x2 = xy.x;
        y2 = xy.y;
        if (x1 === x2 && y1 === y2) {
            // 若弧的起始点和终点重叠则错开一点
            x2 += 1;
            y2 += 1;
        }
        // const cos = Math.cos(Math.PI / 180 * angle);
        // const sin = Math.sin(Math.PI / 180 * angle);
        var x = (x1 - x2) / 2;
        var y = (y1 - y2) / 2;
        var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
        if (h > 1) {
            h = Math.sqrt(h);
            rx = h * rx;
            ry = h * ry;
        }
        var rx2 = rx * rx;
        var ry2 = ry * ry;
        var k = (large_arc_flag === sweep_flag ? -1 : 1) *
            Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
        cx = (k * rx * y) / ry + (x1 + x2) / 2;
        cy = (k * -ry * x) / rx + (y1 + y2) / 2;
        // @ts-ignore
        f1 = Math.asin(((y1 - cy) / ry).toFixed(9));
        // @ts-ignore
        f2 = Math.asin(((y2 - cy) / ry).toFixed(9));
        f1 = x1 < cx ? Math.PI - f1 : f1;
        f2 = x2 < cx ? Math.PI - f2 : f2;
        f1 < 0 && (f1 = Math.PI * 2 + f1);
        f2 < 0 && (f2 = Math.PI * 2 + f2);
        if (sweep_flag && f1 > f2) {
            f1 = f1 - Math.PI * 2;
        }
        if (!sweep_flag && f2 > f1) {
            f2 = f2 - Math.PI * 2;
        }
    }
    else {
        f1 = recursive[0];
        f2 = recursive[1];
        cx = recursive[2];
        cy = recursive[3];
    }
    var df = f2 - f1;
    if (Math.abs(df) > _120) {
        var f2old = f2;
        var x2old = x2;
        var y2old = y2;
        f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
        x2 = cx + rx * Math.cos(f2);
        y2 = cy + ry * Math.sin(f2);
        res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
    }
    df = f2 - f1;
    var c1 = Math.cos(f1);
    var s1 = Math.sin(f1);
    var c2 = Math.cos(f2);
    var s2 = Math.sin(f2);
    var t = Math.tan(df / 4);
    var hx = (4 / 3) * rx * t;
    var hy = (4 / 3) * ry * t;
    var m1 = [x1, y1];
    var m2 = [x1 + hx * s1, y1 - hy * c1];
    var m3 = [x2 + hx * s2, y2 - hy * c2];
    var m4 = [x2, y2];
    m2[0] = 2 * m1[0] - m2[0];
    m2[1] = 2 * m1[1] - m2[1];
    if (recursive) {
        return [m2, m3, m4].concat(res);
    }
    res = [m2, m3, m4]
        .concat(res)
        .join()
        .split(',');
    var newres = [];
    for (var i = 0, ii = res.length; i < ii; i++) {
        newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
    }
    return newres;
};
var pathToCurve = function (path, path2) {
    var p = pathToAbsolute(path);
    var p2 = path2 && pathToAbsolute(path2);
    var attrs = {
        x: 0,
        y: 0,
        bx: 0,
        by: 0,
        X: 0,
        Y: 0,
        qx: null,
        qy: null,
    };
    var attrs2 = {
        x: 0,
        y: 0,
        bx: 0,
        by: 0,
        X: 0,
        Y: 0,
        qx: null,
        qy: null,
    };
    var pcoms1 = []; // path commands of original path p
    var pcoms2 = []; // path commands of original path p2
    var pfirst = ''; // temporary holder for original path command
    var pcom = ''; // holder for previous path command of original path
    var ii;
    var processPath = function (path, d, pcom) {
        var nx;
        var ny;
        if (!path) {
            return ['C', d.x, d.y, d.x, d.y, d.x, d.y];
        }
        !(path[0] in
            {
                T: 1,
                Q: 1,
            }) && (d.qx = d.qy = null);
        switch (path[0]) {
            case 'M':
                d.X = path[1];
                d.Y = path[2];
                break;
            case 'A':
                path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
                break;
            case 'S':
                if (pcom === 'C' || pcom === 'S') {
                    // In "S" case we have to take into account, if the previous command is C/S.
                    nx = d.x * 2 - d.bx; // And reflect the previous
                    ny = d.y * 2 - d.by; // command's control point relative to the current point.
                }
                else {
                    // or some else or nothing
                    nx = d.x;
                    ny = d.y;
                }
                path = ['C', nx, ny].concat(path.slice(1));
                break;
            case 'T':
                if (pcom === 'Q' || pcom === 'T') {
                    // In "T" case we have to take into account, if the previous command is Q/T.
                    d.qx = d.x * 2 - d.qx; // And make a reflection similar
                    d.qy = d.y * 2 - d.qy; // to case "S".
                }
                else {
                    // or something else or nothing
                    d.qx = d.x;
                    d.qy = d.y;
                }
                path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
                break;
            case 'Q':
                d.qx = path[1];
                d.qy = path[2];
                path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
                break;
            case 'L':
                path = ['C'].concat(l2c(d.x, d.y, path[1], path[2]));
                break;
            case 'H':
                path = ['C'].concat(l2c(d.x, d.y, path[1], d.y));
                break;
            case 'V':
                path = ['C'].concat(l2c(d.x, d.y, d.x, path[1]));
                break;
            case 'Z':
                path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y));
                break;
            default:
                break;
        }
        return path;
    };
    var fixArc = function (pp, i) {
        if (pp[i].length > 7) {
            pp[i].shift();
            var pi = pp[i];
            while (pi.length) {
                pcoms1[i] = 'A'; // if created multiple C:s, their original seg is saved
                p2 && (pcoms2[i] = 'A'); // the same as above
                pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6)));
            }
            pp.splice(i, 1);
            ii = Math.max(p.length, (p2 && p2.length) || 0);
        }
    };
    var fixM = function (path1, path2, a1, a2, i) {
        if (path1 && path2 && path1[i][0] === 'M' && path2[i][0] !== 'M') {
            path2.splice(i, 0, ['M', a2.x, a2.y]);
            a1.bx = 0;
            a1.by = 0;
            a1.x = path1[i][1];
            a1.y = path1[i][2];
            ii = Math.max(p.length, (p2 && p2.length) || 0);
        }
    };
    ii = Math.max(p.length, (p2 && p2.length) || 0);
    for (var i = 0; i < ii; i++) {
        p[i] && (pfirst = p[i][0]); // save current path command
        if (pfirst !== 'C') {
            // C is not saved yet, because it may be result of conversion
            pcoms1[i] = pfirst; // Save current path command
            i && (pcom = pcoms1[i - 1]); // Get previous path command pcom
        }
        p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath
        if (pcoms1[i] !== 'A' && pfirst === 'C')
            pcoms1[i] = 'C'; // A is the only command
        // which may produce multiple C:s
        // so we have to make sure that C is also C in original path
        fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1
        if (p2) {
            // the same procedures is done to p2
            p2[i] && (pfirst = p2[i][0]);
            if (pfirst !== 'C') {
                pcoms2[i] = pfirst;
                i && (pcom = pcoms2[i - 1]);
            }
            p2[i] = processPath(p2[i], attrs2, pcom);
            if (pcoms2[i] !== 'A' && pfirst === 'C') {
                pcoms2[i] = 'C';
            }
            fixArc(p2, i);
        }
        fixM(p, p2, attrs, attrs2, i);
        fixM(p2, p, attrs2, attrs, i);
        var seg = p[i];
        var seg2 = p2 && p2[i];
        var seglen = seg.length;
        var seg2len = p2 && seg2.length;
        attrs.x = seg[seglen - 2];
        attrs.y = seg[seglen - 1];
        attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
        attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
        attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x);
        attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y);
        attrs2.x = p2 && seg2[seg2len - 2];
        attrs2.y = p2 && seg2[seg2len - 1];
    }
    return p2 ? [p, p2] : p;
};
exports.pathToCurve = pathToCurve;
var p2s = /,?([a-z]),?/gi;
var parsePathArray = function (path) {
    return path.join(',').replace(p2s, '$1');
};
exports.parsePathArray = parsePathArray;
var base3 = function (t, p1, p2, p3, p4) {
    var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
    var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
    return t * t2 - 3 * p1 + 3 * p2;
};
var bezlen = function (x1, y1, x2, y2, x3, y3, x4, y4, z) {
    if (z === null) {
        z = 1;
    }
    z = z > 1 ? 1 : z < 0 ? 0 : z;
    var z2 = z / 2;
    var n = 12;
    var Tvalues = [
        -0.1252,
        0.1252,
        -0.3678,
        0.3678,
        -0.5873,
        0.5873,
        -0.7699,
        0.7699,
        -0.9041,
        0.9041,
        -0.9816,
        0.9816,
    ];
    var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
    var sum = 0;
    for (var i = 0; i < n; i++) {
        var ct = z2 * Tvalues[i] + z2;
        var xbase = base3(ct, x1, x2, x3, x4);
        var ybase = base3(ct, y1, y2, y3, y4);
        var comb = xbase * xbase + ybase * ybase;
        sum += Cvalues[i] * Math.sqrt(comb);
    }
    return z2 * sum;
};
var curveDim = function (x0, y0, x1, y1, x2, y2, x3, y3) {
    var tvalues = [];
    var bounds = [[], []];
    var a;
    var b;
    var c;
    var t;
    for (var i = 0; i < 2; ++i) {
        if (i === 0) {
            b = 6 * x0 - 12 * x1 + 6 * x2;
            a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
            c = 3 * x1 - 3 * x0;
        }
        else {
            b = 6 * y0 - 12 * y1 + 6 * y2;
            a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
            c = 3 * y1 - 3 * y0;
        }
        if (Math.abs(a) < 1e-12) {
            if (Math.abs(b) < 1e-12) {
                continue;
            }
            t = -c / b;
            if (t > 0 && t < 1) {
                tvalues.push(t);
            }
            continue;
        }
        var b2ac = b * b - 4 * c * a;
        var sqrtb2ac = Math.sqrt(b2ac);
        if (b2ac < 0) {
            continue;
        }
        var t1 = (-b + sqrtb2ac) / (2 * a);
        if (t1 > 0 && t1 < 1) {
            tvalues.push(t1);
        }
        var t2 = (-b - sqrtb2ac) / (2 * a);
        if (t2 > 0 && t2 < 1) {
            tvalues.push(t2);
        }
    }
    var j = tvalues.length;
    var jlen = j;
    var mt;
    while (j--) {
        t = tvalues[j];
        mt = 1 - t;
        bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
        bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
    }
    bounds[0][jlen] = x0;
    bounds[1][jlen] = y0;
    bounds[0][jlen + 1] = x3;
    bounds[1][jlen + 1] = y3;
    bounds[0].length = bounds[1].length = jlen + 2;
    return {
        min: {
            x: Math.min.apply(0, bounds[0]),
            y: Math.min.apply(0, bounds[1]),
        },
        max: {
            x: Math.max.apply(0, bounds[0]),
            y: Math.max.apply(0, bounds[1]),
        },
    };
};
var intersect = function (x1, y1, x2, y2, x3, y3, x4, y4) {
    if (Math.max(x1, x2) < Math.min(x3, x4) ||
        Math.min(x1, x2) > Math.max(x3, x4) ||
        Math.max(y1, y2) < Math.min(y3, y4) ||
        Math.min(y1, y2) > Math.max(y3, y4)) {
        return;
    }
    var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4);
    var ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4);
    var denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
    if (!denominator) {
        return;
    }
    var px = nx / denominator;
    var py = ny / denominator;
    var px2 = +px.toFixed(2);
    var py2 = +py.toFixed(2);
    if (px2 < +Math.min(x1, x2).toFixed(2) ||
        px2 > +Math.max(x1, x2).toFixed(2) ||
        px2 < +Math.min(x3, x4).toFixed(2) ||
        px2 > +Math.max(x3, x4).toFixed(2) ||
        py2 < +Math.min(y1, y2).toFixed(2) ||
        py2 > +Math.max(y1, y2).toFixed(2) ||
        py2 < +Math.min(y3, y4).toFixed(2) ||
        py2 > +Math.max(y3, y4).toFixed(2)) {
        return;
    }
    return {
        x: px,
        y: py,
    };
};
var isPointInsideBBox = function (bbox, x, y) {
    return x >= bbox.x && x <= bbox.x + bbox.width && y >= bbox.y && y <= bbox.y + bbox.height;
};
var rectPath = function (x, y, w, h, r) {
    if (r) {
        return [
            ['M', +x + +r, y],
            ['l', w - r * 2, 0],
            ['a', r, r, 0, 0, 1, r, r],
            ['l', 0, h - r * 2],
            ['a', r, r, 0, 0, 1, -r, r],
            ['l', r * 2 - w, 0],
            ['a', r, r, 0, 0, 1, -r, -r],
            ['l', 0, r * 2 - h],
            ['a', r, r, 0, 0, 1, r, -r],
            ['z'],
        ];
    }
    var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']];
    // @ts-ignore
    res.parsePathArray = parsePathArray;
    return res;
};
exports.rectPath = rectPath;
var box = function (x, y, width, height) {
    if (x === null) {
        x = y = width = height = 0;
    }
    if (y === null) {
        y = x.y;
        width = x.width;
        height = x.height;
        x = x.x;
    }
    return {
        x: x,
        y: y,
        width: width,
        w: width,
        height: height,
        h: height,
        x2: x + width,
        y2: y + height,
        cx: x + width / 2,
        cy: y + height / 2,
        r1: Math.min(width, height) / 2,
        r2: Math.max(width, height) / 2,
        r0: Math.sqrt(width * width + height * height) / 2,
        path: rectPath(x, y, width, height),
        vb: [x, y, width, height].join(' '),
    };
};
var isBBoxIntersect = function (bbox1, bbox2) {
    bbox1 = box(bbox1);
    bbox2 = box(bbox2);
    return (isPointInsideBBox(bbox2, bbox1.x, bbox1.y) ||
        isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) ||
        isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) ||
        isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) ||
        isPointInsideBBox(bbox1, bbox2.x, bbox2.y) ||
        isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) ||
        isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) ||
        isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) ||
        (((bbox1.x < bbox2.x2 && bbox1.x > bbox2.x) || (bbox2.x < bbox1.x2 && bbox2.x > bbox1.x)) &&
            ((bbox1.y < bbox2.y2 && bbox1.y > bbox2.y) || (bbox2.y < bbox1.y2 && bbox2.y > bbox1.y))));
};
var bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
    if (!util_1.isArray(p1x)) {
        p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
    }
    var bbox = curveDim.apply(null, p1x);
    return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y);
};
var findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
    var t1 = 1 - t;
    var t13 = Math.pow(t1, 3);
    var t12 = Math.pow(t1, 2);
    var t2 = t * t;
    var t3 = t2 * t;
    var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;
    var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;
    var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);
    var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);
    var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);
    var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);
    var ax = t1 * p1x + t * c1x;
    var ay = t1 * p1y + t * c1y;
    var cx = t1 * c2x + t * p2x;
    var cy = t1 * c2y + t * p2y;
    var alpha = 90 - (Math.atan2(mx - nx, my - ny) * 180) / Math.PI;
    // (mx > nx || my < ny) && (alpha += 180);
    return {
        x: x,
        y: y,
        m: {
            x: mx,
            y: my,
        },
        n: {
            x: nx,
            y: ny,
        },
        start: {
            x: ax,
            y: ay,
        },
        end: {
            x: cx,
            y: cy,
        },
        alpha: alpha,
    };
};
var interHelper = function (bez1, bez2, justCount) {
    var bbox1 = bezierBBox(bez1);
    var bbox2 = bezierBBox(bez2);
    if (!isBBoxIntersect(bbox1, bbox2)) {
        return justCount ? 0 : [];
    }
    var l1 = bezlen.apply(0, bez1);
    var l2 = bezlen.apply(0, bez2);
    var n1 = ~~(l1 / 8);
    var n2 = ~~(l2 / 8);
    var dots1 = [];
    var dots2 = [];
    var xy = {};
    var res = justCount ? 0 : [];
    for (var i = 0; i < n1 + 1; i++) {
        var d = findDotsAtSegment.apply(0, bez1.concat(i / n1));
        dots1.push({
            x: d.x,
            y: d.y,
            t: i / n1,
        });
    }
    for (var i = 0; i < n2 + 1; i++) {
        var d = findDotsAtSegment.apply(0, bez2.concat(i / n2));
        dots2.push({
            x: d.x,
            y: d.y,
            t: i / n2,
        });
    }
    for (var i = 0; i < n1; i++) {
        for (var j = 0; j < n2; j++) {
            var di = dots1[i];
            var di1 = dots1[i + 1];
            var dj = dots2[j];
            var dj1 = dots2[j + 1];
            var ci = Math.abs(di1.x - di.x) < 0.001 ? 'y' : 'x';
            var cj = Math.abs(dj1.x - dj.x) < 0.001 ? 'y' : 'x';
            var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
            if (is) {
                if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) {
                    continue;
                }
                xy[is.x.toFixed(4)] = is.y.toFixed(4);
                var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t);
                var t2 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
                if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
                    if (justCount) {
                        // @ts-ignore
                        res += 1;
                    }
                    else {
                        // @ts-ignore
                        res.push({
                            x: is.x,
                            y: is.y,
                            t1: t1,
                            t2: t2,
                        });
                    }
                }
            }
        }
    }
    return res;
};
var interPathHelper = function (path1, path2, justCount) {
    path1 = pathToCurve(path1);
    path2 = pathToCurve(path2);
    var x1;
    var y1;
    var x2;
    var y2;
    var x1m;
    var y1m;
    var x2m;
    var y2m;
    var bez1;
    var bez2;
    var res = justCount ? 0 : [];
    for (var i = 0, ii = path1.length; i < ii; i++) {
        var pi = path1[i];
        if (pi[0] === 'M') {
            x1 = x1m = pi[1];
            y1 = y1m = pi[2];
        }
        else {
            if (pi[0] === 'C') {
                bez1 = [x1, y1].concat(pi.slice(1));
                x1 = bez1[6];
                y1 = bez1[7];
            }
            else {
                bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
                x1 = x1m;
                y1 = y1m;
            }
            for (var j = 0, jj = path2.length; j < jj; j++) {
                var pj = path2[j];
                if (pj[0] === 'M') {
                    x2 = x2m = pj[1];
                    y2 = y2m = pj[2];
                }
                else {
                    if (pj[0] === 'C') {
                        bez2 = [x2, y2].concat(pj.slice(1));
                        x2 = bez2[6];
                        y2 = bez2[7];
                    }
                    else {
                        bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
                        x2 = x2m;
                        y2 = y2m;
                    }
                    var intr = interHelper(bez1, bez2, justCount);
                    if (justCount) {
                        // @ts-ignore
                        res += intr;
                    }
                    else {
                        // @ts-ignore
                        for (var k = 0, kk = intr.length; k < kk; k++) {
                            intr[k].segment1 = i;
                            intr[k].segment2 = j;
                            intr[k].bez1 = bez1;
                            intr[k].bez2 = bez2;
                        }
                        // @ts-ignore
                        res = res.concat(intr);
                    }
                }
            }
        }
    }
    return res;
};
var intersection = function (path1, path2) {
    return interPathHelper(path1, path2);
};
exports.intersection = intersection;
function decasteljau(points, t) {
    var left = [];
    var right = [];
    function recurse(points, t) {
        if (points.length === 1) {
            left.push(points[0]);
            right.push(points[0]);
        }
        else {
            var middlePoints = [];
            for (var i = 0; i < points.length - 1; i++) {
                if (i === 0) {
                    left.push(points[0]);
                }
                if (i === points.length - 2) {
                    right.push(points[i + 1]);
                }
                middlePoints[i] = [
                    (1 - t) * points[i][0] + t * points[i + 1][0],
                    (1 - t) * points[i][1] + t * points[i + 1][1],
                ];
            }
            recurse(middlePoints, t);
        }
    }
    if (points.length) {
        recurse(points, t);
    }
    return { left: left, right: right.reverse() };
}
function splitCurve(start, end, count) {
    var points = [[start[1], start[2]]];
    count = count || 2;
    var segments = [];
    if (end[0] === 'A') {
        points.push(end[6]);
        points.push(end[7]);
    }
    else if (end[0] === 'C') {
        points.push([end[1], end[2]]);
        points.push([end[3], end[4]]);
        points.push([end[5], end[6]]);
    }
    else if (end[0] === 'S' || end[0] === 'Q') {
        points.push([end[1], end[2]]);
        points.push([end[3], end[4]]);
    }
    else {
        points.push([end[1], end[2]]);
    }
    var leftSegments = points;
    var t = 1 / count;
    for (var i = 0; i < count - 1; i++) {
        var rt = t / (1 - t * i);
        var split = decasteljau(leftSegments, rt);
        segments.push(split.left);
        leftSegments = split.right;
    }
    segments.push(leftSegments);
    var result = segments.map(function (segment) {
        var cmd = [];
        if (segment.length === 4) {
            cmd.push('C');
            cmd = cmd.concat(segment[2]);
        }
        if (segment.length >= 3) {
            if (segment.length === 3) {
                cmd.push('Q');
            }
            cmd = cmd.concat(segment[1]);
        }
        if (segment.length === 2) {
            cmd.push('L');
        }
        cmd = cmd.concat(segment[segment.length - 1]);
        return cmd;
    });
    return result;
}
var splitSegment = function (start, end, count) {
    if (count === 1) {
        return [[].concat(start)];
    }
    var segments = [];
    if (end[0] === 'L' || end[0] === 'C' || end[0] === 'Q') {
        segments = segments.concat(splitCurve(start, end, count));
    }
    else {
        var temp = [].concat(start);
        if (temp[0] === 'M') {
            temp[0] = 'L';
        }
        for (var i = 0; i <= count - 1; i++) {
            segments.push(temp);
        }
    }
    return segments;
};
var fillPath = function (source, target) {
    if (source.length === 1) {
        return source;
    }
    var sourceLen = source.length - 1;
    var targetLen = target.length - 1;
    var ratio = sourceLen / targetLen;
    var segmentsToFill = [];
    if (source.length === 1 && source[0][0] === 'M') {
        for (var i = 0; i < targetLen - sourceLen; i++) {
            source.push(source[0]);
        }
        return source;
    }
    for (var i = 0; i < targetLen; i++) {
        var index = Math.floor(ratio * i);
        segmentsToFill[index] = (segmentsToFill[index] || 0) + 1;
    }
    var filled = segmentsToFill.reduce(function (filled, count, i) {
        if (i === sourceLen) {
            return filled.concat(source[sourceLen]);
        }
        return filled.concat(splitSegment(source[i], source[i + 1], count));
    }, []);
    filled.unshift(source[0]);
    if (target[targetLen] === 'Z' || target[targetLen] === 'z') {
        filled.push('Z');
    }
    return filled;
};
exports.fillPath = fillPath;
var isEqual = function (obj1, obj2) {
    if (obj1.length !== obj2.length) {
        return false;
    }
    var result = true;
    util_1.each(obj1, function (item, i) {
        if (item !== obj2[i]) {
            result = false;
            return false;
        }
    });
    return result;
};
function getMinDiff(del, add, modify) {
    var type = null;
    var min = modify;
    if (add < min) {
        min = add;
        type = 'add';
    }
    if (del < min) {
        min = del;
        type = 'del';
    }
    return {
        type: type,
        min: min,
    };
}
/*
 * https://en.wikipedia.org/wiki/Levenshtein_distance
 * 计算两条path的编辑距离
 */
var levenshteinDistance = function (source, target) {
    var sourceLen = source.length;
    var targetLen = target.length;
    var sourceSegment;
    var targetSegment;
    var temp = 0;
    if (sourceLen === 0 || targetLen === 0) {
        return null;
    }
    var dist = [];
    for (var i = 0; i <= sourceLen; i++) {
        dist[i] = [];
        dist[i][0] = { min: i };
    }
    for (var j = 0; j <= targetLen; j++) {
        dist[0][j] = { min: j };
    }
    for (var i = 1; i <= sourceLen; i++) {
        sourceSegment = source[i - 1];
        for (var j = 1; j <= targetLen; j++) {
            targetSegment = target[j - 1];
            if (isEqual(sourceSegment, targetSegment)) {
                temp = 0;
            }
            else {
                temp = 1;
            }
            var del = dist[i - 1][j].min + 1;
            var add = dist[i][j - 1].min + 1;
            var modify = dist[i - 1][j - 1].min + temp;
            dist[i][j] = getMinDiff(del, add, modify);
        }
    }
    return dist;
};
var fillPathByDiff = function (source, target) {
    var diffMatrix = levenshteinDistance(source, target);
    var sourceLen = source.length;
    var targetLen = target.length;
    var changes = [];
    var index = 1;
    var minPos = 1;
    // 如果source和target不是完全不相等
    if (diffMatrix[sourceLen][targetLen].min !== sourceLen) {
        // 获取从source到target所需改动
        for (var i = 1; i <= sourceLen; i++) {
            var min = diffMatrix[i][i].min;
            minPos = i;
            for (var j = index; j <= targetLen; j++) {
                if (diffMatrix[i][j].min < min) {
                    min = diffMatrix[i][j].min;
                    minPos = j;
                }
            }
            index = minPos;
            if (diffMatrix[i][index].type) {
                changes.push({ index: i - 1, type: diffMatrix[i][index].type });
            }
        }
        // 对source进行增删path
        for (var i = changes.length - 1; i >= 0; i--) {
            index = changes[i].index;
            if (changes[i].type === 'add') {
                source.splice(index, 0, [].concat(source[index]));
            }
            else {
                source.splice(index, 1);
            }
        }
    }
    // source尾部补齐
    sourceLen = source.length;
    var diff = targetLen - sourceLen;
    if (sourceLen < targetLen) {
        for (var i = 0; i < diff; i++) {
            if (source[sourceLen - 1][0] === 'z' || source[sourceLen - 1][0] === 'Z') {
                source.splice(sourceLen - 2, 0, source[sourceLen - 2]);
            }
            else {
                source.push(source[sourceLen - 1]);
            }
            sourceLen += 1;
        }
    }
    return source;
};
exports.fillPathByDiff = fillPathByDiff;
// 将两个点均分成count个点
function _splitPoints(points, former, count) {
    var result = [].concat(points);
    var index;
    var t = 1 / (count + 1);
    var formerEnd = _getSegmentPoints(former)[0];
    for (var i = 1; i <= count; i++) {
        t *= i;
        index = Math.floor(points.length * t);
        if (index === 0) {
            result.unshift([formerEnd[0] * t + points[index][0] * (1 - t), formerEnd[1] * t + points[index][1] * (1 - t)]);
        }
        else {
            result.splice(index, 0, [
                formerEnd[0] * t + points[index][0] * (1 - t),
                formerEnd[1] * t + points[index][1] * (1 - t),
            ]);
        }
    }
    return result;
}
/*
 * 抽取pathSegment中的关键点
 * M,L,A,Q,H,V一个端点
 * Q, S抽取一个端点，一个控制点
 * C抽取一个端点，两个控制点
 */
function _getSegmentPoints(segment) {
    var points = [];
    switch (segment[0]) {
        case 'M':
            points.push([segment[1], segment[2]]);
            break;
        case 'L':
            points.push([segment[1], segment[2]]);
            break;
        case 'A':
            points.push([segment[6], segment[7]]);
            break;
        case 'Q':
            points.push([segment[3], segment[4]]);
            points.push([segment[1], segment[2]]);
            break;
        case 'T':
            points.push([segment[1], segment[2]]);
            break;
        case 'C':
            points.push([segment[5], segment[6]]);
            points.push([segment[1], segment[2]]);
            points.push([segment[3], segment[4]]);
            break;
        case 'S':
            points.push([segment[3], segment[4]]);
            points.push([segment[1], segment[2]]);
            break;
        case 'H':
            points.push([segment[1], segment[1]]);
            break;
        case 'V':
            points.push([segment[1], segment[1]]);
            break;
        default:
    }
    return points;
}
var formatPath = function (fromPath, toPath) {
    if (fromPath.length <= 1) {
        return fromPath;
    }
    var points;
    for (var i = 0; i < toPath.length; i++) {
        if (fromPath[i][0] !== toPath[i][0]) {
            // 获取fromPath的pathSegment的端点，根据toPath的指令对其改造
            points = _getSegmentPoints(fromPath[i]);
            switch (toPath[i][0]) {
                case 'M':
                    fromPath[i] = ['M'].concat(points[0]);
                    break;
                case 'L':
                    fromPath[i] = ['L'].concat(points[0]);
                    break;
                case 'A':
                    fromPath[i] = [].concat(toPath[i]);
                    fromPath[i][6] = points[0][0];
                    fromPath[i][7] = points[0][1];
                    break;
                case 'Q':
                    if (points.length < 2) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 1);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['Q'].concat(points.reduce(function (arr, i) {
                        return arr.concat(i);
                    }, []));
                    break;
                case 'T':
                    fromPath[i] = ['T'].concat(points[0]);
                    break;
                case 'C':
                    if (points.length < 3) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 2);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['C'].concat(points.reduce(function (arr, i) {
                        return arr.concat(i);
                    }, []));
                    break;
                case 'S':
                    if (points.length < 2) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 1);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['S'].concat(points.reduce(function (arr, i) {
                        return arr.concat(i);
                    }, []));
                    break;
                default:
                    fromPath[i] = toPath[i];
            }
        }
    }
    return fromPath;
};
exports.formatPath = formatPath;

},{"@antv/util":803}],122:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
var offscreen_1 = require("./offscreen");
/**
 * 获取文本的高度
 * @param text 文本
 * @param fontSize 字体大小
 * @param lineHeight 行高，可以为空
 */
function getTextHeight(text, fontSize, lineHeight) {
    var lineCount = 1;
    if (util_1.isString(text)) {
        lineCount = text.split('\n').length;
    }
    if (lineCount > 1) {
        var spaceingY = getLineSpaceing(fontSize, lineHeight);
        return fontSize * lineCount + spaceingY * (lineCount - 1);
    }
    return fontSize;
}
exports.getTextHeight = getTextHeight;
/**
 * 获取行间距如果文本多行，需要获取文本间距
 * @param fontSize 字体大小
 * @param lineHeight 行高
 */
function getLineSpaceing(fontSize, lineHeight) {
    return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
}
exports.getLineSpaceing = getLineSpaceing;
/**
 * 字体宽度
 * @param text 文本
 * @param font 字体
 */
function getTextWidth(text, font) {
    var context = offscreen_1.getOffScreenContext(); // 获取离屏的 ctx 进行计算
    var width = 0;
    // null 或者 undefined 时，宽度为 0
    if (util_1.isNil(text) || text === '') {
        return width;
    }
    context.save();
    context.font = font;
    if (util_1.isString(text) && text.includes('\n')) {
        var textArr = text.split('\n');
        util_1.each(textArr, function (subText) {
            var measureWidth = context.measureText(subText).width;
            if (width < measureWidth) {
                width = measureWidth;
            }
        });
    }
    else {
        width = context.measureText(text).width;
    }
    context.restore();
    return width;
}
exports.getTextWidth = getTextWidth;
function assembleFont(attrs) {
    var fontSize = attrs.fontSize, fontFamily = attrs.fontFamily, fontWeight = attrs.fontWeight, fontStyle = attrs.fontStyle, fontVariant = attrs.fontVariant;
    return [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ').trim();
}
exports.assembleFont = assembleFont;

},{"./offscreen":120,"./util":123}],123:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function removeFromArray(arr, obj) {
    var index = arr.indexOf(obj);
    if (index !== -1) {
        arr.splice(index, 1);
    }
}
exports.removeFromArray = removeFromArray;
exports.isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
var is_nil_1 = require("@antv/util/lib/is-nil");
exports.isNil = is_nil_1.default;
var is_function_1 = require("@antv/util/lib/is-function");
exports.isFunction = is_function_1.default;
var is_string_1 = require("@antv/util/lib/is-string");
exports.isString = is_string_1.default;
var is_object_1 = require("@antv/util/lib/is-object");
exports.isObject = is_object_1.default;
var is_array_1 = require("@antv/util/lib/is-array");
exports.isArray = is_array_1.default;
var mix_1 = require("@antv/util/lib/mix");
exports.mix = mix_1.default;
var each_1 = require("@antv/util/lib/each");
exports.each = each_1.default;
var upper_first_1 = require("@antv/util/lib/upper-first");
exports.upperFirst = upper_first_1.default;
// 是否元素的父容器
function isParent(container, shape) {
    // 所有 shape 都是 canvas 的子元素
    if (container.isCanvas()) {
        return true;
    }
    var parent = shape.getParent();
    var isParent = false;
    while (parent) {
        if (parent === container) {
            isParent = true;
            break;
        }
        parent = parent.getParent();
    }
    return isParent;
}
exports.isParent = isParent;
function isAllowCapture(element) {
    // @ts-ignore
    return element.cfg.visible && element.cfg.capture;
}
exports.isAllowCapture = isAllowCapture;

},{"@antv/util/lib/each":778,"@antv/util/lib/is-array":806,"@antv/util/lib/is-function":817,"@antv/util/lib/is-nil":821,"@antv/util/lib/is-object":826,"@antv/util/lib/is-string":832,"@antv/util/lib/mix":844,"@antv/util/lib/upper-first":871}],124:[function(require,module,exports){
module.exports={
  "__npminstall_done": false,
  "_args": [
    [
      "@antv/g-base@0.4.7",
      "C:\\xampp\\htdocs\\icehrm\\web"
    ]
  ],
  "_from": "@antv/g-base@0.4.7",
  "_id": "@antv/g-base@0.4.7",
  "_inBundle": false,
  "_integrity": "sha512-wKSpS3/M1slU92iOgi2QV4MCd82J1d2PyPcQArqSFRUZU0KnVMIl95v79dG0Be4YvFaZ3bVrT6Ns1Czr8oplhA==",
  "_location": "/@antv/g-base",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "@antv/g-base@0.4.7",
    "name": "@antv/g-base",
    "escapedName": "@antv%2fg-base",
    "scope": "@antv",
    "rawSpec": "0.4.7",
    "saveSpec": null,
    "fetchSpec": "0.4.7"
  },
  "_requiredBy": [
    "/@antv/component",
    "/@antv/g-canvas",
    "/@antv/g-svg",
    "/@antv/g2",
    "/@antv/g2plot"
  ],
  "_resolved": "https://registry.npmjs.org/@antv/g-base/-/g-base-0.4.7.tgz",
  "_spec": "0.4.7",
  "_where": "C:\\xampp\\htdocs\\icehrm\\web",
  "author": {
    "name": "https://github.com/orgs/antvis/people"
  },
  "bugs": {
    "url": "https://github.com/antvis/util/issues"
  },
  "dependencies": {
    "@antv/event-emitter": "^0.1.1",
    "@antv/g-math": "^0.1.3",
    "@antv/matrix-util": "^3.1.0-beta.1",
    "@antv/path-util": "~2.0.5",
    "@antv/util": "~2.0.0",
    "@types/d3-timer": "^1.0.9",
    "d3-ease": "^1.0.5",
    "d3-interpolate": "^1.3.2",
    "d3-timer": "^1.0.9",
    "detect-browser": "^5.1.0"
  },
  "description": "A common util collection for antv projects",
  "devDependencies": {
    "@antv/torch": "^1.0.0",
    "gl-matrix": "^3.0.0",
    "less": "^3.9.0",
    "npm-run-all": "^4.1.5",
    "tsc-watch": "^4.0.0"
  },
  "files": [
    "package.json",
    "esm",
    "lib",
    "LICENSE",
    "README.md"
  ],
  "gitHead": "eb6a2503cb7bb8154697592b10680939d954a31a",
  "homepage": "https://github.com/antvis/util#readme",
  "keywords": [
    "util",
    "antv",
    "g"
  ],
  "license": "ISC",
  "main": "lib/index.js",
  "module": "esm/index.js",
  "name": "@antv/g-base",
  "publishConfig": {
    "access": "public"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/antvis/util.git"
  },
  "scripts": {
    "build": "npm run clean && run-p build:*",
    "build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib",
    "build:esm": "tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm",
    "clean": "rm -rf esm lib",
    "coverage": "npm run coverage-generator && npm run coverage-viewer",
    "coverage-generator": "torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts tests/mocha.opts",
    "coverage-viewer": "torch-coverage",
    "test": "torch --renderer --compile --opts tests/mocha.opts",
    "test-live": "torch --compile --interactive --opts tests/mocha.opts",
    "tsc": "tsc --noEmit",
    "typecheck": "tsc --noEmit",
    "watch:cjs": "tsc-watch -p tsconfig.json --target ES5 --module commonjs --outDir lib --compiler typescript/bin/tsc"
  },
  "types": "lib/index.d.ts",
  "version": "0.4.7"
}

},{}],125:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var hit_1 = require("./util/hit");
var Shape = require("./shape");
var group_1 = require("./group");
var draw_1 = require("./util/draw");
var util_1 = require("./util/util");
var Canvas = /** @class */ (function (_super) {
    tslib_1.__extends(Canvas, _super);
    function Canvas() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Canvas.prototype.getDefaultCfg = function () {
        var cfg = _super.prototype.getDefaultCfg.call(this);
        // 设置渲染引擎为 canvas，只读属性
        cfg['renderer'] = 'canvas';
        // 是否自动绘制，不需要用户调用 draw 方法
        cfg['autoDraw'] = true;
        // 是否允许局部刷新图表
        cfg['localRefresh'] = true;
        cfg['refreshElements'] = [];
        // 是否在视图内自动裁剪
        cfg['clipView'] = true;
        cfg['quickHit'] = false;
        return cfg;
    };
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    Canvas.prototype.onCanvasChange = function (changeType) {
        /**
         * 触发画布更新的三种 changeType
         * 1. attr: 修改画布的绘图属性
         * 2. sort: 画布排序，图形的层次会发生变化
         * 3. changeSize: 改变画布大小
         */
        if (changeType === 'attr' || changeType === 'sort' || changeType === 'changeSize') {
            this.set('refreshElements', [this]);
            this.draw();
        }
    };
    Canvas.prototype.getShapeBase = function () {
        return Shape;
    };
    Canvas.prototype.getGroupBase = function () {
        return group_1.default;
    };
    /**
     * 获取屏幕像素比
     */
    Canvas.prototype.getPixelRatio = function () {
        var pixelRatio = this.get('pixelRatio') || util_1.getPixelRatio();
        // 不足 1 的取 1，超出 1 的取整
        return pixelRatio >= 1 ? Math.ceil(pixelRatio) : 1;
    };
    Canvas.prototype.getViewRange = function () {
        return {
            minX: 0,
            minY: 0,
            maxX: this.get('width'),
            maxY: this.get('height'),
        };
    };
    // 复写基类的方法生成标签
    Canvas.prototype.createDom = function () {
        var element = document.createElement('canvas');
        var context = element.getContext('2d');
        // 缓存 context 对象
        this.set('context', context);
        return element;
    };
    Canvas.prototype.setDOMSize = function (width, height) {
        _super.prototype.setDOMSize.call(this, width, height);
        var context = this.get('context');
        var el = this.get('el');
        var pixelRatio = this.getPixelRatio();
        el.width = pixelRatio * width;
        el.height = pixelRatio * height;
        // 设置 canvas 元素的宽度和高度，会重置缩放，因此 context.scale 需要在每次设置宽、高后调用
        if (pixelRatio > 1) {
            context.scale(pixelRatio, pixelRatio);
        }
    };
    // 复写基类方法
    Canvas.prototype.clear = function () {
        _super.prototype.clear.call(this);
        this._clearFrame(); // 需要清理掉延迟绘制的帧
        var context = this.get('context');
        var element = this.get('el');
        context.clearRect(0, 0, element.width, element.height);
    };
    Canvas.prototype.getShape = function (x, y) {
        if (this.get('quickHit')) {
            return hit_1.getShape(this, x, y);
        }
        return _super.prototype.getShape.call(this, x, y, null);
    };
    // 对绘制区域边缘取整，避免浮点数问题
    Canvas.prototype._getRefreshRegion = function () {
        var elements = this.get('refreshElements');
        var viewRegion = this.getViewRange();
        var region;
        // 如果是当前画布整体发生了变化，则直接重绘整个画布
        if (elements.length && elements[0] === this) {
            region = viewRegion;
        }
        else {
            region = draw_1.getMergedRegion(elements);
            if (region) {
                region.minX = Math.floor(region.minX);
                region.minY = Math.floor(region.minY);
                region.maxX = Math.ceil(region.maxX);
                region.maxY = Math.ceil(region.maxY);
                var clipView = this.get('clipView');
                // 自动裁剪不在 view 内的区域
                if (clipView) {
                    region = draw_1.mergeView(region, viewRegion);
                }
            }
        }
        return region;
    };
    /**
     * 刷新图形元素，这里仅仅是放入队列，下次绘制时进行绘制
     * @param {IElement} element 图形元素
     */
    Canvas.prototype.refreshElement = function (element) {
        var refreshElements = this.get('refreshElements');
        refreshElements.push(element);
        // if (this.get('autoDraw')) {
        //   this._startDraw();
        // }
    };
    // 清理还在进行的绘制
    Canvas.prototype._clearFrame = function () {
        var drawFrame = this.get('drawFrame');
        if (drawFrame) {
            // 如果全部渲染时，存在局部渲染，则抛弃掉局部渲染
            util_1.clearAnimationFrame(drawFrame);
            this.set('drawFrame', null);
            this.set('refreshElements', []);
        }
    };
    // 手工调用绘制接口
    Canvas.prototype.draw = function () {
        var drawFrame = this.get('drawFrame');
        if (this.get('autoDraw') && drawFrame) {
            return;
        }
        this._startDraw();
    };
    // 绘制所有图形
    Canvas.prototype._drawAll = function () {
        var context = this.get('context');
        var element = this.get('el');
        var children = this.getChildren();
        context.clearRect(0, 0, element.width, element.height);
        draw_1.applyAttrsToContext(context, this);
        draw_1.drawChildren(context, children);
        // 对于 https://github.com/antvis/g/issues/422 的场景，全局渲染的模式下也会记录更新的元素队列，因此全局渲染完后也需要置空
        this.set('refreshElements', []);
    };
    // 绘制局部
    Canvas.prototype._drawRegion = function () {
        var context = this.get('context');
        var refreshElements = this.get('refreshElements');
        var children = this.getChildren();
        var region = this._getRefreshRegion();
        // 需要注意可能没有 region 的场景
        // 一般发生在设置了 localRefresh ,在没有图形发生变化的情况下，用户调用了 draw
        if (region) {
            // 清理指定区域
            context.clearRect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY);
            // 保存上下文，设置 clip
            context.save();
            context.beginPath();
            context.rect(region.minX, region.minY, region.maxX - region.minX, region.maxY - region.minY);
            context.clip();
            draw_1.applyAttrsToContext(context, this);
            // 绘制子元素
            draw_1.drawChildren(context, children, region);
            context.restore();
        }
        util_1.each(refreshElements, function (element) {
            if (element.get('hasChanged')) {
                // 在视窗外的 Group 元素会加入到更新队列里，但实际却没有执行 draw() 逻辑，也就没有清除 hasChanged 标记
                // 即已经重绘完、但 hasChanged 标记没有清除的元素，需要统一清除掉。主要是 Group 存在问题，具体原因待排查
                element.set('hasChanged', false);
            }
        });
        this.set('refreshElements', []);
    };
    // 触发绘制
    Canvas.prototype._startDraw = function () {
        var _this = this;
        var drawFrame = this.get('drawFrame');
        if (!drawFrame) {
            drawFrame = util_1.requestAnimationFrame(function () {
                if (_this.get('localRefresh')) {
                    _this._drawRegion();
                }
                else {
                    _this._drawAll();
                }
                _this.set('drawFrame', null);
            });
            this.set('drawFrame', drawFrame);
        }
    };
    Canvas.prototype.skipDraw = function () { };
    return Canvas;
}(g_base_1.AbstractCanvas));
exports.default = Canvas;

},{"./group":126,"./shape":133,"./util/draw":144,"./util/hit":145,"./util/util":155,"@antv/g-base":115,"tslib":894}],126:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var Shape = require("./shape");
var draw_1 = require("./util/draw");
var Group = /** @class */ (function (_super) {
    tslib_1.__extends(Group, _super);
    function Group() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    Group.prototype.onCanvasChange = function (changeType) {
        draw_1.refreshElement(this, changeType);
    };
    Group.prototype.getShapeBase = function () {
        return Shape;
    };
    Group.prototype.getGroupBase = function () {
        return Group;
    };
    // 同 shape 中的方法重复了
    Group.prototype._applyClip = function (context, clip) {
        if (clip) {
            context.save();
            // 将 clip 的属性挂载到 context 上
            draw_1.applyAttrsToContext(context, clip);
            // 绘制 clip 路径
            clip.createPath(context);
            context.restore();
            // 裁剪
            context.clip();
            clip._afterDraw();
        }
    };
    Group.prototype.draw = function (context, region) {
        var children = this.getChildren();
        if (children.length) {
            context.save();
            // group 上的矩阵和属性也会应用到上下文上
            // 先将 attrs 应用到上下文中，再设置 clip。因为 clip 应该被当前元素的 matrix 所影响
            draw_1.applyAttrsToContext(context, this);
            this._applyClip(context, this.getClip());
            draw_1.drawChildren(context, children, region);
            context.restore();
        }
        // 这里的成本比较大
        this.set('cacheCanvasBBox', this.getCanvasBBox());
        // 绘制后，消除更新标记
        this.set('hasChanged', false);
    };
    // 绘制时被跳过，一般发生在分组隐藏时
    Group.prototype.skipDraw = function () {
        this.set('cacheCanvasBBox', null);
        this.set('hasChanged', false);
    };
    return Group;
}(g_base_1.AbstractGroup));
exports.default = Group;

},{"./shape":133,"./util/draw":144,"@antv/g-base":115,"tslib":894}],127:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Shape = exports.version = void 0;
var tslib_1 = require("tslib");
var Shape = require("./shape");
exports.Shape = Shape;
var pkg = require('../package.json');
exports.version = pkg.version;
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./interfaces"), exports);
var g_base_1 = require("@antv/g-base");
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return g_base_1.Event; } });
var canvas_1 = require("./canvas");
Object.defineProperty(exports, "Canvas", { enumerable: true, get: function () { return canvas_1.default; } });
var group_1 = require("./group");
Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return group_1.default; } });

},{"../package.json":156,"./canvas":125,"./group":126,"./interfaces":128,"./shape":133,"./types":141,"@antv/g-base":115,"tslib":894}],128:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// 导出 g-base 中的 interfaces
tslib_1.__exportStar(require("@antv/g-base/lib/interfaces"), exports);

},{"@antv/g-base/lib/interfaces":116,"tslib":894}],129:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var util_1 = require("../util/util");
var draw_1 = require("../util/draw");
var index_1 = require("@antv/g-base/lib/bbox/index");
var Shape = require("./index");
var group_1 = require("../group");
var ShapeBase = /** @class */ (function (_super) {
    tslib_1.__extends(ShapeBase, _super);
    function ShapeBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ShapeBase.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        // 设置默认值
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { lineWidth: 1, lineAppendWidth: 0, strokeOpacity: 1, fillOpacity: 1 });
    };
    ShapeBase.prototype.getShapeBase = function () {
        return Shape;
    };
    ShapeBase.prototype.getGroupBase = function () {
        return group_1.default;
    };
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    ShapeBase.prototype.onCanvasChange = function (changeType) {
        draw_1.refreshElement(this, changeType);
    };
    ShapeBase.prototype.calculateBBox = function () {
        var type = this.get('type');
        var lineWidth = this.getHitLineWidth();
        // const attrs = this.attr();
        var bboxMethod = index_1.getBBoxMethod(type);
        var box = bboxMethod(this);
        var halfLineWidth = lineWidth / 2;
        var minX = box.x - halfLineWidth;
        var minY = box.y - halfLineWidth;
        var maxX = box.x + box.width + halfLineWidth;
        var maxY = box.y + box.height + halfLineWidth;
        return {
            x: minX,
            minX: minX,
            y: minY,
            minY: minY,
            width: box.width + lineWidth,
            height: box.height + lineWidth,
            maxX: maxX,
            maxY: maxY,
        };
    };
    ShapeBase.prototype.isFill = function () {
        return !!this.attrs['fill'] || this.isClipShape();
    };
    ShapeBase.prototype.isStroke = function () {
        return !!this.attrs['stroke'];
    };
    // 同 shape 中的方法重复了
    ShapeBase.prototype._applyClip = function (context, clip) {
        if (clip) {
            context.save();
            // 将 clip 的属性挂载到 context 上
            draw_1.applyAttrsToContext(context, clip);
            // 绘制 clip 路径
            clip.createPath(context);
            context.restore();
            // 裁剪
            context.clip();
            clip._afterDraw();
        }
    };
    // 绘制图形时需要考虑 region 限制
    ShapeBase.prototype.draw = function (context, region) {
        var clip = this.getClip();
        // 如果指定了区域，当与指定区域相交时，才会触发渲染
        if (region) {
            // 是否相交需要考虑 clip 的包围盒
            var bbox = clip ? draw_1.getMergedRegion([this, clip]) : this.getCanvasBBox();
            if (!util_1.intersectRect(region, bbox)) {
                // 图形的包围盒与重绘区域不相交时，也需要清除标记
                this.set('hasChanged', false);
                return;
            }
        }
        context.save();
        // 先将 attrs 应用到上下文中，再设置 clip。因为 clip 应该被当前元素的 matrix 所影响
        draw_1.applyAttrsToContext(context, this);
        this._applyClip(context, this.getClip());
        this.drawPath(context);
        context.restore();
        this._afterDraw();
    };
    ShapeBase.prototype._afterDraw = function () {
        var bbox = this.getCanvasBBox();
        var canvas = this.getCanvas();
        // 绘制的时候缓存包围盒
        this.set('cacheCanvasBBox', bbox);
        if (canvas) {
            // @ts-ignore
            var viewRange = canvas.getViewRange();
            this.set('isInView', util_1.intersectRect(bbox, viewRange));
        }
        // 绘制后消除标记
        this.set('hasChanged', false);
    };
    ShapeBase.prototype.skipDraw = function () {
        this.set('cacheCanvasBBox', null);
        this.set('isInView', null);
        this.set('hasChanged', false);
    };
    /**
     * 绘制图形的路径
     * @param {CanvasRenderingContext2D} context 上下文
     */
    ShapeBase.prototype.drawPath = function (context) {
        this.createPath(context);
        this.strokeAndFill(context);
        this.afterDrawPath(context);
    };
    /**
     * @protected
     * 填充图形
     * @param {CanvasRenderingContext2D} context context 上下文
     */
    ShapeBase.prototype.fill = function (context) {
        context.fill();
    };
    /**
     * @protected
     * 绘制图形边框
     * @param {CanvasRenderingContext2D} context context 上下文
     */
    ShapeBase.prototype.stroke = function (context) {
        context.stroke();
    };
    // 绘制或者填充
    ShapeBase.prototype.strokeAndFill = function (context) {
        var _a = this.attrs, lineWidth = _a.lineWidth, opacity = _a.opacity, strokeOpacity = _a.strokeOpacity, fillOpacity = _a.fillOpacity;
        if (this.isFill()) {
            if (!util_1.isNil(fillOpacity) && fillOpacity !== 1) {
                context.globalAlpha = fillOpacity;
                this.fill(context);
                context.globalAlpha = opacity;
            }
            else {
                this.fill(context);
            }
        }
        if (this.isStroke()) {
            if (lineWidth > 0) {
                if (!util_1.isNil(strokeOpacity) && strokeOpacity !== 1) {
                    context.globalAlpha = strokeOpacity;
                }
                this.stroke(context);
            }
        }
        this.afterDrawPath(context);
    };
    /**
     * @protected
     * 绘制图形的路径
     * @param {CanvasRenderingContext2D} context 上下文
     */
    ShapeBase.prototype.createPath = function (context) { };
    /**
     * 绘制完成 path 后的操作
     * @param {CanvasRenderingContext2D} context 上下文
     */
    ShapeBase.prototype.afterDrawPath = function (context) { };
    ShapeBase.prototype.isInShape = function (refX, refY) {
        // return HitUtil.isHitShape(this, refX, refY);
        var isStroke = this.isStroke();
        var isFill = this.isFill();
        var lineWidth = this.getHitLineWidth();
        return this.isInStrokeOrPath(refX, refY, isStroke, isFill, lineWidth);
    };
    // 之所以不拆成 isInStroke 和 isInPath 在于两者存在一些共同的计算
    ShapeBase.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        return false;
    };
    /**
     * 获取线拾取的宽度
     * @returns {number} 线的拾取宽度
     */
    ShapeBase.prototype.getHitLineWidth = function () {
        if (!this.isStroke()) {
            return 0;
        }
        var attrs = this.attrs;
        return attrs['lineWidth'] + attrs['lineAppendWidth'];
    };
    return ShapeBase;
}(g_base_1.AbstractShape));
exports.default = ShapeBase;

},{"../group":126,"../util/draw":144,"../util/util":155,"./index":133,"@antv/g-base":115,"@antv/g-base/lib/bbox/index":104,"tslib":894}],130:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 圆
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var util_1 = require("../util/util");
// TODO: 暂时不需要圆的工具方法，后续如果需要支持 pointAt，tangentAngle 时再引入
// import CircleUtil from '@antv/g-math/lib/circle';
var Circle = /** @class */ (function (_super) {
    tslib_1.__extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, r: 0 });
    };
    Circle.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        var attrs = this.attr();
        var cx = attrs.x;
        var cy = attrs.y;
        var r = attrs.r;
        var halfLineWidth = lineWidth / 2;
        var absDistance = util_1.distance(cx, cy, x, y);
        // 直接用距离，如果同时存在边和填充时，可以减少两次计算
        if (isFill && isStroke) {
            return absDistance <= r + halfLineWidth;
        }
        if (isFill) {
            return absDistance <= r;
        }
        if (isStroke) {
            return absDistance >= r - halfLineWidth && absDistance <= r + halfLineWidth;
        }
        return false;
    };
    Circle.prototype.createPath = function (context) {
        var attrs = this.attr();
        var cx = attrs.x;
        var cy = attrs.y;
        var r = attrs.r;
        context.beginPath();
        context.arc(cx, cy, r, 0, Math.PI * 2, false);
        context.closePath();
    };
    return Circle;
}(base_1.default));
exports.default = Circle;

},{"../util/util":155,"./base":129,"tslib":894}],131:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 椭圆
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
// 暂时不需要
// import EllipseUtil from '@antv/g-math/lib/ellipse';
// 根据椭圆公式计算 x*x/rx*rx + y*y/ry*ry;
function ellipseDistance(squareX, squareY, rx, ry) {
    return squareX / (rx * rx) + squareY / (ry * ry);
}
var Ellipse = /** @class */ (function (_super) {
    tslib_1.__extends(Ellipse, _super);
    function Ellipse() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Ellipse.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, rx: 0, ry: 0 });
    };
    Ellipse.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        var attrs = this.attr();
        var halfLineWith = lineWidth / 2;
        var cx = attrs.x;
        var cy = attrs.y;
        var rx = attrs.rx, ry = attrs.ry;
        var squareX = (x - cx) * (x - cx);
        var squareY = (y - cy) * (y - cy);
        // 使用椭圆的公式： x*x/rx*rx + y*y/ry*ry = 1;
        if (isFill && isStroke) {
            return ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1;
        }
        if (isFill) {
            return ellipseDistance(squareX, squareY, rx, ry) <= 1;
        }
        if (isStroke) {
            return (ellipseDistance(squareX, squareY, rx - halfLineWith, ry - halfLineWith) >= 1 &&
                ellipseDistance(squareX, squareY, rx + halfLineWith, ry + halfLineWith) <= 1);
        }
        return false;
    };
    Ellipse.prototype.createPath = function (context) {
        var attrs = this.attr();
        var cx = attrs.x;
        var cy = attrs.y;
        var rx = attrs.rx;
        var ry = attrs.ry;
        context.beginPath();
        // 兼容逻辑
        if (context.ellipse) {
            context.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2, false);
        }
        else {
            // 如果不支持，则使用圆来绘制，进行变形
            var r = rx > ry ? rx : ry;
            var scaleX = rx > ry ? 1 : rx / ry;
            var scaleY = rx > ry ? ry / rx : 1;
            context.save();
            context.translate(cx, cy);
            context.scale(scaleX, scaleY);
            context.arc(0, 0, r, 0, Math.PI * 2);
            context.restore();
            context.closePath();
        }
    };
    return Ellipse;
}(base_1.default));
exports.default = Ellipse;

},{"./base":129,"tslib":894}],132:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 图片
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var util_1 = require("../util/util");
function isCanvas(dom) {
    return dom instanceof HTMLElement && util_1.isString(dom.nodeName) && dom.nodeName.toUpperCase() === 'CANVAS';
}
var ImageShape = /** @class */ (function (_super) {
    tslib_1.__extends(ImageShape, _super);
    function ImageShape() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImageShape.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0 });
    };
    ImageShape.prototype.initAttrs = function (attrs) {
        this._setImage(attrs.img);
    };
    // image 不计算 stroke
    ImageShape.prototype.isStroke = function () {
        return false;
    };
    // 仅仅使用包围盒检测来进行拾取
    // 所以不需要复写 isInStrokeOrPath 的方法
    ImageShape.prototype.isOnlyHitBox = function () {
        return true;
    };
    ImageShape.prototype._afterLoading = function () {
        if (this.get('toDraw') === true) {
            var canvas = this.get('canvas');
            if (canvas) {
                // 这段应该改成局部渲染
                canvas.draw();
            }
            else {
                // 这种方式如果发生遮挡会出现问题
                this.createPath(this.get('context'));
            }
        }
    };
    ImageShape.prototype._setImage = function (img) {
        var _this = this;
        var attrs = this.attrs;
        if (util_1.isString(img)) {
            var image_1 = new Image();
            image_1.onload = function () {
                // 图片未加载完，则已经被销毁
                if (_this.destroyed) {
                    return false;
                }
                // 缓存原始地址，可以做对比，防止重复加载图片
                // 如果考虑到在加载过程中可能替换 img 属性，则情况更加复杂
                // this.set('imgSrc', img);
                // 这里会循环调用 _setImage 方法，但不会再走这个分支
                _this.attr('img', image_1);
                _this.set('loading', false);
                _this._afterLoading();
                var callback = _this.get('callback');
                if (callback) {
                    callback.call(_this);
                }
            };
            image_1.src = img;
            // 设置跨域
            image_1.crossOrigin = 'Anonymous';
            // loading 过程中不绘制
            this.set('loading', true);
        }
        else if (img instanceof Image) {
            // 如果是一个 image 对象，则设置宽高
            if (!attrs.width) {
                attrs.width = img.width;
            }
            if (!attrs.height) {
                attrs.height = img.height;
            }
        }
        else if (isCanvas(img)) {
            // 如果设置了 canvas 对象
            if (!attrs.width) {
                attrs.width = Number(img.getAttribute('width'));
            }
            if (!attrs.height) {
                attrs.height, Number(img.getAttribute('height'));
            }
        }
    };
    ImageShape.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        // 如果加载的已经是当前图片，则不再处理
        if (name === 'img') {
            // 可以加缓冲，&& this.get('imgSrc') !== value
            this._setImage(value);
        }
    };
    ImageShape.prototype.createPath = function (context) {
        // 正在加载则不绘制
        if (this.get('loading')) {
            this.set('toDraw', true); // 加载完成后绘制
            this.set('context', context);
            return;
        }
        var attrs = this.attr();
        var x = attrs.x, y = attrs.y, width = attrs.width, height = attrs.height, sx = attrs.sx, sy = attrs.sy, swidth = attrs.swidth, sheight = attrs.sheight;
        var img = attrs.img;
        if (img instanceof Image || isCanvas(img)) {
            if (!util_1.isNil(sx) && !util_1.isNil(sy) && !util_1.isNil(swidth) && !util_1.isNil(sheight)) {
                context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height);
            }
            else {
                context.drawImage(img, x, y, width, height);
            }
        }
    };
    return ImageShape;
}(base_1.default));
exports.default = ImageShape;

},{"../util/util":155,"./base":129,"tslib":894}],133:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base");
Object.defineProperty(exports, "Base", { enumerable: true, get: function () { return base_1.default; } });
var circle_1 = require("./circle");
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.default; } });
var ellipse_1 = require("./ellipse");
Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return ellipse_1.default; } });
var image_1 = require("./image");
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_1.default; } });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });
var marker_1 = require("./marker");
Object.defineProperty(exports, "Marker", { enumerable: true, get: function () { return marker_1.default; } });
var path_1 = require("./path");
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return path_1.default; } });
var polygon_1 = require("./polygon");
Object.defineProperty(exports, "Polygon", { enumerable: true, get: function () { return polygon_1.default; } });
var polyline_1 = require("./polyline");
Object.defineProperty(exports, "Polyline", { enumerable: true, get: function () { return polyline_1.default; } });
var rect_1 = require("./rect");
Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.default; } });
var text_1 = require("./text");
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.default; } });

},{"./base":129,"./circle":130,"./ellipse":131,"./image":132,"./line":134,"./marker":135,"./path":136,"./polygon":137,"./polyline":138,"./rect":139,"./text":140}],134:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @fileoverview 圆
 * @author dxq613@gmail.com
 */
var line_1 = require("@antv/g-math/lib/line");
var base_1 = require("./base");
var line_2 = require("../util/in-stroke/line");
var ArrowUtil = require("../util/arrow");
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Line.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x1: 0, y1: 0, x2: 0, y2: 0, startArrow: false, endArrow: false });
    };
    Line.prototype.initAttrs = function (attrs) {
        this.setArrow();
    };
    // 更新属性时，检测是否更改了箭头
    Line.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        // 由于箭头的绘制依赖于 line 的诸多 attrs，因此这里不再对每个 attr 进行判断，attr 每次变化都会影响箭头的更新
        this.setArrow();
    };
    Line.prototype.setArrow = function () {
        var attrs = this.attr();
        var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
        if (startArrow) {
            ArrowUtil.addStartArrow(this, attrs, x2, y2, x1, y1);
        }
        if (endArrow) {
            ArrowUtil.addEndArrow(this, attrs, x1, y1, x2, y2);
        }
    };
    Line.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        if (!isStroke || !lineWidth) {
            return false;
        }
        var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
        return line_2.default(x1, y1, x2, y2, lineWidth, x, y);
    };
    Line.prototype.createPath = function (context) {
        var attrs = this.attr();
        var x1 = attrs.x1, y1 = attrs.y1, x2 = attrs.x2, y2 = attrs.y2, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
        var startArrowDistance = {
            dx: 0,
            dy: 0,
        };
        var endArrowDistance = {
            dx: 0,
            dy: 0,
        };
        if (startArrow && startArrow.d) {
            startArrowDistance = ArrowUtil.getShortenOffset(x1, y1, x2, y2, attrs.startArrow.d);
        }
        if (endArrow && endArrow.d) {
            endArrowDistance = ArrowUtil.getShortenOffset(x1, y1, x2, y2, attrs.endArrow.d);
        }
        context.beginPath();
        // 如果自定义箭头，线条相应缩进
        context.moveTo(x1 + startArrowDistance.dx, y1 + startArrowDistance.dy);
        context.lineTo(x2 - endArrowDistance.dx, y2 - endArrowDistance.dy);
    };
    Line.prototype.afterDrawPath = function (context) {
        var startArrowShape = this.get('startArrowShape');
        var endArrowShape = this.get('endArrowShape');
        if (startArrowShape) {
            startArrowShape.draw(context);
        }
        if (endArrowShape) {
            endArrowShape.draw(context);
        }
    };
    /**
     * Get length of line
     * @return {number} length
     */
    Line.prototype.getTotalLength = function () {
        var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
        return line_1.default.length(x1, y1, x2, y2);
    };
    /**
     * Get point according to ratio
     * @param {number} ratio
     * @return {Point} point
     */
    Line.prototype.getPoint = function (ratio) {
        var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
        return line_1.default.pointAt(x1, y1, x2, y2, ratio);
    };
    return Line;
}(base_1.default));
exports.default = Line;

},{"../util/arrow":143,"../util/in-stroke/line":149,"./base":129,"@antv/g-math/lib/line":172,"tslib":894}],135:[function(require,module,exports){
"use strict";
/**
 * @fileoverview Marker
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var path_2_absolute_1 = require("@antv/path-util/lib/path-2-absolute");
var base_1 = require("./base");
var util_2 = require("../util/util");
var draw_1 = require("../util/draw");
var Symbols = {
    // 圆
    circle: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['A', r, r, 0, 1, 0, x + r, y],
            ['A', r, r, 0, 1, 0, x - r, y],
        ];
    },
    // 正方形
    square: function (x, y, r) {
        return [['M', x - r, y - r], ['L', x + r, y - r], ['L', x + r, y + r], ['L', x - r, y + r], ['Z']];
    },
    // 菱形
    diamond: function (x, y, r) {
        return [['M', x - r, y], ['L', x, y - r], ['L', x + r, y], ['L', x, y + r], ['Z']];
    },
    // 三角形
    triangle: function (x, y, r) {
        var diffY = r * Math.sin((1 / 3) * Math.PI);
        return [['M', x - r, y + diffY], ['L', x, y - diffY], ['L', x + r, y + diffY], ['Z']];
    },
    // 倒三角形
    'triangle-down': function (x, y, r) {
        var diffY = r * Math.sin((1 / 3) * Math.PI);
        return [['M', x - r, y - diffY], ['L', x + r, y - diffY], ['L', x, y + diffY], ['Z']];
    },
};
var Marker = /** @class */ (function (_super) {
    tslib_1.__extends(Marker, _super);
    function Marker() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Marker.prototype.initAttrs = function (attrs) {
        this._resetParamsCache();
    };
    // 重置绘制 path 存储的缓存
    Marker.prototype._resetParamsCache = function () {
        // 为了加速 path 的绘制、拾取和计算，这个地方可以缓存很多东西
        // 这些缓存都是第一次需要时计算和存储，虽然增加了复杂度，但是频繁调用的方法，性能有很大提升
        this.set('paramsCache', {}); // 清理缓存
    };
    // 更新属性时，检测是否更改了 path
    Marker.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        if (['symbol', 'x', 'y', 'r', 'radius'].indexOf(name) !== -1) {
            // path 相关属性更改时，清理缓存
            this._resetParamsCache();
        }
    };
    // 仅仅使用包围盒检测来进行拾取
    // 所以不需要复写 isInStrokeOrPath 的方法
    Marker.prototype.isOnlyHitBox = function () {
        return true;
    };
    Marker.prototype._getR = function (attrs) {
        // 兼容 r 和 radius 两种写法，推荐使用 r
        return util_1.isNil(attrs.r) ? attrs.radius : attrs.r;
    };
    Marker.prototype._getPath = function () {
        var attrs = this.attr();
        var x = attrs.x, y = attrs.y;
        var symbol = attrs.symbol || 'circle';
        var r = this._getR(attrs);
        var method;
        var path;
        if (util_2.isFunction(symbol)) {
            method = symbol;
            path = method(x, y, r);
            // 将 path 转成绝对路径
            path = path_2_absolute_1.default(path);
        }
        else {
            // 内置 symbol 的 path 都是绝对路径，直接绘制即可，不需要对 path 进行特殊处理
            method = Marker.Symbols[symbol];
            path = method(x, y, r);
        }
        if (!method) {
            console.warn(symbol + " marker is not supported.");
            return null;
        }
        return path;
    };
    Marker.prototype.createPath = function (context) {
        var path = this._getPath();
        var paramsCache = this.get('paramsCache');
        draw_1.drawPath(this, context, { path: path }, paramsCache);
    };
    Marker.Symbols = Symbols;
    return Marker;
}(base_1.default));
exports.default = Marker;

},{"../util/draw":144,"../util/util":155,"./base":129,"@antv/path-util/lib/path-2-absolute":729,"@antv/util":803,"tslib":894}],136:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var cubic_1 = require("@antv/g-math/lib/cubic");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var path_2_absolute_1 = require("@antv/path-util/lib/path-2-absolute");
var path_2_segments_1 = require("@antv/path-util/lib/path-2-segments");
var draw_1 = require("../util/draw");
var point_in_path_1 = require("../util/in-path/point-in-path");
var polygon_1 = require("../util/in-path/polygon");
var path_1 = require("../util/path");
var ArrowUtil = require("../util/arrow");
// 是否在多个多边形内部
function isInPolygons(polygons, x, y) {
    var isHit = false;
    for (var i = 0; i < polygons.length; i++) {
        var points = polygons[i];
        isHit = polygon_1.default(points, x, y);
        if (isHit) {
            break;
        }
    }
    return isHit;
}
var Path = /** @class */ (function (_super) {
    tslib_1.__extends(Path, _super);
    function Path() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Path.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false });
    };
    Path.prototype.initAttrs = function (attrs) {
        this._setPathArr(attrs.path);
        this.setArrow();
    };
    // 更新属性时，检测是否更改了 path
    Path.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        if (name === 'path') {
            this._setPathArr(value);
        }
        // 由于箭头的绘制依赖于 line 的诸多 attrs，因此这里不再对每个 attr 进行判断，attr 每次变化都会影响箭头的更新
        this.setArrow();
    };
    // 将 path 转换成绝对路径
    Path.prototype._setPathArr = function (path) {
        // 转换 path 的格式
        this.attrs.path = path_2_absolute_1.default(path);
        var hasArc = path_1.default.hasArc(path);
        // 为了加速 path 的绘制、拾取和计算，这个地方可以缓存很多东西
        // 这些缓存都是第一次需要时计算和存储，虽然增加了复杂度，但是频繁调用的方法，性能有很大提升
        this.set('hasArc', hasArc);
        this.set('paramsCache', {}); // 清理缓存
        this.set('segments', null); // 延迟生成 path，在动画场景下可能不会有拾取
        this.set('curve', null);
        this.set('tCache', null);
        this.set('totalLength', null);
    };
    Path.prototype.getSegments = function () {
        var segments = this.get('segements');
        if (!segments) {
            segments = path_2_segments_1.default(this.attr('path'));
            this.set('segments', segments);
        }
        return segments;
    };
    Path.prototype.setArrow = function () {
        var attrs = this.attr();
        var startArrow = attrs.startArrow, endArrow = attrs.endArrow;
        if (startArrow) {
            var tangent = this.getStartTangent();
            ArrowUtil.addStartArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]);
        }
        if (endArrow) {
            var tangent = this.getEndTangent();
            ArrowUtil.addEndArrow(this, attrs, tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1]);
        }
    };
    Path.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        var segments = this.getSegments();
        var hasArc = this.get('hasArc');
        var isHit = false;
        if (isStroke) {
            isHit = path_1.default.isPointInStroke(segments, lineWidth, x, y);
        }
        if (!isHit && isFill) {
            if (hasArc) {
                // 存在曲线时，暂时使用 canvas 的 api 计算，后续可以进行多边形切割
                isHit = point_in_path_1.default(this, x, y);
            }
            else {
                var path = this.attr('path');
                var extractResutl = path_1.default.extractPolygons(path);
                // 提取出来的多边形包含闭合的和非闭合的，在这里统一按照多边形处理
                isHit = isInPolygons(extractResutl.polygons, x, y) || isInPolygons(extractResutl.polylines, x, y);
            }
        }
        return isHit;
    };
    Path.prototype.createPath = function (context) {
        var attrs = this.attr();
        var paramsCache = this.get('paramsCache'); // 由于计算圆弧的参数成本很大，所以要缓存
        draw_1.drawPath(this, context, attrs, paramsCache);
    };
    Path.prototype.afterDrawPath = function (context) {
        var startArrowShape = this.get('startArrowShape');
        var endArrowShape = this.get('endArrowShape');
        if (startArrowShape) {
            startArrowShape.draw(context);
        }
        if (endArrowShape) {
            endArrowShape.draw(context);
        }
    };
    /**
     * Get total length of path
     * @return {number} length
     */
    Path.prototype.getTotalLength = function () {
        var totalLength = this.get('totalLength');
        if (!util_1.isNil(totalLength)) {
            return totalLength;
        }
        this._calculateCurve();
        this._setTcache();
        return this.get('totalLength');
    };
    /**
     * Get point according to ratio
     * @param {number} ratio
     * @return {Point} point
     */
    Path.prototype.getPoint = function (ratio) {
        var tCache = this.get('tCache');
        if (!tCache) {
            this._calculateCurve();
            this._setTcache();
            tCache = this.get('tCache');
        }
        var subt;
        var index;
        var curve = this.get('curve');
        if (!tCache || tCache.length === 0) {
            if (curve) {
                return {
                    x: curve[0][1],
                    y: curve[0][2],
                };
            }
            return null;
        }
        util_1.each(tCache, function (v, i) {
            if (ratio >= v[0] && ratio <= v[1]) {
                subt = (ratio - v[0]) / (v[1] - v[0]);
                index = i;
            }
        });
        var seg = curve[index];
        if (util_1.isNil(seg) || util_1.isNil(index)) {
            return null;
        }
        var l = seg.length;
        var nextSeg = curve[index + 1];
        return cubic_1.default.pointAt(seg[l - 2], seg[l - 1], nextSeg[1], nextSeg[2], nextSeg[3], nextSeg[4], nextSeg[5], nextSeg[6], subt);
    };
    Path.prototype._calculateCurve = function () {
        var path = this.attr().path;
        this.set('curve', path_1.default.pathToCurve(path));
    };
    Path.prototype._setTcache = function () {
        var totalLength = 0;
        var tempLength = 0;
        // 每段 curve 对应起止点的长度比例列表，形如: [[0, 0.25], [0.25, 0.6]. [0.6, 0.9], [0.9, 1]]
        var tCache = [];
        var segmentT;
        var segmentL;
        var segmentN;
        var l;
        var curve = this.get('curve');
        if (!curve) {
            return;
        }
        util_1.each(curve, function (segment, i) {
            segmentN = curve[i + 1];
            l = segment.length;
            if (segmentN) {
                totalLength +=
                    cubic_1.default.length(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]) || 0;
            }
        });
        this.set('totalLength', totalLength);
        if (totalLength === 0) {
            this.set('tCache', []);
            return;
        }
        util_1.each(curve, function (segment, i) {
            segmentN = curve[i + 1];
            l = segment.length;
            if (segmentN) {
                segmentT = [];
                segmentT[0] = tempLength / totalLength;
                segmentL = cubic_1.default.length(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
                // 当 path 不连续时，segmentL 可能为空，为空时需要作为 0 处理
                tempLength += segmentL || 0;
                segmentT[1] = tempLength / totalLength;
                tCache.push(segmentT);
            }
        });
        this.set('tCache', tCache);
    };
    /**
     * Get start tangent vector
     * @return {Array}
     */
    Path.prototype.getStartTangent = function () {
        var segments = this.getSegments();
        var result;
        if (segments.length > 1) {
            var startPoint = segments[0].currentPoint;
            var endPoint = segments[1].currentPoint;
            var tangent = segments[1].startTangent;
            result = [];
            if (tangent) {
                result.push([startPoint[0] - tangent[0], startPoint[1] - tangent[1]]);
                result.push([startPoint[0], startPoint[1]]);
            }
            else {
                result.push([endPoint[0], endPoint[1]]);
                result.push([startPoint[0], startPoint[1]]);
            }
        }
        return result;
    };
    /**
     * Get end tangent vector
     * @return {Array}
     */
    Path.prototype.getEndTangent = function () {
        var segments = this.getSegments();
        var length = segments.length;
        var result;
        if (length > 1) {
            var startPoint = segments[length - 2].currentPoint;
            var endPoint = segments[length - 1].currentPoint;
            var tangent = segments[length - 1].endTangent;
            result = [];
            if (tangent) {
                result.push([endPoint[0] - tangent[0], endPoint[1] - tangent[1]]);
                result.push([endPoint[0], endPoint[1]]);
            }
            else {
                result.push([startPoint[0], startPoint[1]]);
                result.push([endPoint[0], endPoint[1]]);
            }
        }
        return result;
    };
    return Path;
}(base_1.default));
exports.default = Path;

},{"../util/arrow":143,"../util/draw":144,"../util/in-path/point-in-path":146,"../util/in-path/polygon":147,"../util/path":154,"./base":129,"@antv/g-math/lib/cubic":170,"@antv/path-util/lib/path-2-absolute":729,"@antv/path-util/lib/path-2-segments":731,"@antv/util":803,"tslib":894}],137:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 多边形
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var polyline_1 = require("../util/in-stroke/polyline");
var polygon_1 = require("../util/in-path/polygon");
var Polygon = /** @class */ (function (_super) {
    tslib_1.__extends(Polygon, _super);
    function Polygon() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Polygon.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        var points = this.attr().points;
        var isHit = false;
        if (isStroke) {
            isHit = polyline_1.default(points, lineWidth, x, y, true);
        }
        if (!isHit && isFill) {
            isHit = polygon_1.default(points, x, y); // isPointInPath(shape, x, y);
        }
        return isHit;
    };
    Polygon.prototype.createPath = function (context) {
        var attrs = this.attr();
        var points = attrs.points;
        if (points.length < 2) {
            return;
        }
        context.beginPath();
        for (var i = 0; i < points.length; i++) {
            var point = points[i];
            if (i === 0) {
                context.moveTo(point[0], point[1]);
            }
            else {
                context.lineTo(point[0], point[1]);
            }
        }
        context.closePath();
    };
    return Polygon;
}(base_1.default));
exports.default = Polygon;

},{"../util/in-path/polygon":147,"../util/in-stroke/polyline":150,"./base":129,"tslib":894}],138:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var line_1 = require("@antv/g-math/lib/line");
var polyline_1 = require("@antv/g-math/lib/polyline");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var polyline_2 = require("../util/in-stroke/polyline");
var ArrowUtil = require("../util/arrow");
var PolyLine = /** @class */ (function (_super) {
    tslib_1.__extends(PolyLine, _super);
    function PolyLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PolyLine.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false });
    };
    PolyLine.prototype.initAttrs = function (attrs) {
        this.setArrow();
    };
    // 更新属性时，检测是否更改了 points
    PolyLine.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        this.setArrow();
        if (['points'].indexOf(name) !== -1) {
            this._resetCache();
        }
    };
    PolyLine.prototype._resetCache = function () {
        this.set('totalLength', null);
        this.set('tCache', null);
    };
    PolyLine.prototype.setArrow = function () {
        var attrs = this.attr();
        var _a = this.attrs, points = _a.points, startArrow = _a.startArrow, endArrow = _a.endArrow;
        var length = points.length;
        var x1 = points[0][0];
        var y1 = points[0][1];
        var x2 = points[length - 1][0];
        var y2 = points[length - 1][1];
        if (startArrow) {
            ArrowUtil.addStartArrow(this, attrs, points[1][0], points[1][1], x1, y1);
        }
        if (endArrow) {
            ArrowUtil.addEndArrow(this, attrs, points[length - 2][0], points[length - 2][1], x2, y2);
        }
    };
    // 不允许 fill
    PolyLine.prototype.isFill = function () {
        return false;
    };
    PolyLine.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        // 没有设置 stroke 不能被拾取, 没有线宽不能被拾取
        if (!isStroke || !lineWidth) {
            return false;
        }
        var points = this.attr().points;
        return polyline_2.default(points, lineWidth, x, y, false);
    };
    // 始终填充
    PolyLine.prototype.isStroke = function () {
        return true;
    };
    PolyLine.prototype.createPath = function (context) {
        var _a = this.attr(), points = _a.points, startArrow = _a.startArrow, endArrow = _a.endArrow;
        var length = points.length;
        if (points.length < 2) {
            return;
        }
        var x1 = points[0][0];
        var y1 = points[0][1];
        var x2 = points[length - 1][0];
        var y2 = points[length - 1][1];
        // 如果定义了箭头，并且是自定义箭头，线条相应缩进
        if (startArrow && startArrow.d) {
            var distance = ArrowUtil.getShortenOffset(x1, y1, points[1][0], points[1][1], startArrow.d);
            x1 += distance.dx;
            y1 += distance.dy;
        }
        if (endArrow && endArrow.d) {
            var distance = ArrowUtil.getShortenOffset(points[length - 2][0], points[length - 2][1], x2, y2, endArrow.d);
            x2 -= distance.dx;
            y2 -= distance.dy;
        }
        context.beginPath();
        context.moveTo(x1, y1);
        for (var i = 0; i < length - 1; i++) {
            var point = points[i];
            context.lineTo(point[0], point[1]);
        }
        context.lineTo(x2, y2);
    };
    PolyLine.prototype.afterDrawPath = function (context) {
        var startArrowShape = this.get('startArrowShape');
        var endArrowShape = this.get('endArrowShape');
        if (startArrowShape) {
            startArrowShape.draw(context);
        }
        if (endArrowShape) {
            endArrowShape.draw(context);
        }
    };
    /**
     * Get length of polyline
     * @return {number} length
     */
    PolyLine.prototype.getTotalLength = function () {
        var points = this.attr().points;
        // get totalLength from cache
        var totalLength = this.get('totalLength');
        if (!util_1.isNil(totalLength)) {
            return totalLength;
        }
        this.set('totalLength', polyline_1.default.length(points));
        return this.get('totalLength');
    };
    /**
     * Get point according to ratio
     * @param {number} ratio
     * @return {Point} point
     */
    PolyLine.prototype.getPoint = function (ratio) {
        var points = this.attr().points;
        // get tCache from cache
        var tCache = this.get('tCache');
        if (!tCache) {
            this._setTcache();
            tCache = this.get('tCache');
        }
        var subt;
        var index;
        util_1.each(tCache, function (v, i) {
            if (ratio >= v[0] && ratio <= v[1]) {
                subt = (ratio - v[0]) / (v[1] - v[0]);
                index = i;
            }
        });
        return line_1.default.pointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt);
    };
    PolyLine.prototype._setTcache = function () {
        var points = this.attr().points;
        if (!points || points.length === 0) {
            return;
        }
        var totalLength = this.getTotalLength();
        if (totalLength <= 0) {
            return;
        }
        var tempLength = 0;
        var tCache = [];
        var segmentT;
        var segmentL;
        util_1.each(points, function (p, i) {
            if (points[i + 1]) {
                segmentT = [];
                segmentT[0] = tempLength / totalLength;
                segmentL = line_1.default.length(p[0], p[1], points[i + 1][0], points[i + 1][1]);
                tempLength += segmentL;
                segmentT[1] = tempLength / totalLength;
                tCache.push(segmentT);
            }
        });
        this.set('tCache', tCache);
    };
    /**
     * Get start tangent vector
     * @return {Array}
     */
    PolyLine.prototype.getStartTangent = function () {
        var points = this.attr().points;
        var result = [];
        result.push([points[1][0], points[1][1]]);
        result.push([points[0][0], points[0][1]]);
        return result;
    };
    /**
     * Get end tangent vector
     * @return {Array}
     */
    PolyLine.prototype.getEndTangent = function () {
        var points = this.attr().points;
        var l = points.length - 1;
        var result = [];
        result.push([points[l - 1][0], points[l - 1][1]]);
        result.push([points[l][0], points[l][1]]);
        return result;
    };
    return PolyLine;
}(base_1.default));
exports.default = PolyLine;

},{"../util/arrow":143,"../util/in-stroke/polyline":150,"./base":129,"@antv/g-math/lib/line":172,"@antv/g-math/lib/polyline":173,"@antv/util":803,"tslib":894}],139:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 矩形
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var parse_1 = require("../util/parse");
var util_1 = require("../util/util");
var rect_1 = require("../util/in-stroke/rect");
var rect_radius_1 = require("../util/in-stroke/rect-radius");
var point_in_path_1 = require("../util/in-path/point-in-path");
var Rect = /** @class */ (function (_super) {
    tslib_1.__extends(Rect, _super);
    function Rect() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Rect.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0, radius: 0 });
    };
    Rect.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
        var attrs = this.attr();
        var minX = attrs.x;
        var minY = attrs.y;
        var width = attrs.width;
        var height = attrs.height;
        var radius = attrs.radius;
        // 无圆角时的策略
        if (!radius) {
            var halfWidth = lineWidth / 2;
            // 同时填充和带有边框
            if (isFill && isStroke) {
                return util_1.inBox(minX - halfWidth, minY - halfWidth, width + halfWidth, height + halfWidth, x, y);
            }
            // 仅填充
            if (isFill) {
                return util_1.inBox(minX, minY, width, height, x, y);
            }
            if (isStroke) {
                return rect_1.default(minX, minY, width, height, lineWidth, x, y);
            }
        }
        else {
            var isHit = false;
            if (isStroke) {
                isHit = rect_radius_1.default(minX, minY, width, height, radius, lineWidth, x, y);
            }
            // 仅填充时带有圆角的矩形直接通过图形拾取
            // 以后可以改成纯数学的近似拾取，将圆弧切割成多边形
            if (!isHit && isFill) {
                isHit = point_in_path_1.default(this, x, y);
            }
            return isHit;
        }
    };
    Rect.prototype.createPath = function (context) {
        var attrs = this.attr();
        var x = attrs.x;
        var y = attrs.y;
        var width = attrs.width;
        var height = attrs.height;
        var radius = attrs.radius;
        context.beginPath();
        if (radius === 0) {
            // 改成原生的rect方法
            context.rect(x, y, width, height);
        }
        else {
            var _a = parse_1.parseRadius(radius), r1 = _a[0], r2 = _a[1], r3 = _a[2], r4 = _a[3];
            context.moveTo(x + r1, y);
            context.lineTo(x + width - r2, y);
            r2 !== 0 && context.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);
            context.lineTo(x + width, y + height - r3);
            r3 !== 0 && context.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);
            context.lineTo(x + r4, y + height);
            r4 !== 0 && context.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);
            context.lineTo(x, y + r1);
            r1 !== 0 && context.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
            context.closePath();
        }
    };
    return Rect;
}(base_1.default));
exports.default = Rect;

},{"../util/in-path/point-in-path":146,"../util/in-stroke/rect":152,"../util/in-stroke/rect-radius":151,"../util/parse":153,"../util/util":155,"./base":129,"tslib":894}],140:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 文本
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var util_1 = require("../util/util");
var text_1 = require("@antv/g-base/lib/util/text");
var Text = /** @class */ (function (_super) {
    tslib_1.__extends(Text, _super);
    function Text() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // 默认文本属性
    Text.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, text: null, fontSize: 12, fontFamily: 'sans-serif', fontStyle: 'normal', fontWeight: 'normal', fontVariant: 'normal', textAlign: 'start', textBaseline: 'bottom' });
    };
    // 仅仅使用包围盒检测来进行拾取
    Text.prototype.isOnlyHitBox = function () {
        return true;
    };
    // 初始化时组合 font，同时判断 text 是否换行
    Text.prototype.initAttrs = function (attrs) {
        this._assembleFont();
        if (attrs.text) {
            this._setText(attrs.text);
        }
    };
    // 组装字体
    Text.prototype._assembleFont = function () {
        var attrs = this.attrs;
        attrs.font = text_1.assembleFont(attrs);
    };
    // 如果文本换行，则缓存数组
    Text.prototype._setText = function (text) {
        var textArr = null;
        if (util_1.isString(text) && text.indexOf('\n') !== -1) {
            textArr = text.split('\n');
        }
        this.set('textArr', textArr);
    };
    // 更新属性时，检测是否更改了 font、text
    Text.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        if (name.startsWith('font')) {
            this._assembleFont();
        }
        if (name === 'text') {
            this._setText(value);
        }
    };
    // 这个方法在 text 时没有可以做的事情，如果要支持文字背景时可以考虑
    // createPath(context) {
    // }
    // 如果文本多行，需要获取文本间距
    Text.prototype._getSpaceingY = function () {
        var attrs = this.attrs;
        var lineHeight = attrs.lineHeight;
        var fontSize = attrs.fontSize * 1;
        return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
    };
    // 绘制文本，考虑多行的场景
    Text.prototype._drawTextArr = function (context, textArr, isFill) {
        var attrs = this.attrs;
        var textBaseline = attrs.textBaseline;
        var x = attrs.x;
        var y = attrs.y;
        var fontSize = attrs.fontSize * 1;
        var spaceingY = this._getSpaceingY();
        var height = text_1.getTextHeight(attrs.text, attrs.fontSize, attrs.lineHeight);
        var subY;
        util_1.each(textArr, function (subText, index) {
            subY = y + index * (spaceingY + fontSize) - height + fontSize; // bottom;
            if (textBaseline === 'middle')
                subY += height - fontSize - (height - fontSize) / 2;
            if (textBaseline === 'top')
                subY += height - fontSize;
            if (isFill) {
                context.fillText(subText, x, subY);
            }
            else {
                context.strokeText(subText, x, subY);
            }
        });
    };
    // 绘制文本，同时考虑填充和绘制边框
    Text.prototype._drawText = function (context, isFill) {
        var attrs = this.attr();
        var x = attrs.x;
        var y = attrs.y;
        var textArr = this.get('textArr');
        if (textArr) {
            this._drawTextArr(context, textArr, isFill);
        }
        else {
            var text = attrs.text;
            if (isFill) {
                context.fillText(text, x, y);
            }
            else {
                context.strokeText(text, x, y);
            }
        }
    };
    // 复写绘制和填充的逻辑：对于文本，应该先绘制边框，再进行填充
    Text.prototype.strokeAndFill = function (context) {
        var _a = this.attrs, lineWidth = _a.lineWidth, opacity = _a.opacity, strokeOpacity = _a.strokeOpacity, fillOpacity = _a.fillOpacity;
        if (this.isStroke()) {
            if (lineWidth > 0) {
                if (!util_1.isNil(strokeOpacity) && strokeOpacity !== 1) {
                    context.globalAlpha = opacity;
                }
                this.stroke(context);
            }
        }
        if (this.isFill()) {
            if (!util_1.isNil(fillOpacity) && fillOpacity !== 1) {
                context.globalAlpha = fillOpacity;
                this.fill(context);
                context.globalAlpha = opacity;
            }
            else {
                this.fill(context);
            }
        }
        this.afterDrawPath(context);
    };
    // 复写填充逻辑
    Text.prototype.fill = function (context) {
        this._drawText(context, true);
    };
    // 复写绘制边框的逻辑
    Text.prototype.stroke = function (context) {
        this._drawText(context, false);
    };
    return Text;
}(base_1.default));
exports.default = Text;

},{"../util/util":155,"./base":129,"@antv/g-base/lib/util/text":122,"tslib":894}],141:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// 导出 g-base 中的 types
tslib_1.__exportStar(require("@antv/g-base/lib/types"), exports);

},{"@antv/g-base/lib/types":117,"tslib":894}],142:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
// 向量长度
function vMag(v) {
    return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
}
// u.v/|u||v|，计算夹角的余弦值
function vRatio(u, v) {
    // 当存在一个向量的长度为 0 时，夹角也为 0，即夹角的余弦值为 1
    return vMag(u) * vMag(v) ? (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)) : 1;
}
// 向量角度
function vAngle(u, v) {
    return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
}
// A 0:rx 1:ry 2:x-axis-rotation 3:large-arc-flag 4:sweep-flag 5: x 6: y
function getArcParams(startPoint, params) {
    var rx = params[1];
    var ry = params[2];
    var xRotation = util_1.mod(util_1.toRadian(params[3]), Math.PI * 2);
    var arcFlag = params[4];
    var sweepFlag = params[5];
    // 弧形起点坐标
    var x1 = startPoint[0];
    var y1 = startPoint[1];
    // 弧形终点坐标
    var x2 = params[6];
    var y2 = params[7];
    var xp = (Math.cos(xRotation) * (x1 - x2)) / 2.0 + (Math.sin(xRotation) * (y1 - y2)) / 2.0;
    var yp = (-1 * Math.sin(xRotation) * (x1 - x2)) / 2.0 + (Math.cos(xRotation) * (y1 - y2)) / 2.0;
    var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
    if (lambda > 1) {
        rx *= Math.sqrt(lambda);
        ry *= Math.sqrt(lambda);
    }
    var diff = rx * rx * (yp * yp) + ry * ry * (xp * xp);
    var f = diff ? Math.sqrt((rx * rx * (ry * ry) - diff) / diff) : 1;
    if (arcFlag === sweepFlag) {
        f *= -1;
    }
    if (isNaN(f)) {
        f = 0;
    }
    // 旋转前的起点坐标，且当长半轴和短半轴的长度为 0 时，坐标按 (0, 0) 处理
    var cxp = ry ? (f * rx * yp) / ry : 0;
    var cyp = rx ? (f * -ry * xp) / rx : 0;
    // 椭圆圆心坐标
    var cx = (x1 + x2) / 2.0 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp;
    var cy = (y1 + y2) / 2.0 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp;
    // 起始点的单位向量
    var u = [(xp - cxp) / rx, (yp - cyp) / ry];
    // 终止点的单位向量
    var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
    // 计算起始点和圆心的连线，与 x 轴正方向的夹角
    var theta = vAngle([1, 0], u);
    // 计算圆弧起始点和终止点与椭圆圆心连线的夹角
    var dTheta = vAngle(u, v);
    if (vRatio(u, v) <= -1) {
        dTheta = Math.PI;
    }
    if (vRatio(u, v) >= 1) {
        dTheta = 0;
    }
    if (sweepFlag === 0 && dTheta > 0) {
        dTheta = dTheta - 2 * Math.PI;
    }
    if (sweepFlag === 1 && dTheta < 0) {
        dTheta = dTheta + 2 * Math.PI;
    }
    return {
        cx: cx,
        cy: cy,
        // 弧形的起点和终点相同时，长轴和短轴的长度按 0 处理
        rx: util_1.isSamePoint(startPoint, [x2, y2]) ? 0 : rx,
        ry: util_1.isSamePoint(startPoint, [x2, y2]) ? 0 : ry,
        startAngle: theta,
        endAngle: theta + dTheta,
        xRotation: xRotation,
        arcFlag: arcFlag,
        sweepFlag: sweepFlag,
    };
}
exports.default = getArcParams;

},{"./util":155}],143:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addEndArrow = exports.addStartArrow = exports.getShortenOffset = void 0;
var tslib_1 = require("tslib");
var shape_1 = require("../shape");
var sin = Math.sin, cos = Math.cos, atan2 = Math.atan2, PI = Math.PI;
function _addDefaultArrow(shape, attrs, x1, y1, x2, y2, isStart) {
    var stroke = attrs.stroke, lineWidth = attrs.lineWidth;
    var x = x1 - x2;
    var y = y1 - y2;
    var rad = atan2(y, x);
    var arrowShape = new shape_1.Path({
        type: 'path',
        canvas: shape.get('canvas'),
        isArrowShape: true,
        attrs: {
            // 默认箭头的边长为 10，夹角为 60 度
            path: "M" + 10 * cos(PI / 6) + "," + 10 * sin(PI / 6) + " L0,0 L" + 10 * cos(PI / 6) + ",-" + 10 * sin(PI / 6),
            // 使用 shape stroke 值
            stroke: stroke,
            lineWidth: lineWidth,
        },
    });
    arrowShape.translate(x2, y2);
    arrowShape.rotateAtPoint(x2, y2, rad);
    shape.set(isStart ? 'startArrowShape' : 'endArrowShape', arrowShape);
}
/**
 * 箭头 path 的设置要求
 * 1. 箭头顶点坐标需要为 (0, 0)
 * 2. 箭头夹角的中心分割线需要与 X 轴正方向对齐
 */
function _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, isStart) {
    var startArrow = attrs.startArrow, endArrow = attrs.endArrow, stroke = attrs.stroke, lineWidth = attrs.lineWidth;
    var arrowAttrs = isStart ? startArrow : endArrow;
    var d = arrowAttrs.d, arrowFill = arrowAttrs.fill, arrowStroke = arrowAttrs.stroke, arrowLineWidth = arrowAttrs.lineWidth, restAttrs = tslib_1.__rest(arrowAttrs, ["d", "fill", "stroke", "lineWidth"]);
    var x = x1 - x2;
    var y = y1 - y2;
    var rad = atan2(y, x);
    if (d) {
        x2 = x2 - cos(rad) * d;
        y2 = y2 - sin(rad) * d;
    }
    var arrowShape = new shape_1.Path({
        type: 'path',
        canvas: shape.get('canvas'),
        isArrowShape: true,
        attrs: tslib_1.__assign(tslib_1.__assign({}, restAttrs), { 
            // 支持单独设置箭头的 stroke 和 lineWidth，若为空则使用 shape 的值
            stroke: arrowStroke || stroke, lineWidth: arrowLineWidth || lineWidth, 
            // 箭头是否填充需要手动设置，不会继承自 shape 的值
            fill: arrowFill }),
    });
    arrowShape.translate(x2, y2);
    arrowShape.rotateAtPoint(x2, y2, rad);
    shape.set(isStart ? 'startArrowShape' : 'endArrowShape', arrowShape);
}
/**
 * 如果自定义箭头并且有 d 需要做偏移，如果直接画，线条会超出箭头尖端，因此需要根据箭头偏移 d, 返回线需要缩短的距离
 * |----------------
 * |<|--------------
 * |
 * @param {number} x1 起始点 x
 * @param {number} y1 起始点 y
 * @param {number} x2 箭头作用点 x
 * @param {number} y2 箭头作用点 y
 * @param {number} d  箭头沿线条方向的偏移距离
 * @return {{dx: number, dy: number}} 返回线条偏移距离
 */
function getShortenOffset(x1, y1, x2, y2, d) {
    var rad = atan2(y2 - y1, x2 - x1);
    return {
        dx: cos(rad) * d,
        dy: sin(rad) * d,
    };
}
exports.getShortenOffset = getShortenOffset;
/**
 * 绘制起始箭头
 * @param {IShape} shape 图形
 * @param {ShapeAttrs} attrs shape 的绘图属性
 * @param {number} x1 起始点 x
 * @param {number} y1 起始点 y
 * @param {number} x2 箭头作用点 x
 * @param {number} y2 箭头作用点 y
 */
function addStartArrow(shape, attrs, x1, y1, x2, y2) {
    if (typeof attrs.startArrow === 'object') {
        _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, true);
    }
    else if (attrs.startArrow) {
        _addDefaultArrow(shape, attrs, x1, y1, x2, y2, true);
    }
    else {
        shape.set('startArrowShape', null);
    }
}
exports.addStartArrow = addStartArrow;
/**
 * 绘制结束箭头
 * @param {IShape} shape 图形
 * @param {ShapeAttrs} attrs shape 的绘图属性
 * @param {number} x1 起始点 x
 * @param {number} y1 起始点 y
 * @param {number} x2 箭头作用点 x
 * @param {number} y2 箭头作用点 y
 */
function addEndArrow(shape, attrs, x1, y1, x2, y2) {
    if (typeof attrs.endArrow === 'object') {
        _addCustomizedArrow(shape, attrs, x1, y1, x2, y2, false);
    }
    else if (attrs.endArrow) {
        _addDefaultArrow(shape, attrs, x1, y1, x2, y2, false);
    }
    else {
        shape.set('startArrowShape', null);
    }
}
exports.addEndArrow = addEndArrow;

},{"../shape":133,"tslib":894}],144:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeView = exports.getMergedRegion = exports.getRefreshRegion = exports.refreshElement = exports.drawPath = exports.drawChildren = exports.applyAttrsToContext = void 0;
var util_1 = require("@antv/util");
var parse_1 = require("./parse");
var arc_params_1 = require("./arc-params");
var util_2 = require("./util");
var ArrowUtil = require("../util/arrow");
var SHAPE_ATTRS_MAP = {
    fill: 'fillStyle',
    stroke: 'strokeStyle',
    opacity: 'globalAlpha',
};
function applyAttrsToContext(context, element) {
    var attrs = element.attr();
    for (var k in attrs) {
        var v = attrs[k];
        // 转换一下不与 canvas 兼容的属性名
        var name_1 = SHAPE_ATTRS_MAP[k] ? SHAPE_ATTRS_MAP[k] : k;
        if (name_1 === 'matrix' && v) {
            // 设置矩阵
            context.transform(v[0], v[1], v[3], v[4], v[6], v[7]);
        }
        else if (name_1 === 'lineDash' && context.setLineDash) {
            // 设置虚线，只支持数组形式，非数组形式不做任何操作
            util_1.isArray(v) && context.setLineDash(v);
        }
        else {
            if (name_1 === 'strokeStyle' || name_1 === 'fillStyle') {
                // 如果存在渐变、pattern 这个开销有些大
                // 可以考虑缓存机制，通过 hasUpdate 来避免一些运算
                v = parse_1.parseStyle(context, element, v);
            }
            else if (name_1 === 'globalAlpha') {
                // opacity 效果可以叠加，子元素的 opacity 需要与父元素 opacity 相乘
                v = v * context.globalAlpha;
            }
            context[name_1] = v;
        }
    }
}
exports.applyAttrsToContext = applyAttrsToContext;
function drawChildren(context, children, region) {
    for (var i = 0; i < children.length; i++) {
        var child = children[i];
        if (child.get('visible')) {
            child.draw(context, region);
        }
        else {
            child.skipDraw();
        }
    }
}
exports.drawChildren = drawChildren;
// 绘制 path
function drawPath(shape, context, attrs, arcParamsCache) {
    var path = attrs.path, startArrow = attrs.startArrow, endArrow = attrs.endArrow;
    var currentPoint = [0, 0]; // 当前图形
    var startMovePoint = [0, 0]; // 开始 M 的点，可能会有多个
    var distance = {
        dx: 0,
        dy: 0,
    };
    context.beginPath();
    for (var i = 0; i < path.length; i++) {
        var params = path[i];
        var command = params[0];
        if (i === 0 && startArrow && startArrow.d) {
            var tangent = shape.getStartTangent();
            distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], startArrow.d);
        }
        else if (i === path.length - 2 && path[i + 1][0] === 'Z' && endArrow && endArrow.d) {
            // 为了防止结尾为 Z 的 segment 缩短不起效，需要取最后两个 segment 特殊处理
            var lastPath = path[i + 1];
            if (lastPath[0] === 'Z') {
                var tangent = shape.getEndTangent();
                distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d);
            }
        }
        else if (i === path.length - 1 && endArrow && endArrow.d) {
            if (path[0] !== 'Z') {
                var tangent = shape.getEndTangent();
                distance = ArrowUtil.getShortenOffset(tangent[0][0], tangent[0][1], tangent[1][0], tangent[1][1], endArrow.d);
            }
        }
        var dx = distance.dx, dy = distance.dy;
        // V,H,S,T 都在前面被转换成标准形式
        switch (command) {
            case 'M':
                context.moveTo(params[1] - dx, params[2] - dy);
                startMovePoint = [params[1], params[2]];
                break;
            case 'L':
                context.lineTo(params[1] - dx, params[2] - dy);
                break;
            case 'Q':
                context.quadraticCurveTo(params[1], params[2], params[3] - dx, params[4] - dy);
                break;
            case 'C':
                context.bezierCurveTo(params[1], params[2], params[3], params[4], params[5] - dx, params[6] - dy);
                break;
            case 'A': {
                var arcParams = void 0;
                // 为了加速绘制，可以提供参数的缓存，各个图形自己缓存
                if (arcParamsCache) {
                    arcParams = arcParamsCache[i];
                    if (!arcParams) {
                        arcParams = arc_params_1.default(currentPoint, params);
                        arcParamsCache[i] = arcParams;
                    }
                }
                else {
                    arcParams = arc_params_1.default(currentPoint, params);
                }
                var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation, sweepFlag = arcParams.sweepFlag;
                // 直接使用椭圆的 api
                if (context.ellipse) {
                    context.ellipse(cx, cy, rx, ry, xRotation, startAngle, endAngle, 1 - sweepFlag);
                }
                else {
                    var r = rx > ry ? rx : ry;
                    var scaleX = rx > ry ? 1 : rx / ry;
                    var scaleY = rx > ry ? ry / rx : 1;
                    context.translate(cx, cy);
                    context.rotate(xRotation);
                    context.scale(scaleX, scaleY);
                    context.arc(0, 0, r, startAngle, endAngle, 1 - sweepFlag);
                    context.scale(1 / scaleX, 1 / scaleY);
                    context.rotate(-xRotation);
                    context.translate(-cx, -cy);
                }
                break;
            }
            case 'Z':
                context.closePath();
                break;
            default:
                break;
        }
        // 有了 Z 后，当前节点从开始 M 的点开始
        if (command === 'Z') {
            currentPoint = startMovePoint;
        }
        else {
            var len = params.length;
            currentPoint = [params[len - 2], params[len - 1]];
        }
    }
}
exports.drawPath = drawPath;
// 刷新图形元素(Shape 或者 Group)
function refreshElement(element, changeType) {
    var canvas = element.get('canvas');
    // 只有存在于 canvas 上时生效
    if (canvas) {
        if (changeType === 'remove') {
            // 一旦 remove，则无法在 element 上拿到包围盒
            // destroy 后所有属性都拿不到，所以需要暂存一下
            // 这是一段 hack 的代码
            element._cacheCanvasBBox = element.get('cacheCanvasBBox');
        }
        // 防止反复刷新
        if (!element.get('hasChanged')) {
            // 本来只有局部渲染模式下，才需要记录更新的元素队列
            // if (canvas.get('localRefresh')) {
            //   canvas.refreshElement(element, changeType, canvas);
            // }
            // 但对于 https://github.com/antvis/g/issues/422 的场景，全局渲染的模式下也需要记录更新的元素队列
            canvas.refreshElement(element, changeType, canvas);
            if (canvas.get('autoDraw')) {
                canvas.draw();
            }
            element.set('hasChanged', true);
        }
    }
}
exports.refreshElement = refreshElement;
function getRefreshRegion(element) {
    var region;
    if (!element.destroyed) {
        var cacheBox = element.get('cacheCanvasBBox');
        var validCache = cacheBox && !!(cacheBox.width && cacheBox.height);
        var bbox = element.getCanvasBBox();
        var validBBox = bbox && !!(bbox.width && bbox.height);
        // 是否是有效 bbox 判定，一些 NaN 或者 宽高为 0 的情况过滤掉
        if (validCache && validBBox) {
            region = util_2.mergeRegion(cacheBox, bbox);
        }
        else if (validCache) {
            region = cacheBox;
        }
        else if (validBBox) {
            region = bbox;
        }
    }
    else {
        // 因为元素已经销毁所以无法获取到缓存的包围盒
        region = element['_cacheCanvasBBox'];
    }
    return region;
}
exports.getRefreshRegion = getRefreshRegion;
function getMergedRegion(elements) {
    if (!elements.length) {
        return null;
    }
    var minXArr = [];
    var minYArr = [];
    var maxXArr = [];
    var maxYArr = [];
    util_1.each(elements, function (el) {
        var region = getRefreshRegion(el);
        if (region) {
            minXArr.push(region.minX);
            minYArr.push(region.minY);
            maxXArr.push(region.maxX);
            maxYArr.push(region.maxY);
        }
    });
    return {
        minX: Math.min.apply(null, minXArr),
        minY: Math.min.apply(null, minYArr),
        maxX: Math.max.apply(null, maxXArr),
        maxY: Math.max.apply(null, maxYArr),
    };
}
exports.getMergedRegion = getMergedRegion;
function mergeView(region, viewRegion) {
    if (!region || !viewRegion) {
        return null;
    }
    // 不相交，则直接返回 null
    if (!util_2.intersectRect(region, viewRegion)) {
        return null;
    }
    return {
        minX: Math.max(region.minX, viewRegion.minX),
        minY: Math.max(region.minY, viewRegion.minY),
        maxX: Math.min(region.maxX, viewRegion.maxX),
        maxY: Math.min(region.maxY, viewRegion.maxY),
    };
}
exports.mergeView = mergeView;

},{"../util/arrow":143,"./arc-params":142,"./parse":153,"./util":155,"@antv/util":803}],145:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getShape = void 0;
var util_1 = require("@antv/g-base/lib/util/util");
var matrix_1 = require("@antv/g-base/lib/util/matrix");
function invertFromMatrix(v, matrix) {
    if (matrix) {
        var invertMatrix = matrix_1.invert(matrix);
        return matrix_1.multiplyVec2(invertMatrix, v);
    }
    return v;
}
function getRefXY(element, x, y) {
    // @ts-ignore
    var totalMatrix = element.getTotalMatrix();
    if (totalMatrix) {
        var _a = invertFromMatrix([x, y, 1], totalMatrix), refX = _a[0], refY = _a[1];
        return [refX, refY];
    }
    return [x, y];
}
// 拾取前的检测，只有通过检测才能继续拾取
function preTest(element, x, y) {
    // @ts-ignore
    if (element.isCanvas && element.isCanvas()) {
        return true;
    }
    // 不允许被拾取，则返回 null
    // @ts-ignore
    if (!util_1.isAllowCapture(element) && element.cfg.isInView === false) {
        return false;
    }
    if (element.cfg.clipShape) {
        // 如果存在 clip
        var _a = getRefXY(element, x, y), refX = _a[0], refY = _a[1];
        if (element.isClipped(refX, refY)) {
            return false;
        }
    }
    // @ts-ignore ，这个地方调用过于频繁
    var bbox = element.cfg.cacheCanvasBBox;
    if (!bbox) {
        bbox = element.getCanvasBBox();
    }
    if (!(x >= bbox.minX && x <= bbox.maxX && y >= bbox.minY && y <= bbox.maxY)) {
        return false;
    }
    return true;
}
function getShape(container, x, y) {
    // 没有通过检测，则返回 null
    if (!preTest(container, x, y)) {
        return null;
    }
    var shape = null;
    var children = container.getChildren();
    var count = children.length;
    for (var i = count - 1; i >= 0; i--) {
        var child = children[i];
        if (child.isGroup()) {
            shape = getShape(child, x, y);
        }
        else if (preTest(child, x, y)) {
            var curShape = child;
            var _a = getRefXY(child, x, y), refX = _a[0], refY = _a[1];
            // @ts-ignore
            if (curShape.isInShape(refX, refY)) {
                shape = child;
            }
        }
        if (shape) {
            break;
        }
    }
    return shape;
}
exports.getShape = getShape;

},{"@antv/g-base/lib/util/matrix":119,"@antv/g-base/lib/util/util":123}],146:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var offscreen_1 = require("@antv/g-base/lib/util/offscreen");
function isPointInPath(shape, x, y) {
    var ctx = offscreen_1.getOffScreenContext();
    shape.createPath(ctx);
    return ctx.isPointInPath(x, y);
}
exports.default = isPointInPath;

},{"@antv/g-base/lib/util/offscreen":120}],147:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 判断点是否在多边形内
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
// 多边形的射线检测，参考：https://blog.csdn.net/WilliamSun0122/article/details/77994526
var tolerance = 1e-6;
// 三态函数，判断两个double在eps精度下的大小关系
function dcmp(x) {
    if (Math.abs(x) < tolerance) {
        return 0;
    }
    return x < 0 ? -1 : 1;
}
// 判断点Q是否在p1和p2的线段上
function onSegment(p1, p2, q) {
    if ((q[0] - p1[0]) * (p2[1] - p1[1]) === (p2[0] - p1[0]) * (q[1] - p1[1]) &&
        Math.min(p1[0], p2[0]) <= q[0] &&
        q[0] <= Math.max(p1[0], p2[0]) &&
        Math.min(p1[1], p2[1]) <= q[1] &&
        q[1] <= Math.max(p1[1], p2[1])) {
        return true;
    }
    return false;
}
// 判断点P在多边形内-射线法
function isInPolygon(points, x, y) {
    var isHit = false;
    var n = points.length;
    if (n <= 2) {
        // svg 中点小于 3 个时，不显示，也无法被拾取
        return false;
    }
    for (var i = 0; i < n; i++) {
        var p1 = points[i];
        var p2 = points[(i + 1) % n];
        if (onSegment(p1, p2, [x, y])) {
            // 点在多边形一条边上
            return true;
        }
        // 前一个判断min(p1[1],p2[1])<P.y<=max(p1[1],p2[1])
        // 后一个判断被测点 在 射线与边交点 的左边
        if (dcmp(p1[1] - y) > 0 !== dcmp(p2[1] - y) > 0 &&
            dcmp(x - ((y - p1[1]) * (p1[0] - p2[0])) / (p1[1] - p2[1]) - p1[0]) < 0) {
            isHit = !isHit;
        }
    }
    return isHit;
}
exports.default = isInPolygon;

},{}],148:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("../util");
function arc(cx, cy, r, startAngle, endAngle, lineWidth, x, y) {
    var angle = (Math.atan2(y - cy, x - cx) + Math.PI * 2) % (Math.PI * 2); // 转换到 0 - 2 * Math.PI 之间
    if (angle < startAngle || angle > endAngle) {
        return false;
    }
    var point = {
        x: cx + r * Math.cos(angle),
        y: cy + r * Math.sin(angle),
    };
    return util_1.distance(point.x, point.y, x, y) <= lineWidth / 2;
}
exports.default = arc;

},{"../util":155}],149:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("@antv/g-math/lib/line");
function inLine(x1, y1, x2, y2, lineWidth, x, y) {
    var minX = Math.min(x1, x2);
    var maxX = Math.max(x1, x2);
    var minY = Math.min(y1, y2);
    var maxY = Math.max(y1, y2);
    var halfWidth = lineWidth / 2;
    // 因为目前的方案是计算点到直线的距离，而有可能会在延长线上，所以要先判断是否在包围盒内
    // 这种方案会在水平或者竖直的情况下载线的延长线上有半 lineWidth 的误差
    if (!(x >= minX - halfWidth && x <= maxX + halfWidth && y >= minY - halfWidth && y <= maxY + halfWidth)) {
        return false;
    }
    // 因为已经计算了包围盒，所以仅需要计算到直线的距离即可，可以显著提升性能
    return line_1.default.pointToLine(x1, y1, x2, y2, x, y) <= lineWidth / 2;
}
exports.default = inLine;

},{"@antv/g-math/lib/line":172}],150:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
function inPolyline(points, lineWidth, x, y, isClose) {
    var count = points.length;
    if (count < 2) {
        return false;
    }
    for (var i = 0; i < count - 1; i++) {
        var x1 = points[i][0];
        var y1 = points[i][1];
        var x2 = points[i + 1][0];
        var y2 = points[i + 1][1];
        if (line_1.default(x1, y1, x2, y2, lineWidth, x, y)) {
            return true;
        }
    }
    // 如果封闭，则计算起始点和结束点的边
    if (isClose) {
        var first = points[0];
        var last = points[count - 1];
        if (line_1.default(first[0], first[1], last[0], last[1], lineWidth, x, y)) {
            return true;
        }
    }
    return false;
}
exports.default = inPolyline;

},{"./line":149}],151:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
var arc_1 = require("./arc");
function rectWithRadius(minX, minY, width, height, radius, lineWidth, x, y) {
    var halfWidth = lineWidth / 2;
    return (line_1.default(minX + radius, minY, minX + width - radius, minY, lineWidth, x, y) ||
        line_1.default(minX + width, minY + radius, minX + width, minY + height - radius, lineWidth, x, y) ||
        line_1.default(minX + width - radius, minY + height, minX + radius, minY + height, lineWidth, x, y) ||
        line_1.default(minX, minY + height - radius, minX, minY + radius, lineWidth, x, y) ||
        arc_1.default(minX + width - radius, minY + radius, radius, 1.5 * Math.PI, 2 * Math.PI, lineWidth, x, y) ||
        arc_1.default(minX + width - radius, minY + height - radius, radius, 0, 0.5 * Math.PI, lineWidth, x, y) ||
        arc_1.default(minX + radius, minY + height - radius, radius, 0.5 * Math.PI, Math.PI, lineWidth, x, y) ||
        arc_1.default(minX + radius, minY + radius, radius, Math.PI, 1.5 * Math.PI, lineWidth, x, y));
}
exports.default = rectWithRadius;

},{"./arc":148,"./line":149}],152:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("../util");
function inRect(minX, minY, width, height, lineWidth, x, y) {
    var halfWidth = lineWidth / 2;
    // 将四个边看做矩形来检测，比边的检测算法要快
    return (util_1.inBox(minX - halfWidth, minY - halfWidth, width, lineWidth, x, y) || // 上边
        util_1.inBox(minX + width - halfWidth, minY - halfWidth, lineWidth, height, x, y) || // 右边
        util_1.inBox(minX + halfWidth, minY + height - halfWidth, width, lineWidth, x, y) || // 下边
        util_1.inBox(minX - halfWidth, minY + halfWidth, lineWidth, height, x, y)); // 左边
}
exports.default = inRect;

},{"../util":155}],153:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseRadius = exports.parseStyle = exports.parsePattern = exports.parseRadialGradient = exports.parseLineGradient = void 0;
var util_1 = require("./util");
var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi;
var regexDot = /[^\s\,]+/gi;
var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
function addStop(steps, gradient) {
    var arr = steps.match(regexColorStop);
    util_1.each(arr, function (item) {
        var itemArr = item.split(':');
        gradient.addColorStop(itemArr[0], itemArr[1]);
    });
}
/**
 * 将边和填充设置的颜色转换成线性渐变对象
 * @param {CanvasRenderingContext2D} context canvas 上下文
 * @param {IElement}                 element  图形元素
 * @param {string}                   gradientStr   颜色
 * @returns {any} 渐变对象
 */
function parseLineGradient(context, element, gradientStr) {
    var arr = regexLG.exec(gradientStr);
    var angle = (parseFloat(arr[1]) % 360) * (Math.PI / 180);
    var steps = arr[2];
    var box = element.getBBox();
    var start;
    var end;
    if (angle >= 0 && angle < (1 / 2) * Math.PI) {
        start = {
            x: box.minX,
            y: box.minY,
        };
        end = {
            x: box.maxX,
            y: box.maxY,
        };
    }
    else if ((1 / 2) * Math.PI <= angle && angle < Math.PI) {
        start = {
            x: box.maxX,
            y: box.minY,
        };
        end = {
            x: box.minX,
            y: box.maxY,
        };
    }
    else if (Math.PI <= angle && angle < (3 / 2) * Math.PI) {
        start = {
            x: box.maxX,
            y: box.maxY,
        };
        end = {
            x: box.minX,
            y: box.minY,
        };
    }
    else {
        start = {
            x: box.minX,
            y: box.maxY,
        };
        end = {
            x: box.maxX,
            y: box.minY,
        };
    }
    var tanTheta = Math.tan(angle);
    var tanTheta2 = tanTheta * tanTheta;
    var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
    var y = (tanTheta * (end.x - start.x + tanTheta * (end.y - start.y))) / (tanTheta2 + 1) + start.y;
    var gradient = context.createLinearGradient(start.x, start.y, x, y);
    addStop(steps, gradient);
    return gradient;
}
exports.parseLineGradient = parseLineGradient;
/**
 * 将边和填充设置的颜色转换成圆形渐变对象
 * @param {CanvasRenderingContext2D} context canvas 上下文
 * @param {IElement}                 element  图形元素
 * @param {string}                   gradientStr   颜色
 * @returns {any} 渐变对象
 */
function parseRadialGradient(context, element, gradientStr) {
    var arr = regexRG.exec(gradientStr);
    var fx = parseFloat(arr[1]);
    var fy = parseFloat(arr[2]);
    var fr = parseFloat(arr[3]);
    var steps = arr[4];
    // 环半径为0时，默认无渐变，取渐变序列的最后一个颜色
    if (fr === 0) {
        var colors = steps.match(regexColorStop);
        return colors[colors.length - 1].split(':')[1];
    }
    var box = element.getBBox();
    var width = box.maxX - box.minX;
    var height = box.maxY - box.minY;
    var r = Math.sqrt(width * width + height * height) / 2;
    var gradient = context.createRadialGradient(box.minX + width * fx, box.minY + height * fy, 0, box.minX + width / 2, box.minY + height / 2, fr * r);
    addStop(steps, gradient);
    return gradient;
}
exports.parseRadialGradient = parseRadialGradient;
/**
 * 边和填充设置的颜色转换成 pattern
 * @param {CanvasRenderingContext2D} context canvas 上下文
 * @param {IElement}                 element  图形元素
 * @param {string}                   patternStr   生成 pattern 的字符串
 */
function parsePattern(context, element, patternStr) {
    // 在转换过程中进行了缓存
    if (element.get('patternSource') && element.get('patternSource') === patternStr) {
        return element.get('pattern');
    }
    var pattern;
    var img;
    var arr = regexPR.exec(patternStr);
    var repeat = arr[1];
    var source = arr[2];
    // Function to be called when pattern loads
    function onload() {
        // Create pattern
        pattern = context.createPattern(img, repeat);
        element.set('pattern', pattern); // be a cache
        element.set('patternSource', patternStr);
    }
    switch (repeat) {
        case 'a':
            repeat = 'repeat';
            break;
        case 'x':
            repeat = 'repeat-x';
            break;
        case 'y':
            repeat = 'repeat-y';
            break;
        case 'n':
            repeat = 'no-repeat';
            break;
        default:
            repeat = 'no-repeat';
    }
    img = new Image();
    // If source URL is not a data URL
    if (!source.match(/^data:/i)) {
        // Set crossOrigin for this image
        img.crossOrigin = 'Anonymous';
    }
    img.src = source;
    if (img.complete) {
        onload();
    }
    else {
        img.onload = onload;
        // Fix onload() bug in IE9
        img.src = img.src;
    }
    return pattern;
}
exports.parsePattern = parsePattern;
function parseStyle(context, element, color) {
    if (util_1.isString(color)) {
        if (color[1] === '(' || color[2] === '(') {
            if (color[0] === 'l') {
                // regexLG.test(color)
                return parseLineGradient(context, element, color);
            }
            if (color[0] === 'r') {
                // regexRG.test(color)
                return parseRadialGradient(context, element, color);
            }
            if (color[0] === 'p') {
                // regexPR.test(color)
                return parsePattern(context, element, color);
            }
        }
        return color;
    }
}
exports.parseStyle = parseStyle;
function parseRadius(radius) {
    var r1 = 0;
    var r2 = 0;
    var r3 = 0;
    var r4 = 0;
    if (util_1.isArray(radius)) {
        if (radius.length === 1) {
            r1 = r2 = r3 = r4 = radius[0];
        }
        else if (radius.length === 2) {
            r1 = r3 = radius[0];
            r2 = r4 = radius[1];
        }
        else if (radius.length === 3) {
            r1 = radius[0];
            r2 = r4 = radius[1];
            r3 = radius[2];
        }
        else {
            r1 = radius[0];
            r2 = radius[1];
            r3 = radius[2];
            r4 = radius[3];
        }
    }
    else {
        r1 = r2 = r3 = r4 = radius;
    }
    return [r1, r2, r3, r4];
}
exports.parseRadius = parseRadius;

},{"./util":155}],154:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @fileoverview path 的一些工具
 * @author dxq613@gmail.com
 */
var g_base_1 = require("@antv/g-base");
var quadratic_1 = require("@antv/g-math/lib/quadratic");
var cubic_1 = require("@antv/g-math/lib/cubic");
var util_1 = require("./util");
var line_1 = require("./in-stroke/line");
var arc_1 = require("./in-stroke/arc");
var mat3 = require("gl-matrix/mat3");
var vec3 = require("gl-matrix/vec3");
function hasArc(path) {
    var hasArc = false;
    var count = path.length;
    for (var i = 0; i < count; i++) {
        var params = path[i];
        var cmd = params[0];
        if (cmd === 'C' || cmd === 'A' || cmd === 'Q') {
            hasArc = true;
            break;
        }
    }
    return hasArc;
}
function isPointInStroke(segments, lineWidth, x, y) {
    var isHit = false;
    var halfWidth = lineWidth / 2;
    for (var i = 0; i < segments.length; i++) {
        var segment = segments[i];
        var currentPoint = segment.currentPoint, params = segment.params, prePoint = segment.prePoint, box = segment.box;
        // 如果在前面已经生成过包围盒，直接按照包围盒计算
        if (box && !util_1.inBox(box.x - halfWidth, box.y - halfWidth, box.width + lineWidth, box.height + lineWidth, x, y)) {
            continue;
        }
        switch (segment.command) {
            // L 和 Z 都是直线， M 不进行拾取
            case 'L':
            case 'Z':
                isHit = line_1.default(prePoint[0], prePoint[1], currentPoint[0], currentPoint[1], lineWidth, x, y);
                break;
            case 'Q':
                var qDistance = quadratic_1.default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], x, y);
                isHit = qDistance <= lineWidth / 2;
                break;
            case 'C':
                var cDistance = cubic_1.default.pointDistance(prePoint[0], prePoint[1], params[1], params[2], params[3], params[4], params[5], params[6], x, y);
                isHit = cDistance <= lineWidth / 2;
                break;
            case 'A':
                // 计算点到椭圆圆弧的距离，暂时使用近似算法，后面可以改成切割法求最近距离
                var arcParams = segment.arcParams;
                var cx = arcParams.cx, cy = arcParams.cy, rx = arcParams.rx, ry = arcParams.ry, startAngle = arcParams.startAngle, endAngle = arcParams.endAngle, xRotation = arcParams.xRotation;
                var p = [x, y, 1];
                var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
                var r = rx > ry ? rx : ry;
                var scaleX = rx > ry ? 1 : rx / ry;
                var scaleY = rx > ry ? ry / rx : 1;
                mat3.translate(m, m, [-cx, -cy]);
                mat3.rotate(m, m, -xRotation);
                mat3.scale(m, m, [1 / scaleX, 1 / scaleY]);
                vec3.transformMat3(p, p, m);
                isHit = arc_1.default(0, 0, r, startAngle, endAngle, lineWidth, p[0], p[1]);
                break;
            default:
                break;
        }
        if (isHit) {
            break;
        }
    }
    return isHit;
}
/**
 * 提取出内部的闭合多边形和非闭合的多边形，假设 path 不存在圆弧
 * @param {Array} path 路径
 * @returns {Array} 点的集合
 */
function extractPolygons(path) {
    var count = path.length;
    var polygons = [];
    var polylines = [];
    var points = []; // 防止第一个命令不是 'M'
    for (var i = 0; i < count; i++) {
        var params = path[i];
        var cmd = params[0];
        if (cmd === 'M') {
            // 遇到 'M' 判定是否是新数组，新数组中没有点
            if (points.length) {
                // 如果存在点，则说明没有遇到 'Z'，开始了一个新的多边形
                polylines.push(points);
                points = []; // 创建新的点
            }
            points.push([params[1], params[2]]);
        }
        else if (cmd === 'Z') {
            if (points.length) {
                // 存在点
                polygons.push(points);
                points = []; // 开始新的点集合
            }
            // 如果不存在点，同时 'Z'，则说明是错误，不处理
        }
        else {
            points.push([params[1], params[2]]);
        }
    }
    // 说明 points 未放入 polygons 或者 polyline
    // 仅当只有一个 M，没有 Z 时会发生这种情况
    if (points.length > 0) {
        polylines.push(points);
    }
    return {
        polygons: polygons,
        polylines: polylines,
    };
}
exports.default = tslib_1.__assign({ hasArc: hasArc,
    extractPolygons: extractPolygons,
    isPointInStroke: isPointInStroke }, g_base_1.PathUtil);

},{"./in-stroke/arc":148,"./in-stroke/line":149,"./util":155,"@antv/g-base":115,"@antv/g-math/lib/cubic":170,"@antv/g-math/lib/quadratic":174,"gl-matrix/mat3":886,"gl-matrix/vec3":891,"tslib":894}],155:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSamePoint = exports.mergeRegion = exports.intersectRect = exports.inBox = exports.distance = exports.getPixelRatio = void 0;
function getPixelRatio() {
    return window ? window.devicePixelRatio : 1;
}
exports.getPixelRatio = getPixelRatio;
/**
 * 两点之间的距离
 * @param {number} x1 起始点 x
 * @param {number} y1 起始点 y
 * @param {number} x2 结束点 x
 * @param {number} y2 结束点 y
 */
function distance(x1, y1, x2, y2) {
    var dx = x1 - x2;
    var dy = y1 - y2;
    return Math.sqrt(dx * dx + dy * dy);
}
exports.distance = distance;
/**
 * 是否在包围盒内
 * @param {number} minX   包围盒开始的点 x
 * @param {number} minY   包围盒开始的点 y
 * @param {number} width  宽度
 * @param {number} height 高度
 * @param {[type]} x      检测点的 x
 * @param {[type]} y      监测点的 y
 */
function inBox(minX, minY, width, height, x, y) {
    return x >= minX && x <= minX + width && y >= minY && y <= minY + height;
}
exports.inBox = inBox;
function intersectRect(box1, box2) {
    return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
exports.intersectRect = intersectRect;
// 合并两个区域
function mergeRegion(region1, region2) {
    if (!region1 || !region2) {
        return region1 || region2;
    }
    return {
        minX: Math.min(region1.minX, region2.minX),
        minY: Math.min(region1.minY, region2.minY),
        maxX: Math.max(region1.maxX, region2.maxX),
        maxY: Math.max(region1.maxY, region2.maxY),
    };
}
exports.mergeRegion = mergeRegion;
/**
 * 判断两个点是否重合，点坐标的格式为 [x, y]
 * @param {Array} point1 第一个点
 * @param {Array} point2 第二个点
 */
function isSamePoint(point1, point2) {
    return point1[0] === point2[0] && point1[1] === point2[1];
}
exports.isSamePoint = isSamePoint;
var is_nil_1 = require("@antv/util/lib/is-nil");
Object.defineProperty(exports, "isNil", { enumerable: true, get: function () { return is_nil_1.default; } });
var is_string_1 = require("@antv/util/lib/is-string");
Object.defineProperty(exports, "isString", { enumerable: true, get: function () { return is_string_1.default; } });
var is_function_1 = require("@antv/util/lib/is-function");
Object.defineProperty(exports, "isFunction", { enumerable: true, get: function () { return is_function_1.default; } });
var is_array_1 = require("@antv/util/lib/is-array");
Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return is_array_1.default; } });
var each_1 = require("@antv/util/lib/each");
Object.defineProperty(exports, "each", { enumerable: true, get: function () { return each_1.default; } });
var to_radian_1 = require("@antv/util/lib/to-radian");
Object.defineProperty(exports, "toRadian", { enumerable: true, get: function () { return to_radian_1.default; } });
var mod_1 = require("@antv/util/lib/mod");
Object.defineProperty(exports, "mod", { enumerable: true, get: function () { return mod_1.default; } });
var is_number_equal_1 = require("@antv/util/lib/is-number-equal");
Object.defineProperty(exports, "isNumberEqual", { enumerable: true, get: function () { return is_number_equal_1.default; } });
var request_animation_frame_1 = require("@antv/util/lib/request-animation-frame");
Object.defineProperty(exports, "requestAnimationFrame", { enumerable: true, get: function () { return request_animation_frame_1.default; } });
var clear_animation_frame_1 = require("@antv/util/lib/clear-animation-frame");
Object.defineProperty(exports, "clearAnimationFrame", { enumerable: true, get: function () { return clear_animation_frame_1.default; } });

},{"@antv/util/lib/clear-animation-frame":772,"@antv/util/lib/each":778,"@antv/util/lib/is-array":806,"@antv/util/lib/is-function":817,"@antv/util/lib/is-nil":821,"@antv/util/lib/is-number-equal":823,"@antv/util/lib/is-string":832,"@antv/util/lib/mod":845,"@antv/util/lib/request-animation-frame":854,"@antv/util/lib/to-radian":865}],156:[function(require,module,exports){
module.exports={
  "__npminstall_done": false,
  "_args": [
    [
      "@antv/g-canvas@0.4.14",
      "C:\\xampp\\htdocs\\icehrm\\web"
    ]
  ],
  "_from": "@antv/g-canvas@0.4.14",
  "_id": "@antv/g-canvas@0.4.14",
  "_inBundle": false,
  "_integrity": "sha512-BPpEbHvszEPQHhssPQrIOF2zKztiogabhiBQ/MCX3qvLUXgBRRzN6ktwS816fQPa82RYiGUmzEUDhgCXUWXAcg==",
  "_location": "/@antv/g-canvas",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "@antv/g-canvas@0.4.14",
    "name": "@antv/g-canvas",
    "escapedName": "@antv%2fg-canvas",
    "scope": "@antv",
    "rawSpec": "0.4.14",
    "saveSpec": null,
    "fetchSpec": "0.4.14"
  },
  "_requiredBy": [
    "/@antv/g2",
    "/@antv/g2plot"
  ],
  "_resolved": "https://registry.npmjs.org/@antv/g-canvas/-/g-canvas-0.4.14.tgz",
  "_spec": "0.4.14",
  "_where": "C:\\xampp\\htdocs\\icehrm\\web",
  "author": {
    "name": "https://github.com/orgs/antvis/people"
  },
  "bugs": {
    "url": "https://github.com/antvis/g/issues"
  },
  "dependencies": {
    "@antv/g-base": "^0.4.7",
    "@antv/g-math": "^0.1.3",
    "@antv/path-util": "~2.0.5",
    "@antv/util": "~2.0.0",
    "gl-matrix": "^3.0.0"
  },
  "description": "A canvas library which providing 2d",
  "devDependencies": {
    "@antv/torch": "^1.0.0",
    "less": "^3.9.0",
    "npm-run-all": "^4.1.5",
    "webpack": "^4.26.1",
    "webpack-cli": "^3.1.2"
  },
  "files": [
    "package.json",
    "esm",
    "lib",
    "dist",
    "LICENSE",
    "README.md"
  ],
  "gitHead": "6b4107c8cfae1b893c385758ad8e870236f73f6b",
  "homepage": "https://github.com/antvis/g#readme",
  "keywords": [
    "util",
    "antv",
    "g"
  ],
  "license": "ISC",
  "main": "lib/index.js",
  "module": "esm/index.js",
  "name": "@antv/g-canvas",
  "publishConfig": {
    "access": "public"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/antvis/g.git"
  },
  "scripts": {
    "build": "npm run clean && run-p build:*",
    "build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib",
    "build:esm": "tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm",
    "build:umd": "webpack --config webpack.config.js --mode production",
    "clean": "rm -rf esm lib dist",
    "coverage": "npm run coverage-generator && npm run coverage-viewer",
    "coverage-generator": "torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts tests/mocha.opts",
    "coverage-viewer": "torch-coverage",
    "dist": "webpack --config webpack.config.js --mode production",
    "test": "torch --renderer --compile --opts tests/mocha.opts",
    "test-live": "torch --compile --interactive --opts tests/mocha.opts",
    "tsc": "tsc --noEmit",
    "typecheck": "tsc --noEmit"
  },
  "types": "lib/index.d.ts",
  "unpkg": "dist/g.min.js",
  "version": "0.4.14"
}

},{}],157:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var wheel_1 = require("./wheel");
exports.Wheel = wheel_1.Wheel;

},{"./wheel":158}],158:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = require("@antv/event-emitter");
var d3Ease = require("d3-ease");
var gm_1 = require("../gm");
var clock_1 = require("../utils/clock");
// 看那个曲线跟合适了
var ease = d3Ease.easeCubicIn;
var TOTAL_MS = 800; // 惯性滚动时间；调参工程师，或者根据速度来计算这个时间
var SWIPE = 'swipe';
var PAN = 'pan';
var WHEEL = 'wheel';
/**
 * 给 view 添加移动端的滚动能力：
 *  - 监听 touch 事件，emit wheel 事件
 *  - 滚动惯性包装
 *  - 和 pc 的 wheel 事件保持基本一致
 */
var Wheel = /** @class */ (function (_super) {
    tslib_1.__extends(Wheel, _super);
    function Wheel(element) {
        var _this = _super.call(this) || this;
        _this.rafMs = 0;
        /**
         * pan 事件
         * @param ev
         */
        _this.onPan = function (ev) {
            var deltaX = ev.deltaX, deltaY = ev.deltaY;
            var e = _this.getWrapperEvent(ev, deltaX, deltaY);
            _this.emit(WHEEL, e);
        };
        /**
         * 当出现 swipe 事件的时候
         * @param ev
         */
        _this.onSwipe = function (ev) {
            var speedX = ev.speedX, speedY = ev.speedY;
            // raf 循环执行的时间戳
            _this.rafMs = clock_1.clock.now();
            _this.ms = _this.rafMs;
            // 对于没有滑动的情况下，不做处理
            if (speedX !== 0 || speedY !== 0) {
                _this.rafInertia(ev);
            }
        };
        _this.element = element;
        _this.gm = new gm_1.GM(element, { gestures: ['Pan', 'Swipe'] });
        _this.gm.on(SWIPE, _this.onSwipe);
        _this.gm.on(PAN, _this.onPan);
        return _this;
    }
    Wheel.prototype.destroy = function () {
        window.cancelAnimationFrame(this.raf);
        this.gm.destroy();
        this.off();
    };
    // 使用 raf 进行惯性滑动
    Wheel.prototype.rafInertia = function (ev) {
        var _this = this;
        var speedX = ev.speedX, speedY = ev.speedY;
        this.raf = window.requestAnimationFrame(function () {
            var now = clock_1.clock.now();
            var ratio = (now - _this.ms) / TOTAL_MS;
            if (ratio < 1) {
                ratio = ease(1 - ratio);
                // 折损之后的速度 * 时间，等于距离
                var t = now - _this.rafMs;
                var movedX = speedX * ratio * t;
                var movedY = speedY * ratio * t;
                var e = _this.getWrapperEvent(ev, movedX, movedY);
                // 发出 wheel 事件
                _this.emit(WHEEL, e);
                _this.rafMs = now; // 记录时间
                // 进行下一次
                _this.rafInertia(ev);
            }
        });
    };
    Wheel.prototype.getWrapperEvent = function (ev, deltaX, deltaY) {
        // 移动端的滑动应该是跟随手指
        return tslib_1.__assign(tslib_1.__assign({}, ev), { deltaX: -deltaX, deltaY: -deltaY });
    };
    return Wheel;
}(event_emitter_1.default));
exports.Wheel = Wheel;

},{"../gm":165,"../utils/clock":167,"@antv/event-emitter":94,"d3-ease":876,"tslib":894}],159:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Gesture = /** @class */ (function () {
    function Gesture(gm) {
        this.EVENT = 'gesture';
        this.gm = gm;
    }
    /**
     * 处理事件
     * @param ev
     */
    Gesture.prototype.do = function (ev) {
        var type = ev.type;
        switch (type) {
            case 'touchstart':
                this.onTouchStart(ev);
                break;
            case 'touchmove':
                this.onTouchMove(ev);
                break;
            case 'touchend':
                this.onTouchEnd(ev);
                break;
            case 'touchcancel':
                this.onTouchCancel(ev);
                break;
            default:
                return;
        }
    };
    /**
     * 触发事件
     * @param e
     */
    Gesture.prototype.emit = function (e) {
        this.gm.emit(this.EVENT, e);
    };
    return Gesture;
}());
exports.Gesture = Gesture;

},{}],160:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var gesture_1 = require("./gesture");
exports.Gesture = gesture_1.Gesture;
var pan_1 = require("./pan");
var press_1 = require("./press");
var swipe_1 = require("./swipe");
var tap_1 = require("./tap");
var MAP = {
    Pan: pan_1.Pan,
    Press: press_1.Press,
    Swipe: swipe_1.Swipe,
    Tap: tap_1.Tap,
};
exports.getGesture = function (g) { return MAP[g]; };

},{"./gesture":159,"./pan":161,"./press":162,"./swipe":163,"./tap":164}],161:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var gesture_1 = require("./gesture");
var Pan = /** @class */ (function (_super) {
    tslib_1.__extends(Pan, _super);
    function Pan() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.EVENT = 'pan';
        return _this;
    }
    Pan.prototype.onTouchCancel = function (ev) { };
    Pan.prototype.onTouchEnd = function (ev) { };
    Pan.prototype.onTouchMove = function (ev) {
        var x = ev.x, y = ev.y;
        var deltaX = x - this.preX;
        var deltaY = y - this.preY;
        this.preX = x;
        this.preY = y;
        this.emit({ x: x, y: y, deltaX: deltaX, deltaY: deltaY, event: ev });
    };
    Pan.prototype.onTouchStart = function (ev) {
        var x = ev.x, y = ev.y;
        this.preX = x;
        this.preY = y;
    };
    return Pan;
}(gesture_1.Gesture));
exports.Pan = Pan;

},{"./gesture":159,"tslib":894}],162:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var clock_1 = require("../utils/clock");
var gesture_1 = require("./gesture");
var TIME = 300;
var DISTANCE = 10;
var Press = /** @class */ (function (_super) {
    tslib_1.__extends(Press, _super);
    function Press() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.EVENT = 'press';
        return _this;
    }
    Press.prototype.onTouchCancel = function (ev) {
        this.clearTimeout();
    };
    Press.prototype.onTouchEnd = function (ev) {
        this.clearTimeout();
    };
    Press.prototype.onTouchMove = function (ev) {
        var x = ev.x, y = ev.y;
        if (x - this.touchStartX > DISTANCE || y - this.touchStartY > DISTANCE) {
            this.clearTimeout();
        }
    };
    Press.prototype.onTouchStart = function (ev) {
        var _this = this;
        this.clearTimeout();
        var x = ev.x, y = ev.y;
        this.touchStartTime = clock_1.clock.now();
        this.touchStartX = x;
        this.touchStartY = y;
        this.pressTimeout = window.setTimeout(function () {
            _this.emit({ x: x, y: y, event: ev });
        }, TIME);
    };
    Press.prototype.clearTimeout = function () {
        window.clearTimeout(this.pressTimeout);
    };
    return Press;
}(gesture_1.Gesture));
exports.Press = Press;

},{"../utils/clock":167,"./gesture":159,"tslib":894}],163:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var clock_1 = require("../utils/clock");
var gesture_1 = require("./gesture");
var SWIPE_TIME_GAP = 100;
var Swipe = /** @class */ (function (_super) {
    tslib_1.__extends(Swipe, _super);
    function Swipe() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.EVENT = 'swipe';
        // 最后一次 move 的事件，用于区分 swipe 和 pan
        _this.latestMoveTime = 0;
        // 最后交互的时间，用于计算速度
        _this.ms = 0;
        // 最后的 move 速度，用于touchend 之后做惯性
        _this.speedX = 0;
        _this.speedY = 0;
        // 最后 move 的 x，y 位置
        _this.preX = 0;
        _this.preY = 0;
        return _this;
    }
    Swipe.prototype.onTouchCancel = function (ev) { };
    Swipe.prototype.onTouchEnd = function (ev) {
        var speedX = this.speedX;
        var speedY = this.speedY;
        if (clock_1.clock.now() - this.latestMoveTime < SWIPE_TIME_GAP) {
            var x = ev.x, y = ev.y;
            // 抛出事件
            this.emit({ x: x, y: y, speedX: speedX, speedY: speedY, event: ev });
        }
    };
    Swipe.prototype.onTouchMove = function (ev) {
        var x = ev.x, y = ev.y;
        var ms = clock_1.clock.now();
        // 1. 计算 wheel 偏移
        var deltaX = x - this.preX;
        var deltaY = y - this.preY;
        var deltaTime = ms - this.ms;
        // 2. 计算速度（简版吧）
        this.speedX = deltaX / deltaTime;
        this.speedY = deltaY / deltaTime;
        // 记录最后一次移动事件
        this.latestMoveTime = ms;
    };
    Swipe.prototype.onTouchStart = function (ev) {
        var x = ev.x, y = ev.y;
        // 初始化
        this.speedX = this.speedY = 0;
        this.preX = x;
        this.preY = y;
        this.ms = clock_1.clock.now();
    };
    return Swipe;
}(gesture_1.Gesture));
exports.Swipe = Swipe;

},{"../utils/clock":167,"./gesture":159,"tslib":894}],164:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var clock_1 = require("../utils/clock");
var gesture_1 = require("./gesture");
var TIME = 300;
var DISTANCE = 2;
var Tap = /** @class */ (function (_super) {
    tslib_1.__extends(Tap, _super);
    function Tap() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.EVENT = 'tap';
        return _this;
    }
    Tap.prototype.onTouchCancel = function (ev) { };
    Tap.prototype.onTouchEnd = function (ev) {
        var x = ev.x, y = ev.y;
        if (x - this.touchStartX < DISTANCE &&
            y - this.touchStartY < DISTANCE &&
            clock_1.clock.now() - this.touchStartTime < TIME) {
            this.emit({ x: x, y: y, event: ev });
        }
    };
    Tap.prototype.onTouchMove = function (ev) { };
    Tap.prototype.onTouchStart = function (ev) {
        var x = ev.x, y = ev.y;
        this.touchStartTime = clock_1.clock.now();
        this.touchStartX = x;
        this.touchStartY = y;
    };
    return Tap;
}(gesture_1.Gesture));
exports.Tap = Tap;

},{"../utils/clock":167,"./gesture":159,"tslib":894}],165:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = require("@antv/event-emitter");
var gestures_1 = require("./gestures");
/**
 * 给 view 添加移动端的滚动能力：
 *  - 监听 touch 事件，emit wheel 事件
 *  - 滚动惯性包装
 *  - 和 pc 的 wheel 事件保持基本一致
 */
var GM = /** @class */ (function (_super) {
    tslib_1.__extends(GM, _super);
    function GM(element, options) {
        if (options === void 0) { options = {}; }
        var _this = _super.call(this) || this;
        /**
         * touchstart 触发
         * @param ev
         */
        _this.onTouchStart = function (ev) {
            _this.preventEvent(ev);
            _this.element.on('touchmove', _this.onTouchMove);
            _this.element.on('touchend', _this.onTouchEnd);
            _this.element.on('touchcancel', _this.onTouchCancel);
            _this.emit('touchdown', ev);
            _this.doGestures(ev);
        };
        /**
         * touchmove 触发
         * @param ev
         */
        _this.onTouchMove = function (ev) {
            _this.preventEvent(ev);
            _this.emit('touchmove', ev);
            _this.doGestures(ev);
        };
        /**
         * touchend 触发
         * @param ev
         */
        _this.onTouchEnd = function (ev) {
            _this.preventEvent(ev);
            _this.emit('touchend', ev);
            _this.element.off('touchmove', _this.onTouchMove);
            _this.element.off('touchend', _this.onTouchEnd);
            _this.element.off('touchcancel', _this.onTouchCancel);
            _this.doGestures(ev);
        };
        /**
         * touchcancel 触发
         * @param ev
         */
        _this.onTouchCancel = function (ev) {
            _this.preventEvent(ev);
            _this.emit('touchcancel', ev);
            _this.element.off('touchmove', _this.onTouchMove);
            _this.element.off('touchend', _this.onTouchEnd);
            _this.element.off('touchcancel', _this.onTouchCancel);
            _this.doGestures(ev);
        };
        _this.element = element;
        _this.options = options;
        _this.initialGestures();
        _this.bindTouchStart();
        return _this;
    }
    /**
     * 销毁，取消事件绑定
     */
    GM.prototype.destroy = function () {
        this.element.off('touchstart', this.onTouchStart);
        this.off();
    };
    /**
     * 实例化手势
     */
    GM.prototype.initialGestures = function () {
        var _this = this;
        var gestures = this.options.gestures || ['Pan', 'Press', 'Swipe', 'Tap'];
        this.gestures = gestures.map(function (gesture) {
            var Ctor = gestures_1.getGesture(gesture);
            return new Ctor(_this);
        });
    };
    /**
     * 绑定 touchstart 事件
     */
    GM.prototype.bindTouchStart = function () {
        this.element.on('touchstart', this.onTouchStart);
    };
    GM.prototype.preventEvent = function (ev) {
        var type = ev.type;
        var prevents = this.options.prevents || [];
        if (prevents.includes(type)) {
            ev.preventDefault();
        }
    };
    GM.prototype.doGestures = function (ev) {
        this.gestures.forEach(function (g) {
            g.do(ev);
        });
    };
    return GM;
}(event_emitter_1.default));
exports.GM = GM;

},{"./gestures":160,"@antv/event-emitter":94,"tslib":894}],166:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var gm_1 = require("./gm");
exports.GM = gm_1.GM;
// 包装的上层 wheel 事件
var event_1 = require("./event");
exports.Wheel = event_1.Wheel;

},{"./event":157,"./gm":165}],167:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 时钟
exports.clock = typeof performance === 'object' && performance.now ? performance : Date;

},{}],168:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
var ellipse_1 = require("./ellipse");
// 偏导数 x
function derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) {
    return -1 * rx * Math.cos(xRotation) * Math.sin(angle) - ry * Math.sin(xRotation) * Math.cos(angle);
}
// 偏导数 y
function derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle) {
    return -1 * rx * Math.sin(xRotation) * Math.sin(angle) + ry * Math.cos(xRotation) * Math.cos(angle);
}
// x 的极值
function xExtrema(rx, ry, xRotation) {
    return Math.atan((-ry / rx) * Math.tan(xRotation));
}
// y 的极值
function yExtrema(rx, ry, xRotation) {
    return Math.atan(ry / (rx * Math.tan(xRotation)));
}
// 根据角度求 x 坐标
function xAt(cx, cy, rx, ry, xRotation, angle) {
    return rx * Math.cos(xRotation) * Math.cos(angle) - ry * Math.sin(xRotation) * Math.sin(angle) + cx;
}
// 根据角度求 y 坐标
function yAt(cx, cy, rx, ry, xRotation, angle) {
    return rx * Math.sin(xRotation) * Math.cos(angle) + ry * Math.cos(xRotation) * Math.sin(angle) + cy;
}
// 获取点在椭圆上的角度
function getAngle(rx, ry, x0, y0) {
    var angle = Math.atan2(y0 * rx, x0 * ry);
    // 转换到 0 - 2PI 内
    return (angle + Math.PI * 2) % (Math.PI * 2);
}
// 根据角度获取，x,y
function getPoint(rx, ry, angle) {
    return {
        x: rx * Math.cos(angle),
        y: ry * Math.sin(angle),
    };
}
// 旋转
function rotate(x, y, angle) {
    var cos = Math.cos(angle);
    var sin = Math.sin(angle);
    return [x * cos - y * sin, x * sin + y * cos];
}
exports.default = {
    /**
     * 计算包围盒
     * @param {number} cx         圆心 x
     * @param {number} cy         圆心 y
     * @param {number} rx         x 轴方向的半径
     * @param {number} ry         y 轴方向的半径
     * @param {number} xRotation  旋转角度
     * @param {number} startAngle 起始角度
     * @param {number} endAngle   结束角度
     * @return {object} 包围盒对象
     */
    box: function (cx, cy, rx, ry, xRotation, startAngle, endAngle) {
        var xDim = xExtrema(rx, ry, xRotation);
        var minX = Infinity;
        var maxX = -Infinity;
        var xs = [startAngle, endAngle];
        for (var i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
            var xAngle = xDim + i;
            if (startAngle < endAngle) {
                if (startAngle < xAngle && xAngle < endAngle) {
                    xs.push(xAngle);
                }
            }
            else {
                if (endAngle < xAngle && xAngle < startAngle) {
                    xs.push(xAngle);
                }
            }
        }
        for (var i = 0; i < xs.length; i++) {
            var x = xAt(cx, cy, rx, ry, xRotation, xs[i]);
            if (x < minX) {
                minX = x;
            }
            if (x > maxX) {
                maxX = x;
            }
        }
        var yDim = yExtrema(rx, ry, xRotation);
        var minY = Infinity;
        var maxY = -Infinity;
        var ys = [startAngle, endAngle];
        for (var i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
            var yAngle = yDim + i;
            if (startAngle < endAngle) {
                if (startAngle < yAngle && yAngle < endAngle) {
                    ys.push(yAngle);
                }
            }
            else {
                if (endAngle < yAngle && yAngle < startAngle) {
                    ys.push(yAngle);
                }
            }
        }
        for (var i = 0; i < ys.length; i++) {
            var y = yAt(cx, cy, rx, ry, xRotation, ys[i]);
            if (y < minY) {
                minY = y;
            }
            if (y > maxY) {
                maxY = y;
            }
        }
        return {
            x: minX,
            y: minY,
            width: maxX - minX,
            height: maxY - minY,
        };
    },
    /**
     * 获取圆弧的长度，计算圆弧长度时不考虑旋转角度，
     * 仅跟 rx, ry, startAngle, endAngle 相关
     * @param {number} cx         圆心 x
     * @param {number} cy         圆心 y
     * @param {number} rx         x 轴方向的半径
     * @param {number} ry         y 轴方向的半径
     * @param {number} xRotation  旋转角度
     * @param {number} startAngle 起始角度
     * @param {number} endAngle   结束角度
     */
    length: function (cx, cy, rx, ry, xRotation, startAngle, endAngle) { },
    /**
     * 获取指定点到圆弧的最近距离的点
     * @param {number} cx         圆心 x
     * @param {number} cy         圆心 y
     * @param {number} rx         x 轴方向的半径
     * @param {number} ry         y 轴方向的半径
     * @param {number} xRotation  旋转角度
     * @param {number} startAngle 起始角度
     * @param {number} endAngle   结束角度
     * @param {number} x0         指定点的 x
     * @param {number} y0         指定点的 y
     * @return {object} 到指定点最近距离的点
     */
    nearestPoint: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) {
        // 将最近距离问题转换成到椭圆中心 0,0 没有旋转的椭圆问题
        var relativeVector = rotate(x0 - cx, y0 - cy, -xRotation);
        var x1 = relativeVector[0], y1 = relativeVector[1];
        // 计算点到椭圆的最近的点
        var relativePoint = ellipse_1.default.nearestPoint(0, 0, rx, ry, x1, y1);
        // 获取点在椭圆上的角度
        var angle = getAngle(rx, ry, relativePoint.x, relativePoint.y);
        // 点没有在圆弧上
        if (angle < startAngle) {
            // 小于起始圆弧
            relativePoint = getPoint(rx, ry, startAngle);
        }
        else if (angle > endAngle) {
            // 大于结束圆弧
            relativePoint = getPoint(rx, ry, endAngle);
        }
        // 旋转到 xRotation 的角度
        var vector = rotate(relativePoint.x, relativePoint.y, xRotation);
        return {
            x: vector[0] + cx,
            y: vector[1] + cy,
        };
    },
    pointDistance: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, x0, y0) {
        var nearestPoint = this.nearestPoint(cx, cy, rx, ry, x0, y0);
        return util_1.distance(nearestPoint.x, nearestPoint.y, x0, y0);
    },
    pointAt: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, t) {
        var angle = (endAngle - startAngle) * t + startAngle;
        return {
            x: xAt(cx, cy, rx, ry, xRotation, angle),
            y: yAt(cx, cy, rx, ry, xRotation, angle),
        };
    },
    tangentAngle: function (cx, cy, rx, ry, xRotation, startAngle, endAngle, t) {
        var angle = (endAngle - startAngle) * t + startAngle;
        var dx = derivativeXAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle);
        var dy = derivativeYAt(cx, cy, rx, ry, xRotation, startAngle, endAngle, angle);
        return util_1.piMod(Math.atan2(dy, dx));
    },
};

},{"./ellipse":171,"./util":176}],169:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.snapLength = exports.nearestPoint = void 0;
var util_1 = require("./util");
var EPSILON = 0.0001;
/**
 * 使用牛顿切割法求最近的点
 * @param {number[]} xArr      点的 x 数组
 * @param {number[]} yArr      点的 y 数组
 * @param {number}   x         指定的点 x
 * @param {number}   y         指定的点 y
 * @param {Function} tCallback 差值函数
 */
function nearestPoint(xArr, yArr, x, y, tCallback, length) {
    var t;
    var d = Infinity;
    var v0 = [x, y];
    var segNum = 20;
    if (length && length > 200) {
        segNum = length / 10;
    }
    var increaseRate = 1 / segNum;
    var interval = increaseRate / 10;
    for (var i = 0; i <= segNum; i++) {
        var _t = i * increaseRate;
        var v1 = [tCallback.apply(null, xArr.concat([_t])), tCallback.apply(null, yArr.concat([_t]))];
        var d1 = util_1.distance(v0[0], v0[1], v1[0], v1[1]);
        if (d1 < d) {
            t = _t;
            d = d1;
        }
    }
    // 提前终止
    if (t === 0) {
        return {
            x: xArr[0],
            y: yArr[0],
        };
    }
    if (t === 1) {
        var count = xArr.length;
        return {
            x: xArr[count - 1],
            y: yArr[count - 1],
        };
    }
    d = Infinity;
    for (var i = 0; i < 32; i++) {
        if (interval < EPSILON) {
            break;
        }
        var prev = t - interval;
        var next = t + interval;
        var v1 = [tCallback.apply(null, xArr.concat([prev])), tCallback.apply(null, yArr.concat([prev]))];
        var d1 = util_1.distance(v0[0], v0[1], v1[0], v1[1]);
        if (prev >= 0 && d1 < d) {
            t = prev;
            d = d1;
        }
        else {
            var v2 = [tCallback.apply(null, xArr.concat([next])), tCallback.apply(null, yArr.concat([next]))];
            var d2 = util_1.distance(v0[0], v0[1], v2[0], v2[1]);
            if (next <= 1 && d2 < d) {
                t = next;
                d = d2;
            }
            else {
                interval *= 0.5;
            }
        }
    }
    return {
        x: tCallback.apply(null, xArr.concat([t])),
        y: tCallback.apply(null, yArr.concat([t])),
    };
}
exports.nearestPoint = nearestPoint;
// 近似求解 https://community.khronos.org/t/3d-cubic-bezier-segment-length/62363/2
function snapLength(xArr, yArr) {
    var totalLength = 0;
    var count = xArr.length;
    for (var i = 0; i < count; i++) {
        var x = xArr[i];
        var y = yArr[i];
        var nextX = xArr[(i + 1) % count];
        var nextY = yArr[(i + 1) % count];
        totalLength += util_1.distance(x, y, nextX, nextY);
    }
    return totalLength / 2;
}
exports.snapLength = snapLength;

},{"./util":176}],170:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
var line_1 = require("./line");
var bezier_1 = require("./bezier");
function cubicAt(p0, p1, p2, p3, t) {
    var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
    return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
}
function derivativeAt(p0, p1, p2, p3, t) {
    var onet = 1 - t;
    return 3 * (onet * onet * (p1 - p0) + 2 * onet * t * (p2 - p1) + t * t * (p3 - p2));
}
function extrema(p0, p1, p2, p3) {
    var a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3;
    var b = 6 * p0 - 12 * p1 + 6 * p2;
    var c = 3 * p1 - 3 * p0;
    var extremas = [];
    var t1;
    var t2;
    var discSqrt;
    if (util_1.isNumberEqual(a, 0)) {
        if (!util_1.isNumberEqual(b, 0)) {
            t1 = -c / b;
            if (t1 >= 0 && t1 <= 1) {
                extremas.push(t1);
            }
        }
    }
    else {
        var disc = b * b - 4 * a * c;
        if (util_1.isNumberEqual(disc, 0)) {
            extremas.push(-b / (2 * a));
        }
        else if (disc > 0) {
            discSqrt = Math.sqrt(disc);
            t1 = (-b + discSqrt) / (2 * a);
            t2 = (-b - discSqrt) / (2 * a);
            if (t1 >= 0 && t1 <= 1) {
                extremas.push(t1);
            }
            if (t2 >= 0 && t2 <= 1) {
                extremas.push(t2);
            }
        }
    }
    return extremas;
}
// 分割贝塞尔曲线
function divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, t) {
    // 划分点
    var xt = cubicAt(x1, x2, x3, x4, t);
    var yt = cubicAt(y1, y2, y3, y4, t);
    // 计算两点之间的差值点
    var c1 = line_1.default.pointAt(x1, y1, x2, y2, t);
    var c2 = line_1.default.pointAt(x2, y2, x3, y3, t);
    var c3 = line_1.default.pointAt(x3, y3, x4, y4, t);
    var c12 = line_1.default.pointAt(c1.x, c1.y, c2.x, c2.y, t);
    var c23 = line_1.default.pointAt(c2.x, c2.y, c3.x, c3.y, t);
    return [
        [x1, y1, c1.x, c1.y, c12.x, c12.y, xt, yt],
        [xt, yt, c23.x, c23.y, c3.x, c3.y, x4, y4],
    ];
}
// 使用迭代法取贝塞尔曲线的长度，二阶和三阶分开写，更清晰和便于调试
function cubicLength(x1, y1, x2, y2, x3, y3, x4, y4, iterationCount) {
    if (iterationCount === 0) {
        return bezier_1.snapLength([x1, x2, x3, x4], [y1, y2, y3, y4]);
    }
    var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5);
    var left = cubics[0];
    var right = cubics[1];
    left.push(iterationCount - 1);
    right.push(iterationCount - 1);
    return cubicLength.apply(null, left) + cubicLength.apply(null, right);
}
exports.default = {
    extrema: extrema,
    box: function (x1, y1, x2, y2, x3, y3, x4, y4) {
        var xArr = [x1, x4];
        var yArr = [y1, y4];
        var xExtrema = extrema(x1, x2, x3, x4);
        var yExtrema = extrema(y1, y2, y3, y4);
        for (var i = 0; i < xExtrema.length; i++) {
            xArr.push(cubicAt(x1, x2, x3, x4, xExtrema[i]));
        }
        for (var i = 0; i < yExtrema.length; i++) {
            yArr.push(cubicAt(y1, y2, y3, y4, yExtrema[i]));
        }
        return util_1.getBBoxByArray(xArr, yArr);
    },
    length: function (x1, y1, x2, y2, x3, y3, x4, y4) {
        // 迭代三次，划分成 8 段求长度
        return cubicLength(x1, y1, x2, y2, x3, y3, x4, y4, 3);
    },
    nearestPoint: function (x1, y1, x2, y2, x3, y3, x4, y4, x0, y0, length) {
        return bezier_1.nearestPoint([x1, x2, x3, x4], [y1, y2, y3, y4], x0, y0, cubicAt, length);
    },
    pointDistance: function (x1, y1, x2, y2, x3, y3, x4, y4, x0, y0, length) {
        var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x4, y4, x0, y0, length);
        return util_1.distance(point.x, point.y, x0, y0);
    },
    interpolationAt: cubicAt,
    pointAt: function (x1, y1, x2, y2, x3, y3, x4, y4, t) {
        return {
            x: cubicAt(x1, x2, x3, x4, t),
            y: cubicAt(y1, y2, y3, y4, t),
        };
    },
    divide: function (x1, y1, x2, y2, x3, y3, x4, y4, t) {
        return divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, t);
    },
    tangentAngle: function (x1, y1, x2, y2, x3, y3, x4, y4, t) {
        var dx = derivativeAt(x1, x2, x3, x4, t);
        var dy = derivativeAt(y1, y2, y3, y4, t);
        return util_1.piMod(Math.atan2(dy, dx));
    },
};

},{"./bezier":169,"./line":172,"./util":176}],171:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 椭圆的一些计算，
 *  - 周长计算参考：https://www.mathsisfun.com/geometry/ellipse-perimeter.html
 *  - 距离计算参考：https://wet-robots.ghost.io/simple-method-for-distance-to-ellipse/
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
function copysign(v1, v2) {
    var absv = Math.abs(v1);
    return v2 > 0 ? absv : absv * -1;
}
exports.default = {
    /**
     * 包围盒计算
     * @param {number} x  椭圆中心 x
     * @param {number} y  椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @return {object} 包围盒
     */
    box: function (x, y, rx, ry) {
        return {
            x: x - rx,
            y: y - ry,
            width: rx * 2,
            height: ry * 2,
        };
    },
    /**
     * 计算周长，使用近似法
     * @param {number} x  椭圆中心 x
     * @param {number} y  椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @return {number} 椭圆周长
     */
    length: function (x, y, rx, ry) {
        return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
    },
    /**
     * 距离椭圆最近的点
     * @param {number} x  椭圆中心 x
     * @param {number} y  椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @param {number} x0  指定的点 x
     * @param {number} y0  指定的点 y
     * @return {object} 椭圆上距离指定点最近的点
     */
    nearestPoint: function (x, y, rx, ry, x0, y0) {
        var a = rx;
        var b = ry;
        // 假如椭圆半径为0则返回圆心
        if (a === 0 || b === 0) {
            return {
                x: x,
                y: y,
            };
        }
        // 转换成 0， 0 为中心的椭圆计算
        var relativeX = x0 - x;
        var relativeY = y0 - y;
        var px = Math.abs(relativeX);
        var py = Math.abs(relativeY);
        var squareA = a * a;
        var squareB = b * b;
        // const angle0 = Math.atan2(relativeY, relativeX);
        var t = Math.PI / 4;
        var nearestX; // 椭圆上的任一点
        var nearestY;
        // 迭代 4 次
        for (var i = 0; i < 4; i++) {
            nearestX = a * Math.cos(t);
            nearestY = b * Math.sin(t);
            var ex = ((squareA - squareB) * Math.pow(Math.cos(t), 3)) / a;
            var ey = ((squareB - squareA) * Math.pow(Math.sin(t), 3)) / b;
            var rx1 = nearestX - ex;
            var ry1 = nearestY - ey;
            var qx = px - ex;
            var qy = py - ey;
            var r = Math.hypot(ry1, rx1);
            var q = Math.hypot(qy, qx);
            var delta_c = r * Math.asin((rx1 * qy - ry1 * qx) / (r * q));
            var delta_t = delta_c / Math.sqrt(squareA + squareB - nearestX * nearestX - nearestY * nearestY);
            t += delta_t;
            t = Math.min(Math.PI / 2, Math.max(0, t));
        }
        return {
            x: x + copysign(nearestX, relativeX),
            y: y + copysign(nearestY, relativeY),
        };
    },
    /**
     * 点到椭圆最近的距离
     * @param {number} x  椭圆中心 x
     * @param {number} y  椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @param {number} x0  指定的点 x
     * @param {number} y0  指定的点 y
     * @return {number} 点到椭圆的距离
     */
    pointDistance: function (x, y, rx, ry, x0, y0) {
        var nearestPoint = this.nearestPoint(x, y, rx, ry, x0, y0);
        return util_1.distance(nearestPoint.x, nearestPoint.y, x0, y0);
    },
    /**
     * 根据比例获取点
     * @param {number} x 椭圆中心 x
     * @param {number} y 椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @param {number} t 指定比例，x轴方向为 0
     * @return {object} 点
     */
    pointAt: function (x, y, rx, ry, t) {
        var angle = 2 * Math.PI * t; // 按照角度进行计算，而不按照周长计算
        return {
            x: x + rx * Math.cos(angle),
            y: y + ry * Math.sin(angle),
        };
    },
    /**
     * 根据比例计算切线角度
     * @param {number} x 椭圆中心 x
     * @param {number} y 椭圆中心 y
     * @param {number} rx 椭圆 x 方向半径
     * @param {number} ry 椭圆 y 方向半径
     * @param {number} t 指定比例 0 - 1 之间，x轴方向为 0。在 0-1 范围之外是循环还是返回 null，还需要调整
     * @return {number} 角度，在 0 - 2PI 之间
     */
    tangentAngle: function (x, y, rx, ry, t) {
        var angle = 2 * Math.PI * t; // 按照角度进行计算，而不按照周长计算
        // 直接使用 x,y 的导数计算， x' = -rx * sin(t); y' = ry * cos(t);
        var tangentAngle = Math.atan2(ry * Math.cos(angle), -rx * Math.sin(angle));
        // 也可以使用指定点的切线方程计算，成本有些高
        // const point = this.pointAt(0, 0, rx, ry, t); // 椭圆的切线同椭圆的中心不相关
        // let tangentAngle = -1 * Math.atan((ry * ry * point.x) / (rx * rx * point.y));
        // if (angle >= 0 && angle <= Math.PI) {
        //   tangentAngle += Math.PI;
        // }
        return util_1.piMod(tangentAngle);
    },
};

},{"./util":176}],172:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
var vec2 = require("gl-matrix/vec2");
exports.default = {
    /**
     * 计算线段的包围盒
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @return {object} 包围盒对象
     */
    box: function (x1, y1, x2, y2) {
        return util_1.getBBoxByArray([x1, x2], [y1, y2]);
    },
    /**
     * 线段的长度
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @return {number} 距离
     */
    length: function (x1, y1, x2, y2) {
        return util_1.distance(x1, y1, x2, y2);
    },
    /**
     * 根据比例获取点
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @param {number} t 指定比例
     * @return {object} 包含 x, y 的点
     */
    pointAt: function (x1, y1, x2, y2, t) {
        return {
            x: (1 - t) * x1 + t * x2,
            y: (1 - t) * y1 + t * y2,
        };
    },
    /**
     * 点到线段的距离
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @param {number} x  测试点 x
     * @param {number} y  测试点 y
     * @return {number} 距离
     */
    pointDistance: function (x1, y1, x2, y2, x, y) {
        // 投影距离 x1, y1 的向量，假设 p, p1, p2 三个点，投影点为 a
        // p1a = p1p.p1p2/|p1p2| * (p1p 的单位向量)
        var cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
        if (cross < 0) {
            return util_1.distance(x1, y1, x, y);
        }
        var lengthSquare = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
        if (cross > lengthSquare) {
            return util_1.distance(x2, y2, x, y);
        }
        return this.pointToLine(x1, y1, x2, y2, x, y);
    },
    /**
     * 点到直线的距离，而不是点到线段的距离
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @param {number} x  测试点 x
     * @param {number} y  测试点 y
     * @return {number} 距离
     */
    pointToLine: function (x1, y1, x2, y2, x, y) {
        var d = [x2 - x1, y2 - y1];
        // 如果端点相等，则判定点到点的距离
        if (vec2.exactEquals(d, [0, 0])) {
            return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
        }
        var u = [-d[1], d[0]];
        vec2.normalize(u, u);
        var a = [x - x1, y - y1];
        return Math.abs(vec2.dot(a, u));
    },
    /**
     * 线段的角度
     * @param {number} x1 起始点 x
     * @param {number} y1 起始点 y
     * @param {number} x2 结束点 x
     * @param {number} y2 结束点 y
     * @return {number} 导数
     */
    tangentAngle: function (x1, y1, x2, y2) {
        return Math.atan2(y2 - y1, x2 - x1);
    },
};

},{"./util":176,"gl-matrix/vec2":890}],173:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var segments_1 = require("./segments");
var util_1 = require("./util");
exports.default = {
    /**
     * 计算多折线的包围盒
     * @param {array} points 点的集合 [x,y] 的形式
     * @return {object} 包围盒
     */
    box: function (points) {
        var xArr = [];
        var yArr = [];
        for (var i = 0; i < points.length; i++) {
            var point = points[i];
            xArr.push(point[0]);
            yArr.push(point[1]);
        }
        return util_1.getBBoxByArray(xArr, yArr);
    },
    /**
     * 计算多折线的长度
     * @param {array} points 点的集合 [x,y] 的形式
     * @return {object} 多条边的长度
     */
    length: function (points) {
        return segments_1.lengthOfSegment(points);
    },
    /**
     * 根据比例获取多折线的点
     * @param {array} points 点的集合 [x,y] 的形式
     * @param {number} t 在多折线的长度上的比例
     * @return {object} 根据比例值计算出来的点
     */
    pointAt: function (points, t) {
        return segments_1.pointAtSegments(points, t);
    },
    /**
     * 指定点到多折线的距离
     * @param {array} points 点的集合 [x,y] 的形式
     * @param {number} x 指定点的 x
     * @param {number} y 指定点的 y
     * @return {number} 点到多折线的距离
     */
    pointDistance: function (points, x, y) {
        return segments_1.distanceAtSegment(points, x, y);
    },
    /**
     * 根据比例获取多折线的切线角度
     * @param {array} points 点的集合 [x,y] 的形式
     * @param {number} t 在多折线的长度上的比例
     * @return {object} 根据比例值计算出来的角度
     */
    tangentAngle: function (points, t) {
        return segments_1.angleAtSegments(points, t);
    },
};

},{"./segments":175,"./util":176}],174:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var line_1 = require("./line");
var util_1 = require("./util");
var bezier_1 = require("./bezier");
// 差值公式
function quadraticAt(p0, p1, p2, t) {
    var onet = 1 - t;
    return onet * onet * p0 + 2 * t * onet * p1 + t * t * p2;
}
// 求极值
function extrema(p0, p1, p2) {
    var a = p0 + p2 - 2 * p1;
    if (util_1.isNumberEqual(a, 0)) {
        return [0.5];
    }
    var rst = (p0 - p1) / a;
    if (rst <= 1 && rst >= 0) {
        return [rst];
    }
    return [];
}
function derivativeAt(p0, p1, p2, t) {
    return 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1);
}
// 分割贝塞尔曲线
function divideQuadratic(x1, y1, x2, y2, x3, y3, t) {
    // 划分点
    var xt = quadraticAt(x1, x2, x3, t);
    var yt = quadraticAt(y1, y2, y3, t);
    // 分割的第一条曲线的控制点
    var controlPoint1 = line_1.default.pointAt(x1, y1, x2, y2, t);
    // 分割的第二条曲线的控制点
    var controlPoint2 = line_1.default.pointAt(x2, y2, x3, y3, t);
    return [
        [x1, y1, controlPoint1.x, controlPoint1.y, xt, yt],
        [xt, yt, controlPoint2.x, controlPoint2.y, x3, y3],
    ];
}
// 使用迭代法取贝塞尔曲线的长度
function quadraticLength(x1, y1, x2, y2, x3, y3, iterationCount) {
    if (iterationCount === 0) {
        return (util_1.distance(x1, y1, x2, y2) + util_1.distance(x2, y2, x3, y3) + util_1.distance(x1, y1, x3, y3)) / 2;
    }
    var quadratics = divideQuadratic(x1, y1, x2, y2, x3, y3, 0.5);
    var left = quadratics[0];
    var right = quadratics[1];
    left.push(iterationCount - 1);
    right.push(iterationCount - 1);
    return quadraticLength.apply(null, left) + quadraticLength.apply(null, right);
}
exports.default = {
    box: function (x1, y1, x2, y2, x3, y3) {
        var xExtrema = extrema(x1, x2, x3)[0];
        var yExtrema = extrema(y1, y2, y3)[0];
        // 控制点不加入 box 的计算
        var xArr = [x1, x3];
        var yArr = [y1, y3];
        if (xExtrema !== undefined) {
            xArr.push(quadraticAt(x1, x2, x3, xExtrema));
        }
        if (yExtrema !== undefined) {
            yArr.push(quadraticAt(y1, y2, y3, yExtrema));
        }
        return util_1.getBBoxByArray(xArr, yArr);
    },
    length: function (x1, y1, x2, y2, x3, y3) {
        return quadraticLength(x1, y1, x2, y2, x3, y3, 3);
    },
    nearestPoint: function (x1, y1, x2, y2, x3, y3, x0, y0) {
        return bezier_1.nearestPoint([x1, x2, x3], [y1, y2, y3], x0, y0, quadraticAt);
    },
    pointDistance: function (x1, y1, x2, y2, x3, y3, x0, y0) {
        var point = this.nearestPoint(x1, y1, x2, y2, x3, y3, x0, y0);
        return util_1.distance(point.x, point.y, x0, y0);
    },
    interpolationAt: quadraticAt,
    pointAt: function (x1, y1, x2, y2, x3, y3, t) {
        return {
            x: quadraticAt(x1, x2, x3, t),
            y: quadraticAt(y1, y2, y3, t),
        };
    },
    divide: function (x1, y1, x2, y2, x3, y3, t) {
        return divideQuadratic(x1, y1, x2, y2, x3, y3, t);
    },
    tangentAngle: function (x1, y1, x2, y2, x3, y3, t) {
        var dx = derivativeAt(x1, x2, x3, t);
        var dy = derivativeAt(y1, y2, y3, t);
        var angle = Math.atan2(dy, dx);
        return util_1.piMod(angle);
    },
};

},{"./bezier":169,"./line":172,"./util":176}],175:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.distanceAtSegment = exports.angleAtSegments = exports.pointAtSegments = exports.lengthOfSegment = void 0;
var line_1 = require("./line");
var util_1 = require("./util");
function analyzePoints(points) {
    // 计算每段的长度和总的长度
    var totalLength = 0;
    var segments = [];
    for (var i = 0; i < points.length - 1; i++) {
        var from = points[i];
        var to = points[i + 1];
        var length_1 = util_1.distance(from[0], from[1], to[0], to[1]);
        var seg = {
            from: from,
            to: to,
            length: length_1,
        };
        segments.push(seg);
        totalLength += length_1;
    }
    return { segments: segments, totalLength: totalLength };
}
function lengthOfSegment(points) {
    if (points.length < 2) {
        return 0;
    }
    var totalLength = 0;
    for (var i = 0; i < points.length - 1; i++) {
        var from = points[i];
        var to = points[i + 1];
        totalLength += util_1.distance(from[0], from[1], to[0], to[1]);
    }
    return totalLength;
}
exports.lengthOfSegment = lengthOfSegment;
/**
 * 按照比例在数据片段中获取点
 * @param {array} points 点的集合
 * @param {number} t 百分比 0-1
 * @return {object} 点的坐标
 */
function pointAtSegments(points, t) {
    // 边界判断
    if (t > 1 || t < 0 || points.length < 2) {
        return null;
    }
    var _a = analyzePoints(points), segments = _a.segments, totalLength = _a.totalLength;
    // 多个点有可能重合
    if (totalLength === 0) {
        return {
            x: points[0][0],
            y: points[0][1],
        };
    }
    // 计算比例
    var startRatio = 0;
    var point = null;
    for (var i = 0; i < segments.length; i++) {
        var seg = segments[i];
        var from = seg.from, to = seg.to;
        var currentRatio = seg.length / totalLength;
        if (t >= startRatio && t <= startRatio + currentRatio) {
            var localRatio = (t - startRatio) / currentRatio;
            point = line_1.default.pointAt(from[0], from[1], to[0], to[1], localRatio);
            break;
        }
        startRatio += currentRatio;
    }
    return point;
}
exports.pointAtSegments = pointAtSegments;
/**
 * 按照比例在数据片段中获取切线的角度
 * @param {array} points 点的集合
 * @param {number} t 百分比 0-1
 */
function angleAtSegments(points, t) {
    // 边界判断
    if (t > 1 || t < 0 || points.length < 2) {
        return 0;
    }
    var _a = analyzePoints(points), segments = _a.segments, totalLength = _a.totalLength;
    // 计算比例
    var startRatio = 0;
    var angle = 0;
    for (var i = 0; i < segments.length; i++) {
        var seg = segments[i];
        var from = seg.from, to = seg.to;
        var currentRatio = seg.length / totalLength;
        if (t >= startRatio && t <= startRatio + currentRatio) {
            angle = Math.atan2(to[1] - from[1], to[0] - from[0]);
            break;
        }
        startRatio += currentRatio;
    }
    return angle;
}
exports.angleAtSegments = angleAtSegments;
function distanceAtSegment(points, x, y) {
    var minDistance = Infinity;
    for (var i = 0; i < points.length - 1; i++) {
        var point = points[i];
        var nextPoint = points[i + 1];
        var distance_1 = line_1.default.pointDistance(point[0], point[1], nextPoint[0], nextPoint[1], x, y);
        if (distance_1 < minDistance) {
            minDistance = distance_1;
        }
    }
    return minDistance;
}
exports.distanceAtSegment = distanceAtSegment;

},{"./line":172,"./util":176}],176:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.piMod = exports.getBBoxRange = exports.getBBoxByArray = exports.isNumberEqual = exports.distance = void 0;
function minNum(array) {
    return Math.min.apply(null, array);
}
function maxNum(array) {
    return Math.max.apply(null, array);
}
/**
 * 两点之间的距离
 * @param {number} x1 起始点 x
 * @param {number} y1 起始点 y
 * @param {number} x2 结束点 x
 * @param {number} y2 结束点 y
 * @return {number} 距离
 */
function distance(x1, y1, x2, y2) {
    var dx = x1 - x2;
    var dy = y1 - y2;
    return Math.sqrt(dx * dx + dy * dy);
}
exports.distance = distance;
function isNumberEqual(v1, v2) {
    return Math.abs(v1 - v2) < 0.001;
}
exports.isNumberEqual = isNumberEqual;
function getBBoxByArray(xArr, yArr) {
    var minX = minNum(xArr);
    var minY = minNum(yArr);
    var maxX = maxNum(xArr);
    var maxY = maxNum(yArr);
    return {
        x: minX,
        y: minY,
        width: maxX - minX,
        height: maxY - minY,
    };
}
exports.getBBoxByArray = getBBoxByArray;
function getBBoxRange(x1, y1, x2, y2) {
    return {
        minX: minNum([x1, x2]),
        maxX: maxNum([x1, x2]),
        minY: minNum([y1, y2]),
        maxY: maxNum([y1, y2]),
    };
}
exports.getBBoxRange = getBBoxRange;
function piMod(angle) {
    return (angle + Math.PI * 2) % (Math.PI * 2);
}
exports.piMod = piMod;

},{}],177:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var constant_1 = require("./constant");
var draw_1 = require("./util/draw");
var svg_1 = require("./util/svg");
var dom_1 = require("./util/dom");
var Shape = require("./shape");
var group_1 = require("./group");
var defs_1 = require("./defs");
var Canvas = /** @class */ (function (_super) {
    tslib_1.__extends(Canvas, _super);
    function Canvas(cfg) {
        return _super.call(this, tslib_1.__assign(tslib_1.__assign({}, cfg), { autoDraw: true, 
            // 设置渲染引擎为 canvas，只读属性
            renderer: 'svg' })) || this;
    }
    Canvas.prototype.getShapeBase = function () {
        return Shape;
    };
    Canvas.prototype.getGroupBase = function () {
        return group_1.default;
    };
    // 覆盖 Container 中通过遍历的方式获取 shape 对象的逻辑，直接走 SVG 的 dom 拾取即可
    Canvas.prototype.getShape = function (x, y, ev) {
        var target = ev.target || ev.srcElement;
        if (!constant_1.SHAPE_TO_TAGS[target.tagName]) {
            var parent_1 = target.parentNode;
            while (parent_1 && !constant_1.SHAPE_TO_TAGS[parent_1.tagName]) {
                parent_1 = parent_1.parentNode;
            }
            target = parent_1;
        }
        return this.find(function (child) { return child.get('el') === target; });
    };
    // 复写基类的方法生成标签
    Canvas.prototype.createDom = function () {
        var element = dom_1.createSVGElement('svg');
        var context = new defs_1.default(element);
        element.setAttribute('width', "" + this.get('width'));
        element.setAttribute('height', "" + this.get('height'));
        // 缓存 context 对象
        this.set('context', context);
        return element;
    };
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    Canvas.prototype.onCanvasChange = function (changeType) {
        var context = this.get('context');
        var el = this.get('el');
        if (changeType === 'sort') {
            var children_1 = this.get('children');
            if (children_1 && children_1.length) {
                dom_1.sortDom(this, function (a, b) {
                    return children_1.indexOf(a) - children_1.indexOf(b) ? 1 : 0;
                });
            }
        }
        else if (changeType === 'clear') {
            // el maybe null for canvas
            if (el) {
                // 清空 SVG 元素
                el.innerHTML = '';
                var defsEl = context.el;
                // 清空 defs 元素
                defsEl.innerHTML = '';
                // 将清空后的 defs 元素挂载到 el 下
                el.appendChild(defsEl);
            }
        }
        else if (changeType === 'matrix') {
            svg_1.setTransform(this);
        }
        else if (changeType === 'clip') {
            svg_1.setClip(this, context);
        }
        else if (changeType === 'changeSize') {
            el.setAttribute('width', "" + this.get('width'));
            el.setAttribute('height', "" + this.get('height'));
        }
    };
    // 复写基类的 draw 方法
    Canvas.prototype.draw = function () {
        var context = this.get('context');
        var children = this.getChildren();
        svg_1.setClip(this, context);
        if (children.length) {
            draw_1.drawChildren(context, children);
        }
    };
    return Canvas;
}(g_base_1.AbstractCanvas));
exports.default = Canvas;

},{"./constant":178,"./defs":182,"./group":185,"./shape":192,"./util/dom":201,"./util/draw":202,"./util/svg":204,"@antv/g-base":115,"tslib":894}],178:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SHAPE_TO_TAGS = {
    rect: 'path',
    circle: 'circle',
    line: 'line',
    path: 'path',
    marker: 'path',
    text: 'text',
    polyline: 'polyline',
    polygon: 'polygon',
    image: 'image',
    ellipse: 'ellipse',
    dom: 'foreignObject',
};
exports.SVG_ATTR_MAP = {
    opacity: 'opacity',
    fillStyle: 'fill',
    fill: 'fill',
    fillOpacity: 'fill-opacity',
    strokeStyle: 'stroke',
    strokeOpacity: 'stroke-opacity',
    stroke: 'stroke',
    x: 'x',
    y: 'y',
    r: 'r',
    rx: 'rx',
    ry: 'ry',
    width: 'width',
    height: 'height',
    x1: 'x1',
    x2: 'x2',
    y1: 'y1',
    y2: 'y2',
    lineCap: 'stroke-linecap',
    lineJoin: 'stroke-linejoin',
    lineWidth: 'stroke-width',
    lineDash: 'stroke-dasharray',
    lineDashOffset: 'stroke-dashoffset',
    miterLimit: 'stroke-miterlimit',
    font: 'font',
    fontSize: 'font-size',
    fontStyle: 'font-style',
    fontVariant: 'font-variant',
    fontWeight: 'font-weight',
    fontFamily: 'font-family',
    startArrow: 'marker-start',
    endArrow: 'marker-end',
    path: 'd',
    class: 'class',
    id: 'id',
    style: 'style',
    preserveAspectRatio: 'preserveAspectRatio',
};
exports.EVENTS = [
    'click',
    'mousedown',
    'mouseup',
    'dblclick',
    'contextmenu',
    'mouseenter',
    'mouseleave',
    'mouseover',
    'mouseout',
    'mousemove',
    'wheel',
];

},{}],179:[function(require,module,exports){
"use strict";
/**
 * @fileoverview arrow
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_1 = require("../util/dom");
var Arrow = /** @class */ (function () {
    function Arrow(attrs, type) {
        this.cfg = {};
        var el = dom_1.createSVGElement('marker');
        var id = util_1.uniqueId('marker_');
        el.setAttribute('id', id);
        var shape = dom_1.createSVGElement('path');
        shape.setAttribute('stroke', attrs.stroke || 'none');
        shape.setAttribute('fill', attrs.fill || 'none');
        el.appendChild(shape);
        el.setAttribute('overflow', 'visible');
        el.setAttribute('orient', 'auto-start-reverse');
        this.el = el;
        this.child = shape;
        this.id = id;
        var cfg = attrs[type === 'marker-start' ? 'startArrow' : 'endArrow'];
        this.stroke = attrs.stroke || '#000';
        if (cfg === true) {
            this._setDefaultPath(type, shape);
        }
        else {
            this.cfg = cfg; // when arrow config exists
            this._setMarker(attrs.lineWidth, shape);
        }
        return this;
    }
    Arrow.prototype.match = function () {
        return false;
    };
    Arrow.prototype._setDefaultPath = function (type, el) {
        var parent = this.el;
        // 默认箭头的边长为 10，夹角为 60 度
        el.setAttribute('d', "M0,0 L" + 10 * Math.cos(Math.PI / 6) + ",5 L0,10");
        parent.setAttribute('refX', "" + 10 * Math.cos(Math.PI / 6));
        parent.setAttribute('refY', "" + 5);
    };
    Arrow.prototype._setMarker = function (r, el) {
        var parent = this.el;
        var path = this.cfg.path;
        var d = this.cfg.d;
        if (util_1.isArray(path)) {
            path = path
                .map(function (segment) {
                return segment.join(' ');
            })
                .join('');
        }
        el.setAttribute('d', path);
        parent.appendChild(el);
        if (d) {
            parent.setAttribute('refX', "" + d / r);
        }
    };
    Arrow.prototype.update = function (fill) {
        var child = this.child;
        if (child.attr) {
            child.attr('fill', fill);
        }
        else {
            child.setAttribute('fill', fill);
        }
    };
    return Arrow;
}());
exports.default = Arrow;

},{"../util/dom":201,"@antv/util":803}],180:[function(require,module,exports){
"use strict";
/**
 * @fileoverview clip
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_1 = require("../util/dom");
var Clip = /** @class */ (function () {
    function Clip(cfg) {
        this.type = 'clip';
        this.cfg = {};
        var el = dom_1.createSVGElement('clipPath');
        this.el = el;
        this.id = util_1.uniqueId('clip_');
        el.id = this.id;
        var shapeEl = cfg.cfg.el;
        el.appendChild(shapeEl);
        this.cfg = cfg;
        return this;
    }
    Clip.prototype.match = function () {
        return false;
    };
    Clip.prototype.remove = function () {
        var el = this.el;
        el.parentNode.removeChild(el);
    };
    return Clip;
}());
exports.default = Clip;

},{"../util/dom":201,"@antv/util":803}],181:[function(require,module,exports){
"use strict";
/**
 * @fileoverview gradient
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_1 = require("../util/dom");
var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/gi;
function addStop(steps) {
    var arr = steps.match(regexColorStop);
    if (!arr) {
        return '';
    }
    var stops = '';
    arr.sort(function (a, b) {
        a = a.split(':');
        b = b.split(':');
        return Number(a[0]) - Number(b[0]);
    });
    util_1.each(arr, function (item) {
        item = item.split(':');
        stops += "<stop offset=\"" + item[0] + "\" stop-color=\"" + item[1] + "\"></stop>";
    });
    return stops;
}
function parseLineGradient(color, el) {
    var arr = regexLG.exec(color);
    var angle = util_1.mod(util_1.toRadian(parseFloat(arr[1])), Math.PI * 2);
    var steps = arr[2];
    var start;
    var end;
    if (angle >= 0 && angle < 0.5 * Math.PI) {
        start = {
            x: 0,
            y: 0,
        };
        end = {
            x: 1,
            y: 1,
        };
    }
    else if (0.5 * Math.PI <= angle && angle < Math.PI) {
        start = {
            x: 1,
            y: 0,
        };
        end = {
            x: 0,
            y: 1,
        };
    }
    else if (Math.PI <= angle && angle < 1.5 * Math.PI) {
        start = {
            x: 1,
            y: 1,
        };
        end = {
            x: 0,
            y: 0,
        };
    }
    else {
        start = {
            x: 0,
            y: 1,
        };
        end = {
            x: 1,
            y: 0,
        };
    }
    var tanTheta = Math.tan(angle);
    var tanTheta2 = tanTheta * tanTheta;
    var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
    var y = (tanTheta * (end.x - start.x + tanTheta * (end.y - start.y))) / (tanTheta2 + 1) + start.y;
    el.setAttribute('x1', start.x);
    el.setAttribute('y1', start.y);
    el.setAttribute('x2', x);
    el.setAttribute('y2', y);
    el.innerHTML = addStop(steps);
}
function parseRadialGradient(color, self) {
    var arr = regexRG.exec(color);
    var cx = parseFloat(arr[1]);
    var cy = parseFloat(arr[2]);
    var r = parseFloat(arr[3]);
    var steps = arr[4];
    self.setAttribute('cx', cx);
    self.setAttribute('cy', cy);
    self.setAttribute('r', r);
    self.innerHTML = addStop(steps);
}
var Gradient = /** @class */ (function () {
    function Gradient(cfg) {
        this.cfg = {};
        var el = null;
        var id = util_1.uniqueId('gradient_');
        if (cfg.toLowerCase()[0] === 'l') {
            el = dom_1.createSVGElement('linearGradient');
            parseLineGradient(cfg, el);
        }
        else {
            el = dom_1.createSVGElement('radialGradient');
            parseRadialGradient(cfg, el);
        }
        el.setAttribute('id', id);
        this.el = el;
        this.id = id;
        this.cfg = cfg;
        return this;
    }
    Gradient.prototype.match = function (type, attr) {
        return this.cfg === attr;
    };
    return Gradient;
}());
exports.default = Gradient;

},{"../util/dom":201,"@antv/util":803}],182:[function(require,module,exports){
"use strict";
/**
 * @fileoverview defs
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var gradient_1 = require("./gradient");
var shadow_1 = require("./shadow");
var arrow_1 = require("./arrow");
var clip_1 = require("./clip");
var pattern_1 = require("./pattern");
var dom_1 = require("../util/dom");
var Defs = /** @class */ (function () {
    function Defs(canvas) {
        var el = dom_1.createSVGElement('defs');
        var id = util_1.uniqueId('defs_');
        el.id = id;
        canvas.appendChild(el);
        this.children = [];
        this.defaultArrow = {};
        this.el = el;
        this.canvas = canvas;
    }
    Defs.prototype.find = function (type, attr) {
        var children = this.children;
        var result = null;
        for (var i = 0; i < children.length; i++) {
            if (children[i].match(type, attr)) {
                result = children[i].id;
                break;
            }
        }
        return result;
    };
    Defs.prototype.findById = function (id) {
        var children = this.children;
        var flag = null;
        for (var i = 0; i < children.length; i++) {
            if (children[i].id === id) {
                flag = children[i];
                break;
            }
        }
        return flag;
    };
    Defs.prototype.add = function (item) {
        this.children.push(item);
        item.canvas = this.canvas;
        item.parent = this;
    };
    Defs.prototype.getDefaultArrow = function (attrs, name) {
        var stroke = attrs.stroke || attrs.strokeStyle;
        if (this.defaultArrow[stroke]) {
            return this.defaultArrow[stroke].id;
        }
        var arrow = new arrow_1.default(attrs, name);
        this.defaultArrow[stroke] = arrow;
        this.el.appendChild(arrow.el);
        this.add(arrow);
        return arrow.id;
    };
    Defs.prototype.addGradient = function (cfg) {
        var gradient = new gradient_1.default(cfg);
        this.el.appendChild(gradient.el);
        this.add(gradient);
        return gradient.id;
    };
    Defs.prototype.addArrow = function (attrs, name) {
        var arrow = new arrow_1.default(attrs, name);
        this.el.appendChild(arrow.el);
        this.add(arrow);
        return arrow.id;
    };
    Defs.prototype.addShadow = function (cfg) {
        var shadow = new shadow_1.default(cfg);
        this.el.appendChild(shadow.el);
        this.add(shadow);
        return shadow.id;
    };
    Defs.prototype.addPattern = function (cfg) {
        var pattern = new pattern_1.default(cfg);
        this.el.appendChild(pattern.el);
        this.add(pattern);
        return pattern.id;
    };
    Defs.prototype.addClip = function (cfg) {
        var clip = new clip_1.default(cfg);
        this.el.appendChild(clip.el);
        this.add(clip);
        return clip.id;
    };
    return Defs;
}());
exports.default = Defs;

},{"../util/dom":201,"./arrow":179,"./clip":180,"./gradient":181,"./pattern":183,"./shadow":184,"@antv/util":803}],183:[function(require,module,exports){
"use strict";
/**
 * @fileoverview pattern
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_1 = require("../util/dom");
var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
var Pattern = /** @class */ (function () {
    function Pattern(cfg) {
        this.cfg = {};
        var el = dom_1.createSVGElement('pattern');
        el.setAttribute('patternUnits', 'userSpaceOnUse');
        var child = dom_1.createSVGElement('image');
        el.appendChild(child);
        var id = util_1.uniqueId('pattern_');
        el.id = id;
        this.el = el;
        this.id = id;
        this.cfg = cfg;
        var arr = regexPR.exec(cfg);
        var source = arr[2];
        child.setAttribute('href', source);
        var img = new Image();
        if (!source.match(/^data:/i)) {
            img.crossOrigin = 'Anonymous';
        }
        img.src = source;
        function onload() {
            el.setAttribute('width', "" + img.width);
            el.setAttribute('height', "" + img.height);
        }
        if (img.complete) {
            onload();
        }
        else {
            img.onload = onload;
            // Fix onload() bug in IE9
            img.src = img.src;
        }
        return this;
    }
    Pattern.prototype.match = function (type, attr) {
        return this.cfg === attr;
    };
    return Pattern;
}());
exports.default = Pattern;

},{"../util/dom":201,"@antv/util":803}],184:[function(require,module,exports){
"use strict";
/**
 * @fileoverview shadow
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_1 = require("../util/dom");
var ATTR_MAP = {
    shadowColor: 'color',
    shadowOpacity: 'opacity',
    shadowBlur: 'blur',
    shadowOffsetX: 'dx',
    shadowOffsetY: 'dy',
};
var SHADOW_DIMENSION = {
    x: '-40%',
    y: '-40%',
    width: '200%',
    height: '200%',
};
var Shadow = /** @class */ (function () {
    function Shadow(cfg) {
        this.type = 'filter';
        this.cfg = {};
        this.type = 'filter';
        var el = dom_1.createSVGElement('filter');
        // expand the filter region to fill in shadows
        util_1.each(SHADOW_DIMENSION, function (v, k) {
            el.setAttribute(k, v);
        });
        this.el = el;
        this.id = util_1.uniqueId('filter_');
        this.el.id = this.id;
        this.cfg = cfg;
        this._parseShadow(cfg, el);
        return this;
    }
    Shadow.prototype.match = function (type, cfg) {
        if (this.type !== type) {
            return false;
        }
        var flag = true;
        var config = this.cfg;
        util_1.each(Object.keys(config), function (attr) {
            if (config[attr] !== cfg[attr]) {
                flag = false;
                return false;
            }
        });
        return flag;
    };
    Shadow.prototype.update = function (name, value) {
        var config = this.cfg;
        config[ATTR_MAP[name]] = value;
        this._parseShadow(config, this.el);
        return this;
    };
    Shadow.prototype._parseShadow = function (config, el) {
        var child = "<feDropShadow\n      dx=\"" + (config.dx || 0) + "\"\n      dy=\"" + (config.dy || 0) + "\"\n      stdDeviation=\"" + (config.blur ? config.blur / 10 : 0) + "\"\n      flood-color=\"" + (config.color ? config.color : '#000') + "\"\n      flood-opacity=\"" + (config.opacity ? config.opacity : 1) + "\"\n      />";
        el.innerHTML = child;
    };
    return Shadow;
}());
exports.default = Shadow;

},{"../util/dom":201,"@antv/util":803}],185:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var util_1 = require("@antv/util");
var Shape = require("./shape");
var draw_1 = require("./util/draw");
var svg_1 = require("./util/svg");
var constant_1 = require("./constant");
var dom_1 = require("./util/dom");
var Group = /** @class */ (function (_super) {
    tslib_1.__extends(Group, _super);
    function Group() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // SVG 中分组对应实体标签 <g>
    Group.prototype.isEntityGroup = function () {
        return true;
    };
    Group.prototype.createDom = function () {
        var element = dom_1.createSVGElement('g');
        this.set('el', element);
        var parent = this.getParent();
        if (parent) {
            var parentNode = parent.get('el');
            if (parentNode) {
                parentNode.appendChild(element);
            }
            else {
                // parentNode maybe null for group
                parentNode = parent.createDom();
                parent.set('el', parentNode);
                parentNode.appendChild(element);
            }
        }
        return element;
    };
    // 覆盖基类的 afterAttrsChange 方法
    Group.prototype.afterAttrsChange = function (targetAttrs) {
        _super.prototype.afterAttrsChange.call(this, targetAttrs);
        var canvas = this.get('canvas');
        // 只有挂载到画布下，才对元素进行实际渲染
        if (canvas && canvas.get('autoDraw')) {
            var context = canvas.get('context');
            this.createPath(context, targetAttrs);
        }
    };
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    Group.prototype.onCanvasChange = function (changeType) {
        draw_1.refreshElement(this, changeType);
    };
    Group.prototype.getShapeBase = function () {
        return Shape;
    };
    Group.prototype.getGroupBase = function () {
        return Group;
    };
    Group.prototype.draw = function (context) {
        var children = this.getChildren();
        var el = this.get('el');
        if (this.get('destroyed')) {
            if (el) {
                el.parentNode.removeChild(el);
            }
        }
        else {
            if (!el) {
                this.createDom();
            }
            svg_1.setClip(this, context);
            this.createPath(context);
            if (children.length) {
                draw_1.drawChildren(context, children);
            }
        }
    };
    /**
     * 绘制分组的路径
     * @param {Defs} context 上下文
     * @param {ShapeAttrs} targetAttrs 渲染的目标属性
     */
    Group.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
        svg_1.setTransform(this);
    };
    return Group;
}(g_base_1.AbstractGroup));
exports.default = Group;

},{"./constant":178,"./shape":192,"./util/dom":201,"./util/draw":202,"./util/svg":204,"@antv/g-base":115,"@antv/util":803,"tslib":894}],186:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Shape = require("./shape");
exports.Shape = Shape;
var pkg = require('../package.json');
exports.version = pkg.version;
var g_base_1 = require("@antv/g-base");
exports.Event = g_base_1.Event;
var canvas_1 = require("./canvas");
exports.Canvas = canvas_1.default;
var group_1 = require("./group");
exports.Group = group_1.default;

},{"../package.json":206,"./canvas":177,"./group":185,"./shape":192,"@antv/g-base":115}],187:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var g_base_1 = require("@antv/g-base");
var svg_1 = require("../util/svg");
var dom_1 = require("../util/dom");
var draw_1 = require("../util/draw");
var constant_1 = require("../constant");
var Shape = require("./index");
var group_1 = require("../group");
var index_1 = require("@antv/g-base/lib/bbox/index");
var ShapeBase = /** @class */ (function (_super) {
    tslib_1.__extends(ShapeBase, _super);
    function ShapeBase() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'svg';
        _this.canFill = false;
        _this.canStroke = false;
        return _this;
    }
    ShapeBase.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        // 设置默认值
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { lineWidth: 1, lineAppendWidth: 0, strokeOpacity: 1, fillOpacity: 1 });
    };
    // 覆盖基类的 afterAttrsChange 方法
    ShapeBase.prototype.afterAttrsChange = function (targetAttrs) {
        _super.prototype.afterAttrsChange.call(this, targetAttrs);
        var canvas = this.get('canvas');
        // 只有挂载到画布下，才对元素进行实际渲染
        if (canvas && canvas.get('autoDraw')) {
            var context = canvas.get('context');
            this.draw(context, targetAttrs);
        }
    };
    ShapeBase.prototype.getShapeBase = function () {
        return Shape;
    };
    ShapeBase.prototype.getGroupBase = function () {
        return group_1.default;
    };
    /**
     * 一些方法调用会引起画布变化
     * @param {ChangeType} changeType 改变的类型
     */
    ShapeBase.prototype.onCanvasChange = function (changeType) {
        draw_1.refreshElement(this, changeType);
    };
    ShapeBase.prototype.calculateBBox = function () {
        var el = this.get('el');
        var bbox = null;
        // 包围盒计算依赖于绘制，如果还没有生成对应的 Dom 元素，则包围盒的长宽均为 0
        if (el) {
            bbox = el.getBBox();
        }
        else {
            var bboxMethod = index_1.getBBoxMethod(this.get('type'));
            if (bboxMethod) {
                bbox = bboxMethod(this);
            }
        }
        if (bbox) {
            var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height;
            var lineWidth = this.getHitLineWidth();
            var halfWidth = lineWidth / 2;
            var minX = x - halfWidth;
            var minY = y - halfWidth;
            var maxX = x + width + halfWidth;
            var maxY = y + height + halfWidth;
            return {
                x: minX,
                y: minY,
                minX: minX,
                minY: minY,
                maxX: maxX,
                maxY: maxY,
                width: width + lineWidth,
                height: height + lineWidth,
            };
        }
        return {
            x: 0,
            y: 0,
            minX: 0,
            minY: 0,
            maxX: 0,
            maxY: 0,
            width: 0,
            height: 0,
        };
    };
    ShapeBase.prototype.isFill = function () {
        var _a = this.attr(), fill = _a.fill, fillStyle = _a.fillStyle;
        return (fill || fillStyle || this.isClipShape()) && this.canFill;
    };
    ShapeBase.prototype.isStroke = function () {
        var _a = this.attr(), stroke = _a.stroke, strokeStyle = _a.strokeStyle;
        return (stroke || strokeStyle) && this.canStroke;
    };
    ShapeBase.prototype.draw = function (context, targetAttrs) {
        var el = this.get('el');
        if (this.get('destroyed')) {
            if (el) {
                el.parentNode.removeChild(el);
            }
        }
        else {
            if (!el) {
                dom_1.createDom(this);
            }
            svg_1.setClip(this, context);
            this.createPath(context, targetAttrs);
            this.shadow(context, targetAttrs);
            this.strokeAndFill(context, targetAttrs);
            this.transform(targetAttrs);
        }
    };
    /**
     * @protected
     * 绘制图形的路径
     * @param {Defs} context 上下文
     * @param {ShapeAttrs} targetAttrs 渲染的目标属性
     */
    ShapeBase.prototype.createPath = function (context, targetAttrs) { };
    // stroke and fill
    ShapeBase.prototype.strokeAndFill = function (context, targetAttrs) {
        var attrs = targetAttrs || this.attr();
        var fill = attrs.fill, fillStyle = attrs.fillStyle, stroke = attrs.stroke, strokeStyle = attrs.strokeStyle, fillOpacity = attrs.fillOpacity, strokeOpacity = attrs.strokeOpacity, lineWidth = attrs.lineWidth;
        var el = this.get('el');
        if (this.canFill) {
            // 初次渲染和更新渲染的逻辑有所不同: 初次渲染值为空时，需要设置为 none，否则就会是黑色，而更新渲染则不需要
            if (!targetAttrs) {
                this._setColor(context, 'fill', fill || fillStyle);
            }
            else if ('fill' in attrs) {
                this._setColor(context, 'fill', fill);
            }
            else if ('fillStyle' in attrs) {
                // compatible with fillStyle
                this._setColor(context, 'fill', fillStyle);
            }
            if (fillOpacity) {
                el.setAttribute(constant_1.SVG_ATTR_MAP['fillOpacity'], fillOpacity);
            }
        }
        if (this.canStroke && lineWidth > 0) {
            if (!targetAttrs) {
                this._setColor(context, 'stroke', stroke || strokeStyle);
            }
            else if ('stroke' in attrs) {
                this._setColor(context, 'stroke', stroke);
            }
            else if ('strokeStyle' in attrs) {
                // compatible with strokeStyle
                this._setColor(context, 'stroke', strokeStyle);
            }
            if (strokeOpacity) {
                el.setAttribute(constant_1.SVG_ATTR_MAP['strokeOpacity'], strokeOpacity);
            }
            if (lineWidth) {
                el.setAttribute(constant_1.SVG_ATTR_MAP['lineWidth'], lineWidth);
            }
        }
    };
    ShapeBase.prototype._setColor = function (context, attr, value) {
        var el = this.get('el');
        if (!value) {
            // need to set `none` to avoid default value
            el.setAttribute(constant_1.SVG_ATTR_MAP[attr], 'none');
            return;
        }
        value = value.trim();
        if (/^[r,R,L,l]{1}[\s]*\(/.test(value)) {
            var id = context.find('gradient', value);
            if (!id) {
                id = context.addGradient(value);
            }
            el.setAttribute(constant_1.SVG_ATTR_MAP[attr], "url(#" + id + ")");
        }
        else if (/^[p,P]{1}[\s]*\(/.test(value)) {
            var id = context.find('pattern', value);
            if (!id) {
                id = context.addPattern(value);
            }
            el.setAttribute(constant_1.SVG_ATTR_MAP[attr], "url(#" + id + ")");
        }
        else {
            el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
        }
    };
    ShapeBase.prototype.shadow = function (context, targetAttrs) {
        var attrs = this.attr();
        var _a = targetAttrs || attrs, shadowOffsetX = _a.shadowOffsetX, shadowOffsetY = _a.shadowOffsetY, shadowBlur = _a.shadowBlur, shadowColor = _a.shadowColor;
        if (shadowOffsetX || shadowOffsetY || shadowBlur || shadowColor) {
            svg_1.setShadow(this, context);
        }
    };
    ShapeBase.prototype.transform = function (targetAttrs) {
        var attrs = this.attr();
        var matrix = (targetAttrs || attrs).matrix;
        if (matrix) {
            svg_1.setTransform(this);
        }
    };
    ShapeBase.prototype.isInShape = function (refX, refY) {
        return this.isPointInPath(refX, refY);
    };
    ShapeBase.prototype.isPointInPath = function (refX, refY) {
        var el = this.get('el');
        var canvas = this.get('canvas');
        var bbox = canvas.get('el').getBoundingClientRect();
        var clientX = refX + bbox.left;
        var clientY = refY + bbox.top;
        var element = document.elementFromPoint(clientX, clientY);
        if (element && element.isEqualNode(el)) {
            return true;
        }
        return false;
    };
    /**
     * 获取线拾取的宽度
     * @returns {number} 线的拾取宽度
     */
    ShapeBase.prototype.getHitLineWidth = function () {
        var _a = this.attrs, lineWidth = _a.lineWidth, lineAppendWidth = _a.lineAppendWidth;
        if (this.isStroke()) {
            return lineWidth + lineAppendWidth;
        }
        return 0;
    };
    return ShapeBase;
}(g_base_1.AbstractShape));
exports.default = ShapeBase;

},{"../constant":178,"../group":185,"../util/dom":201,"../util/draw":202,"../util/svg":204,"./index":192,"@antv/g-base":115,"@antv/g-base/lib/bbox/index":104,"tslib":894}],188:[function(require,module,exports){
"use strict";
/**
 * @fileoverview circle
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Circle = /** @class */ (function (_super) {
    tslib_1.__extends(Circle, _super);
    function Circle() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'circle';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Circle.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, r: 0 });
    };
    Circle.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            // 圆和椭圆的点坐标属性不是 x, y，而是 cx, cy
            if (attr === 'x' || attr === 'y') {
                el.setAttribute("c" + attr, value);
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    return Circle;
}(base_1.default));
exports.default = Circle;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],189:[function(require,module,exports){
"use strict";
/**
 * @fileoverview dom
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Dom = /** @class */ (function (_super) {
    tslib_1.__extends(Dom, _super);
    function Dom() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'dom';
        _this.canFill = false;
        _this.canStroke = false;
        return _this;
    }
    Dom.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
        el.innerHTML = attrs['html']; // set innerHTML
    };
    return Dom;
}(base_1.default));
exports.default = Dom;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],190:[function(require,module,exports){
"use strict";
/**
 * @fileoverview ellipse
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Ellipse = /** @class */ (function (_super) {
    tslib_1.__extends(Ellipse, _super);
    function Ellipse() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'ellipse';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Ellipse.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, rx: 0, ry: 0 });
    };
    Ellipse.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            // 圆和椭圆的点坐标属性不是 x, y，而是 cx, cy
            if (attr === 'x' || attr === 'y') {
                el.setAttribute("c" + attr, value);
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    return Ellipse;
}(base_1.default));
exports.default = Ellipse;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],191:[function(require,module,exports){
"use strict";
/**
 * @fileoverview image
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Image = /** @class */ (function (_super) {
    tslib_1.__extends(Image, _super);
    function Image() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'image';
        _this.canFill = false;
        _this.canStroke = false;
        return _this;
    }
    Image.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0 });
    };
    Image.prototype.createPath = function (context, targetAttrs) {
        var _this = this;
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'img') {
                _this._setImage(attrs.img);
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    Image.prototype.setAttr = function (name, value) {
        this.attrs[name] = value;
        if (name === 'img') {
            this._setImage(value);
        }
    };
    Image.prototype._setImage = function (img) {
        var attrs = this.attr();
        var el = this.get('el');
        if (util_1.isString(img)) {
            el.setAttribute('href', img);
        }
        else if (img instanceof window.Image) {
            if (!attrs.width) {
                el.setAttribute('width', img.width);
                this.attr('width', img.width);
            }
            if (!attrs.height) {
                el.setAttribute('height', img.height);
                this.attr('height', img.height);
            }
            el.setAttribute('href', img.src);
        }
        else if (img instanceof HTMLElement && util_1.isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
            // @ts-ignore
            el.setAttribute('href', img.toDataURL());
        }
        else if (img instanceof ImageData) {
            var canvas = document.createElement('canvas');
            canvas.setAttribute('width', "" + img.width);
            canvas.setAttribute('height', "" + img.height);
            canvas.getContext('2d').putImageData(img, 0, 0);
            if (!attrs.width) {
                el.setAttribute('width', "" + img.width);
                this.attr('width', img.width);
            }
            if (!attrs.height) {
                el.setAttribute('height', "" + img.height);
                this.attr('height', img.height);
            }
            el.setAttribute('href', canvas.toDataURL());
        }
    };
    return Image;
}(base_1.default));
exports.default = Image;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],192:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base");
exports.Base = base_1.default;
var circle_1 = require("./circle");
exports.Circle = circle_1.default;
var dom_1 = require("./dom");
exports.Dom = dom_1.default;
var ellipse_1 = require("./ellipse");
exports.Ellipse = ellipse_1.default;
var image_1 = require("./image");
exports.Image = image_1.default;
var line_1 = require("./line");
exports.Line = line_1.default;
var marker_1 = require("./marker");
exports.Marker = marker_1.default;
var path_1 = require("./path");
exports.Path = path_1.default;
var polygon_1 = require("./polygon");
exports.Polygon = polygon_1.default;
var polyline_1 = require("./polyline");
exports.Polyline = polyline_1.default;
var rect_1 = require("./rect");
exports.Rect = rect_1.default;
var text_1 = require("./text");
exports.Text = text_1.default;

},{"./base":187,"./circle":188,"./dom":189,"./ellipse":190,"./image":191,"./line":193,"./marker":194,"./path":196,"./polygon":197,"./polyline":198,"./rect":199,"./text":200}],193:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @fileoverview line
 * @author dengfuping_develop@163.com
 */
var line_1 = require("@antv/g-math/lib/line");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'line';
        _this.canFill = false;
        _this.canStroke = true;
        return _this;
    }
    Line.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x1: 0, y1: 0, x2: 0, y2: 0, startArrow: false, endArrow: false });
    };
    Line.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'startArrow' || attr === 'endArrow') {
                if (value) {
                    var id = util_1.isObject(value)
                        ? context.addArrow(attrs, constant_1.SVG_ATTR_MAP[attr])
                        : context.getDefaultArrow(attrs, constant_1.SVG_ATTR_MAP[attr]);
                    el.setAttribute(constant_1.SVG_ATTR_MAP[attr], "url(#" + id + ")");
                }
                else {
                    el.removeAttribute(constant_1.SVG_ATTR_MAP[attr]);
                }
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    /**
     * Use math calculation to get length of line
     * @return {number} length
     */
    Line.prototype.getTotalLength = function () {
        var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
        return line_1.default.length(x1, y1, x2, y2);
    };
    /**
     * Use math calculation to get point according to ratio as same sa Canvas version
     * @param {number} ratio
     * @return {Point} point
     */
    Line.prototype.getPoint = function (ratio) {
        var _a = this.attr(), x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
        return line_1.default.pointAt(x1, y1, x2, y2, ratio);
    };
    return Line;
}(base_1.default));
exports.default = Line;

},{"../constant":178,"./base":187,"@antv/g-math/lib/line":172,"@antv/util":803,"tslib":894}],194:[function(require,module,exports){
"use strict";
/**
 * @fileoverview marker
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var symbols_1 = require("./symbols");
var Marker = /** @class */ (function (_super) {
    tslib_1.__extends(Marker, _super);
    function Marker() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'marker';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Marker.prototype.createPath = function (context) {
        var el = this.get('el');
        el.setAttribute('d', this._assembleMarker());
    };
    Marker.prototype._assembleMarker = function () {
        var d = this._getPath();
        if (util_1.isArray(d)) {
            return d
                .map(function (path) {
                return path.join(' ');
            })
                .join('');
        }
        return d;
    };
    Marker.prototype._getPath = function () {
        var attrs = this.attr();
        var x = attrs.x, y = attrs.y;
        // 兼容 r 和 radius 两种写法，推荐使用 r
        var r = attrs.r || attrs.radius;
        var symbol = attrs.symbol || 'circle';
        var method;
        if (util_1.isFunction(symbol)) {
            method = symbol;
        }
        else {
            method = symbols_1.default.get(symbol);
        }
        if (!method) {
            console.warn(method + " symbol is not exist.");
            return null;
        }
        return method(x, y, r);
    };
    // 作为其静态属性
    Marker.symbolsFactory = symbols_1.default;
    return Marker;
}(base_1.default));
exports.default = Marker;

},{"../base":187,"./symbols":195,"@antv/util":803,"tslib":894}],195:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Symbols = {
    // 圆
    circle: function (x, y, r) {
        return [['M', x, y], ['m', -r, 0], ['a', r, r, 0, 1, 0, r * 2, 0], ['a', r, r, 0, 1, 0, -r * 2, 0]];
    },
    // 正方形
    square: function (x, y, r) {
        return [['M', x - r, y - r], ['L', x + r, y - r], ['L', x + r, y + r], ['L', x - r, y + r], ['Z']];
    },
    // 菱形
    diamond: function (x, y, r) {
        return [['M', x - r, y], ['L', x, y - r], ['L', x + r, y], ['L', x, y + r], ['Z']];
    },
    // 三角形
    triangle: function (x, y, r) {
        var diffY = r * Math.sin((1 / 3) * Math.PI);
        return [['M', x - r, y + diffY], ['L', x, y - diffY], ['L', x + r, y + diffY], ['z']];
    },
    // 倒三角形
    triangleDown: function (x, y, r) {
        var diffY = r * Math.sin((1 / 3) * Math.PI);
        return [['M', x - r, y - diffY], ['L', x + r, y - diffY], ['L', x, y + diffY], ['Z']];
    },
};
exports.default = {
    get: function (type) {
        return Symbols[type];
    },
    register: function (type, func) {
        Symbols[type] = func;
    },
    remove: function (type) {
        delete Symbols[type];
    },
    getAll: function () {
        return Symbols;
    },
};

},{}],196:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Path = /** @class */ (function (_super) {
    tslib_1.__extends(Path, _super);
    function Path() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'path';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Path.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false });
    };
    Path.prototype.createPath = function (context, targetAttrs) {
        var _this = this;
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'path' && util_1.isArray(value)) {
                el.setAttribute('d', _this._formatPath(value));
            }
            else if (attr === 'startArrow' || attr === 'endArrow') {
                if (value) {
                    var id = util_1.isObject(value)
                        ? context.addArrow(attrs, constant_1.SVG_ATTR_MAP[attr])
                        : context.getDefaultArrow(attrs, constant_1.SVG_ATTR_MAP[attr]);
                    el.setAttribute(constant_1.SVG_ATTR_MAP[attr], "url(#" + id + ")");
                }
                else {
                    el.removeAttribute(constant_1.SVG_ATTR_MAP[attr]);
                }
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    Path.prototype._formatPath = function (value) {
        var newValue = value
            .map(function (path) {
            return path.join(' ');
        })
            .join('');
        if (~newValue.indexOf('NaN')) {
            return '';
        }
        return newValue;
    };
    /**
     * Get total length of path
     * 尽管通过浏览器的 SVGPathElement.getTotalLength() 接口获取的 path 长度，
     * 与 Canvas 版本通过数学计算的方式得到的长度有一些细微差异，但最大误差在个位数像素，精度上可以能接受
     * @return {number} length
     */
    Path.prototype.getTotalLength = function () {
        var el = this.get('el');
        return el ? el.getTotalLength() : null;
    };
    /**
     * Get point according to ratio
     * @param {number} ratio
     * @return {Point} point
     */
    Path.prototype.getPoint = function (ratio) {
        var el = this.get('el');
        var totalLength = this.getTotalLength();
        var point = el ? el.getPointAtLength(ratio * totalLength) : null;
        return point
            ? {
                x: point.x,
                y: point.y,
            }
            : null;
    };
    return Path;
}(base_1.default));
exports.default = Path;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],197:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @fileoverview polygon
 * @author dengfuping_develop@163.com
 */
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Polygon = /** @class */ (function (_super) {
    tslib_1.__extends(Polygon, _super);
    function Polygon() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'polygon';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Polygon.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'points' && util_1.isArray(value) && value.length >= 2) {
                el.setAttribute('points', value.map(function (point) { return point[0] + "," + point[1]; }).join(' '));
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    return Polygon;
}(base_1.default));
exports.default = Polygon;

},{"../constant":178,"./base":187,"@antv/util":803,"tslib":894}],198:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var line_1 = require("@antv/g-math/lib/line");
var polyline_1 = require("@antv/g-math/lib/polyline");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = require("./base");
var Polyline = /** @class */ (function (_super) {
    tslib_1.__extends(Polyline, _super);
    function Polyline() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'polyline';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Polyline.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { startArrow: false, endArrow: false });
    };
    // 更新属性时，检测是否更改了 points
    Polyline.prototype.onAttrChange = function (name, value, originValue) {
        _super.prototype.onAttrChange.call(this, name, value, originValue);
        if (['points'].indexOf(name) !== -1) {
            this._resetCache();
        }
    };
    Polyline.prototype._resetCache = function () {
        this.set('totalLength', null);
        this.set('tCache', null);
    };
    Polyline.prototype.createPath = function (context, targetAttrs) {
        var attrs = this.attr();
        var el = this.get('el');
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'points' && util_1.isArray(value) && value.length >= 2) {
                el.setAttribute('points', value.map(function (point) { return point[0] + "," + point[1]; }).join(' '));
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    /**
     * Get length of polyline
     * @return {number} length
     */
    Polyline.prototype.getTotalLength = function () {
        var points = this.attr().points;
        // get totalLength from cache
        var totalLength = this.get('totalLength');
        if (!util_1.isNil(totalLength)) {
            return totalLength;
        }
        this.set('totalLength', polyline_1.default.length(points));
        return this.get('totalLength');
    };
    /**
     * Get point according to ratio
     * @param {number} ratio
     * @return {Point} point
     */
    Polyline.prototype.getPoint = function (ratio) {
        var points = this.attr().points;
        // get tCache from cache
        var tCache = this.get('tCache');
        if (!tCache) {
            this._setTcache();
            tCache = this.get('tCache');
        }
        var subt;
        var index;
        util_1.each(tCache, function (v, i) {
            if (ratio >= v[0] && ratio <= v[1]) {
                subt = (ratio - v[0]) / (v[1] - v[0]);
                index = i;
            }
        });
        return line_1.default.pointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt);
    };
    Polyline.prototype._setTcache = function () {
        var points = this.attr().points;
        if (!points || points.length === 0) {
            return;
        }
        var totalLength = this.getTotalLength();
        if (totalLength <= 0) {
            return;
        }
        var tempLength = 0;
        var tCache = [];
        var segmentT;
        var segmentL;
        util_1.each(points, function (p, i) {
            if (points[i + 1]) {
                segmentT = [];
                segmentT[0] = tempLength / totalLength;
                segmentL = line_1.default.length(p[0], p[1], points[i + 1][0], points[i + 1][1]);
                tempLength += segmentL;
                segmentT[1] = tempLength / totalLength;
                tCache.push(segmentT);
            }
        });
        this.set('tCache', tCache);
    };
    /**
     * Get start tangent vector
     * @return {Array}
     */
    Polyline.prototype.getStartTangent = function () {
        var points = this.attr().points;
        var result = [];
        result.push([points[1][0], points[1][1]]);
        result.push([points[0][0], points[0][1]]);
        return result;
    };
    /**
     * Get end tangent vector
     * @return {Array}
     */
    Polyline.prototype.getEndTangent = function () {
        var points = this.attr().points;
        var l = points.length - 1;
        var result = [];
        result.push([points[l - 1][0], points[l - 1][1]]);
        result.push([points[l][0], points[l][1]]);
        return result;
    };
    return Polyline;
}(base_1.default));
exports.default = Polyline;

},{"../constant":178,"./base":187,"@antv/g-math/lib/line":172,"@antv/g-math/lib/polyline":173,"@antv/util":803,"tslib":894}],199:[function(require,module,exports){
"use strict";
/**
 * @fileoverview rect
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var constant_1 = require("../constant");
var format_1 = require("../util/format");
var Rect = /** @class */ (function (_super) {
    tslib_1.__extends(Rect, _super);
    function Rect() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'rect';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Rect.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, width: 0, height: 0, radius: 0 });
    };
    Rect.prototype.createPath = function (context, targetAttrs) {
        var _this = this;
        var attrs = this.attr();
        var el = this.get('el');
        // 加上状态量，用来标记 path 是否已组装
        var completed = false;
        // 和组装 path 相关的绘图属性
        var pathRelatedAttrs = ['x', 'y', 'width', 'height', 'radius'];
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (pathRelatedAttrs.indexOf(attr) !== -1 && !completed) {
                el.setAttribute('d', _this._assembleRect(attrs));
                completed = true;
            }
            else if (pathRelatedAttrs.indexOf(attr) === -1 && constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
    };
    Rect.prototype._assembleRect = function (attrs) {
        var x = attrs.x;
        var y = attrs.y;
        var w = attrs.width;
        var h = attrs.height;
        var radius = attrs.radius;
        if (!radius) {
            return "M " + x + "," + y + " l " + w + ",0 l 0," + h + " l" + -w + " 0 z";
        }
        var r = format_1.parseRadius(radius);
        if (util_1.isArray(radius)) {
            if (radius.length === 1) {
                r.r1 = r.r2 = r.r3 = r.r4 = radius[0];
            }
            else if (radius.length === 2) {
                r.r1 = r.r3 = radius[0];
                r.r2 = r.r4 = radius[1];
            }
            else if (radius.length === 3) {
                r.r1 = radius[0];
                r.r2 = r.r4 = radius[1];
                r.r3 = radius[2];
            }
            else {
                r.r1 = radius[0];
                r.r2 = radius[1];
                r.r3 = radius[2];
                r.r4 = radius[3];
            }
        }
        else {
            r.r1 = r.r2 = r.r3 = r.r4 = radius;
        }
        var d = [
            ["M " + (x + r.r1) + "," + y],
            ["l " + (w - r.r1 - r.r2) + ",0"],
            ["a " + r.r2 + "," + r.r2 + ",0,0,1," + r.r2 + "," + r.r2],
            ["l 0," + (h - r.r2 - r.r3)],
            ["a " + r.r3 + "," + r.r3 + ",0,0,1," + -r.r3 + "," + r.r3],
            ["l " + (r.r3 + r.r4 - w) + ",0"],
            ["a " + r.r4 + "," + r.r4 + ",0,0,1," + -r.r4 + "," + -r.r4],
            ["l 0," + (r.r4 + r.r1 - h)],
            ["a " + r.r1 + "," + r.r1 + ",0,0,1," + r.r1 + "," + -r.r1],
            ['z'],
        ];
        return d.join(' ');
    };
    return Rect;
}(base_1.default));
exports.default = Rect;

},{"../constant":178,"../util/format":203,"./base":187,"@antv/util":803,"tslib":894}],200:[function(require,module,exports){
"use strict";
/**
 * @fileoverview text
 * @author dengfuping_develop@163.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var detect_browser_1 = require("detect-browser");
var svg_1 = require("../util/svg");
var constant_1 = require("../constant");
var base_1 = require("./base");
var LETTER_SPACING = 0.3;
var BASELINE_MAP = {
    top: 'before-edge',
    middle: 'central',
    bottom: 'after-edge',
    alphabetic: 'baseline',
    hanging: 'hanging',
};
// for FireFox
var BASELINE_MAP_FOR_FIREFOX = {
    top: 'text-before-edge',
    middle: 'central',
    bottom: 'text-after-edge',
    alphabetic: 'alphabetic',
    hanging: 'hanging',
};
var ANCHOR_MAP = {
    left: 'left',
    start: 'left',
    center: 'middle',
    right: 'end',
    end: 'end',
};
var Text = /** @class */ (function (_super) {
    tslib_1.__extends(Text, _super);
    function Text() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'text';
        _this.canFill = true;
        _this.canStroke = true;
        return _this;
    }
    Text.prototype.getDefaultAttrs = function () {
        var attrs = _super.prototype.getDefaultAttrs.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, attrs), { x: 0, y: 0, text: null, fontSize: 12, fontFamily: 'sans-serif', fontStyle: 'normal', fontWeight: 'normal', fontVariant: 'normal', textAlign: 'start', textBaseline: 'bottom' });
    };
    Text.prototype.createPath = function (context, targetAttrs) {
        var _this = this;
        var attrs = this.attr();
        var el = this.get('el');
        this._setFont();
        util_1.each(targetAttrs || attrs, function (value, attr) {
            if (attr === 'text') {
                _this._setText("" + value);
            }
            else if (attr === 'matrix' && value) {
                svg_1.setTransform(_this);
            }
            else if (constant_1.SVG_ATTR_MAP[attr]) {
                el.setAttribute(constant_1.SVG_ATTR_MAP[attr], value);
            }
        });
        el.setAttribute('paint-order', 'stroke');
        el.setAttribute('style', 'stroke-linecap:butt; stroke-linejoin:miter;');
    };
    Text.prototype._setFont = function () {
        var el = this.get('el');
        var _a = this.attr(), textBaseline = _a.textBaseline, textAlign = _a.textAlign;
        var browser = detect_browser_1.detect();
        if (browser && browser.name === 'firefox') {
            // compatible with FireFox browser, ref: https://github.com/antvis/g/issues/119
            el.setAttribute('dominant-baseline', BASELINE_MAP_FOR_FIREFOX[textBaseline] || 'alphabetic');
        }
        else {
            el.setAttribute('alignment-baseline', BASELINE_MAP[textBaseline] || 'baseline');
        }
        el.setAttribute('text-anchor', ANCHOR_MAP[textAlign] || 'left');
    };
    Text.prototype._setText = function (text) {
        var el = this.get('el');
        var _a = this.attr(), x = _a.x, _b = _a.textBaseline, baseline = _b === void 0 ? 'bottom' : _b;
        if (!text) {
            el.innerHTML = '';
        }
        else if (~text.indexOf('\n')) {
            var textArr = text.split('\n');
            var textLen_1 = textArr.length - 1;
            var arr_1 = '';
            util_1.each(textArr, function (segment, i) {
                if (i === 0) {
                    if (baseline === 'alphabetic') {
                        arr_1 += "<tspan x=\"" + x + "\" dy=\"" + -textLen_1 + "em\">" + segment + "</tspan>";
                    }
                    else if (baseline === 'top') {
                        arr_1 += "<tspan x=\"" + x + "\" dy=\"0.9em\">" + segment + "</tspan>";
                    }
                    else if (baseline === 'middle') {
                        arr_1 += "<tspan x=\"" + x + "\" dy=\"" + -(textLen_1 - 1) / 2 + "em\">" + segment + "</tspan>";
                    }
                    else if (baseline === 'bottom') {
                        arr_1 += "<tspan x=\"" + x + "\" dy=\"-" + (textLen_1 + LETTER_SPACING) + "em\">" + segment + "</tspan>";
                    }
                    else if (baseline === 'hanging') {
                        arr_1 += "<tspan x=\"" + x + "\" dy=\"" + (-(textLen_1 - 1) - LETTER_SPACING) + "em\">" + segment + "</tspan>";
                    }
                }
                else {
                    arr_1 += "<tspan x=\"" + x + "\" dy=\"1em\">" + segment + "</tspan>";
                }
            });
            el.innerHTML = arr_1;
        }
        else {
            el.innerHTML = text;
        }
    };
    return Text;
}(base_1.default));
exports.default = Text;

},{"../constant":178,"../util/svg":204,"./base":187,"@antv/util":803,"detect-browser":205,"tslib":894}],201:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
/**
 * 创建并返回图形的 svg 元素
 * @param type svg类型
 */
function createSVGElement(type) {
    return document.createElementNS('http://www.w3.org/2000/svg', type);
}
exports.createSVGElement = createSVGElement;
/**
 * 创建并返回图形的 dom 元素
 * @param  {IShape} shape 图形
 * @return {SVGElement}
 */
function createDom(shape) {
    var type = constant_1.SHAPE_TO_TAGS[shape.type];
    var parent = shape.getParent();
    if (!type) {
        throw new Error("the type " + shape.type + " is not supported by svg");
    }
    var element = createSVGElement(type);
    if (shape.get('id')) {
        element.id = shape.get('id');
    }
    shape.set('el', element);
    shape.set('attrs', {});
    // 对于 defs 下的 dom 节点，parent 为空，通过 context 统一挂载到 defs 节点下
    if (parent) {
        var parentNode = parent.get('el');
        if (parentNode) {
            parentNode.appendChild(element);
        }
        else {
            // parentNode maybe null for group
            parentNode = parent.createDom();
            parent.set('el', parentNode);
            parentNode.appendChild(element);
        }
    }
    return element;
}
exports.createDom = createDom;
/**
 * 对 dom 元素进行排序
 * @param {IElement} element  元素
 * @param {sorter}   function 排序函数
 */
function sortDom(element, sorter) {
    var el = element.get('el');
    var childList = util_1.toArray(el.children).sort(sorter);
    // create empty fragment
    var fragment = document.createDocumentFragment();
    childList.forEach(function (child) {
        fragment.appendChild(child);
    });
    el.appendChild(fragment);
}
exports.sortDom = sortDom;
/**
 * 将 dom 元素移动到父元素下的指定位置
 * @param {SVGElement} element     dom 元素
 * @param {number}     targetIndex 目标位置(从 0 开始)
 */
function moveTo(element, targetIndex) {
    var parentNode = element.parentNode;
    var siblings = Array.from(parentNode.childNodes).filter(
    // 要求为元素节点，且不能为 defs 节点
    function (node) { return node.nodeType === 1 && node.nodeName.toLowerCase() !== 'defs'; });
    // 获取目标节点
    var target = siblings[targetIndex];
    var currentIndex = siblings.indexOf(element);
    // 如果目标节点存在
    if (target) {
        // 当前索引 > 目标索引，直接插入到目标节点之前即可
        if (currentIndex > targetIndex) {
            parentNode.insertBefore(element, target);
        }
        else if (currentIndex < targetIndex) {
            // 当前索引 < 目标索引
            // 获取目标节点的下一个节点
            var targetNext = siblings[targetIndex + 1];
            // 如果目标节点的下一个节点存在，插入到该节点之前
            if (targetNext) {
                parentNode.insertBefore(element, targetNext);
            }
            else {
                // 如果该节点不存在，则追加到末尾
                parentNode.appendChild(element);
            }
        }
    }
    else {
        parentNode.appendChild(element);
    }
}
exports.moveTo = moveTo;

},{"../constant":178,"@antv/util":803}],202:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var svg_1 = require("./svg");
var dom_1 = require("./dom");
function drawChildren(context, children) {
    children.forEach(function (child) {
        child.draw(context);
    });
}
exports.drawChildren = drawChildren;
/**
 * 更新元素，包括 group 和 shape
 * @param {IElement} element       SVG 元素
 * @param {ChangeType} changeType  更新类型
 */
function refreshElement(element, changeType) {
    // 对于还没有挂载到画布下的元素，canvas 可能为空
    var canvas = element.get('canvas');
    // 只有挂载到画布下，才对元素进行实际渲染
    if (canvas && canvas.get('autoDraw')) {
        var context = canvas.get('context');
        var parent_1 = element.getParent();
        var parentChildren = parent_1 ? parent_1.getChildren() : [canvas];
        var el = element.get('el');
        if (changeType === 'remove') {
            var isClipShape = element.get('isClipShape');
            // 对于 clip，不仅需要将 clipShape 对于的 SVG 元素删除，还需要将上层的 clipPath 元素也删除
            if (isClipShape) {
                var clipPathEl = el && el.parentNode;
                var defsEl = clipPathEl && clipPathEl.parentNode;
                if (clipPathEl && defsEl) {
                    defsEl.removeChild(clipPathEl);
                }
            }
            else if (el && el.parentNode) {
                el.parentNode.removeChild(el);
            }
        }
        else if (changeType === 'show') {
            el.setAttribute('visibility', 'visible');
        }
        else if (changeType === 'hide') {
            el.setAttribute('visibility', 'hidden');
        }
        else if (changeType === 'zIndex') {
            dom_1.moveTo(el, parentChildren.indexOf(element));
        }
        else if (changeType === 'sort') {
            var children_1 = element.get('children');
            if (children_1 && children_1.length) {
                dom_1.sortDom(element, function (a, b) {
                    return children_1.indexOf(a) - children_1.indexOf(b) ? 1 : 0;
                });
            }
        }
        else if (changeType === 'clear') {
            // el maybe null for group
            if (el) {
                el.innerHTML = '';
            }
        }
        else if (changeType === 'matrix') {
            svg_1.setTransform(element);
        }
        else if (changeType === 'clip') {
            svg_1.setClip(element, context);
        }
        else if (changeType === 'attr') {
            // 已在 afterAttrsChange 进行了处理，此处 do nothing
        }
        else if (changeType === 'add') {
            element.draw(context);
        }
    }
}
exports.refreshElement = refreshElement;

},{"./dom":201,"./svg":204}],203:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi;
var regexDot = /[^\s\,]+/gi;
function parseRadius(radius) {
    var r1 = 0;
    var r2 = 0;
    var r3 = 0;
    var r4 = 0;
    if (util_1.isArray(radius)) {
        if (radius.length === 1) {
            r1 = r2 = r3 = r4 = radius[0];
        }
        else if (radius.length === 2) {
            r1 = r3 = radius[0];
            r2 = r4 = radius[1];
        }
        else if (radius.length === 3) {
            r1 = radius[0];
            r2 = r4 = radius[1];
            r3 = radius[2];
        }
        else {
            r1 = radius[0];
            r2 = radius[1];
            r3 = radius[2];
            r4 = radius[3];
        }
    }
    else {
        r1 = r2 = r3 = r4 = radius;
    }
    return {
        r1: r1,
        r2: r2,
        r3: r3,
        r4: r4,
    };
}
exports.parseRadius = parseRadius;
function parsePath(path) {
    path = path || [];
    if (util_1.isArray(path)) {
        return path;
    }
    if (util_1.isString(path)) {
        path = path.match(regexTags);
        util_1.each(path, function (item, index) {
            item = item.match(regexDot);
            if (item[0].length > 1) {
                var tag = item[0].charAt(0);
                item.splice(1, 0, item[0].substr(1));
                item[0] = tag;
            }
            util_1.each(item, function (sub, i) {
                if (!isNaN(sub)) {
                    item[i] = +sub;
                }
            });
            path[index] = item;
        });
        return path;
    }
}
exports.parsePath = parsePath;

},{"@antv/util":803}],204:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dom_1 = require("./dom");
function setShadow(model, context) {
    var el = model.cfg.el;
    var attrs = model.attr();
    var cfg = {
        dx: attrs.shadowOffsetX,
        dy: attrs.shadowOffsetY,
        blur: attrs.shadowBlur,
        color: attrs.shadowColor,
    };
    if (!cfg.dx && !cfg.dy && !cfg.blur && !cfg.color) {
        el.removeAttribute('filter');
    }
    else {
        var id = context.find('filter', cfg);
        if (!id) {
            id = context.addShadow(cfg);
        }
        el.setAttribute('filter', "url(#" + id + ")");
    }
}
exports.setShadow = setShadow;
function setTransform(model) {
    var matrix = model.attr().matrix;
    if (matrix) {
        var el = model.cfg.el;
        var transform = [];
        for (var i = 0; i < 9; i += 3) {
            transform.push(matrix[i] + "," + matrix[i + 1]);
        }
        transform = transform.join(',');
        if (transform.indexOf('NaN') === -1) {
            el.setAttribute('transform', "matrix(" + transform + ")");
        }
        else {
            console.warn('invalid matrix:', matrix);
        }
    }
}
exports.setTransform = setTransform;
function setClip(model, context) {
    var clip = model.getClip();
    var el = model.get('el');
    if (!clip) {
        el.removeAttribute('clip-path');
    }
    else if (clip && !el.hasAttribute('clip-path')) {
        dom_1.createDom(clip);
        clip.createPath(context);
        var id = context.addClip(clip);
        el.setAttribute('clip-path', "url(#" + id + ")");
    }
}
exports.setClip = setClip;

},{"./dom":201}],205:[function(require,module,exports){
(function (process){
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var BrowserInfo = /** @class */ (function () {
    function BrowserInfo(name, version, os) {
        this.name = name;
        this.version = version;
        this.os = os;
    }
    return BrowserInfo;
}());
exports.BrowserInfo = BrowserInfo;
var NodeInfo = /** @class */ (function () {
    function NodeInfo(version) {
        this.version = version;
        this.name = 'node';
        this.os = process.platform;
    }
    return NodeInfo;
}());
exports.NodeInfo = NodeInfo;
var BotInfo = /** @class */ (function () {
    function BotInfo() {
        this.bot = true; // NOTE: deprecated test name instead
        this.name = 'bot';
        this.version = null;
        this.os = null;
    }
    return BotInfo;
}());
exports.BotInfo = BotInfo;
// tslint:disable-next-line:max-line-length
var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;
var SEARCHBOT_OS_REGEX = /(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/;
var REQUIRED_VERSION_PARTS = 3;
var userAgentRules = [
    ['aol', /AOLShield\/([0-9\._]+)/],
    ['edge', /Edge\/([0-9\._]+)/],
    ['edge-ios', /EdgiOS\/([0-9\._]+)/],
    ['yandexbrowser', /YaBrowser\/([0-9\._]+)/],
    ['vivaldi', /Vivaldi\/([0-9\.]+)/],
    ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/],
    ['samsung', /SamsungBrowser\/([0-9\.]+)/],
    ['silk', /\bSilk\/([0-9._-]+)\b/],
    ['miui', /MiuiBrowser\/([0-9\.]+)$/],
    ['beaker', /BeakerBrowser\/([0-9\.]+)/],
    ['edge-chromium', /Edg\/([0-9\.]+)/],
    [
        'chromium-webview',
        /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/,
    ],
    ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
    ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/],
    ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/],
    ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/],
    ['fxios', /FxiOS\/([0-9\.]+)/],
    ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/],
    ['opera', /Opera\/([0-9\.]+)(?:\s|$)/],
    ['opera', /OPR\/([0-9\.]+)(:?\s|$)/],
    ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
    ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
    ['ie', /MSIE\s(7\.0)/],
    ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/],
    ['android', /Android\s([0-9\.]+)/],
    ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/],
    ['safari', /Version\/([0-9\._]+).*Safari/],
    ['facebook', /FBAV\/([0-9\.]+)/],
    ['instagram', /Instagram\s([0-9\.]+)/],
    ['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/],
    ['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
    ['searchbot', SEARCHBOX_UA_REGEX],
];
var operatingSystemRules = [
    ['iOS', /iP(hone|od|ad)/],
    ['Android OS', /Android/],
    ['BlackBerry OS', /BlackBerry|BB10/],
    ['Windows Mobile', /IEMobile/],
    ['Amazon OS', /Kindle/],
    ['Windows 3.11', /Win16/],
    ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],
    ['Windows 98', /(Windows 98)|(Win98)/],
    ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],
    ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],
    ['Windows Server 2003', /(Windows NT 5.2)/],
    ['Windows Vista', /(Windows NT 6.0)/],
    ['Windows 7', /(Windows NT 6.1)/],
    ['Windows 8', /(Windows NT 6.2)/],
    ['Windows 8.1', /(Windows NT 6.3)/],
    ['Windows 10', /(Windows NT 10.0)/],
    ['Windows ME', /Windows ME/],
    ['Open BSD', /OpenBSD/],
    ['Sun OS', /SunOS/],
    ['Chrome OS', /CrOS/],
    ['Linux', /(Linux)|(X11)/],
    ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],
    ['QNX', /QNX/],
    ['BeOS', /BeOS/],
    ['OS/2', /OS\/2/],
    ['Search Bot', SEARCHBOT_OS_REGEX],
];
function detect(userAgent) {
    if (!!userAgent) {
        return parseUserAgent(userAgent);
    }
    if (typeof navigator !== 'undefined') {
        return parseUserAgent(navigator.userAgent);
    }
    return getNodeVersion();
}
exports.detect = detect;
function parseUserAgent(ua) {
    // opted for using reduce here rather than Array#first with a regex.test call
    // this is primarily because using the reduce we only perform the regex
    // execution once rather than once for the test and for the exec again below
    // probably something that needs to be benchmarked though
    var matchedRule = ua !== '' &&
        userAgentRules.reduce(function (matched, _a) {
            var browser = _a[0], regex = _a[1];
            if (matched) {
                return matched;
            }
            var uaMatch = regex.exec(ua);
            return !!uaMatch && [browser, uaMatch];
        }, false);
    if (!matchedRule) {
        return null;
    }
    var name = matchedRule[0], match = matchedRule[1];
    if (name === 'searchbot') {
        return new BotInfo();
    }
    var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);
    if (versionParts) {
        if (versionParts.length < REQUIRED_VERSION_PARTS) {
            versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length));
        }
    }
    else {
        versionParts = [];
    }
    return new BrowserInfo(name, versionParts.join('.'), detectOS(ua));
}
exports.parseUserAgent = parseUserAgent;
function detectOS(ua) {
    for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {
        var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];
        var match = regex.test(ua);
        if (match) {
            return os;
        }
    }
    return null;
}
exports.detectOS = detectOS;
function getNodeVersion() {
    var isNode = typeof process !== 'undefined' && process.version;
    return isNode ? new NodeInfo(process.version.slice(1)) : null;
}
exports.getNodeVersion = getNodeVersion;
function createVersionParts(count) {
    var output = [];
    for (var ii = 0; ii < count; ii++) {
        output.push('0');
    }
    return output;
}

}).call(this,require('_process'))

},{"_process":1}],206:[function(require,module,exports){
module.exports={
  "__npminstall_done": false,
  "_args": [
    [
      "@antv/g-svg@0.4.7",
      "C:\\xampp\\htdocs\\icehrm\\web"
    ]
  ],
  "_from": "@antv/g-svg@0.4.7",
  "_id": "@antv/g-svg@0.4.7",
  "_inBundle": false,
  "_integrity": "sha512-+lqlBK+qylP4t/vyUgEaPthp1XmTiImfkPl/ZmRp3L1knH64OI9XTfOGGuBUFAt3JBt7VHKf6t0L/MCf0BR88Q==",
  "_location": "/@antv/g-svg",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "@antv/g-svg@0.4.7",
    "name": "@antv/g-svg",
    "escapedName": "@antv%2fg-svg",
    "scope": "@antv",
    "rawSpec": "0.4.7",
    "saveSpec": null,
    "fetchSpec": "0.4.7"
  },
  "_requiredBy": [
    "/@antv/g2",
    "/@antv/g2plot"
  ],
  "_resolved": "https://registry.npmjs.org/@antv/g-svg/-/g-svg-0.4.7.tgz",
  "_spec": "0.4.7",
  "_where": "C:\\xampp\\htdocs\\icehrm\\web",
  "author": {
    "name": "https://github.com/orgs/antvis/people"
  },
  "bugs": {
    "url": "https://github.com/antvis/g/issues"
  },
  "dependencies": {
    "@antv/g-base": "^0.4.7",
    "@antv/g-math": "^0.1.3",
    "@antv/util": "~2.0.0",
    "detect-browser": "^4.6.0"
  },
  "description": "A canvas library which providing 2d",
  "devDependencies": {
    "@antv/torch": "^1.0.0",
    "less": "^3.9.0",
    "npm-run-all": "^4.1.5",
    "webpack": "^4.39.3",
    "webpack-cli": "^3.3.7"
  },
  "files": [
    "package.json",
    "esm",
    "lib",
    "dist",
    "LICENSE",
    "README.md"
  ],
  "gitHead": "eb6a2503cb7bb8154697592b10680939d954a31a",
  "homepage": "https://github.com/antvis/g#readme",
  "keywords": [
    "util",
    "antv",
    "g"
  ],
  "license": "ISC",
  "main": "lib/index.js",
  "module": "esm/index.js",
  "name": "@antv/g-svg",
  "publishConfig": {
    "access": "public"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/antvis/g.git"
  },
  "scripts": {
    "build": "npm run clean && run-p build:*",
    "build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib",
    "build:esm": "tsc -p tsconfig.json --target ES5 --module ESNext --outDir esm",
    "build:umd": "webpack --config webpack.config.js --mode production",
    "clean": "rm -rf esm lib dist",
    "coverage": "npm run coverage-generator && npm run coverage-viewer",
    "coverage-generator": "torch --coverage --compile --source-pattern src/*.js,src/**/*.js --opts tests/mocha.opts",
    "coverage-viewer": "torch-coverage",
    "test": "torch --renderer --compile --opts tests/mocha.opts",
    "test-live": "torch --compile --interactive --opts tests/mocha.opts",
    "tsc": "tsc --noEmit",
    "typecheck": "tsc --noEmit"
  },
  "types": "lib/index.d.ts",
  "unpkg": "dist/g.min.js",
  "version": "0.4.7"
}

},{}],207:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fadeOut = exports.fadeIn = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * 单个 shape 动画
 * 渐现动画
 * @param shape 执行动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function fadeIn(shape, animateCfg, cfg) {
    var endState = {
        fillOpacity: util_1.isNil(shape.attr('fillOpacity')) ? 1 : shape.attr('fillOpacity'),
        strokeOpacity: util_1.isNil(shape.attr('strokeOpacity')) ? 1 : shape.attr('strokeOpacity'),
        opacity: util_1.isNil(shape.attr('opacity')) ? 1 : shape.attr('opacity'),
    };
    shape.attr({
        fillOpacity: 0,
        strokeOpacity: 0,
        opacity: 0,
    });
    shape.animate(endState, animateCfg);
}
exports.fadeIn = fadeIn;
/**
 * @ignore
 * 单个 shape 动画
 * 渐隐动画
 * @param shape 执行动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function fadeOut(shape, animateCfg, cfg) {
    var endState = {
        fillOpacity: 0,
        strokeOpacity: 0,
        opacity: 0,
    };
    var easing = animateCfg.easing, duration = animateCfg.duration, delay = animateCfg.delay;
    shape.animate(endState, duration, easing, function () {
        shape.remove(true);
    }, delay);
}
exports.fadeOut = fadeOut;

},{"@antv/util":803}],208:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.growInXY = exports.growInY = exports.growInX = void 0;
var util_1 = require("./util");
/**
 * @ignore
 * 入场动画
 * x 方向的生长
 * @param element 执行动画的元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function growInX(element, animateCfg, cfg) {
    var coordinate = cfg.coordinate, minYPoint = cfg.minYPoint;
    util_1.doScaleAnimate(element, animateCfg, coordinate, minYPoint, 'x');
}
exports.growInX = growInX;
/**
 * @ignore
 * 入场动画
 * y 轴方向上的生长
 * @param element 执行动画的元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function growInY(element, animateCfg, cfg) {
    var coordinate = cfg.coordinate, minYPoint = cfg.minYPoint;
    util_1.doScaleAnimate(element, animateCfg, coordinate, minYPoint, 'y');
}
exports.growInY = growInY;
/**
 * @ignore
 * 入场
 * 中心点的向四周的生长动画
 * @param element 执行动画的元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function growInXY(element, animateCfg, cfg) {
    var coordinate = cfg.coordinate, minYPoint = cfg.minYPoint;
    util_1.doScaleAnimate(element, animateCfg, coordinate, minYPoint, 'xy');
}
exports.growInXY = growInXY;

},{"./util":214}],209:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerAnimation = exports.getAnimation = void 0;
var ANIMATIONS_MAP = {};
/**
 * 根据名称获取对应的动画执行函数
 * @param type 动画函数名称
 */
function getAnimation(type) {
    return ANIMATIONS_MAP[type.toLowerCase()];
}
exports.getAnimation = getAnimation;
/**
 * 注册动画执行函数
 * @param type 动画执行函数名称
 * @param animation 动画执行函数
 */
function registerAnimation(type, animation) {
    ANIMATIONS_MAP[type.toLowerCase()] = animation;
}
exports.registerAnimation = registerAnimation;

},{}],210:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pathIn = void 0;
/**
 * @ignore
 * 入场动画
 * path 的入场动画
 * @param element 执行动画的元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function pathIn(element, animateCfg, cfg) {
    // @ts-ignore
    var length = element.getTotalLength();
    // 设置虚线样式
    element.attr('lineDash', [length]);
    element.animate(function (ratio) {
        return {
            // 对虚线偏移量做动画
            lineDashOffset: (1 - ratio) * length,
        };
    }, animateCfg);
}
exports.pathIn = pathIn;

},{}],211:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.positionUpdate = void 0;
/**
 * @ignore
 * 坐标移动动画
 * @param shape 图形
 * @param animateCfg
 * @param cfg
 */
function positionUpdate(shape, animateCfg, cfg) {
    var toAttrs = cfg.toAttrs;
    // @ts-ignore
    var x = toAttrs.x;
    // @ts-ignore
    var y = toAttrs.y;
    // @ts-ignore
    delete toAttrs.x;
    // @ts-ignore
    delete toAttrs.y;
    shape.attr(toAttrs);
    shape.animate({
        x: x,
        y: y,
    }, animateCfg);
}
exports.positionUpdate = positionUpdate;

},{}],212:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.scaleInY = exports.scaleInX = void 0;
var matrix_util_1 = require("@antv/matrix-util");
/**
 * @ignore
 * 沿着 x 方向放大的动画
 * @param shape
 * @param animateCfg
 * @param shapeModel
 */
function scaleInX(shape, animateCfg, cfg) {
    var box = shape.getBBox();
    var mappingData = shape.get('origin').mappingData;
    var points = mappingData.points;
    // x 数值如果为负值，那么应该从右往左生长
    var x = points[0].y - points[1].y > 0 ? box.maxX : box.minX;
    var y = (box.minY + box.maxY) / 2;
    shape.applyToMatrix([x, y, 1]);
    var matrix = matrix_util_1.ext.transform(shape.getMatrix(), [
        ['t', -x, -y],
        ['s', 0.01, 1],
        ['t', x, y],
    ]);
    shape.setMatrix(matrix);
    shape.animate({
        matrix: matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 100, 1],
            ['t', x, y],
        ]),
    }, animateCfg);
}
exports.scaleInX = scaleInX;
/**
 * @ignore
 * 沿着 y 方向放大的动画
 * @param shape
 * @param animateCfg
 * @param shapeModel
 */
function scaleInY(shape, animateCfg, cfg) {
    var box = shape.getBBox();
    var mappingData = shape.get('origin').mappingData;
    var x = (box.minX + box.maxX) / 2;
    var points = mappingData.points;
    // 数值如果为负值，那么应该从上往下生长，通过 shape 的关键点进行判断
    var y = points[0].y - points[1].y <= 0 ? box.maxY : box.minY;
    shape.applyToMatrix([x, y, 1]);
    var matrix = matrix_util_1.ext.transform(shape.getMatrix(), [
        ['t', -x, -y],
        ['s', 1, 0.01],
        ['t', x, y],
    ]);
    shape.setMatrix(matrix);
    shape.animate({
        matrix: matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 1, 100],
            ['t', x, y],
        ]),
    }, animateCfg);
}
exports.scaleInY = scaleInY;

},{"@antv/matrix-util":717}],213:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sectorPathUpdate = void 0;
var tslib_1 = require("tslib");
var arc_params_1 = tslib_1.__importDefault(require("@antv/g-canvas/lib/util/arc-params"));
var util_1 = require("@antv/util");
var graphics_1 = require("../../util/graphics");
function getAngle(startPoint, arcPath) {
    var _a;
    var _b = arc_params_1.default(startPoint, arcPath), startAngle = _b.startAngle, endAngle = _b.endAngle;
    if (!util_1.isNumberEqual(startAngle, -Math.PI * 0.5) && startAngle < -Math.PI * 0.5) {
        startAngle += Math.PI * 2;
    }
    if (!util_1.isNumberEqual(endAngle, -Math.PI * 0.5) && endAngle < -Math.PI * 0.5) {
        endAngle += Math.PI * 2;
    }
    if (arcPath[5] === 0) {
        // 逆时针，需要将 startAngle 和 endAngle 转置，因为 G2 极坐标系为顺时针方向
        _a = [endAngle, startAngle], startAngle = _a[0], endAngle = _a[1];
    }
    if (util_1.isNumberEqual(startAngle, Math.PI * 1.5)) {
        startAngle = Math.PI * -0.5;
    }
    if (util_1.isNumberEqual(endAngle, Math.PI * -0.5)) {
        endAngle = Math.PI * 1.5;
    }
    return {
        startAngle: startAngle,
        endAngle: endAngle,
    };
}
function getArcStartPoint(path) {
    var startPoint;
    if (path[0] === 'M' || path[0] === 'L') {
        startPoint = [path[1], path[2]];
    }
    else if (path[0] === 'a' || path[0] === 'A') {
        startPoint = [path[path.length - 2], path[path.length - 1]];
    }
    return startPoint;
}
/**
 * path 存在以下情况
 * 1. 饼图不为整圆的 path，命令为 M, L, A, L, Z
 * 2. 饼图为整圆的 path，命令为 M, M, A, A, M, Z
 * 3. 环图不为整圆的 path，命令为 M, A, L, A, L, Z
 * 4. 环图为整圆的 path，命令为 M, A, A, M, A, A, M, Z
 * 5. radial-line, 不为整圆时的 path, 命令为 M, A, A, Z
 * 6. radial-line, 为整圆时的 path，命令为 M, A, A, A, A, Z
 * @param path theta 坐标系下圆弧的 path 命令
 */
function getArcInfo(path) {
    var _a;
    var startAngle;
    var endAngle;
    var arcPaths = path.filter(function (command) {
        return command[0] === 'A' || command[0] === 'a';
    });
    var firstArcPathCommand = arcPaths[0];
    var lastArcPathCommand = arcPaths.length > 1 ? arcPaths[1] : arcPaths[0];
    var firstIndex = path.indexOf(firstArcPathCommand);
    var lastIndex = path.indexOf(lastArcPathCommand);
    var firstStartPoint = getArcStartPoint(path[firstIndex - 1]);
    var lastStartPoint = getArcStartPoint(path[lastIndex - 1]);
    var _b = getAngle(firstStartPoint, firstArcPathCommand), firstStartAngle = _b.startAngle, firstEndAngle = _b.endAngle;
    var _c = getAngle(lastStartPoint, lastArcPathCommand), lastStartAngle = _c.startAngle, lastEndAngle = _c.endAngle;
    if (util_1.isNumberEqual(firstStartAngle, lastStartAngle) && util_1.isNumberEqual(firstEndAngle, lastEndAngle)) {
        startAngle = firstStartAngle;
        endAngle = firstEndAngle;
    }
    else {
        startAngle = Math.min(firstStartAngle, lastStartAngle);
        endAngle = Math.max(firstEndAngle, lastEndAngle);
    }
    var radius = firstArcPathCommand[1];
    var innerRadius = arcPaths[arcPaths.length - 1][1];
    if (radius < innerRadius) {
        _a = [innerRadius, radius], radius = _a[0], innerRadius = _a[1];
    }
    else if (radius === innerRadius) {
        innerRadius = 0;
    }
    return {
        startAngle: startAngle,
        endAngle: endAngle,
        radius: radius,
        innerRadius: innerRadius,
    };
}
/**
 * @ignore
 * 饼图更新动画
 * @param shape 文本图形
 * @param animateCfg
 * @param cfg
 */
function sectorPathUpdate(shape, animateCfg, cfg) {
    var toAttrs = cfg.toAttrs, coordinate = cfg.coordinate;
    // @ts-ignore
    var path = toAttrs.path;
    var pathCommands = path.map(function (command) { return command[0]; });
    var _a = getArcInfo(path), curStartAngle = _a.startAngle, curEndAngle = _a.endAngle, radius = _a.radius, innerRadius = _a.innerRadius;
    var _b = getArcInfo(shape.attr('path')), preStartAngle = _b.startAngle, preEndAngle = _b.endAngle;
    var center = coordinate.getCenter();
    var diffStartAngle = curStartAngle - preStartAngle;
    var diffEndAngle = curEndAngle - preEndAngle;
    shape.animate(function (ratio) {
        var onFrameStartAngle = preStartAngle + ratio * diffStartAngle;
        var onFrameEndAngle = preEndAngle + ratio * diffEndAngle;
        return tslib_1.__assign(tslib_1.__assign({}, toAttrs), { path: 
            // hack, 兼容 /examples/bar/basic/demo/radial-line.ts 动画
            util_1.isEqual(pathCommands, ['M', 'A', 'A', 'Z'])
                ? graphics_1.getArcPath(center.x, center.y, radius, onFrameStartAngle, onFrameEndAngle)
                : graphics_1.getSectorPath(center.x, center.y, radius, onFrameStartAngle, onFrameEndAngle, innerRadius) });
    }, tslib_1.__assign(tslib_1.__assign({}, animateCfg), { callback: function () {
            // 将 path 保持原始态，否则会影响 setState() 的动画
            shape.attr('path', path);
        } }));
}
exports.sectorPathUpdate = sectorPathUpdate;

},{"../../util/graphics":375,"@antv/g-canvas/lib/util/arc-params":142,"@antv/util":803,"tslib":385}],214:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doScaleAnimate = exports.transformShape = void 0;
var matrix_util_1 = require("@antv/matrix-util");
/**
 * @ignore
 * 对图形元素进行矩阵变换，同时返回变换前的图形矩阵
 * @param shape 进行矩阵变换的图形
 * @param vector 矩阵变换的中心点
 * @param direct 矩阵变换的类型
 */
function transformShape(shape, vector, direct) {
    var scaledMatrix;
    var x = vector[0], y = vector[1];
    shape.applyToMatrix([x, y, 1]);
    if (direct === 'x') {
        shape.setMatrix(matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 0.01, 1],
            ['t', x, y],
        ]));
        scaledMatrix = matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 100, 1],
            ['t', x, y],
        ]);
    }
    else if (direct === 'y') {
        shape.setMatrix(matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 1, 0.01],
            ['t', x, y],
        ]));
        scaledMatrix = matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 1, 100],
            ['t', x, y],
        ]);
    }
    else if (direct === 'xy') {
        shape.setMatrix(matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 0.01, 0.01],
            ['t', x, y],
        ]));
        scaledMatrix = matrix_util_1.ext.transform(shape.getMatrix(), [
            ['t', -x, -y],
            ['s', 100, 100],
            ['t', x, y],
        ]);
    }
    return scaledMatrix;
}
exports.transformShape = transformShape;
/**
 * 对图形元素进行剪切动画
 * @param element 进行动画的图形元素
 * @param animateCfg 动画配置
 * @param coordinate 当前坐标系
 * @param yMinPoint y 轴的最小值对应的图形坐标点
 * @param type 剪切动画的类型
 */
function doScaleAnimate(element, animateCfg, coordinate, yMinPoint, type) {
    var start = coordinate.start, end = coordinate.end;
    var width = coordinate.getWidth();
    var height = coordinate.getHeight();
    var x;
    var y;
    if (type === 'y') {
        x = start.x + width / 2;
        y = yMinPoint.y < start.y ? yMinPoint.y : start.y;
    }
    else if (type === 'x') {
        x = yMinPoint.x > start.x ? yMinPoint.x : start.x;
        y = start.y + height / 2;
    }
    else if (type === 'xy') {
        if (coordinate.isPolar) {
            x = coordinate.getCenter().x;
            y = coordinate.getCenter().y;
        }
        else {
            x = (start.x + end.x) / 2;
            y = (start.y + end.y) / 2;
        }
    }
    var endMatrix = transformShape(element, [x, y], type);
    element.animate({
        matrix: endMatrix,
    }, animateCfg);
}
exports.doScaleAnimate = doScaleAnimate;

},{"@antv/matrix-util":717}],215:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waveIn = void 0;
var tslib_1 = require("tslib");
var coordinate_1 = require("../../util/coordinate");
/**
 * @ignore
 * 整体动画
 * 划入入场动画效果
 * @todo 放两张直角坐标系和极坐标系的图
 * @param element 参与动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function waveIn(element, animateCfg, cfg) {
    var _a = coordinate_1.getCoordinateClipCfg(cfg.coordinate, 20), type = _a.type, startState = _a.startState, endState = _a.endState; // 根据坐标系类型获取整体的剪切区域配置信息
    var clipShape = element.setClip({
        type: type,
        attrs: startState,
    }); // 为 shape 设置剪切区域
    // 对剪切图形做动画
    clipShape.animate(endState, tslib_1.__assign(tslib_1.__assign({}, animateCfg), { callback: function () {
            if (element && !element.get('destroyed')) {
                element.set('clipShape', null);
            }
            clipShape.remove(true); // 动画结束需要将剪切图形销毁
        } }));
}
exports.waveIn = waveIn;

},{"../../util/coordinate":371,"tslib":385}],216:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.zoomOut = exports.zoomIn = void 0;
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
function doShapeZoom(shape, animateCfg, type) {
    if (shape.isGroup()) {
        util_1.each(shape.getChildren(), function (child) {
            doShapeZoom(child, animateCfg, type);
        });
    }
    else {
        var bbox = shape.getBBox();
        var x = (bbox.minX + bbox.maxX) / 2;
        var y = (bbox.minY + bbox.maxY) / 2;
        shape.applyToMatrix([x, y, 1]);
        if (type === 'zoomIn') {
            // 放大
            var matrix = matrix_util_1.ext.transform(shape.getMatrix(), [
                ['t', -x, -y],
                ['s', 0.01, 0.01],
                ['t', x, y],
            ]);
            shape.setMatrix(matrix);
            shape.animate({
                matrix: matrix_util_1.ext.transform(shape.getMatrix(), [
                    ['t', -x, -y],
                    ['s', 100, 100],
                    ['t', x, y],
                ]),
            }, animateCfg);
        }
        else {
            shape.animate({
                matrix: matrix_util_1.ext.transform(shape.getMatrix(), [
                    ['t', -x, -y],
                    ['s', 0.01, 0.01],
                    ['t', x, y],
                ]),
            }, tslib_1.__assign(tslib_1.__assign({}, animateCfg), { callback: function () {
                    shape.remove(true);
                } }));
        }
    }
}
/**
 * @ignore
 * 单个 shape 动画
 * shape 以自身中心点逐渐放大的进入动画
 * @param shape 参与动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function zoomIn(shape, animateCfg, cfg) {
    doShapeZoom(shape, animateCfg, 'zoomIn');
}
exports.zoomIn = zoomIn;
/**
 * @ignore
 * 单个 shape 动画
 * 消失动画，shape 以自身为中心点的逐渐缩小
 * @param shape 参与动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外信息
 */
function zoomOut(shape, animateCfg, cfg) {
    doShapeZoom(shape, animateCfg, 'zoomOut');
}
exports.zoomOut = zoomOut;

},{"@antv/matrix-util":717,"@antv/util":803,"tslib":385}],217:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doGroupAppearAnimate = exports.doAnimate = exports.getDefaultAnimateCfg = exports.DEFAULT_ANIMATE_CFG = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var animation_1 = require("./animation");
// 默认的动画参数配置
exports.DEFAULT_ANIMATE_CFG = {
    appear: {
        duration: 450,
        easing: 'easeQuadOut',
    },
    update: {
        duration: 400,
        easing: 'easeQuadInOut',
    },
    enter: {
        duration: 400,
        easing: 'easeQuadInOut',
    },
    leave: {
        duration: 350,
        easing: 'easeQuadIn',
    },
};
// 各个 Geometry 默认的动画执行函数
var GEOMETRY_ANIMATE_CFG = {
    interval: function (coordinate) {
        return {
            enter: {
                animation: coordinate.isRect ? (coordinate.isTransposed ? 'scale-in-x' : 'scale-in-y') : 'fade-in',
            },
            update: {
                animation: coordinate.isPolar && coordinate.isTransposed ? 'sector-path-update' : null,
            },
            leave: {
                animation: 'fade-out',
            },
        };
    },
    line: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    path: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    point: {
        appear: {
            animation: 'zoom-in',
        },
        enter: {
            animation: 'zoom-in',
        },
        leave: {
            animation: 'zoom-out',
        },
    },
    area: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    polygon: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    schema: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    edge: {
        enter: {
            animation: 'fade-in',
        },
        leave: {
            animation: 'fade-out',
        },
    },
    label: {
        appear: {
            animation: 'fade-in',
            delay: 450,
        },
        enter: {
            animation: 'fade-in',
        },
        update: {
            animation: 'position-update',
        },
        leave: {
            animation: 'fade-out',
        },
    },
};
// 各个 Geometry 默认的群组出场动画
var GEOMETRY_GROUP_APPEAR_ANIMATION = {
    line: function () {
        return {
            animation: 'wave-in',
        };
    },
    area: function () {
        return {
            animation: 'wave-in',
        };
    },
    path: function () {
        return {
            animation: 'fade-in',
        };
    },
    interval: function (coordinate) {
        var animation;
        if (coordinate.isRect) {
            animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';
        }
        else {
            animation = 'grow-in-xy';
            if (coordinate.isPolar && coordinate.isTransposed) {
                // pie chart
                animation = 'wave-in';
            }
        }
        return {
            animation: animation,
        };
    },
    schema: function (coordinate) {
        var animation;
        if (coordinate.isRect) {
            animation = coordinate.isTransposed ? 'grow-in-x' : 'grow-in-y';
        }
        else {
            animation = 'grow-in-xy';
        }
        return {
            animation: animation,
        };
    },
    polygon: function () {
        return {
            animation: 'fade-in',
            duration: 500,
        };
    },
    edge: function () {
        return {
            animation: 'fade-in',
        };
    },
};
// 解析用户的动画配置
function parseAnimateConfig(animateCfg, data) {
    return {
        delay: util_1.isFunction(animateCfg.delay) ? animateCfg.delay(data) : animateCfg.delay,
        easing: util_1.isFunction(animateCfg.easing) ? animateCfg.easing(data) : animateCfg.easing,
        duration: util_1.isFunction(animateCfg.duration) ? animateCfg.duration(data) : animateCfg.duration,
        callback: animateCfg.callback,
    };
}
/**
 * @ignore
 * 获取 elementName 对应的动画配置，当声明了 `animateType`，则返回 `animateType` 对应的动画配置
 * @param elementName 元素名称
 * @param coordinate 做表弟类型
 * @param animateType 可选，动画类型
 */
function getDefaultAnimateCfg(elementName, coordinate, animateType) {
    var animateCfg = GEOMETRY_ANIMATE_CFG[elementName];
    if (animateCfg) {
        if (util_1.isFunction(animateCfg)) {
            animateCfg = animateCfg(coordinate);
        }
        animateCfg = util_1.deepMix({}, exports.DEFAULT_ANIMATE_CFG, animateCfg);
        if (animateType) {
            return animateCfg[animateType];
        }
    }
    return animateCfg;
}
exports.getDefaultAnimateCfg = getDefaultAnimateCfg;
/**
 * @ignore
 * 工具函数
 * 根据用户传入的配置为 shape 执行动画
 * @param shape 执行动画的图形元素
 * @param animateCfg 动画配置
 * @param cfg 额外的信息
 */
function doAnimate(shape, animateCfg, cfg) {
    var data = util_1.get(shape.get('origin'), 'data', constant_1.FIELD_ORIGIN);
    var animation = animateCfg.animation; // 获取动画执行函数
    var parsedAnimateCfg = parseAnimateConfig(animateCfg, data);
    if (animation) {
        // 用户声明了动画执行函数
        var animateFunction = animation_1.getAnimation(animation);
        if (animateFunction) {
            animateFunction(shape, parsedAnimateCfg, cfg);
        }
    }
    else {
        // 没有声明，则根据 toAttrs 做差值动画
        shape.animate(cfg.toAttrs, parsedAnimateCfg);
    }
}
exports.doAnimate = doAnimate;
/**
 * @ignore
 * 执行 Geometry 群组入场动画
 * @param container 执行群组动画的图形元素
 * @param animateCfg 动画配置
 * @param geometryType geometry 类型
 * @param coordinate 坐标系对象
 * @param minYPoint y 轴最小值对应的画布坐标点
 */
function doGroupAppearAnimate(container, animateCfg, geometryType, coordinate, minYPoint) {
    if (GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType]) {
        var defaultCfg = GEOMETRY_GROUP_APPEAR_ANIMATION[geometryType](coordinate);
        var animation = animation_1.getAnimation(util_1.get(defaultCfg, 'animation', ''));
        if (animation) {
            var cfg = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, exports.DEFAULT_ANIMATE_CFG.appear), defaultCfg), animateCfg);
            container.stopAnimate(); // 先结束当前 container 动画
            animation(container, cfg, {
                coordinate: coordinate,
                minYPoint: minYPoint,
                toAttrs: null,
            });
        }
    }
}
exports.doGroupAppearAnimate = doGroupAppearAnimate;

},{"../constant":237,"./animation":209,"@antv/util":803,"tslib":385}],218:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
/**
 * G2 Chart、View、Geometry 以及 Element 等的基类，提供事件以及一些通用的方法。
 */
var Base = /** @class */ (function (_super) {
    tslib_1.__extends(Base, _super);
    function Base(cfg) {
        var _this = _super.call(this) || this;
        /** 标识对象是否已销毁 */
        _this.destroyed = false;
        var _a = cfg.visible, visible = _a === void 0 ? true : _a;
        _this.visible = visible;
        return _this;
    }
    /**
     * 显示。
     */
    Base.prototype.show = function () {
        var visible = this.visible;
        if (!visible) {
            this.changeVisible(true);
        }
    };
    /**
     * 隐藏。
     */
    Base.prototype.hide = function () {
        var visible = this.visible;
        if (visible) {
            this.changeVisible(false);
        }
    };
    /**
     * 销毁。
     */
    Base.prototype.destroy = function () {
        this.off();
        this.destroyed = true;
    };
    /**
     * 显示或者隐藏。
     * @param visible
     * @returns
     */
    Base.prototype.changeVisible = function (visible) {
        if (this.visible === visible) {
            return;
        }
        this.visible = visible;
    };
    return Base;
}(event_emitter_1.default));
exports.default = Base;

},{"@antv/event-emitter":94,"tslib":385}],219:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var engine_1 = require("../engine");
var dom_1 = require("../util/dom");
var view_1 = tslib_1.__importDefault(require("./view"));
/**
 * Chart 类，是使用 G2 进行绘图的入口。
 */
var Chart = /** @class */ (function (_super) {
    tslib_1.__extends(Chart, _super);
    // @ts-ignore
    function Chart(props) {
        var _this = this;
        var container = props.container, width = props.width, height = props.height, _a = props.autoFit, autoFit = _a === void 0 ? false : _a, padding = props.padding, appendPadding = props.appendPadding, _b = props.renderer, renderer = _b === void 0 ? 'canvas' : _b, pixelRatio = props.pixelRatio, _c = props.localRefresh, localRefresh = _c === void 0 ? true : _c, _d = props.visible, visible = _d === void 0 ? true : _d, _e = props.defaultInteractions, defaultInteractions = _e === void 0 ? ['tooltip', 'legend-filter', 'legend-active', 'continuous-filter', 'ellipsis-text'] : _e, options = props.options, limitInPlot = props.limitInPlot, theme = props.theme;
        var ele = util_1.isString(container) ? document.getElementById(container) : container;
        // 生成内部正式绘制的 div 元素
        var wrapperElement = dom_1.createDom('<div style="position:relative;"></div>');
        ele.appendChild(wrapperElement);
        // if autoFit, use the container size, to avoid the graph render twice.
        var size = dom_1.getChartSize(ele, autoFit, width, height);
        var G = engine_1.getEngine(renderer);
        var canvas = new G.Canvas(tslib_1.__assign({ container: wrapperElement, pixelRatio: pixelRatio,
            localRefresh: localRefresh }, size));
        // 调用 view 的创建
        _this = _super.call(this, {
            parent: null,
            canvas: canvas,
            // create 3 group layers for views.
            backgroundGroup: canvas.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.BG }),
            middleGroup: canvas.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.MID }),
            foregroundGroup: canvas.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.FORE }),
            padding: padding,
            appendPadding: appendPadding,
            visible: visible,
            options: options,
            limitInPlot: limitInPlot,
            theme: theme,
        }) || this;
        /**
         * when container size changed, change chart size props, and re-render.
         */
        _this.onResize = util_1.debounce(function () {
            _this.forceFit();
        }, 300);
        _this.ele = ele;
        _this.canvas = canvas;
        _this.width = size.width;
        _this.height = size.height;
        _this.autoFit = autoFit;
        _this.localRefresh = localRefresh;
        _this.renderer = renderer;
        _this.wrapperElement = wrapperElement;
        // 自适应大小
        _this.updateCanvasStyle();
        _this.bindAutoFit();
        _this.initDefaultInteractions(defaultInteractions);
        return _this;
    }
    Chart.prototype.initDefaultInteractions = function (interactions) {
        var _this = this;
        util_1.each(interactions, function (interaction) {
            _this.interaction(interaction);
        });
    };
    /**
     * 改变图表大小，同时重新渲染。
     * @param width 图表宽度
     * @param height 图表高度
     * @returns
     */
    Chart.prototype.changeSize = function (width, height) {
        // 如果宽高一致，那么 changeSize 不执行任何操作
        if (this.width === width && this.height === height) {
            return this;
        }
        this.width = width;
        this.height = height;
        this.canvas.changeSize(width, height);
        // 重新渲染
        this.render(true);
        return this;
    };
    /**
     * 销毁图表，同时解绑事件，销毁创建的 G.Canvas 实例。
     * @returns void
     */
    Chart.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.unbindAutoFit();
        this.canvas.destroy();
        dom_1.removeDom(this.wrapperElement);
        this.wrapperElement = null;
    };
    /**
     * 显示或隐藏图表
     * @param visible 是否可见，true 表示显示，false 表示隐藏
     * @returns
     */
    Chart.prototype.changeVisible = function (visible) {
        _super.prototype.changeVisible.call(this, visible); // 需要更新 visible 变量
        this.wrapperElement.style.display = visible ? '' : 'none';
        return this;
    };
    /**
     * 自动根据容器大小 resize 画布
     */
    Chart.prototype.forceFit = function () {
        // skip if already destroyed
        if (!this.destroyed) {
            // 注意第二参数用 true，意思是即时 autoFit = false，forceFit() 调用之后一样是适配容器
            var _a = dom_1.getChartSize(this.ele, true, this.width, this.height), width = _a.width, height = _a.height;
            this.changeSize(width, height);
        }
    };
    Chart.prototype.updateCanvasStyle = function () {
        dom_1.modifyCSS(this.canvas.get('el'), {
            display: 'inline-block',
            verticalAlign: 'middle',
        });
    };
    Chart.prototype.bindAutoFit = function () {
        if (this.autoFit) {
            window.addEventListener('resize', this.onResize);
        }
    };
    Chart.prototype.unbindAutoFit = function () {
        if (this.autoFit) {
            window.removeEventListener('resize', this.onResize);
        }
    };
    return Chart;
}(view_1.default));
exports.default = Chart;

},{"../constant":237,"../engine":240,"../util/dom":373,"./view":235,"@antv/util":803,"tslib":385}],220:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../dependents");
var animate_1 = require("../../animate/");
var constant_1 = require("../../constant");
var coordinate_1 = require("../../util/coordinate");
var helper_1 = require("../../util/helper");
var base_1 = require("./base");
/**
 * Annotation controller, 主要作用:
 * 1. 创建 Annotation: line、text、arc ...
 * 2. 生命周期: init、layout、render、clear、destroy
 */
var Annotation = /** @class */ (function (_super) {
    tslib_1.__extends(Annotation, _super);
    function Annotation(view) {
        var _this = _super.call(this, view) || this;
        /* 组件更新的 cache，组件配置 object : 组件 */
        _this.cache = new Map();
        _this.foregroundContainer = _this.view.getLayer(constant_1.LAYER.FORE).addGroup();
        _this.backgroundContainer = _this.view.getLayer(constant_1.LAYER.BG).addGroup();
        _this.option = [];
        return _this;
    }
    Object.defineProperty(Annotation.prototype, "name", {
        get: function () {
            return 'annotation';
        },
        enumerable: false,
        configurable: true
    });
    Annotation.prototype.init = function () { };
    Annotation.prototype.layout = function () {
        var _this = this;
        var components = this.getComponents();
        var updateComponentFn = function (co) {
            var component = co.component, extra = co.extra;
            var type = extra.type;
            var theme = _this.getAnnotationTheme(type);
            component.update(_this.getAnnotationCfg(type, extra, theme));
        };
        var createComponentFn = function (option) {
            var co = _this.createAnnotation(option);
            if (co) {
                co.component.init();
                // Note：regionFilter 特殊处理，regionFilter需要取到 Geometry 中的 Shape，需要在 view render 之后处理
                // 其他组件使用外层的统一 render 逻辑
                if (option.type === 'regionFilter') {
                    co.component.render();
                }
                // 缓存起来
                _this.cache.set(option, co);
            }
        };
        if (components.length) {
            util_1.each(components, function (co) {
                var component = co.component;
                if (component.get('type') === 'regionFilter') {
                    // regionFilter 依赖绘制后的 Geometry Shapes
                    _this.view.getRootView().once(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
                        updateComponentFn(co);
                    });
                }
                else {
                    updateComponentFn(co);
                }
            });
        }
        else {
            util_1.each(this.option, function (option) {
                if (option.type === 'regionFilter') {
                    _this.view.getRootView().once(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
                        // regionFilter 依赖绘制后的 Geometry Shapes
                        createComponentFn(option);
                    });
                }
                else {
                    createComponentFn(option);
                }
            });
        }
    };
    Annotation.prototype.render = function () {
        // 因为 Annotation 不参与布局，但是渲染的位置依赖于坐标系，所以可以将绘制阶段延迟到 layout() 进行
    };
    /**
     * 更新
     */
    Annotation.prototype.update = function () {
        var _this = this;
        // 已经处理过的 legend
        var updated = new WeakMap();
        var updateComponentFn = function (option) {
            var type = option.type;
            var theme = _this.getAnnotationTheme(type);
            var cfg = _this.getAnnotationCfg(type, option, theme);
            var existCo = _this.cache.get(option);
            // 存在，则更新
            if (existCo) {
                // 忽略掉一些配置
                helper_1.omit(cfg, ['container']);
                existCo.component.update(cfg);
                updated.set(option, true);
            }
            else {
                // 不存在，则创建
                var co = _this.createAnnotation(option);
                if (co) {
                    co.component.init();
                    // Note：regionFilter 特殊处理，regionFilter需要取到 Geometry 中的 Shape，需要在 view render 之后处理
                    // 其他组件使用外层的统一 render 逻辑
                    if (option.type === 'regionFilter') {
                        co.component.render();
                    }
                    // 缓存起来
                    _this.cache.set(option, co);
                    updated.set(option, true);
                }
            }
        };
        this.view.once(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
            // 先看是否有 regionFilter 要更新
            util_1.each(_this.option, function (option) {
                if (option.type === 'regionFilter') {
                    updateComponentFn(option);
                }
            });
            // 处理完成之后，销毁删除的
            // 不在处理中的
            var newCache = new Map();
            _this.cache.forEach(function (value, key) {
                if (updated.has(key)) {
                    newCache.set(key, value);
                }
                else {
                    // 不存在，则是所有需要被销毁的组件
                    value.component.destroy();
                }
            });
            // 更新缓存
            _this.cache = newCache;
        });
        util_1.each(this.option, function (option) {
            if (option.type !== 'regionFilter') {
                updateComponentFn(option);
            }
        });
    };
    /**
     * 清空
     * @param includeOption 是否清空 option 配置项
     */
    Annotation.prototype.clear = function (includeOption) {
        if (includeOption === void 0) { includeOption = false; }
        _super.prototype.clear.call(this);
        this.cache.clear();
        this.foregroundContainer.clear();
        this.backgroundContainer.clear();
        // clear all option
        if (includeOption) {
            this.option = [];
        }
    };
    Annotation.prototype.destroy = function () {
        this.clear(true);
        this.foregroundContainer.remove(true);
        this.backgroundContainer.remove(true);
    };
    /**
     * 复写基类的方法
     */
    Annotation.prototype.getComponents = function () {
        var co = [];
        this.cache.forEach(function (value) {
            co.push(value);
        });
        return co;
    };
    Annotation.prototype.createAnnotation = function (option) {
        var type = option.type;
        var Ctor = dependents_1.Annotation[util_1.upperFirst(type)];
        if (Ctor) {
            var theme = this.getAnnotationTheme(type);
            var cfg = this.getAnnotationCfg(type, option, theme);
            var annotation = new Ctor(cfg);
            return {
                component: annotation,
                layer: this.isTop(cfg) ? constant_1.LAYER.FORE : constant_1.LAYER.BG,
                direction: constant_1.DIRECTION.NONE,
                type: constant_1.COMPONENT_TYPE.ANNOTATION,
                extra: option,
            };
        }
    };
    // APIs for creating annotation component
    Annotation.prototype.annotation = function (option) {
        this.option.push(option);
    };
    /**
     * 创建 Arc
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.arc = function (option) {
        this.annotation(tslib_1.__assign({ type: 'arc' }, option));
        return this;
    };
    /**
     * 创建 image
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.image = function (option) {
        this.annotation(tslib_1.__assign({ type: 'image' }, option));
        return this;
    };
    /**
     * 创建 Line
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.line = function (option) {
        this.annotation(tslib_1.__assign({ type: 'line' }, option));
        return this;
    };
    /**
     * 创建 Region
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.region = function (option) {
        this.annotation(tslib_1.__assign({ type: 'region' }, option));
        return this;
    };
    /**
     * 创建 Text
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.text = function (option) {
        this.annotation(tslib_1.__assign({ type: 'text' }, option));
        return this;
    };
    /**
     * 创建 DataMarker
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.dataMarker = function (option) {
        this.annotation(tslib_1.__assign({ type: 'dataMarker' }, option));
        return this;
    };
    /**
     * 创建 DataRegion
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.dataRegion = function (option) {
        this.annotation(tslib_1.__assign({ type: 'dataRegion' }, option));
    };
    /**
     * 创建 RegionFilter
     * @param option
     * @returns AnnotationController
     */
    Annotation.prototype.regionFilter = function (option) {
        this.annotation(tslib_1.__assign({ type: 'regionFilter' }, option));
    };
    // end API
    /**
     * parse the point position to [x, y]
     * @param p Position
     * @returns { x, y }
     */
    Annotation.prototype.parsePosition = function (p) {
        var xScale = this.view.getXScale();
        // 转成 object
        var yScales = this.view.getScalesByDim('y');
        var position = util_1.isFunction(p) ? p.call(null, xScale, yScales) : p;
        var x = 0;
        var y = 0;
        // 入参是 [24, 24] 这类时
        if (util_1.isArray(position)) {
            var xPos = position[0], yPos = position[1];
            // 如果数据格式是 ['50%', '50%'] 的格式
            // fix: 原始数据中可能会包含 'xxx5%xxx' 这样的数据，需要判断下 https://github.com/antvis/f2/issues/590
            // @ts-ignore
            if (util_1.isString(xPos) && xPos.indexOf('%') !== -1 && !isNaN(xPos.slice(0, -1))) {
                return this.parsePercentPosition(position);
            }
            x = this.getNormalizedValue(xPos, xScale);
            y = this.getNormalizedValue(yPos, Object.values(yScales)[0]);
        }
        else if (!util_1.isNil(position)) {
            // 入参是 object 结构，数据点
            for (var _i = 0, _a = util_1.keys(position); _i < _a.length; _i++) {
                var key = _a[_i];
                var value = position[key];
                if (key === xScale.field) {
                    x = this.getNormalizedValue(value, xScale);
                }
                if (yScales[key]) {
                    y = this.getNormalizedValue(value, yScales[key]);
                }
            }
        }
        return this.view.getCoordinate().convert({ x: x, y: y });
    };
    /**
     * parse all the points between start and end
     * @param start
     * @param end
     * @return Point[]
     */
    Annotation.prototype.getRegionPoints = function (start, end) {
        var _this = this;
        var xScale = this.view.getXScale();
        var yScales = this.view.getScalesByDim('y');
        var yScale = Object.values(yScales)[0];
        var xField = xScale.field;
        var viewData = this.view.getData();
        var startXValue = util_1.isArray(start) ? start[0] : start[xField];
        var endXValue = util_1.isArray(end) ? end[0] : end[xField];
        var arr = [];
        var startIndex;
        util_1.each(viewData, function (item, idx) {
            if (item[xField] === startXValue) {
                startIndex = idx;
            }
            if (idx >= startIndex) {
                var point = _this.parsePosition([item[xField], item[yScale.field]]);
                if (point) {
                    arr.push(point);
                }
            }
            if (item[xField] === endXValue) {
                return false;
            }
        });
        return arr;
    };
    /**
     * parse the value position
     * @param val
     * @param scale
     */
    Annotation.prototype.getNormalizedValue = function (val, scale) {
        var result;
        var scaled;
        switch (val) {
            case 'start':
                result = 0;
                break;
            case 'end':
                result = 1;
                break;
            case 'median': {
                scaled = scale.isCategory ? (scale.values.length - 1) / 2 : (scale.min + scale.max) / 2;
                result = scale.scale(scaled);
                break;
            }
            case 'min':
            case 'max':
                if (scale.isCategory) {
                    scaled = val === 'min' ? 0 : scale.values.length - 1;
                }
                else {
                    scaled = scale[val];
                }
                result = scale.scale(scaled);
                break;
            default:
                result = scale.scale(val);
        }
        return result;
    };
    /**
     * parse percent position
     * @param position
     */
    Annotation.prototype.parsePercentPosition = function (position) {
        var xPercent = parseFloat(position[0]) / 100;
        var yPercent = parseFloat(position[1]) / 100;
        var coordinate = this.view.getCoordinate();
        var start = coordinate.start, end = coordinate.end;
        var topLeft = {
            x: Math.min(start.x, end.x),
            y: Math.min(start.y, end.y),
        };
        var x = coordinate.getWidth() * xPercent + topLeft.x;
        var y = coordinate.getHeight() * yPercent + topLeft.y;
        return { x: x, y: y };
    };
    /**
     * get coordinate bbox
     */
    Annotation.prototype.getCoordinateBBox = function () {
        var coordinate = this.view.getCoordinate();
        var start = coordinate.start, end = coordinate.end;
        var width = coordinate.getWidth();
        var height = coordinate.getHeight();
        var topLeft = {
            x: Math.min(start.x, end.x),
            y: Math.min(start.y, end.y),
        };
        return {
            x: topLeft.x,
            y: topLeft.y,
            minX: topLeft.x,
            minY: topLeft.y,
            maxX: topLeft.x + width,
            maxY: topLeft.y + height,
            width: width,
            height: height,
        };
    };
    /**
     * get annotation component config by different type
     * @param type
     * @param option 用户的配置
     * @param theme
     */
    Annotation.prototype.getAnnotationCfg = function (type, option, theme) {
        var coordinate = this.view.getCoordinate();
        var o = {};
        if (util_1.isNil(option)) {
            return null;
        }
        if (type === 'arc') {
            var _a = option, start = _a.start, end = _a.end;
            var sp = this.parsePosition(start);
            var ep = this.parsePosition(end);
            var startAngle = coordinate_1.getAngleByPoint(coordinate, sp);
            var endAngle = coordinate_1.getAngleByPoint(coordinate, ep);
            if (startAngle > endAngle) {
                endAngle = Math.PI * 2 + endAngle;
            }
            o = {
                center: coordinate.getCenter(),
                radius: coordinate_1.getDistanceToCenter(coordinate, sp),
                startAngle: startAngle,
                endAngle: endAngle,
            };
        }
        else if (type === 'image') {
            var _b = option, start = _b.start, end = _b.end;
            o = {
                start: this.parsePosition(start),
                end: this.parsePosition(end),
                src: option.src,
            };
        }
        else if (type === 'line') {
            var _c = option, start = _c.start, end = _c.end;
            o = {
                start: this.parsePosition(start),
                end: this.parsePosition(end),
                text: util_1.get(option, 'text', null),
            };
        }
        else if (type === 'region') {
            var _d = option, start = _d.start, end = _d.end;
            o = {
                start: this.parsePosition(start),
                end: this.parsePosition(end),
            };
        }
        else if (type === 'text') {
            var filteredData = this.view.getData();
            var _e = option, position = _e.position, content = _e.content, rest = tslib_1.__rest(_e, ["position", "content"]);
            var textContent = content;
            if (util_1.isFunction(content)) {
                textContent = content(filteredData);
            }
            o = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, this.parsePosition(position)), rest), { content: textContent });
        }
        else if (type === 'dataMarker') {
            var _f = option, position = _f.position, point = _f.point, line = _f.line, text = _f.text, autoAdjust = _f.autoAdjust, direction = _f.direction;
            o = tslib_1.__assign(tslib_1.__assign({}, this.parsePosition(position)), { coordinateBBox: this.getCoordinateBBox(), point: point,
                line: line,
                text: text,
                autoAdjust: autoAdjust,
                direction: direction });
        }
        else if (type === 'dataRegion') {
            var _g = option, start = _g.start, end = _g.end, region = _g.region, text = _g.text, lineLength = _g.lineLength;
            o = {
                points: this.getRegionPoints(start, end),
                region: region,
                text: text,
                lineLength: lineLength,
            };
        }
        else if (type === 'regionFilter') {
            var _h = option, start = _h.start, end = _h.end, apply_1 = _h.apply, color = _h.color;
            var geometries = this.view.geometries;
            var shapes_1 = [];
            var addShapes_1 = function (item) {
                if (!item) {
                    return;
                }
                if (item.isGroup()) {
                    item.getChildren().forEach(function (child) { return addShapes_1(child); });
                }
                else {
                    shapes_1.push(item);
                }
            };
            util_1.each(geometries, function (geom) {
                if (apply_1) {
                    if (util_1.contains(apply_1, geom.type)) {
                        util_1.each(geom.elements, function (elem) {
                            addShapes_1(elem.shape);
                        });
                    }
                }
                else {
                    util_1.each(geom.elements, function (elem) {
                        addShapes_1(elem.shape);
                    });
                }
            });
            o = {
                color: color,
                shapes: shapes_1,
                start: this.parsePosition(start),
                end: this.parsePosition(end),
            };
        }
        // 合并主题，用户配置优先级高于默认主题
        var cfg = util_1.deepMix({}, theme, tslib_1.__assign(tslib_1.__assign({}, o), { top: option.top, style: option.style, offsetX: option.offsetX, offsetY: option.offsetY }));
        cfg.container = this.getComponentContainer(cfg);
        cfg.animate = this.view.getOptions().animate && cfg.animate && util_1.get(option, 'animate', cfg.animate); // 如果 view 关闭动画，则不执行
        cfg.animateOption = util_1.deepMix({}, animate_1.DEFAULT_ANIMATE_CFG, cfg.animateOption, option.animateOption);
        return cfg;
    };
    /**
     * is annotation render on top
     * @param option
     * @return whethe on top
     */
    Annotation.prototype.isTop = function (option) {
        return util_1.get(option, 'top', true);
    };
    /**
     * get the container by option.top
     * default is on top
     * @param option
     * @returns the container
     */
    Annotation.prototype.getComponentContainer = function (option) {
        return this.isTop(option) ? this.foregroundContainer : this.backgroundContainer;
    };
    Annotation.prototype.getAnnotationTheme = function (type) {
        return util_1.get(this.view.getTheme(), ['components', 'annotation', type], {});
    };
    return Annotation;
}(base_1.Controller));
exports.default = Annotation;

},{"../../animate/":217,"../../constant":237,"../../dependents":239,"../../util/coordinate":371,"../../util/helper":377,"./base":222,"@antv/util":803,"tslib":385}],221:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../../constant");
var dependents_1 = require("../../dependents");
var animate_1 = require("../../animate/");
var axis_1 = require("../../util/axis");
var axis_2 = require("../../util/axis");
var grid_1 = require("../../util/grid");
var helper_1 = require("../../util/helper");
var base_1 = require("./base");
// update 组件的时候，忽略的数据更新
var OMIT_CFG = ['container'];
// 坐标轴默认动画配置
var AXIS_DEFAULT_ANIMATE_CFG = tslib_1.__assign(tslib_1.__assign({}, animate_1.DEFAULT_ANIMATE_CFG), { appear: null });
/**
 * @ignore
 * G2 Axis controller, will:
 *  - create component
 *    - axis
 *    - grid
 *  - life circle
 */
var Axis = /** @class */ (function (_super) {
    tslib_1.__extends(Axis, _super);
    function Axis(view) {
        var _this = _super.call(this, view) || this;
        /** 使用 object 存储组件 */
        _this.cache = new Map();
        // 先创建 gridContainer，将 grid 放到 axis 底层
        _this.gridContainer = _this.view.getLayer(constant_1.LAYER.BG).addGroup();
        _this.axisContainer = _this.view.getLayer(constant_1.LAYER.BG).addGroup();
        return _this;
    }
    Object.defineProperty(Axis.prototype, "name", {
        get: function () {
            return 'axis';
        },
        enumerable: false,
        configurable: true
    });
    Axis.prototype.init = function () { };
    Axis.prototype.render = function () {
        this.update();
    };
    /**
     * 更新组件布局，位置大小
     */
    Axis.prototype.layout = function () {
        var _this = this;
        var coordinate = this.view.getCoordinate();
        util_1.each(this.getComponents(), function (co) {
            var component = co.component, direction = co.direction, type = co.type, extra = co.extra;
            var dim = extra.dim, scale = extra.scale, alignTick = extra.alignTick;
            var updated;
            if (type === constant_1.COMPONENT_TYPE.AXIS) {
                if (coordinate.isPolar) {
                    if (dim === 'x') {
                        updated = coordinate.isTransposed
                            ? axis_1.getAxisRegion(coordinate, direction)
                            : axis_1.getCircleAxisCenterRadius(coordinate);
                    }
                    else if (dim === 'y') {
                        updated = coordinate.isTransposed
                            ? axis_1.getCircleAxisCenterRadius(coordinate)
                            : axis_1.getAxisRegion(coordinate, direction);
                    }
                }
                else {
                    updated = axis_1.getAxisRegion(coordinate, direction);
                }
            }
            else if (type === constant_1.COMPONENT_TYPE.GRID) {
                if (coordinate.isPolar) {
                    var items = void 0;
                    if (coordinate.isTransposed) {
                        items =
                            dim === 'x'
                                ? grid_1.getCircleGridItems(coordinate, _this.view.getYScales()[0], scale, alignTick, dim)
                                : grid_1.getLineGridItems(coordinate, scale, dim, alignTick);
                    }
                    else {
                        items =
                            dim === 'x'
                                ? grid_1.getLineGridItems(coordinate, scale, dim, alignTick)
                                : grid_1.getCircleGridItems(coordinate, _this.view.getXScale(), scale, alignTick, dim);
                    }
                    updated = {
                        items: items,
                        // coordinate 更新之后，center 也变化了
                        center: _this.view.getCoordinate().getCenter(),
                    };
                }
                else {
                    updated = { items: grid_1.getLineGridItems(coordinate, scale, dim, alignTick) };
                }
            }
            component.update(updated);
        });
    };
    /**
     * 更新 axis 组件
     */
    Axis.prototype.update = function () {
        this.option = this.view.getOptions().axes;
        var updatedCache = new Map();
        this.updateXAxes(updatedCache);
        this.updateYAxes(updatedCache);
        // 处理完成之后，销毁删除的
        // 不在处理中的
        var newCache = new Map();
        this.cache.forEach(function (co, key) {
            if (updatedCache.has(key)) {
                newCache.set(key, co);
            }
            else {
                // 不存在，则是所有需要被销毁的组件
                co.component.destroy();
            }
        });
        // 更新缓存
        this.cache = newCache;
    };
    Axis.prototype.clear = function () {
        _super.prototype.clear.call(this);
        this.cache.clear();
        this.gridContainer.clear();
        this.axisContainer.clear();
    };
    Axis.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.gridContainer.remove(true);
        this.axisContainer.remove(true);
    };
    /**
     * @override
     */
    Axis.prototype.getComponents = function () {
        var co = [];
        this.cache.forEach(function (value) {
            co.push(value);
        });
        return co;
    };
    /**
     * 更新 x axis
     * @param updatedCache
     */
    Axis.prototype.updateXAxes = function (updatedCache) {
        // x axis
        var scale = this.view.getXScale();
        if (!scale || scale.isIdentity) {
            return;
        }
        var xAxisOption = axis_2.getAxisOption(this.option, scale.field);
        if (xAxisOption === false) {
            return;
        }
        var direction = axis_1.getAxisDirection(xAxisOption, constant_1.DIRECTION.BOTTOM);
        var layer = constant_1.LAYER.BG;
        var dim = 'x';
        var coordinate = this.view.getCoordinate();
        var axisId = this.getId('axis', scale.field);
        var gridId = this.getId('grid', scale.field);
        if (coordinate.isRect) {
            // 1. do axis update
            var axis = this.cache.get(axisId);
            // 存在则更新
            if (axis) {
                var cfg = this.getLineAxisCfg(scale, xAxisOption, direction);
                helper_1.omit(cfg, OMIT_CFG);
                axis.component.update(cfg);
                updatedCache.set(axisId, axis);
            }
            else {
                // 不存在，则创建
                axis = this.createLineAxis(scale, xAxisOption, layer, direction, dim);
                this.cache.set(axisId, axis);
                updatedCache.set(axisId, axis);
            }
            // 2. do grid update
            var grid = this.cache.get(gridId);
            // 存在则更新
            if (grid) {
                var cfg = this.getLineGridCfg(scale, xAxisOption, direction, dim);
                helper_1.omit(cfg, OMIT_CFG);
                grid.component.update(cfg);
                updatedCache.set(gridId, grid);
            }
            else {
                // 不存在则创建
                grid = this.createLineGrid(scale, xAxisOption, layer, direction, dim);
                if (grid) {
                    this.cache.set(gridId, grid);
                    updatedCache.set(gridId, grid);
                }
            }
        }
        else if (coordinate.isPolar) {
            // 1. do axis update
            var axis = this.cache.get(axisId);
            // 存在则更新
            if (axis) {
                var cfg = coordinate.isTransposed
                    ? this.getLineAxisCfg(scale, xAxisOption, constant_1.DIRECTION.RADIUS)
                    : this.getCircleAxisCfg(scale, xAxisOption, direction);
                helper_1.omit(cfg, OMIT_CFG);
                axis.component.update(cfg);
                updatedCache.set(axisId, axis);
            }
            else {
                // 不存在，则创建
                if (coordinate.isTransposed) {
                    if (util_1.isUndefined(xAxisOption)) {
                        // 默认不渲染转置极坐标下的坐标轴
                        return;
                    }
                    else {
                        // 如果用户打开了隐藏的坐标轴 chart.axis(true)/chart.axis('x', true)
                        // 那么对于转置了的极坐标，半径轴显示的是 x 轴对应的数据
                        axis = this.createLineAxis(scale, xAxisOption, layer, constant_1.DIRECTION.RADIUS, dim);
                    }
                }
                else {
                    axis = this.createCircleAxis(scale, xAxisOption, layer, direction, dim);
                }
                this.cache.set(axisId, axis);
                updatedCache.set(axisId, axis);
            }
            // 2. do grid update
            var grid = this.cache.get(gridId);
            // 存在则更新
            if (grid) {
                var cfg = coordinate.isTransposed
                    ? this.getCircleGridCfg(scale, xAxisOption, constant_1.DIRECTION.RADIUS, dim)
                    : this.getLineGridCfg(scale, xAxisOption, constant_1.DIRECTION.CIRCLE, dim);
                helper_1.omit(cfg, OMIT_CFG);
                grid.component.update(cfg);
                updatedCache.set(gridId, grid);
            }
            else {
                // 不存在则创建
                if (coordinate.isTransposed) {
                    if (util_1.isUndefined(xAxisOption)) {
                        return;
                    }
                    else {
                        grid = this.createCircleGrid(scale, xAxisOption, layer, constant_1.DIRECTION.RADIUS, dim);
                    }
                }
                else {
                    // grid，极坐标下的 x 轴网格线沿着半径方向绘制
                    grid = this.createLineGrid(scale, xAxisOption, layer, constant_1.DIRECTION.CIRCLE, dim);
                }
                if (grid) {
                    this.cache.set(gridId, grid);
                    updatedCache.set(gridId, grid);
                }
            }
        }
        else {
            // helix and other, do not draw axis
        }
    };
    Axis.prototype.updateYAxes = function (updatedCache) {
        var _this = this;
        // y axes
        var yScales = this.view.getYScales();
        util_1.each(yScales, function (scale, idx) {
            // @ts-ignore
            if (!scale || scale.isIdentity) {
                return;
            }
            var field = scale.field;
            var yAxisOption = axis_2.getAxisOption(_this.option, field);
            if (yAxisOption !== false) {
                var layer = constant_1.LAYER.BG;
                var dim = 'y';
                var axisId = _this.getId('axis', field);
                var gridId = _this.getId('grid', field);
                var coordinate = _this.view.getCoordinate();
                if (coordinate.isRect) {
                    var direction = axis_1.getAxisDirection(yAxisOption, idx === 0 ? constant_1.DIRECTION.LEFT : constant_1.DIRECTION.RIGHT);
                    // 1. do axis update
                    var axis = _this.cache.get(axisId);
                    // 存在则更新
                    if (axis) {
                        var cfg = _this.getLineAxisCfg(scale, yAxisOption, direction);
                        helper_1.omit(cfg, OMIT_CFG);
                        axis.component.update(cfg);
                        updatedCache.set(axisId, axis);
                    }
                    else {
                        // 不存在，则创建
                        axis = _this.createLineAxis(scale, yAxisOption, layer, direction, dim);
                        _this.cache.set(axisId, axis);
                        updatedCache.set(axisId, axis);
                    }
                    // 2. do grid update
                    var grid = _this.cache.get(gridId);
                    // 存在则更新
                    if (grid) {
                        var cfg = _this.getLineGridCfg(scale, yAxisOption, direction, dim);
                        helper_1.omit(cfg, OMIT_CFG);
                        grid.component.update(cfg);
                        updatedCache.set(gridId, grid);
                    }
                    else {
                        // 不存在则创建
                        grid = _this.createLineGrid(scale, yAxisOption, layer, direction, dim);
                        if (grid) {
                            _this.cache.set(gridId, grid);
                            updatedCache.set(gridId, grid);
                        }
                    }
                }
                else if (coordinate.isPolar) {
                    // 1. do axis update
                    var axis = _this.cache.get(axisId);
                    // 存在则更新
                    if (axis) {
                        var cfg = coordinate.isTransposed
                            ? _this.getCircleAxisCfg(scale, yAxisOption, constant_1.DIRECTION.CIRCLE)
                            : _this.getLineAxisCfg(scale, yAxisOption, constant_1.DIRECTION.RADIUS);
                        // @ts-ignore
                        helper_1.omit(cfg, OMIT_CFG);
                        axis.component.update(cfg);
                        updatedCache.set(axisId, axis);
                    }
                    else {
                        // 不存在，则创建
                        if (coordinate.isTransposed) {
                            if (util_1.isUndefined(yAxisOption)) {
                                return;
                            }
                            else {
                                axis = _this.createCircleAxis(scale, yAxisOption, layer, constant_1.DIRECTION.CIRCLE, dim);
                            }
                        }
                        else {
                            axis = _this.createLineAxis(scale, yAxisOption, layer, constant_1.DIRECTION.RADIUS, dim);
                        }
                        _this.cache.set(axisId, axis);
                        updatedCache.set(axisId, axis);
                    }
                    // 2. do grid update
                    var grid = _this.cache.get(gridId);
                    // 存在则更新
                    if (grid) {
                        var cfg = coordinate.isTransposed
                            ? _this.getLineGridCfg(scale, yAxisOption, constant_1.DIRECTION.CIRCLE, dim)
                            : _this.getCircleGridCfg(scale, yAxisOption, constant_1.DIRECTION.RADIUS, dim);
                        helper_1.omit(cfg, OMIT_CFG);
                        grid.component.update(cfg);
                        updatedCache.set(gridId, grid);
                    }
                    else {
                        // 不存在则创建
                        if (coordinate.isTransposed) {
                            if (util_1.isUndefined(yAxisOption)) {
                                return;
                            }
                            else {
                                grid = _this.createLineGrid(scale, yAxisOption, layer, constant_1.DIRECTION.CIRCLE, dim);
                            }
                        }
                        else {
                            grid = _this.createCircleGrid(scale, yAxisOption, layer, constant_1.DIRECTION.RADIUS, dim);
                        }
                        if (grid) {
                            _this.cache.set(gridId, grid);
                            updatedCache.set(gridId, grid);
                        }
                    }
                }
                else {
                    // helix and other, do not draw axis
                }
            }
        });
    };
    /**
     * 创建 line axis
     * @param scale
     * @param option
     * @param layer
     * @param direction
     * @param dim
     */
    Axis.prototype.createLineAxis = function (scale, option, layer, direction, dim) {
        // axis
        var axis = {
            component: new dependents_1.LineAxis(this.getLineAxisCfg(scale, option, direction)),
            layer: layer,
            direction: direction === constant_1.DIRECTION.RADIUS ? constant_1.DIRECTION.NONE : direction,
            type: constant_1.COMPONENT_TYPE.AXIS,
            extra: { dim: dim, scale: scale },
        };
        axis.component.set('field', scale.field);
        axis.component.init();
        return axis;
    };
    Axis.prototype.createLineGrid = function (scale, option, layer, direction, dim) {
        var cfg = this.getLineGridCfg(scale, option, direction, dim);
        if (cfg) {
            var grid = {
                component: new dependents_1.LineGrid(cfg),
                layer: layer,
                direction: constant_1.DIRECTION.NONE,
                type: constant_1.COMPONENT_TYPE.GRID,
                extra: {
                    dim: dim,
                    scale: scale,
                    alignTick: util_1.get(cfg, 'alignTick', true),
                },
            };
            grid.component.init();
            return grid;
        }
    };
    Axis.prototype.createCircleAxis = function (scale, option, layer, direction, dim) {
        var axis = {
            component: new dependents_1.CircleAxis(this.getCircleAxisCfg(scale, option, direction)),
            layer: layer,
            direction: direction,
            type: constant_1.COMPONENT_TYPE.AXIS,
            extra: { dim: dim, scale: scale },
        };
        axis.component.set('field', scale.field);
        axis.component.init();
        return axis;
    };
    Axis.prototype.createCircleGrid = function (scale, option, layer, direction, dim) {
        var cfg = this.getCircleGridCfg(scale, option, direction, dim);
        if (cfg) {
            var grid = {
                component: new dependents_1.CircleGrid(cfg),
                layer: layer,
                direction: constant_1.DIRECTION.NONE,
                type: constant_1.COMPONENT_TYPE.GRID,
                extra: {
                    dim: dim,
                    scale: scale,
                    alignTick: util_1.get(cfg, 'alignTick', true),
                },
            };
            grid.component.init();
            return grid;
        }
    };
    /**
     * generate line axis cfg
     * @param scale
     * @param axisOption
     * @param direction
     * @return line axis cfg
     */
    Axis.prototype.getLineAxisCfg = function (scale, axisOption, direction) {
        var container = this.axisContainer;
        var coordinate = this.view.getCoordinate();
        var region = axis_1.getAxisRegion(coordinate, direction);
        var titleText = axis_1.getAxisTitleText(scale, axisOption);
        var axisThemeCfg = axis_1.getAxisThemeCfg(this.view.getTheme(), direction);
        // the cfg order should be ensure
        var optionWithTitle = util_1.get(axisOption, ['title'])
            ? util_1.deepMix({ title: { style: { text: titleText } } }, axisOption)
            : axisOption;
        var cfg = util_1.deepMix(tslib_1.__assign(tslib_1.__assign({ container: container }, region), { ticks: scale.getTicks().map(function (tick) { return ({ id: "" + tick.tickValue, name: tick.text, value: tick.value }); }), verticalFactor: coordinate.isPolar
                ? axis_1.getAxisFactorByRegion(region, coordinate.getCenter()) * -1
                : axis_1.getAxisFactorByRegion(region, coordinate.getCenter()) }), axisThemeCfg, optionWithTitle);
        var _a = this.getAnimateCfg(cfg), animate = _a.animate, animateOption = _a.animateOption;
        cfg.animateOption = animateOption;
        cfg.animate = animate;
        // 计算 verticalLimitLength
        var isAxisVertical = axis_1.isVertical(region);
        // TODO: 1 / 3 等默认值需要有一个全局的配置的地方
        var verticalLimitLength = util_1.get(cfg, 'verticalLimitLength', isAxisVertical ? 1 / 3 : 1 / 2);
        if (verticalLimitLength <= 1) {
            // 配置的相对值，相对于画布
            var canvasWidth = this.view.getCanvas().get('width');
            var canvasHeight = this.view.getCanvas().get('height');
            cfg.verticalLimitLength = verticalLimitLength * (isAxisVertical ? canvasWidth : canvasHeight);
        }
        return cfg;
    };
    /**
     * generate line grid cfg
     * @param scale
     * @param axisOption
     * @param direction
     * @param dim
     * @return line grid cfg
     */
    Axis.prototype.getLineGridCfg = function (scale, axisOption, direction, dim) {
        if (!grid_1.showGrid(axis_1.getAxisThemeCfg(this.view.getTheme(), direction), axisOption)) {
            return undefined;
        }
        var gridThemeCfg = grid_1.getGridThemeCfg(this.view.getTheme(), direction);
        // the cfg order should be ensure
        // grid 动画以 axis 为准
        var gridCfg = util_1.deepMix({
            container: this.gridContainer,
        }, gridThemeCfg, util_1.get(axisOption, 'grid'), this.getAnimateCfg(axisOption));
        gridCfg.items = grid_1.getLineGridItems(this.view.getCoordinate(), scale, dim, util_1.get(gridCfg, 'alignTick', true));
        return gridCfg;
    };
    /**
     * generate circle axis cfg
     * @param scale
     * @param axisOption
     * @param direction
     * @return circle axis cfg
     */
    Axis.prototype.getCircleAxisCfg = function (scale, axisOption, direction) {
        var container = this.axisContainer;
        var coordinate = this.view.getCoordinate();
        var ticks = scale.getTicks().map(function (tick) { return ({ id: "" + tick.tickValue, name: tick.text, value: tick.value }); });
        if (!scale.isCategory && Math.abs(coordinate.endAngle - coordinate.startAngle) === Math.PI * 2) {
            // x 轴对应的值如果是非 cat 类型，在整圆的情况下坐标轴第一个和最后一个文本会重叠，默认只展示第一个文本
            ticks.pop();
        }
        var titleText = axis_1.getAxisTitleText(scale, axisOption);
        var axisThemeCfg = axis_1.getAxisThemeCfg(this.view.getTheme(), constant_1.DIRECTION.CIRCLE);
        // the cfg order should be ensure
        var optionWithTitle = util_1.get(axisOption, ['title'])
            ? util_1.deepMix({ title: { style: { text: titleText } } }, axisOption)
            : axisOption;
        var cfg = util_1.deepMix(tslib_1.__assign(tslib_1.__assign({ container: container }, axis_1.getCircleAxisCenterRadius(this.view.getCoordinate())), { ticks: ticks, verticalFactor: 1 }), axisThemeCfg, optionWithTitle);
        var _a = this.getAnimateCfg(cfg), animate = _a.animate, animateOption = _a.animateOption;
        cfg.animate = animate;
        cfg.animateOption = animateOption;
        return cfg;
    };
    /**
     * generate circle grid cfg
     * @param scale
     * @param axisOption
     * @param direction
     * @return circle grid cfg
     */
    Axis.prototype.getCircleGridCfg = function (scale, axisOption, direction, dim) {
        if (!grid_1.showGrid(axis_1.getAxisThemeCfg(this.view.getTheme(), direction), axisOption)) {
            return undefined;
        }
        // the cfg order should be ensure
        // grid 动画以 axis 为准
        var gridThemeCfg = grid_1.getGridThemeCfg(this.view.getTheme(), constant_1.DIRECTION.RADIUS);
        var gridCfg = util_1.deepMix({
            container: this.gridContainer,
            center: this.view.getCoordinate().getCenter(),
        }, gridThemeCfg, util_1.get(axisOption, 'grid'), this.getAnimateCfg(axisOption));
        var alignTick = util_1.get(gridCfg, 'alignTick', true);
        var verticalScale = dim === 'x' ? this.view.getYScales()[0] : this.view.getXScale();
        gridCfg.items = grid_1.getCircleGridItems(this.view.getCoordinate(), verticalScale, scale, alignTick, dim);
        // the cfg order should be ensure
        // grid 动画以 axis 为准
        return gridCfg;
    };
    Axis.prototype.getId = function (name, key) {
        var coordinate = this.view.getCoordinate();
        // 坐标系类型也作为组件的 key
        return name + "-" + key + "-" + coordinate.type;
    };
    Axis.prototype.getAnimateCfg = function (cfg) {
        return {
            animate: this.view.getOptions().animate && util_1.get(cfg, 'animate'),
            animateOption: cfg && cfg.animateOption ? util_1.deepMix({}, AXIS_DEFAULT_ANIMATE_CFG, cfg.animateOption) : AXIS_DEFAULT_ANIMATE_CFG,
        };
    };
    return Axis;
}(base_1.Controller));
exports.default = Axis;

},{"../../animate/":217,"../../constant":237,"../../dependents":239,"../../util/axis":369,"../../util/grid":376,"../../util/helper":377,"./base":222,"@antv/util":803,"tslib":385}],222:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Controller = void 0;
var util_1 = require("@antv/util");
/**
 * Component Controller 规范需要定义的基类
 * 1. 规范的 option 输入
 * 2. 统一的信息获取 API
 * 3. 明确定义的组件事件（名称、数据）
 */
var Controller = /** @class */ (function () {
    function Controller(view) {
        /** 是否可见 */
        this.visible = true;
        /** 所有的 component */
        this.components = [];
        this.view = view;
    }
    /**
     * clear
     */
    Controller.prototype.clear = function () {
        // destroy all components
        util_1.each(this.components, function (co) {
            co.component.destroy();
        });
        // clear all component instance
        this.components = [];
    };
    /**
     * destroy the component
     */
    Controller.prototype.destroy = function () {
        this.clear();
    };
    /**
     * get all components
     * @returns components array
     */
    Controller.prototype.getComponents = function () {
        return this.components;
    };
    /**
     * change visibility of component
     * @param visible
     */
    Controller.prototype.changeVisible = function (visible) {
        if (this.visible === visible) {
            return;
        }
        this.components.forEach(function (co) {
            if (visible) {
                co.component.show();
            }
            else {
                co.component.hide();
            }
        });
        this.visible = visible;
    };
    return Controller;
}());
exports.Controller = Controller;

},{"@antv/util":803}],223:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../dependents");
/**
 * coordinate controller，职责：
 * 1. 创建实例
 * 2. 暂存配置
 */
var CoordinateController = /** @class */ (function () {
    function CoordinateController(option) {
        // 设置默认值，并存储配置
        this.option = this.wrapperOption(option);
    }
    /**
     * 更新配置
     * @param option
     */
    CoordinateController.prototype.update = function (option) {
        this.option = this.wrapperOption(option);
        return this;
    };
    /**
     * 是否存在某一个 action
     * @param actionName
     */
    CoordinateController.prototype.hasAction = function (actionName) {
        var actions = this.option.actions;
        return util_1.some(actions, function (action) { return action[0] === actionName; });
    };
    /**
     * 创建坐标系对象
     * @param start 起始位置
     * @param end   结束位置
     * @return 坐标系实例
     */
    CoordinateController.prototype.create = function (start, end) {
        var _a = this.option, type = _a.type, cfg = _a.cfg;
        var isTheta = type === 'theta';
        // 1. 起始位置
        var props = tslib_1.__assign({ start: start,
            end: end }, cfg);
        // 2. 创建实例
        var C = dependents_1.getCoordinate(isTheta ? 'polar' : type);
        this.coordinate = new C(props);
        // @ts-ignore FIXME coordinate 包问题导致 type 不正确
        this.coordinate.type = type;
        // 3. 添加默认 action
        if (isTheta) {
            // 不存在 transpose，为其自动设置一个 action
            if (!this.hasAction('transpose')) {
                this.transpose();
            }
        }
        // 4. 执行 action
        this.execActions();
        return this.coordinate;
    };
    /**
     * 更新坐标系对象
     * @param start 起始位置
     * @param end   结束位置
     * @return 坐标系实例
     */
    CoordinateController.prototype.adjust = function (start, end) {
        this.coordinate.update({
            start: start,
            end: end,
        });
        // 更新坐标系大小的时候，需要：
        // 1. 重置 matrix
        // 2. 重新执行作用于 matrix 的 action
        this.coordinate.resetMatrix();
        this.execActions(['scale', 'rotate', 'translate']);
        return this.coordinate;
    };
    /**
     * 旋转弧度
     * @param angle
     */
    CoordinateController.prototype.rotate = function (angle) {
        this.option.actions.push(['rotate', angle]);
        return this;
    };
    /**
     * 镜像
     * @param dim
     */
    CoordinateController.prototype.reflect = function (dim) {
        this.option.actions.push(['reflect', dim]);
        return this;
    };
    /**
     * scale
     * @param sx
     * @param sy
     */
    CoordinateController.prototype.scale = function (sx, sy) {
        this.option.actions.push(['scale', sx, sy]);
        return this;
    };
    /**
     * 对角变换
     */
    CoordinateController.prototype.transpose = function () {
        this.option.actions.push(['transpose']);
        return this;
    };
    /**
     * 获取配置
     */
    CoordinateController.prototype.getOption = function () {
        return this.option;
    };
    /**
     * 获得 coordinate 实例
     */
    CoordinateController.prototype.getCoordinate = function () {
        return this.coordinate;
    };
    /**
     * 包装配置的默认值
     * @param option
     */
    CoordinateController.prototype.wrapperOption = function (option) {
        return tslib_1.__assign({ type: 'rect', actions: [], cfg: {} }, option);
    };
    /**
     * coordinate 实例执行 actions
     * @params includeActions 如果没有指定，则执行全部，否则，执行指定的 action
     */
    CoordinateController.prototype.execActions = function (includeActions) {
        var _this = this;
        var actions = this.option.actions;
        util_1.each(actions, function (action) {
            var _a;
            var actionName = action[0], args = action.slice(1);
            var shouldExec = util_1.isNil(includeActions) ? true : includeActions.includes(actionName);
            if (shouldExec) {
                (_a = _this.coordinate)[actionName].apply(_a, args);
            }
        });
    };
    return CoordinateController;
}());
exports.default = CoordinateController;

},{"../../dependents":239,"@antv/util":803,"tslib":385}],224:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var PRESS_DELAY = 250;
// 计算滑动的方向
var calcDirection = function (start, end) {
    var xDistance = end.x - start.x;
    var yDistance = end.y - start.y;
    // x 的距离大于y 说明是横向，否则就是纵向
    if (Math.abs(xDistance) > Math.abs(yDistance)) {
        return xDistance > 0 ? 'right' : 'left';
    }
    return yDistance > 0 ? 'down' : 'up';
};
// 计算2点之间的距离
var calcDistance = function (point1, point2) {
    var xDistance = Math.abs(point2.x - point1.x);
    var yDistance = Math.abs(point2.y - point1.y);
    return Math.sqrt(xDistance * xDistance + yDistance * yDistance);
};
var getCenter = function (point1, point2) {
    var x = (point1.x + point2.x) / 2;
    var y = (point1.y + point2.y) / 2;
    return { x: x, y: y };
};
var convertPoints = function (touches, canvas) {
    if (!touches) {
        return;
    }
    var points = [];
    var len = touches.length;
    for (var i = 0; i < len; i++) {
        var touch = touches[i];
        // x, y: 相对canvas原点的位置，clientX, clientY 相对于可视窗口的位置
        var clientX = touch.clientX, clientY = touch.clientY;
        var point = canvas.getPointByClient(clientX, clientY);
        points.push(point);
    }
    return points;
};
var GestureController = /** @class */ (function (_super) {
    tslib_1.__extends(GestureController, _super);
    function GestureController(view) {
        var _this = _super.call(this, view) || this;
        _this.processEvent = {};
        _this.touchStart = function (ev) {
            var points = convertPoints(ev.originalEvent.touches, _this.canvas);
            if (!points) {
                return;
            }
            ev.points = points;
            // 防止上次的内容没有清理掉，重新reset下
            _this.reset();
            // 记录touch start 的时间
            _this.startTime = Date.now();
            // 记录touch start 的点
            _this.startPoints = points;
            if (points.length > 1) {
                _this.startDistance = calcDistance(points[0], points[1]);
                _this.center = getCenter(points[0], points[1]);
            }
            else {
                // 如果touchstart后停顿250ms, 则也触发press事件
                _this.pressTimeout = setTimeout(function () {
                    // 这里固定触发press事件
                    var eventType = 'press';
                    ev.direction = 'none';
                    _this.emitStart(eventType, ev);
                    _this.emitEvent(eventType, ev);
                    _this.eventType = eventType;
                }, PRESS_DELAY);
            }
        };
        _this.touchMove = function (ev) {
            var points = convertPoints(ev.originalEvent.touches, _this.canvas);
            if (!points) {
                return;
            }
            _this.clearPressTimeout();
            ev.points = points;
            var startPoints = _this.startPoints;
            if (!startPoints) {
                return;
            }
            // 多指触控
            if (points.length > 1) {
                // touchstart的距离
                var startDistance = _this.startDistance;
                var currentDistance = calcDistance(points[0], points[1]);
                ev.zoom = currentDistance / startDistance;
                ev.center = _this.center;
                // 触发缩放事件
                _this.emitStart('pinch', ev);
                _this.emitEvent('pinch', ev);
            }
            else {
                var deltaX = points[0].x - startPoints[0].x;
                var deltaY = points[0].y - startPoints[0].y;
                var direction = _this.direction || calcDirection(startPoints[0], points[0]);
                _this.direction = direction;
                // 获取press或者pan的事件类型
                // press 按住滑动, pan表示平移
                // 如果start后立刻move，则触发pan, 如果有停顿，则触发press
                var eventType = _this.getEventType(points);
                ev.direction = direction;
                ev.deltaX = deltaX;
                ev.deltaY = deltaY;
                _this.emitStart(eventType, ev);
                _this.emitEvent(eventType, ev);
                // 记录最后2次move的时间和坐标，为了给swipe事件用
                var prevMoveTime = _this.lastMoveTime;
                var now = Date.now();
                // 最后2次的时间间隔一定要大于0，否则swipe没发计算
                if (now - prevMoveTime > 0) {
                    _this.prevMoveTime = prevMoveTime;
                    _this.prevMovePoints = _this.lastMovePoints;
                    _this.lastMoveTime = now;
                    _this.lastMovePoints = points;
                }
            }
        };
        _this.touchEnd = function (ev) {
            _this.emitEnd(ev);
            // swipe事件处理, 在touchend之后触发
            var lastMoveTime = _this.lastMoveTime;
            var now = Date.now();
            // 做这个判断是为了最后一次touchmove后到end前，还有一个停顿的过程
            // 100 是拍的一个值，理论这个值会很短，一般不卡顿的话在10ms以内
            if (now - lastMoveTime < 100) {
                var prevMoveTime = _this.prevMoveTime || _this.startTime;
                var intervalTime = lastMoveTime - prevMoveTime;
                // 时间间隔一定要大于0, 否则计算没意义
                if (intervalTime > 0) {
                    var prevMovePoints = _this.prevMovePoints || _this.startPoints;
                    var lastMovePoints = _this.lastMovePoints;
                    // move速率
                    var velocity = calcDistance(prevMovePoints[0], lastMovePoints[0]) / intervalTime;
                    // 0.3 是参考hammerjs的设置
                    if (velocity > 0.3) {
                        ev.velocity = velocity;
                        ev.direction = calcDirection(prevMovePoints[0], lastMovePoints[0]);
                        _this.emitEvent('swipe', ev);
                    }
                }
            }
            _this.reset();
            var touches = ev.touches;
            // 当多指只释放了1指时也会触发end, 这时重新触发一次start
            if (touches && touches.length > 0) {
                _this.touchStart(ev);
            }
        };
        _this.canvas = view.getCanvas();
        _this.delegateEvent();
        // 用来记录当前触发的事件
        _this.processEvent = {};
        return _this;
    }
    Object.defineProperty(GestureController.prototype, "name", {
        get: function () {
            return 'gesture';
        },
        enumerable: false,
        configurable: true
    });
    GestureController.prototype.init = function () { };
    GestureController.prototype.render = function () { };
    GestureController.prototype.layout = function () { };
    GestureController.prototype.update = function () { };
    GestureController.prototype.destroy = function () {
        this.reset();
        this.offEvent();
        this.processEvent = null;
    };
    GestureController.prototype.delegateEvent = function () {
        // 代理这几个事件
        this.canvas.on('touchstart', this.touchStart);
        this.canvas.on('touchmove', this.touchMove);
        this.canvas.on('touchend', this.touchEnd);
    };
    GestureController.prototype.offEvent = function () {
        this.canvas.off('touchstart', this.touchStart);
        this.canvas.off('touchmove', this.touchMove);
        this.canvas.off('touchend', this.touchEnd);
    };
    GestureController.prototype.emitEvent = function (type, ev) {
        var view = this.view;
        view.emit(type, ev);
    };
    // 触发start事件
    GestureController.prototype.emitStart = function (type, ev) {
        if (this.isProcess(type)) {
            return;
        }
        this.enable(type);
        this.emitEvent(type + "start", ev);
    };
    // 触发end事件
    GestureController.prototype.emitEnd = function (ev) {
        var _this = this;
        var processEvent = this.processEvent;
        Object.keys(processEvent).forEach(function (type) {
            _this.emitEvent(type + "end", ev);
            delete processEvent[type];
        });
    };
    GestureController.prototype.enable = function (eventType) {
        this.processEvent[eventType] = true;
    };
    // 是否进行中的事件
    GestureController.prototype.isProcess = function (eventType) {
        return this.processEvent[eventType];
    };
    GestureController.prototype.reset = function () {
        this.clearPressTimeout();
        this.startTime = 0;
        this.startPoints = null;
        this.startDistance = 0;
        this.direction = null;
        this.eventType = null;
        this.prevMoveTime = 0;
        this.prevMovePoints = null;
        this.lastMoveTime = 0;
        this.lastMovePoints = null;
    };
    GestureController.prototype.clearPressTimeout = function () {
        if (this.pressTimeout) {
            clearTimeout(this.pressTimeout);
            this.pressTimeout = 0;
        }
    };
    GestureController.prototype.getEventType = function (points) {
        var _a = this, eventType = _a.eventType, view = _a.view, startTime = _a.startTime, startPoints = _a.startPoints;
        if (eventType) {
            return eventType;
        }
        var type;
        var panEventListeners = view.getEvents().pan;
        // 如果 view 上没有 pan 事件的监听，默认都是 press
        if (!panEventListeners || !panEventListeners.length) {
            type = 'press';
        }
        else {
            // 如果有pan事件的处理，press则需要停顿250ms, 且移动距离小于10
            var now = Date.now();
            if (now - startTime > PRESS_DELAY && calcDistance(startPoints[0], points[0]) < 10) {
                type = 'press';
            }
            else {
                type = 'pan';
            }
        }
        this.eventType = type;
        return type;
    };
    return GestureController;
}(base_1.Controller));
exports.default = GestureController;

},{"./base":222,"tslib":385}],225:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getComponentController = exports.getComponentControllerNames = exports.unregisterComponentController = exports.registerComponentController = void 0;
var LOAD_COMPONENT_CONTROLLERS = {};
/**
 * 全局注册组件。
 * @param name 组件名称
 * @param plugin 注册的组件类
 * @returns void
 */
function registerComponentController(name, plugin) {
    LOAD_COMPONENT_CONTROLLERS[name] = plugin;
}
exports.registerComponentController = registerComponentController;
/**
 * 删除全局组件。
 * @param name 组件名
 * @returns void
 */
function unregisterComponentController(name) {
    delete LOAD_COMPONENT_CONTROLLERS[name];
}
exports.unregisterComponentController = unregisterComponentController;
/**
 * 获取以注册的组件名。
 * @returns string[] 返回已注册的组件名称
 */
function getComponentControllerNames() {
    return Object.keys(LOAD_COMPONENT_CONTROLLERS);
}
exports.getComponentControllerNames = getComponentControllerNames;
/**
 * 根据组件名获取组件类。
 * @param name 组件名
 * @returns 返回组件类
 */
function getComponentController(name) {
    return LOAD_COMPONENT_CONTROLLERS[name];
}
exports.getComponentController = getComponentController;

},{}],226:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../../constant");
var dependents_1 = require("../../dependents");
var animate_1 = require("../../animate");
var bbox_1 = require("../../util/bbox");
var direction_1 = require("../../util/direction");
var helper_1 = require("../../util/helper");
var legend_1 = require("../../util/legend");
var scale_1 = require("../../util/scale");
var base_1 = require("./base");
/**
 * 从配置中获取单个字段的 legend 配置
 * @param legends
 * @param field
 * @returns the option of one legend field
 */
function getLegendOption(legends, field) {
    if (util_1.isBoolean(legends)) {
        return legends === false ? false : {};
    }
    return util_1.get(legends, [field], legends);
}
function getDirection(legendOption) {
    return util_1.get(legendOption, 'position', constant_1.DIRECTION.BOTTOM);
}
/**
 * @ignore
 * legend Controller
 */
var Legend = /** @class */ (function (_super) {
    tslib_1.__extends(Legend, _super);
    function Legend(view) {
        var _this = _super.call(this, view) || this;
        _this.container = _this.view.getLayer(constant_1.LAYER.FORE).addGroup();
        return _this;
    }
    Object.defineProperty(Legend.prototype, "name", {
        get: function () {
            return 'legend';
        },
        enumerable: false,
        configurable: true
    });
    Legend.prototype.init = function () { };
    /**
     * render the legend component by legend options
     */
    Legend.prototype.render = function () {
        var _this = this;
        this.option = this.view.getOptions().legends;
        var doEachLegend = function (geometry, attr, scale) {
            var legend = _this.createFieldLegend(geometry, attr, scale);
            if (legend) {
                legend.component.init();
                _this.components.push(legend);
            }
        };
        // 全局自定义图例
        if (util_1.get(this.option, 'custom')) {
            var component = this.createCustomLegend(undefined, undefined, undefined, this.option);
            if (component) {
                component.init();
                var layer = constant_1.LAYER.FORE;
                var direction = getDirection(this.option);
                this.components.push({
                    id: 'global-custom',
                    component: component,
                    layer: layer,
                    direction: direction,
                    type: constant_1.COMPONENT_TYPE.LEGEND,
                    extra: undefined,
                });
            }
        }
        else {
            // 遍历处理每一个创建逻辑
            this.loopLegends(doEachLegend);
        }
    };
    /**
     * layout legend
     * 计算出 legend 的 direction 位置 x, y
     */
    Legend.prototype.layout = function () {
        var _this = this;
        this.layoutBBox = this.view.viewBBox;
        var margin = util_1.get(this.view.getTheme(), ['components', 'legend', 'margin'], [0, 0, 0, 0]);
        util_1.each(this.components, function (co) {
            var component = co.component, direction = co.direction;
            var layout = legend_1.getLegendLayout(direction);
            var maxSize = _this.getCategoryLegendSizeCfg(layout);
            var maxWidth = component.get('maxWidth');
            var maxHeight = component.get('maxHeight');
            // 先更新 maxSize，更新 layoutBBox，以便计算正确的 x y
            component.update({
                maxWidth: Math.min(maxSize.maxWidth, maxWidth || 0),
                maxHeight: Math.min(maxSize.maxHeight, maxHeight || 0),
            });
            var bboxObject = component.getLayoutBBox(); // 这里只需要他的 width、height 信息做位置调整
            var bbox = new bbox_1.BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height);
            var _a = direction_1.directionToPosition(_this.view.viewBBox, bbox, direction), x1 = _a[0], y1 = _a[1];
            var _b = direction_1.directionToPosition(_this.layoutBBox, bbox, direction), x2 = _b[0], y2 = _b[1];
            var x = 0;
            var y = 0;
            // 因为 legend x y 要和 coordinateBBox 对齐，所以要做一个简单的判断
            if (direction.startsWith('top') || direction.startsWith('bottom')) {
                x = x1;
                y = y2;
            }
            else {
                x = x2;
                y = y1;
            }
            // 加上 margin
            if (direction.indexOf('left') >= 0) {
                x += margin[3];
            }
            if (direction.indexOf('right') >= 0) {
                x -= margin[1];
            }
            if (direction.indexOf('top') >= 0) {
                y += margin[0];
            }
            if (direction.indexOf('bottom') >= 0) {
                y -= margin[2];
            }
            // 更新位置
            component.update({
                x: x,
                y: y,
            });
            _this.layoutBBox = _this.layoutBBox.cut(bbox, direction);
        });
    };
    /**
     * legend 的更新逻辑
     */
    Legend.prototype.update = function () {
        var _this = this;
        this.option = this.view.getOptions().legends;
        // 已经处理过的 legend
        var updated = {};
        var eachLegend = function (geometry, attr, scale) {
            var id = _this.getId(scale.field);
            var existCo = _this.getComponentById(id);
            // 存在则 update
            if (existCo) {
                var cfg = void 0;
                var legendOption = getLegendOption(_this.option, scale.field);
                // if the legend option is not false, means legend should be created.
                if (legendOption !== false) {
                    if (util_1.get(legendOption, 'custom')) {
                        cfg = _this.getCategoryCfg(geometry, attr, scale, legendOption, true);
                    }
                    else {
                        if (scale.isLinear) {
                            // linear field, create continuous legend
                            cfg = _this.getContinuousCfg(geometry, attr, scale, legendOption);
                        }
                        else if (scale.isCategory) {
                            // category field, create category legend
                            cfg = _this.getCategoryCfg(geometry, attr, scale, legendOption);
                        }
                    }
                }
                // 如果 cfg 为空，则不在 updated 标记，那么会在后面逻辑中删除
                if (cfg) {
                    // omit 掉一些属性，比如 container 等
                    helper_1.omit(cfg, ['container']);
                    existCo.direction = getDirection(legendOption);
                    existCo.component.update(cfg);
                    // 标记为新的
                    updated[id] = true;
                }
            }
            else {
                // 不存在则 create
                var legend = _this.createFieldLegend(geometry, attr, scale);
                if (legend) {
                    legend.component.init();
                    _this.components.push(legend);
                    // 标记为新的
                    updated[id] = true;
                }
            }
        };
        // 全局自定义图例
        if (util_1.get(this.option, 'custom')) {
            var id = 'global-custom';
            var existCo = this.getComponentById(id);
            if (existCo) {
                var customCfg = this.getCategoryCfg(undefined, undefined, undefined, this.option, true);
                helper_1.omit(customCfg, ['container']);
                existCo.component.update(customCfg);
                updated[id] = true;
            }
            else {
                var component = this.createCustomLegend(undefined, undefined, undefined, this.option);
                if (component) {
                    component.init();
                    var layer = constant_1.LAYER.FORE;
                    var direction = getDirection(this.option);
                    this.components.push({
                        id: id,
                        component: component,
                        layer: layer,
                        direction: direction,
                        type: constant_1.COMPONENT_TYPE.LEGEND,
                        extra: undefined,
                    });
                    // 标记为更新
                    updated[id] = true;
                }
            }
        }
        else {
            // 遍历处理每一个创建逻辑
            this.loopLegends(eachLegend);
        }
        // 处理完成之后，销毁删除的
        // 不在处理中的
        var components = [];
        util_1.each(this.getComponents(), function (co) {
            if (updated[co.id]) {
                components.push(co);
            }
            else {
                co.component.destroy();
            }
        });
        // 更新当前已有的 components
        this.components = components;
    };
    Legend.prototype.clear = function () {
        _super.prototype.clear.call(this);
        this.container.clear();
    };
    Legend.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.container.remove(true);
    };
    /**
     * 递归获取所有的 Geometry
     */
    Legend.prototype.getGeometries = function (view) {
        var _this = this;
        var geometries = view.geometries;
        util_1.each(view.views, function (v) {
            geometries = geometries.concat(_this.getGeometries(v));
        });
        return geometries;
    };
    /**
     * 遍历 Geometry，处理 legend 逻辑
     * @param doEach 每个 loop 中的处理方法
     */
    Legend.prototype.loopLegends = function (doEach) {
        var isRootView = this.view.getRootView() === this.view;
        // 非根 view，不处理 legend
        if (!isRootView) {
            return;
        }
        // 递归 view 中所有的 Geometry，进行创建 legend
        var geometries = this.getGeometries(this.view);
        var looped = {}; // 防止一个字段创建两个 legend
        util_1.each(geometries, function (geometry) {
            var attributes = geometry.getGroupAttributes();
            util_1.each(attributes, function (attr) {
                var scale = attr.getScale(attr.type);
                // 如果在视觉通道上映射常量值，如 size(2) shape('circle') 不创建 legend
                if (!scale || scale.type === 'identity' || looped[scale.field]) {
                    return;
                }
                doEach(geometry, attr, scale);
                looped[scale.field] = true;
            });
        });
    };
    /**
     * 创建一个 legend
     * @param geometry
     * @param attr
     * @param scale
     */
    Legend.prototype.createFieldLegend = function (geometry, attr, scale) {
        var component;
        var legendOption = getLegendOption(this.option, scale.field);
        var layer = constant_1.LAYER.FORE;
        var direction = getDirection(legendOption);
        // if the legend option is not false, means legend should be created.
        if (legendOption !== false) {
            if (util_1.get(legendOption, 'custom')) {
                component = this.createCustomLegend(geometry, attr, scale, legendOption);
            }
            else {
                if (scale.isLinear) {
                    // linear field, create continuous legend
                    component = this.createContinuousLegend(geometry, attr, scale, legendOption);
                }
                else if (scale.isCategory) {
                    // category field, create category legend
                    component = this.createCategoryLegend(geometry, attr, scale, legendOption);
                }
            }
        }
        if (component) {
            component.set('field', scale.field);
            return {
                id: this.getId(scale.field),
                component: component,
                layer: layer,
                direction: direction,
                type: constant_1.COMPONENT_TYPE.LEGEND,
                extra: { scale: scale },
            };
        }
    };
    /**
     * 自定义图例使用 category 图例去渲染
     * @param geometry
     * @param attr
     * @param scale
     * @param legendOption
     */
    Legend.prototype.createCustomLegend = function (geometry, attr, scale, legendOption) {
        // 直接使用 分类图例渲染
        var cfg = this.getCategoryCfg(geometry, attr, scale, legendOption, true);
        return new dependents_1.CategoryLegend(cfg);
    };
    /**
     * 创建连续图例
     * @param geometry
     * @param attr
     * @param scale
     * @param legendOption
     */
    Legend.prototype.createContinuousLegend = function (geometry, attr, scale, legendOption) {
        var cfg = this.getContinuousCfg(geometry, attr, scale, legendOption);
        return new dependents_1.ContinuousLegend(cfg);
    };
    /**
     * 创建分类图例
     * @param geometry
     * @param attr
     * @param scale
     * @param legendOption
     */
    Legend.prototype.createCategoryLegend = function (geometry, attr, scale, legendOption) {
        var cfg = this.getCategoryCfg(geometry, attr, scale, legendOption);
        return new dependents_1.CategoryLegend(cfg);
    };
    /**
     * 获得连续图例的配置
     * @param geometry
     * @param attr
     * @param scale
     * @param legendOption
     */
    Legend.prototype.getContinuousCfg = function (geometry, attr, scale, legendOption) {
        var ticks = scale.getTicks();
        var containMin = util_1.find(ticks, function (tick) { return tick.value === 0; });
        var containMax = util_1.find(ticks, function (tick) { return tick.value === 1; });
        var items = ticks.map(function (tick) {
            var value = tick.value, tickValue = tick.tickValue;
            var attrValue = attr.mapping(scale.invert(value)).join('');
            return {
                value: tickValue,
                attrValue: attrValue,
                color: attrValue,
                scaleValue: value,
            };
        });
        if (!containMin) {
            items.push({
                value: scale.min,
                attrValue: attr.mapping(scale.invert(0)).join(''),
                color: attr.mapping(scale.invert(0)).join(''),
                scaleValue: 0,
            });
        }
        if (!containMax) {
            items.push({
                value: scale.max,
                attrValue: attr.mapping(scale.invert(1)).join(''),
                color: attr.mapping(scale.invert(1)).join(''),
                scaleValue: 1,
            });
        }
        // 排序
        items.sort(function (a, b) { return a.value - b.value; });
        // 跟 attr 相关的配置
        // size color 区别的配置
        var attrLegendCfg = {
            min: util_1.head(items).value,
            max: util_1.last(items).value,
            colors: [],
            rail: {
                type: attr.type,
            },
            track: {},
        };
        if (attr.type === 'size') {
            attrLegendCfg.track = {
                style: {
                    // size 的选中前景色，对于 color，则直接使用 color 标识
                    // @ts-ignore
                    fill: attr.type === 'size' ? this.view.getTheme().defaultColor : undefined,
                },
            };
        }
        if (attr.type === 'color') {
            attrLegendCfg.colors = items.map(function (item) { return item.attrValue; });
        }
        var container = this.container;
        // if position is not set, use top as default
        var direction = getDirection(legendOption);
        var layout = legend_1.getLegendLayout(direction);
        var title = util_1.get(legendOption, 'title');
        if (title) {
            title = util_1.deepMix({
                text: scale_1.getName(scale),
            }, title);
        }
        // 基础配置，从当前数据中读到的配置
        attrLegendCfg.container = container;
        attrLegendCfg.layout = layout;
        attrLegendCfg.title = title;
        attrLegendCfg.animateOption = animate_1.DEFAULT_ANIMATE_CFG;
        // @ts-ignore
        return this.mergeLegendCfg(attrLegendCfg, legendOption, 'continuous');
    };
    /**
     * 获取分类图例的配置项
     * @param geometry
     * @param attr
     * @param scale
     * @param custom
     * @param legendOption
     */
    Legend.prototype.getCategoryCfg = function (geometry, attr, scale, legendOption, custom) {
        var container = this.container;
        // if position is not set, use top as default
        var direction = util_1.get(legendOption, 'position', constant_1.DIRECTION.BOTTOM);
        // the default marker style
        var themeMarker = util_1.get(this.view.getTheme(), ['components', 'legend', direction, 'marker']);
        var userMarker = util_1.get(legendOption, 'marker');
        var layout = legend_1.getLegendLayout(direction);
        var items = custom
            ? legend_1.getCustomLegendItems(themeMarker, userMarker, legendOption.items)
            : legend_1.getLegendItems(this.view, geometry, attr, themeMarker, userMarker);
        var title = util_1.get(legendOption, 'title');
        if (title) {
            title = util_1.deepMix({
                text: scale ? scale_1.getName(scale) : '',
            }, title);
        }
        var baseCfg = this.getCategoryLegendSizeCfg(layout);
        baseCfg.container = container;
        baseCfg.layout = layout;
        baseCfg.items = items;
        baseCfg.title = title;
        baseCfg.animateOption = animate_1.DEFAULT_ANIMATE_CFG;
        var categoryCfg = this.mergeLegendCfg(baseCfg, legendOption, direction);
        if (categoryCfg.reversed) {
            // 图例项需要逆序
            categoryCfg.items.reverse();
        }
        var maxItemWidth = util_1.get(categoryCfg, 'maxItemWidth');
        if (maxItemWidth && maxItemWidth <= 1) {
            // 转换成像素值
            categoryCfg.maxItemWidth = this.view.viewBBox.width * maxItemWidth;
        }
        return categoryCfg;
    };
    /**
     * get legend config, use option > suggestion > theme
     * @param baseCfg
     * @param legendOption
     * @param direction
     */
    Legend.prototype.mergeLegendCfg = function (baseCfg, legendOption, direction) {
        var position = direction.split('-')[0];
        var themeObject = util_1.get(this.view.getTheme(), ['components', 'legend', position], {});
        return util_1.deepMix({}, themeObject, baseCfg, legendOption);
    };
    /**
     * 生成 id
     * @param key
     */
    Legend.prototype.getId = function (key) {
        return this.name + "-" + key;
    };
    /**
     * 根据 id 来获取组件
     * @param id
     */
    Legend.prototype.getComponentById = function (id) {
        return util_1.find(this.components, function (co) { return co.id === id; });
    };
    Legend.prototype.getCategoryLegendSizeCfg = function (layout) {
        var _a = this.view.viewBBox, vw = _a.width, vh = _a.height;
        // 目前 legend 的布局是以 viewBBox 为参照
        // const { width: cw, height: ch } = this.view.coordinateBBox;
        return layout === 'vertical'
            ? {
                maxWidth: vw * constant_1.COMPONENT_MAX_VIEW_PERCENTAGE,
                maxHeight: vh,
            }
            : {
                maxWidth: vw,
                maxHeight: vh * constant_1.COMPONENT_MAX_VIEW_PERCENTAGE,
            };
    };
    return Legend;
}(base_1.Controller));
exports.default = Legend;

},{"../../animate":217,"../../constant":237,"../../dependents":239,"../../util/bbox":370,"../../util/direction":372,"../../util/helper":377,"../../util/legend":378,"../../util/scale":381,"./base":222,"@antv/util":803,"tslib":385}],227:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../../constant");
var dependents_1 = require("../../dependents");
var bbox_1 = require("../../util/bbox");
var direction_1 = require("../../util/direction");
var helper_1 = require("../../util/helper");
var base_1 = require("./base");
/**
 * @ignore
 * slider Controller
 */
var Slider = /** @class */ (function (_super) {
    tslib_1.__extends(Slider, _super);
    function Slider(view) {
        var _this = _super.call(this, view) || this;
        /**
         * 滑块滑动的时候出发
         * @param v
         */
        _this.onValueChanged = function (v) {
            var min = v[0], max = v[1];
            _this.updateMinMaxText(min, max);
            _this.view.render(true);
        };
        _this.container = _this.view.getLayer(constant_1.LAYER.FORE).addGroup();
        return _this;
    }
    Object.defineProperty(Slider.prototype, "name", {
        get: function () {
            return 'slider';
        },
        enumerable: false,
        configurable: true
    });
    /**
     * 初始化
     */
    Slider.prototype.init = function () { };
    /**
     * 渲染
     */
    Slider.prototype.render = function () {
        this.option = this.view.getOptions().slider;
        if (this.option) {
            if (this.slider) {
                // exist, update
                this.slider = this.updateSlider();
            }
            else {
                // not exist, create
                this.slider = this.createSlider();
                // 监听事件，绑定交互
                this.slider.component.on('sliderchange', this.onValueChanged);
            }
            // changeData 的时候同样需要更新
            // 设置初始的 text
            var min = this.slider.component.get('start') || 0;
            var max = this.slider.component.get('end') || 1;
            this.updateMinMaxText(min, max);
        }
        else {
            if (this.slider) {
                // exist, destroy
                this.slider.component.destroy();
                this.slider = undefined;
            }
            else {
                // do nothing
            }
        }
    };
    /**
     * 布局
     */
    Slider.prototype.layout = function () {
        if (this.slider) {
            var width = this.view.coordinateBBox.width;
            // 获取组件的 layout bbox
            var bboxObject = this.slider.component.getLayoutBBox();
            var bbox = new bbox_1.BBox(bboxObject.x, bboxObject.y, Math.min(bboxObject.width, width), bboxObject.height);
            var _a = direction_1.directionToPosition(this.view.viewBBox, bbox, constant_1.DIRECTION.BOTTOM), x1 = _a[0], y1 = _a[1];
            var _b = direction_1.directionToPosition(this.view.coordinateBBox, bbox, constant_1.DIRECTION.BOTTOM), x2 = _b[0], y2 = _b[1];
            // 默认放在 bottom
            this.slider.component.update({
                x: x2,
                y: y1,
                width: width,
            });
        }
    };
    /**
     * 更新
     */
    Slider.prototype.update = function () {
        // 逻辑和 render 保持一致
        this.render();
    };
    /**
     * 创建 slider 组件
     */
    Slider.prototype.createSlider = function () {
        var cfg = this.getSliderCfg();
        // 添加 slider 组件
        var component = new dependents_1.Slider(tslib_1.__assign({ container: this.container }, cfg));
        component.init();
        return {
            component: component,
            layer: constant_1.LAYER.FORE,
            direction: constant_1.DIRECTION.BOTTOM,
            type: constant_1.COMPONENT_TYPE.OTHER,
        };
    };
    /**
     * 更新配置
     */
    Slider.prototype.updateSlider = function () {
        var cfg = this.getSliderCfg();
        helper_1.omit(cfg, ['x', 'y', 'width', 'start', 'end', 'minText', 'maxText']);
        this.slider.component.update(cfg);
        return this.slider;
    };
    /**
     * 生成 slider 配置
     */
    Slider.prototype.getSliderCfg = function () {
        if (util_1.isObject(this.option)) {
            // 用户配置的数据，优先级更高
            var trendCfg = tslib_1.__assign({ data: this.getData() }, util_1.get(this.option, 'trendCfg', {}));
            // 初始的位置大小信息
            var x = 0;
            var y = 0;
            var width = this.view.coordinateBBox.width;
            // 因为有样式，所以深层覆盖
            var cfg = util_1.deepMix({}, { x: x, y: y, width: width }, this.option);
            // trendCfg 因为有数据数组，所以使用浅替换
            return tslib_1.__assign(tslib_1.__assign({}, cfg), { trendCfg: trendCfg });
        }
        return {};
    };
    /**
     * 从 view 中获取数据，缩略轴使用全量的数据
     */
    Slider.prototype.getData = function () {
        var data = this.view.getOptions().data;
        var yScale = this.view.getYScales()[0];
        var groupScales = this.view.getGroupScales();
        if (groupScales.length) {
            var _a = groupScales[0], field_1 = _a.field, ticks_1 = _a.ticks;
            return data.reduce(function (pre, cur) {
                if (cur[field_1] === ticks_1[0]) {
                    pre.push(cur[yScale.field]);
                }
                return pre;
            }, []);
        }
        return data.map(function (datum) { return datum[yScale.field] || 0; });
    };
    Slider.prototype.updateMinMaxText = function (min, max) {
        var data = this.view.getOptions().data;
        var xScale = this.view.getXScale();
        var dataSize = util_1.size(data);
        if (!xScale || !dataSize) {
            return;
        }
        var x = xScale.field;
        // x 轴刻度
        var xTicks = data.reduce(function (pre, datum) {
            if (!pre.includes(datum[x]))
                pre.push(datum[x]);
            return pre;
        }, []);
        var xTickCount = util_1.size(xTicks);
        var minIndex = Math.floor(min * (xTickCount - 1));
        var maxIndex = Math.floor(max * (xTickCount - 1));
        var minText = util_1.get(xTicks, [minIndex]);
        var maxText = util_1.get(xTicks, [maxIndex]);
        var formatter = this.getSliderCfg().formatter;
        if (formatter) {
            minText = formatter(minText, data[minIndex], minIndex);
            maxText = formatter(maxText, data[maxIndex], maxIndex);
        }
        // 更新文本
        this.slider.component.update({
            minText: minText,
            maxText: maxText,
            start: min,
            end: max,
        });
        // 增加 x 轴的过滤器
        this.view.filter(xScale.field, function (value, datum) {
            var idx = xTicks.indexOf(value);
            return idx > -1 ? helper_1.isBetween(idx, minIndex, maxIndex) : true;
        });
    };
    /**
     * 覆写父类方法
     */
    Slider.prototype.getComponents = function () {
        return this.slider ? [this.slider] : [];
    };
    return Slider;
}(base_1.Controller));
exports.default = Slider;

},{"../../constant":237,"../../dependents":239,"../../util/bbox":370,"../../util/direction":372,"../../util/helper":377,"./base":222,"@antv/util":803,"tslib":385}],228:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../dependents");
var coordinate_1 = require("../../util/coordinate");
var graphics_1 = require("../../util/graphics");
var tooltip_1 = require("../../util/tooltip");
var base_1 = require("./base");
// Filter duplicates, use `name`, `color`, `value` and `title` property values as condition
function uniq(items) {
    var uniqItems = [];
    var _loop_1 = function (index) {
        var item = items[index];
        var result = util_1.find(uniqItems, function (subItem) {
            return (subItem.color === item.color &&
                subItem.name === item.name &&
                subItem.value === item.value &&
                subItem.title === item.title);
        });
        if (!result) {
            uniqItems.push(item);
        }
    };
    for (var index = 0; index < items.length; index++) {
        _loop_1(index);
    }
    return uniqItems;
}
/** @ignore */
var Tooltip = /** @class */ (function (_super) {
    tslib_1.__extends(Tooltip, _super);
    function Tooltip() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.isLocked = false;
        return _this;
    }
    Object.defineProperty(Tooltip.prototype, "name", {
        get: function () {
            return 'tooltip';
        },
        enumerable: false,
        configurable: true
    });
    Tooltip.prototype.init = function () { };
    Tooltip.prototype.isVisible = function () {
        var option = this.view.getOptions().tooltip;
        return option !== false;
    };
    Tooltip.prototype.render = function () { };
    /**
     * Shows tooltip
     * @param point
     */
    Tooltip.prototype.showTooltip = function (point) {
        this.point = point;
        if (!this.isVisible()) {
            // 如果设置 tooltip(false) 则始终不显示
            return;
        }
        var view = this.view;
        var items = this.getTooltipItems(point);
        if (!items.length) {
            // 无内容则不展示，同时 tooltip 需要隐藏
            this.hideTooltip();
            return;
        }
        var title = this.getTitle(items);
        var dataPoint = {
            x: items[0].x,
            y: items[0].y,
        }; // 数据点位置
        view.emit('tooltip:show', tslib_1.__assign({ items: items,
            title: title }, point));
        var cfg = this.getTooltipCfg();
        var follow = cfg.follow, showMarkers = cfg.showMarkers, showCrosshairs = cfg.showCrosshairs, showContent = cfg.showContent, marker = cfg.marker;
        var lastItems = this.items;
        var lastTitle = this.title;
        if (!util_1.isEqual(lastTitle, title) || !util_1.isEqual(lastItems, items)) {
            // 内容发生变化了更新 tooltip
            view.emit('tooltip:change', tslib_1.__assign({ items: items,
                title: title }, point));
            if (showContent) {
                // 展示 tooltip 内容框才渲染 tooltip
                if (!this.tooltip) {
                    // 延迟生成
                    this.renderTooltip();
                }
                this.tooltip.update(util_1.mix({}, cfg, {
                    items: items,
                    title: title,
                }, follow ? point : {}));
                this.tooltip.show();
            }
            if (showMarkers) {
                // 展示 tooltipMarkers，tooltipMarkers 跟随数据
                this.renderTooltipMarkers(items, marker);
            }
        }
        else {
            // 内容未发生变化，则更新位置
            if (this.tooltip && follow) {
                this.tooltip.update(point);
                this.tooltip.show(); // tooltip 有可能被隐藏，需要保证显示状态
            }
            if (this.tooltipMarkersGroup) {
                this.tooltipMarkersGroup.show();
            }
        }
        this.items = items;
        this.title = title;
        if (showCrosshairs) {
            // 展示 tooltip 辅助线
            var isCrosshairsFollowCursor = util_1.get(cfg, ['crosshairs', 'follow'], false); // 辅助线是否要跟随鼠标
            this.renderCrosshairs(isCrosshairsFollowCursor ? point : dataPoint, cfg);
        }
    };
    Tooltip.prototype.hideTooltip = function () {
        var follow = this.getTooltipCfg().follow;
        if (!follow) {
            this.point = null;
            return;
        }
        // hide the tooltipMarkers
        var tooltipMarkersGroup = this.tooltipMarkersGroup;
        if (tooltipMarkersGroup) {
            tooltipMarkersGroup.hide();
        }
        // hide crosshairs
        var xCrosshair = this.xCrosshair;
        var yCrosshair = this.yCrosshair;
        if (xCrosshair) {
            xCrosshair.hide();
        }
        if (yCrosshair) {
            yCrosshair.hide();
        }
        var tooltip = this.tooltip;
        if (tooltip) {
            tooltip.hide();
        }
        this.view.emit('tooltip:hide', {});
        this.point = null;
    };
    /**
     * lockTooltip
     */
    Tooltip.prototype.lockTooltip = function () {
        this.isLocked = true;
        if (this.tooltip) {
            // tooltip contianer 可捕获事件
            this.tooltip.setCapture(true);
        }
    };
    /**
     * unlockTooltip
     */
    Tooltip.prototype.unlockTooltip = function () {
        this.isLocked = false;
        var cfg = this.getTooltipCfg();
        if (this.tooltip) {
            // 重置 capture 属性
            this.tooltip.setCapture(cfg.capture);
        }
    };
    /**
     * isTooltipLocked
     */
    Tooltip.prototype.isTooltipLocked = function () {
        return this.isLocked;
    };
    Tooltip.prototype.clear = function () {
        var _a = this, tooltip = _a.tooltip, xCrosshair = _a.xCrosshair, yCrosshair = _a.yCrosshair, tooltipMarkersGroup = _a.tooltipMarkersGroup;
        if (tooltip) {
            tooltip.hide();
            tooltip.clear();
        }
        if (xCrosshair) {
            xCrosshair.clear();
        }
        if (yCrosshair) {
            yCrosshair.clear();
        }
        if (tooltipMarkersGroup) {
            tooltipMarkersGroup.clear();
        }
    };
    Tooltip.prototype.destroy = function () {
        if (this.tooltip) {
            this.tooltip.destroy();
        }
        if (this.xCrosshair) {
            this.xCrosshair.destroy();
        }
        if (this.yCrosshair) {
            this.yCrosshair.destroy();
        }
        if (this.guideGroup) {
            this.guideGroup.remove(true);
        }
        this.items = null;
        this.title = null;
        this.tooltipMarkersGroup = null;
        this.tooltipCrosshairsGroup = null;
        this.xCrosshair = null;
        this.yCrosshair = null;
        this.tooltip = null;
        this.guideGroup = null;
        this.isLocked = false;
        this.point = null;
    };
    Tooltip.prototype.changeVisible = function (visible) {
        if (this.visible === visible) {
            return;
        }
        var _a = this, tooltip = _a.tooltip, tooltipMarkersGroup = _a.tooltipMarkersGroup, xCrosshair = _a.xCrosshair, yCrosshair = _a.yCrosshair;
        if (visible) {
            if (tooltip) {
                tooltip.show();
            }
            if (tooltipMarkersGroup) {
                tooltipMarkersGroup.show();
            }
            if (xCrosshair) {
                xCrosshair.show();
            }
            if (yCrosshair) {
                yCrosshair.show();
            }
        }
        else {
            if (tooltip) {
                tooltip.hide();
            }
            if (tooltipMarkersGroup) {
                tooltipMarkersGroup.hide();
            }
            if (xCrosshair) {
                xCrosshair.hide();
            }
            if (yCrosshair) {
                yCrosshair.hide();
            }
        }
        this.visible = visible;
    };
    Tooltip.prototype.getTooltipItems = function (point) {
        var items = this.findItemsFromView(this.view, point);
        if (items.length) {
            // 三层
            items = util_1.flatten(items);
            for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
                var itemArr = items_1[_i];
                for (var _a = 0, itemArr_1 = itemArr; _a < itemArr_1.length; _a++) {
                    var item = itemArr_1[_a];
                    var _b = item.mappingData, x = _b.x, y = _b.y;
                    item.x = util_1.isArray(x) ? x[x.length - 1] : x;
                    item.y = util_1.isArray(y) ? y[y.length - 1] : y;
                }
            }
            var shared = this.getTooltipCfg().shared;
            // shared: false 代表只显示当前拾取到的 shape 的数据，但是一个 view 会有多个 Geometry，所以有可能会拾取到多个 shape
            if (shared === false && items.length > 1) {
                var snapItem = items[0];
                var min = Math.abs(point.y - snapItem[0].y);
                for (var _c = 0, items_2 = items; _c < items_2.length; _c++) {
                    var aItem = items_2[_c];
                    var yDistance = Math.abs(point.y - aItem[0].y);
                    if (yDistance <= min) {
                        snapItem = aItem;
                        min = yDistance;
                    }
                }
                items = [snapItem];
            }
            return uniq(util_1.flatten(items));
        }
        return [];
    };
    Tooltip.prototype.layout = function () { };
    Tooltip.prototype.update = function () {
        if (this.point) {
            this.showTooltip(this.point);
        }
        if (this.tooltip) {
            // #2279 修复resize之后tooltip越界的问题
            // 确保tooltip已经创建的情况下
            var canvas = this.view.getCanvas();
            // 更新 region
            this.tooltip.set('region', {
                start: { x: 0, y: 0 },
                end: { x: canvas.get('width'), y: canvas.get('height') },
            });
        }
    };
    // 获取 tooltip 配置，因为用户可能会通过 view.tooltip() 重新配置 tooltip，所以就不做缓存，每次直接读取
    Tooltip.prototype.getTooltipCfg = function () {
        var view = this.view;
        var option = view.getOptions().tooltip;
        var theme = view.getTheme();
        var defaultCfg = util_1.get(theme, ['components', 'tooltip'], {});
        var enterable = util_1.isUndefined(util_1.get(option, 'enterable')) ? defaultCfg.enterable : util_1.get(option, 'enterable');
        return util_1.deepMix({}, defaultCfg, option, {
            capture: enterable || this.isLocked ? true : false,
        });
    };
    Tooltip.prototype.getTitle = function (items) {
        var title = items[0].title || items[0].name;
        this.title = title;
        return title;
    };
    Tooltip.prototype.renderTooltip = function () {
        var canvas = this.view.getCanvas();
        var region = {
            start: { x: 0, y: 0 },
            end: { x: canvas.get('width'), y: canvas.get('height') },
        };
        var cfg = this.getTooltipCfg();
        var tooltip = new dependents_1.HtmlTooltip(tslib_1.__assign(tslib_1.__assign({ parent: canvas.get('el').parentNode, region: region }, cfg), { visible: false, crosshairs: null }));
        tooltip.init();
        this.tooltip = tooltip;
    };
    Tooltip.prototype.renderTooltipMarkers = function (items, marker) {
        var tooltipMarkersGroup = this.getTooltipMarkersGroup();
        for (var _i = 0, items_3 = items; _i < items_3.length; _i++) {
            var item = items_3[_i];
            var x = item.x, y = item.y;
            var attrs = tslib_1.__assign(tslib_1.__assign({ fill: item.color, symbol: 'circle', shadowColor: item.color }, marker), { x: x,
                y: y });
            tooltipMarkersGroup.addShape('marker', {
                attrs: attrs,
            });
        }
    };
    Tooltip.prototype.renderCrosshairs = function (point, cfg) {
        var crosshairsType = util_1.get(cfg, ['crosshairs', 'type'], 'x'); // 默认展示 x 轴上的辅助线
        if (crosshairsType === 'x') {
            if (this.yCrosshair) {
                this.yCrosshair.hide();
            }
            this.renderXCrosshairs(point, cfg);
        }
        else if (crosshairsType === 'y') {
            if (this.xCrosshair) {
                this.xCrosshair.hide();
            }
            this.renderYCrosshairs(point, cfg);
        }
        else if (crosshairsType === 'xy') {
            this.renderXCrosshairs(point, cfg);
            this.renderYCrosshairs(point, cfg);
        }
    };
    // 渲染 x 轴上的 tooltip 辅助线
    Tooltip.prototype.renderXCrosshairs = function (point, tooltipCfg) {
        var coordinate = this.getViewWithGeometry(this.view).getCoordinate();
        if (!coordinate_1.isPointInCoordinate(coordinate, point)) {
            return;
        }
        var start;
        var end;
        if (coordinate.isRect) {
            if (coordinate.isTransposed) {
                start = {
                    x: coordinate.start.x,
                    y: point.y,
                };
                end = {
                    x: coordinate.end.x,
                    y: point.y,
                };
            }
            else {
                start = {
                    x: point.x,
                    y: coordinate.end.y,
                };
                end = {
                    x: point.x,
                    y: coordinate.start.y,
                };
            }
        }
        else {
            // 极坐标下 x 轴上的 crosshairs 表现为半径
            var angle = coordinate_1.getAngleByPoint(coordinate, point);
            var center = coordinate.getCenter();
            var radius = coordinate.getRadius();
            end = graphics_1.polarToCartesian(center.x, center.y, radius, angle);
            start = center;
        }
        var cfg = util_1.deepMix({
            start: start,
            end: end,
            container: this.getTooltipCrosshairsGroup(),
        }, util_1.get(tooltipCfg, 'crosshairs', {}), this.getCrosshairsText('x', point, tooltipCfg));
        delete cfg.type; // 与 Crosshairs 组件的 type 冲突故删除
        var xCrosshair = this.xCrosshair;
        if (xCrosshair) {
            xCrosshair.update(cfg);
        }
        else {
            xCrosshair = new dependents_1.Crosshair.Line(cfg);
            xCrosshair.init();
        }
        xCrosshair.render();
        xCrosshair.show();
        this.xCrosshair = xCrosshair;
    };
    // 渲染 y 轴上的辅助线
    Tooltip.prototype.renderYCrosshairs = function (point, tooltipCfg) {
        var coordinate = this.getViewWithGeometry(this.view).getCoordinate();
        if (!coordinate_1.isPointInCoordinate(coordinate, point)) {
            return;
        }
        var cfg;
        var type;
        if (coordinate.isRect) {
            var start = void 0;
            var end = void 0;
            if (coordinate.isTransposed) {
                start = {
                    x: point.x,
                    y: coordinate.end.y,
                };
                end = {
                    x: point.x,
                    y: coordinate.start.y,
                };
            }
            else {
                start = {
                    x: coordinate.start.x,
                    y: point.y,
                };
                end = {
                    x: coordinate.end.x,
                    y: point.y,
                };
            }
            cfg = {
                start: start,
                end: end,
            };
            type = 'Line';
        }
        else {
            // 极坐标下 y 轴上的 crosshairs 表现为圆弧
            cfg = {
                center: coordinate.getCenter(),
                // @ts-ignore
                radius: coordinate_1.getDistanceToCenter(coordinate, point),
                startAngle: coordinate.startAngle,
                endAngle: coordinate.endAngle,
            };
            type = 'Circle';
        }
        cfg = util_1.deepMix({
            container: this.getTooltipCrosshairsGroup(),
        }, cfg, util_1.get(tooltipCfg, 'crosshairs', {}), this.getCrosshairsText('y', point, tooltipCfg));
        delete cfg.type; // 与 Crosshairs 组件的 type 冲突故删除
        var yCrosshair = this.yCrosshair;
        if (yCrosshair) {
            // 如果坐标系发生直角坐标系与极坐标的切换操作
            if ((coordinate.isRect && yCrosshair.get('type') === 'circle') ||
                (!coordinate.isRect && yCrosshair.get('type') === 'line')) {
                yCrosshair = new dependents_1.Crosshair[type](cfg);
                yCrosshair.init();
            }
            else {
                yCrosshair.update(cfg);
            }
        }
        else {
            yCrosshair = new dependents_1.Crosshair[type](cfg);
            yCrosshair.init();
        }
        yCrosshair.render();
        yCrosshair.show();
        this.yCrosshair = yCrosshair;
    };
    Tooltip.prototype.getCrosshairsText = function (type, point, tooltipCfg) {
        var textCfg = util_1.get(tooltipCfg, ['crosshairs', 'text']);
        var follow = util_1.get(tooltipCfg, ['crosshairs', 'follow']);
        var items = this.items;
        if (textCfg) {
            var view = this.getViewWithGeometry(this.view);
            // 需要展示文本
            var firstItem = items[0];
            var xScale = view.getXScale();
            var yScale = view.getYScales()[0];
            var xValue = void 0;
            var yValue = void 0;
            if (follow) {
                // 如果需要跟随鼠标移动，就需要将当前鼠标坐标点转换为对应的数值
                var invertPoint = this.view.getCoordinate().invert(point);
                xValue = xScale.invert(invertPoint.x); // 转换为原始值
                yValue = yScale.invert(invertPoint.y); // 转换为原始值
            }
            else {
                xValue = firstItem.data[xScale.field];
                yValue = firstItem.data[yScale.field];
            }
            var content = type === 'x' ? xValue : yValue;
            if (util_1.isFunction(textCfg)) {
                textCfg = textCfg(type, content, items, point);
            }
            else {
                textCfg.content = content;
            }
            return {
                text: textCfg,
            };
        }
    };
    // 获取存储 tooltipMarkers 和 crosshairs 的容器
    Tooltip.prototype.getGuideGroup = function () {
        if (!this.guideGroup) {
            var foregroundGroup = this.view.foregroundGroup;
            this.guideGroup = foregroundGroup.addGroup({
                name: 'tooltipGuide',
                capture: false,
            });
        }
        return this.guideGroup;
    };
    // 获取 tooltipMarkers 存储的容器
    Tooltip.prototype.getTooltipMarkersGroup = function () {
        var tooltipMarkersGroup = this.tooltipMarkersGroup;
        if (tooltipMarkersGroup && !tooltipMarkersGroup.destroyed) {
            tooltipMarkersGroup.clear();
            tooltipMarkersGroup.show();
        }
        else {
            tooltipMarkersGroup = this.getGuideGroup().addGroup({
                name: 'tooltipMarkersGroup',
            });
            tooltipMarkersGroup.toFront();
            this.tooltipMarkersGroup = tooltipMarkersGroup;
        }
        return tooltipMarkersGroup;
    };
    // 获取 tooltip crosshairs 存储的容器
    Tooltip.prototype.getTooltipCrosshairsGroup = function () {
        var tooltipCrosshairsGroup = this.tooltipCrosshairsGroup;
        if (!tooltipCrosshairsGroup) {
            tooltipCrosshairsGroup = this.getGuideGroup().addGroup({
                name: 'tooltipCrosshairsGroup',
                capture: false,
            });
            tooltipCrosshairsGroup.toBack();
            this.tooltipCrosshairsGroup = tooltipCrosshairsGroup;
        }
        return tooltipCrosshairsGroup;
    };
    Tooltip.prototype.getTooltipItemsByHitShape = function (geometry, point, title) {
        var result = [];
        var container = geometry.container;
        var shape = container.getShape(point.x, point.y);
        if (shape && shape.get('visible') && shape.get('origin')) {
            var mappingData = shape.get('origin').mappingData;
            var items = tooltip_1.getTooltipItems(mappingData, geometry, title);
            if (items.length) {
                result.push(items);
            }
        }
        return result;
    };
    Tooltip.prototype.getTooltipItemsByFindData = function (geometry, point, title) {
        var result = [];
        var dataArray = geometry.dataArray;
        geometry.sort(dataArray); // 先进行排序，便于 tooltip 查找
        for (var _i = 0, dataArray_1 = dataArray; _i < dataArray_1.length; _i++) {
            var data = dataArray_1[_i];
            var record = tooltip_1.findDataByPoint(point, data, geometry);
            if (record) {
                var elementId = geometry.getElementId(record);
                var element = geometry.elementsMap[elementId];
                if (geometry.type === 'heatmap' || element.visible) {
                    // Heatmap 没有 Element
                    // 如果图形元素隐藏了，怎不再 tooltip 上展示相关数据
                    var items = tooltip_1.getTooltipItems(record, geometry, title);
                    if (items.length) {
                        result.push(items);
                    }
                }
            }
        }
        return result;
    };
    Tooltip.prototype.findItemsFromView = function (view, point) {
        if (view.getOptions().tooltip === false) {
            // 如果 view 关闭了 tooltip
            return [];
        }
        var result = [];
        // 先从 view 本身查找
        var geometries = view.geometries;
        var _a = this.getTooltipCfg(), shared = _a.shared, title = _a.title;
        for (var _i = 0, geometries_1 = geometries; _i < geometries_1.length; _i++) {
            var geometry = geometries_1[_i];
            if (geometry.visible && geometry.tooltipOption !== false) {
                // geometry 可见同时未关闭 tooltip
                var geometryType = geometry.type;
                var tooltipItems = void 0;
                if (['point', 'edge', 'polygon'].includes(geometryType)) {
                    // 始终通过图形拾取
                    tooltipItems = this.getTooltipItemsByHitShape(geometry, point, title);
                }
                else if (['area', 'line', 'path', 'heatmap'].includes(geometryType)) {
                    // 如果是 'area', 'line', 'path'，始终通过数据查找方法查找 tooltip
                    tooltipItems = this.getTooltipItemsByFindData(geometry, point, title);
                }
                else {
                    if (shared !== false) {
                        tooltipItems = this.getTooltipItemsByFindData(geometry, point, title);
                    }
                    else {
                        tooltipItems = this.getTooltipItemsByHitShape(geometry, point, title);
                    }
                }
                if (tooltipItems.length) {
                    // geometry 有可能会有多个 item，因为用户可以设置 geometry.tooltip('x*y*z')
                    result.push(tooltipItems);
                }
            }
        }
        // 递归查找，并合并结果
        for (var _b = 0, _c = view.views; _b < _c.length; _b++) {
            var childView = _c[_b];
            result = result.concat(this.findItemsFromView(childView, point));
        }
        return result;
    };
    // FIXME: hack 方法
    // 因为 tooltip 的交互是挂载在 Chart 上，所以当chart 上没有绘制 Geometry 的时候，就查找不到数据，并且绘图区域同子 View 的区域不同
    Tooltip.prototype.getViewWithGeometry = function (view) {
        var _this = this;
        if (view.geometries.length) {
            return view;
        }
        return util_1.find(view.views, function (childView) { return _this.getViewWithGeometry(childView); });
    };
    return Tooltip;
}(base_1.Controller));
exports.default = Tooltip;

},{"../../dependents":239,"../../util/coordinate":371,"../../util/graphics":375,"../../util/tooltip":383,"./base":222,"@antv/util":803,"tslib":385}],229:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @todo Whether it can(or necessary to) keep consistent with the structure of G.Event or directly use the structure of G.Event
 * G2 事件的事件包装类，基于 G.Event
 */
var Event = /** @class */ (function () {
    function Event(view, gEvent, data) {
        this.view = view;
        this.gEvent = gEvent;
        this.data = data;
        this.type = gEvent.type;
    }
    Object.defineProperty(Event.prototype, "target", {
        // below props are proxy props of G.event convenient
        /** the real trigger shape of the event */
        get: function () {
            // @todo G 中事件定义为 object 不正确，这里先 ignore
            // @ts-ignore
            return this.gEvent.target;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Event.prototype, "event", {
        /** 获取对应的 dom 原生时间 */
        get: function () {
            return this.gEvent.originalEvent;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Event.prototype, "x", {
        /** x 画布坐标 */
        get: function () {
            return this.gEvent.x;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Event.prototype, "y", {
        /** y 画布坐标 */
        get: function () {
            return this.gEvent.y;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Event.prototype, "clientX", {
        /** x 窗口坐标 */
        get: function () {
            return this.gEvent.clientX;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Event.prototype, "clientY", {
        /** y 窗口坐标 */
        get: function () {
            return this.gEvent.clientY;
        },
        enumerable: false,
        configurable: true
    });
    // end for proxy events
    /**
     * event string
     * @returns string
     */
    Event.prototype.toString = function () {
        return "[Event (type=" + this.type + ")]";
    };
    /**
     * clone a new event with same attributes
     * @returns [[Event]]
     */
    Event.prototype.clone = function () {
        return new Event(this.view, this.gEvent, this.data);
    };
    return Event;
}());
exports.default = Event;

},{}],230:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chart_1 = require("./chart");
Object.defineProperty(exports, "Chart", { enumerable: true, get: function () { return chart_1.default; } });
var view_1 = require("./view");
Object.defineProperty(exports, "View", { enumerable: true, get: function () { return view_1.default; } });
Object.defineProperty(exports, "registerGeometry", { enumerable: true, get: function () { return view_1.registerGeometry; } });
var event_1 = require("./event");
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return event_1.default; } });
var controller_1 = require("./controller");
Object.defineProperty(exports, "registerComponentController", { enumerable: true, get: function () { return controller_1.registerComponentController; } });

},{"./chart":219,"./controller":225,"./event":229,"./view":235}],231:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculatePadding = void 0;
var util_1 = require("@antv/util");
var constant_1 = require("../../constant");
var bbox_1 = require("../../util/bbox");
var padding_1 = require("../../util/padding");
var padding_cal_1 = require("./padding-cal");
/**
 * @ignore
 * 根据 view 中的组件，计算实际的 padding 数值
 * @param view
 */
function calculatePadding(view) {
    var padding = view.padding;
    // 如果不是 auto padding，那么直接解析之后返回
    if (!padding_1.isAutoPadding(padding)) {
        return padding_1.parsePadding(padding);
    }
    // 是 auto padding，根据组件的情况，来计算 padding
    var viewBBox = view.viewBBox, autoPadding = view.autoPadding;
    var paddingCal = new padding_cal_1.PaddingCal();
    util_1.each(view.getComponents(), function (co) {
        var component = co.component, type = co.type;
        // grid, tooltip 不参入 padding 布局
        if (type === constant_1.COMPONENT_TYPE.GRID || type === constant_1.COMPONENT_TYPE.TOOLTIP) {
            return;
        }
        var bboxObject = component.getLayoutBBox();
        var componentBBox = new bbox_1.BBox(bboxObject.x, bboxObject.y, bboxObject.width, bboxObject.height);
        if (type === constant_1.COMPONENT_TYPE.AXIS) {
            var exceed = componentBBox.exceed(viewBBox);
            paddingCal.shrink(exceed);
        }
        else {
            // 按照方向计算 padding
            var direction = co.direction;
            // const direction =
            //   type === COMPONENT_TYPE.AXIS ? getTranslateDirection(co.direction, view.getCoordinate()) : co.direction;
            paddingCal.inc(componentBBox, direction);
        }
    });
    var calculatedPadding = paddingCal.getPadding();
    if (autoPadding) {
        var appendPadding = padding_1.parsePadding(view.appendPadding);
        // 取上一次以及当前计算结果的最大区间
        return [
            Math.max(autoPadding[0] - appendPadding[0], calculatedPadding[0]),
            Math.max(autoPadding[1] - appendPadding[1], calculatedPadding[1]),
            Math.max(autoPadding[2] - appendPadding[2], calculatedPadding[2]),
            Math.max(autoPadding[3] - appendPadding[3], calculatedPadding[3]),
        ];
    }
    return calculatedPadding;
}
exports.calculatePadding = calculatePadding;

},{"../../constant":237,"../../util/bbox":370,"../../util/padding":380,"./padding-cal":233,"@antv/util":803}],232:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var padding_1 = require("../../util/padding");
var auto_1 = require("./auto");
/**
 * @ignore
 * G2 默认提供的 layout 函数
 * 内置布局函数处理的逻辑：
 *
 * 1. 如果 padding = 'auto'，那么自动根据组件的 direction 来计算 padding 数组
 * 2. 根据 padding 和 direction 去分配对应方向的 padding 数值
 * 3. 移动组件位置
 *
 * 对于组件响应式布局，可以尝试使用约束布局的方式去求解位置信息。
 * @param view
 */
function defaultLayout(view) {
    var axis = view.getController('axis');
    var legend = view.getController('legend');
    var annotation = view.getController('annotation');
    var slider = view.getController('slider');
    // 1. 自动加 auto padding -> absolute padding
    var padding = auto_1.calculatePadding(view);
    // 2. 计算出新的 coordinateBBox
    view.coordinateBBox = view.viewBBox.shrink(padding).shrink(padding_1.parsePadding(view.appendPadding));
    view.adjustCoordinate();
    // 3. 根据最新的 coordinate 重新布局组件
    [axis, slider, legend, annotation].forEach(function (controller) {
        if (controller) {
            controller.layout();
        }
    });
}
exports.default = defaultLayout;

},{"../../util/padding":380,"./auto":231}],233:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaddingCal = void 0;
var constant_1 = require("../../constant");
/** @ignore */
var PaddingCal = /** @class */ (function () {
    /**
     * 初始的 padding 数据
     * @param top
     * @param right
     * @param bottom
     * @param left
     */
    function PaddingCal(top, right, bottom, left) {
        if (top === void 0) { top = 0; }
        if (right === void 0) { right = 0; }
        if (bottom === void 0) { bottom = 0; }
        if (left === void 0) { left = 0; }
        this.top = top;
        this.right = right;
        this.bottom = bottom;
        this.left = left;
    }
    /**
     * 四周增加 padding
     * @param padding
     */
    PaddingCal.prototype.shrink = function (padding) {
        var top = padding[0], right = padding[1], bottom = padding[2], left = padding[3];
        this.top += top;
        this.right += right;
        this.bottom += bottom;
        this.left += left;
        return this;
    };
    /**
     * 在某一个方向增加 padding
     * @param bbox
     * @param direction
     */
    PaddingCal.prototype.inc = function (bbox, direction) {
        var width = bbox.width, height = bbox.height;
        switch (direction) {
            case constant_1.DIRECTION.TOP:
            case constant_1.DIRECTION.TOP_LEFT:
            case constant_1.DIRECTION.TOP_RIGHT:
                this.top += height;
                break;
            case constant_1.DIRECTION.RIGHT:
            case constant_1.DIRECTION.RIGHT_TOP:
            case constant_1.DIRECTION.RIGHT_BOTTOM:
                this.right += width;
                break;
            case constant_1.DIRECTION.BOTTOM:
            case constant_1.DIRECTION.BOTTOM_LEFT:
            case constant_1.DIRECTION.BOTTOM_RIGHT:
                this.bottom += height;
                break;
            case constant_1.DIRECTION.LEFT:
            case constant_1.DIRECTION.LEFT_TOP:
            case constant_1.DIRECTION.LEFT_BOTTOM:
                this.left += width;
                break;
            default:
                break;
        }
        return this;
    };
    /**
     * 获得最终的 padding
     */
    PaddingCal.prototype.getPadding = function () {
        return [this.top, this.right, this.bottom, this.left];
    };
    return PaddingCal;
}());
exports.PaddingCal = PaddingCal;

},{"../../constant":237}],234:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScalePool = void 0;
/**
 * view 中缓存 scale 的类
 */
var util_1 = require("@antv/util");
var scale_1 = require("../../util/scale");
/** @ignore */
var ScalePool = /** @class */ (function () {
    function ScalePool() {
        /** 所有的 scales */
        this.scales = new Map();
        /** 需要同步的 scale 分组， key: scaleKeyArray */
        this.syncScales = new Map();
    }
    /**
     * 创建 scale
     * @param field
     * @param data
     * @param scaleDef
     * @param key
     */
    ScalePool.prototype.createScale = function (field, data, scaleDef, key) {
        var finalScaleDef = scaleDef;
        var cacheScaleMeta = this.getScaleMeta(key);
        if (data.length === 0 && cacheScaleMeta) {
            // 在更新过程中数据变为空，同时 key 对应的 scale 已存在则保持 scale 同类型
            var cacheScale = cacheScaleMeta.scale;
            var cacheScaleDef = {
                type: cacheScale.type,
            };
            if (cacheScale.isCategory) {
                // 如果是分类类型，保持 values
                cacheScaleDef.values = cacheScale.values;
            }
            finalScaleDef = util_1.deepMix(cacheScaleDef, cacheScaleMeta.scaleDef, scaleDef);
        }
        var scale = scale_1.createScaleByField(field, data, finalScaleDef);
        // 缓存起来
        this.cacheScale(scale, scaleDef, key);
        return scale;
    };
    /**
     * 同步 scale
     */
    ScalePool.prototype.sync = function () {
        var _this = this;
        // 对于 syncScales 中每一个 syncKey 下面的 scale 数组进行同步处理
        this.syncScales.forEach(function (scaleKeys, syncKey) {
            // min, max, values
            var min = Number.MAX_SAFE_INTEGER;
            var max = Number.MIN_SAFE_INTEGER;
            var values = [];
            // 1. 遍历求得最大最小值，values 等
            util_1.each(scaleKeys, function (key) {
                var scale = _this.getScale(key);
                max = util_1.isNumber(scale.max) ? Math.max(max, scale.max) : max;
                min = util_1.isNumber(scale.min) ? Math.min(min, scale.min) : min;
                // 去重
                util_1.each(scale.values, function (v) {
                    if (!values.includes(v)) {
                        values.push(v);
                    }
                });
            });
            // 2. 同步
            util_1.each(scaleKeys, function (key) {
                var scale = _this.getScale(key);
                if (scale.isContinuous) {
                    scale.change({
                        min: min,
                        max: max,
                        values: values,
                    });
                }
                else if (scale.isCategory) {
                    scale.change({
                        values: values,
                    });
                }
            });
        });
    };
    /**
     * 缓存一个 scale
     * @param scale
     * @param scaleDef
     * @param key
     */
    ScalePool.prototype.cacheScale = function (scale, scaleDef, key) {
        // 1. 缓存到 scales
        var sm = this.getScaleMeta(key);
        // 存在则更新，同时检测类型是否一致
        if (sm && sm.scale.type === scale.type) {
            scale_1.syncScale(sm.scale, scale);
            sm.scaleDef = scaleDef;
            // 更新 scaleDef
        }
        else {
            sm = {
                key: key,
                scale: scale,
                scaleDef: scaleDef,
            };
            this.scales.set(key, sm);
        }
        // 2. 缓存到 syncScales，构造 Record<sync, string[]> 数据结构
        var syncKey = this.getSyncKey(sm);
        sm.syncKey = syncKey; // 设置 sync 同步的 key
        // 因为存在更新 scale 机制，所以在缓存之前，先从原 syncScales 中去除 sync 的缓存引用
        this.removeFromSyncScales(key);
        // 存在 sync 标记才进行 sync
        if (syncKey) {
            // 不存在这个 syncKey，则创建一个空数组
            var scaleKeys = this.syncScales.get(syncKey);
            if (!scaleKeys) {
                scaleKeys = [];
                this.syncScales.set(syncKey, scaleKeys);
            }
            scaleKeys.push(key);
        }
    };
    /**
     * 通过 key 获取 scale
     * @param key
     */
    ScalePool.prototype.getScale = function (key) {
        var scaleMeta = this.getScaleMeta(key);
        if (!scaleMeta) {
            var field = util_1.last(key.split('-'));
            var scaleKeys = this.syncScales.get(field);
            if (scaleKeys && scaleKeys.length) {
                scaleMeta = this.getScaleMeta(scaleKeys[0]);
            }
        }
        return scaleMeta && scaleMeta.scale;
    };
    /**
     * 在 view 销毁的时候，删除 scale 实例，防止内存泄露
     * @param key
     */
    ScalePool.prototype.deleteScale = function (key) {
        var scaleMeta = this.getScaleMeta(key);
        if (scaleMeta) {
            var syncKey = scaleMeta.syncKey;
            var scaleKeys = this.syncScales.get(syncKey);
            // 移除同步的关系
            if (scaleKeys && scaleKeys.length) {
                var idx = scaleKeys.indexOf(key);
                if (idx !== -1) {
                    scaleKeys.splice(idx, 1);
                }
            }
        }
        // 删除 scale 实例
        this.scales.delete(key);
    };
    /**
     * 清空
     */
    ScalePool.prototype.clear = function () {
        this.scales.clear();
        this.syncScales.clear();
    };
    /**
     * 删除 sync scale 引用
     * @param key
     */
    ScalePool.prototype.removeFromSyncScales = function (key) {
        var _this = this;
        this.syncScales.forEach(function (scaleKeys, syncKey) {
            var idx = scaleKeys.indexOf(key);
            if (idx !== -1) {
                scaleKeys.splice(idx, 1);
                // 删除空数组值
                if (scaleKeys.length === 0) {
                    _this.syncScales.delete(syncKey);
                }
                return false; // 跳出循环
            }
        });
    };
    /**
     * get sync key
     * @param sm
     */
    ScalePool.prototype.getSyncKey = function (sm) {
        var scale = sm.scale, scaleDef = sm.scaleDef;
        var field = scale.field;
        var sync = util_1.get(scaleDef, ['sync']);
        // 如果 sync = true，则直接使用字段名作为 syncKey
        return sync === true ? field : sync === false ? undefined : sync;
    };
    /**
     * 通过 key 获取 scale
     * @param key
     */
    ScalePool.prototype.getScaleMeta = function (key) {
        return this.scales.get(key);
    };
    return ScalePool;
}());
exports.ScalePool = ScalePool;

},{"../../util/scale":381,"@antv/util":803}],235:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerGeometry = exports.View = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = tslib_1.__importDefault(require("../base"));
var facet_1 = require("../facet");
var interaction_1 = require("../interaction");
var theme_1 = require("../theme");
var bbox_1 = require("../util/bbox");
var coordinate_1 = require("../util/coordinate");
var helper_1 = require("../util/helper");
var tooltip_1 = require("../util/tooltip");
var controller_1 = require("./controller");
var coordinate_2 = tslib_1.__importDefault(require("./controller/coordinate"));
var event_1 = tslib_1.__importDefault(require("./event"));
var layout_1 = tslib_1.__importDefault(require("./layout"));
var scale_pool_1 = require("./util/scale-pool");
var padding_1 = require("../util/padding");
/**
 * G2 视图 View 类
 */
var View = /** @class */ (function (_super) {
    tslib_1.__extends(View, _super);
    function View(props) {
        var _this = _super.call(this, { visible: props.visible }) || this;
        /** view id，全局唯一。 */
        _this.id = util_1.uniqueId('view');
        /** 所有的子 view。 */
        _this.views = [];
        /** 所有的 geometry 实例。 */
        _this.geometries = [];
        /** 所有的组件 controllers。 */
        _this.controllers = [];
        /** 所有的 Interaction 实例。 */
        _this.interactions = {};
        /** 是否对超出坐标系范围的 Geometry 进行剪切 */
        _this.limitInPlot = false;
        // 配置信息存储
        _this.options = {
            data: [],
            animate: true,
        }; // 初始化为空
        /** 配置开启的组件插件，默认为全局配置的组件。 */
        _this.usedControllers = controller_1.getComponentControllerNames();
        /** 所有的 scales */
        _this.scalePool = new scale_pool_1.ScalePool();
        /** 布局函数 */
        _this.layoutFunc = layout_1.default;
        /** 当前鼠标是否在 plot 内（CoordinateBBox） */
        _this.isPreMouseInPlot = false;
        /** 默认标识位，用于判定数据是否更新 */
        _this.isDataChanged = false;
        /** 用于判断坐标系范围是否发生变化的标志位 */
        _this.isCoordinateChanged = false;
        /** 从当前这个 view 创建的 scale key */
        _this.createdScaleKeys = new Map();
        _this.onCanvasEvent = function (evt) {
            var name = evt.name;
            if (!name.includes(':')) {
                // 非委托事件
                var e = _this.createViewEvent(evt);
                // 处理 plot 事件
                _this.doPlotEvent(e);
                _this.emit(name, e);
            }
        };
        /**
         * 触发事件之后
         * @param evt
         */
        _this.onDelegateEvents = function (evt) {
            // 阻止继续冒泡，防止重复事件触发
            // evt.preventDefault();
            var name = evt.name;
            if (!name.includes(':')) {
                return;
            }
            // 事件在 view 嵌套中冒泡（暂不提供阻止冒泡的机制）
            var e = _this.createViewEvent(evt);
            // 包含有基本事件、组合事件
            _this.emit(name, e);
            // const currentTarget = evt.currentTarget as IShape;
            // const inheritNames = currentTarget.get('inheritNames');
            // if (evt.delegateObject || inheritNames) {
            //   const events = this.getEvents();
            //   each(inheritNames, (subName) => {
            //     const eventName = `${subName}:${type}`;
            //     if (events[eventName]) {
            //       this.emit(eventName, e);
            //     }
            //   });
            // }
        };
        var parent = props.parent, canvas = props.canvas, backgroundGroup = props.backgroundGroup, middleGroup = props.middleGroup, foregroundGroup = props.foregroundGroup, _a = props.region, region = _a === void 0 ? { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } } : _a, padding = props.padding, appendPadding = props.appendPadding, theme = props.theme, options = props.options, limitInPlot = props.limitInPlot;
        _this.parent = parent;
        _this.canvas = canvas;
        _this.backgroundGroup = backgroundGroup;
        _this.middleGroup = middleGroup;
        _this.foregroundGroup = foregroundGroup;
        _this.region = region;
        _this.padding = padding;
        _this.appendPadding = appendPadding;
        // 接受父 view 传入的参数
        _this.options = tslib_1.__assign(tslib_1.__assign({}, _this.options), options);
        _this.limitInPlot = limitInPlot;
        // 初始化 theme
        _this.themeObject = util_1.isObject(theme) ? util_1.deepMix({}, theme_1.getTheme('default'), theme) : theme_1.getTheme(theme);
        _this.init();
        return _this;
    }
    /**
     * 设置 layout 布局函数
     * @param layout 布局函数
     * @returns void
     */
    View.prototype.setLayout = function (layout) {
        this.layoutFunc = layout;
    };
    /**
     * 生命周期：初始化
     * @returns voids
     */
    View.prototype.init = function () {
        // 计算画布的 viewBBox
        this.calculateViewBBox();
        // 事件委托机制
        this.initEvents();
        // 初始化组件 controller
        this.initComponentController();
        // 创建 coordinate controller
        this.coordinateController = new coordinate_2.default(this.options.coordinate);
        this.initOptions();
        // 递归初始化子 view
        var views = this.views;
        for (var i = 0; i < views.length; i++) {
            views[i].init();
        }
    };
    /**
     * 生命周期：渲染流程，渲染过程需要处理数据更新的情况。
     * render 函数仅仅会处理 view 和子 view。
     * @param isUpdate 是否触发更新流程。
     */
    View.prototype.render = function (isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_RENDER);
        // 递归渲染
        this.paint(isUpdate);
        this.emit(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER);
        if (this.visible === false) {
            // 用户在初始化的时候声明 visible: false
            this.changeVisible(false);
        }
    };
    /**
     * 生命周期：清空图表上所有的绘制内容，但是不销毁图表，chart 仍可使用。
     * @returns void
     */
    View.prototype.clear = function () {
        var _this = this;
        this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_CLEAR);
        // 1. 清空缓存和计算数据
        this.filteredData = [];
        this.coordinateInstance = undefined;
        this.isDataChanged = false; // 复位
        this.isCoordinateChanged = false; // 复位
        // 2. 清空 geometries
        var geometries = this.geometries;
        for (var i = 0; i < geometries.length; i++) {
            geometries[i].clear();
        }
        this.geometries = [];
        // 3. 清空 controllers
        var controllers = this.controllers;
        for (var i = 0; i < controllers.length; i++) {
            controllers[i].clear();
        }
        // 4. 删除 scale 缓存
        this.createdScaleKeys.forEach(function (v, k) {
            _this.getRootView().scalePool.deleteScale(k);
        });
        this.createdScaleKeys.clear();
        // 递归处理子 view
        var views = this.views;
        for (var i = 0; i < views.length; i++) {
            views[i].clear();
        }
        this.emit(constant_1.VIEW_LIFE_CIRCLE.AFTER_CLEAR);
    };
    /**
     * 生命周期：销毁，完全无法使用。
     * @returns void
     */
    View.prototype.destroy = function () {
        // 销毁前事件，销毁之后已经没有意义了，所以不抛出事件
        this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_DESTROY);
        var interactions = this.interactions;
        // 销毁 interactions
        util_1.each(interactions, function (interaction) {
            if (interaction) {
                // 有可能已经销毁，设置了 undefined
                interaction.destroy();
            }
        });
        this.clear();
        // 销毁 controller 中的组件
        var controllers = this.controllers;
        for (var i = 0, len = controllers.length; i < len; i++) {
            var controller = controllers[i];
            controller.destroy();
        }
        this.backgroundGroup.remove(true);
        this.middleGroup.remove(true);
        this.foregroundGroup.remove(true);
        _super.prototype.destroy.call(this);
    };
    /* end 生命周期函数 */
    /**
     * 显示或者隐藏整个 view。
     * @param visible 是否可见
     * @returns View
     */
    View.prototype.changeVisible = function (visible) {
        _super.prototype.changeVisible.call(this, visible);
        var geometries = this.geometries;
        for (var i = 0, len = geometries.length; i < len; i++) {
            var geometry = geometries[i];
            geometry.changeVisible(visible);
        }
        var controllers = this.controllers;
        for (var i = 0, len = controllers.length; i < len; i++) {
            var controller = controllers[i];
            controller.changeVisible(visible);
        }
        this.foregroundGroup.set('visible', visible);
        this.middleGroup.set('visible', visible);
        this.backgroundGroup.set('visible', visible);
        // group.set('visible', visible) 不会触发自动刷新
        this.getCanvas().draw();
        return this;
    };
    /**
     * 装载数据源。
     *
     * ```ts
     * view.data([{ city: '杭州', sale: 100 }, { city: '上海', sale: 110 } ]);
     * ```
     *
     * @param data 数据源，json 数组。
     * @returns View
     */
    View.prototype.data = function (data) {
        util_1.set(this.options, 'data', data);
        this.isDataChanged = true;
        return this;
    };
    /**
     * @deprecated
     * This method will be removed at G2 V4.1. Replaced by {@link #data(data)}
     */
    View.prototype.source = function (data) {
        console.warn('This method will be removed at G2 V4.1. Please use chart.data() instead.');
        return this.data(data);
    };
    /**
     * 设置数据筛选规则。
     *
     * ```ts
     * view.filter('city', (value: any, datum: Datum) => value !== '杭州');
     *
     * // 删除 'city' 字段对应的筛选规则。
     * view.filter('city', null);
     * ```
     *
     * @param field 数据字段
     * @param condition 筛选规则
     * @returns View
     */
    View.prototype.filter = function (field, condition) {
        if (util_1.isFunction(condition)) {
            util_1.set(this.options, ['filters', field], condition);
            return this;
        }
        // condition 为空，则表示删除过滤条件
        if (!condition && util_1.get(this.options, ['filters', field])) {
            delete this.options.filters[field];
        }
        return this;
    };
    View.prototype.axis = function (field, axisOption) {
        if (util_1.isBoolean(field)) {
            util_1.set(this.options, ['axes'], field);
        }
        else {
            util_1.set(this.options, ['axes', field], axisOption);
        }
        return this;
    };
    View.prototype.legend = function (field, legendOption) {
        if (util_1.isBoolean(field)) {
            util_1.set(this.options, ['legends'], field);
        }
        else if (util_1.isString(field)) {
            util_1.set(this.options, ['legends', field], legendOption);
        }
        else {
            // 设置全局的 legend 配置
            util_1.set(this.options, ['legends'], field);
        }
        return this;
    };
    View.prototype.scale = function (field, scaleOption) {
        var _this = this;
        if (util_1.isString(field)) {
            util_1.set(this.options, ['scales', field], scaleOption);
        }
        else if (util_1.isObject(field)) {
            util_1.each(field, function (v, k) {
                util_1.set(_this.options, ['scales', k], v);
            });
        }
        return this;
    };
    /**
     * tooltip 提示信息配置。
     *
     * ```ts
     * view.tooltip(false); // 关闭 tooltip
     *
     * view.tooltip({
     *   shared: true
     * });
     * ```
     *
     * @param cfg Tooltip 配置，更详细的配置项参考：https://github.com/antvis/component#tooltip
     * @returns View
     */
    View.prototype.tooltip = function (cfg) {
        util_1.set(this.options, 'tooltip', cfg);
        return this;
    };
    /**
     * 辅助标记配置。
     *
     * ```ts
     * view.annotation().line({
     *   start: ['min', 85],
     *   end: ['max', 85],
     *   style: {
     *     stroke: '#595959',
     *     lineWidth: 1,
     *     lineDash: [3, 3],
     *   },
     * });
     * ```
     * 更详细的配置项：https://github.com/antvis/component#annotation
     * @returns [[Annotation]]
     */
    View.prototype.annotation = function () {
        return this.getController('annotation');
    };
    /**
     * @deprecated
     * This method will be removed at G2 V4.1. Replaced by {@link #guide()}
     */
    View.prototype.guide = function () {
        console.warn('This method will be removed at G2 V4.1. Please use chart.annotation() instead.');
        return this.annotation();
    };
    View.prototype.coordinate = function (type, coordinateCfg) {
        // 提供语法糖，使用更简单
        if (util_1.isString(type)) {
            util_1.set(this.options, 'coordinate', { type: type, cfg: coordinateCfg });
        }
        else {
            util_1.set(this.options, 'coordinate', type);
        }
        // 更新 coordinate 配置
        this.coordinateController.update(this.options.coordinate);
        return this.coordinateController;
    };
    /**
     * @deprecated
     * This method will be removed at G2 V4.1. Replaced by {@link #coordinate()}
     */
    View.prototype.coord = function (type, coordinateCfg) {
        console.warn('This method will be removed at G2 V4.1. Please use chart.coordinate() instead.');
        // @ts-ignore
        return this.coordinate(type, coordinateCfg);
    };
    /**
     * view 分面绘制。
     *
     * ```ts
     * view.facet('rect', {
     *   rowField: 'province',
     *   columnField: 'category',
     *   eachView: (innerView: View, facet?: FacetData) => {
     *     innerView.line().position('city*sale');
     *   },
     * });
     * ```
     *
     * @param type 分面类型
     * @param cfg 分面配置， [[FacetCfgMap]]
     * @returns View
     */
    View.prototype.facet = function (type, cfg) {
        // 先销毁掉之前的分面
        if (this.facetInstance) {
            this.facetInstance.destroy();
        }
        // 创建新的分面
        var Ctor = facet_1.getFacet(type);
        if (!Ctor) {
            throw new Error("facet '" + type + "' is not exist!");
        }
        this.facetInstance = new Ctor(this, tslib_1.__assign(tslib_1.__assign({}, cfg), { type: type }));
        return this;
    };
    /*
     * 开启或者关闭动画。
     *
     * ```ts
     * view.animate(false);
     * ```
     *
     * @param status 动画状态，true 表示开始，false 表示关闭
     * @returns View
     */
    View.prototype.animate = function (status) {
        util_1.set(this.options, 'animate', status);
        return this;
    };
    /**
     * 更新配置项，用于配置项式声明。
     * @param options 配置项
     */
    View.prototype.updateOptions = function (options) {
        this.clear(); // 清空
        util_1.mix(this.options, options);
        this.initOptions();
        return this;
    };
    /**
     * 往 `view.options` 属性中存储配置项。
     * @param name 属性名称
     * @param opt 属性值
     * @returns view
     */
    View.prototype.option = function (name, opt) {
        // 对于内置的 option，避免覆盖。
        // name 在原型上，说明可能是内置 API，存在 option 被覆盖的风险，不处理
        if (View.prototype[name]) {
            throw new Error("Can't use built in variable name \"" + name + "\", please change another one.");
        }
        // 存入到 option 中
        util_1.set(this.options, name, opt);
        return this;
    };
    /**
     * 设置主题。
     *
     * ```ts
     * view.theme('dark'); // 'dark' 需要事先通过 `registerTheme()` 接口注册完成
     *
     * view.theme({ defaultColor: 'red' });
     * ```
     *
     * @param theme 主题名或者主题配置
     * @returns View
     */
    View.prototype.theme = function (theme) {
        this.themeObject = util_1.isObject(theme) ? util_1.deepMix({}, this.themeObject, theme) : theme_1.getTheme(theme);
        return this;
    };
    /* end 一系列传入配置的 API */
    /**
     * Call the interaction based on the interaction name
     *
     * ```ts
     * view.interaction('my-interaction', { extra: 'hello world' });
     * ```
     * 详细文档可以参考：https://g2.antv.vision/zh/docs/manual/tutorial/interaction
     * @param name interaction name
     * @param cfg interaction config
     * @returns
     */
    View.prototype.interaction = function (name, cfg) {
        var existInteraction = this.interactions[name];
        // 存在则先销毁已有的
        if (existInteraction) {
            existInteraction.destroy();
        }
        // 新建交互实例
        var interaction = interaction_1.createInteraction(name, this, cfg);
        if (interaction) {
            interaction.init();
            this.interactions[name] = interaction;
        }
        return this;
    };
    /**
     * 移除当前 View 的 interaction
     * ```ts
     * view.removeInteraction('my-interaction');
     * ```
     * @param name interaction name
     */
    View.prototype.removeInteraction = function (name) {
        var existInteraction = this.interactions[name];
        // 存在则先销毁已有的
        if (existInteraction) {
            existInteraction.destroy();
            this.interactions[name] = undefined;
        }
    };
    /**
     * 修改数据，数据更新逻辑，数据更新仅仅影响当前这一层的 view
     *
     * ```ts
     * view.changeData([{ city: '北京', sale: '200' }]);
     * ```
     *
     * @param data
     * @returns void
     */
    View.prototype.changeData = function (data) {
        this.isDataChanged = true;
        this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_CHANGE_DATA);
        // 1. 保存数据
        this.data(data);
        // 2. 渲染
        this.paint(true);
        // 3. 遍历子 view 进行 change data
        var views = this.views;
        for (var i = 0, len = views.length; i < len; i++) {
            var view = views[i];
            // FIXME 子 view 有自己的数据的情况，该如何处理？
            view.changeData(data);
        }
        this.emit(constant_1.VIEW_LIFE_CIRCLE.AFTER_CHANGE_DATA);
    };
    /* View 管理相关的 API */
    /**
     * 创建子 view
     *
     * ```ts
     * const innerView = view.createView({
     *   start: { x: 0, y: 0 },
     *   end: { x: 0.5, y: 0.5 },
     *   padding: 8,
     * });
     * ```
     *
     * @param cfg
     * @returns View
     */
    View.prototype.createView = function (cfg) {
        // 子 view 共享 options 配置数据
        var sharedOptions = {
            data: this.options.data,
            scales: util_1.clone(this.options.scales),
            axes: util_1.clone(this.options.axes),
            coordinate: util_1.clone(this.coordinateController.getOption()),
            tooltip: util_1.clone(this.options.tooltip),
            legends: util_1.clone(this.options.legends),
            animate: this.options.animate,
            visible: this.visible,
        };
        var v = new View(tslib_1.__assign(tslib_1.__assign({ parent: this, canvas: this.canvas, 
            // 子 view 共用三层 group
            backgroundGroup: this.backgroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.BG }), middleGroup: this.middleGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.MID }), foregroundGroup: this.foregroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.FORE }), theme: this.themeObject, padding: this.padding }, cfg), { options: tslib_1.__assign(tslib_1.__assign({}, sharedOptions), util_1.get(cfg, 'options', {})) }));
        this.views.push(v);
        return v;
    };
    /**
     * @deprecated
     * This method will be removed at G2 V4.1. Replaced by {@link #createView()}
     */
    View.prototype.view = function (cfg) {
        console.warn('This method will be removed at G2 V4.1. Please use chart.createView() instead.');
        return this.createView(cfg);
    };
    /**
     * 删除一个子 view
     * @param view
     * @return removedView
     */
    View.prototype.removeView = function (view) {
        var removedView = util_1.remove(this.views, function (v) { return v === view; })[0];
        if (removedView) {
            removedView.destroy();
        }
        return removedView;
    };
    /* end View 管理相关的 API */
    // 一些 get 方法
    /**
     * 获取当前坐标系实例。
     * @returns [[Coordinate]]
     */
    View.prototype.getCoordinate = function () {
        return this.coordinateInstance;
    };
    /**
     * 获取当前 view 的主题配置。
     * @returns themeObject
     */
    View.prototype.getTheme = function () {
        return this.themeObject;
    };
    /**
     * 获得 x 轴字段的 scale 实例。
     * @returns view 中 Geometry 对于的 x scale
     */
    View.prototype.getXScale = function () {
        // 拿第一个 Geometry 的 X scale
        // 隐藏逻辑：一个 view 中的 Geometry 必须 x 字段一致
        var g = this.geometries[0];
        return g ? g.getXScale() : null;
    };
    /**
     * 获取 y 轴字段的 scales 实例。
     * @returns view 中 Geometry 对于的 y scale 数组
     */
    View.prototype.getYScales = function () {
        // 拿到所有的 Geometry 的 Y scale，然后去重
        var tmpMap = {};
        return this.geometries.map(function (g) {
            var yScale = g.getYScale();
            var field = yScale.field;
            if (!tmpMap[field]) {
                tmpMap[field] = true;
                return yScale;
            }
        });
    };
    /**
     * 获取 x 轴或者 y 轴对应的所有 scale 实例。
     * @param dimType x | y
     * @returns x 轴或者 y 轴对应的所有 scale 实例。
     */
    View.prototype.getScalesByDim = function (dimType) {
        var geometries = this.geometries;
        var scales = {};
        for (var i = 0, len = geometries.length; i < len; i++) {
            var geometry = geometries[i];
            var scale = dimType === 'x' ? geometry.getXScale() : geometry.getYScale();
            if (scale && !scales[scale.field]) {
                scales[scale.field] = scale;
            }
        }
        return scales;
    };
    /**
     * 根据字段名去获取 scale 实例。
     * @param field 数据字段名称
     * @param key id
     */
    View.prototype.getScaleByField = function (field, key) {
        var defaultKey = key ? key : this.getScaleKey(field);
        // 调用根节点 view 的方法获取
        return this.getRootView().scalePool.getScale(defaultKey);
    };
    /**
     * 返回所有配置信息。
     * @returns 所有的 view API 配置。
     */
    View.prototype.getOptions = function () {
        return this.options;
    };
    /**
     * 获取 view 的数据（过滤后的数据）。
     * @returns 处理过滤器之后的数据。
     */
    View.prototype.getData = function () {
        return this.filteredData;
    };
    /**
     * 获得绘制的层级 group。
     * @param layer 层级名称。
     * @returns 对应层级的 Group。
     */
    View.prototype.getLayer = function (layer) {
        return layer === constant_1.LAYER.BG
            ? this.backgroundGroup
            : layer === constant_1.LAYER.MID
                ? this.middleGroup
                : layer === constant_1.LAYER.FORE
                    ? this.foregroundGroup
                    : this.foregroundGroup;
    };
    /**
     * 对外暴露方法，判断一个点是否在绘图区域（即坐标系范围）内部。
     * @param point 坐标点
     */
    View.prototype.isPointInPlot = function (point) {
        return coordinate_1.isPointInCoordinate(this.getCoordinate(), point);
    };
    /**
     * 获得所有的 legend 对应的 attribute 实例。
     * @returns 维度字段的 Attribute 数组
     */
    View.prototype.getLegendAttributes = function () {
        return util_1.flatten(this.geometries.map(function (g) { return g.getGroupAttributes(); }));
    };
    /**
     * 获取所有的分组字段的 scale 实例。
     * @returns 获得分组字段的 scale 实例数组。
     */
    View.prototype.getGroupScales = function () {
        // 拿到所有的 Geometry 的 分组字段 scale，然后打平去重
        var scales = this.geometries.map(function (g) { return g.getGroupScales(); });
        return helper_1.uniq(util_1.flatten(scales));
    };
    /**
     * 获取 G.Canvas 实例。
     * @returns G.Canvas 画布实例。
     */
    View.prototype.getCanvas = function () {
        return this.getRootView().canvas;
    };
    /**
     * 获得根节点 view。
     */
    View.prototype.getRootView = function () {
        var v = this;
        while (true) {
            if (v.parent) {
                v = v.parent;
                continue;
            }
            break;
        }
        return v;
    };
    /**
     * 获取该数据在可视化后，对应的画布坐标点。
     * @param data 原始数据记录
     * @returns 对应的画布坐标点
     */
    View.prototype.getXY = function (data) {
        var coordinate = this.getCoordinate();
        var xScales = this.getScalesByDim('x');
        var yScales = this.getScalesByDim('y');
        var x;
        var y;
        util_1.each(data, function (value, key) {
            if (xScales[key]) {
                x = xScales[key].scale(value);
            }
            if (yScales[key]) {
                y = yScales[key].scale(value);
            }
        });
        if (!util_1.isNil(x) && !util_1.isNil(y)) {
            return coordinate.convert({ x: x, y: y });
        }
    };
    /**
     * 获取 name 对应的 controller 实例
     * @param name
     */
    View.prototype.getController = function (name) {
        return util_1.find(this.controllers, function (c) { return c.name === name; });
    };
    /**
     * 显示 point 坐标点对应的 tooltip。
     * @param point 画布坐标点
     * @returns View
     */
    View.prototype.showTooltip = function (point) {
        var tooltip = this.getController('tooltip');
        if (tooltip) {
            tooltip.showTooltip(point);
        }
        return this;
    };
    /**
     * 隐藏 tooltip。
     * @returns View
     */
    View.prototype.hideTooltip = function () {
        var tooltip = this.getController('tooltip');
        if (tooltip) {
            tooltip.hideTooltip();
        }
        return this;
    };
    /**
     * 将 tooltip 锁定到当前位置不能移动。
     * @returns View
     */
    View.prototype.lockTooltip = function () {
        var tooltip = this.getController('tooltip');
        if (tooltip) {
            tooltip.lockTooltip();
        }
        return this;
    };
    /**
     * 将 tooltip 锁定解除。
     * @returns View
     */
    View.prototype.unlockTooltip = function () {
        var tooltip = this.getController('tooltip');
        if (tooltip) {
            tooltip.unlockTooltip();
        }
        return this;
    };
    /**
     * 是否锁定 tooltip。
     * @returns 是否锁定
     */
    View.prototype.isTooltipLocked = function () {
        var tooltip = this.getController('tooltip');
        return tooltip && tooltip.isTooltipLocked();
    };
    /**
     * 获取当前 point 对应的 tooltip 数据项。
     * @param point 坐标点
     * @returns tooltip 数据项
     */
    View.prototype.getTooltipItems = function (point) {
        var tooltip = this.getController('tooltip');
        return tooltip ? tooltip.getTooltipItems(point) : [];
    };
    /**
     * 获取逼近的点的数据集合
     * @param point 当前坐标点
     * @returns  数据
     */
    View.prototype.getSnapRecords = function (point) {
        var geometries = this.geometries;
        var rst = [];
        for (var i = 0, len = geometries.length; i < len; i++) {
            var geom = geometries[i];
            var dataArray = geom.dataArray;
            geom.sort(dataArray); // 先进行排序，便于 tooltip 查找
            var record = void 0;
            for (var j = 0, dataLen = dataArray.length; j < dataLen; j++) {
                var data = dataArray[j];
                record = tooltip_1.findDataByPoint(point, data, geom);
                if (record) {
                    rst.push(record);
                }
            }
        }
        // 同样递归处理子 views
        var views = this.views;
        for (var i = 0, len = views.length; i < len; i++) {
            var view = views[i];
            var snapRecords = view.getSnapRecords(point);
            rst = rst.concat(snapRecords);
        }
        return rst;
    };
    /**
     * 获取所有的 pure component 组件，用于布局。
     */
    View.prototype.getComponents = function () {
        var components = [];
        var controllers = this.controllers;
        for (var i = 0, len = controllers.length; i < len; i++) {
            var controller = controllers[i];
            components = components.concat(controller.getComponents());
        }
        return components;
    };
    /**
     * 将 data 数据进行过滤。
     * @param data
     * @returns 过滤之后的数据
     */
    View.prototype.filterData = function (data) {
        var filters = this.options.filters;
        // 不存在 filters，则不需要进行数据过滤
        if (util_1.size(filters) === 0) {
            return data;
        }
        // 存在过滤器，则逐个执行过滤，过滤器之间是 与 的关系
        return util_1.filter(data, function (datum, idx) {
            // 所有的 filter 字段
            var fields = Object.keys(filters);
            // 所有的条件都通过，才算通过
            return fields.every(function (field) {
                var condition = filters[field];
                // condition 返回 true，则保留
                return condition(datum[field], datum, idx);
            });
        });
    };
    /**
     * 对某一个字段进行过滤
     * @param field
     * @param data
     */
    View.prototype.filterFieldData = function (field, data) {
        var filters = this.options.filters;
        var condition = util_1.get(filters, field);
        if (util_1.isUndefined(condition)) {
            return data;
        }
        return data.filter(function (datum, idx) { return condition(datum[field], datum, idx); });
    };
    /**
     * 调整 coordinate 的坐标范围。
     */
    View.prototype.adjustCoordinate = function () {
        var _a = this.getCoordinate(), curStart = _a.start, curEnd = _a.end;
        var start = this.coordinateBBox.bl;
        var end = this.coordinateBBox.tr;
        // 在 defaultLayoutFn 中只会在 coordinateBBox 发生变化的时候会调用 adjustCoorinate()，所以不用担心被置位
        if (util_1.isEqual(curStart, start) && util_1.isEqual(curEnd, end)) {
            this.isCoordinateChanged = false;
            // 如果大小没有变化则不更新
            return;
        }
        this.isCoordinateChanged = true;
        this.coordinateInstance = this.coordinateController.adjust(start, end);
    };
    View.prototype.paint = function (isUpdate) {
        this.renderDataRecursive(isUpdate);
        // 处理 sync scale 的逻辑
        this.syncScale();
        this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_PAINT);
        this.renderBackgroundStyleShape();
        this.renderLayoutRecursive(isUpdate);
        this.renderPaintRecursive(isUpdate);
        this.emit(constant_1.VIEW_LIFE_CIRCLE.AFTER_PAINT);
        this.isDataChanged = false; // 渲染完毕复位
    };
    /** 渲染背景样式的 shape */
    View.prototype.renderBackgroundStyleShape = function () {
        // 只有根节点才处理
        if (!this.parent) {
            var background = util_1.get(this.themeObject, 'background');
            // 1. 配置了背景色
            if (background) {
                // 1. 不存在则创建
                if (!this.backgruondStyleRectShape) {
                    this.backgruondStyleRectShape = this.backgroundGroup.addShape('rect', {
                        attrs: {
                            zIndex: -1,
                        },
                    });
                }
                // 2. 有了 shape 之后设置背景，位置（更新的时候）
                var _a = this.viewBBox, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
                this.backgruondStyleRectShape.attr({
                    fill: background,
                    x: x,
                    y: y,
                    width: width,
                    height: height,
                });
            }
            else {
                // 没有配置背景色
                if (this.backgruondStyleRectShape) {
                    this.backgruondStyleRectShape.remove(true);
                    this.backgruondStyleRectShape = undefined;
                }
            }
        }
    };
    /**
     * 替换处理 view 的布局，最终是计算各个 view 的 coordinateBBox 和 coordinateInstance
     * @param isUpdate
     */
    View.prototype.renderLayoutRecursive = function (isUpdate) {
        // 1. 子 view 大小相对 coordinateBBox，changeSize 的时候需要重新计算
        this.calculateViewBBox();
        // 2. 更新 coordinate
        this.adjustCoordinate();
        // 3. 初始化组件 component
        this.initComponents(isUpdate);
        // 4. 进行布局，计算 coordinateBBox，进行组件布局，update 位置
        this.doLayout();
        // 5. 更新并存储最终的 padding 值
        var viewBBox = this.viewBBox;
        var coordinateBBox = this.coordinateBBox;
        if (padding_1.isAutoPadding(this.padding)) {
            // 用户未设置 padding 时，将自动计算的 padding 保存至 autoPadding 属性中
            this.autoPadding = [
                coordinateBBox.tl.y - viewBBox.tl.y,
                viewBBox.tr.x - coordinateBBox.tr.x,
                viewBBox.bl.y - coordinateBBox.bl.y,
                coordinateBBox.tl.x - viewBBox.tl.x,
            ];
        }
        // 同样递归处理子 views
        var views = this.views;
        for (var i = 0, len = views.length; i < len; i++) {
            var view = views[i];
            view.renderLayoutRecursive(isUpdate);
        }
    };
    /**
     * 最终递归绘制组件和图形
     * @param isUpdate
     */
    View.prototype.renderPaintRecursive = function (isUpdate) {
        if (this.limitInPlot) {
            var middleGroup = this.middleGroup;
            var _a = coordinate_1.getCoordinateClipCfg(this.coordinateInstance), type = _a.type, attrs = _a.attrs;
            middleGroup.setClip({
                type: type,
                attrs: attrs,
            });
        }
        // 1. 渲染几何标记
        this.paintGeometries(isUpdate);
        // 2. 绘制组件
        this.renderComponents(isUpdate);
        // 同样递归处理子 views
        var views = this.views;
        for (var i = 0, len = views.length; i < len; i++) {
            var view = views[i];
            view.renderPaintRecursive(isUpdate);
        }
    };
    // end Get 方法
    /**
     * 创建 scale，递归到顶层 view 去创建和缓存 scale
     * @param field
     * @param data
     * @param scaleDef
     * @param key
     */
    View.prototype.createScale = function (field, data, scaleDef, key) {
        // 1. 合并 field 对应的 scaleDef，合并原则是底层覆盖顶层（就近原则）
        var currentScaleDef = util_1.get(this.options.scales, [field]);
        var mergedScaleDef = tslib_1.__assign(tslib_1.__assign({}, currentScaleDef), scaleDef);
        // 2. 是否存在父 view，在则递归，否则创建
        if (this.parent) {
            return this.parent.createScale(field, data, mergedScaleDef, key);
        }
        // 3. 在根节点 view 通过 scalePool 创建
        return this.scalePool.createScale(field, data, mergedScaleDef, key);
    };
    /**
     * 递归渲染中的数据处理
     * @param isUpdate
     */
    View.prototype.renderDataRecursive = function (isUpdate) {
        // 1. 处理数据
        this.doFilterData();
        // 2. 创建实例
        this.createCoordinate();
        // 3. 初始化 Geometry
        this.initGeometries(isUpdate);
        // 4. 处理分面逻辑，最终都是生成子 view 和 geometry
        this.renderFacet(isUpdate);
        // 同样递归处理子 views
        var views = this.views;
        for (var i = 0, len = views.length; i < len; i++) {
            var view = views[i];
            view.renderDataRecursive(isUpdate);
        }
    };
    /**
     * 计算 region，计算实际的像素范围坐标
     * @private
     */
    View.prototype.calculateViewBBox = function () {
        var x;
        var y;
        var width;
        var height;
        if (this.parent) {
            var bbox = this.parent.coordinateBBox;
            // 存在 parent， 那么就是通过父容器大小计算
            x = bbox.x;
            y = bbox.y;
            width = bbox.width;
            height = bbox.height;
        }
        else {
            // 顶层容器，从 canvas 中取值 宽高
            x = 0;
            y = 0;
            width = this.canvas.get('width');
            height = this.canvas.get('height');
        }
        var _a = this.region, start = _a.start, end = _a.end;
        // 根据 region 计算当前 view 的 bbox 大小。
        var viewBBox = new bbox_1.BBox(x + width * start.x, y + height * start.y, width * (end.x - start.x), height * (end.y - start.y));
        if (!this.viewBBox || !this.viewBBox.isEqual(viewBBox)) {
            // viewBBox 发生变化的时候进行更新
            this.viewBBox = new bbox_1.BBox(x + width * start.x, y + height * start.y, width * (end.x - start.x), height * (end.y - start.y));
            // 初始的 coordinate bbox 大小
            this.coordinateBBox = this.viewBBox;
        }
    };
    /**
     * 初始化事件机制：G 4.0 底层内置支持 name:event 的机制，那么只要所有组件都有自己的 name 即可。
     *
     * G2 的事件只是获取事件委托，然后在 view 嵌套结构中，形成事件冒泡机制。
     * 当前 view 只委托自己 view 中的 Component 和 Geometry 事件，并向上冒泡
     * @private
     */
    View.prototype.initEvents = function () {
        // 三层 group 中的 shape 事件都会通过 G 冒泡上来的
        this.foregroundGroup.on('*', this.onDelegateEvents);
        this.middleGroup.on('*', this.onDelegateEvents);
        this.backgroundGroup.on('*', this.onDelegateEvents);
        this.canvas.on('*', this.onCanvasEvent);
    };
    /**
     * 初始化插件
     */
    View.prototype.initComponentController = function () {
        var usedControllers = this.usedControllers;
        for (var i = 0, len = usedControllers.length; i < len; i++) {
            var controllerName = usedControllers[i];
            var Ctor = controller_1.getComponentController(controllerName);
            if (Ctor) {
                this.controllers.push(new Ctor(this));
            }
        }
    };
    View.prototype.createViewEvent = function (evt) {
        var shape = evt.shape, name = evt.name;
        var data = shape ? shape.get('origin') : null;
        // 事件在 view 嵌套中冒泡（暂不提供阻止冒泡的机制）
        var e = new event_1.default(this, evt, data);
        e.type = name;
        return e;
    };
    /**
     * 处理 PLOT_EVENTS
     * plot event 需要处理所有的基础事件，并判断是否在画布中，然后再决定是否要 emit。
     * 对于 mouseenter、mouseleave 比较特殊，需要做一下数学比较。
     * @param e
     */
    View.prototype.doPlotEvent = function (e) {
        var type = e.type, x = e.x, y = e.y;
        var point = { x: x, y: y };
        var ALL_EVENTS = [
            'mousedown',
            'mouseup',
            'mousemove',
            'mouseleave',
            'mousewheel',
            'touchstart',
            'touchmove',
            'touchend',
            'touchcancel',
            'click',
            'dblclick',
            'contextmenu',
        ];
        if (ALL_EVENTS.includes(type)) {
            var currentInPlot = this.isPointInPlot(point);
            if (currentInPlot) {
                var TYPE = "plot:" + type; // 组合 plot 事件
                e.type = TYPE;
                this.emit(TYPE, e);
                if (type === 'mouseleave' || type === 'touchend') {
                    // 在plot 内部却离开画布
                    this.isPreMouseInPlot = false;
                }
            }
            // 对于 mouseenter, mouseleave 的计算处理
            if (type === 'mousemove' || type === 'touchmove') {
                if (this.isPreMouseInPlot && !currentInPlot) {
                    if (type === 'mousemove') {
                        e.type = constant_1.PLOT_EVENTS.MOUSE_LEAVE;
                        this.emit(constant_1.PLOT_EVENTS.MOUSE_LEAVE, e);
                    }
                    e.type = constant_1.PLOT_EVENTS.LEAVE;
                    this.emit(constant_1.PLOT_EVENTS.LEAVE, e);
                }
                else if (!this.isPreMouseInPlot && currentInPlot) {
                    if (type === 'mousemove') {
                        e.type = constant_1.PLOT_EVENTS.MOUSE_ENTER;
                        this.emit(constant_1.PLOT_EVENTS.MOUSE_ENTER, e);
                    }
                    e.type = constant_1.PLOT_EVENTS.ENTER;
                    this.emit(constant_1.PLOT_EVENTS.ENTER, e);
                }
                // 赋新的状态值
                this.isPreMouseInPlot = currentInPlot;
            }
            else if (type === 'mouseleave' || type === 'touchend') {
                // 可能不在 currentInPlot 中
                if (this.isPreMouseInPlot) {
                    if (type === 'mouseleave') {
                        e.type = constant_1.PLOT_EVENTS.MOUSE_LEAVE;
                        this.emit(constant_1.PLOT_EVENTS.MOUSE_LEAVE, e);
                    }
                    e.type = constant_1.PLOT_EVENTS.LEAVE;
                    this.emit(constant_1.PLOT_EVENTS.LEAVE, e);
                    this.isPreMouseInPlot = false;
                }
            }
        }
    };
    // view 生命周期 —— 渲染流程
    /**
     * 处理筛选器，筛选数据
     * @private
     */
    View.prototype.doFilterData = function () {
        var data = this.options.data;
        this.filteredData = this.filterData(data);
    };
    /**
     * 初始化 Geometries
     * @private
     */
    View.prototype.initGeometries = function (isUpdate) {
        // 初始化图形的之前，先创建 / 更新 scales
        this.createOrUpdateScales();
        // 实例化 Geometry，然后 view 将所有的 scale 管理起来
        var coordinate = this.getCoordinate();
        var scaleDefs = util_1.get(this.options, 'scales', {});
        var geometries = this.geometries;
        for (var i = 0, len = geometries.length; i < len; i++) {
            var geometry = geometries[i];
            // 保持 scales 引用不要变化
            geometry.scales = this.getGeometryScales();
            var cfg = {
                coordinate: coordinate,
                scaleDefs: scaleDefs,
                data: this.filteredData,
                theme: this.themeObject,
                isDataChanged: this.isDataChanged,
                isCoordinateChanged: this.isCoordinateChanged,
            };
            if (isUpdate) {
                // 数据发生更新
                geometry.update(cfg);
            }
            else {
                geometry.init(cfg);
            }
        }
        // Geometry 初始化之后，生成了 scale，然后进行调整 scale 配置
        this.adjustScales();
    };
    /**
     * 根据 Geometry 的所有字段创建 scales
     * 如果存在，则更新，不存在则创建
     */
    View.prototype.createOrUpdateScales = function () {
        var fields = this.getScaleFields();
        var groupedFields = this.getGroupedFields();
        var _a = this.getOptions(), data = _a.data, _b = _a.scales, scales = _b === void 0 ? {} : _b;
        var filteredData = this.filteredData;
        for (var i = 0, len = fields.length; i < len; i++) {
            var field = fields[i];
            var scaleDef = scales[field];
            // 调用方法，递归去创建
            var key = this.getScaleKey(field);
            this.createScale(field, 
            // 分组字段的 scale 使用未过滤的数据创建
            groupedFields.includes(field) ? data : filteredData, scaleDef, key);
            // 缓存从当前 view 创建的 scale key
            this.createdScaleKeys.set(key, true);
        }
    };
    /**
     * 处理 scale 同步逻辑
     */
    View.prototype.syncScale = function () {
        // 最终调用 root view 的
        this.getRootView().scalePool.sync();
    };
    /**
     * 获得 Geometry 中的 scale 对象
     */
    View.prototype.getGeometryScales = function () {
        var fields = this.getScaleFields();
        var scales = {};
        for (var i = 0; i < fields.length; i++) {
            var field = fields[i];
            scales[field] = this.getScaleByField(field);
        }
        return scales;
    };
    View.prototype.getScaleFields = function () {
        var fields = [];
        var tmpMap = {};
        var geometries = this.geometries;
        for (var i = 0; i < geometries.length; i++) {
            var geometry = geometries[i];
            var geometryScales = geometry.getScaleFields();
            helper_1.uniq(geometryScales, fields, tmpMap);
        }
        return fields;
    };
    View.prototype.getGroupedFields = function () {
        var fields = [];
        var tmpMap = {};
        var geometries = this.geometries;
        for (var i = 0; i < geometries.length; i++) {
            var geometry = geometries[i];
            var groupFields = geometry.getGroupFields();
            helper_1.uniq(groupFields, fields, tmpMap);
        }
        return fields;
    };
    /**
     * 调整 scale 配置
     * @private
     */
    View.prototype.adjustScales = function () {
        // 调整目前包括：
        // 分类 scale，调整 range 范围
        this.adjustCategoryScaleRange();
    };
    /**
     * 调整分类 scale 的 range，防止超出坐标系外面
     * @private
     */
    View.prototype.adjustCategoryScaleRange = function () {
        var _this = this;
        var xyScales = tslib_1.__spreadArrays([this.getXScale()], this.getYScales()).filter(function (e) { return !!e; });
        var coordinate = this.getCoordinate();
        var scaleOptions = this.options.scales;
        util_1.each(xyScales, function (scale) {
            var field = scale.field, values = scale.values, isCategory = scale.isCategory, isIdentity = scale.isIdentity;
            // 分类或者 identity 的 scale 才进行处理
            if (isCategory || isIdentity) {
                // 存在 value 值，且用户没有配置 range 配置
                if (values && !util_1.get(scaleOptions, [field, 'range'])) {
                    var count = values.length;
                    var range = void 0;
                    if (count === 1) {
                        range = [0.5, 1]; // 只有一个分类时,防止计算出现 [0.5,0.5] 的状态
                    }
                    else {
                        var widthRatio = 1;
                        var offset = 0;
                        if (coordinate_1.isFullCircle(coordinate)) {
                            if (!coordinate.isTransposed) {
                                range = [0, 1 - 1 / count];
                            }
                            else {
                                widthRatio = util_1.get(_this.theme, 'widthRatio.multiplePie', 1 / 1.3);
                                offset = (1 / count) * widthRatio;
                                range = [offset / 2, 1 - offset / 2];
                            }
                        }
                        else {
                            offset = 1 / count / 2; // 两边留下分类空间的一半
                            range = [offset, 1 - offset]; // 坐标轴最前面和最后面留下空白防止绘制柱状图时
                        }
                    }
                    // 更新 range
                    scale.range = range;
                }
            }
        });
    };
    /**
     * 根据 options 配置、Geometry 字段配置，自动生成 components
     * @param isUpdate 是否是更新
     * @private
     */
    View.prototype.initComponents = function (isUpdate) {
        // 先全部清空，然后 render
        var controllers = this.controllers;
        for (var i = 0; i < controllers.length; i++) {
            var controller = controllers[i];
            // 更新则走更新逻辑；否则清空载重绘
            if (isUpdate) {
                controller.update();
            }
            else {
                controller.clear();
                controller.render();
            }
        }
    };
    View.prototype.doLayout = function () {
        this.layoutFunc(this);
    };
    /**
     * 创建坐标系
     * @private
     */
    View.prototype.createCoordinate = function () {
        var start = this.coordinateBBox.bl;
        var end = this.coordinateBBox.tr;
        this.coordinateInstance = this.coordinateController.create(start, end);
    };
    /**
     * 根据 options 配置自动渲染 geometry
     * @private
     */
    View.prototype.paintGeometries = function (isUpdate) {
        var doAnimation = this.options.animate;
        // geometry 的 paint 阶段
        var coordinate = this.getCoordinate();
        var canvasRegion = {
            x: this.viewBBox.x,
            y: this.viewBBox.y,
            minX: this.viewBBox.minX,
            minY: this.viewBBox.minY,
            maxX: this.viewBBox.maxX,
            maxY: this.viewBBox.maxY,
            width: this.viewBBox.width,
            height: this.viewBBox.height,
        };
        var geometries = this.geometries;
        for (var i = 0; i < geometries.length; i++) {
            var geometry = geometries[i];
            geometry.coordinate = coordinate;
            geometry.canvasRegion = canvasRegion;
            if (!doAnimation) {
                // 如果 view 不执行动画，那么 view 下所有的 geometry 都不执行动画
                geometry.animate(false);
            }
            geometry.paint(isUpdate);
        }
    };
    /**
     * 最后的绘制组件
     * @param isUpdate
     */
    View.prototype.renderComponents = function (isUpdate) {
        // 先全部清空，然后 render
        for (var i = 0; i < this.getComponents().length; i++) {
            var co = this.getComponents()[i];
            co.component.render();
        }
    };
    /**
     * 渲染分面，会在其中进行数据分面，然后进行子 view 创建
     * @param isUpdate
     */
    View.prototype.renderFacet = function (isUpdate) {
        if (this.facetInstance) {
            if (isUpdate) {
                this.facetInstance.update();
            }
            else {
                this.facetInstance.clear();
                // 计算分面数据
                this.facetInstance.init();
                // 渲染组件和 views
                this.facetInstance.render();
            }
        }
    };
    View.prototype.initOptions = function () {
        var _a = this.options, _b = _a.geometries, geometries = _b === void 0 ? [] : _b, _c = _a.interactions, interactions = _c === void 0 ? [] : _c, _d = _a.views, views = _d === void 0 ? [] : _d, _e = _a.annotations, annotations = _e === void 0 ? [] : _e;
        // 创建 geometry 实例
        for (var i = 0; i < geometries.length; i++) {
            var geometryOption = geometries[i];
            this.createGeometry(geometryOption);
        }
        // 创建 interactions 实例
        for (var j = 0; j < interactions.length; j++) {
            var interactionOption = interactions[j];
            var type = interactionOption.type, cfg = interactionOption.cfg;
            this.interaction(type, cfg);
        }
        // 创建 view 实例
        for (var k = 0; k < views.length; k++) {
            var viewOption = views[k];
            this.createView(viewOption);
        }
        // 设置 annotation
        var annotationComponent = this.getController('annotation');
        for (var l = 0; l < annotations.length; l++) {
            var annotationOption = annotations[l];
            annotationComponent.annotation(annotationOption);
        }
    };
    View.prototype.createGeometry = function (geometryOption) {
        var type = geometryOption.type, _a = geometryOption.cfg, cfg = _a === void 0 ? {} : _a;
        if (this[type]) {
            var geometry_1 = this[type](cfg);
            util_1.each(geometryOption, function (v, k) {
                if (util_1.isFunction(geometry_1[k])) {
                    geometry_1[k](v);
                }
            });
        }
    };
    /**
     * scale key 的创建方式
     * @param field
     */
    View.prototype.getScaleKey = function (field) {
        return this.id + "-" + field;
    };
    return View;
}(base_1.default));
exports.View = View;
/**
 * 注册 geometry 组件
 * @param name
 * @param Ctor
 * @returns Geometry
 */
function registerGeometry(name, Ctor) {
    // 语法糖，在 view API 上增加原型方法
    View.prototype[name.toLowerCase()] = function (cfg) {
        if (cfg === void 0) { cfg = {}; }
        var props = tslib_1.__assign({ 
            /** 图形容器 */
            container: this.middleGroup.addGroup(), labelsContainer: this.foregroundGroup.addGroup() }, cfg);
        var geometry = new Ctor(props);
        this.geometries.push(geometry);
        return geometry;
    };
}
exports.registerGeometry = registerGeometry;
exports.default = View;

},{"../base":218,"../constant":237,"../facet":243,"../interaction":362,"../theme":365,"../util/bbox":370,"../util/coordinate":371,"../util/helper":377,"../util/padding":380,"../util/tooltip":383,"./controller":225,"./controller/coordinate":223,"./event":229,"./layout":232,"./util/scale-pool":234,"@antv/util":803,"tslib":385}],236:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var animate_1 = require("../animate");
var label_1 = require("../geometry/label");
var graphics_1 = require("../util/graphics");
var transform_1 = require("../util/transform");
/**
 * Geometry labels 渲染组件
 */
var Labels = /** @class */ (function () {
    function Labels(cfg) {
        /** 存储当前 shape 的映射表，键值为 shape id */
        this.shapesMap = {};
        this.lastShapesMap = {};
        var layout = cfg.layout, container = cfg.container;
        this.layout = layout;
        this.container = container;
    }
    /**
     * 渲染文本
     */
    Labels.prototype.render = function (items, shapes, isUpdate) {
        var _this = this;
        if (isUpdate === void 0) { isUpdate = false; }
        this.shapesMap = {};
        var container = this.container;
        var offscreenGroup = this.createOffscreenGroup(); // 创建虚拟分组
        if (items.length) {
            // 如果 items 空的话就不进行绘制调整操作
            // step 1: 在虚拟 group 中创建 shapes
            for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
                var item = items_1[_i];
                if (item) {
                    this.renderLabel(item, offscreenGroup);
                }
            }
            // step 2: 根据布局，调整 labels
            this.doLayout(items, shapes);
            // step 3: 绘制 labelLine
            this.renderLabelLine(items);
            // step 4: 根据用户设置的偏移量调整 label
            this.adjustLabel(items);
        }
        // 进行添加、更新、销毁操作
        var lastShapesMap = this.lastShapesMap;
        var shapesMap = this.shapesMap;
        util_1.each(shapesMap, function (shape, id) {
            if (shape.destroyed) {
                // label 在布局调整环节被删除了（doLayout）
                delete shapesMap[id];
            }
            else {
                if (lastShapesMap[id]) {
                    // 图形发生更新
                    var data_1 = shape.get('data');
                    var origin_1 = shape.get('origin');
                    var coordinate_1 = shape.get('coordinate');
                    var currentShape = lastShapesMap[id]; // 已经在渲染树上的 shape
                    var currentAnimateCfg_1 = shape.get('animateCfg');
                    currentShape.set('data', data_1);
                    currentShape.set('origin', origin_1);
                    currentShape.set('animateCfg', currentAnimateCfg_1);
                    currentShape.set('coordinate', coordinate_1);
                    var updateAnimateCfg_1 = util_1.get(currentAnimateCfg_1, 'update');
                    var currentChildren_1 = currentShape.getChildren();
                    shape.getChildren().map(function (child, index) {
                        var currentChild = currentChildren_1[index];
                        currentChild.set('data', data_1);
                        currentChild.set('origin', origin_1);
                        currentChild.set('animateCfg', currentAnimateCfg_1);
                        currentChild.set('coordinate', coordinate_1);
                        var newAttrs = graphics_1.getReplaceAttrs(currentChild, child);
                        if (updateAnimateCfg_1) {
                            animate_1.doAnimate(currentChild, updateAnimateCfg_1, {
                                toAttrs: newAttrs,
                                coordinate: coordinate_1,
                            });
                        }
                        else {
                            currentChild.attr(newAttrs);
                        }
                    });
                    _this.shapesMap[id] = currentShape; // 保存引用
                }
                else {
                    // 新生成的 shape
                    container.add(shape);
                    var animateCfg = util_1.get(shape.get('animateCfg'), isUpdate ? 'enter' : 'appear');
                    if (animateCfg) {
                        animate_1.doAnimate(shape, animateCfg, {
                            toAttrs: tslib_1.__assign({}, shape.attr()),
                            coordinate: shape.get('coordinate'),
                        });
                    }
                }
                delete lastShapesMap[id];
            }
        });
        // 移除
        util_1.each(lastShapesMap, function (deleteShape) {
            var animateCfg = util_1.get(deleteShape.get('animateCfg'), 'leave');
            if (animateCfg) {
                animate_1.doAnimate(deleteShape, animateCfg, {
                    toAttrs: null,
                    coordinate: deleteShape.get('coordinate'),
                });
            }
            else {
                deleteShape.remove(true); // 移除
            }
        });
        this.lastShapesMap = shapesMap;
        offscreenGroup.destroy();
    };
    /** 清楚当前 labels */
    Labels.prototype.clear = function () {
        this.container.clear();
        this.shapesMap = {};
        this.lastShapesMap = {};
    };
    /** 销毁 */
    Labels.prototype.destroy = function () {
        this.container.destroy();
        this.shapesMap = null;
        this.lastShapesMap = null;
    };
    Labels.prototype.renderLabel = function (cfg, container) {
        var id = cfg.id, data = cfg.data, mappingData = cfg.mappingData, coordinate = cfg.coordinate, animate = cfg.animate, content = cfg.content;
        var shapeAppendCfg = {
            id: id,
            data: data,
            origin: mappingData,
            coordinate: coordinate,
        };
        var labelGroup = container.addGroup(tslib_1.__assign({ name: 'label', 
            // 如果 this.animate === false 或者 cfg.animate === false/null 则不进行动画，否则进行动画配置的合并
            animateCfg: this.animate === false || animate === null || animate === false ? false : util_1.deepMix({}, this.animate, animate) }, shapeAppendCfg));
        var labelShape;
        if ((content.isGroup && content.isGroup()) || (content.isShape && content.isShape())) {
            // 如果 content 是 Group 或者 Shape，根据 textAlign 调整位置后，直接将其加入 labelGroup
            var _a = content.getCanvasBBox(), width = _a.width, height = _a.height;
            var textAlign = util_1.get(cfg, 'textAlign', 'left');
            var x = cfg.x;
            var y = cfg.y - height / 2;
            if (textAlign === 'center') {
                x = x - width / 2;
            }
            else if (textAlign === 'right' || textAlign === 'end') {
                x = x - width;
            }
            transform_1.translate(content, x, y); // 将 label 平移至 x, y 指定的位置
            labelShape = content;
            labelGroup.add(content);
        }
        else {
            labelShape = labelGroup.addShape('text', tslib_1.__assign({ attrs: tslib_1.__assign({ x: cfg.x, y: cfg.y, textAlign: cfg.textAlign, textBaseline: util_1.get(cfg, 'textBaseline', 'middle'), text: cfg.content }, cfg.style) }, shapeAppendCfg));
        }
        if (cfg.rotate) {
            transform_1.rotate(labelShape, cfg.rotate);
        }
        this.shapesMap[id] = labelGroup;
    };
    // 根据type对label布局
    Labels.prototype.doLayout = function (items, shapes) {
        var _this = this;
        if (this.layout) {
            var layouts = util_1.isArray(this.layout) ? this.layout : [this.layout];
            util_1.each(layouts, function (layout) {
                var layoutFn = label_1.getGeometryLabelLayout(util_1.get(layout, 'type', ''));
                if (layoutFn) {
                    var labelShapes_1 = [];
                    var geometryShapes_1 = [];
                    util_1.each(_this.shapesMap, function (labelShape, id) {
                        labelShapes_1.push(labelShape);
                        geometryShapes_1.push(shapes[id]);
                    });
                    layoutFn(items, labelShapes_1, geometryShapes_1, _this.region, layout.cfg);
                }
            });
        }
    };
    Labels.prototype.renderLabelLine = function (labelItems) {
        var _this = this;
        util_1.each(labelItems, function (labelItem) {
            var coordinate = util_1.get(labelItem, 'coordinate');
            if (!labelItem || !coordinate) {
                return;
            }
            var center = coordinate.getCenter();
            var radius = coordinate.getRadius();
            if (!labelItem.labelLine) {
                // labelLine: null | false，关闭 label 对应的 labelLine
                return;
            }
            var labelLineCfg = util_1.get(labelItem, 'labelLine', {});
            var id = labelItem.id;
            var path = labelLineCfg.path;
            if (!path) {
                var start = graphics_1.polarToCartesian(center.x, center.y, radius, labelItem.angle);
                path = [
                    ['M', start.x, start.y],
                    ['L', labelItem.x, labelItem.y],
                ];
            }
            var labelGroup = _this.shapesMap[id];
            if (!labelGroup.destroyed) {
                labelGroup.addShape('path', {
                    capture: false,
                    attrs: tslib_1.__assign({ path: path, stroke: labelItem.color ? labelItem.color : util_1.get(labelItem, ['style', 'fill'], '#000'), fill: null }, labelLineCfg.style),
                    id: id,
                    origin: labelItem.mappingData,
                    data: labelItem.data,
                    coordinate: labelItem.coordinate,
                });
            }
        });
    };
    Labels.prototype.createOffscreenGroup = function () {
        var container = this.container;
        var GroupClass = container.getGroupBase(); // 获取分组的构造函数
        var newGroup = new GroupClass({});
        return newGroup;
    };
    Labels.prototype.adjustLabel = function (items) {
        var _this = this;
        util_1.each(items, function (item) {
            if (item) {
                var id = item.id;
                var labelGroup = _this.shapesMap[id];
                if (!labelGroup.destroyed) {
                    var labelShape = labelGroup.find(function (ele) { return ele.get('type') === 'text'; });
                    if (labelShape) {
                        if (item.offsetX) {
                            labelShape.attr('x', labelShape.attr('x') + item.offsetX);
                        }
                        if (item.offsetY) {
                            labelShape.attr('y', labelShape.attr('y') + item.offsetY);
                        }
                    }
                }
            }
        });
    };
    return Labels;
}());
exports.default = Labels;

},{"../animate":217,"../geometry/label":256,"../util/graphics":375,"../util/transform":384,"@antv/util":803,"tslib":385}],237:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.COMPONENT_MAX_VIEW_PERCENTAGE = exports.MIN_CHART_HEIGHT = exports.MIN_CHART_WIDTH = exports.FIELD_ORIGIN = exports.GROUP_ATTRS = exports.ELEMENT_STATE = exports.PLOT_EVENTS = exports.VIEW_LIFE_CIRCLE = exports.GROUP_Z_INDEX = exports.COMPONENT_TYPE = exports.DIRECTION = exports.LAYER = void 0;
/**
 * view 中三层 group 分层 key
 */
var LAYER;
(function (LAYER) {
    /** 前景层 */
    LAYER["FORE"] = "fore";
    /** 中间层 */
    LAYER["MID"] = "mid";
    /** 背景层 */
    LAYER["BG"] = "bg";
})(LAYER = exports.LAYER || (exports.LAYER = {}));
/**
 * 组件在画布的布局方位 12 方位
 */
var DIRECTION;
(function (DIRECTION) {
    DIRECTION["TOP"] = "top";
    DIRECTION["TOP_LEFT"] = "top-left";
    DIRECTION["TOP_RIGHT"] = "top-right";
    DIRECTION["RIGHT"] = "right";
    DIRECTION["RIGHT_TOP"] = "right-top";
    DIRECTION["RIGHT_BOTTOM"] = "right-bottom";
    DIRECTION["LEFT"] = "left";
    DIRECTION["LEFT_TOP"] = "left-top";
    DIRECTION["LEFT_BOTTOM"] = "left-bottom";
    DIRECTION["BOTTOM"] = "bottom";
    DIRECTION["BOTTOM_LEFT"] = "bottom-left";
    DIRECTION["BOTTOM_RIGHT"] = "bottom-right";
    DIRECTION["RADIUS"] = "radius";
    DIRECTION["CIRCLE"] = "circle";
    // no direction information
    DIRECTION["NONE"] = "none";
})(DIRECTION = exports.DIRECTION || (exports.DIRECTION = {}));
/**
 * 组件的类型，可能会影响到布局算法
 */
var COMPONENT_TYPE;
(function (COMPONENT_TYPE) {
    /** axis 组件 */
    COMPONENT_TYPE["AXIS"] = "axis";
    /** grid 组件 */
    COMPONENT_TYPE["GRID"] = "grid";
    /** legend 组件 */
    COMPONENT_TYPE["LEGEND"] = "legend";
    /** tooltip 组件 */
    COMPONENT_TYPE["TOOLTIP"] = "tooltip";
    /** annotation 组件 */
    COMPONENT_TYPE["ANNOTATION"] = "annotation";
    /** 其他组件，自定义组件 */
    COMPONENT_TYPE["OTHER"] = "other";
})(COMPONENT_TYPE = exports.COMPONENT_TYPE || (exports.COMPONENT_TYPE = {}));
/**
 * 三层 group 的 z index
 */
exports.GROUP_Z_INDEX = {
    FORE: 3,
    MID: 2,
    BG: 1,
};
/**
 * View 的生命周期阶段（和 3.x 的生命周期略有不同）
 * 我们需要先确定在那写场景需要用到生命周期，如果只是为了在生命周期插入一下什么组件之类的，那么在现有架构就是不需要的
 */
var VIEW_LIFE_CIRCLE;
(function (VIEW_LIFE_CIRCLE) {
    VIEW_LIFE_CIRCLE["BEFORE_RENDER"] = "beforerender";
    VIEW_LIFE_CIRCLE["AFTER_RENDER"] = "afterrender";
    VIEW_LIFE_CIRCLE["BEFORE_PAINT"] = "beforepaint";
    VIEW_LIFE_CIRCLE["AFTER_PAINT"] = "afterpaint";
    VIEW_LIFE_CIRCLE["BEFORE_CHANGE_DATA"] = "beforechangedata";
    VIEW_LIFE_CIRCLE["AFTER_CHANGE_DATA"] = "afterchangedata";
    VIEW_LIFE_CIRCLE["BEFORE_CLEAR"] = "beforeclear";
    VIEW_LIFE_CIRCLE["AFTER_CLEAR"] = "afterclear";
    VIEW_LIFE_CIRCLE["BEFORE_DESTROY"] = "beforedestroy";
})(VIEW_LIFE_CIRCLE = exports.VIEW_LIFE_CIRCLE || (exports.VIEW_LIFE_CIRCLE = {}));
/**
 * 绘图区的事件列表
 */
var PLOT_EVENTS;
(function (PLOT_EVENTS) {
    // mouse 事件
    PLOT_EVENTS["MOUSE_ENTER"] = "plot:mouseenter";
    PLOT_EVENTS["MOUSE_DOWN"] = "plot:mousedown";
    PLOT_EVENTS["MOUSE_MOVE"] = "plot:mousemove";
    PLOT_EVENTS["MOUSE_UP"] = "plot:mouseup";
    PLOT_EVENTS["MOUSE_LEAVE"] = "plot:mouseleave";
    // 移动端事件
    PLOT_EVENTS["TOUCH_START"] = "plot:touchstart";
    PLOT_EVENTS["TOUCH_MOVE"] = "plot:touchmove";
    PLOT_EVENTS["TOUCH_END"] = "plot:touchend";
    PLOT_EVENTS["TOUCH_CANCEL"] = "plot:touchcancel";
    // click 事件
    PLOT_EVENTS["CLICK"] = "plot:click";
    PLOT_EVENTS["DBLCLICK"] = "plot:dblclick";
    PLOT_EVENTS["CONTEXTMENU"] = "plot:contextmenu";
    PLOT_EVENTS["LEAVE"] = "plot:leave";
    PLOT_EVENTS["ENTER"] = "plot:enter";
})(PLOT_EVENTS = exports.PLOT_EVENTS || (exports.PLOT_EVENTS = {}));
/**
 * Element 图形交互状态
 */
var ELEMENT_STATE;
(function (ELEMENT_STATE) {
    ELEMENT_STATE["ACTIVE"] = "active";
    ELEMENT_STATE["INACTIVE"] = "inactive";
    ELEMENT_STATE["SELECTED"] = "selected";
    ELEMENT_STATE["DEFAULT"] = "default";
})(ELEMENT_STATE = exports.ELEMENT_STATE || (exports.ELEMENT_STATE = {}));
/** 参与分组的图形属性名 */
exports.GROUP_ATTRS = ['color', 'shape', 'size'];
/** 存储原始数据的字段名 */
exports.FIELD_ORIGIN = '_origin';
/** 最小的图表宽度 */
exports.MIN_CHART_WIDTH = 1;
/** 最小的图表高度 */
exports.MIN_CHART_HEIGHT = 1;
/** 辅助组件占图表的尺寸的最大比例：如图表上方的图例最多占图表高度的25% */
exports.COMPONENT_MAX_VIEW_PERCENTAGE = 0.25;

},{}],238:[function(require,module,exports){
"use strict";
/* G2 的一个壳子，不包含 Geometry，由开发者自己定义和引入 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Types = exports.VERSION = void 0;
var tslib_1 = require("tslib");
exports.VERSION = '4.0.15';
// 核心基类导出
var chart_1 = require("./chart"); // Chart, View 类
Object.defineProperty(exports, "Chart", { enumerable: true, get: function () { return chart_1.Chart; } });
Object.defineProperty(exports, "View", { enumerable: true, get: function () { return chart_1.View; } });
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return chart_1.Event; } });
var base_1 = require("./chart/controller/base"); // G2 组件基类
Object.defineProperty(exports, "ComponentController", { enumerable: true, get: function () { return base_1.Controller; } });
var base_2 = require("./geometry/base"); // Geometry 基类
Object.defineProperty(exports, "Geometry", { enumerable: true, get: function () { return base_2.default; } });
var base_3 = require("./geometry/label/base"); // Geometry Label 基类
Object.defineProperty(exports, "GeometryLabel", { enumerable: true, get: function () { return base_3.default; } });
var interaction_1 = require("./interaction"); // Interaction 基类
Object.defineProperty(exports, "Interaction", { enumerable: true, get: function () { return interaction_1.Interaction; } });
var facet_1 = require("./facet"); // Facet 基类
Object.defineProperty(exports, "Facet", { enumerable: true, get: function () { return facet_1.Facet; } });
var base_4 = require("./interaction/action/base"); // Interaction Action 基类
Object.defineProperty(exports, "InteractionAction", { enumerable: true, get: function () { return base_4.default; } });
// 注册 ComponentController
var chart_2 = require("./chart");
Object.defineProperty(exports, "registerComponentController", { enumerable: true, get: function () { return chart_2.registerComponentController; } });
// 注册 Geometry
var chart_3 = require("./chart");
Object.defineProperty(exports, "registerGeometry", { enumerable: true, get: function () { return chart_3.registerGeometry; } });
// 注册 Geometry Shape
var base_5 = require("./geometry/shape/base");
Object.defineProperty(exports, "registerShape", { enumerable: true, get: function () { return base_5.registerShape; } });
Object.defineProperty(exports, "registerShapeFactory", { enumerable: true, get: function () { return base_5.registerShapeFactory; } });
Object.defineProperty(exports, "getShapeFactory", { enumerable: true, get: function () { return base_5.getShapeFactory; } });
// 注册 Geometry label 以及 Geometry Label 布局函数
var label_1 = require("./geometry/label");
Object.defineProperty(exports, "registerGeometryLabel", { enumerable: true, get: function () { return label_1.registerGeometryLabel; } });
Object.defineProperty(exports, "registerGeometryLabelLayout", { enumerable: true, get: function () { return label_1.registerGeometryLabelLayout; } });
Object.defineProperty(exports, "getGeometryLabel", { enumerable: true, get: function () { return label_1.getGeometryLabel; } });
Object.defineProperty(exports, "getGeometryLabelLayout", { enumerable: true, get: function () { return label_1.getGeometryLabelLayout; } });
// 注册 interaction
var interaction_2 = require("./interaction");
Object.defineProperty(exports, "getInteraction", { enumerable: true, get: function () { return interaction_2.getInteraction; } });
Object.defineProperty(exports, "registerInteraction", { enumerable: true, get: function () { return interaction_2.registerInteraction; } });
Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return interaction_2.registerAction; } });
Object.defineProperty(exports, "getActionClass", { enumerable: true, get: function () { return interaction_2.getActionClass; } });
// 注册 facet
var facet_2 = require("./facet");
Object.defineProperty(exports, "getFacet", { enumerable: true, get: function () { return facet_2.getFacet; } });
Object.defineProperty(exports, "registerFacet", { enumerable: true, get: function () { return facet_2.registerFacet; } });
// 注册主题
var theme_1 = require("./theme");
Object.defineProperty(exports, "getTheme", { enumerable: true, get: function () { return theme_1.getTheme; } });
Object.defineProperty(exports, "registerTheme", { enumerable: true, get: function () { return theme_1.registerTheme; } });
// G engine 管理相关
var engine_1 = require("./engine");
Object.defineProperty(exports, "registerEngine", { enumerable: true, get: function () { return engine_1.registerEngine; } });
Object.defineProperty(exports, "getEngine", { enumerable: true, get: function () { return engine_1.getEngine; } });
// 注册动画函数
var animation_1 = require("./animate/animation");
Object.defineProperty(exports, "registerAnimation", { enumerable: true, get: function () { return animation_1.registerAnimation; } });
Object.defineProperty(exports, "getAnimation", { enumerable: true, get: function () { return animation_1.getAnimation; } });
var constant_1 = require("./constant");
Object.defineProperty(exports, "LAYER", { enumerable: true, get: function () { return constant_1.LAYER; } });
Object.defineProperty(exports, "DIRECTION", { enumerable: true, get: function () { return constant_1.DIRECTION; } });
// 因为 typescript 部分版本不支持 export * as 语法。
var Types = tslib_1.__importStar(require("./interface"));
exports.Types = Types;

},{"./animate/animation":209,"./chart":230,"./chart/controller/base":222,"./constant":237,"./engine":240,"./facet":243,"./geometry/base":250,"./geometry/label":256,"./geometry/label/base":255,"./geometry/shape/base":275,"./interaction":362,"./interaction/action/base":311,"./interface":364,"./theme":365,"tslib":385}],239:[function(require,module,exports){
"use strict";
/* 依赖的模块，在这里统一引入，方便打包优化 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Slider = exports.HtmlTooltip = exports.ContinuousLegend = exports.CategoryLegend = exports.CircleGrid = exports.LineGrid = exports.CircleAxis = exports.LineAxis = exports.Annotation = exports.Crosshair = exports.Component = exports.GroupComponent = exports.HtmlComponent = void 0;
var g_base_1 = require("@antv/g-base");
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return g_base_1.Event; } });
Object.defineProperty(exports, "AbstractGroup", { enumerable: true, get: function () { return g_base_1.AbstractGroup; } });
Object.defineProperty(exports, "AbstractShape", { enumerable: true, get: function () { return g_base_1.AbstractShape; } });
// adjust
var factory_1 = require("@antv/adjust/lib/factory");
Object.defineProperty(exports, "registerAdjust", { enumerable: true, get: function () { return factory_1.registerAdjust; } });
Object.defineProperty(exports, "getAdjust", { enumerable: true, get: function () { return factory_1.getAdjust; } });
Object.defineProperty(exports, "Adjust", { enumerable: true, get: function () { return factory_1.Adjust; } });
// attr
var factory_2 = require("@antv/attr/lib/factory");
Object.defineProperty(exports, "getAttribute", { enumerable: true, get: function () { return factory_2.getAttribute; } });
Object.defineProperty(exports, "Attribute", { enumerable: true, get: function () { return factory_2.Attribute; } });
var attr_1 = require("@antv/attr");
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return attr_1.Color; } });
// coordinate
var coord_1 = require("@antv/coord");
Object.defineProperty(exports, "getCoordinate", { enumerable: true, get: function () { return coord_1.getCoordinate; } });
Object.defineProperty(exports, "registerCoordinate", { enumerable: true, get: function () { return coord_1.registerCoordinate; } });
Object.defineProperty(exports, "Coordinate", { enumerable: true, get: function () { return coord_1.Coordinate; } });
// scale
var scale_1 = require("@antv/scale");
Object.defineProperty(exports, "getScale", { enumerable: true, get: function () { return scale_1.getScale; } });
Object.defineProperty(exports, "registerScale", { enumerable: true, get: function () { return scale_1.registerScale; } });
Object.defineProperty(exports, "Scale", { enumerable: true, get: function () { return scale_1.Scale; } });
// component
var component_1 = require("@antv/component");
Object.defineProperty(exports, "Annotation", { enumerable: true, get: function () { return component_1.Annotation; } });
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return component_1.Component; } });
Object.defineProperty(exports, "Crosshair", { enumerable: true, get: function () { return component_1.Crosshair; } });
Object.defineProperty(exports, "GroupComponent", { enumerable: true, get: function () { return component_1.GroupComponent; } });
Object.defineProperty(exports, "HtmlComponent", { enumerable: true, get: function () { return component_1.HtmlComponent; } });
Object.defineProperty(exports, "Slider", { enumerable: true, get: function () { return component_1.Slider; } });
// axis
var LineAxis = component_1.Axis.Line, CircleAxis = component_1.Axis.Circle;
exports.LineAxis = LineAxis;
exports.CircleAxis = CircleAxis;
// grid
var LineGrid = component_1.Grid.Line, CircleGrid = component_1.Grid.Circle;
exports.LineGrid = LineGrid;
exports.CircleGrid = CircleGrid;
// legend
var CategoryLegend = component_1.Legend.Category, ContinuousLegend = component_1.Legend.Continuous;
exports.CategoryLegend = CategoryLegend;
exports.ContinuousLegend = ContinuousLegend;
// Tooltip
var HtmlTooltip = component_1.Tooltip.Html;
exports.HtmlTooltip = HtmlTooltip;

},{"@antv/adjust/lib/factory":8,"@antv/attr":17,"@antv/attr/lib/factory":16,"@antv/component":51,"@antv/coord":83,"@antv/g-base":115,"@antv/scale":747}],240:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerEngine = exports.getEngine = void 0;
var ENGINES = {};
/**
 * 通过名字获取渲染 engine
 * @param name 渲染引擎名字
 * @returns G engine
 */
function getEngine(name) {
    var G = ENGINES[name];
    if (!G) {
        throw new Error("G engine '" + name + "' is not exist, please register it at first.");
    }
    return G;
}
exports.getEngine = getEngine;
/**
 * 注册渲染引擎
 * @param name
 * @param engine
 */
function registerEngine(name, engine) {
    ENGINES[name] = engine;
}
exports.registerEngine = registerEngine;

},{}],241:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * 镜像分面
 */
var Circle = /** @class */ (function (_super) {
    tslib_1.__extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'circle',
            showTitle: true,
            title: _super.prototype.getDefaultTitleCfg.call(this),
        });
    };
    Circle.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    /**
     * 根据总数和当前索引，计算分面的 region
     * @param count
     * @param index
     */
    Circle.prototype.getRegion = function (count, index) {
        var r = 1 / 2; // 画布半径
        // 画布圆心
        var center = { x: 0.5, y: 0.5 };
        // 每隔分面间隔的弧度
        var avgAngle = (Math.PI * 2) / count;
        // 当前分面所在的弧度
        var angle = (-1 * Math.PI) / 2 + avgAngle * index;
        // TODO 没看懂
        var facetR = r / (1 + 1 / Math.sin(avgAngle / 2));
        // 分面的中心点
        var middle = facet_1.getAnglePoint(center, r - facetR, angle);
        var startAngle = (Math.PI * 5) / 4; // 右上角
        var endAngle = (Math.PI * 1) / 4; // 左下角
        return {
            start: facet_1.getAnglePoint(middle, facetR, startAngle),
            end: facet_1.getAnglePoint(middle, facetR, endAngle),
        };
    };
    Circle.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    Circle.prototype.beforeEachView = function (view, facet) { };
    Circle.prototype.generateFacets = function (data) {
        var _this = this;
        var _a = this.cfg, fields = _a.fields, type = _a.type;
        var field = fields[0];
        if (!field) {
            throw new Error('No `fields` specified!');
        }
        var values = this.getFieldValues(data, field);
        var count = values.length;
        var rst = [];
        values.forEach(function (value, index) {
            var conditions = [{ field: field, value: value, values: values }];
            var facetData = util_1.filter(data, _this.getFacetDataFilter(conditions));
            var facet = {
                type: type,
                data: facetData,
                region: _this.getRegion(count, index),
                columnValue: value,
                columnField: field,
                columnIndex: index,
                columnValuesLength: count,
                rowValue: null,
                rowField: null,
                rowIndex: 0,
                rowValuesLength: 1,
            };
            rst.push(facet);
        });
        return rst;
    };
    Circle.prototype.getXAxisOption = function (x, axes, option, facet) {
        // 不做任何处理
        return option;
    };
    /**
     * 设置 y 坐标轴的文本、title 是否显示
     * @param y
     * @param axes
     * @param option
     * @param facet
     */
    Circle.prototype.getYAxisOption = function (y, axes, option, facet) {
        // 不做任何处理
        return option;
    };
    /**
     * facet title
     */
    Circle.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet) {
            var columnValue = facet.columnValue, view = facet.view;
            var formatter = util_1.get(_this.cfg.title, 'formatter');
            var config = util_1.deepMix({
                position: ['50%', '0%'],
                content: formatter ? formatter(columnValue) : columnValue,
            }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.title);
            view.annotation().text(config);
        });
    };
    return Circle;
}(facet_2.Facet));
exports.default = Circle;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],242:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Facet = void 0;
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var axis_1 = require("../util/axis");
/**
 * facet 基类
 *  - 定义生命周期，方便自定义 facet
 *  - 提供基础的生命流程方法
 *
 * 生命周期：
 *
 * 初始化 init
 * 1. 初始化容器
 * 2. 数据分面，生成分面布局信息
 *
 * 渲染阶段 render
 * 1. view 创建
 * 2. title
 * 3. axis
 *
 * 清除阶段 clear
 * 1. 清除 view
 *
 * 销毁阶段 destroy
 * 1. clear
 * 2. 清除事件
 * 3. 清除 group
 */
var Facet = /** @class */ (function () {
    function Facet(view, cfg) {
        /** 是否销毁 */
        this.destroyed = false;
        /** 分面之后的所有分面数据结构 */
        this.facets = [];
        this.view = view;
        this.cfg = util_1.deepMix({}, this.getDefaultCfg(), cfg);
    }
    /**
     * 初始化过程
     */
    Facet.prototype.init = function () {
        // 初始化容器
        if (!this.container) {
            this.container = this.createContainer();
        }
        // 生成分面布局信息
        var data = this.view.getData();
        this.facets = this.generateFacets(data);
    };
    /**
     * 渲染分面，由上层 view 调用。包括：
     *  - 分面 view
     *  - 轴
     *  - title
     *
     *  子类可以复写，添加一些其他组件，比如滚动条等
     */
    Facet.prototype.render = function () {
        this.renderViews();
    };
    /**
     * 更新 facet
     */
    Facet.prototype.update = function () {
        // 其实不用做任何事情，因为 facet 最终生成的 View 和 Geometry 都在父 view 的更新中处理了
    };
    /**
     * 清空，clear 之后如果还需要使用，需要重新调用 init 初始化过程
     * 一般在数据有变更的时候调用，重新进行数据的分面逻辑
     */
    Facet.prototype.clear = function () {
        this.clearFacetViews();
    };
    /**
     * 销毁
     */
    Facet.prototype.destroy = function () {
        this.clear();
        if (this.container) {
            this.container.remove(true);
            this.container = undefined;
        }
        this.destroyed = true;
        this.view = undefined;
        this.facets = [];
    };
    /**
     * 根据 facet 生成 view，可以给上层自定义使用
     * @param facet
     */
    Facet.prototype.facetToView = function (facet) {
        var region = facet.region, data = facet.data, _a = facet.padding, padding = _a === void 0 ? this.cfg.padding : _a;
        var view = this.view.createView({
            region: region,
            padding: padding,
        });
        // 设置分面的数据
        view.data(data || []);
        facet.view = view;
        // 前置钩子
        this.beforeEachView(view, facet);
        var eachView = this.cfg.eachView;
        if (eachView) {
            eachView(view, facet);
        }
        // 后置钩子
        this.afterEachView(view, facet);
        return view;
    };
    // 创建容器
    Facet.prototype.createContainer = function () {
        var foregroundGroup = this.view.getLayer(constant_1.LAYER.FORE);
        return foregroundGroup.addGroup();
    };
    /**
     * 初始化 view
     */
    Facet.prototype.renderViews = function () {
        this.createFacetViews();
    };
    /**
     * 创建 分面 view
     */
    Facet.prototype.createFacetViews = function () {
        var _this = this;
        // 使用分面数据 创建分面 view
        return this.facets.map(function (facet) {
            return _this.facetToView(facet);
        });
    };
    /**
     * 从 view 中清除 facetView
     */
    Facet.prototype.clearFacetViews = function () {
        var _this = this;
        // 从 view 中移除分面 view
        util_1.each(this.facets, function (facet) {
            if (facet.view) {
                _this.view.removeView(facet.view);
                facet.view = undefined;
            }
        });
    };
    // 其他一些提供给子类使用的方法
    /**
     * 获取这个字段对应的所有值，数组
     * @protected
     * @param data 数据
     * @param field 字段名
     * @return 字段对应的值
     */
    Facet.prototype.getFieldValues = function (data, field) {
        var rst = [];
        var cache = {};
        // 去重、去除 Nil 值
        util_1.each(data, function (d) {
            var value = d[field];
            if (!util_1.isNil(value) && !cache[value]) {
                rst.push(value);
                cache[value] = true;
            }
        });
        return rst;
    };
    /**
     * 获得每个分面的 region，平分区域
     * @param rows row 总数
     * @param cols col 总数
     * @param xIndex x 方向 index
     * @param yIndex y 方向 index
     */
    Facet.prototype.getRegion = function (rows, cols, xIndex, yIndex) {
        // x, y 方向均分 100% 宽高
        var xRatio = 1 / (cols === 0 ? 1 : cols);
        var yRatio = 1 / (rows === 0 ? 1 : rows);
        var start = {
            x: xRatio * xIndex,
            y: yRatio * yIndex,
        };
        var end = {
            x: xRatio * (xIndex + 1),
            y: yRatio * (yIndex + 1),
        };
        return {
            start: start,
            end: end,
        };
    };
    Facet.prototype.getDefaultCfg = function () {
        return {
            eachView: undefined,
            showTitle: true,
            padding: 10,
            fields: [],
        };
    };
    /**
     * 默认的 title 样式，因为有的分面是 title，有的分面配置是 columnTitle、rowTitle
     */
    Facet.prototype.getDefaultTitleCfg = function () {
        // @ts-ignore
        var fontFamily = this.view.getTheme().fontFamily;
        return {
            style: {
                fontSize: 14,
                fill: '#666',
                fontFamily: fontFamily,
            },
        };
    };
    /**
     * 处理 axis 的默认配置
     * @param view
     * @param facet
     */
    Facet.prototype.processAxis = function (view, facet) {
        var options = view.getOptions();
        var coordinateOption = options.coordinate;
        var geometries = view.geometries;
        var coordinateType = util_1.get(coordinateOption, 'type', 'rect');
        if (coordinateType === 'rect' && geometries.length) {
            if (util_1.isNil(options.axes)) {
                // @ts-ignore
                options.axes = {};
            }
            var axes = options.axes;
            var _a = geometries[0].getXYFields(), x = _a[0], y = _a[1];
            var xOption = axis_1.getAxisOption(axes, x);
            var yOption = axis_1.getAxisOption(axes, y);
            if (xOption !== false) {
                options.axes[x] = this.getXAxisOption(x, axes, xOption, facet);
            }
            if (yOption !== false) {
                options.axes[y] = this.getYAxisOption(y, axes, yOption, facet);
            }
        }
    };
    /**
     * 获取分面数据
     * @param conditions
     */
    Facet.prototype.getFacetDataFilter = function (conditions) {
        return function (datum) {
            // 过滤出全部满足条件的数据
            return util_1.every(conditions, function (condition) {
                var field = condition.field, value = condition.value;
                if (!util_1.isNil(value) && field) {
                    return datum[field] === value;
                }
                return true;
            });
        };
    };
    return Facet;
}());
exports.Facet = Facet;

},{"../constant":237,"../util/axis":369,"@antv/util":803}],243:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerFacet = exports.getFacet = void 0;
var util_1 = require("@antv/util");
var facet_1 = require("./facet");
Object.defineProperty(exports, "Facet", { enumerable: true, get: function () { return facet_1.Facet; } });
/**
 * 所有的 Facet 类
 */
var Facets = {};
/**
 * 根据 type 获取 facet 类
 * @param type 分面类型
 */
exports.getFacet = function (type) {
    return Facets[util_1.lowerCase(type)];
};
/**
 * 注册一个 Facet 类
 * @param type 分面类型
 * @param ctor 分面类
 */
exports.registerFacet = function (type, ctor) {
    Facets[util_1.lowerCase(type)] = ctor;
};

},{"./facet":242,"@antv/util":803}],244:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * 镜像分面
 */
var List = /** @class */ (function (_super) {
    tslib_1.__extends(List, _super);
    function List() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    List.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'list',
            cols: null,
            showTitle: true,
            title: _super.prototype.getDefaultTitleCfg.call(this),
        });
    };
    List.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    List.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    List.prototype.beforeEachView = function (view, facet) { };
    List.prototype.generateFacets = function (data) {
        var _this = this;
        var fields = this.cfg.fields;
        var cols = this.cfg.cols;
        var columnField = fields[0];
        if (!columnField) {
            throw new Error('No `fields` specified!');
        }
        var colValues = this.getFieldValues(data, columnField);
        var count = colValues.length;
        cols = cols || count; // 每行有几列数据
        // 总共有几行
        var rows = this.getPageCount(count, cols);
        var rst = [];
        colValues.forEach(function (val, index) {
            // 当前 index 在那个行列
            var _a = _this.getRowCol(index, cols), row = _a.row, col = _a.col;
            var conditions = [{ field: columnField, value: val, values: colValues }];
            var facetData = util_1.filter(data, _this.getFacetDataFilter(conditions));
            var facet = {
                type: _this.cfg.type,
                data: facetData,
                region: _this.getRegion(rows, cols, col, row),
                columnValue: val,
                rowValue: val,
                columnField: columnField,
                rowField: null,
                columnIndex: col,
                rowIndex: row,
                columnValuesLength: cols,
                rowValuesLength: rows,
                total: count,
            };
            rst.push(facet);
        });
        return rst;
    };
    /**
     * 设置 x 坐标轴的文本、title 是否显示
     * @param x
     * @param axes
     * @param option
     * @param facet
     */
    List.prototype.getXAxisOption = function (x, axes, option, facet) {
        // 当是最后一行或者下面没有 view 时文本不显示
        if (facet.rowIndex !== facet.rowValuesLength - 1 &&
            facet.columnValuesLength * facet.rowIndex + facet.columnIndex + 1 + facet.columnValuesLength <= facet.total) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { label: null, title: null });
        }
        return option;
    };
    /**
     * 设置 y 坐标轴的文本、title 是否显示
     * @param y
     * @param axes
     * @param option
     * @param facet
     */
    List.prototype.getYAxisOption = function (y, axes, option, facet) {
        if (facet.columnIndex !== 0) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        return option;
    };
    /**
     * facet title
     */
    List.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet) {
            var columnValue = facet.columnValue, view = facet.view;
            var formatter = util_1.get(_this.cfg.title, 'formatter');
            var config = util_1.deepMix({
                position: ['50%', '0%'],
                content: formatter ? formatter(columnValue) : columnValue,
            }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.title);
            view.annotation().text(config);
        });
    };
    /**
     * 计算分页数
     * @param total
     * @param pageSize
     */
    List.prototype.getPageCount = function (total, pageSize) {
        return Math.floor((total + pageSize - 1) / pageSize);
    };
    /**
     * 索引值在哪一页
     * @param index
     * @param pageSize
     */
    List.prototype.getRowCol = function (index, pageSize) {
        var row = Math.floor(index / pageSize);
        var col = index % pageSize;
        return { row: row, col: col };
    };
    return List;
}(facet_2.Facet));
exports.default = List;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],245:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * 镜像分面
 */
var Matrix = /** @class */ (function (_super) {
    tslib_1.__extends(Matrix, _super);
    function Matrix() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Matrix.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'matrix',
            showTitle: false,
            columnTitle: tslib_1.__assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
            rowTitle: tslib_1.__assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
        });
    };
    Matrix.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    Matrix.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    Matrix.prototype.beforeEachView = function (view, facet) { };
    Matrix.prototype.generateFacets = function (data) {
        var _a = this.cfg, fields = _a.fields, type = _a.type;
        // 矩阵中行列相等，等于指定的字段个数
        var rowValuesLength = fields.length;
        var columnValuesLength = rowValuesLength;
        var rst = [];
        for (var i = 0; i < columnValuesLength; i++) {
            var columnField = fields[i];
            for (var j = 0; j < rowValuesLength; j++) {
                var rowField = fields[j];
                var facet = {
                    type: type,
                    data: data,
                    region: this.getRegion(rowValuesLength, columnValuesLength, i, j),
                    columnValue: columnField,
                    rowValue: rowField,
                    columnField: columnField,
                    rowField: rowField,
                    columnIndex: i,
                    rowIndex: j,
                    columnValuesLength: columnValuesLength,
                    rowValuesLength: rowValuesLength,
                };
                rst.push(facet);
            }
        }
        return rst;
    };
    /**
     * 设置 x 坐标轴的文本、title 是否显示
     * @param x
     * @param axes
     * @param option
     * @param facet
     */
    Matrix.prototype.getXAxisOption = function (x, axes, option, facet) {
        // 最后一行显示
        if (facet.rowIndex !== facet.rowValuesLength - 1) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { label: null, title: null });
        }
        return option;
    };
    /**
     * 设置 y 坐标轴的文本、title 是否显示
     * @param y
     * @param axes
     * @param option
     * @param facet
     */
    Matrix.prototype.getYAxisOption = function (y, axes, option, facet) {
        // 第一列显示
        if (facet.columnIndex !== 0) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        return option;
    };
    /**
     * facet title
     */
    Matrix.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet, facetIndex) {
            var columnIndex = facet.columnIndex, rowIndex = facet.rowIndex, columnValuesLength = facet.columnValuesLength, rowValuesLength = facet.rowValuesLength, columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
            // top
            if (rowIndex === 0) {
                var formatter = util_1.get(_this.cfg.columnTitle, 'formatter');
                var config = util_1.deepMix({
                    position: ['50%', '0%'],
                    content: formatter ? formatter(columnValue) : columnValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.columnTitle);
                view.annotation().text(config);
            }
            // right
            if (columnIndex === columnValuesLength - 1) {
                var formatter = util_1.get(_this.cfg.rowTitle, 'formatter');
                var config = util_1.deepMix({
                    position: ['100%', '50%'],
                    content: formatter ? formatter(rowValue) : rowValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.RIGHT), _this.cfg.rowTitle);
                view.annotation().text(config);
            }
        });
    };
    return Matrix;
}(facet_2.Facet));
exports.default = Matrix;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],246:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * 镜像分面
 */
var Mirror = /** @class */ (function (_super) {
    tslib_1.__extends(Mirror, _super);
    function Mirror() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Mirror.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'mirror',
            showTitle: true,
            title: _super.prototype.getDefaultTitleCfg.call(this),
            transpose: false,
        });
    };
    Mirror.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    Mirror.prototype.beforeEachView = function (view, facet) {
        // 做一下坐标系转化
        if (this.cfg.transpose) {
            if (facet.columnIndex % 2 === 0) {
                view.coordinate().transpose().reflect('x');
            }
            else {
                view.coordinate().transpose();
            }
        }
        else {
            if (facet.rowIndex % 2 !== 0) {
                view.coordinate().reflect('y');
            }
        }
    };
    Mirror.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    Mirror.prototype.generateFacets = function (data) {
        var _this = this;
        var f = this.cfg.fields[0];
        var rst = [];
        var columnValuesLength = 1;
        var rowValuesLength = 1;
        var columnValues = [''];
        var rowValues = [''];
        var columnField;
        var rowField;
        if (this.cfg.transpose) {
            columnField = f;
            columnValues = this.getFieldValues(data, columnField).slice(0, 2); // 镜像最多两个
            columnValuesLength = columnValues.length;
        }
        else {
            rowField = f;
            rowValues = this.getFieldValues(data, rowField).slice(0, 2); // 镜像最多两个
            rowValuesLength = rowValues.length;
        }
        // 获取每个维度对应的数据配置片段
        columnValues.forEach(function (xVal, xIndex) {
            rowValues.forEach(function (yVal, yIndex) {
                var conditions = [
                    { field: columnField, value: xVal, values: columnValues },
                    { field: rowField, value: yVal, values: rowValues },
                ];
                var facetData = util_1.filter(data, _this.getFacetDataFilter(conditions));
                var facet = {
                    type: _this.cfg.type,
                    data: facetData,
                    region: _this.getRegion(rowValuesLength, columnValuesLength, xIndex, yIndex),
                    columnValue: xVal,
                    rowValue: yVal,
                    columnField: columnField,
                    rowField: rowField,
                    columnIndex: xIndex,
                    rowIndex: yIndex,
                    columnValuesLength: columnValuesLength,
                    rowValuesLength: rowValuesLength,
                };
                rst.push(facet);
            });
        });
        return rst;
    };
    /**
     * 设置 x 坐标轴的文本、title 是否显示
     * @param x
     * @param axes
     * @param option
     * @param facet
     */
    Mirror.prototype.getXAxisOption = function (x, axes, option, facet) {
        // 非最后一行
        // 当是最后一行或者下面没有 view 时文本不显示
        if (facet.columnIndex === 1 || facet.rowIndex === 1) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { label: null, title: null });
        }
        return option;
    };
    /**
     * 设置 y 坐标轴的文本、title 是否显示
     * @param y
     * @param axes
     * @param option
     * @param facet
     */
    Mirror.prototype.getYAxisOption = function (y, axes, option, facet) {
        // do nothing
        return option;
    };
    Mirror.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet, facetIndex) {
            var columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
            var formatter = util_1.get(_this.cfg.title, 'formatter');
            if (_this.cfg.transpose) {
                var config = util_1.deepMix({
                    position: ['50%', '0%'],
                    content: formatter ? formatter(columnValue) : columnValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.title);
                view.annotation().text(config);
            }
            else {
                var config = util_1.deepMix({
                    position: ['100%', '50%'],
                    content: formatter ? formatter(rowValue) : rowValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.RIGHT), _this.cfg.title);
                view.annotation().text(config);
            }
        });
    };
    return Mirror;
}(facet_2.Facet));
exports.default = Mirror;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],247:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * 矩阵分面
 */
var Rect = /** @class */ (function (_super) {
    tslib_1.__extends(Rect, _super);
    function Rect() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Rect.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    Rect.prototype.beforeEachView = function (view, facet) {
        // do nothing
    };
    Rect.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'rect',
            columnTitle: tslib_1.__assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
            rowTitle: tslib_1.__assign({}, _super.prototype.getDefaultTitleCfg.call(this)),
        });
    };
    Rect.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    /**
     * 生成矩阵分面的分面数据
     * @param data
     */
    Rect.prototype.generateFacets = function (data) {
        var _this = this;
        var _a = this.cfg.fields, columnField = _a[0], rowField = _a[1];
        var rst = [];
        var columnValuesLength = 1;
        var rowValuesLength = 1;
        var columnValues = [''];
        var rowValues = [''];
        if (columnField) {
            columnValues = this.getFieldValues(data, columnField);
            columnValuesLength = columnValues.length;
        }
        if (rowField) {
            rowValues = this.getFieldValues(data, rowField);
            rowValuesLength = rowValues.length;
        }
        // 获取每个维度对应的数据配置片段
        columnValues.forEach(function (xVal, xIndex) {
            rowValues.forEach(function (yVal, yIndex) {
                var conditions = [
                    { field: columnField, value: xVal, values: columnValues },
                    { field: rowField, value: yVal, values: rowValues },
                ];
                var facetData = util_1.filter(data, _this.getFacetDataFilter(conditions));
                var facet = {
                    type: _this.cfg.type,
                    data: facetData,
                    region: _this.getRegion(rowValuesLength, columnValuesLength, xIndex, yIndex),
                    columnValue: xVal,
                    rowValue: yVal,
                    columnField: columnField,
                    rowField: rowField,
                    columnIndex: xIndex,
                    rowIndex: yIndex,
                    columnValuesLength: columnValuesLength,
                    rowValuesLength: rowValuesLength,
                };
                rst.push(facet);
            });
        });
        return rst;
    };
    Rect.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet, facetIndex) {
            var columnIndex = facet.columnIndex, rowIndex = facet.rowIndex, columnValuesLength = facet.columnValuesLength, columnValue = facet.columnValue, rowValue = facet.rowValue, view = facet.view;
            // top
            if (rowIndex === 0) {
                var formatter = util_1.get(_this.cfg.columnTitle, 'formatter');
                var config = util_1.deepMix({
                    position: ['50%', '0%'],
                    content: formatter ? formatter(columnValue) : columnValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.columnTitle);
                view.annotation().text(config);
            }
            // right
            if (columnIndex === columnValuesLength - 1) {
                var formatter = util_1.get(_this.cfg.rowTitle, 'formatter');
                var config = util_1.deepMix({
                    position: ['100%', '50%'],
                    content: formatter ? formatter(rowValue) : rowValue,
                }, facet_1.getFactTitleConfig(constant_1.DIRECTION.RIGHT), _this.cfg.rowTitle);
                view.annotation().text(config);
            }
        });
    };
    /**
     * 设置 x 坐标轴的文本、title 是否显示
     * @param x
     * @param axes
     * @param option
     * @param facet
     */
    Rect.prototype.getXAxisOption = function (x, axes, option, facet) {
        // 非最后一行
        if (facet.rowIndex !== facet.rowValuesLength - 1) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        else if (facet.columnIndex !== Math.floor((facet.columnValuesLength - 1) / 2)) {
            // 不是中间列
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null });
        }
        return option;
    };
    /**
     * 设置 y 坐标轴的文本、title 是否显示
     * @param y
     * @param axes
     * @param option
     * @param facet
     */
    Rect.prototype.getYAxisOption = function (y, axes, option, facet) {
        if (facet.columnIndex !== 0) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        else if (facet.rowIndex !== Math.floor((facet.rowValuesLength - 1) / 2)) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null });
        }
        return option;
    };
    return Rect;
}(facet_2.Facet));
exports.default = Rect;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],248:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-10
 */
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var facet_1 = require("../util/facet");
var facet_2 = require("./facet");
/**
 * @ignore
 * Tree Facet
 */
var Tree = /** @class */ (function (_super) {
    tslib_1.__extends(Tree, _super);
    function Tree() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.afterChartRender = function () {
            if (_this.facets && _this.cfg.line) {
                _this.container.clear();
                _this.drawLines(_this.facets);
            }
        };
        return _this;
    }
    Tree.prototype.afterEachView = function (view, facet) {
        this.processAxis(view, facet);
    };
    Tree.prototype.beforeEachView = function (view, facet) { };
    Tree.prototype.init = function () {
        _super.prototype.init.call(this);
        this.view.on(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, this.afterChartRender);
    };
    Tree.prototype.getDefaultCfg = function () {
        return util_1.deepMix({}, _super.prototype.getDefaultCfg.call(this), {
            type: 'tree',
            line: {
                style: {
                    lineWidth: 1,
                    stroke: '#ddd',
                },
                smooth: false,
            },
            showTitle: true,
            title: _super.prototype.getDefaultTitleCfg.call(this),
        });
    };
    Tree.prototype.generateFacets = function (data) {
        var fields = this.cfg.fields;
        if (!fields.length) {
            throw new Error('Please specify for the fields for rootFacet!');
        }
        var rst = [];
        var rootFacet = {
            type: this.cfg.type,
            data: data,
            region: null,
            rowValuesLength: this.getRows(),
            columnValuesLength: 1,
            rowIndex: 0,
            columnIndex: 0,
            rowField: '',
            columnField: '',
            rowValue: '',
            columnValue: '',
        };
        rst.push(rootFacet);
        rootFacet.children = this.getChildFacets(data, 1, rst);
        this.setRegion(rst);
        return rst;
    };
    Tree.prototype.setRegion = function (facets) {
        var _this = this;
        this.forceColIndex(facets);
        facets.forEach(function (facet) {
            // @ts-ignore 允许调整
            facet.region = _this.getRegion(facet.rowValuesLength, facet.columnValuesLength, facet.columnIndex, facet.rowIndex);
        });
    };
    Tree.prototype.getRegion = function (rows, cols, xIndex, yIndex) {
        var xWidth = 1 / cols; // x轴方向的每个分面的偏移
        var yWidth = 1 / rows; // y轴方向的每个分面的偏移
        var start = {
            x: xWidth * xIndex,
            y: yWidth * yIndex,
        };
        var end = {
            x: start.x + xWidth,
            y: start.y + (yWidth * 2) / 3,
        };
        return {
            start: start,
            end: end,
        };
    };
    Tree.prototype.forceColIndex = function (facets) {
        var _this = this;
        var leafs = [];
        var index = 0;
        facets.forEach(function (facet) {
            if (_this.isLeaf(facet)) {
                leafs.push(facet);
                // @ts-ignore 允许调整
                facet.columnIndex = index;
                index++;
            }
        });
        leafs.forEach(function (facet) {
            // @ts-ignore
            facet.columnValuesLength = leafs.length;
        });
        var maxLevel = this.cfg.fields.length;
        for (var i = maxLevel - 1; i >= 0; i--) {
            var levelFacets = this.getFacetsByLevel(facets, i);
            // var yIndex = maxLevel - i;
            for (var _i = 0, levelFacets_1 = levelFacets; _i < levelFacets_1.length; _i++) {
                var facet = levelFacets_1[_i];
                if (!this.isLeaf(facet)) {
                    facet.originColIndex = facet.columnIndex;
                    // @ts-ignore
                    facet.columnIndex = this.getRegionIndex(facet.children);
                    // @ts-ignore
                    facet.columnValuesLength = leafs.length;
                }
            }
        }
    };
    // get facet use level
    Tree.prototype.getFacetsByLevel = function (facets, level) {
        var rst = [];
        facets.forEach(function (facet) {
            if (facet.rowIndex === level) {
                rst.push(facet);
            }
        });
        return rst;
    };
    // if the facet has children , make it's column index in the middle of it's children
    Tree.prototype.getRegionIndex = function (children) {
        var first = children[0];
        var last = children[children.length - 1];
        return (last.columnIndex - first.columnIndex) / 2 + first.columnIndex;
    };
    // is  a leaf without children
    Tree.prototype.isLeaf = function (facet) {
        return !facet.children || !facet.children.length;
    };
    Tree.prototype.getRows = function () {
        return this.cfg.fields.length + 1;
    };
    // get child
    Tree.prototype.getChildFacets = function (data, level, arr) {
        var _this = this;
        // [ 'grade', 'class' ]
        var fields = this.cfg.fields;
        var length = fields.length;
        if (length < level) {
            return;
        }
        var rst = [];
        // get fist level except root node
        var field = fields[level - 1];
        // get field value
        var values = this.getFieldValues(data, field);
        values.forEach(function (value, index) {
            var conditions = [{ field: field, value: value, values: values }];
            var subData = data.filter(_this.getFacetDataFilter(conditions));
            if (subData.length) {
                var facet = {
                    type: _this.cfg.type,
                    data: subData,
                    region: null,
                    columnValue: value,
                    rowValue: '',
                    columnField: field,
                    rowField: '',
                    columnIndex: index,
                    rowValuesLength: _this.getRows(),
                    columnValuesLength: 1,
                    rowIndex: level,
                    children: _this.getChildFacets(subData, level + 1, arr),
                };
                rst.push(facet);
                arr.push(facet);
            }
        });
        return rst;
    };
    Tree.prototype.render = function () {
        _super.prototype.render.call(this);
        if (this.cfg.showTitle) {
            this.renderTitle();
        }
    };
    Tree.prototype.renderTitle = function () {
        var _this = this;
        util_1.each(this.facets, function (facet) {
            var columnValue = facet.columnValue, view = facet.view;
            var formatter = util_1.get(_this.cfg.title, 'formatter');
            var config = util_1.deepMix({
                position: ['50%', '0%'],
                content: formatter ? formatter(columnValue) : columnValue,
            }, facet_1.getFactTitleConfig(constant_1.DIRECTION.TOP), _this.cfg.title);
            view.annotation().text(config);
        });
    };
    Tree.prototype.drawLines = function (facets) {
        var _this = this;
        facets.forEach(function (facet) {
            if (!_this.isLeaf(facet)) {
                var children = facet.children;
                _this.addFacetLines(facet, children);
            }
        });
    };
    // add lines with it's children
    Tree.prototype.addFacetLines = function (facet, children) {
        var _this = this;
        var view = facet.view;
        var region = view.coordinateBBox;
        // top, right, bottom, left
        var start = {
            x: region.x + region.width / 2,
            y: region.y + region.height,
        };
        children.forEach(function (subFacet) {
            var subRegion = subFacet.view.coordinateBBox;
            var end = {
                x: subRegion.bl.x + (subRegion.tr.x - subRegion.bl.x) / 2,
                y: subRegion.tr.y,
            };
            var middle1 = {
                x: start.x,
                y: start.y + (end.y - start.y) / 2,
            };
            var middle2 = {
                x: end.x,
                y: middle1.y,
            };
            _this.drawLine([start, middle1, middle2, end]);
        });
    };
    Tree.prototype.getPath = function (points) {
        var path = [];
        var smooth = this.cfg.line.smooth;
        if (smooth) {
            path.push(['M', points[0].x, points[0].y]);
            path.push(['C', points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y]);
        }
        else {
            points.forEach(function (point, index) {
                if (index === 0) {
                    path.push(['M', point.x, point.y]);
                }
                else {
                    path.push(['L', point.x, point.y]);
                }
            });
        }
        return path;
    };
    // draw line width points
    Tree.prototype.drawLine = function (points) {
        var path = this.getPath(points);
        var line = this.cfg.line.style;
        this.container.addShape('path', {
            attrs: util_1.assign({
                // @ts-ignore
                path: path,
            }, line),
        });
    };
    Tree.prototype.getXAxisOption = function (x, axes, option, facet) {
        if (facet.rowIndex !== facet.rowValuesLength - 1) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        return option;
    };
    Tree.prototype.getYAxisOption = function (y, axes, option, facet) {
        if (facet.originColIndex !== 0 && facet.columnIndex !== 0) {
            return tslib_1.__assign(tslib_1.__assign({}, option), { title: null, label: null });
        }
        return option;
    };
    return Tree;
}(facet_2.Facet));
exports.default = Tree;

},{"../constant":237,"../util/facet":374,"./facet":242,"@antv/util":803,"tslib":385}],249:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var constant_1 = require("../constant");
var path_1 = tslib_1.__importDefault(require("./path"));
require("./shape/area");
/**
 * Area 几何标记类。
 * 常用于绘制面积图。
 */
var Area = /** @class */ (function (_super) {
    tslib_1.__extends(Area, _super);
    function Area(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'area';
        _this.shapeType = 'area';
        /** 生成图形关键点 */
        _this.generatePoints = true;
        /**
         * 面积图是否从 0 基准线开始填充。
         * 1. 默认值为 `true`，表现如下：
         * ![image](https://gw.alipayobjects.com/zos/rmsportal/ZQqwUCczalrKqGgagOVp.png)
         * 2. 当值为 `false` 时，表现如下：
         * ![image](https://gw.alipayobjects.com/zos/rmsportal/yPswkaXvUpCYOdhocGwB.png)
         */
        _this.startOnZero = true;
        var _a = cfg.startOnZero, startOnZero = _a === void 0 ? true : _a, _b = cfg.sortable, sortable = _b === void 0 ? true : _b, _c = cfg.showSinglePoint, showSinglePoint = _c === void 0 ? false : _c;
        _this.startOnZero = startOnZero; // 默认为 true
        _this.sortable = sortable; // Area 默认会对数据按照 x 轴字段进行正向排序
        _this.showSinglePoint = showSinglePoint;
        return _this;
    }
    /**
     * 获取图形绘制的关键点以及数据
     * @param mappingData 映射后的数据
     */
    Area.prototype.getPointsAndData = function (mappingData) {
        var points = [];
        var data = [];
        for (var i = 0, len = mappingData.length; i < len; i++) {
            var obj = mappingData[i];
            points.push(obj.points);
            data.push(obj[constant_1.FIELD_ORIGIN]);
        }
        return {
            points: points,
            data: data,
        };
    };
    /**
     * 获取 Y 轴上的最小值
     * @returns y 字段最小值
     */
    Area.prototype.getYMinValue = function () {
        if (this.startOnZero) {
            return _super.prototype.getYMinValue.call(this);
        }
        var yScale = this.getYScale();
        return yScale.min;
    };
    return Area;
}(path_1.default));
exports.default = Area;

},{"../constant":237,"./path":266,"./shape/area":270,"tslib":385}],250:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var adjust_1 = require("@antv/adjust");
var attr_1 = require("@antv/attr");
var util_1 = require("@antv/util");
var animate_1 = require("../animate");
var base_1 = tslib_1.__importDefault(require("../base"));
var constant_1 = require("../constant");
var helper_1 = require("../util/helper");
var element_1 = tslib_1.__importDefault(require("./element"));
var label_1 = require("./label");
var base_2 = require("./shape/base");
var group_data_1 = require("./util/group-data");
var is_model_change_1 = require("./util/is-model-change");
var parse_fields_1 = require("./util/parse-fields");
// 根据 elementId 查找对应的 label，因为有可能一个 element 对应多个 labels，所以在给 labels 打标识时做了处理
// 打标规则详见 ./label/base.ts#L263
function filterLabelsById(id, labelsMap) {
    var labels = [];
    util_1.each(labelsMap, function (label, labelId) {
        var elementId = labelId.split(' ')[0];
        if (elementId === id) {
            labels.push(label);
        }
    });
    return labels;
}
/**
 * Geometry 几何标记基类，主要负责数据到图形属性的映射以及绘制逻辑。
 */
var Geometry = /** @class */ (function (_super) {
    tslib_1.__extends(Geometry, _super);
    /**
     * 创建 Geometry 实例。
     * @param cfg
     */
    function Geometry(cfg) {
        var _this = _super.call(this, cfg) || this;
        /** Geometry 几何标记类型。 */
        _this.type = 'base';
        // 内部产生的属性
        /** Attribute map  */
        _this.attributes = {};
        /** Element map */
        _this.elements = [];
        /** 使用 key-value 结构存储 Element，key 为每个 Element 实例对应的唯一 ID */
        _this.elementsMap = {};
        /** animate 配置项 */
        _this.animateOption = true;
        /** 图形属性映射配置 */
        _this.attributeOption = {};
        /** 存储上一次渲染时的 element 映射表，用于更新逻辑 */
        _this.lastElementsMap = {};
        /** 是否生成多个点来绘制图形。 */
        _this.generatePoints = false;
        /** 存储发生图形属性映射前的数据 */
        _this.beforeMappingData = null;
        _this.adjusts = {};
        _this.idFields = [];
        _this.hasSorted = false;
        _this.isCoordinateChanged = false;
        var container = cfg.container, labelsContainer = cfg.labelsContainer, coordinate = cfg.coordinate, data = cfg.data, _a = cfg.sortable, sortable = _a === void 0 ? false : _a, _b = cfg.visible, visible = _b === void 0 ? true : _b, theme = cfg.theme, _c = cfg.scales, scales = _c === void 0 ? {} : _c, _d = cfg.scaleDefs, scaleDefs = _d === void 0 ? {} : _d;
        _this.container = container;
        _this.labelsContainer = labelsContainer;
        _this.coordinate = coordinate;
        _this.data = data;
        _this.sortable = sortable;
        _this.visible = visible;
        _this.userTheme = theme;
        _this.scales = scales;
        _this.scaleDefs = scaleDefs;
        return _this;
    }
    /**
     * 配置 position 通道映射规则。
     *
     * @example
     * ```typescript
     * // 数据结构: [{ x: 'A', y: 10, color: 'red' }]
     * geometry.position('x*y');
     * geometry.position([ 'x', 'y' ]);
     * geometry.position({
     *   fields: [ 'x', 'y' ],
     * });
     * ```
     *
     * @param cfg 映射规则
     * @returns
     */
    Geometry.prototype.position = function (cfg) {
        var positionCfg = cfg;
        if (!util_1.isPlainObject(cfg)) {
            // 字符串字段或者数组字段
            positionCfg = {
                fields: parse_fields_1.parseFields(cfg),
            };
        }
        var fields = util_1.get(positionCfg, 'fields');
        if (fields.length === 1) {
            // 默认填充一维 1*xx
            fields.unshift('1');
            util_1.set(positionCfg, 'fields', fields);
        }
        util_1.set(this.attributeOption, 'position', positionCfg);
        return this;
    };
    Geometry.prototype.color = function (field, cfg) {
        this.createAttrOption('color', field, cfg);
        return this;
    };
    Geometry.prototype.shape = function (field, cfg) {
        this.createAttrOption('shape', field, cfg);
        return this;
    };
    Geometry.prototype.size = function (field, cfg) {
        this.createAttrOption('size', field, cfg);
        return this;
    };
    /**
     * 设置数据调整方式。G2 目前内置了四种类型：
     * 1. dodge
     * 2. stack
     * 3. symmetric
     * 4. jitter
     *
     *
     * **Tip**
     * + 对于 'dodge' 类型，可以额外进行如下属性的配置:
     * ```typescript
     * geometry.adjust('dodge', {
     *   marginRatio: 0, // 取 0 到 1 范围的值（相对于每个柱子宽度），用于控制一个分组中柱子之间的间距
     *   dodgeBy: 'x', // 该属性只对 'dodge' 类型生效，声明以哪个数据字段为分组依据
     * });
     * ```
     *
     * + 对于 'stack' 类型，可以额外进行如下属性的配置:
     * ```typescript
     * geometry.adjust('stack', {
     *   reverseOrder: false, // 用于控制是否对数据进行反序操作
     * });
     * ```
     *
     * @example
     * ```typescript
     * geometry.adjust('stack');
     *
     * geometry.adjust({
     *   type: 'stack',
     *   reverseOrder: false,
     * });
     *
     * // 组合使用 adjust
     * geometry.adjust([ 'stack', 'dodge' ]);
     *
     * geometry.adjust([
     *   { type: 'stack' },
     *   { type: 'dodge', dodgeBy: 'x' },
     * ]);
     * ```
     *
     * @param adjustCfg 数据调整配置
     * @returns
     */
    Geometry.prototype.adjust = function (adjustCfg) {
        var adjusts = adjustCfg;
        if (util_1.isString(adjustCfg) || util_1.isPlainObject(adjustCfg)) {
            adjusts = [adjustCfg];
        }
        util_1.each(adjusts, function (adjust, index) {
            if (!util_1.isObject(adjust)) {
                adjusts[index] = { type: adjust };
            }
        });
        this.adjustOption = adjusts;
        return this;
    };
    Geometry.prototype.style = function (field, styleFunc) {
        if (util_1.isString(field)) {
            var fields = parse_fields_1.parseFields(field);
            this.styleOption = {
                fields: fields,
                callback: styleFunc,
            };
        }
        else {
            var _a = field, fields = _a.fields, callback = _a.callback, cfg = _a.cfg;
            if (fields || callback || cfg) {
                this.styleOption = field;
            }
            else {
                this.styleOption = {
                    cfg: field,
                };
            }
        }
        return this;
    };
    Geometry.prototype.tooltip = function (field, cfg) {
        if (util_1.isString(field)) {
            var fields = parse_fields_1.parseFields(field);
            this.tooltipOption = {
                fields: fields,
                callback: cfg,
            };
        }
        else {
            this.tooltipOption = field;
        }
        return this;
    };
    /**
     * Geometry 动画配置。
     *
     * + `animate(false)` 关闭动画
     * + `animate(true)` 开启动画，默认开启。
     *
     * 我们将动画分为四个场景：
     * 1. appear: 图表第一次加载时的入场动画；
     * 2. enter: 图表绘制完成，发生更新后，产生的新图形的进场动画；
     * 3. update: 图表绘制完成，数据发生变更后，有状态变更的图形的更新动画；
     * 4. leave: 图表绘制完成，数据发生变更后，被销毁图形的销毁动画。
     *
     * @example
     * ```typescript
     * animate({
     *   enter: {
     *     duration: 1000, // enter 动画执行时间
     *   },
     *   leave: false, // 关闭 leave 销毁动画
     * });
     * ```
     *
     * @param cfg 动画配置
     * @returns
     */
    Geometry.prototype.animate = function (cfg) {
        this.animateOption = cfg;
        return this;
    };
    Geometry.prototype.label = function (field, secondParam, thirdParam) {
        if (util_1.isString(field)) {
            var labelOption = {};
            var fields = parse_fields_1.parseFields(field);
            labelOption.fields = fields;
            if (util_1.isFunction(secondParam)) {
                labelOption.callback = secondParam;
            }
            else if (util_1.isPlainObject(secondParam)) {
                labelOption.cfg = secondParam;
            }
            if (thirdParam) {
                labelOption.cfg = thirdParam;
            }
            this.labelOption = labelOption;
        }
        else {
            this.labelOption = field;
        }
        return this;
    };
    /**
     * 设置状态对应的样式。
     *
     * @example
     * ```ts
     * chart.interval().state({
     *   selected: {
     *     animate: { duration: 100, easing: 'easeLinear' },
     *     style: {
     *       lineWidth: 2,
     *       stroke: '#000',
     *     },
     *   },
     * });
     * ```
     *
     * 如果图形 shape 是由多个 shape 组成，即为一个 G.Group 对象，那么针对 group 中的每个 shape，我们需要使用下列方式进行状态样式设置：
     * 如果我们为 group 中的每个 shape 设置了 'name' 属性(shape.set('name', 'xx'))，则以 'name' 作为 key，否则默认以索引值（即 shape 的 添加顺序）为 key。
     *
     * ```ts
     * chart.interval().shape('groupShape').state({
     *   selected: {
     *     style: {
     *       0: { lineWidth: 2 },
     *       1: { fillOpacity: 1 },
     *     }
     *   }
     * });
     * ```
     *
     * @param cfg 状态样式
     */
    Geometry.prototype.state = function (cfg) {
        this.stateOption = cfg;
        return this;
    };
    /**
     * 初始化 Geomtry 实例：
     * 创建 [[Attribute]] and [[Scale]] 实例，进行数据处理，包括分组、数值化以及数据调整。
     */
    Geometry.prototype.init = function (cfg) {
        if (cfg === void 0) { cfg = {}; }
        this.setCfg(cfg);
        this.initAttributes(); // 创建图形属性
        // 数据加工：分组 -> 数字化 -> adjust
        this.processData(this.data);
        // 调整 scale
        this.adjustScale();
    };
    /**
     * Geometry 更新。
     * @param [cfg] 更新的配置
     */
    Geometry.prototype.update = function (cfg) {
        if (cfg === void 0) { cfg = {}; }
        var data = cfg.data, isDataChanged = cfg.isDataChanged, isCoordinateChanged = cfg.isCoordinateChanged;
        var _a = this, attributeOption = _a.attributeOption, lastAttributeOption = _a.lastAttributeOption;
        if (!util_1.isEqual(attributeOption, lastAttributeOption)) {
            // 映射发生改变，则重新创建图形属性
            this.init(cfg);
        }
        else if (data && (isDataChanged || !util_1.isEqual(data, this.data))) {
            // 数据发生变化
            this.setCfg(cfg);
            this.processData(data); // 数据加工：分组 -> 数字化 -> adjust
        }
        else {
            // 有可能 coordinate 变化
            this.setCfg(cfg);
        }
        // 调整 scale
        this.adjustScale();
        this.isCoordinateChanged = isCoordinateChanged;
    };
    /**
     * 将原始数据映射至图形空间，同时创建图形对象。
     */
    Geometry.prototype.paint = function (isUpdate) {
        var _this = this;
        if (isUpdate === void 0) { isUpdate = false; }
        if (this.animateOption) {
            this.animateOption = util_1.deepMix({}, animate_1.getDefaultAnimateCfg(this.type, this.coordinate), this.animateOption);
        }
        this.defaultSize = undefined;
        this.elements = [];
        this.elementsMap = {};
        var offscreenGroup = this.getOffscreenGroup();
        offscreenGroup.clear();
        var beforeMappingData = this.beforeMappingData;
        var dataArray = this.beforeMapping(beforeMappingData);
        var mappingArray = [];
        for (var index = 0, length_1 = dataArray.length; index < length_1; index++) {
            var eachGroup = dataArray[index];
            var mappingData = this.mapping(eachGroup);
            mappingArray.push(mappingData);
            this.createElements(mappingData, index, isUpdate);
        }
        if (this.canDoGroupAnimation(isUpdate)) {
            // 如果用户没有配置 appear.animation，就默认走整体动画
            var container = this.container;
            var type = this.type;
            var coordinate = this.coordinate;
            var animateCfg = util_1.get(this.animateOption, 'appear');
            var yScale = this.getYScale();
            var yMinPoint = coordinate.convert({
                x: 0,
                y: yScale.scale(this.getYMinValue()),
            });
            animate_1.doGroupAppearAnimate(container, animateCfg, type, coordinate, yMinPoint);
        }
        // 添加 label
        if (this.labelOption) {
            this.renderLabels(util_1.flatten(mappingArray), isUpdate);
        }
        this.dataArray = mappingArray;
        // 销毁被删除的 elements
        util_1.each(this.lastElementsMap, function (deletedElement) {
            // 更新动画配置，用户有可能在更新之前有对动画进行配置操作
            deletedElement.animate = _this.animateOption;
            deletedElement.destroy();
        });
        this.lastElementsMap = this.elementsMap;
        // 缓存，用于更新
        this.lastAttributeOption = tslib_1.__assign({}, this.attributeOption);
        if (this.visible === false) {
            // 用户在初始化的时候声明 visible: false
            this.changeVisible(false);
        }
    };
    /**
     * 清空当前 Geometry，配置项仍保留，但是内部创建的对象全部清空。
     * @override
     */
    Geometry.prototype.clear = function () {
        var _a = this, container = _a.container, geometryLabel = _a.geometryLabel, offscreenGroup = _a.offscreenGroup;
        if (container) {
            container.clear();
        }
        if (geometryLabel) {
            geometryLabel.clear();
        }
        if (offscreenGroup) {
            offscreenGroup.clear();
        }
        // 属性恢复至出厂状态
        this.scaleDefs = undefined;
        this.attributes = {};
        this.scales = {};
        this.elementsMap = {};
        this.lastElementsMap = {};
        this.elements = [];
        this.adjusts = {};
        this.dataArray = null;
        this.beforeMappingData = null;
        this.lastAttributeOption = undefined;
        this.defaultSize = undefined;
        this.idFields = [];
        this.groupScales = undefined;
        this.hasSorted = false;
        this.isCoordinateChanged = false;
    };
    /**
     * 销毁 Geometry 实例。
     */
    Geometry.prototype.destroy = function () {
        this.clear();
        var container = this.container;
        container.remove(true);
        if (this.offscreenGroup) {
            this.offscreenGroup.remove(true);
            this.offscreenGroup = null;
        }
        if (this.geometryLabel) {
            this.geometryLabel.destroy();
            this.geometryLabel = null;
        }
        this.theme = undefined;
        this.shapeFactory = undefined;
        _super.prototype.destroy.call(this);
    };
    /**
     * 获取决定分组的图形属性对应的 scale 实例。
     * @returns
     */
    Geometry.prototype.getGroupScales = function () {
        return this.groupScales;
    };
    /**
     * 根据名字获取图形属性实例。
     */
    Geometry.prototype.getAttribute = function (name) {
        return this.attributes[name];
    };
    /** 获取 x 轴对应的 scale 实例。 */
    Geometry.prototype.getXScale = function () {
        return this.getAttribute('position').scales[0];
    };
    /** 获取 y 轴对应的 scale 实例。 */
    Geometry.prototype.getYScale = function () {
        return this.getAttribute('position').scales[1];
    };
    /**
     * 获取决定分组的图形属性实例。
     */
    Geometry.prototype.getGroupAttributes = function () {
        var rst = [];
        util_1.each(this.attributes, function (attr) {
            if (constant_1.GROUP_ATTRS.includes(attr.type)) {
                rst.push(attr);
            }
        });
        return rst;
    };
    /** 获取图形属性默认的映射值。 */
    Geometry.prototype.getDefaultValue = function (attrName) {
        var value;
        var attr = this.getAttribute(attrName);
        if (attr && util_1.isEmpty(attr.scales)) {
            // 获取映射至常量的值
            value = attr.values[0];
        }
        return value;
    };
    /**
     * 获取该数据发生图形映射后对应的 Attribute 图形空间数据。
     * @param attr Attribute 图形属性实例。
     * @param obj 需要进行映射的原始数据。
     * @returns
     */
    Geometry.prototype.getAttributeValues = function (attr, obj) {
        var params = [];
        var scales = attr.scales;
        for (var index = 0, length_2 = scales.length; index < length_2; index++) {
            var scale = scales[index];
            var field = scale.field;
            if (scale.isIdentity) {
                params.push(scale.values);
            }
            else {
                params.push(obj[field]);
            }
        }
        return attr.mapping.apply(attr, params);
    };
    Geometry.prototype.getAdjust = function (adjustType) {
        return this.adjusts[adjustType];
    };
    /**
     * 获取 shape 对应的 marker 样式。
     * @param shapeName shape 具体名字
     * @param cfg marker 信息
     * @returns
     */
    Geometry.prototype.getShapeMarker = function (shapeName, cfg) {
        var shapeFactory = this.getShapeFactory();
        return shapeFactory.getMarker(shapeName, cfg);
    };
    /**
     * 根据一定的规则查找 Geometry 的 Elements。
     *
     * ```typescript
     * getElementsBy((element) => {
     *   const data = element.getData();
     *
     *   return data.a === 'a';
     * });
     * ```
     *
     * @param condition 定义查找规则的回调函数。
     * @returns
     */
    Geometry.prototype.getElementsBy = function (condition) {
        return this.elements.filter(function (element) {
            return condition(element);
        });
    };
    /**
     * 获取数据对应的唯一 id。
     * @param data Element 对应的绘制数据
     * @returns
     */
    Geometry.prototype.getElementId = function (data) {
        data = util_1.isArray(data) ? data[0] : data;
        var originData = data[constant_1.FIELD_ORIGIN];
        // 如果用户声明了使用哪些字段作为 id 值
        if (this.idFields.length) {
            var elementId = originData[this.idFields[0]];
            for (var index = 1; index < this.idFields.length; index++) {
                elementId += '-' + originData[this.idFields[index]];
            }
            return elementId;
        }
        var type = this.type;
        var xScale = this.getXScale();
        var yScale = this.getYScale();
        var xField = xScale.field || 'x';
        var yField = yScale.field || 'y';
        var yVal = originData[yField];
        var xVal;
        if (xScale.type === 'identity') {
            xVal = xScale.values[0];
        }
        else {
            xVal = originData[xField];
        }
        var id;
        if (type === 'interval' || type === 'schema') {
            id = xVal;
        }
        else if (type === 'line' || type === 'area' || type === 'path') {
            id = type;
        }
        else {
            id = xVal + "-" + yVal;
        }
        var groupScales = this.groupScales;
        for (var index = 0, length_3 = groupScales.length; index < length_3; index++) {
            var groupScale = groupScales[index];
            var field = groupScale.field;
            id = id + "-" + originData[field];
        }
        // 用户在进行 dodge 类型的 adjust 调整的时候设置了 dodgeBy 属性
        var dodgeAdjust = this.getAdjust('dodge');
        if (dodgeAdjust) {
            var dodgeBy = dodgeAdjust.dodgeBy;
            if (dodgeBy) {
                id = id + "-" + originData[dodgeBy];
            }
        }
        if (this.getAdjust('jitter')) {
            id = id + "-" + data.x + "-" + data.y;
        }
        return id;
    };
    /**
     * 获取所有需要创建 scale 的字段名称。
     */
    Geometry.prototype.getScaleFields = function () {
        var fields = [];
        var tmpMap = {};
        var _a = this, attributeOption = _a.attributeOption, labelOption = _a.labelOption, tooltipOption = _a.tooltipOption;
        // 获取图形属性上的 fields
        for (var attributeType in attributeOption) {
            if (attributeOption.hasOwnProperty(attributeType)) {
                var eachOpt = attributeOption[attributeType];
                if (eachOpt.fields) {
                    helper_1.uniq(eachOpt.fields, fields, tmpMap);
                }
                else if (eachOpt.values) {
                    // 考虑 size(10), shape('circle') 等场景
                    helper_1.uniq(eachOpt.values, fields, tmpMap);
                }
            }
        }
        // 获取 label 上的字段
        if (labelOption && labelOption.fields) {
            helper_1.uniq(labelOption.fields, fields, tmpMap);
        }
        // 获取 tooltip 上的字段
        if (util_1.isObject(tooltipOption) && tooltipOption.fields) {
            helper_1.uniq(tooltipOption.fields, fields, tmpMap);
        }
        return fields;
    };
    /**
     * 显示或者隐藏 geometry。
     * @param visible
     */
    Geometry.prototype.changeVisible = function (visible) {
        _super.prototype.changeVisible.call(this, visible);
        var elements = this.elements;
        for (var index = 0, length_4 = elements.length; index < length_4; index++) {
            var element = elements[index];
            element.changeVisible(visible);
        }
        if (visible) {
            if (this.container) {
                this.container.show();
            }
            if (this.labelsContainer) {
                this.labelsContainer.show();
            }
        }
        else {
            if (this.container) {
                this.container.hide();
            }
            if (this.labelsContainer) {
                this.labelsContainer.hide();
            }
        }
    };
    /**
     * 获取当前配置中的所有分组 & 分类的字段。
     * @return fields string[]
     */
    Geometry.prototype.getGroupFields = function () {
        var groupFields = [];
        var tmpMap = {}; // 用于去重过滤
        for (var index = 0, length_5 = constant_1.GROUP_ATTRS.length; index < length_5; index++) {
            var attributeName = constant_1.GROUP_ATTRS[index];
            var cfg = this.attributeOption[attributeName];
            if (cfg && cfg.fields) {
                helper_1.uniq(cfg.fields, groupFields, tmpMap);
            }
        }
        return groupFields;
    };
    /**
     * 获得图形的 x y 字段。
     */
    Geometry.prototype.getXYFields = function () {
        var _a = this.attributeOption.position.fields, x = _a[0], y = _a[1];
        return [x, y];
    };
    /**
     * 获取该 Geometry 下所有生成的 shapes。
     * @returns shapes
     */
    Geometry.prototype.getShapes = function () {
        return this.elements.map(function (element) { return element.shape; });
    };
    /**
     * 获取虚拟 Group。
     * @returns
     */
    Geometry.prototype.getOffscreenGroup = function () {
        if (!this.offscreenGroup) {
            var GroupCtor = this.container.getGroupBase(); // 获取分组的构造函数
            this.offscreenGroup = new GroupCtor({});
        }
        return this.offscreenGroup;
    };
    // 对数据进行排序
    Geometry.prototype.sort = function (mappingArray) {
        if (!this.hasSorted) {
            // 未发生过排序
            var xScale_1 = this.getXScale();
            var xField_1 = xScale_1.field;
            for (var index = 0; index < mappingArray.length; index++) {
                var itemArr = mappingArray[index];
                itemArr.sort(function (obj1, obj2) {
                    return xScale_1.translate(obj1[constant_1.FIELD_ORIGIN][xField_1]) - xScale_1.translate(obj2[constant_1.FIELD_ORIGIN][xField_1]);
                });
            }
        }
        this.hasSorted = true;
    };
    /**
     * 调整度量范围。主要针对发生层叠以及一些特殊需求的 Geometry，比如 Interval 下的柱状图 Y 轴默认从 0 开始。
     */
    Geometry.prototype.adjustScale = function () {
        var yScale = this.getYScale();
        // 如果数据发生过 stack adjust，需要调整下 yScale 的数据范围
        if (yScale && this.getAdjust('stack')) {
            this.updateStackRange(yScale, this.beforeMappingData);
        }
    };
    /**
     * 获取当前 Geometry 对应的 Shape 工厂实例。
     */
    Geometry.prototype.getShapeFactory = function () {
        var shapeType = this.shapeType;
        if (!base_2.getShapeFactory(shapeType)) {
            return;
        }
        if (!this.shapeFactory) {
            this.shapeFactory = util_1.clone(base_2.getShapeFactory(shapeType)); // 防止多个 view 共享一个 shapeFactory 实例，导致 coordinate 被篡改
        }
        // 因为这里缓存了 shapeFactory，但是外部可能会变更 coordinate，导致无法重新设置到 shapeFactory 中
        this.shapeFactory.coordinate = this.coordinate;
        // theme 原因同上
        this.shapeFactory.theme = this.theme.geometries[shapeType] || {};
        return this.shapeFactory;
    };
    /**
     * 获取每个 Shape 对应的关键点数据。
     * @param obj 经过分组 -> 数字化 -> adjust 调整后的数据记录
     * @returns
     */
    Geometry.prototype.createShapePointsCfg = function (obj) {
        var xScale = this.getXScale();
        var yScale = this.getYScale();
        var x = this.normalizeValues(obj[xScale.field], xScale);
        var y; // 存在没有 y 的情况
        if (yScale) {
            y = this.normalizeValues(obj[yScale.field], yScale);
        }
        else {
            y = obj.y ? obj.y : 0.1;
        }
        return {
            x: x,
            y: y,
            y0: yScale ? yScale.scale(this.getYMinValue()) : undefined,
        };
    };
    /**
     * 创建 Element 实例。
     * @param mappingDatum Element 对应的绘制数据
     * @param [isUpdate] 是否处于更新阶段
     * @returns element 返回创建的 Element 实例
     */
    Geometry.prototype.createElement = function (mappingDatum, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var container = this.container;
        var shapeCfg = this.getDrawCfg(mappingDatum); // 获取绘制图形的配置信息
        var shapeFactory = this.getShapeFactory();
        var element = new element_1.default({
            shapeFactory: shapeFactory,
            container: container,
            offscreenGroup: this.getOffscreenGroup(),
        });
        element.animate = this.animateOption;
        element.geometry = this;
        element.draw(shapeCfg, isUpdate); // 绘制
        return element;
    };
    /**
     * 获取每条数据对应的图形绘制数据。
     * @param mappingDatum 映射后的数据
     * @returns draw cfg
     */
    Geometry.prototype.getDrawCfg = function (mappingDatum) {
        var originData = mappingDatum[constant_1.FIELD_ORIGIN]; // 原始数据
        var cfg = {
            mappingData: mappingDatum,
            data: originData,
            x: mappingDatum.x,
            y: mappingDatum.y,
            color: mappingDatum.color,
            size: mappingDatum.size,
            isInCircle: this.coordinate.isPolar,
        };
        var shapeName = mappingDatum.shape;
        if (!shapeName && this.getShapeFactory()) {
            shapeName = this.getShapeFactory().defaultShapeType;
        }
        cfg.shape = shapeName;
        // 获取默认样式
        var theme = this.theme.geometries[this.shapeType];
        cfg.defaultStyle = util_1.get(theme, [shapeName, 'default'], {}).style;
        var styleOption = this.styleOption;
        if (styleOption) {
            cfg.style = this.getStyleCfg(styleOption, originData);
        }
        if (this.generatePoints) {
            cfg.points = mappingDatum.points;
            cfg.nextPoints = mappingDatum.nextPoints;
        }
        return cfg;
    };
    /**
     * 创建所有的 Elements。
     * @param mappingData
     * @param [isUpdate]
     * @returns elements
     */
    Geometry.prototype.createElements = function (mappingData, index, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var _a = this, lastElementsMap = _a.lastElementsMap, elementsMap = _a.elementsMap, elements = _a.elements;
        for (var subIndex = 0, length_6 = mappingData.length; subIndex < length_6; subIndex++) {
            var mappingDatum = mappingData[subIndex];
            var id = this.getElementId(mappingDatum);
            if (elementsMap[id]) {
                // 存在重复数据，则根据再根据 index 进行区分
                id = id + "-" + index + "-" + subIndex;
            }
            var result = lastElementsMap[id];
            if (!result) {
                // 创建新的 element
                result = this.createElement(mappingDatum, isUpdate);
            }
            else {
                // element 已经创建
                var currentShapeCfg = this.getDrawCfg(mappingDatum);
                var preShapeCfg = result.getModel();
                if (this.isCoordinateChanged || is_model_change_1.isModelChange(currentShapeCfg, preShapeCfg)) {
                    result.animate = this.animateOption;
                    // 通过绘制数据的变更来判断是否需要更新，因为用户有可能会修改图形属性映射
                    result.update(currentShapeCfg); // 更新对应的 element
                }
                delete lastElementsMap[id];
            }
            elements.push(result);
            elementsMap[id] = result;
        }
        return elements;
    };
    /**
     * 获取渲染的 label 类型。
     */
    Geometry.prototype.getLabelType = function () {
        var _a = this, labelOption = _a.labelOption, coordinate = _a.coordinate, type = _a.type;
        var coordinateType = coordinate.type;
        var labelType = util_1.get(labelOption, ['cfg', 'type']);
        if (!labelType) {
            // 用户未定义，则进行默认的逻辑
            if (coordinateType === 'polar') {
                // 极坐标下使用通用的极坐标文本
                labelType = 'polar';
            }
            else if (coordinateType === 'theta') {
                // theta 坐标系下使用饼图文本
                labelType = 'pie';
            }
            else if (type === 'interval' || type === 'polygon') {
                labelType = 'interval';
            }
            else {
                labelType = 'base';
            }
        }
        return labelType;
    };
    /**
     * 获取 Y 轴上的最小值。
     */
    Geometry.prototype.getYMinValue = function () {
        var yScale = this.getYScale();
        var min = yScale.min, max = yScale.max;
        var value;
        if (min >= 0) {
            value = min;
        }
        else if (max <= 0) {
            // 当值全位于负区间时，需要保证 ymin 在区域内，不可为 0
            value = max;
        }
        else {
            value = 0;
        }
        return value;
    };
    // 创建图形属性相关的配置项
    Geometry.prototype.createAttrOption = function (attrName, field, cfg) {
        if (util_1.isNil(field) || util_1.isObject(field)) {
            if (util_1.isObject(field) && util_1.isEqual(Object.keys(field), ['values'])) {
                // shape({ values: [ 'funnel' ] })
                util_1.set(this.attributeOption, attrName, {
                    fields: field.values,
                });
            }
            else {
                util_1.set(this.attributeOption, attrName, field);
            }
        }
        else {
            var attrCfg = {};
            if (util_1.isNumber(field)) {
                // size(3)
                attrCfg.values = [field];
            }
            else {
                attrCfg.fields = parse_fields_1.parseFields(field);
            }
            if (cfg) {
                if (util_1.isFunction(cfg)) {
                    attrCfg.callback = cfg;
                }
                else {
                    attrCfg.values = cfg;
                }
            }
            util_1.set(this.attributeOption, attrName, attrCfg);
        }
    };
    Geometry.prototype.initAttributes = function () {
        var _this = this;
        var _a = this, attributes = _a.attributes, attributeOption = _a.attributeOption, theme = _a.theme, shapeType = _a.shapeType;
        this.groupScales = [];
        var tmpMap = {};
        var _loop_1 = function (attrType) {
            if (attributeOption.hasOwnProperty(attrType)) {
                var option = attributeOption[attrType];
                if (!option) {
                    return { value: void 0 };
                }
                var attrCfg = tslib_1.__assign({}, option);
                var callback = attrCfg.callback, values = attrCfg.values, _a = attrCfg.fields, fields = _a === void 0 ? [] : _a;
                // 获取每一个字段对应的 scale
                var scales = fields.map(function (field) {
                    var scale = _this.scales[field];
                    if (scale.isCategory && !tmpMap[field] && constant_1.GROUP_ATTRS.includes(attrType)) {
                        _this.groupScales.push(scale);
                        tmpMap[field] = true;
                    }
                    return scale;
                });
                attrCfg.scales = scales;
                if (attrType !== 'position' && scales.length === 1 && scales[0].type === 'identity') {
                    // 用户在图形通道上声明了常量字段 color('red'), size(5)
                    attrCfg.values = scales[0].values;
                }
                else if (!callback && !values) {
                    // 用户没有指定任何规则，则使用默认的映射规则
                    if (attrType === 'size') {
                        attrCfg.values = theme.sizes;
                    }
                    else if (attrType === 'shape') {
                        attrCfg.values = theme.shapes[shapeType] || [];
                    }
                    else if (attrType === 'color') {
                        if (scales.length) {
                            // 根据数值个数使用对应的色板
                            attrCfg.values = scales[0].values.length <= 10 ? theme.colors10 : theme.colors20;
                        }
                        else {
                            attrCfg.values = theme.colors10;
                        }
                    }
                }
                var AttributeCtor = attr_1.getAttribute(attrType);
                attributes[attrType] = new AttributeCtor(attrCfg);
            }
        };
        // 遍历每一个 attrOption，各自创建 Attribute 实例
        for (var attrType in attributeOption) {
            var state_1 = _loop_1(attrType);
            if (typeof state_1 === "object")
                return state_1.value;
        }
    };
    // 处理数据：分组 -> 数字化 -> adjust 调整
    Geometry.prototype.processData = function (data) {
        this.hasSorted = false;
        var scales = this.getAttribute('position').scales;
        var categoryScales = scales.filter(function (scale) { return scale.isCategory; });
        var groupedArray = this.groupData(data); // 数据分组
        var beforeAdjust = [];
        for (var i = 0, len = groupedArray.length; i < len; i++) {
            var subData = groupedArray[i];
            var arr = [];
            for (var j = 0, subLen = subData.length; j < subLen; j++) {
                var originData = subData[j];
                var item = {};
                // tslint:disable-next-line: forin
                for (var k in originData) {
                    item[k] = originData[k];
                }
                item[constant_1.FIELD_ORIGIN] = originData;
                // 将分类数据翻译成数据, 仅对位置相关的度量进行数字化处理
                for (var _i = 0, categoryScales_1 = categoryScales; _i < categoryScales_1.length; _i++) {
                    var scale = categoryScales_1[_i];
                    var field = scale.field;
                    item[field] = scale.translate(item[field]);
                }
                arr.push(item);
            }
            beforeAdjust.push(arr);
        }
        var dataArray = this.adjustData(beforeAdjust); // 进行 adjust 数据调整
        this.beforeMappingData = dataArray;
        return dataArray;
    };
    // 调整数据
    Geometry.prototype.adjustData = function (dataArray) {
        var adjustOption = this.adjustOption;
        var result = dataArray;
        if (adjustOption) {
            var xScale = this.getXScale();
            var yScale = this.getYScale();
            var xField = xScale.field;
            var yField = yScale ? yScale.field : null;
            for (var i = 0, len = adjustOption.length; i < len; i++) {
                var adjust = adjustOption[i];
                var adjustCfg = tslib_1.__assign({ xField: xField,
                    yField: yField }, adjust);
                var type = adjust.type;
                if (type === 'dodge') {
                    var adjustNames = [];
                    if (xScale.isCategory || xScale.type === 'identity') {
                        adjustNames.push('x');
                    }
                    else if (!yScale) {
                        adjustNames.push('y');
                    }
                    else {
                        throw new Error('dodge is not support linear attribute, please use category attribute!');
                    }
                    adjustCfg.adjustNames = adjustNames;
                    // 每个分组内每条柱子的宽度占比，用户不可指定，用户需要通过 columnWidthRatio 指定
                    adjustCfg.dodgeRatio = this.theme.columnWidthRatio;
                }
                else if (type === 'stack') {
                    var coordinate = this.coordinate;
                    if (!yScale) {
                        // 一维的情况下获取高度和默认size
                        adjustCfg.height = coordinate.getHeight();
                        var size = this.getDefaultValue('size') || 3;
                        adjustCfg.size = size;
                    }
                    // 不进行 transpose 时，用户又没有设置这个参数时，默认从上向下
                    if (!coordinate.isTransposed && util_1.isNil(adjustCfg.reverseOrder)) {
                        adjustCfg.reverseOrder = true;
                    }
                }
                var adjustCtor = adjust_1.getAdjust(type);
                var adjustInstance = new adjustCtor(adjustCfg);
                result = adjustInstance.process(result);
                this.adjusts[type] = adjustInstance;
            }
        }
        return result;
    };
    // 对数据进行分组
    Geometry.prototype.groupData = function (data) {
        var groupScales = this.getGroupScales();
        var scaleDefs = this.scaleDefs;
        var appendConditions = {};
        var groupFields = [];
        for (var index = 0; index < groupScales.length; index++) {
            var scale = groupScales[index];
            var field = scale.field;
            groupFields.push(field);
            if (util_1.get(scaleDefs, [field, 'values'])) {
                // 用户通过 view.scale() 接口指定了 values 属性
                appendConditions[field] = scaleDefs[field].values;
            }
        }
        return group_data_1.group(data, groupFields, appendConditions);
    };
    // 更新发生层叠后的数据对应的度量范围
    Geometry.prototype.updateStackRange = function (scale, dataArray) {
        var mergeArray = util_1.flatten(dataArray);
        var field = scale.field;
        var min = scale.min;
        var max = scale.max;
        for (var index = 0; index < mergeArray.length; index++) {
            var obj = mergeArray[index];
            var tmpMin = Math.min.apply(null, obj[field]);
            var tmpMax = Math.max.apply(null, obj[field]);
            if (tmpMin < min) {
                min = tmpMin;
            }
            if (tmpMax > max) {
                max = tmpMax;
            }
        }
        var scaleDefs = this.scaleDefs;
        var cfg = {};
        if (min < scale.min && !util_1.get(scaleDefs, [field, 'min'])) {
            // 用户如果在列定义中定义了 min，则以用户定义的为准
            cfg.min = min;
        }
        if (max > scale.max && !util_1.get(scaleDefs, [field, 'max'])) {
            // 用户如果在列定义中定义了 max
            cfg.max = max;
        }
        scale.change(cfg);
    };
    // 将数据映射至图形空间前的操作：排序以及关键点的生成
    Geometry.prototype.beforeMapping = function (beforeMappingData) {
        // 当初加 clone 是因为 points 的引用关系，导致更新失败，可是现在貌似复现不出来了，所以暂时不进行 clone
        // const source = clone(beforeMappingData);
        var source = beforeMappingData;
        if (this.sortable) {
            this.sort(source);
        }
        if (this.generatePoints) {
            // 需要生成关键点
            for (var index = 0, length_7 = source.length; index < length_7; index++) {
                var currentData = source[index];
                this.generateShapePoints(currentData);
                var nextData = source[index + 1];
                if (nextData) {
                    this.generateShapePoints(nextData);
                    currentData[0].nextPoints = nextData[0].points;
                }
            }
        }
        return source;
    };
    // 生成 shape 的关键点
    Geometry.prototype.generateShapePoints = function (data) {
        var shapeFactory = this.getShapeFactory();
        var shapeAttr = this.getAttribute('shape');
        for (var index = 0; index < data.length; index++) {
            var obj = data[index];
            var cfg = this.createShapePointsCfg(obj);
            var shape = shapeAttr ? this.getAttributeValues(shapeAttr, obj) : null;
            var points = shapeFactory.getShapePoints(shape, cfg);
            obj.points = points;
        }
    };
    // 将数据归一化
    Geometry.prototype.normalizeValues = function (values, scale) {
        var rst = [];
        if (util_1.isArray(values)) {
            for (var index = 0; index < values.length; index++) {
                var value = values[index];
                rst.push(scale.scale(value));
            }
        }
        else {
            rst = scale.scale(values);
        }
        return rst;
    };
    // 将数据映射至图形空间
    Geometry.prototype.mapping = function (data) {
        var attributes = this.attributes;
        var mappingData = [];
        for (var index = 0; index < data.length; index++) {
            var record = data[index];
            var newRecord = {
                _origin: record[constant_1.FIELD_ORIGIN],
                points: record.points,
                nextPoints: record.nextPoints,
            };
            for (var k in attributes) {
                if (attributes.hasOwnProperty(k)) {
                    var attr = attributes[k];
                    var names = attr.names;
                    var values = this.getAttributeValues(attr, record);
                    if (names.length > 1) {
                        // position 之类的生成多个字段的属性
                        for (var j = 0; j < values.length; j += 1) {
                            var val = values[j];
                            var name_1 = names[j];
                            newRecord[name_1] = util_1.isArray(val) && val.length === 1 ? val[0] : val; // 只有一个值时返回第一个属性值
                        }
                    }
                    else {
                        // values.length === 1 的判断是以下情况，获取用户设置的图形属性值
                        // shape('a', ['dot', 'dash']), color('a', ['red', 'yellow'])
                        newRecord[names[0]] = values.length === 1 ? values[0] : values;
                    }
                }
            }
            this.convertPoint(newRecord); // 将 x、y 转换成画布坐标
            mappingData.push(newRecord);
        }
        return mappingData;
    };
    // 将归一化的坐标值转换成画布坐标
    Geometry.prototype.convertPoint = function (mappingRecord) {
        var x = mappingRecord.x, y = mappingRecord.y;
        var rstX;
        var rstY;
        var obj;
        var coordinate = this.coordinate;
        if (util_1.isArray(x) && util_1.isArray(y)) {
            rstX = [];
            rstY = [];
            for (var i = 0, j = 0, xLen = x.length, yLen = y.length; i < xLen && j < yLen; i += 1, j += 1) {
                obj = coordinate.convert({
                    x: x[i],
                    y: y[j],
                });
                rstX.push(obj.x);
                rstY.push(obj.y);
            }
        }
        else if (util_1.isArray(y)) {
            rstY = [];
            for (var index = 0; index < y.length; index++) {
                var yVal = y[index];
                obj = coordinate.convert({
                    x: x,
                    y: yVal,
                });
                if (rstX && rstX !== obj.x) {
                    if (!util_1.isArray(rstX)) {
                        rstX = [rstX];
                    }
                    rstX.push(obj.x);
                }
                else {
                    rstX = obj.x;
                }
                rstY.push(obj.y);
            }
        }
        else if (util_1.isArray(x)) {
            rstX = [];
            for (var index = 0; index < x.length; index++) {
                var xVal = x[index];
                obj = coordinate.convert({
                    x: xVal,
                    y: y,
                });
                if (rstY && rstY !== obj.y) {
                    if (!util_1.isArray(rstY)) {
                        rstY = [rstY];
                    }
                    rstY.push(obj.y);
                }
                else {
                    rstY = obj.y;
                }
                rstX.push(obj.x);
            }
        }
        else {
            var point = coordinate.convert({
                x: x,
                y: y,
            });
            rstX = point.x;
            rstY = point.y;
        }
        mappingRecord.x = rstX;
        mappingRecord.y = rstY;
    };
    // 获取 style 配置
    Geometry.prototype.getStyleCfg = function (styleOption, originData) {
        var _a = styleOption.fields, fields = _a === void 0 ? [] : _a, callback = styleOption.callback, cfg = styleOption.cfg;
        if (cfg) {
            // 用户直接配置样式属性
            return cfg;
        }
        var params = fields.map(function (field) {
            return originData[field];
        });
        return callback.apply(void 0, params);
    };
    Geometry.prototype.setCfg = function (cfg) {
        var _this = this;
        var coordinate = cfg.coordinate, data = cfg.data, theme = cfg.theme, scaleDefs = cfg.scaleDefs;
        if (coordinate) {
            this.coordinate = coordinate;
        }
        if (data) {
            this.data = data;
        }
        if (scaleDefs) {
            this.scaleDefs = scaleDefs;
            this.idFields = [];
            util_1.each(scaleDefs, function (scaleDef, field) {
                if (scaleDef && scaleDef.key) {
                    _this.idFields.push(field);
                }
            });
        }
        if (theme) {
            this.theme = this.userTheme ? util_1.deepMix({}, theme, this.userTheme) : theme; // 支持 geometry 层级的主题设置
        }
    };
    Geometry.prototype.renderLabels = function (mappingArray, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var geometryLabel = this.geometryLabel;
        if (!geometryLabel) {
            // 初次创建
            var labelType = this.getLabelType();
            var GeometryLabelsCtor = label_1.getGeometryLabel(labelType);
            geometryLabel = new GeometryLabelsCtor(this);
            this.geometryLabel = geometryLabel;
        }
        geometryLabel.render(mappingArray, isUpdate);
        // 将 label 同 element 进行关联
        var labelsMap = geometryLabel.labelsRenderer.shapesMap;
        util_1.each(this.elementsMap, function (element, id) {
            var labels = filterLabelsById(id, labelsMap); // element 实例同 label 进行绑定
            if (labels.length) {
                element.labelShape = labels;
                for (var i = 0; i < labels.length; i++) {
                    var label = labels[i];
                    var labelChildren = label.getChildren();
                    for (var j = 0; j < labelChildren.length; j++) {
                        var child = labelChildren[j];
                        child.cfg.name = ['element', 'label'];
                        child.cfg.element = element;
                    }
                }
            }
        });
    };
    /**
     * 是否需要进行群组入场动画
     * 规则：
     * 1. 如果发生更新，则不进行
     * 2. 如果用户关闭 geometry 动画，则不进行
     * 3. 如果用户关闭了 appear 动画，则不进行
     * 4. 如果用户配置了 appear.animation，则不进行
     */
    Geometry.prototype.canDoGroupAnimation = function (isUpdate) {
        return (!isUpdate &&
            this.animateOption &&
            (util_1.get(this.animateOption, 'appear') === undefined ||
                (util_1.get(this.animateOption, 'appear') && util_1.get(this.animateOption, ['appear', 'animation']) === undefined)));
    };
    return Geometry;
}(base_1.default));
exports.default = Geometry;

},{"../animate":217,"../base":218,"../constant":237,"../util/helper":377,"./element":252,"./label":256,"./shape/base":275,"./util/group-data":305,"./util/is-model-change":306,"./util/parse-fields":307,"@antv/adjust":9,"@antv/attr":17,"@antv/util":803,"tslib":385}],251:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("./base"));
require("./shape/edge");
/**
 * Edge 几何标记，用于绘制关系图中的**边**图形，如：
 * 1. 流程图
 * 2. 树
 * 3. 弧长连接图
 * 4. 和弦图
 * 5. 桑基图
 */
var Edge = /** @class */ (function (_super) {
    tslib_1.__extends(Edge, _super);
    function Edge() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'edge';
        _this.shapeType = 'edge';
        _this.generatePoints = true;
        return _this;
    }
    return Edge;
}(base_1.default));
exports.default = Edge;

},{"./base":250,"./shape/edge":277,"tslib":385}],252:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var animate_1 = require("../../animate");
var base_1 = tslib_1.__importDefault(require("../../base"));
var graphics_1 = require("../../util/graphics");
var event_1 = require("@antv/component/lib/util/event");
/**
 * Element 图形元素。
 * 定义：在 G2 中，我们会将数据通过图形语法映射成不同的图形，比如点图，数据集中的每条数据会对应一个点，柱状图每条数据对应一个柱子，线图则是一组数据对应一条折线，Element 即一条/一组数据对应的图形元素，它代表一条数据或者一个数据集，在图形层面，它可以是单个 Shape 也可以是多个 Shape，我们称之为图形元素。
 */
var Element = /** @class */ (function (_super) {
    tslib_1.__extends(Element, _super);
    function Element(cfg) {
        var _this = _super.call(this, cfg) || this;
        // 存储当前开启的状态
        _this.states = [];
        var shapeFactory = cfg.shapeFactory, container = cfg.container, offscreenGroup = cfg.offscreenGroup, _a = cfg.visible, visible = _a === void 0 ? true : _a;
        _this.shapeFactory = shapeFactory;
        _this.container = container;
        _this.offscreenGroup = offscreenGroup;
        _this.visible = visible;
        return _this;
    }
    /**
     * 绘制图形。
     * @param model 绘制数据。
     * @param isUpdate 可选，是否是更新发生后的绘制。
     */
    Element.prototype.draw = function (model, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        this.model = model;
        this.data = model.data; // 存储原始数据
        this.shapeType = this.getShapeType(model);
        // 绘制图形
        this.drawShape(model, isUpdate);
        if (this.visible === false) {
            // 用户在初始化的时候声明 visible: false
            this.changeVisible(false);
        }
    };
    /**
     * 更新图形。
     * @param model 更新的绘制数据。
     */
    Element.prototype.update = function (model) {
        var _a = this, shapeFactory = _a.shapeFactory, shape = _a.shape;
        if (!shape) {
            return;
        }
        // 更新数据
        this.model = model;
        this.data = model.data;
        this.shapeType = this.getShapeType(model);
        // step 1: 更新 shape 携带的信息
        this.setShapeInfo(shape, model);
        // step 2: 使用虚拟 Group 重新绘制 shape，然后更新当前 shape
        var offscreenGroup = this.getOffscreenGroup();
        var newShape = shapeFactory.drawShape(this.shapeType, model, offscreenGroup);
        // @ts-ignore
        newShape.cfg.data = this.data;
        // @ts-ignore
        newShape.cfg.origin = model;
        // step 3: 同步 shape 样式
        this.syncShapeStyle(shape, newShape, '', this.getAnimateCfg('update'));
    };
    /**
     * 销毁 element 实例。
     */
    Element.prototype.destroy = function () {
        var _a = this, shapeFactory = _a.shapeFactory, shape = _a.shape;
        if (shape) {
            var animateCfg = this.getAnimateCfg('leave');
            if (animateCfg) {
                // 指定了动画配置则执行销毁动画
                animate_1.doAnimate(shape, animateCfg, {
                    coordinate: shapeFactory.coordinate,
                    toAttrs: tslib_1.__assign({}, shape.attr()),
                });
            }
            else {
                // 否则直接销毁
                shape.remove(true);
            }
        }
        // reset
        this.states = [];
        this.shapeFactory = undefined;
        this.container = undefined;
        this.shape = undefined;
        this.animate = undefined;
        this.geometry = undefined;
        this.labelShape = undefined;
        this.model = undefined;
        this.data = undefined;
        this.offscreenGroup = undefined;
        this.statesStyle = undefined;
        _super.prototype.destroy.call(this);
    };
    /**
     * 显示或者隐藏 element。
     * @param visible 是否可见。
     */
    Element.prototype.changeVisible = function (visible) {
        _super.prototype.changeVisible.call(this, visible);
        if (visible) {
            if (this.shape) {
                this.shape.show();
            }
            if (this.labelShape) {
                this.labelShape.forEach(function (label) {
                    label.show();
                });
            }
        }
        else {
            if (this.shape) {
                this.shape.hide();
            }
            if (this.labelShape) {
                this.labelShape.forEach(function (label) {
                    label.hide();
                });
            }
        }
    };
    /**
     * 设置 Element 的状态。
     *
     * 目前 Element 开放三种状态：
     * 1. active
     * 2. selected
     * 3. inactive
     *
     * 这三种状态相互独立，可以进行叠加。
     *
     * 这三种状态的样式可在 [[Theme]] 主题中或者通过 `geometry.state()` 接口进行配置。
     *
     * ```ts
     * // 激活 active 状态
     * setState('active', true);
     * ```
     *
     * @param stateName 状态名
     * @param stateStatus 是否开启状态
     */
    Element.prototype.setState = function (stateName, stateStatus) {
        var _this = this;
        var _a = this, states = _a.states, shapeFactory = _a.shapeFactory, model = _a.model, shape = _a.shape, shapeType = _a.shapeType;
        var index = states.indexOf(stateName);
        if (stateStatus) {
            // 开启状态
            if (index > -1) {
                // 该状态已经开启，则返回
                return;
            }
            states.push(stateName);
            if (stateName === 'active' || stateName === 'selected') {
                shape.toFront();
            }
        }
        else {
            if (index === -1) {
                // 关闭状态，但是状态未设置过
                return;
            }
            states.splice(index, 1);
            if (stateName === 'active' || stateName === 'selected') {
                shape.toBack();
            }
        }
        // 使用虚拟 group 重新绘制 shape，然后对这个 shape 应用状态样式后，更新当前 shape。
        var offscreenShape = shapeFactory.drawShape(shapeType, model, this.getOffscreenGroup());
        if (states.length) {
            // 应用当前状态
            states.forEach(function (state) {
                _this.syncShapeStyle(shape, offscreenShape, state, null);
            });
        }
        else {
            // 如果没有状态，则需要恢复至原始状态
            this.syncShapeStyle(shape, offscreenShape, 'reset', null);
        }
        offscreenShape.remove(true); // 销毁，减少内存占用
        var eventObject = {
            state: stateName,
            stateStatus: stateStatus,
            element: this,
            target: this.container,
        };
        this.container.emit('statechange', eventObject);
        // @ts-ignore
        event_1.propagationDelegate(this.shape, 'statechange', eventObject);
    };
    /**
     * 清空状量态，恢复至初始状态。
     */
    Element.prototype.clearStates = function () {
        var _this = this;
        var states = this.states;
        util_1.each(states, function (state) {
            _this.setState(state, false);
        });
        this.states = [];
    };
    /**
     * 查询当前 Element 上是否已设置 `stateName` 对应的状态。
     * @param stateName 状态名称。
     * @returns true 表示存在，false 表示不存在。
     */
    Element.prototype.hasState = function (stateName) {
        return this.states.includes(stateName);
    };
    /**
     * 获取当前 Element 上所有的状态。
     * @returns 当前 Element 上所有的状态数组。
     */
    Element.prototype.getStates = function () {
        return this.states;
    };
    /**
     * 获取 Element 对应的原始数据。
     * @returns 原始数据。
     */
    Element.prototype.getData = function () {
        return this.data;
    };
    /**
     * 获取 Element 对应的图形绘制数据。
     * @returns 图形绘制数据。
     */
    Element.prototype.getModel = function () {
        return this.model;
    };
    /**
     * 返回 Element 元素整体的 bbox，包含文本及文本连线（有的话）。
     * @returns 整体包围盒。
     */
    Element.prototype.getBBox = function () {
        var _a = this, shape = _a.shape, labelShape = _a.labelShape;
        var bbox = {
            x: 0,
            y: 0,
            minX: 0,
            minY: 0,
            maxX: 0,
            maxY: 0,
            width: 0,
            height: 0,
        };
        if (shape) {
            bbox = shape.getCanvasBBox();
        }
        if (labelShape) {
            labelShape.forEach(function (label) {
                var labelBBox = label.getCanvasBBox();
                bbox.x = Math.min(labelBBox.x, bbox.x);
                bbox.y = Math.min(labelBBox.y, bbox.y);
                bbox.minX = Math.min(labelBBox.minX, bbox.minX);
                bbox.minY = Math.min(labelBBox.minY, bbox.minY);
                bbox.maxX = Math.max(labelBBox.maxX, bbox.maxX);
                bbox.maxY = Math.max(labelBBox.maxY, bbox.maxY);
            });
        }
        bbox.width = bbox.maxX - bbox.minX;
        bbox.height = bbox.maxY - bbox.minY;
        return bbox;
    };
    Element.prototype.getStatesStyle = function () {
        if (!this.statesStyle) {
            var _a = this, shapeType = _a.shapeType, geometry = _a.geometry, shapeFactory = _a.shapeFactory;
            var stateOption = geometry.stateOption;
            var defaultShapeType = shapeFactory.defaultShapeType;
            var stateTheme = shapeFactory.theme[shapeType] || shapeFactory.theme[defaultShapeType];
            this.statesStyle = util_1.deepMix({}, stateTheme, stateOption);
        }
        return this.statesStyle;
    };
    // 从主题中获取对应状态量的样式
    Element.prototype.getStateStyle = function (stateName, shapeKey) {
        var statesStyle = this.getStatesStyle();
        var stateCfg = util_1.get(statesStyle, [stateName, 'style'], {});
        var shapeStyle = stateCfg[shapeKey] || stateCfg;
        if (util_1.isFunction(shapeStyle)) {
            return shapeStyle(this);
        }
        return shapeStyle;
    };
    // 获取动画配置
    Element.prototype.getAnimateCfg = function (animateType) {
        var animate = this.animate;
        if (animate) {
            return animate[animateType];
        }
        return null;
    };
    // 绘制图形
    Element.prototype.drawShape = function (model, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var _a = this, shapeFactory = _a.shapeFactory, container = _a.container, shapeType = _a.shapeType;
        // 自定义 shape 有可能返回空 shape
        this.shape = shapeFactory.drawShape(shapeType, model, container);
        if (this.shape) {
            this.setShapeInfo(this.shape, model); // 存储绘图数据
            // @ts-ignore
            var name_1 = this.shape.cfg.name;
            // 附加 element 的 name, name 现在支持数组了，很好用了
            if (!name_1) {
                // 这个地方如果用户添加了 name, 则附加 name ，否则就添加自己的 name
                // @ts-ignore
                this.shape.cfg.name = ['element', this.shapeFactory.geometryType];
            }
            else if (util_1.isString(name_1)) {
                // @ts-ignore
                this.shape.cfg.name = ['element', name_1];
            }
            // 执行入场动画
            var animateType = isUpdate ? 'enter' : 'appear';
            var animateCfg = this.getAnimateCfg(animateType);
            if (animateCfg) {
                animate_1.doAnimate(this.shape, animateCfg, {
                    coordinate: shapeFactory.coordinate,
                    toAttrs: tslib_1.__assign({}, this.shape.attr()),
                });
            }
        }
    };
    // 获取虚拟 Group
    Element.prototype.getOffscreenGroup = function () {
        if (!this.offscreenGroup) {
            var GroupCtor = this.container.getGroupBase(); // 获取分组的构造函数
            this.offscreenGroup = new GroupCtor({});
        }
        return this.offscreenGroup;
    };
    // 设置 shape 上需要携带的信息
    Element.prototype.setShapeInfo = function (shape, data) {
        var _this = this;
        // @ts-ignore
        shape.cfg.origin = data;
        // @ts-ignore
        shape.cfg.element = this;
        if (shape.isGroup()) {
            var children = shape.get('children');
            children.forEach(function (child) {
                _this.setShapeInfo(child, data);
            });
        }
    };
    // 更新当前 shape 的样式
    Element.prototype.syncShapeStyle = function (sourceShape, targetShape, state, animateCfg, index) {
        if (state === void 0) { state = ''; }
        if (index === void 0) { index = 0; }
        if (sourceShape.isGroup()) {
            var children = sourceShape.get('children');
            var newChildren = targetShape.get('children');
            for (var i = 0; i < children.length; i++) {
                this.syncShapeStyle(children[i], newChildren[i], state, animateCfg, index + i);
            }
        }
        else {
            if (state && state !== 'reset') {
                var name_2 = sourceShape.get('name');
                if (util_1.isArray(name_2)) {
                    // 会附加 element 的 name
                    name_2 = name_2[1];
                }
                var style = this.getStateStyle(state, name_2 || index); // 如果用户没有设置 name，则默认根据索引值
                targetShape.attr(style);
            }
            var newAttrs = graphics_1.getReplaceAttrs(sourceShape, targetShape);
            if (this.animate) {
                if (animateCfg) {
                    // 需要进行动画
                    animate_1.doAnimate(sourceShape, animateCfg, {
                        coordinate: this.shapeFactory.coordinate,
                        toAttrs: newAttrs,
                        shapeModel: this.model,
                    });
                }
                else if (state) {
                    sourceShape.stopAnimate();
                    sourceShape.animate(newAttrs, {
                        duration: 300,
                    });
                }
                else {
                    sourceShape.attr(newAttrs);
                }
            }
            else {
                sourceShape.attr(newAttrs);
            }
        }
    };
    Element.prototype.getShapeType = function (model) {
        var shape = util_1.get(model, 'shape');
        return util_1.isArray(shape) ? shape[0] : shape;
    };
    return Element;
}(base_1.default));
exports.default = Element;

},{"../../animate":217,"../../base":218,"../../util/graphics":375,"@antv/component/lib/util/event":70,"@antv/util":803,"tslib":385}],253:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var color_util_1 = tslib_1.__importDefault(require("@antv/color-util"));
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * 用于绘制热力图。
 */
var Heatmap = /** @class */ (function (_super) {
    tslib_1.__extends(Heatmap, _super);
    function Heatmap() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'heatmap';
        _this.paletteCache = {};
        return _this;
    }
    Heatmap.prototype.createElements = function (mappingData, index, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var range = this.prepareRange(mappingData);
        var radius = this.prepareSize();
        var blur = util_1.get(this.styleOption, ['style', 'shadowBlur']);
        if (!util_1.isNumber(blur)) {
            blur = radius / 2;
        }
        this.prepareGreyScaleBlurredCircle(radius, blur);
        this.drawWithRange(mappingData, range, radius, blur);
        return null;
    };
    /**
     * clear
     */
    Heatmap.prototype.clear = function () {
        _super.prototype.clear.call(this);
        this.clearShadowCanvasCtx();
        this.paletteCache = {};
    };
    Heatmap.prototype.prepareRange = function (data) {
        var colorAttr = this.getAttribute('color');
        var colorField = colorAttr.getFields()[0];
        var min = Infinity;
        var max = -Infinity;
        data.forEach(function (row) {
            var value = row[constant_1.FIELD_ORIGIN][colorField];
            if (value > max) {
                max = value;
            }
            if (value < min) {
                min = value;
            }
        });
        if (min === max) {
            min = max - 1;
        }
        return [min, max];
    };
    Heatmap.prototype.prepareSize = function () {
        var radius = this.getDefaultValue('size');
        if (!util_1.isNumber(radius)) {
            radius = this.getDefaultSize();
        }
        return radius;
    };
    Heatmap.prototype.prepareGreyScaleBlurredCircle = function (radius, blur) {
        var grayScaleBlurredCanvas = this.getGrayScaleBlurredCanvas();
        var r2 = radius + blur;
        var ctx = grayScaleBlurredCanvas.getContext('2d');
        grayScaleBlurredCanvas.width = grayScaleBlurredCanvas.height = r2 * 2;
        ctx.clearRect(0, 0, grayScaleBlurredCanvas.width, grayScaleBlurredCanvas.height);
        ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
        ctx.shadowBlur = blur;
        ctx.shadowColor = 'black';
        ctx.beginPath();
        ctx.arc(-r2, -r2, radius, 0, Math.PI * 2, true);
        ctx.closePath();
        ctx.fill();
    };
    Heatmap.prototype.drawWithRange = function (data, range, radius, blur) {
        // canvas size
        var _a = this.coordinate, start = _a.start, end = _a.end;
        var width = this.coordinate.getWidth();
        var height = this.coordinate.getHeight();
        // value, range, etc
        var colorAttr = this.getAttribute('color');
        var valueField = colorAttr.getFields()[0];
        // prepare shadow canvas context
        this.clearShadowCanvasCtx();
        var ctx = this.getShadowCanvasCtx();
        // filter data
        if (range) {
            data = data.filter(function (row) {
                return row[constant_1.FIELD_ORIGIN][valueField] <= range[1] && row[constant_1.FIELD_ORIGIN][valueField] >= range[0];
            });
        }
        // step1. draw points with shadow
        var scale = this.scales[valueField];
        for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
            var obj = data_1[_i];
            var _b = this.getDrawCfg(obj), x = _b.x, y = _b.y;
            var alpha = scale.scale(obj[constant_1.FIELD_ORIGIN][valueField]);
            this.drawGrayScaleBlurredCircle(x - start.x, y - end.y, radius + blur, alpha, ctx);
        }
        // step2. convert pixels
        var colored = ctx.getImageData(0, 0, width, height);
        this.clearShadowCanvasCtx();
        this.colorize(colored);
        ctx.putImageData(colored, 0, 0);
        var imageShape = this.getImageShape();
        imageShape.attr('x', start.x);
        imageShape.attr('y', end.y);
        imageShape.attr('width', width);
        imageShape.attr('height', height);
        imageShape.attr('img', ctx.canvas);
        imageShape.set('origin', this.getShapeInfo(data)); // 存储绘图信息数据
    };
    Heatmap.prototype.getDefaultSize = function () {
        var position = this.getAttribute('position');
        var coordinate = this.coordinate;
        return Math.min(coordinate.getWidth() / (position.scales[0].ticks.length * 4), coordinate.getHeight() / (position.scales[1].ticks.length * 4));
    };
    Heatmap.prototype.clearShadowCanvasCtx = function () {
        var ctx = this.getShadowCanvasCtx();
        ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
    };
    Heatmap.prototype.getShadowCanvasCtx = function () {
        var canvas = this.shadowCanvas;
        if (!canvas) {
            canvas = document.createElement('canvas');
            this.shadowCanvas = canvas;
        }
        canvas.width = this.coordinate.getWidth();
        canvas.height = this.coordinate.getHeight();
        return canvas.getContext('2d');
    };
    Heatmap.prototype.getGrayScaleBlurredCanvas = function () {
        if (!this.grayScaleBlurredCanvas) {
            this.grayScaleBlurredCanvas = document.createElement('canvas');
        }
        return this.grayScaleBlurredCanvas;
    };
    Heatmap.prototype.drawGrayScaleBlurredCircle = function (x, y, r, alpha, ctx) {
        var grayScaleBlurredCanvas = this.getGrayScaleBlurredCanvas();
        ctx.globalAlpha = alpha;
        ctx.drawImage(grayScaleBlurredCanvas, x - r, y - r);
    };
    Heatmap.prototype.colorize = function (img) {
        var colorAttr = this.getAttribute('color');
        var pixels = img.data;
        var paletteCache = this.paletteCache;
        for (var i = 3; i < pixels.length; i += 4) {
            var alpha = pixels[i]; // get gradient color from opacity value
            if (util_1.isNumber(alpha)) {
                var palette = paletteCache[alpha] ? paletteCache[alpha] : color_util_1.default.rgb2arr(colorAttr.gradient(alpha / 256));
                pixels[i - 3] = palette[0];
                pixels[i - 2] = palette[1];
                pixels[i - 1] = palette[2];
                pixels[i] = alpha;
            }
        }
    };
    Heatmap.prototype.getImageShape = function () {
        var imageShape = this.imageShape;
        if (imageShape) {
            return imageShape;
        }
        var container = this.container;
        imageShape = container.addShape({
            type: 'image',
            attrs: {},
        });
        this.imageShape = imageShape;
        return imageShape;
    };
    Heatmap.prototype.getShapeInfo = function (mappingData) {
        var shapeCfg = this.getDrawCfg(mappingData[0]);
        return tslib_1.__assign(tslib_1.__assign({}, shapeCfg), { mappingData: mappingData, data: this.getData(mappingData) });
    };
    Heatmap.prototype.getData = function (mappingData) {
        return mappingData.map(function (obj) {
            return obj[constant_1.FIELD_ORIGIN];
        });
    };
    return Heatmap;
}(base_1.default));
exports.default = Heatmap;

},{"../constant":237,"./base":250,"@antv/color-util":19,"@antv/util":803,"tslib":385}],254:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var coordinate_1 = require("../util/coordinate");
var base_1 = tslib_1.__importDefault(require("./base"));
/** 引入对应的 ShapeFactory */
require("./shape/interval");
var shape_size_1 = require("./util/shape-size");
/**
 * Interval 几何标记。
 * 用于绘制柱状图、饼图、条形图、玫瑰图等。
 */
var Interval = /** @class */ (function (_super) {
    tslib_1.__extends(Interval, _super);
    function Interval() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'interval';
        _this.shapeType = 'interval';
        _this.generatePoints = true;
        return _this;
    }
    /**
     * 获取每条数据的 Shape 绘制信息
     * @param obj 经过分组 -> 数字化 -> adjust 调整后的数据记录
     * @returns
     */
    Interval.prototype.createShapePointsCfg = function (obj) {
        var cfg = _super.prototype.createShapePointsCfg.call(this, obj);
        // 计算每个 shape 的 size
        var size;
        var sizeAttr = this.getAttribute('size');
        if (sizeAttr) {
            size = this.getAttributeValues(sizeAttr, obj)[0];
            // 归一化
            var coordinate = this.coordinate;
            var coordinateWidth = coordinate_1.getXDimensionLength(coordinate);
            size = size / coordinateWidth;
        }
        else {
            if (!this.defaultSize) {
                this.defaultSize = shape_size_1.getDefaultSize(this);
            }
            size = this.defaultSize;
        }
        cfg.size = size;
        return cfg;
    };
    /**
     * 调整 y 轴的 scale 范围。
     * 对于 Y 轴为数值轴柱状图，默认从 0 开始 生长。
     */
    Interval.prototype.adjustScale = function () {
        _super.prototype.adjustScale.call(this);
        var yScale = this.getYScale();
        // 特殊逻辑：饼图需要填充满整个空间
        if (this.coordinate.type === 'theta') {
            yScale.change({
                nice: false,
                min: 0,
                // 发生过 stack 调整，yScale 的 max 被调整过，this.updateStackRange()
                max: Math.max(Math.max.apply(null, yScale.values), yScale.max),
            });
        }
        else {
            // 柱状图数值轴默认从 0 开始
            var scaleDefs = this.scaleDefs;
            var field = yScale.field, min = yScale.min, max = yScale.max, type = yScale.type;
            if (type !== 'time') {
                // time 类型不做调整
                // 柱状图的 Y 轴要从 0 开始生长，但是如果用户设置了则以用户的为准
                if (min > 0 && !util_1.get(scaleDefs, [field, 'min'])) {
                    yScale.change({
                        min: 0,
                    });
                }
                // 柱当柱状图全为负值时也需要从 0 开始生长，但是如果用户设置了则以用户的为准
                if (max <= 0 && !util_1.get(scaleDefs, [field, 'max'])) {
                    yScale.change({
                        max: 0,
                    });
                }
            }
        }
    };
    return Interval;
}(base_1.default));
exports.default = Interval;

},{"../util/coordinate":371,"./base":250,"./shape/interval":283,"./util/shape-size":308,"@antv/util":803,"tslib":385}],255:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../../constant");
var animate_1 = require("../../animate");
var graphics_1 = require("../../util/graphics");
var labels_1 = tslib_1.__importDefault(require("../../component/labels"));
function avg(arr) {
    var sum = 0;
    util_1.each(arr, function (value) {
        sum += value;
    });
    return sum / arr.length;
}
/**
 * Geometry Label 基类，用于生成 Geometry 下所有 label 的配置项信息
 */
var GeometryLabel = /** @class */ (function () {
    function GeometryLabel(geometry) {
        this.geometry = geometry;
    }
    GeometryLabel.prototype.getLabelItems = function (mapppingArray) {
        var _this = this;
        var items = [];
        var labelCfgs = this.getLabelCfgs(mapppingArray);
        // 获取 label 相关的 x，y 的值，获取具体的 x, y，防止存在数组
        util_1.each(mapppingArray, function (mappingData, index) {
            var labelCfg = labelCfgs[index];
            if (!labelCfg || util_1.isNil(mappingData.x) || util_1.isNil(mappingData.y)) {
                items.push(null);
                return;
            }
            var labelContent = !util_1.isArray(labelCfg.content) ? [labelCfg.content] : labelCfg.content;
            labelCfg.content = labelContent;
            var total = labelContent.length;
            util_1.each(labelContent, function (content, subIndex) {
                if (util_1.isNil(content) || content === '') {
                    items.push(null);
                    return;
                }
                var item = tslib_1.__assign(tslib_1.__assign({}, labelCfg), _this.getLabelPoint(labelCfg, mappingData, subIndex));
                if (!item.textAlign) {
                    item.textAlign = _this.getLabelAlign(item, subIndex, total);
                }
                if (item.offset <= 0) {
                    item.labelLine = null;
                }
                items.push(item);
            });
        });
        return items;
    };
    GeometryLabel.prototype.render = function (mapppingArray, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        var labelItems = this.getLabelItems(mapppingArray);
        var labelsRenderer = this.getLabelsRenderer();
        var shapes = this.getGeometryShapes();
        // 渲染文本
        labelsRenderer.render(labelItems, shapes, isUpdate);
    };
    GeometryLabel.prototype.clear = function () {
        var labelsRenderer = this.labelsRenderer;
        if (labelsRenderer) {
            labelsRenderer.clear();
        }
    };
    GeometryLabel.prototype.destroy = function () {
        var labelsRenderer = this.labelsRenderer;
        if (labelsRenderer) {
            labelsRenderer.destroy();
        }
        this.labelsRenderer = null;
    };
    // geometry 更新之后，对应的 Coordinate 也会更新，为了获取到最新鲜的 Coordinate，故使用方法获取
    GeometryLabel.prototype.getCoordinate = function () {
        return this.geometry.coordinate;
    };
    /**
     * 获取 label 的默认配置
     */
    GeometryLabel.prototype.getDefaultLabelCfg = function () {
        return util_1.get(this.geometry.theme, 'labels', {});
    };
    /**
     * 设置 label 位置
     * @param labelPointCfg
     * @param mappingData
     * @param index
     * @param position
     */
    GeometryLabel.prototype.setLabelPosition = function (labelPointCfg, mappingData, index, position) { };
    /**
     * 获取文本默认偏移量
     * @param offset
     * @returns
     */
    GeometryLabel.prototype.getDefaultOffset = function (offset) {
        var coordinate = this.getCoordinate();
        var vector = this.getOffsetVector(offset);
        return coordinate.isTransposed ? vector[0] : vector[1];
    };
    /**
     * 获取每个 label 的偏移量
     * @param labelCfg
     * @param index
     * @param total
     * @returns
     */
    GeometryLabel.prototype.getLabelOffset = function (labelCfg, index, total) {
        var offset = this.getDefaultOffset(labelCfg.offset);
        var coordinate = this.getCoordinate();
        var transposed = coordinate.isTransposed;
        var dim = transposed ? 'x' : 'y';
        var factor = transposed ? 1 : -1; // y 方向上越大，像素的坐标越小，所以transposed时将系数变成
        var offsetPoint = {
            x: 0,
            y: 0,
        };
        if (index > 0 || total === 1) {
            // 判断是否小于0
            offsetPoint[dim] = offset * factor;
        }
        else {
            offsetPoint[dim] = offset * factor * -1;
        }
        return offsetPoint;
    };
    /**
     * 获取每个 label 的位置
     * @param labelCfg
     * @param mappingData
     * @param index
     * @returns label point
     */
    GeometryLabel.prototype.getLabelPoint = function (labelCfg, mappingData, index) {
        var coordinate = this.getCoordinate();
        var total = labelCfg.content.length;
        function getDimValue(value, idx) {
            var v = value;
            if (util_1.isArray(v)) {
                if (labelCfg.content.length === 1) {
                    // 如果仅一个 label，多个 y, 取最后一个 y
                    if (v.length <= 2) {
                        v = v[value.length - 1];
                    }
                    else {
                        v = avg(v);
                    }
                }
                else {
                    v = v[idx];
                }
            }
            return v;
        }
        var label = {
            content: labelCfg.content[index],
            x: 0,
            y: 0,
            start: { x: 0, y: 0 },
            color: '#fff',
        };
        // 多边形场景，多用于地图
        if (mappingData && this.geometry.type === 'polygon') {
            var centroid = graphics_1.getPolygonCentroid(mappingData.x, mappingData.y);
            label.x = centroid[0];
            label.y = centroid[1];
        }
        else {
            label.x = getDimValue(mappingData.x, index);
            label.y = getDimValue(mappingData.y, index);
        }
        // 处理漏斗图文本位置
        var shape = util_1.isArray(mappingData.shape) ? mappingData.shape[0] : mappingData.shape;
        if (shape === 'funnel' || shape === 'pyramid') {
            var nextPoints = util_1.get(mappingData, 'nextPoints');
            var points = util_1.get(mappingData, 'points');
            if (nextPoints) {
                // 非漏斗图底部
                var point1 = coordinate.convert(points[1]);
                var point2 = coordinate.convert(nextPoints[1]);
                label.x = (point1.x + point2.x) / 2;
                label.y = (point1.y + point2.y) / 2;
            }
            else if (shape === 'pyramid') {
                var point1 = coordinate.convert(points[1]);
                var point2 = coordinate.convert(points[2]);
                label.x = (point1.x + point2.x) / 2;
                label.y = (point1.y + point2.y) / 2;
            }
        }
        if (labelCfg.position) {
            // 如果 label 支持 position 属性
            this.setLabelPosition(label, mappingData, index, labelCfg.position);
        }
        var offsetPoint = this.getLabelOffset(labelCfg, index, total);
        label.start = { x: label.x, y: label.y };
        label.x += offsetPoint.x;
        label.y += offsetPoint.y;
        label.color = mappingData.color;
        return label;
    };
    /**
     * 获取文本的对齐方式
     * @param item
     * @param index
     * @param total
     * @returns
     */
    GeometryLabel.prototype.getLabelAlign = function (item, index, total) {
        var align = 'center';
        var coordinate = this.getCoordinate();
        if (coordinate.isTransposed) {
            var offset = this.getDefaultOffset(item.offset);
            if (offset < 0) {
                align = 'right';
            }
            else if (offset === 0) {
                align = 'center';
            }
            else {
                align = 'left';
            }
            if (total > 1 && index === 0) {
                if (align === 'right') {
                    align = 'left';
                }
                else if (align === 'left') {
                    align = 'right';
                }
            }
        }
        return align;
    };
    /**
     * 获取每一个 label 的唯一 id
     * @param mappingData label 对应的图形的绘制数据
     */
    GeometryLabel.prototype.getLabelId = function (mappingData) {
        var geometry = this.geometry;
        var type = geometry.type;
        var xScale = geometry.getXScale();
        var yScale = geometry.getYScale();
        var origin = mappingData[constant_1.FIELD_ORIGIN]; // 原始数据
        var labelId = geometry.getElementId(mappingData);
        if (type === 'line' || type === 'area') {
            // 折线图以及区域图，一条线会对应一组数据，即多个 labels，为了区分这些 labels，需要在 line id 的前提下加上 x 字段值
            labelId += " " + origin[xScale.field];
        }
        else if (type === 'path') {
            // path 路径图，无序，有可能存在相同 x 不同 y 的情况，需要通过 x y 来确定唯一 id
            labelId += " " + origin[xScale.field] + "-" + origin[yScale.field];
        }
        return labelId;
    };
    // 获取 labels 组件
    GeometryLabel.prototype.getLabelsRenderer = function () {
        var _a = this.geometry, labelsContainer = _a.labelsContainer, labelOption = _a.labelOption, canvasRegion = _a.canvasRegion, animateOption = _a.animateOption;
        var coordinate = this.geometry.coordinate;
        var labelsRenderer = this.labelsRenderer;
        if (!labelsRenderer) {
            labelsRenderer = new labels_1.default({
                container: labelsContainer,
                layout: util_1.get(labelOption, ['cfg', 'layout'], {
                    type: this.defaultLayout,
                }),
            });
            this.labelsRenderer = labelsRenderer;
        }
        labelsRenderer.region = canvasRegion;
        // 设置动画配置，如果 geometry 的动画关闭了，那么 label 的动画也会关闭
        labelsRenderer.animate = animateOption ? animate_1.getDefaultAnimateCfg('label', coordinate) : false;
        return labelsRenderer;
    };
    GeometryLabel.prototype.getLabelCfgs = function (mapppingArray) {
        var _this = this;
        var geometry = this.geometry;
        var defaultLabelCfg = this.getDefaultLabelCfg();
        var type = geometry.type, theme = geometry.theme, labelOption = geometry.labelOption, scales = geometry.scales, coordinate = geometry.coordinate;
        var _a = labelOption, fields = _a.fields, callback = _a.callback, cfg = _a.cfg;
        var labelScales = fields.map(function (field) {
            return scales[field];
        });
        var labelCfgs = [];
        util_1.each(mapppingArray, function (mappingData, index) {
            var origin = mappingData[constant_1.FIELD_ORIGIN]; // 原始数据
            var originText = _this.getLabelText(origin, labelScales);
            var callbackCfg;
            if (callback) {
                // 当同时配置了 callback 和 cfg 时，以 callback 为准
                var originValues = fields.map(function (field) { return origin[field]; });
                callbackCfg = callback.apply(void 0, originValues);
                if (util_1.isNil(callbackCfg)) {
                    labelCfgs.push(null);
                    return;
                }
            }
            var labelCfg = tslib_1.__assign(tslib_1.__assign({ id: _this.getLabelId(mappingData), data: origin, // 存储原始数据
                mappingData: mappingData,
                coordinate: coordinate }, cfg), callbackCfg);
            var content = labelCfg.content;
            if (util_1.isFunction(content)) {
                labelCfg.content = content(origin, mappingData, index);
            }
            else if (util_1.isUndefined(content)) {
                // 用户未配置 content，则默认为映射的第一个字段的值
                labelCfg.content = originText[0];
            }
            if (util_1.isFunction(labelCfg.position)) {
                labelCfg.position = labelCfg.position(origin, mappingData, index);
            }
            if (type === 'polygon' || (labelCfg.offset < 0 && !['line', 'point', 'path'].includes(type))) {
                // polygon 或者 offset 小于 0 时，文本展示在图形内部，将其颜色设置为 白色
                labelCfg = util_1.deepMix({}, defaultLabelCfg, theme.innerLabels, labelCfg);
            }
            else {
                labelCfg = util_1.deepMix({}, defaultLabelCfg, theme.labels, labelCfg);
            }
            labelCfgs.push(labelCfg);
        });
        return labelCfgs;
    };
    GeometryLabel.prototype.getLabelText = function (origin, scales) {
        var labelTexts = [];
        util_1.each(scales, function (scale) {
            var value = origin[scale.field];
            if (util_1.isArray(value)) {
                value = value.map(function (subVal) {
                    return scale.getText(subVal);
                });
            }
            else {
                value = scale.getText(value);
            }
            if (util_1.isNil(value) || value === '') {
                labelTexts.push(null);
            }
            else {
                labelTexts.push(value);
            }
        });
        return labelTexts;
    };
    GeometryLabel.prototype.getOffsetVector = function (offset) {
        if (offset === void 0) { offset = 0; }
        var coordinate = this.getCoordinate();
        // 如果 x,y 翻转，则偏移 x，否则偏移 y
        return coordinate.isTransposed ? coordinate.applyMatrix(offset, 0) : coordinate.applyMatrix(0, offset);
    };
    GeometryLabel.prototype.getGeometryShapes = function () {
        var geometry = this.geometry;
        var shapes = {};
        util_1.each(geometry.elementsMap, function (element, id) {
            shapes[id] = element.shape;
        });
        // 因为有可能 shape 还在进行动画，导致 shape.getBBox() 获取到的值不是最终态，所以需要从 offscreenGroup 获取
        util_1.each(geometry.getOffscreenGroup().getChildren(), function (child) {
            var id = geometry.getElementId(child.get('origin').mappingData);
            shapes[id] = child;
        });
        return shapes;
    };
    return GeometryLabel;
}());
exports.default = GeometryLabel;

},{"../../animate":217,"../../component/labels":236,"../../constant":237,"../../util/graphics":375,"@antv/util":803,"tslib":385}],256:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerGeometryLabelLayout = exports.getGeometryLabelLayout = exports.registerGeometryLabel = exports.getGeometryLabel = void 0;
var GEOMETRY_LABELS_MAP = {};
var GEOMETRY_LABELS_LAYOUT_MAP = {};
/**
 * 获取 `type` 对应的 [[GeometryLabel]] 类
 * @param type
 * @returns
 */
function getGeometryLabel(type) {
    return GEOMETRY_LABELS_MAP[type.toLowerCase()];
}
exports.getGeometryLabel = getGeometryLabel;
/**
 * 注册定义的 GeometryLabel 类
 * @param type GeometryLabel 类型名称
 * @param ctor GeometryLabel 类
 */
function registerGeometryLabel(type, ctor) {
    GEOMETRY_LABELS_MAP[type.toLowerCase()] = ctor;
}
exports.registerGeometryLabel = registerGeometryLabel;
/**
 * 获取 `type` 对应的 [[GeometryLabelsLayoutFn]] label 布局函数
 * @param type 布局函数名称
 * @returns
 */
function getGeometryLabelLayout(type) {
    return GEOMETRY_LABELS_LAYOUT_MAP[type.toLowerCase()];
}
exports.getGeometryLabelLayout = getGeometryLabelLayout;
/**
 * 注册定义的 label 布局函数
 * @param type label 布局函数名称
 * @param layoutFn label 布局函数
 */
function registerGeometryLabelLayout(type, layoutFn) {
    GEOMETRY_LABELS_LAYOUT_MAP[type.toLowerCase()] = layoutFn;
}
exports.registerGeometryLabelLayout = registerGeometryLabelLayout;

},{}],257:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * 柱状图 label
 */
var IntervalLabel = /** @class */ (function (_super) {
    tslib_1.__extends(IntervalLabel, _super);
    function IntervalLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    IntervalLabel.prototype.setLabelPosition = function (labelPointCfg, mappingData, index, position) {
        var coordinate = this.getCoordinate();
        var transposed = coordinate.isTransposed;
        var shapePoints = mappingData.points;
        var point0 = coordinate.convert(shapePoints[0]);
        var point1 = coordinate.convert(shapePoints[2]);
        var flag = transposed ? -1 : 1;
        var width = ((point0.x - point1.x) / 2) * flag;
        var height = ((point0.y - point1.y) / 2) * flag;
        switch (position) {
            case 'right':
                if (!transposed) {
                    labelPointCfg.x -= width;
                    labelPointCfg.y += height;
                }
                labelPointCfg.textAlign = util_1.get(labelPointCfg, 'textAlign', 'left');
                break;
            case 'left':
                if (transposed) {
                    labelPointCfg.x -= width * 2;
                }
                else {
                    labelPointCfg.x += width;
                    labelPointCfg.y += height;
                }
                labelPointCfg.textAlign = util_1.get(labelPointCfg, 'textAlign', 'right');
                break;
            case 'bottom':
                if (transposed) {
                    labelPointCfg.x -= width;
                    labelPointCfg.y -= height;
                }
                else {
                    labelPointCfg.y += height * 2;
                }
                labelPointCfg.textAlign = util_1.get(labelPointCfg, 'textAlign', 'center');
                labelPointCfg.textBaseline = util_1.get(labelPointCfg, 'textBaseline', 'top');
                break;
            case 'middle':
                if (transposed) {
                    labelPointCfg.x -= width;
                }
                else {
                    labelPointCfg.y += height;
                }
                labelPointCfg.textAlign = util_1.get(labelPointCfg, 'textAlign', 'center');
                break;
            case 'top':
                if (transposed) {
                    labelPointCfg.x -= width;
                    labelPointCfg.y += height;
                }
                labelPointCfg.textAlign = util_1.get(labelPointCfg, 'textAlign', 'center');
                labelPointCfg.textBaseline = util_1.get(labelPointCfg, 'textBaseline', 'bottom');
                break;
            default:
                break;
        }
    };
    return IntervalLabel;
}(base_1.default));
exports.default = IntervalLabel;

},{"./base":255,"@antv/util":803,"tslib":385}],258:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.limitInCanvas = void 0;
var util_1 = require("@antv/util");
var transform_1 = require("../../../util/transform");
/**
 * @ignore
 * 将 label 限制在画布范围内，简单得将超出画布的 label 往画布内调整
 * @param labels
 * @param cfg
 */
function limitInCanvas(items, labels, shapes, region) {
    util_1.each(labels, function (label) {
        var regionMinX = region.minX, regionMinY = region.minY, regionMaxX = region.maxX, regionMaxY = region.maxY;
        var _a = label.getCanvasBBox(), minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        var finalX = x;
        var finalY = y;
        if (minX < regionMinX || maxX < regionMinX) {
            // 超出左侧
            finalX = regionMinX;
        }
        if (minY < regionMinY || maxY < regionMinY) {
            // 超出顶部
            finalY = regionMinY;
        }
        if (minX > regionMaxX) {
            // 整体超出右侧
            finalX = regionMaxX - width;
        }
        else if (maxX > regionMaxX) {
            // 超出右侧
            finalX = finalX - (maxX - regionMaxX);
        }
        if (minY > regionMaxY) {
            // 整体超出顶部
            finalY = regionMaxY - height;
        }
        else if (maxY > regionMaxY) {
            // 超出底部
            finalY = finalY - (maxY - regionMaxY);
        }
        if (finalX !== x || finalY !== y) {
            transform_1.translate(label, finalX - x, finalY - y);
        }
    });
}
exports.limitInCanvas = limitInCanvas;

},{"../../../util/transform":384,"@antv/util":803}],259:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.limitInShape = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * 根据图形元素以及 label 的 bbox 进行调整，如果 label 超出了 shape 的 bbox 则不展示
 */
function limitInShape(items, labels, shapes, region) {
    util_1.each(labels, function (label, index) {
        var labelBBox = label.getCanvasBBox(); // 文本有可能发生旋转
        var shapeBBox = shapes[index].getBBox();
        if (labelBBox.minX < shapeBBox.minX ||
            labelBBox.minY < shapeBBox.minY ||
            labelBBox.maxX > shapeBBox.maxX ||
            labelBBox.maxY > shapeBBox.maxY) {
            label.remove(true); // 超出则不展示
        }
    });
}
exports.limitInShape = limitInShape;

},{"@antv/util":803}],260:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.overlap = exports.fixedOverlap = void 0;
var util_1 = require("@antv/util");
var MAX_TIMES = 100;
/**
 * @ignore
 * Greedy 贪婪算法
 */
var Greedy = /** @class */ (function () {
    function Greedy(cfg) {
        if (cfg === void 0) { cfg = {}; }
        this.bitmap = {};
        var _a = cfg.xGap, xGap = _a === void 0 ? 1 : _a, _b = cfg.yGap, yGap = _b === void 0 ? 8 : _b;
        this.xGap = xGap;
        this.yGap = yGap;
    }
    Greedy.prototype.hasGap = function (bbox) {
        var hasGap = true;
        var bitmap = this.bitmap;
        var minX = Math.round(bbox.minX);
        var maxX = Math.round(bbox.maxX);
        var minY = Math.round(bbox.minY);
        var maxY = Math.round(bbox.maxY);
        for (var i = minX; i <= maxX; i += 1) {
            if (!bitmap[i]) {
                bitmap[i] = {};
                continue;
            }
            if (i === minX || i === maxX) {
                for (var j = minY; j <= maxY; j++) {
                    if (bitmap[i][j]) {
                        hasGap = false;
                        break;
                    }
                }
            }
            else {
                if (bitmap[i][minY] || bitmap[i][maxY]) {
                    hasGap = false;
                    break;
                }
            }
        }
        return hasGap;
    };
    Greedy.prototype.fillGap = function (bbox) {
        var bitmap = this.bitmap;
        var minX = Math.round(bbox.minX);
        var maxX = Math.round(bbox.maxX);
        var minY = Math.round(bbox.minY);
        var maxY = Math.round(bbox.maxY);
        // filling grid
        for (var i = minX; i <= maxX; i += 1) {
            if (!bitmap[i]) {
                bitmap[i] = {};
            }
        }
        for (var i = minX; i <= maxX; i += this.xGap) {
            for (var j = minY; j <= maxY; j += this.yGap) {
                bitmap[i][j] = true;
            }
            bitmap[i][maxY] = true;
        }
        // filling y edges
        if (this.yGap !== 1) {
            for (var i = minY; i <= maxY; i += 1) {
                bitmap[minX][i] = true;
                bitmap[maxX][i] = true;
            }
        }
        // filling x edges
        if (this.xGap !== 1) {
            for (var i = minX; i <= maxX; i += 1) {
                bitmap[i][minY] = true;
                bitmap[i][maxY] = true;
            }
        }
    };
    Greedy.prototype.destroy = function () {
        this.bitmap = {};
    };
    return Greedy;
}());
function spiralFill(label, greedy, maxTimes) {
    if (maxTimes === void 0) { maxTimes = MAX_TIMES; }
    var dt = -1;
    var _a = label.attr(), x = _a.x, y = _a.y;
    var bbox = label.getCanvasBBox();
    var maxDelta = Math.sqrt(bbox.width * bbox.width + bbox.height * bbox.height);
    var dxdy;
    var t = -dt;
    var dx = 0;
    var dy = 0;
    var f = function (param) {
        var nt = param * 0.1;
        return [nt * Math.cos(nt), nt * Math.sin(nt)];
    };
    if (greedy.hasGap(bbox)) {
        greedy.fillGap(bbox);
        return true;
    }
    var canFill = false;
    var times = 0;
    var accessedCache = {};
    while (Math.min(Math.abs(dx), Math.abs(dy)) < maxDelta && times < maxTimes) {
        dxdy = f((t += dt));
        dx = ~~dxdy[0];
        dy = ~~dxdy[1];
        if ((!dx && !dy) || accessedCache[dx + "-" + dy]) {
            continue;
        }
        label.attr({ x: x + dx, y: y + dy });
        if (dx + dy < 0) {
            label.attr('textAlign', 'right');
        }
        times++;
        if (greedy.hasGap(label.getCanvasBBox())) {
            greedy.fillGap(label.getCanvasBBox());
            canFill = true;
            accessedCache[dx + "-" + dy] = true;
            break;
        }
    }
    return canFill;
}
/*
 *  根据如下规则尝试放置label
 *                5
 *        ------------------
 *        |    1   |   0   |
 *    8   —————————4————————   7
 *        |    2   |   3   |
 *        ——————————————————
 *                 6
 */
function adjustLabelPosition(label, x, y, index) {
    var _a = label.getCanvasBBox(), width = _a.width, height = _a.height;
    var attrs = {
        x: x,
        y: y,
        textAlign: 'center',
    };
    switch (index) {
        case 0:
            attrs.y -= height + 1;
            attrs.x += 1;
            attrs.textAlign = 'left';
            break;
        case 1:
            attrs.y -= height + 1;
            attrs.x -= 1;
            attrs.textAlign = 'right';
            break;
        case 2:
            attrs.y += height + 1;
            attrs.x -= 1;
            attrs.textAlign = 'right';
            break;
        case 3:
            attrs.y += height + 1;
            attrs.x += 1;
            attrs.textAlign = 'left';
            break;
        case 5:
            attrs.y -= height * 2 + 2;
            break;
        case 6:
            attrs.y += height * 2 + 2;
            break;
        case 7:
            attrs.x += width + 1;
            attrs.textAlign = 'left';
            break;
        case 8:
            attrs.x -= width + 1;
            attrs.textAlign = 'right';
            break;
        default:
            break;
    }
    label.attr(attrs);
    return label.getCanvasBBox();
}
/**
 * @ignore
 * label 防遮挡布局：在不改变 label 位置的情况下对相互重叠的 label 进行调整。
 * 不同于 'overlap' 类型的布局，该布局不会对 label 的位置进行偏移调整。
 * @param labels 参与布局调整的 label 数组集合
 */
function fixedOverlap(items, labels, shapes, region) {
    var greedy = new Greedy();
    util_1.each(labels, function (label) {
        var labelShape = label.find(function (shape) { return shape.get('type') === 'text'; });
        if (!spiralFill(labelShape, greedy)) {
            label.remove(true);
        }
    });
    greedy.destroy();
}
exports.fixedOverlap = fixedOverlap;
/**
 * @ignore
 * label 防遮挡布局：为了防止 label 之间相互覆盖同时保证尽可能多 的 label 展示，通过尝试将 label 向**四周偏移**来剔除放不下的 label
 * @param labels 参与布局调整的 label 数组集合
 */
function overlap(items, labels, shapes, region) {
    var greedy = new Greedy();
    util_1.each(labels, function (label) {
        var labelShape = label.find(function (shape) { return shape.get('type') === 'text'; });
        var _a = labelShape.attr(), x = _a.x, y = _a.y;
        var canFill = false;
        for (var i = 0; i <= 8; i++) {
            var bbox = adjustLabelPosition(labelShape, x, y, i);
            if (greedy.hasGap(bbox)) {
                greedy.fillGap(bbox);
                canFill = true;
                break;
            }
        }
        if (!canFill) {
            label.remove(true);
        }
    });
    greedy.destroy();
}
exports.overlap = overlap;

},{"@antv/util":803}],261:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.distribute = void 0;
var util_1 = require("@antv/util");
var graphics_1 = require("../../../../util/graphics");
/** label text和line距离 4px */
var MARGIN = 4;
function antiCollision(labelShapes, labels, lineHeight, plotRange, center, isRight) {
    // adjust y position of labels to avoid overlapping
    var overlapping = true;
    var start = plotRange.start;
    var end = plotRange.end;
    var startY = Math.min(start.y, end.y);
    var totalHeight = Math.abs(start.y - end.y);
    var i;
    var maxY = 0;
    var minY = Number.MIN_VALUE;
    var boxes = labels.map(function (label) {
        if (label.y > maxY) {
            maxY = label.y;
        }
        if (label.y < minY) {
            minY = label.y;
        }
        return {
            size: lineHeight,
            targets: [label.y - startY],
        };
    });
    minY -= startY;
    if (maxY - startY > totalHeight) {
        totalHeight = maxY - startY;
    }
    while (overlapping) {
        /* eslint no-loop-func: 0 */
        boxes.forEach(function (box) {
            var target = (Math.min.apply(minY, box.targets) + Math.max.apply(minY, box.targets)) / 2;
            box.pos = Math.min(Math.max(minY, target - box.size / 2), totalHeight - box.size);
            // box.pos = Math.max(0, target - box.size / 2);
        });
        // detect overlapping and join boxes
        overlapping = false;
        i = boxes.length;
        while (i--) {
            if (i > 0) {
                var previousBox = boxes[i - 1];
                var box = boxes[i];
                if (previousBox.pos + previousBox.size > box.pos) {
                    // overlapping
                    previousBox.size += box.size;
                    previousBox.targets = previousBox.targets.concat(box.targets);
                    // overflow, shift up
                    if (previousBox.pos + previousBox.size > totalHeight) {
                        previousBox.pos = totalHeight - previousBox.size;
                    }
                    boxes.splice(i, 1); // removing box
                    overlapping = true;
                }
            }
        }
    }
    i = 0;
    // step 4: normalize y and adjust x
    boxes.forEach(function (b) {
        var posInCompositeBox = startY + lineHeight / 2; // middle of the label
        b.targets.forEach(function () {
            labels[i].y = b.pos + posInCompositeBox;
            posInCompositeBox += lineHeight;
            i++;
        });
    });
    var labelsMap = {};
    for (var _i = 0, labelShapes_1 = labelShapes; _i < labelShapes_1.length; _i++) {
        var labelShape = labelShapes_1[_i];
        labelsMap[labelShape.get('id')] = labelShape;
    }
    // (x - cx)^2 + (y - cy)^2 = totalR^2
    labels.forEach(function (label) {
        var rPow2 = label.r * label.r;
        var dyPow2 = Math.pow(Math.abs(label.y - center.y), 2);
        if (rPow2 < dyPow2) {
            label.x = center.x;
        }
        else {
            var dx = Math.sqrt(rPow2 - dyPow2);
            if (!isRight) {
                // left
                label.x = center.x - dx;
            }
            else {
                // right
                label.x = center.x + dx;
            }
        }
        // adjust labelShape
        var labelShape = labelsMap[label.id];
        labelShape.attr('x', label.x);
        labelShape.attr('y', label.y);
        // because group could not effect text-shape, should set text-shape position manually
        var textShape = util_1.find(labelShape.getChildren(), function (ele) { return ele.get('type') === 'text'; });
        // @ts-ignore
        if (textShape) {
            textShape.attr('y', label.y);
            textShape.attr('x', label.x);
        }
    });
}
function distribute(items, labels, shapes, region) {
    var offset = items[0] ? items[0].offset : 0;
    var coordinate = labels[0].get('coordinate');
    var radius = coordinate.getRadius();
    var center = coordinate.getCenter();
    if (offset > 0) {
        // const lineHeight = get(this.geometry.theme, ['pieLabels', 'labelHeight'], 14);
        var lineHeight_1 = 14; // TODO
        var totalR = radius + offset;
        var totalHeight_1 = totalR * 2 + lineHeight_1 * 2;
        var plotRange_1 = {
            start: coordinate.start,
            end: coordinate.end,
        };
        // step 1: separate labels
        var halves_1 = [
            [],
            [],
        ];
        items.forEach(function (labelItem) {
            if (!labelItem) {
                return;
            }
            if (labelItem.textAlign === 'right') {
                // left
                halves_1[0].push(labelItem);
            }
            else {
                // right or center will be put on the right side
                halves_1[1].push(labelItem);
            }
        });
        halves_1.forEach(function (half, index) {
            // step 2: reduce labels
            var maxLabelsCountForOneSide = totalHeight_1 / lineHeight_1;
            if (half.length > maxLabelsCountForOneSide) {
                half.sort(function (a, b) {
                    // sort by percentage DESC
                    return b['..percent'] - a['..percent'];
                });
                half.splice(maxLabelsCountForOneSide, half.length - maxLabelsCountForOneSide);
            }
            // step 3: distribute position (x and y)
            half.sort(function (a, b) {
                // sort by y ASC
                return a.y - b.y;
            });
            antiCollision(labels, half, lineHeight_1, plotRange_1, center, index);
        });
    }
    // 配置 labelLine
    util_1.each(items, function (item) {
        if (item && item.labelLine) {
            var distance = item.offset;
            var angle = item.angle;
            // 贴近圆周
            var startPoint = graphics_1.polarToCartesian(center.x, center.y, radius, angle);
            var innerPoint = graphics_1.polarToCartesian(center.x, center.y, radius + distance / 2, angle);
            var itemX = item.x + util_1.get(item, 'offsetX', 0);
            var itemY = item.y + util_1.get(item, 'offsetY', 0);
            var endPoint = {
                x: itemX - Math.cos(angle) * MARGIN,
                y: itemY - Math.sin(angle) * MARGIN,
            };
            if (!util_1.isObject(item.labelLine)) {
                // labelLine: true
                item.labelLine = {};
            }
            item.labelLine.path = [
                "M " + startPoint.x,
                startPoint.y + " Q" + innerPoint.x,
                innerPoint.y + " " + endPoint.x,
                endPoint.y,
            ].join(',');
        }
    });
}
exports.distribute = distribute;

},{"../../../../util/graphics":375,"@antv/util":803}],262:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pieOuterLabelLayout = void 0;
var util_1 = require("@antv/util");
var graphics_1 = require("../../../../util/graphics");
/** label text和line距离 4px */
var MARGIN = 4;
function antiCollision(labelShapes, labels, labelHeight, plotRange, center, radius, isRight) {
    // sorted by y, mutable
    labels.sort(function (a, b) { return a.y - b.y; });
    // adjust y position of labels to avoid overlapping
    var start = plotRange.start;
    var end = plotRange.end;
    var startY = Math.min(start.y, end.y);
    var endY = Math.max(start.y, end.y);
    var i;
    var boxes = labels.map(function (label) {
        return {
            content: label.content,
            size: labelHeight,
            pos: label.y,
            targets: [label.y],
        };
    });
    var maxPos = Math.max.apply(Math, boxes.map(function (b) { return b.pos; }));
    var minPos = Math.min.apply(Math, boxes.map(function (b) { return b.pos; }));
    /**
     * when in right, shift from up to down
     */
    if (isRight) {
        var minY = Math.min(minPos, endY - (boxes.length - 1) * labelHeight);
        var maxY = Math.max(minY + boxes.length * labelHeight, maxPos + labelHeight);
        var overlapping = true;
        while (overlapping) {
            // detect overlapping and join boxes
            overlapping = false;
            i = boxes.length;
            while (i--) {
                if (i > 0) {
                    var previousBox = boxes[i - 1];
                    var box = boxes[i];
                    // overlap
                    if (previousBox.pos + previousBox.size > box.pos) {
                        if (box.pos + i * labelHeight < maxY) {
                            // join boxes
                            previousBox.size += box.size;
                            previousBox.targets = previousBox.targets.concat(box.targets);
                            // removing box
                            boxes.splice(i, 1);
                        }
                        else {
                            previousBox.pos = box.pos - previousBox.size;
                        }
                        overlapping = true;
                    }
                }
            }
        }
    }
    else {
        var maxY = Math.max(startY + (boxes.length - 1) * labelHeight, maxPos);
        var minY = Math.min(minPos, maxY - (boxes.length - 1) * labelHeight);
        var overlapping = true;
        while (overlapping) {
            // detect overlapping and join boxes
            overlapping = false;
            i = boxes.length;
            while (i--) {
                if (i > 0) {
                    var previousBox = boxes[i - 1];
                    var box = boxes[i];
                    // overlap
                    if (previousBox.pos + previousBox.size > box.pos) {
                        if (previousBox.pos - minY > i * labelHeight) {
                            previousBox.pos -= previousBox.size;
                        }
                        else {
                            // join boxes
                            previousBox.size += box.size;
                            previousBox.targets = previousBox.targets.concat(box.targets);
                            // removing box
                            boxes.splice(i, 1);
                        }
                        overlapping = true;
                    }
                }
            }
        }
    }
    // step 4: normalize y and adjust x
    i = 0;
    boxes.forEach(function (b) {
        var posInCompositeBox = b.pos;
        b.targets.forEach(function () {
            labels[i].y = posInCompositeBox;
            posInCompositeBox += labelHeight;
            i++;
        });
    });
    var labelsMap = {};
    for (var _i = 0, labelShapes_1 = labelShapes; _i < labelShapes_1.length; _i++) {
        var labelShape = labelShapes_1[_i];
        labelsMap[labelShape.get('id')] = labelShape;
    }
    // (x - cx)^2 + (y - cy)^2 = totalR^2
    var totalR = (Math.max.apply(Math, labels.map(function (l) { return l.y; })) - Math.min.apply(Math, labels.map(function (l) { return l.y; }))) / 2;
    totalR = Math.max(totalR, radius);
    labels.forEach(function (label) {
        var labelShape = labelsMap[label.id];
        // because group could not effect text-shape, should set text-shape position manually
        var textShape = labelShape.find(function (child) { return child.get('type') === 'text'; });
        // textShape 发生过调整
        if (textShape && textShape.attr('y') !== label.y) {
            var rPow2 = totalR * totalR;
            var dyPow2 = Math.pow(Math.abs(label.y - center.y), 2);
            if (rPow2 < dyPow2) {
                label.x = center.x;
            }
            else {
                var dx = Math.sqrt(rPow2 - dyPow2);
                if (!isRight) {
                    // left
                    label.x = center.x - dx;
                }
                else {
                    // right
                    label.x = center.x + dx;
                }
            }
        }
        // adjust labelShape
        labelShape.attr('x', label.x);
        labelShape.attr('y', label.y);
        // @ts-ignore
        if (textShape) {
            textShape.attr('y', label.y);
            textShape.attr('x', label.x);
        }
    });
}
function pieOuterLabelLayout(items, labels, shapes, region) {
    var offset = items[0] ? items[0].offset : 0;
    var coordinate = labels[0].get('coordinate');
    var radius = coordinate.getRadius();
    var center = coordinate.getCenter();
    if (offset > 0) {
        // note labelHeight 可以控制 label 的行高
        var lineHeight_1 = util_1.get(items[0], 'labelHeight', 14);
        var totalR_1 = radius + offset;
        var totalHeight_1 = totalR_1 * 2 + lineHeight_1 * 2;
        var plotRange_1 = {
            start: coordinate.start,
            end: coordinate.end,
        };
        // step 1: separate labels
        var halves_1 = [
            [],
            [],
        ];
        items.forEach(function (labelItem) {
            if (!labelItem) {
                return;
            }
            if (labelItem.x < center.x) {
                // left
                halves_1[0].push(labelItem);
            }
            else {
                // right or center will be put on the right side
                halves_1[1].push(labelItem);
            }
        });
        halves_1.forEach(function (half, index) {
            // step 2: reduce labels
            var maxLabelsCountForOneSide = totalHeight_1 / lineHeight_1;
            if (half.length > maxLabelsCountForOneSide) {
                half.sort(function (a, b) {
                    // sort by percentage DESC
                    // fixme-xinming 目前还获取不到，需要使用 scale 去获取 percent
                    return b['data.percent'] - a['data.percent'];
                });
                var hidden = half.splice(maxLabelsCountForOneSide, half.length - maxLabelsCountForOneSide + 1);
                hidden.forEach(function (l) {
                    var idx = labels.findIndex(function (item) { return item.get('id') === l.id; });
                    if (labels[idx]) {
                        labels[idx].remove(true);
                        // 同时移除
                        labels.splice(idx, 1);
                    }
                });
            }
            antiCollision(labels, half, lineHeight_1, plotRange_1, center, totalR_1, index === 1);
        });
    }
    // 配置 labelLine
    util_1.each(items, function (item) {
        if (item && item.labelLine) {
            var angle = item.angle;
            // 贴近圆周
            var startPoint = graphics_1.polarToCartesian(center.x, center.y, radius, angle);
            var itemX = item.x + util_1.get(item, 'offsetX', 0) * (Math.cos(angle) > 0 ? 1 : -1);
            var itemY = item.y + util_1.get(item, 'offsetY', 0) * (Math.sin(angle) > 0 ? 1 : -1);
            var endPoint = {
                x: itemX - Math.cos(angle) * MARGIN,
                y: itemY - Math.sin(angle) * MARGIN,
            };
            var smoothConnector = item.labelLine.smooth;
            var path = [];
            var dx = endPoint.x - center.x;
            var dy = endPoint.y - center.y;
            var endAngle = Math.atan(dy / dx);
            // 第三象限 & 第四象限
            if (dx < 0) {
                endAngle += Math.PI;
            }
            // 默认 smooth, undefined 也为 smooth
            if (smoothConnector === false) {
                if (!util_1.isObject(item.labelLine)) {
                    // labelLine: true
                    item.labelLine = {};
                }
                // 表示弧线的方向，0 表示从起点到终点沿逆时针画弧, 1 表示顺时针
                var sweepFlag = 0;
                // 第一象限
                if ((angle < 0 && angle > -Math.PI / 2) || angle > Math.PI * 1.5) {
                    if (endPoint.y > startPoint.y) {
                        sweepFlag = 1;
                    }
                }
                // 第二象限
                if (angle >= 0 && angle < Math.PI / 2) {
                    if (endPoint.y > startPoint.y) {
                        sweepFlag = 1;
                    }
                }
                // 第三象限
                if (angle >= Math.PI / 2 && angle < Math.PI) {
                    if (startPoint.y > endPoint.y) {
                        sweepFlag = 1;
                    }
                }
                // 第四象限
                if (angle < -Math.PI / 2 || (angle >= Math.PI && angle < Math.PI * 1.5)) {
                    if (startPoint.y > endPoint.y) {
                        sweepFlag = 1;
                    }
                }
                var distance = offset / 2 > 4 ? 4 : Math.max(offset / 2 - 1, 0);
                var breakPoint = graphics_1.polarToCartesian(center.x, center.y, radius + distance, angle);
                // 圆弧的结束点
                var breakPoint3 = graphics_1.polarToCartesian(center.x, center.y, radius + offset / 2, endAngle);
                /**
                 * @example
                 * M 100 100 L100 90 A 50 50 0 0 0 150 50
                 * 移动至 (100, 100), 连接到 (100, 90), 以 (50, 50) 为圆心，绘制圆弧至 (150, 50);
                 * A 命令的第 4 个参数 large-arc-flag, 决定弧线是大于还是小于 180 度: 0 表示小角度弧，1 表示大角
                 * 第 5 个参数: 是否顺时针绘制
                 */
                // 默认小弧
                var largeArcFlag = 0;
                // step1: 移动至起点
                path.push("M " + startPoint.x + " " + startPoint.y);
                // step2: 连接拐点
                path.push("L " + breakPoint.x + " " + breakPoint.y);
                // step3: 绘制圆弧 至 结束点
                path.push("A " + center.x + " " + center.y + " 0 " + largeArcFlag + " " + sweepFlag + " " + breakPoint3.x + " " + breakPoint3.y);
                // step4: 连接结束点
                path.push("L " + endPoint.x + " " + endPoint.y);
            }
            else {
                var breakPoint = graphics_1.polarToCartesian(center.x, center.y, radius + (offset / 2 > 4 ? 4 : Math.max(offset / 2 - 1, 0)), angle);
                // G2 旧的拉线
                // path.push('Q', `${breakPoint.x}`, `${breakPoint.y}`, `${endPoint.x}`, `${endPoint.y}`);
                var xSign = startPoint.x < center.x ? 1 : -1;
                // step1: 连接结束点
                path.push("M " + endPoint.x + " " + endPoint.y);
                var slope1 = (startPoint.y - center.y) / (startPoint.x - center.x);
                var slope2 = (endPoint.y - center.y) / (endPoint.x - center.x);
                if (Math.abs(slope1 - slope2) > Math.pow(Math.E, -16)) {
                    // step2: 绘制 curve line (起点 & 结合点与圆心的斜率不等时, 由于存在误差, 使用近似处理)
                    path.push.apply(path, [
                        'C',
                        endPoint.x + xSign * 4,
                        endPoint.y,
                        2 * breakPoint.x - startPoint.x,
                        2 * breakPoint.y - startPoint.y,
                        startPoint.x,
                        startPoint.y,
                    ]);
                }
                // step3: 连接至起点
                path.push("L " + startPoint.x + " " + startPoint.y);
            }
            item.labelLine.path = path.join(' ');
        }
    });
}
exports.pieOuterLabelLayout = pieOuterLabelLayout;

},{"../../../../util/graphics":375,"@antv/util":803}],263:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var coordinate_1 = require("../../util/coordinate");
var graphics_1 = require("../../util/graphics");
var polar_1 = tslib_1.__importDefault(require("./polar"));
/**
 * 饼图 label
 */
var PieLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PieLabel, _super);
    function PieLabel(geometry) {
        var _this = _super.call(this, geometry) || this;
        _this.defaultLayout = 'distribute';
        return _this;
    }
    PieLabel.prototype.getDefaultLabelCfg = function () {
        return util_1.get(this.geometry.theme, 'pieLabels', {});
    };
    PieLabel.prototype.getDefaultOffset = function (offset) {
        return offset || 0;
    };
    PieLabel.prototype.getLabelRotate = function (angle, offset, isLabelLimit) {
        var rotate;
        if (offset < 0) {
            rotate = angle;
            if (rotate > Math.PI / 2) {
                rotate = rotate - Math.PI;
            }
            if (rotate < -Math.PI / 2) {
                rotate = rotate + Math.PI;
            }
        }
        return rotate;
    };
    PieLabel.prototype.getLabelAlign = function (point) {
        var coordinate = this.getCoordinate();
        var center = coordinate.getCenter();
        var align;
        if (point.angle <= Math.PI / 2 && point.x >= center.x) {
            align = 'left';
        }
        else {
            align = 'right';
        }
        var offset = this.getDefaultOffset(point.offset);
        if (offset <= 0) {
            if (align === 'right') {
                align = 'left';
            }
            else {
                align = 'right';
            }
        }
        return align;
    };
    PieLabel.prototype.getArcPoint = function (point) {
        return point;
    };
    PieLabel.prototype.getPointAngle = function (point) {
        var coordinate = this.getCoordinate();
        var startPoint = {
            x: util_1.isArray(point.x) ? point.x[0] : point.x,
            y: point.y[0],
        };
        var endPoint = {
            x: util_1.isArray(point.x) ? point.x[1] : point.x,
            y: point.y[1],
        };
        var angle;
        var startAngle = coordinate_1.getAngleByPoint(coordinate, startPoint);
        if (point.points && point.points[0].y === point.points[1].y) {
            angle = startAngle;
        }
        else {
            var endAngle = coordinate_1.getAngleByPoint(coordinate, endPoint);
            if (startAngle >= endAngle) {
                // 100% pie slice
                endAngle = endAngle + Math.PI * 2;
            }
            angle = startAngle + (endAngle - startAngle) / 2;
        }
        return angle;
    };
    PieLabel.prototype.getCirclePoint = function (angle, offset, p) {
        var coordinate = this.getCoordinate();
        var center = coordinate.getCenter();
        var r = coordinate.getRadius() + offset;
        return tslib_1.__assign(tslib_1.__assign({}, graphics_1.polarToCartesian(center.x, center.y, r, angle)), { angle: angle,
            r: r });
    };
    return PieLabel;
}(polar_1.default));
exports.default = PieLabel;

},{"../../util/coordinate":371,"../../util/graphics":375,"./polar":264,"@antv/util":803,"tslib":385}],264:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var coordinate_1 = require("../../util/coordinate");
var coordinate_2 = require("../../util/coordinate");
var base_1 = tslib_1.__importDefault(require("./base"));
var HALF_PI = Math.PI / 2;
/**
 * 极坐标下的图形 label
 */
var PolarLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PolarLabel, _super);
    function PolarLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @override
     * 获取文本的对齐方式
     * @param point
     */
    PolarLabel.prototype.getLabelAlign = function (point) {
        var coordinate = this.getCoordinate();
        var align;
        if (point.labelEmit) {
            align = point.angle <= Math.PI / 2 && point.angle >= -Math.PI / 2 ? 'left' : 'right';
        }
        else if (!coordinate.isTransposed) {
            align = 'center';
        }
        else {
            var center = coordinate.getCenter();
            var offset = this.getDefaultOffset(point.offset);
            if (Math.abs(point.x - center.x) < 1) {
                align = 'center';
            }
            else if (point.angle > Math.PI || point.angle <= 0) {
                align = offset > 0 ? 'left' : 'right';
            }
            else {
                align = offset > 0 ? 'right' : 'left';
            }
        }
        return align;
    };
    /**
     * @override
     * 获取 label 的位置
     * @param labelCfg
     * @param mappingData
     * @param index
     */
    PolarLabel.prototype.getLabelPoint = function (labelCfg, mappingData, index) {
        var factor = 1;
        var arcPoint;
        var content = labelCfg.content[index];
        if (this.isToMiddle(mappingData)) {
            arcPoint = this.getMiddlePoint(mappingData.points);
        }
        else {
            if (labelCfg.content.length === 1 && index === 0) {
                index = 1;
            }
            else if (index === 0) {
                factor = -1;
            }
            arcPoint = this.getArcPoint(mappingData, index);
        }
        var offset = this.getDefaultOffset(labelCfg.offset) * factor;
        var middleAngle = this.getPointAngle(arcPoint);
        var isLabelEmit = labelCfg.labelEmit;
        var labelPositionCfg = this.getCirclePoint(middleAngle, offset, arcPoint, isLabelEmit);
        if (labelPositionCfg.r === 0) {
            // 如果文本位置位于圆心，则不展示
            labelPositionCfg.content = '';
        }
        else {
            labelPositionCfg.content = content;
            labelPositionCfg.angle = middleAngle;
            labelPositionCfg.color = mappingData.color;
        }
        labelPositionCfg.rotate = labelCfg.autoRotate
            ? this.getLabelRotate(middleAngle, offset, isLabelEmit)
            : labelCfg.rotate;
        labelPositionCfg.start = {
            x: arcPoint.x,
            y: arcPoint.y,
        };
        return labelPositionCfg;
    };
    /**
     * 获取圆弧的位置
     */
    PolarLabel.prototype.getArcPoint = function (mappingData, index) {
        if (index === void 0) { index = 0; }
        if (!util_1.isArray(mappingData.x) && !util_1.isArray(mappingData.y)) {
            return {
                x: mappingData.x,
                y: mappingData.y,
            };
        }
        return {
            x: util_1.isArray(mappingData.x) ? mappingData.x[index] : mappingData.x,
            y: util_1.isArray(mappingData.y) ? mappingData.y[index] : mappingData.y,
        };
    };
    /**
     * 计算坐标线点在极坐标系下角度
     * @param point
     */
    PolarLabel.prototype.getPointAngle = function (point) {
        return coordinate_2.getAngleByPoint(this.getCoordinate(), point);
    };
    /**
     * 获取坐标点与圆心形成的圆的位置信息
     * @param angle
     * @param offset
     * @param point
     * @param isLabelEmit
     */
    PolarLabel.prototype.getCirclePoint = function (angle, offset, point, isLabelEmit) {
        var coordinate = this.getCoordinate();
        var center = coordinate.getCenter();
        var r = coordinate_1.getDistanceToCenter(coordinate, point);
        if (r === 0) {
            return tslib_1.__assign(tslib_1.__assign({}, center), { r: r });
        }
        var labelAngle = angle;
        if (coordinate.isTransposed && r > offset && !isLabelEmit) {
            var appendAngle = Math.asin(offset / (2 * r));
            labelAngle = angle + appendAngle * 2;
        }
        else {
            r = r + offset;
        }
        return {
            x: center.x + r * Math.cos(labelAngle),
            y: center.y + r * Math.sin(labelAngle),
            r: r,
        };
    };
    /**
     * 获取 label 的旋转角度
     * @param angle
     * @param offset
     * @param isLabelEmit
     */
    PolarLabel.prototype.getLabelRotate = function (angle, offset, isLabelEmit) {
        var rotate = angle + HALF_PI;
        if (isLabelEmit) {
            rotate -= HALF_PI;
        }
        if (rotate) {
            if (rotate > HALF_PI) {
                rotate = rotate - Math.PI;
            }
            else if (rotate < -HALF_PI) {
                rotate = rotate + Math.PI;
            }
        }
        return rotate;
    };
    // 获取中心的位置
    PolarLabel.prototype.getMiddlePoint = function (points) {
        var coordinate = this.getCoordinate();
        var count = points.length;
        var middlePoint = {
            x: 0,
            y: 0,
        };
        util_1.each(points, function (point) {
            middlePoint.x += point.x;
            middlePoint.y += point.y;
        });
        middlePoint.x /= count;
        middlePoint.y /= count;
        middlePoint = coordinate.convert(middlePoint);
        return middlePoint;
    };
    // 是否居中
    PolarLabel.prototype.isToMiddle = function (mappingData) {
        return mappingData.x.length > 2;
    };
    return PolarLabel;
}(base_1.default));
exports.default = PolarLabel;

},{"../../util/coordinate":371,"./base":255,"@antv/util":803,"tslib":385}],265:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var path_1 = tslib_1.__importDefault(require("./path"));
/** 引入 Path 对应的 ShapeFactory */
require("./shape/line");
/**
 * Line 几何标记。
 * 常用于折线图的绘制。
 */
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'line';
        var _a = cfg.sortable, sortable = _a === void 0 ? true : _a; // Line 默认会对数据按照 x 轴字段进行排序
        _this.sortable = sortable;
        return _this;
    }
    return Line;
}(path_1.default));
exports.default = Line;

},{"./path":266,"./shape/line":288,"tslib":385}],266:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var constant_1 = require("../constant");
var base_1 = tslib_1.__importDefault(require("./base"));
var element_1 = tslib_1.__importDefault(require("./element"));
/** 引入对应的 ShapeFactory */
require("./shape/line");
var is_model_change_1 = require("./util/is-model-change");
/**
 * Path 几何标记。
 * 用于绘制路径图等。
 */
var Path = /** @class */ (function (_super) {
    tslib_1.__extends(Path, _super);
    function Path(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'path';
        _this.shapeType = 'line';
        var _a = cfg.connectNulls, connectNulls = _a === void 0 ? false : _a, _b = cfg.showSinglePoint, showSinglePoint = _b === void 0 ? true : _b;
        _this.connectNulls = connectNulls;
        _this.showSinglePoint = showSinglePoint;
        return _this;
    }
    /**
     * 创建所有的 Element 实例，对于 Path、Line、Area，一组数据对应一个 Element。
     * @param mappingData
     * @param [isUpdate]
     * @returns elements
     */
    Path.prototype.createElements = function (mappingData, index, isUpdate) {
        if (isUpdate === void 0) { isUpdate = false; }
        // Path 的每个 element 对应一组数据
        var _a = this, lastElementsMap = _a.lastElementsMap, elementsMap = _a.elementsMap, elements = _a.elements, container = _a.container;
        var elementId = this.getElementId(mappingData);
        var shapeCfg = this.getShapeInfo(mappingData);
        var result = lastElementsMap[elementId];
        if (!result) {
            var shapeFactory = this.getShapeFactory();
            result = new element_1.default({
                shapeFactory: shapeFactory,
                container: container,
                offscreenGroup: this.getOffscreenGroup(),
            });
            result.geometry = this;
            result.animate = this.animateOption;
            result.draw(shapeCfg, isUpdate); // 绘制 shape
        }
        else {
            // element 已经创建
            var preShapeCfg = result.getModel();
            if (this.isCoordinateChanged || is_model_change_1.isModelChange(preShapeCfg, shapeCfg)) {
                result.animate = this.animateOption;
                // 通过绘制数据的变更来判断是否需要更新，因为用户有可能会修改图形属性映射
                result.update(shapeCfg); // 更新对应的 element
            }
            delete lastElementsMap[elementId];
        }
        elements.push(result);
        elementsMap[elementId] = result;
        return elements;
    };
    /**
     * 获取组成一条线（一组数据）的所有点以及数据
     * @param mappingData 映射后的数组
     */
    Path.prototype.getPointsAndData = function (mappingData) {
        var points = [];
        var data = [];
        for (var i = 0, len = mappingData.length; i < len; i++) {
            var obj = mappingData[i];
            points.push({
                x: obj.x,
                y: obj.y,
            });
            data.push(obj[constant_1.FIELD_ORIGIN]);
        }
        return {
            points: points,
            data: data,
        };
    };
    Path.prototype.getShapeInfo = function (mappingData) {
        var shapeCfg = this.getDrawCfg(mappingData[0]);
        var _a = this.getPointsAndData(mappingData), points = _a.points, data = _a.data;
        shapeCfg.mappingData = mappingData;
        shapeCfg.data = data;
        shapeCfg.isStack = !!this.getAdjust('stack');
        shapeCfg.points = points;
        shapeCfg.connectNulls = this.connectNulls;
        shapeCfg.showSinglePoint = this.showSinglePoint;
        return shapeCfg;
    };
    return Path;
}(base_1.default));
exports.default = Path;

},{"../constant":237,"./base":250,"./element":252,"./shape/line":288,"./util/is-model-change":306,"tslib":385}],267:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("./base"));
/** 引入 Point 对应的 ShapeFactory */
require("./shape/point");
/**
 * Point 几何标记。
 * 常用于绘制点图。
 */
var Point = /** @class */ (function (_super) {
    tslib_1.__extends(Point, _super);
    function Point() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'point';
        _this.shapeType = 'point';
        _this.generatePoints = true;
        return _this;
    }
    /**
     * 获取一个点的绘制信息。
     * @param mappingDatum
     * @returns draw cfg
     */
    Point.prototype.getDrawCfg = function (mappingDatum) {
        var shapeCfg = _super.prototype.getDrawCfg.call(this, mappingDatum);
        return tslib_1.__assign(tslib_1.__assign({}, shapeCfg), { isStack: !!this.getAdjust('stack') });
    };
    return Point;
}(base_1.default));
exports.default = Point;

},{"./base":250,"./shape/point":293,"tslib":385}],268:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
/** 引入 Path 对应的 ShapeFactory */
require("./shape/polygon");
/**
 * Polygon 几何标记。
 * 常用于绘制色块图、日历图等。
 */
var Polygon = /** @class */ (function (_super) {
    tslib_1.__extends(Polygon, _super);
    function Polygon() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'polygon';
        _this.shapeType = 'polygon';
        _this.generatePoints = true;
        return _this;
    }
    /**
     * 获取 Shape 的关键点数据。
     * @param obj
     * @returns
     */
    Polygon.prototype.createShapePointsCfg = function (obj) {
        var cfg = _super.prototype.createShapePointsCfg.call(this, obj);
        var x = cfg.x;
        var y = cfg.y;
        var temp;
        // x y 都是数组时，不做处理
        if (!(util_1.isArray(x) && util_1.isArray(y))) {
            var xScale = this.getXScale();
            var yScale = this.getYScale();
            var xCount = xScale.values.length;
            var yCount = yScale.values.length;
            var xOffset = (0.5 * 1) / xCount;
            var yOffset = (0.5 * 1) / yCount;
            if (xScale.isCategory && yScale.isCategory) {
                // 如果x,y都是分类
                x = [x - xOffset, x - xOffset, x + xOffset, x + xOffset];
                y = [y - yOffset, y + yOffset, y + yOffset, y - yOffset];
            }
            else if (util_1.isArray(x)) {
                // x 是数组
                temp = x;
                x = [temp[0], temp[0], temp[1], temp[1]];
                y = [y - yOffset / 2, y + yOffset / 2, y + yOffset / 2, y - yOffset / 2];
            }
            else if (util_1.isArray(y)) {
                // y 是数组
                temp = y;
                y = [temp[0], temp[1], temp[1], temp[0]];
                x = [x - xOffset / 2, x - xOffset / 2, x + xOffset / 2, x + xOffset / 2];
            }
            cfg.x = x;
            cfg.y = y;
        }
        return cfg;
    };
    return Polygon;
}(base_1.default));
exports.default = Polygon;

},{"./base":250,"./shape/polygon":296,"@antv/util":803,"tslib":385}],269:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var coordinate_1 = require("../util/coordinate");
var base_1 = tslib_1.__importDefault(require("./base"));
/** 引入对应的 ShapeFactory */
require("./shape/schema");
var shape_size_1 = require("./util/shape-size");
/**
 * Schema 几何标记，用于一些自定义图形的绘制，比如箱型图、股票图等。
 */
var Schema = /** @class */ (function (_super) {
    tslib_1.__extends(Schema, _super);
    function Schema() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'schema';
        _this.shapeType = 'schema';
        _this.generatePoints = true;
        return _this;
    }
    /**
     * 获取 Shape 的关键点数据。
     * @param record
     * @returns
     */
    Schema.prototype.createShapePointsCfg = function (record) {
        var cfg = _super.prototype.createShapePointsCfg.call(this, record);
        // 计算每个 shape 的 size
        var size;
        var sizeAttr = this.getAttribute('size');
        if (sizeAttr) {
            size = this.getAttributeValues(sizeAttr, record)[0];
            // 归一化
            var coordinate = this.coordinate;
            var coordinateWidth = coordinate_1.getXDimensionLength(coordinate);
            size = size / coordinateWidth;
        }
        else {
            if (!this.defaultSize) {
                this.defaultSize = shape_size_1.getDefaultSize(this);
            }
            size = this.defaultSize;
        }
        cfg.size = size;
        return cfg;
    };
    return Schema;
}(base_1.default));
exports.default = Schema;

},{"../util/coordinate":371,"./base":250,"./shape/schema":300,"./util/shape-size":308,"tslib":385}],270:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var base_1 = require("../base");
var util_2 = require("./util");
var AreaShapeFactory = base_1.registerShapeFactory('area', {
    defaultShapeType: 'area',
    getDefaultPoints: function (pointInfo) {
        // area 基本标记的绘制需要获取上下两边的顶点
        var x = pointInfo.x, y0 = pointInfo.y0;
        var y = util_1.isArray(pointInfo.y) ? pointInfo.y : [y0, pointInfo.y];
        return y.map(function (yItem) {
            return {
                x: x,
                y: yItem,
            };
        });
    },
});
// Area 几何标记默认的 shape：填充的区域图
base_1.registerShape('area', 'area', {
    draw: function (cfg, container) {
        var attrs = util_2.getShapeAttrs(cfg, false, false, this);
        var shape = container.addShape({
            type: 'path',
            attrs: attrs,
            name: 'area',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                if (r === void 0) { r = 5.5; }
                return [['M', x - r, y - 4], ['L', x + r, y - 4], ['L', x + r, y + 4], ['L', x - r, y + 4], ['Z']];
            },
            style: {
                r: 5,
                fill: color,
            },
        };
    },
});
exports.default = AreaShapeFactory;

},{"../base":275,"./util":274,"@antv/util":803}],271:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("../base");
var util_1 = require("./util");
/**
 * 描边但不填充的区域图
 */
base_1.registerShape('area', 'line', {
    draw: function (cfg, container) {
        var attrs = util_1.getShapeAttrs(cfg, true, false, this);
        var shape = container.addShape({
            type: 'path',
            attrs: attrs,
            name: 'area',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                if (r === void 0) { r = 5.5; }
                return [['M', x - r, y - 4], ['L', x + r, y - 4], ['L', x + r, y + 4], ['L', x - r, y + 4], ['Z']];
            },
            style: {
                r: 5,
                stroke: color,
                fill: null,
            },
        };
    },
});

},{"../base":275,"./util":274}],272:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("../base");
var util_1 = require("./util");
/** 描边的平滑曲面图 */
base_1.registerShape('area', 'smooth-line', {
    draw: function (cfg, container) {
        var coordinate = this.coordinate;
        var attrs = util_1.getShapeAttrs(cfg, true, true, this, util_1.getConstraint(coordinate));
        var shape = container.addShape({
            type: 'path',
            attrs: attrs,
            name: 'area',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                if (r === void 0) { r = 5.5; }
                return [['M', x - r, y - 4], ['L', x + r, y - 4], ['L', x + r, y + 4], ['L', x - r, y + 4], ['Z']];
            },
            style: {
                r: 5,
                stroke: color,
                fill: null,
            },
        };
    },
});

},{"../base":275,"./util":274}],273:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("../base");
var util_1 = require("./util");
/**
 * 填充的平滑曲面图
 */
base_1.registerShape('area', 'smooth', {
    draw: function (cfg, container) {
        var coordinate = this.coordinate;
        var attrs = util_1.getShapeAttrs(cfg, false, true, this, util_1.getConstraint(coordinate));
        var shape = container.addShape({
            type: 'path',
            attrs: attrs,
            name: 'area',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                if (r === void 0) { r = 5.5; }
                return [['M', x - r, y - 4], ['L', x + r, y - 4], ['L', x + r, y + 4], ['L', x - r, y + 4], ['Z']];
            },
            style: {
                r: 5,
                fill: color,
            },
        };
    },
});

},{"../base":275,"./util":274}],274:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConstraint = exports.getShapeAttrs = void 0;
var util_1 = require("@antv/util");
var get_path_points_1 = require("../util/get-path-points");
var get_style_1 = require("../util/get-style");
var path_1 = require("../util/path");
function getPath(points, isInCircle, smooth, registeredShape, constraint) {
    var path = [];
    if (points.length) {
        var topLinePoints_1 = []; // area 区域上部分
        var bottomLinePoints_1 = []; // area 区域下部分
        for (var i = 0, len = points.length; i < len; i++) {
            var point = points[i];
            topLinePoints_1.push(point[1]);
            bottomLinePoints_1.push(point[0]);
        }
        bottomLinePoints_1 = bottomLinePoints_1.reverse();
        util_1.each([topLinePoints_1, bottomLinePoints_1], function (pointsData, index) {
            var subPath = [];
            var parsedPoints = registeredShape.parsePoints(pointsData);
            var p1 = parsedPoints[0];
            if (topLinePoints_1.length === 1 && bottomLinePoints_1.length === 1) {
                // 都只有一个点，绘制一条竖线
                subPath =
                    index === 0
                        ? [
                            ['M', p1.x - 0.5, p1.y],
                            ['L', p1.x + 0.5, p1.y],
                        ]
                        : [
                            ['L', p1.x + 0.5, p1.y],
                            ['L', p1.x - 0.5, p1.y],
                        ];
            }
            else {
                if (isInCircle) {
                    parsedPoints.push({ x: p1.x, y: p1.y });
                }
                if (smooth) {
                    subPath = path_1.getSplinePath(parsedPoints, false, constraint);
                }
                else {
                    subPath = path_1.getLinePath(parsedPoints, false);
                }
                if (index > 0) {
                    subPath[0][0] = 'L';
                }
            }
            path = path.concat(subPath);
        });
        path.push(['Z']);
    }
    return path;
}
/**
 * @ignore
 * Gets shape attrs
 * @param cfg
 * @param isStroke
 * @param smooth
 * @param registeredShape
 * @param [constraint]
 * @returns
 */
function getShapeAttrs(cfg, isStroke, smooth, registeredShape, constraint) {
    var attrs = get_style_1.getStyle(cfg, isStroke, !isStroke, 'lineWidth');
    var connectNulls = cfg.connectNulls, isInCircle = cfg.isInCircle, points = cfg.points, showSinglePoint = cfg.showSinglePoint;
    var pathPoints = get_path_points_1.getPathPoints(points, connectNulls, showSinglePoint); // 根据 connectNulls 配置获取图形关键点
    var path = [];
    for (var i = 0, len = pathPoints.length; i < len; i++) {
        var eachPoints = pathPoints[i];
        path = path.concat(getPath(eachPoints, isInCircle, smooth, registeredShape, constraint));
    }
    attrs.path = path;
    return attrs;
}
exports.getShapeAttrs = getShapeAttrs;
/**
 * @ignore
 * Gets constraint
 * @param coordinate
 * @returns constraint
 */
function getConstraint(coordinate) {
    var start = coordinate.start, end = coordinate.end;
    return [
        [start.x, end.y],
        [end.x, start.y],
    ];
}
exports.getConstraint = getConstraint;

},{"../util/get-path-points":301,"../util/get-style":302,"../util/path":303,"@antv/util":803}],275:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getShapeFactory = exports.registerShape = exports.registerShapeFactory = void 0;
var tslib_1 = require("tslib");
var path_util_1 = require("@antv/path-util");
var util_1 = require("@antv/util");
var path_1 = require("./util/path");
/** ShapeFactory 基类 */
var ShapeFactoryBase = {
    /** 坐标系对象 */
    coordinate: null,
    /** 默认绘制的 Shape 类型 */
    defaultShapeType: null,
    /** 主题样式 */
    theme: null,
    /**
     * 获取 shape 绘制需要的关键点
     * @param shapeType shape 类型
     * @param shapePoint 每条数据映射后的坐标点以及 size 数值
     * @returns 图形关键点信息
     */
    getShapePoints: function (shapeType, shapePoint) {
        var shape = this.getShape(shapeType);
        if (shape.getPoints) {
            return shape.getPoints(shapePoint);
        }
        return this.getDefaultPoints(shapePoint);
    },
    /**
     * 根据 shape 类型获取具体的 shape 实例
     * @param shapeType string shape 的类型
     * @returns
     */
    getShape: function (shapeType) {
        var shape = this[shapeType] || this[this.defaultShapeType];
        shape.coordinate = this.coordinate;
        return shape;
    },
    /**
     * 获取 shape 的默认关键点
     * @override
     */
    getDefaultPoints: function () {
        return [];
    },
    /**
     * 获取 shape 对应的缩略图配置信息。
     * @param shapeType shape 类型
     * @param color 颜色
     * @param isInPolar 是否在极坐标系下
     * @returns 返回缩略图 marker 配置。
     */
    getMarker: function (shapeType, markerCfg) {
        var shape = this.getShape(shapeType);
        if (!shape.getMarker) {
            var defaultShapeType = this.defaultShapeType;
            shape = this.getShape(defaultShapeType);
        }
        var theme = this.theme;
        var shapeStyle = util_1.get(theme, [shapeType, 'default'], {});
        var markerStyle = shape.getMarker(markerCfg);
        return util_1.deepMix({}, shapeStyle, markerStyle);
    },
    /**
     * 绘制 shape
     * @override
     * @param shapeType 绘制的 shape 类型
     * @param cfg 绘制 shape 需要的信息
     * @param element Element 实例
     * @returns
     */
    drawShape: function (shapeType, cfg, container) {
        var shape = this.getShape(shapeType);
        return shape.draw(cfg, container);
    },
};
/** Shape 基类 */
var ShapeBase = {
    /** 坐标系对象 */
    coordinate: null,
    /**
     * 将归一化的 path 转换成坐标系下的 path
     * @param path 归一化的路径
     * @returns
     */
    parsePath: function (path) {
        var coordinate = this.coordinate;
        var parsedPath = path_util_1.parsePathString(path);
        if (coordinate.isPolar) {
            parsedPath = path_1.convertPolarPath(coordinate, parsedPath);
        }
        else {
            parsedPath = path_1.convertNormalPath(coordinate, parsedPath);
        }
        return parsedPath;
    },
    /**
     * 将归一化的坐标转换成画布坐标
     * @param point 归一化的坐标点数据
     * @returns
     */
    parsePoint: function (point) {
        var coordinate = this.coordinate;
        return coordinate.convert(point);
    },
    /**
     * 0～1 points 转 画布 points
     * @param points 节点集合
     * @returns
     */
    parsePoints: function (points) {
        var coordinate = this.coordinate;
        return points.map(function (point) {
            return coordinate.convert(point);
        });
    },
    /**
     * 绘制 shape
     * @override
     */
    draw: function (cfg, container) { },
};
var ShapeFactoryMap = {};
/**
 * 注册 ShapeFactory。
 * @param factoryName  ShapeFactory 名称，对应 Geometry 几何标记名称。
 * @param cfg 注册 ShapeFactory 需要覆写定义的属性。
 * @returns 返回 ShapeFactory 对象。
 */
function registerShapeFactory(factoryName, cfg) {
    var className = util_1.upperFirst(factoryName);
    var geomObj = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, ShapeFactoryBase), cfg), { geometryType: factoryName });
    ShapeFactoryMap[className] = geomObj;
    return geomObj;
}
exports.registerShapeFactory = registerShapeFactory;
/**
 * 注册 Shape。
 * @param factoryName 对应的 ShapeFactory 名称。
 * @param shapeType 注册的 shape 名称。
 * @param cfg 注册 Shape 需要覆写定义的属性。
 * @returns shape 返回注册的 shape 对象。
 */
function registerShape(factoryName, shapeType, cfg) {
    var className = util_1.upperFirst(factoryName);
    var factory = ShapeFactoryMap[className];
    var shapeObj = tslib_1.__assign(tslib_1.__assign({}, ShapeBase), cfg);
    factory[shapeType] = shapeObj;
    return shapeObj;
}
exports.registerShape = registerShape;
/**
 * 获取 factoryName 对应的 shapeFactory
 * @param factoryName
 * @returns shape factory
 */
function getShapeFactory(factoryName) {
    var className = util_1.upperFirst(factoryName);
    return ShapeFactoryMap[className];
}
exports.getShapeFactory = getShapeFactory;

},{"./util/path":303,"@antv/path-util":724,"@antv/util":803,"tslib":385}],276:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var graphics_1 = require("../../../util/graphics");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
function getArcShapePath(from, to, center) {
    var sub = util_1.getQPath(to, center);
    var path = [['M', from.x, from.y]];
    path.push(sub);
    return path;
}
function getArcShapeWeightPath(points, center) {
    var arc1 = util_1.getQPath(points[1], center);
    var arc2 = util_1.getQPath(points[3], center);
    var path = [['M', points[0].x, points[0].y]];
    path.push(arc2);
    path.push(['L', points[3].x, points[3].y]);
    path.push(['L', points[2].x, points[2].y]);
    path.push(arc1);
    path.push(['L', points[1].x, points[1].y]);
    path.push(['L', points[0].x, points[0].y]);
    path.push(['Z']);
    return path;
}
// 弧线包括笛卡尔坐标系下的半圆弧线、极坐标系下以圆心为控制点的二阶曲线、笛卡尔坐标系下带权重的三阶曲线、极坐标系下带权重的以圆心为控制点的二阶曲线
base_1.registerShape('edge', 'arc', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false, 'lineWidth');
        var points = cfg.points;
        var type = points.length > 2 ? 'weight' : 'normal';
        var path;
        if (cfg.isInCircle) {
            var center = { x: 0, y: 1 };
            if (type === 'normal') {
                path = getArcShapePath(points[0], points[1], center);
            }
            else {
                style.fill = style.stroke;
                path = getArcShapeWeightPath(points, center);
            }
            path = this.parsePath(path);
            return container.addShape('path', {
                attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            });
        }
        else {
            if (type === 'normal') {
                points = this.parsePoints(points);
                path = graphics_1.getArcPath((points[1].x + points[0].x) / 2, points[0].y, Math.abs(points[1].x - points[0].x) / 2, Math.PI, Math.PI * 2);
                return container.addShape('path', {
                    attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
                });
            }
            else {
                var c1 = util_1.getCPath(points[1], points[3]);
                var c2 = util_1.getCPath(points[2], points[0]);
                path = [
                    ['M', points[0].x, points[0].y],
                    ['L', points[1].x, points[1].y],
                    c1,
                    ['L', points[3].x, points[3].y],
                    ['L', points[2].x, points[2].y],
                    c2,
                    ['Z'],
                ];
                path = this.parsePath(path);
                style.fill = style.stroke;
                return container.addShape('path', {
                    attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
                });
            }
        }
    },
    getMarker: function (markerCfg) {
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: markerCfg.color,
            },
        };
    },
});

},{"../../../util/graphics":375,"../base":275,"../util/get-style":302,"./util":279,"tslib":385}],277:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var path_1 = require("../util/path");
var split_points_1 = require("../util/split-points");
var EdgeShapeFactory = base_1.registerShapeFactory('edge', {
    defaultShapeType: 'line',
    getDefaultPoints: function (pointInfo) {
        return split_points_1.splitPoints(pointInfo);
    },
});
base_1.registerShape('edge', 'line', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false, 'lineWidth');
        var path = path_1.getLinePath(this.parsePoints(cfg.points), this.coordinate.isPolar);
        return container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
        });
    },
    getMarker: function (markerCfg) {
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: markerCfg.color,
            },
        };
    },
});
exports.default = EdgeShapeFactory;

},{"../base":275,"../util/get-style":302,"../util/path":303,"../util/split-points":304,"tslib":385}],278:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
function getSmoothPath(from, to) {
    var sub = util_1.getCPath(from, to);
    var path = [['M', from.x, from.y]];
    path.push(sub);
    return path;
}
base_1.registerShape('edge', 'smooth', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false, 'lineWidth');
        var points = cfg.points;
        var path = this.parsePath(getSmoothPath(points[0], points[1]));
        return container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
        });
    },
    getMarker: function (markerCfg) {
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: markerCfg.color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"./util":279,"tslib":385}],279:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getQPath = exports.getCPath = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * Gets cpath
 * @param from
 * @param to
 * @returns
 */
function getCPath(from, to) {
    var points = [];
    points.push({
        x: from.x,
        y: (from.y * 1) / 2 + (to.y * 1) / 2,
    });
    points.push({
        x: to.x,
        y: (from.y * 1) / 2 + (to.y * 1) / 2,
    });
    points.push(to);
    var sub = ['C'];
    util_1.each(points, function (point) {
        sub.push(point.x, point.y);
    });
    return sub;
}
exports.getCPath = getCPath;
/**
 * @ignore
 * Gets qpath
 * @param to
 * @param center
 * @returns
 */
function getQPath(to, center) {
    var points = [];
    points.push({
        x: center.x,
        y: center.y,
    });
    points.push(to);
    var sub = ['Q'];
    util_1.each(points, function (point) {
        sub.push(point.x, point.y);
    });
    return sub;
}
exports.getQPath = getQPath;

},{"@antv/util":803}],280:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var CORNER_PERCENT = 1 / 3;
function getVHVPath(from, to) {
    var points = [];
    points.push({
        x: from.x,
        y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
    });
    points.push({
        x: to.x,
        y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
    });
    points.push(to);
    var path = [['M', from.x, from.y]];
    util_1.each(points, function (point) {
        path.push(['L', point.x, point.y]);
    });
    return path;
}
base_1.registerShape('edge', 'vhv', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false, 'lineWidth');
        var points = cfg.points;
        var path = this.parsePath(getVHVPath(points[0], points[1]));
        return container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
        });
    },
    getMarker: function (markerCfg) {
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: markerCfg.color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],281:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
/** 漏斗图 */
base_1.registerShape('interval', 'funnel', {
    getPoints: function (shapePoint) {
        shapePoint.size = shapePoint.size * 2; // 漏斗图的 size 是柱状图的两倍
        return util_1.getRectPoints(shapePoint);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, false, true);
        var path = this.parsePath(util_1.getFunnelPath(cfg.points, cfg.nextPoints, false));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"./util":287,"tslib":385}],282:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
/** 描边柱状图 */
base_1.registerShape('interval', 'hollow-rect', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false);
        var path = this.parsePath(util_1.getRectPath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color, isInPolar = markerCfg.isInPolar;
        if (isInPolar) {
            return {
                symbol: 'circle',
                style: {
                    r: 4.5,
                    stroke: color,
                    fill: null,
                },
            };
        }
        return {
            symbol: 'square',
            style: {
                r: 4,
                stroke: color,
                fill: null,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"./util":287,"tslib":385}],283:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
/** Interval 的 shape 工厂 */
var IntervalShapeFactory = base_1.registerShapeFactory('interval', {
    defaultShapeType: 'rect',
    getDefaultPoints: function (pointInfo) {
        return util_1.getRectPoints(pointInfo);
    },
});
/** Inerval 默认 shape，填充的矩形 */
base_1.registerShape('interval', 'rect', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, false, true);
        var path = this.parsePath(util_1.getRectPath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color, isInPolar = markerCfg.isInPolar;
        if (isInPolar) {
            return {
                symbol: 'circle',
                style: {
                    r: 4.5,
                    fill: color,
                },
            };
        }
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});
exports.default = IntervalShapeFactory;

},{"../base":275,"../util/get-style":302,"./util":287,"tslib":385}],284:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_2 = require("./util");
// 根据数据点生成 Line 的两个关键点
function getLinePoints(pointInfo) {
    var x = pointInfo.x, y = pointInfo.y, y0 = pointInfo.y0;
    if (util_1.isArray(y)) {
        return y.map(function (yItem, idx) {
            return {
                x: util_1.isArray(x) ? x[idx] : x,
                y: yItem,
            };
        });
    }
    // 起始点从 y0 开始
    return [
        { x: x, y: y0 },
        { x: x, y: y },
    ];
}
base_1.registerShape('interval', 'line', {
    getPoints: function (shapePoint) {
        return getLinePoints(shapePoint);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false, 'lineWidth');
        var path = this.parsePath(util_2.getRectPath(cfg.points, false));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                return [
                    ['M', x, y - r],
                    ['L', x, y + r],
                ];
            },
            style: {
                r: 5,
                stroke: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"./util":287,"@antv/util":803,"tslib":385}],285:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
var util_1 = require("./util");
/** 金字塔图，尖底漏斗图 */
base_1.registerShape('interval', 'pyramid', {
    getPoints: function (shapePoint) {
        shapePoint.size = shapePoint.size * 2; // 漏斗图的 size 是柱状图的两倍
        return util_1.getRectPoints(shapePoint, true);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, false, true);
        var path = this.parsePath(util_1.getFunnelPath(cfg.points, cfg.nextPoints, true));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"./util":287,"tslib":385}],286:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
// 根据数据点生成 tick shape 的 6 个关键点
function getTickPoints(pointInfo) {
    var x = pointInfo.x, y = pointInfo.y, y0 = pointInfo.y0, size = pointInfo.size;
    var yMin;
    var yMax;
    if (util_1.isArray(y)) {
        yMin = y[0], yMax = y[1];
    }
    else {
        yMin = y0;
        yMax = y;
    }
    var xMax = x + size / 2;
    var xMin = x - size / 2;
    // tick 关键点顺序
    // 4 - 1 - 5
    //     |
    // 2 - 0 - 3
    return [
        { x: x, y: yMin },
        { x: x, y: yMax },
        { x: xMin, y: yMin },
        { x: xMax, y: yMin },
        { x: xMin, y: yMax },
        { x: xMax, y: yMax },
    ];
}
// 根据 tick 关键点绘制 path
function getTickPath(points) {
    return [
        ['M', points[0].x, points[0].y],
        ['L', points[1].x, points[1].y],
        ['M', points[2].x, points[2].y],
        ['L', points[3].x, points[3].y],
        ['M', points[4].x, points[4].y],
        ['L', points[5].x, points[5].y],
    ];
}
/** I 形状柱状图，常用于 error bar chart */
base_1.registerShape('interval', 'tick', {
    getPoints: function (shapePoint) {
        return getTickPoints(shapePoint);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false);
        var path = this.parsePath(getTickPath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                return [
                    ['M', x - r / 2, y - r],
                    ['L', x + r / 2, y - r],
                    ['M', x, y - r],
                    ['L', x, y + r],
                    ['M', x - r / 2, y + r],
                    ['L', x + r / 2, y + r],
                ];
            },
            style: {
                r: 5,
                stroke: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],287:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunnelPath = exports.getRectPath = exports.getRectPoints = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * 根据数据点生成矩形的四个关键点
 * @param pointInfo 数据点信息
 * @param [isPyramid] 是否为尖底漏斗图
 * @returns rect points 返回矩形四个顶点信息
 */
function getRectPoints(pointInfo, isPyramid) {
    if (isPyramid === void 0) { isPyramid = false; }
    var x = pointInfo.x, y = pointInfo.y, y0 = pointInfo.y0, size = pointInfo.size;
    // 有 4 种情况，
    // 1. x, y 都不是数组
    // 2. y是数组，x不是
    // 3. x是数组，y不是
    // 4. x, y 都是数组
    var yMin;
    var yMax;
    if (util_1.isArray(y)) {
        yMin = y[0], yMax = y[1];
    }
    else {
        yMin = y0;
        yMax = y;
    }
    var xMin;
    var xMax;
    if (util_1.isArray(x)) {
        xMin = x[0], xMax = x[1];
    }
    else {
        xMin = x - size / 2;
        xMax = x + size / 2;
    }
    var points = [
        { x: xMin, y: yMin },
        { x: xMin, y: yMax },
    ];
    if (isPyramid) {
        // 绘制尖底漏斗图
        // 金字塔漏斗图的关键点
        // 1
        // |   2
        // 0
        points.push({
            x: xMax,
            y: (yMax + yMin) / 2,
        });
    }
    else {
        // 矩形的四个关键点，结构如下（左下角顺时针连接）
        // 1 ---- 2
        // |      |
        // 0 ---- 3
        points.push({ x: xMax, y: yMax }, { x: xMax, y: yMin });
    }
    return points;
}
exports.getRectPoints = getRectPoints;
/**
 * @ignore
 * 根据矩形关键点绘制 path
 * @param points 关键点数组
 * @param isClosed path 是否需要闭合
 * @returns 返回矩形的 path
 */
function getRectPath(points, isClosed) {
    if (isClosed === void 0) { isClosed = true; }
    var path = [];
    var firstPoint = points[0];
    path.push(['M', firstPoint.x, firstPoint.y]);
    for (var i = 1, len = points.length; i < len; i++) {
        path.push(['L', points[i].x, points[i].y]);
    }
    // 对于 shape="line" path 不应该闭合，否则会造成 lineCap 绘图属性失效
    if (isClosed) {
        path.push(['L', firstPoint.x, firstPoint.y]); // 需要闭合
        path.push(['z']);
    }
    return path;
}
exports.getRectPath = getRectPath;
/**
 * @ignore
 * 根据 funnel 关键点绘制漏斗图的 path
 * @param points 图形关键点信息
 * @param nextPoints 下一个数据的图形关键点信息
 * @param isPyramid 是否为尖底漏斗图
 * @returns 返回漏斗图的图形 path
 */
function getFunnelPath(points, nextPoints, isPyramid) {
    var path = [];
    if (!util_1.isNil(nextPoints)) {
        path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', nextPoints[1].x, nextPoints[1].y], ['L', nextPoints[0].x, nextPoints[0].y], ['Z']);
    }
    else if (isPyramid) {
        // 金字塔最底部
        path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['L', points[2].x, points[2].y], ['Z']);
    }
    else {
        // 漏斗图最底部
        path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['Z']);
    }
    return path;
}
exports.getFunnelPath = getFunnelPath;

},{"@antv/util":803}],288:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_path_points_1 = require("../util/get-path-points");
var get_style_1 = require("../util/get-style");
var path_1 = require("../util/path");
var split_points_1 = require("../util/split-points");
var util_2 = require("./util");
function getShapeAttrs(cfg, smooth, constraint) {
    var isStack = cfg.isStack, connectNulls = cfg.connectNulls, isInCircle = cfg.isInCircle, showSinglePoint = cfg.showSinglePoint;
    var shapeAttrs = get_style_1.getStyle(cfg, true, false, 'lineWidth');
    var points = get_path_points_1.getPathPoints(cfg.points, connectNulls, showSinglePoint); // 根据 connectNulls 值处理 points
    var path = [];
    for (var i = 0, len = points.length; i < len; i++) {
        var eachLinePoints = points[i];
        path = path.concat(getPath(eachLinePoints, isInCircle, isStack, smooth, constraint, shapeAttrs));
    }
    shapeAttrs.path = path;
    return shapeAttrs;
}
// 单条 path
function getSinglePath(points, isInCircle, smooth, constraint, style) {
    if (points.length === 1) {
        // 只有一个点时
        return [
            ['M', points[0].x, points[0].y - style.lineWidth / 2],
            ['L', points[0].x, points[0].y],
            ['L', points[0].x, points[0].y + style.lineWidth / 2],
        ];
    }
    var path;
    if (!smooth) {
        path = path_1.getLinePath(points, false);
        if (isInCircle) {
            path.push(['Z']);
        }
    }
    else {
        // 直角坐标系下绘制曲线时限制最大值、最小值
        if (isInCircle && points.length) {
            points.push({ x: points[0].x, y: points[0].y });
        }
        path = path_1.getSplinePath(points, false, constraint);
    }
    return path;
}
function getRangePath(points, isInCircle, isStack, smooth, constraint, style) {
    var topPoints = [];
    var bottomPoints = [];
    util_1.each(points, function (point) {
        var result = split_points_1.splitPoints(point);
        topPoints.push(result[1]); // 上边
        bottomPoints.push(result[0]); // 底边
    });
    var topPath = getSinglePath(topPoints, isInCircle, smooth, constraint, style);
    var bottomPath = getSinglePath(bottomPoints, isInCircle, smooth, constraint, style);
    if (isStack) {
        return topPath;
    }
    return topPath.concat(bottomPath);
}
function getPath(points, isInCircle, isStack, smooth, constraint, style) {
    if (points.length) {
        var first = points[0];
        return util_1.isArray(first.y)
            ? getRangePath(points, isInCircle, isStack, smooth, constraint, style)
            : getSinglePath(points, isInCircle, smooth, constraint, style);
    }
    return [];
}
var LineShapeFactory = base_1.registerShapeFactory('line', {
    defaultShapeType: 'line',
});
// 这里因为代码公用，所以直接全部注册
// 'line' 默认折线；'dot' 点线 ···；'dash' 断线 - - -
util_1.each(['line', 'dot', 'dash', 'smooth'], function (shapeType) {
    base_1.registerShape('line', shapeType, {
        draw: function (cfg, container) {
            var smooth = shapeType === 'smooth';
            var constraint;
            if (smooth) {
                var _a = this.coordinate, start = _a.start, end = _a.end;
                constraint = [
                    [start.x, end.y],
                    [end.x, start.y],
                ];
            }
            var attrs = getShapeAttrs(cfg, smooth, constraint);
            var shape = container.addShape({
                type: 'path',
                attrs: attrs,
                name: 'line',
            });
            return shape;
        },
        getMarker: function (markerCfg) {
            return util_2.getLineMarker(markerCfg, shapeType);
        },
    });
});
exports.default = LineShapeFactory;

},{"../base":275,"../util/get-path-points":301,"../util/get-style":302,"../util/path":303,"../util/split-points":304,"./util":290,"@antv/util":803}],289:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_path_points_1 = require("../util/get-path-points");
var get_style_1 = require("../util/get-style");
var util_2 = require("./util");
var interpolateCallback = function (point, nextPoint, shapeType) {
    var x = point.x;
    var y = point.y;
    var nextX = nextPoint.x;
    var nextY = nextPoint.y;
    var result;
    switch (shapeType) {
        case 'hv':
            result = [{ x: nextX, y: y }];
            break;
        case 'vh':
            result = [{ x: x, y: nextY }];
            break;
        case 'hvh':
            var middleX = (nextX + x) / 2;
            result = [
                { x: middleX, y: y },
                { x: middleX, y: nextY },
            ];
            break;
        case 'vhv':
            var middleY = (y + nextY) / 2;
            result = [
                { x: x, y: middleY },
                { x: nextX, y: middleY },
            ];
            break;
        default:
            break;
    }
    return result;
};
function getInterpolatePoints(points, shapeType) {
    var result = [];
    util_1.each(points, function (point, index) {
        var nextPoint = points[index + 1];
        result.push(point);
        if (nextPoint) {
            var interpolatePoint = interpolateCallback(point, nextPoint, shapeType);
            result = result.concat(interpolatePoint);
        }
    });
    return result;
}
// 插值的图形path，不考虑null
function getInterpolatePath(points) {
    return points.map(function (point, index) {
        return index === 0 ? ['M', point.x, point.y] : ['L', point.x, point.y];
    });
}
// 插值的图形
function getInterpolateShapeAttrs(cfg, shapeType) {
    var points = get_path_points_1.getPathPoints(cfg.points, cfg.connectNulls, cfg.showSinglePoint); // 根据 connectNulls 值处理 points
    var path = [];
    util_1.each(points, function (eachLinePoints) {
        var interpolatePoints = getInterpolatePoints(eachLinePoints, shapeType);
        path = path.concat(getInterpolatePath(interpolatePoints));
    });
    return tslib_1.__assign(tslib_1.__assign({}, get_style_1.getStyle(cfg, true, false, 'lineWidth')), { path: path });
}
// step line
util_1.each(['hv', 'vh', 'hvh', 'vhv'], function (shapeType) {
    base_1.registerShape('line', shapeType, {
        draw: function (cfg, container) {
            var attrs = getInterpolateShapeAttrs(cfg, shapeType);
            var shape = container.addShape({
                type: 'path',
                attrs: attrs,
                name: 'line',
            });
            return shape;
        },
        getMarker: function (markerCfg) {
            return util_2.getLineMarker(markerCfg, shapeType);
        },
    });
});

},{"../base":275,"../util/get-path-points":301,"../util/get-style":302,"./util":290,"@antv/util":803,"tslib":385}],290:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLineMarker = void 0;
var LineSymbols = {
    line: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['L', x + r, y],
        ];
    },
    dot: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['L', x + r, y],
        ];
    },
    dash: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['L', x + r, y],
        ];
    },
    smooth: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['A', r / 2, r / 2, 0, 1, 1, x, y],
            ['A', r / 2, r / 2, 0, 1, 0, x + r, y],
        ];
    },
    hv: function (x, y, r) {
        return [
            ['M', x - r - 1, y - 2.5],
            ['L', x, y - 2.5],
            ['L', x, y + 2.5],
            ['L', x + r + 1, y + 2.5],
        ];
    },
    vh: function (x, y, r) {
        return [
            ['M', x - r - 1, y + 2.5],
            ['L', x, y + 2.5],
            ['L', x, y - 2.5],
            ['L', x + r + 1, y - 2.5],
        ];
    },
    hvh: function (x, y, r) {
        return [
            ['M', x - (r + 1), y + 2.5],
            ['L', x - r / 2, y + 2.5],
            ['L', x - r / 2, y - 2.5],
            ['L', x + r / 2, y - 2.5],
            ['L', x + r / 2, y + 2.5],
            ['L', x + r + 1, y + 2.5],
        ];
    },
    vhv: function (x, y) {
        // 宽 13px，高 8px
        return [
            ['M', x - 5, y + 2.5],
            ['L', x - 5, y],
            ['L', x, y],
            ['L', x, y - 3],
            ['L', x, y + 3],
            ['L', x + 6.5, y + 3],
        ];
    },
};
/**
 * Gets line marker
 * @ignore
 * @param markerCfg
 * @param shapeType
 * @returns 返回 Line 的 marker 配置
 */
function getLineMarker(markerCfg, shapeType) {
    var color = markerCfg.color;
    return {
        symbol: LineSymbols[shapeType],
        style: {
            lineWidth: 2,
            r: 6,
            stroke: color,
        },
    };
}
exports.getLineMarker = getLineMarker;

},{}],291:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var marker_1 = require("../../../util/marker");
var base_1 = require("../base");
var util_2 = require("./util");
// 添加 hollowShape
util_1.each(util_2.HOLLOW_SHAPES, function (shapeName) {
    base_1.registerShape('point', shapeName, {
        draw: function (cfg, container) {
            return util_2.drawPoints(this, cfg, container, shapeName, true);
        },
        getMarker: function (markerCfg) {
            var color = markerCfg.color;
            return {
                symbol: marker_1.MarkerSymbols[shapeName],
                style: {
                    r: 4.5,
                    stroke: color,
                    fill: null,
                },
            };
        },
    });
});

},{"../../../util/marker":379,"../base":275,"./util":295,"@antv/util":803}],292:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
base_1.registerShape('point', 'image', {
    draw: function (cfg, container) {
        var size = get_style_1.getStyle(cfg, false, false, 'r').r;
        var points = this.parsePoints(cfg.points);
        var pointPosition = points[0];
        if (cfg.isStack) {
            pointPosition = points[1];
        }
        else if (points.length > 1) {
            var group = container.addGroup();
            for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
                var point = points_1[_i];
                group.addShape('image', {
                    attrs: {
                        x: point.x - size / 2,
                        y: point.y - size,
                        width: size,
                        height: size,
                        img: cfg.shape[1],
                    },
                });
            }
            return group;
        }
        return container.addShape('image', {
            attrs: {
                x: pointPosition.x - size / 2,
                y: pointPosition.y - size,
                width: size,
                height: size,
                img: cfg.shape[1],
            },
        });
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302}],293:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var marker_1 = require("../../../util/marker");
var base_1 = require("../base");
var split_points_1 = require("../util/split-points");
var util_2 = require("./util");
var PointShapeFactory = base_1.registerShapeFactory('point', {
    defaultShapeType: 'hollow-circle',
    getDefaultPoints: function (pointInfo) {
        return split_points_1.splitPoints(pointInfo);
    },
});
util_1.each(util_2.SHAPES, function (shapeName) {
    // 添加该 shape 对应的 hollow-shape
    base_1.registerShape('point', "hollow-" + shapeName, {
        draw: function (cfg, container) {
            return util_2.drawPoints(this, cfg, container, shapeName, true);
        },
        getMarker: function (markerCfg) {
            var color = markerCfg.color;
            return {
                symbol: marker_1.MarkerSymbols[shapeName] || shapeName,
                style: {
                    r: 4.5,
                    stroke: color,
                    fill: null,
                },
            };
        },
    });
});
exports.default = PointShapeFactory;

},{"../../../util/marker":379,"../base":275,"../util/split-points":304,"./util":295,"@antv/util":803}],294:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var marker_1 = require("../../../util/marker");
var base_1 = require("../base");
var util_2 = require("./util");
// 所有的 SHAPES 都注册一下
util_1.each(util_2.SHAPES, function (shapeName) {
    base_1.registerShape('point', shapeName, {
        draw: function (cfg, container) {
            return util_2.drawPoints(this, cfg, container, shapeName, false);
        },
        getMarker: function (markerCfg) {
            var color = markerCfg.color;
            return {
                symbol: marker_1.MarkerSymbols[shapeName] || shapeName,
                style: {
                    r: 4.5,
                    fill: color,
                },
            };
        },
    });
});

},{"../../../util/marker":379,"../base":275,"./util":295,"@antv/util":803}],295:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawPoints = exports.HOLLOW_SHAPES = exports.SHAPES = void 0;
var tslib_1 = require("tslib");
var marker_1 = require("../../../util/marker");
var get_style_1 = require("../util/get-style");
exports.SHAPES = ['circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down'];
exports.HOLLOW_SHAPES = ['cross', 'tick', 'plus', 'hyphen', 'line'];
/**
 * @ignore
 * Draws points
 * @param shape
 * @param cfg
 * @param container
 * @param shapeName
 * @param isStroke
 * @returns points
 */
function drawPoints(shape, cfg, container, shapeName, isStroke) {
    var style = get_style_1.getStyle(cfg, isStroke, !isStroke, 'r');
    var points = shape.parsePoints(cfg.points);
    var pointPosition = points[0];
    if (cfg.isStack) {
        pointPosition = points[1];
    }
    else if (points.length > 1) {
        var group = container.addGroup();
        for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
            var point = points_1[_i];
            group.addShape({
                type: 'marker',
                attrs: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, style), { symbol: marker_1.MarkerSymbols[shapeName] || shapeName }), point),
            });
        }
        return group;
    }
    return container.addShape({
        type: 'marker',
        attrs: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, style), { symbol: marker_1.MarkerSymbols[shapeName] || shapeName }), pointPosition),
    });
}
exports.drawPoints = drawPoints;

},{"../../../util/marker":379,"../util/get-style":302,"tslib":385}],296:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
function getPath(points) {
    var flag = points[0];
    var i = 1;
    var path = [['M', flag.x, flag.y]];
    while (i < points.length) {
        var c = points[i];
        if (c.x !== points[i - 1].x || c.y !== points[i - 1].y) {
            path.push(['L', c.x, c.y]);
            if (c.x === flag.x && c.y === flag.y && i < points.length - 1) {
                flag = points[i + 1];
                path.push(['Z']);
                path.push(['M', flag.x, flag.y]);
                i++;
            }
        }
        i++;
    }
    if (!util_1.isEqual(util_1.last(path), flag)) {
        path.push(['L', flag.x, flag.y]);
    }
    path.push(['Z']);
    return path;
}
var PolygonShapeFactory = base_1.registerShapeFactory('polygon', {
    defaultShapeType: 'polygon',
    getDefaultPoints: function (pointInfo) {
        var points = [];
        util_1.each(pointInfo.x, function (subX, index) {
            var subY = pointInfo.y[index];
            points.push({
                x: subX,
                y: subY,
            });
        });
        return points;
    },
});
base_1.registerShape('polygon', 'polygon', {
    draw: function (cfg, container) {
        if (!util_1.isEmpty(cfg.points)) {
            var shapeAttrs = get_style_1.getStyle(cfg, true, true);
            var path = this.parsePath(getPath(cfg.points));
            return container.addShape('path', {
                attrs: tslib_1.__assign(tslib_1.__assign({}, shapeAttrs), { path: path }),
                name: 'polygon',
            });
        }
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});
exports.default = PolygonShapeFactory;

},{"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],297:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
function getRectAttrs(points, size) {
    var width = Math.abs(points[0].x - points[2].x);
    var height = Math.abs(points[0].y - points[2].y);
    var len = Math.min(width, height);
    if (size) {
        len = util_1.clamp(size, 0, Math.min(width, height));
    }
    len = len / 2;
    var centerX = (points[0].x + points[2].x) / 2;
    var centerY = (points[0].y + points[2].y) / 2;
    return {
        x: centerX - len,
        y: centerY - len,
        width: len * 2,
        height: len * 2,
    };
}
base_1.registerShape('polygon', 'square', {
    draw: function (cfg, container) {
        if (!util_1.isEmpty(cfg.points)) {
            var shapeAttrs = get_style_1.getStyle(cfg, true, true);
            var points = this.parsePoints(cfg.points); // 转换为画布坐标
            return container.addShape('rect', {
                attrs: tslib_1.__assign(tslib_1.__assign({}, shapeAttrs), getRectAttrs(points, cfg.size)),
                name: 'polygon',
            });
        }
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],298:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
function parseValue(value) {
    var array = !util_1.isArray(value) ? [value] : value;
    var min = array[0]; // 最小值
    var max = array[array.length - 1]; // 最大值
    var min1 = array.length > 1 ? array[1] : min;
    var max1 = array.length > 3 ? array[3] : max;
    var median = array.length > 2 ? array[2] : min1;
    return {
        min: min,
        max: max,
        min1: min1,
        max1: max1,
        median: median,
    };
}
function getBoxPoints(x, y, size) {
    var halfSize = size / 2;
    var pointsArray;
    if (util_1.isArray(y)) {
        // 2维
        var _a = parseValue(y), min = _a.min, max = _a.max, median = _a.median, min1 = _a.min1, max1 = _a.max1;
        var minX = x - halfSize;
        var maxX = x + halfSize;
        pointsArray = [
            [minX, max],
            [maxX, max],
            [x, max],
            [x, max1],
            [minX, min1],
            [minX, max1],
            [maxX, max1],
            [maxX, min1],
            [x, min1],
            [x, min],
            [minX, min],
            [maxX, min],
            [minX, median],
            [maxX, median],
        ];
    }
    else {
        // 只有一个维度
        y = util_1.isNil(y) ? 0.5 : y;
        var _b = parseValue(x), min = _b.min, max = _b.max, median = _b.median, min1 = _b.min1, max1 = _b.max1;
        var minY = y - halfSize;
        var maxY = y + halfSize;
        pointsArray = [
            [min, minY],
            [min, maxY],
            [min, y],
            [min1, y],
            [min1, minY],
            [min1, maxY],
            [max1, maxY],
            [max1, minY],
            [max1, y],
            [max, y],
            [max, minY],
            [max, maxY],
            [median, minY],
            [median, maxY],
        ];
    }
    return pointsArray.map(function (arr) {
        return {
            x: arr[0],
            y: arr[1],
        };
    });
}
function getBoxPath(points) {
    return [
        ['M', points[0].x, points[0].y],
        ['L', points[1].x, points[1].y],
        ['M', points[2].x, points[2].y],
        ['L', points[3].x, points[3].y],
        ['M', points[4].x, points[4].y],
        ['L', points[5].x, points[5].y],
        ['L', points[6].x, points[6].y],
        ['L', points[7].x, points[7].y],
        ['L', points[4].x, points[4].y],
        ['Z'],
        ['M', points[8].x, points[8].y],
        ['L', points[9].x, points[9].y],
        ['M', points[10].x, points[10].y],
        ['L', points[11].x, points[11].y],
        ['M', points[12].x, points[12].y],
        ['L', points[13].x, points[13].y],
    ];
}
// box shape
base_1.registerShape('schema', 'box', {
    getPoints: function (shapePoint) {
        var x = shapePoint.x, y = shapePoint.y, size = shapePoint.size;
        return getBoxPoints(x, y, size);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, false);
        var path = this.parsePath(getBoxPath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path, name: 'schema' }),
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                var yValues = [y - 6, y - 3, y, y + 3, y + 6];
                var points = getBoxPoints(x, yValues, r);
                return [
                    ['M', points[0].x + 1, points[0].y],
                    ['L', points[1].x - 1, points[1].y],
                    ['M', points[2].x, points[2].y],
                    ['L', points[3].x, points[3].y],
                    ['M', points[4].x, points[4].y],
                    ['L', points[5].x, points[5].y],
                    ['L', points[6].x, points[6].y],
                    ['L', points[7].x, points[7].y],
                    ['L', points[4].x, points[4].y],
                    ['Z'],
                    ['M', points[8].x, points[8].y],
                    ['L', points[9].x, points[9].y],
                    ['M', points[10].x + 1, points[10].y],
                    ['L', points[11].x - 1, points[11].y],
                    ['M', points[12].x, points[12].y],
                    ['L', points[13].x, points[13].y],
                ];
            },
            style: {
                r: 6,
                lineWidth: 1,
                stroke: color,
            },
        };
    },
});

},{"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],299:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var helper_1 = require("../../../util/helper");
var base_1 = require("../base");
var get_style_1 = require("../util/get-style");
function getCandleYValues(value) {
    var array = !util_1.isArray(value) ? [value] : value;
    // 从大到小排序
    var sorted = array.sort(function (a, b) { return b - a; });
    return helper_1.padEnd(sorted, 4, sorted[sorted.length - 1]);
}
// get candle shape's key points
function getCandlePoints(x, y, size) {
    var yValues = getCandleYValues(y);
    return [
        { x: x, y: yValues[0] },
        { x: x, y: yValues[1] },
        { x: x - size / 2, y: yValues[2] },
        { x: x - size / 2, y: yValues[1] },
        { x: x + size / 2, y: yValues[1] },
        { x: x + size / 2, y: yValues[2] },
        { x: x, y: yValues[2] },
        { x: x, y: yValues[3] },
    ];
}
function getCandlePath(points) {
    return [
        ['M', points[0].x, points[0].y],
        ['L', points[1].x, points[1].y],
        ['M', points[2].x, points[2].y],
        ['L', points[3].x, points[3].y],
        ['L', points[4].x, points[4].y],
        ['L', points[5].x, points[5].y],
        ['Z'],
        ['M', points[6].x, points[6].y],
        ['L', points[7].x, points[7].y],
    ];
}
// k line shape
base_1.registerShape('schema', 'candle', {
    getPoints: function (shapePoint) {
        var x = shapePoint.x, y = shapePoint.y, size = shapePoint.size;
        return getCandlePoints(x, y, size);
    },
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, true, true);
        var path = this.parsePath(getCandlePath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path, name: 'schema' }),
        });
        return shape;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: function (x, y, r) {
                var yValues = [y + 7.5, y + 3, y - 3, y - 7.5];
                var points = getCandlePoints(x, yValues, r);
                return [
                    ['M', points[0].x, points[0].y],
                    ['L', points[1].x, points[1].y],
                    ['M', points[2].x, points[2].y],
                    ['L', points[3].x, points[3].y],
                    ['L', points[4].x, points[4].y],
                    ['L', points[5].x, points[5].y],
                    ['Z'],
                    ['M', points[6].x, points[6].y],
                    ['L', points[7].x, points[7].y],
                ];
            },
            style: {
                lineWidth: 1,
                stroke: color,
                fill: color,
                r: 6,
            },
        };
    },
});

},{"../../../util/helper":377,"../base":275,"../util/get-style":302,"@antv/util":803,"tslib":385}],300:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("../base");
var SchemaShapeFactory = base_1.registerShapeFactory('schema', {
    defaultShapeType: '',
});
exports.default = SchemaShapeFactory;

},{"../base":275}],301:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPathPoints = void 0;
var util_1 = require("@antv/util");
function isValueEmpty(value) {
    if (value) {
        return false;
    }
    return value === null || value === undefined || isNaN(value);
}
function isYNil(point) {
    if (util_1.isArray(point)) {
        // 特殊处理 area 的关键点数据，其关键点结构为 [{x: 0, y: 1}, {x: 0, y: 2}]
        return isValueEmpty(point[1].y);
    }
    var value = point.y;
    return util_1.isArray(value) ? isValueEmpty(value[0]) : isValueEmpty(value);
}
/**
 * @ignore
 * 分割数据，用于处理在一组点数据中，y 对应的数值存在 null/undefined/NaN 的情况
 * 应用于折线图、区域图以及路径图
 *
 * ```typescript
 * // return [[{x: 1, y: 2}, {x: 3, y: 3}]]
 * getPathPoints([{x: 1, y: 2}, {x: 2, y: null}, {x: 3, y: 3}], true);
 * // return [[{x: 1, y: 2}], [{x: 3, y: 3}]]
 * getPathPoints([{x: 1, y: 2}, {x: 2, y: null}, {x: 3, y: 3}], false);
 * // return [[[{ x: 1, y: 10 }, { x: 2, y: 2 }], [{ x: 9, y: 34 }, { x: 1, y: 1 }]]]
 * getPathPoints([
 *   [{ x: 1, y: 10 }, { x: 2, y: 2 }],
 *   [{ x: 4, y: 2 }, { x: 8, y: NaN }],
 *   [{ x: 9, y: 34 }, { x: 1, y: 1 }],
 * ], true);
 * ```
 *
 * @param points 要进行处理点集合
 * @param connectNulls 是否连接空值数据
 * @param showSinglePoint 是否展示孤立点
 * @returns 返回处理后的点集合
 */
function getPathPoints(points, connectNulls, showSinglePoint) {
    if (connectNulls === void 0) { connectNulls = false; }
    if (showSinglePoint === void 0) { showSinglePoint = true; }
    if (!points.length || (points.length === 1 && !showSinglePoint)) {
        // 空或者只有一个点并配置不展示时
        return [];
    }
    if (connectNulls) {
        // 即 y 值为空的场景
        var filtered = [];
        for (var i = 0, len = points.length; i < len; i++) {
            var point = points[i];
            if (!isYNil(point)) {
                filtered.push(point);
            }
        }
        return [filtered];
    }
    var result = [];
    var tmp = [];
    for (var i = 0, len = points.length; i < len; i++) {
        var point = points[i];
        if (isYNil(point)) {
            if (tmp.length) {
                if (!(tmp.length === 1 && !showSinglePoint)) {
                    // 如果前段数据只有一个字段并且不需要展示时则不加入
                    result.push(tmp);
                }
                tmp = [];
            }
        }
        else {
            tmp.push(point);
        }
    }
    if (tmp.length) {
        result.push(tmp);
    }
    return result;
}
exports.getPathPoints = getPathPoints;

},{"@antv/util":803}],302:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyle = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
/**
 * @ignore
 * 获取 Shape 的图形属性
 * @param cfg
 * @param isStroke 是否需要描边
 * @param isFill 是否需要填充
 * @param [sizeName] 可选，表示图形大小的属性，lineWidth 或者 r
 * @returns
 */
function getStyle(cfg, isStroke, isFill, sizeName) {
    if (sizeName === void 0) { sizeName = ''; }
    var _a = cfg.style, style = _a === void 0 ? {} : _a, defaultStyle = cfg.defaultStyle, color = cfg.color, size = cfg.size;
    var attrs = tslib_1.__assign(tslib_1.__assign({}, defaultStyle), style);
    if (color) {
        if (isStroke) {
            if (!style.stroke) {
                // 如果用户在 style() 中配置了 stroke，则以用户配置的为准
                attrs.stroke = color;
            }
        }
        if (isFill) {
            if (!style.fill) {
                // 如果用户在 style() 中配置了 fill
                attrs.fill = color;
            }
        }
    }
    if (sizeName && util_1.isNil(style[sizeName]) && !util_1.isNil(size)) {
        // 如果用户在 style() 中配置了 lineWidth 或者 r 属性
        attrs[sizeName] = size;
    }
    return attrs;
}
exports.getStyle = getStyle;

},{"@antv/util":803,"tslib":385}],303:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPolarPath = exports.convertNormalPath = exports.getSplinePath = exports.getLinePath = exports.catmullRom2bezier = exports.smoothBezier = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var coordinate_1 = require("../../../util/coordinate");
function _points2path(points, isInCircle) {
    var path = [];
    if (points.length) {
        path.push(['M', points[0].x, points[0].y]);
        for (var i = 1, length_1 = points.length; i < length_1; i += 1) {
            var item = points[i];
            path.push(['L', item.x, item.y]);
        }
        if (isInCircle) {
            path.push(['Z']);
        }
    }
    return path;
}
function _convertArr(arr, coord) {
    var tmp = [arr[0]];
    for (var i = 1, len = arr.length; i < len; i = i + 2) {
        var point = coord.convert({
            x: arr[i],
            y: arr[i + 1],
        });
        tmp.push(point.x, point.y);
    }
    return tmp;
}
function _convertPolarPath(pre, cur, coord) {
    var isTransposed = coord.isTransposed, startAngle = coord.startAngle, endAngle = coord.endAngle;
    var prePoint = {
        x: pre[1],
        y: pre[2],
    };
    var curPoint = {
        x: cur[1],
        y: cur[2],
    };
    var rst = [];
    var xDim = isTransposed ? 'y' : 'x';
    var angleRange = Math.abs(curPoint[xDim] - prePoint[xDim]) * (endAngle - startAngle);
    var direction = curPoint[xDim] >= prePoint[xDim] ? 1 : 0; // 圆弧的方向
    var flag = angleRange > Math.PI ? 1 : 0; // 大弧还是小弧标志位
    var convertPoint = coord.convert(curPoint);
    var r = coordinate_1.getDistanceToCenter(coord, convertPoint);
    if (r >= 0.5) {
        // 小于1像素的圆在图像上无法识别
        if (angleRange === Math.PI * 2) {
            var middlePoint = {
                x: (curPoint.x + prePoint.x) / 2,
                y: (curPoint.y + prePoint.y) / 2,
            };
            var middleConvertPoint = coord.convert(middlePoint);
            rst.push(['A', r, r, 0, flag, direction, middleConvertPoint.x, middleConvertPoint.y]);
            rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
        }
        else {
            rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
        }
    }
    return rst;
}
// 当存在整体的圆时，去除圆前面和后面的线，防止出现直线穿过整个圆的情形
function _filterFullCirleLine(path) {
    util_1.each(path, function (subPath, index) {
        var cur = subPath;
        if (cur[0].toLowerCase() === 'a') {
            var pre = path[index - 1];
            var next = path[index + 1];
            if (next && next[0].toLowerCase() === 'a') {
                if (pre && pre[0].toLowerCase() === 'l') {
                    pre[0] = 'M';
                }
            }
            else if (pre && pre[0].toLowerCase() === 'a') {
                if (next && next[0].toLowerCase() === 'l') {
                    next[0] = 'M';
                }
            }
        }
    });
}
/**
 * @ignore
 * 计算光滑的贝塞尔曲线
 */
exports.smoothBezier = function (points, smooth, isLoop, constraint) {
    var cps = [];
    var prevPoint;
    var nextPoint;
    var hasConstraint = !!constraint;
    var min;
    var max;
    if (hasConstraint) {
        min = [Infinity, Infinity];
        max = [-Infinity, -Infinity];
        for (var i = 0, l = points.length; i < l; i++) {
            var point = points[i];
            min = matrix_util_1.vec2.min([0, 0], min, point);
            max = matrix_util_1.vec2.max([0, 0], max, point);
        }
        min = matrix_util_1.vec2.min([0, 0], min, constraint[0]);
        max = matrix_util_1.vec2.max([0, 0], max, constraint[1]);
    }
    for (var i = 0, len = points.length; i < len; i++) {
        var point = points[i];
        if (isLoop) {
            prevPoint = points[i ? i - 1 : len - 1];
            nextPoint = points[(i + 1) % len];
        }
        else {
            if (i === 0 || i === len - 1) {
                cps.push(point);
                continue;
            }
            else {
                prevPoint = points[i - 1];
                nextPoint = points[i + 1];
            }
        }
        var v = [0, 0];
        v = matrix_util_1.vec2.sub(v, nextPoint, prevPoint);
        v = matrix_util_1.vec2.scale(v, v, smooth);
        var d0 = matrix_util_1.vec2.distance(point, prevPoint);
        var d1 = matrix_util_1.vec2.distance(point, nextPoint);
        var sum = d0 + d1;
        if (sum !== 0) {
            d0 /= sum;
            d1 /= sum;
        }
        var v1 = matrix_util_1.vec2.scale([0, 0], v, -d0);
        var v2 = matrix_util_1.vec2.scale([0, 0], v, d1);
        var cp0 = matrix_util_1.vec2.add([0, 0], point, v1);
        var cp1 = matrix_util_1.vec2.add([0, 0], point, v2);
        if (hasConstraint) {
            cp0 = matrix_util_1.vec2.max([0, 0], cp0, min);
            cp0 = matrix_util_1.vec2.min([0, 0], cp0, max);
            cp1 = matrix_util_1.vec2.max([0, 0], cp1, min);
            cp1 = matrix_util_1.vec2.min([0, 0], cp1, max);
        }
        cps.push(cp0);
        cps.push(cp1);
    }
    if (isLoop) {
        cps.push(cps.shift());
    }
    return cps;
};
/**
 * @ignore
 * 贝塞尔曲线
 */
function catmullRom2bezier(crp, z, constraint) {
    var isLoop = !!z;
    var pointList = [];
    for (var i = 0, l = crp.length; i < l; i += 2) {
        pointList.push([crp[i], crp[i + 1]]);
    }
    var controlPointList = exports.smoothBezier(pointList, 0.4, isLoop, constraint);
    var len = pointList.length;
    var d1 = [];
    var cp1;
    var cp2;
    var p;
    for (var i = 0; i < len - 1; i++) {
        cp1 = controlPointList[i * 2];
        cp2 = controlPointList[i * 2 + 1];
        p = pointList[i + 1];
        d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
    }
    if (isLoop) {
        cp1 = controlPointList[len];
        cp2 = controlPointList[len + 1];
        p = pointList[0];
        d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
    }
    return d1;
}
exports.catmullRom2bezier = catmullRom2bezier;
/**
 * @ignore
 * 将点连接成路径 path
 */
function getLinePath(points, isInCircle) {
    return _points2path(points, isInCircle);
}
exports.getLinePath = getLinePath;
/**
 * @ignore
 * 根据关键点获取限定了范围的平滑线
 */
function getSplinePath(points, isInCircle, constaint) {
    var data = [];
    var first = points[0];
    var prePoint = null;
    if (points.length <= 2) {
        // 两点以内直接绘制成路径
        return getLinePath(points, isInCircle);
    }
    for (var i = 0, len = points.length; i < len; i++) {
        var point = points[i];
        if (!prePoint || !(prePoint.x === point.x && prePoint.y === point.y)) {
            data.push(point.x);
            data.push(point.y);
            prePoint = point;
        }
    }
    var constraint = constaint || [
        // 范围
        [0, 0],
        [1, 1],
    ];
    var splinePath = catmullRom2bezier(data, isInCircle, constraint);
    splinePath.unshift(['M', first.x, first.y]);
    return splinePath;
}
exports.getSplinePath = getSplinePath;
/**
 * @ignore
 * 将归一化后的路径数据转换成坐标
 */
function convertNormalPath(coord, path) {
    var tmp = [];
    util_1.each(path, function (subPath) {
        var action = subPath[0];
        switch (action.toLowerCase()) {
            case 'm':
            case 'l':
            case 'c':
                tmp.push(_convertArr(subPath, coord));
                break;
            case 'z':
            default:
                tmp.push(subPath);
                break;
        }
    });
    return tmp;
}
exports.convertNormalPath = convertNormalPath;
/**
 * @ignore
 * 将路径转换为极坐标下的真实路径
 */
function convertPolarPath(coord, path) {
    var tmp = [];
    var pre;
    var cur;
    var transposed;
    var equals;
    util_1.each(path, function (subPath, index) {
        var action = subPath[0];
        switch (action.toLowerCase()) {
            case 'm':
            case 'c':
            case 'q':
                tmp.push(_convertArr(subPath, coord));
                break;
            case 'l':
                pre = path[index - 1];
                cur = subPath;
                transposed = coord.isTransposed;
                // 是否半径相同，转换成圆弧
                equals = transposed ? pre[pre.length - 2] === cur[1] : pre[pre.length - 1] === cur[2];
                if (equals) {
                    tmp = tmp.concat(_convertPolarPath(pre, cur, coord));
                }
                else {
                    // y 不相等，所以直接转换
                    tmp.push(_convertArr(subPath, coord));
                }
                break;
            case 'z':
            default:
                tmp.push(subPath);
                break;
        }
    });
    _filterFullCirleLine(tmp); // 过滤多余的直线
    return tmp;
}
exports.convertPolarPath = convertPolarPath;

},{"../../../util/coordinate":371,"@antv/matrix-util":717,"@antv/util":803}],304:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitPoints = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * 拆分点数据
 * @example
 * // result: [{x: 20, y: 20}, {x: 20, y: 30}]
 * splitPoints({x: 20,y: [20, 30]});
 * @example
 * // result: [{x: 20, y: 20}, {x: 30, y: 30}]
 * splitPoints({x: [20, 30],y: [20, 30]});
 * @param obj
 */
function splitPoints(obj) {
    // y 有可能是数组，对应原始数据中 y 为一个区间数据，如 [19, 30]，为了统一也将 x 转换为数组
    var x = obj.x;
    var y = util_1.isArray(obj.y) ? obj.y : [obj.y];
    return y.map(function (eachY, index) {
        return {
            x: util_1.isArray(x) ? x[index] : x,
            y: eachY,
        };
    });
}
exports.splitPoints = splitPoints;

},{"@antv/util":803}],305:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.group = void 0;
var util_1 = require("@antv/util");
/** @ignore */
function group(data, fields, appendConditions) {
    if (appendConditions === void 0) { appendConditions = {}; }
    if (!fields) {
        return [data];
    }
    var groups = util_1.groupToMap(data, fields);
    var array = [];
    if (fields.length === 1 && appendConditions[fields[0]]) {
        var values = appendConditions[fields[0]];
        for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
            var value = values_1[_i];
            var arr = groups["_" + value];
            if (arr) {
                // 可能存在用户设置 values ，但是数据中没有对应的字段，则这时候 arr 就为 null
                array.push(arr);
            }
        }
    }
    else {
        for (var k in groups) {
            if (groups.hasOwnProperty(k)) {
                var eachGroup = groups[k];
                array.push(eachGroup);
            }
        }
    }
    return array;
}
exports.group = group;

},{"@antv/util":803}],306:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isModelChange = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * Determines whether model is change
 * @param currentModel
 * @param preModel
 * @returns
 */
function isModelChange(currentModel, preModel) {
    return util_1.some(['color', 'shape', 'size', 'x', 'y', 'isInCircle', 'data', 'style', 'defaultStyle', 'points', 'mappingData'], function (key) {
        return !util_1.isEqual(currentModel[key], preModel[key]);
    });
}
exports.isModelChange = isModelChange;

},{"@antv/util":803}],307:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseFields = void 0;
var util_1 = require("@antv/util");
/** @ignore */
function parseFields(field) {
    if (util_1.isArray(field)) {
        return field;
    }
    return field.split('*');
}
exports.parseFields = parseFields;

},{"@antv/util":803}],308:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultSize = void 0;
var util_1 = require("@antv/util");
var coordinate_1 = require("../../util/coordinate");
// 已经排序后的数据查找距离最小的
function findMinDistance(arr, scale) {
    var count = arr.length;
    var sourceArr = arr;
    if (util_1.isString(sourceArr[0])) {
        // 日期类型的 values 经常上文本类型，所以需要转换一下
        sourceArr = arr.map(function (v) {
            return scale.translate(v);
        });
    }
    var distance = sourceArr[1] - sourceArr[0];
    for (var i = 2; i < count; i++) {
        var tmp = sourceArr[i] - sourceArr[i - 1];
        if (distance > tmp) {
            distance = tmp;
        }
    }
    return distance;
}
function getDodgeCount(dataArray, dodgeBy) {
    if (dodgeBy) {
        var mergeData = util_1.flatten(dataArray);
        var values = util_1.valuesOfKey(mergeData, dodgeBy);
        return values.length;
    }
    return dataArray.length;
}
/** @ignore */
function getDefaultSize(geometry) {
    var theme = geometry.theme;
    var coordinate = geometry.coordinate;
    var xScale = geometry.getXScale();
    var xValues = xScale.values;
    var dataArray = geometry.beforeMappingData;
    var count = xValues.length;
    if (xScale.isLinear && xValues.length > 1) {
        // Linear 类型用户有可能设置了 min, max 范围所以需要根据数据最小区间计算 count
        xValues.sort();
        var interval = findMinDistance(xValues, xScale);
        count = (xScale.max - xScale.min) / interval;
        if (xValues.length > count) {
            count = xValues.length;
        }
    }
    var range = xScale.range;
    var normalizedSize = 1 / count;
    var wr = 1;
    if (coordinate.isPolar) {
        if (coordinate.isTransposed && count > 1) {
            // 极坐标下多层环图
            wr = theme.multiplePieWidthRatio;
        }
        else {
            wr = theme.roseWidthRatio;
        }
    }
    else {
        if (xScale.isLinear) {
            normalizedSize *= range[1] - range[0];
        }
        wr = theme.columnWidthRatio;
    }
    normalizedSize *= wr;
    if (geometry.getAdjust('dodge')) {
        var dodgeAdjust = geometry.getAdjust('dodge');
        var dodgeBy = dodgeAdjust.dodgeBy;
        var dodgeCount = getDodgeCount(dataArray, dodgeBy);
        normalizedSize = normalizedSize / dodgeCount;
    }
    // 最大和最小限制
    var maxColumnWidth = theme.maxColumnWidth, minColumnWidth = theme.minColumnWidth;
    var xDimensionLength = coordinate_1.getXDimensionLength(geometry.coordinate);
    if (maxColumnWidth) {
        var normalizedMaxColumnWidth = maxColumnWidth / xDimensionLength;
        if (normalizedSize > normalizedMaxColumnWidth) {
            normalizedSize = normalizedMaxColumnWidth;
        }
    }
    if (minColumnWidth) {
        var normalizedMinColumnWidth = minColumnWidth / xDimensionLength;
        if (normalizedSize < normalizedMinColumnWidth) {
            normalizedSize = normalizedMinColumnWidth;
        }
    }
    return normalizedSize;
}
exports.getDefaultSize = getDefaultSize;

},{"../../util/coordinate":371,"@antv/util":803}],309:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Util = void 0;
var tslib_1 = require("tslib");
// 注册黑暗主题
var core_1 = require("./core");
var dark_1 = require("./theme/style-sheet/dark");
var theme_1 = require("./util/theme");
core_1.registerTheme('dark', theme_1.createThemeByStylesheet(dark_1.antvDark));
// 注册 G 渲染引擎
var CanvasEngine = tslib_1.__importStar(require("@antv/g-canvas"));
var SVGEngine = tslib_1.__importStar(require("@antv/g-svg"));
var core_2 = require("./core");
core_2.registerEngine('canvas', CanvasEngine);
core_2.registerEngine('svg', SVGEngine);
// 注册 G2 内置的 geometry
var core_3 = require("./core");
var area_1 = tslib_1.__importDefault(require("./geometry/area"));
var edge_1 = tslib_1.__importDefault(require("./geometry/edge"));
var heatmap_1 = tslib_1.__importDefault(require("./geometry/heatmap"));
var interval_1 = tslib_1.__importDefault(require("./geometry/interval"));
var line_1 = tslib_1.__importDefault(require("./geometry/line"));
var path_1 = tslib_1.__importDefault(require("./geometry/path"));
var point_1 = tslib_1.__importDefault(require("./geometry/point"));
var polygon_1 = tslib_1.__importDefault(require("./geometry/polygon"));
var schema_1 = tslib_1.__importDefault(require("./geometry/schema"));
core_3.registerGeometry('Polygon', polygon_1.default);
core_3.registerGeometry('Interval', interval_1.default);
core_3.registerGeometry('Schema', schema_1.default);
core_3.registerGeometry('Path', path_1.default);
core_3.registerGeometry('Point', point_1.default);
core_3.registerGeometry('Line', line_1.default);
core_3.registerGeometry('Area', area_1.default);
core_3.registerGeometry('Edge', edge_1.default);
core_3.registerGeometry('Heatmap', heatmap_1.default);
// 引入所有内置的 shapes
require("./geometry/shape/area/line");
require("./geometry/shape/area/smooth");
require("./geometry/shape/area/smooth-line");
require("./geometry/shape/edge/arc");
require("./geometry/shape/edge/smooth");
require("./geometry/shape/edge/vhv");
require("./geometry/shape/interval/funnel");
require("./geometry/shape/interval/hollow-rect");
require("./geometry/shape/interval/line");
require("./geometry/shape/interval/pyramid");
require("./geometry/shape/interval/tick");
require("./geometry/shape/line/step");
require("./geometry/shape/point/hollow");
require("./geometry/shape/point/image");
require("./geometry/shape/point/solid");
require("./geometry/shape/schema/box");
require("./geometry/shape/schema/candle");
require("./geometry/shape/polygon/square");
// 注册 Geometry 内置的 label
var core_4 = require("./core");
var base_1 = tslib_1.__importDefault(require("./geometry/label/base"));
var interval_2 = tslib_1.__importDefault(require("./geometry/label/interval"));
var pie_1 = tslib_1.__importDefault(require("./geometry/label/pie"));
var polar_1 = tslib_1.__importDefault(require("./geometry/label/polar"));
core_4.registerGeometryLabel('base', base_1.default);
core_4.registerGeometryLabel('interval', interval_2.default);
core_4.registerGeometryLabel('pie', pie_1.default);
core_4.registerGeometryLabel('polar', polar_1.default);
// 注册 Geometry label 内置的布局函数
var core_5 = require("./core");
var distribute_1 = require("./geometry/label/layout/pie/distribute");
var outer_1 = require("./geometry/label/layout/pie/outer");
var limit_in_canvas_1 = require("./geometry/label/layout/limit-in-canvas");
var limit_in_shape_1 = require("./geometry/label/layout/limit-in-shape");
var overlap_1 = require("./geometry/label/layout/overlap");
core_5.registerGeometryLabelLayout('overlap', overlap_1.overlap);
core_5.registerGeometryLabelLayout('distribute', distribute_1.distribute);
core_5.registerGeometryLabelLayout('fixed-overlap', overlap_1.fixedOverlap);
core_5.registerGeometryLabelLayout('limit-in-shape', limit_in_shape_1.limitInShape);
core_5.registerGeometryLabelLayout('limit-in-canvas', limit_in_canvas_1.limitInCanvas);
core_5.registerGeometryLabelLayout('pie-outer', outer_1.pieOuterLabelLayout);
// 注册需要的动画执行函数
var fade_1 = require("./animate/animation/fade");
var grow_in_1 = require("./animate/animation/grow-in");
var path_in_1 = require("./animate/animation/path-in");
var position_update_1 = require("./animate/animation/position-update");
var scale_in_1 = require("./animate/animation/scale-in");
var sector_path_update_1 = require("./animate/animation/sector-path-update");
var wave_in_1 = require("./animate/animation/wave-in");
var zoom_1 = require("./animate/animation/zoom");
var core_6 = require("./core");
core_6.registerAnimation('fade-in', fade_1.fadeIn);
core_6.registerAnimation('fade-out', fade_1.fadeOut);
core_6.registerAnimation('grow-in-x', grow_in_1.growInX);
core_6.registerAnimation('grow-in-xy', grow_in_1.growInXY);
core_6.registerAnimation('grow-in-y', grow_in_1.growInY);
core_6.registerAnimation('scale-in-x', scale_in_1.scaleInX);
core_6.registerAnimation('scale-in-y', scale_in_1.scaleInY);
core_6.registerAnimation('wave-in', wave_in_1.waveIn);
core_6.registerAnimation('zoom-in', zoom_1.zoomIn);
core_6.registerAnimation('zoom-out', zoom_1.zoomOut);
core_6.registerAnimation('position-update', position_update_1.positionUpdate);
core_6.registerAnimation('sector-path-update', sector_path_update_1.sectorPathUpdate);
core_6.registerAnimation('path-in', path_in_1.pathIn);
// 注册内置的 Facet
var core_7 = require("./core");
var circle_1 = tslib_1.__importDefault(require("./facet/circle"));
var list_1 = tslib_1.__importDefault(require("./facet/list"));
var matrix_1 = tslib_1.__importDefault(require("./facet/matrix"));
var mirror_1 = tslib_1.__importDefault(require("./facet/mirror"));
var rect_1 = tslib_1.__importDefault(require("./facet/rect"));
var tree_1 = tslib_1.__importDefault(require("./facet/tree"));
core_7.registerFacet('rect', rect_1.default);
core_7.registerFacet('mirror', mirror_1.default);
core_7.registerFacet('list', list_1.default);
core_7.registerFacet('matrix', matrix_1.default);
core_7.registerFacet('circle', circle_1.default);
core_7.registerFacet('tree', tree_1.default);
// 注册内置的 Component
var core_8 = require("./core");
var annotation_1 = tslib_1.__importDefault(require("./chart/controller/annotation"));
var axis_1 = tslib_1.__importDefault(require("./chart/controller/axis"));
var legend_1 = tslib_1.__importDefault(require("./chart/controller/legend"));
var slider_1 = tslib_1.__importDefault(require("./chart/controller/slider"));
var tooltip_1 = tslib_1.__importDefault(require("./chart/controller/tooltip"));
// register build-in components
core_8.registerComponentController('axis', axis_1.default);
core_8.registerComponentController('legend', legend_1.default);
core_8.registerComponentController('tooltip', tooltip_1.default);
core_8.registerComponentController('annotation', annotation_1.default);
core_8.registerComponentController('slider', slider_1.default);
// 注册 Interaction Action
var core_9 = require("./core");
var active_region_1 = tslib_1.__importDefault(require("./interaction/action/active-region"));
var sibling_1 = tslib_1.__importDefault(require("./interaction/action/component/tooltip/sibling"));
var geometry_1 = tslib_1.__importDefault(require("./interaction/action/component/tooltip/geometry"));
var ellipsis_text_1 = tslib_1.__importDefault(require("./interaction/action/component/tooltip/ellipsis-text"));
var active_1 = tslib_1.__importDefault(require("./interaction/action/element/active"));
var link_by_color_1 = tslib_1.__importDefault(require("./interaction/action/element/link-by-color"));
var range_active_1 = tslib_1.__importDefault(require("./interaction/action/element/range-active"));
var single_active_1 = tslib_1.__importDefault(require("./interaction/action/element/single-active"));
var highlight_1 = tslib_1.__importDefault(require("./interaction/action/element/highlight"));
var highlight_by_color_1 = tslib_1.__importDefault(require("./interaction/action/element/highlight-by-color"));
var highlight_by_x_1 = tslib_1.__importDefault(require("./interaction/action/element/highlight-by-x"));
var range_highlight_1 = tslib_1.__importDefault(require("./interaction/action/element/range-highlight"));
var single_highlight_1 = tslib_1.__importDefault(require("./interaction/action/element/single-highlight"));
var range_selected_1 = tslib_1.__importDefault(require("./interaction/action/element/range-selected"));
var selected_1 = tslib_1.__importDefault(require("./interaction/action/element/selected"));
var single_selected_1 = tslib_1.__importDefault(require("./interaction/action/element/single-selected"));
var list_active_1 = tslib_1.__importDefault(require("./interaction/action/component/list-active"));
var list_highlight_1 = tslib_1.__importDefault(require("./interaction/action/component/list-highlight"));
var list_selected_1 = tslib_1.__importDefault(require("./interaction/action/component/list-selected"));
var list_unchecked_1 = tslib_1.__importDefault(require("./interaction/action/component/list-unchecked"));
var circle_2 = tslib_1.__importDefault(require("./interaction/action/mask/circle"));
var dim_rect_1 = tslib_1.__importDefault(require("./interaction/action/mask/dim-rect"));
var path_2 = tslib_1.__importDefault(require("./interaction/action/mask/path"));
var rect_2 = tslib_1.__importDefault(require("./interaction/action/mask/rect"));
var smooth_path_1 = tslib_1.__importDefault(require("./interaction/action/mask/smooth-path"));
var cursor_1 = tslib_1.__importDefault(require("./interaction/action/cursor"));
var filter_1 = tslib_1.__importDefault(require("./interaction/action/data/filter"));
var range_filter_1 = tslib_1.__importDefault(require("./interaction/action/data/range-filter"));
var sibling_filter_1 = tslib_1.__importDefault(require("./interaction/action/data/sibling-filter"));
var filter_2 = tslib_1.__importDefault(require("./interaction/action/element/filter"));
var sibling_filter_2 = tslib_1.__importDefault(require("./interaction/action/element/sibling-filter"));
var button_1 = tslib_1.__importDefault(require("./interaction/action/view/button"));
var drag_1 = tslib_1.__importDefault(require("./interaction/action/view/drag"));
var move_1 = tslib_1.__importDefault(require("./interaction/action/view/move"));
var scale_translate_1 = tslib_1.__importDefault(require("./interaction/action/view/scale-translate"));
var scale_zoom_1 = tslib_1.__importDefault(require("./interaction/action/view/scale-zoom"));
core_9.registerAction('tooltip', geometry_1.default);
core_9.registerAction('sibling-tooltip', sibling_1.default);
core_9.registerAction('ellipsis-text', ellipsis_text_1.default);
core_9.registerAction('element-active', active_1.default);
core_9.registerAction('element-single-active', single_active_1.default);
core_9.registerAction('element-range-active', range_active_1.default);
core_9.registerAction('element-highlight', highlight_1.default);
core_9.registerAction('element-highlight-by-x', highlight_by_x_1.default);
core_9.registerAction('element-highlight-by-color', highlight_by_color_1.default);
core_9.registerAction('element-single-highlight', single_highlight_1.default);
core_9.registerAction('element-range-highlight', range_highlight_1.default);
core_9.registerAction('element-sibling-highlight', range_highlight_1.default, {
    effectSiblings: true,
    effectByRecord: true,
});
core_9.registerAction('element-selected', selected_1.default);
core_9.registerAction('element-single-selected', single_selected_1.default);
core_9.registerAction('element-range-selected', range_selected_1.default);
core_9.registerAction('element-link-by-color', link_by_color_1.default);
core_9.registerAction('active-region', active_region_1.default);
core_9.registerAction('list-active', list_active_1.default);
core_9.registerAction('list-selected', list_selected_1.default);
core_9.registerAction('list-highlight', list_highlight_1.default);
core_9.registerAction('list-unchecked', list_unchecked_1.default);
core_9.registerAction('legend-item-highlight', list_highlight_1.default, {
    componentNames: ['legend'],
});
core_9.registerAction('axis-label-highlight', list_highlight_1.default, {
    componentNames: ['axis'],
});
core_9.registerAction('rect-mask', rect_2.default);
core_9.registerAction('x-rect-mask', dim_rect_1.default, { dim: 'x' });
core_9.registerAction('y-rect-mask', dim_rect_1.default, { dim: 'y' });
core_9.registerAction('circle-mask', circle_2.default);
core_9.registerAction('path-mask', path_2.default);
core_9.registerAction('smooth-path-mask', smooth_path_1.default);
core_9.registerAction('cursor', cursor_1.default);
core_9.registerAction('data-filter', filter_1.default);
core_9.registerAction('brush', range_filter_1.default);
core_9.registerAction('brush-x', range_filter_1.default, { dims: ['x'] });
core_9.registerAction('brush-y', range_filter_1.default, { dims: ['y'] });
core_9.registerAction('sibling-filter', sibling_filter_1.default);
core_9.registerAction('sibling-x-filter', sibling_filter_1.default);
core_9.registerAction('sibling-y-filter', sibling_filter_1.default);
core_9.registerAction('element-filter', filter_2.default);
core_9.registerAction('element-sibling-filter', sibling_filter_2.default);
core_9.registerAction('element-sibling-filter-record', sibling_filter_2.default, { byRecord: true });
core_9.registerAction('view-drag', drag_1.default);
core_9.registerAction('view-move', move_1.default);
core_9.registerAction('scale-translate', scale_translate_1.default);
core_9.registerAction('scale-zoom', scale_zoom_1.default);
core_9.registerAction('reset-button', button_1.default, {
    name: 'reset-button',
    text: 'reset',
});
// 注册默认的 Interaction 交互行为
var core_10 = require("./core");
function isPointInView(context) {
    return context.isInPlot();
}
// 注册 tooltip 的 interaction
core_10.registerInteraction('tooltip', {
    start: [
        { trigger: 'plot:mousemove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
        { trigger: 'plot:touchmove', action: 'tooltip:show', throttle: { wait: 50, leading: true, trailing: false } },
    ],
    end: [
        { trigger: 'plot:mouseleave', action: 'tooltip:hide' },
        { trigger: 'plot:leave', action: 'tooltip:hide' },
        { trigger: 'plot:touchend', action: 'tooltip:hide' },
    ],
});
core_10.registerInteraction('ellipsis-text', {
    start: [
        {
            trigger: 'legend-item-name:mousemove',
            action: 'ellipsis-text:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'legend-item-name:touchstart',
            action: 'ellipsis-text:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'axis-label:mousemove',
            action: 'ellipsis-text:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'axis-label:touchstart',
            action: 'ellipsis-text:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
    ],
    end: [
        { trigger: 'legend-item-name:mouseleave', action: 'ellipsis-text:hide' },
        { trigger: 'legend-item-name:touchend', action: 'ellipsis-text:hide' },
        { trigger: 'axis-label:mouseleave', action: 'ellipsis-text:hide' },
        { trigger: 'axis-label:touchend', action: 'ellipsis-text:hide' },
    ],
});
// 移动到 elment 上 active
core_10.registerInteraction('element-active', {
    start: [{ trigger: 'element:mouseenter', action: 'element-active:active' }],
    end: [{ trigger: 'element:mouseleave', action: 'element-active:reset' }],
});
// 点击选中，允许取消
core_10.registerInteraction('element-selected', {
    start: [{ trigger: 'element:click', action: 'element-selected:toggle' }],
});
// hover highlight，允许取消
core_10.registerInteraction('element-highlight', {
    start: [{ trigger: 'element:mouseenter', action: 'element-highlight:highlight' }],
    end: [{ trigger: 'element:mouseleave', action: 'element-highlight:reset' }],
});
// hover highlight by x，允许取消
core_10.registerInteraction('element-highlight-by-x', {
    start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-x:highlight' }],
    end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-x:reset' }],
});
// hover highlight by y，允许取消
core_10.registerInteraction('element-highlight-by-color', {
    start: [{ trigger: 'element:mouseenter', action: 'element-highlight-by-color:highlight' }],
    end: [{ trigger: 'element:mouseleave', action: 'element-highlight-by-color:reset' }],
});
// legend hover，element active
core_10.registerInteraction('legend-active', {
    start: [{ trigger: 'legend-item:mouseenter', action: ['list-active:active', 'element-active:active'] }],
    end: [{ trigger: 'legend-item:mouseleave', action: ['list-active:reset', 'element-active:reset'] }],
});
// legend hover，element active
core_10.registerInteraction('legend-highlight', {
    start: [
        { trigger: 'legend-item:mouseenter', action: ['legend-item-highlight:highlight', 'element-highlight:highlight'] },
    ],
    end: [{ trigger: 'legend-item:mouseleave', action: ['legend-item-highlight:reset', 'element-highlight:reset'] }],
});
// legend hover，element active
core_10.registerInteraction('axis-label-highlight', {
    start: [
        { trigger: 'axis-label:mouseenter', action: ['axis-label-highlight:highlight', 'element-highlight:highlight'] },
    ],
    end: [{ trigger: 'axis-label:mouseleave', action: ['axis-label-highlight:reset', 'element-highlight:reset'] }],
});
// legend hover，element active
core_10.registerInteraction('element-list-highlight', {
    start: [{ trigger: 'element:mouseenter', action: ['list-highlight:highlight', 'element-highlight:highlight'] }],
    end: [{ trigger: 'element:mouseleave', action: ['list-highlight:reset', 'element-highlight:reset'] }],
});
// 框选
core_10.registerInteraction('element-range-highlight', {
    showEnable: [
        { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
        { trigger: 'mask:mouseenter', action: 'cursor:move' },
        { trigger: 'plot:mouseleave', action: 'cursor:default' },
        { trigger: 'mask:mouseleave', action: 'cursor:crosshair' },
    ],
    start: [
        {
            trigger: 'plot:mousedown',
            isEnable: function (context) {
                // 不要点击在 mask 上重新开始
                return !context.isInShape('mask');
            },
            action: ['rect-mask:start', 'rect-mask:show'],
        },
        {
            trigger: 'mask:dragstart',
            action: ['rect-mask:moveStart'],
        },
    ],
    processing: [
        {
            trigger: 'plot:mousemove',
            action: ['rect-mask:resize'],
        },
        {
            trigger: 'mask:drag',
            action: ['rect-mask:move'],
        },
        {
            trigger: 'mask:change',
            action: ['element-range-highlight:highlight'],
        },
    ],
    end: [
        { trigger: 'plot:mouseup', action: ['rect-mask:end'] },
        { trigger: 'mask:dragend', action: ['rect-mask:moveEnd'] },
        {
            trigger: 'document:mouseup',
            isEnable: function (context) {
                return !context.isInPlot();
            },
            action: ['element-range-highlight:clear', 'rect-mask:end', 'rect-mask:hide'],
        },
    ],
    rollback: [{ trigger: 'dblclick', action: ['element-range-highlight:clear', 'rect-mask:hide'] }],
});
core_10.registerInteraction('brush', {
    showEnable: [
        { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
        { trigger: 'plot:mouseleave', action: 'cursor:default' },
    ],
    start: [
        {
            trigger: 'mousedown',
            isEnable: isPointInView,
            action: ['brush:start', 'rect-mask:start', 'rect-mask:show'],
        },
    ],
    processing: [
        {
            trigger: 'mousemove',
            isEnable: isPointInView,
            action: ['rect-mask:resize'],
        },
    ],
    end: [
        {
            trigger: 'mouseup',
            isEnable: isPointInView,
            action: ['brush:filter', 'brush:end', 'rect-mask:end', 'rect-mask:hide', 'reset-button:show'],
        },
    ],
    rollback: [{ trigger: 'reset-button:click', action: ['brush:reset', 'reset-button:hide', 'cursor:crosshair'] }],
});
core_10.registerInteraction('brush-visible', {
    showEnable: [
        { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
        { trigger: 'plot:mouseleave', action: 'cursor:default' },
    ],
    start: [
        {
            trigger: 'plot:mousedown',
            action: ['rect-mask:start', 'rect-mask:show'],
        },
    ],
    processing: [
        {
            trigger: 'plot:mousemove',
            action: ['rect-mask:resize'],
        },
        { trigger: 'mask:change', action: ['element-range-highlight:highlight'] },
    ],
    end: [
        {
            trigger: 'plot:mouseup',
            action: ['rect-mask:end', 'rect-mask:hide', 'element-filter:filter', 'element-range-highlight:clear'],
        },
    ],
    rollback: [
        {
            trigger: 'dblclick',
            action: ['element-filter:clear'],
        },
    ],
});
core_10.registerInteraction('brush-x', {
    showEnable: [
        { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
        { trigger: 'plot:mouseleave', action: 'cursor:default' },
    ],
    start: [
        {
            trigger: 'mousedown',
            isEnable: isPointInView,
            action: ['brush-x:start', 'x-rect-mask:start', 'x-rect-mask:show'],
        },
    ],
    processing: [
        {
            trigger: 'mousemove',
            isEnable: isPointInView,
            action: ['x-rect-mask:resize'],
        },
    ],
    end: [
        {
            trigger: 'mouseup',
            isEnable: isPointInView,
            action: ['brush-x:filter', 'brush-x:end', 'x-rect-mask:end', 'x-rect-mask:hide'],
        },
    ],
    rollback: [{ trigger: 'dblclick', action: ['brush-x:reset'] }],
});
core_10.registerInteraction('element-path-highlight', {
    showEnable: [
        { trigger: 'plot:mouseenter', action: 'cursor:crosshair' },
        { trigger: 'plot:mouseleave', action: 'cursor:default' },
    ],
    start: [
        { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:start' },
        { trigger: 'mousedown', isEnable: isPointInView, action: 'path-mask:show' },
    ],
    processing: [{ trigger: 'mousemove', action: 'path-mask:addPoint' }],
    end: [{ trigger: 'mouseup', action: 'path-mask:end' }],
    rollback: [{ trigger: 'dblclick', action: 'path-mask:hide' }],
});
// 点击选中，允许取消
core_10.registerInteraction('element-single-selected', {
    start: [{ trigger: 'element:click', action: 'element-single-selected:toggle' }],
});
// 筛选数据
core_10.registerInteraction('legend-filter', {
    showEnable: [
        { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
        { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
    ],
    start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'data-filter:filter'] }],
});
// 筛选数据
core_10.registerInteraction('continuous-filter', {
    start: [{ trigger: 'legend:valuechanged', action: 'data-filter:filter' }],
});
// 筛选数据
core_10.registerInteraction('continuous-visible-filter', {
    start: [{ trigger: 'legend:valuechanged', action: 'element-filter:filter' }],
});
// 筛选图形
core_10.registerInteraction('legend-visible-filter', {
    showEnable: [
        { trigger: 'legend-item:mouseenter', action: 'cursor:pointer' },
        { trigger: 'legend-item:mouseleave', action: 'cursor:default' },
    ],
    start: [{ trigger: 'legend-item:click', action: ['list-unchecked:toggle', 'element-filter:filter'] }],
});
// 出现背景框
core_10.registerInteraction('active-region', {
    start: [{ trigger: 'plot:mousemove', action: 'active-region:show' }],
    end: [{ trigger: 'plot:mouseleave', action: 'active-region:hide' }],
});
function isWheelDown(event) {
    event.gEvent.preventDefault();
    return event.gEvent.originalEvent.deltaY > 0;
}
core_10.registerInteraction('view-zoom', {
    start: [
        {
            trigger: 'plot:mousewheel',
            isEnable: function (context) {
                return isWheelDown(context.event);
            },
            action: 'scale-zoom:zoomOut',
            throttle: { wait: 100, leading: true, trailing: false },
        },
        {
            trigger: 'plot:mousewheel',
            isEnable: function (context) {
                return !isWheelDown(context.event);
            },
            action: 'scale-zoom:zoomIn',
            throttle: { wait: 100, leading: true, trailing: false },
        },
    ],
});
core_10.registerInteraction('sibling-tooltip', {
    start: [{ trigger: 'plot:mousemove', action: 'sibling-tooltip:show' }],
    end: [{ trigger: 'plot:mouseleave', action: 'sibling-tooltip:hide' }],
});
tslib_1.__exportStar(require("./core"), exports);
// 一些工具方法导出
var graphics_1 = require("./util/graphics");
var transform_1 = require("./util/transform");
exports.Util = {
    translate: transform_1.translate,
    rotate: transform_1.rotate,
    zoom: transform_1.zoom,
    transform: transform_1.transform,
    getAngle: graphics_1.getAngle,
    polarToCartesian: graphics_1.polarToCartesian,
};

},{"./animate/animation/fade":207,"./animate/animation/grow-in":208,"./animate/animation/path-in":210,"./animate/animation/position-update":211,"./animate/animation/scale-in":212,"./animate/animation/sector-path-update":213,"./animate/animation/wave-in":215,"./animate/animation/zoom":216,"./chart/controller/annotation":220,"./chart/controller/axis":221,"./chart/controller/legend":226,"./chart/controller/slider":227,"./chart/controller/tooltip":228,"./core":238,"./facet/circle":241,"./facet/list":244,"./facet/matrix":245,"./facet/mirror":246,"./facet/rect":247,"./facet/tree":248,"./geometry/area":249,"./geometry/edge":251,"./geometry/heatmap":253,"./geometry/interval":254,"./geometry/label/base":255,"./geometry/label/interval":257,"./geometry/label/layout/limit-in-canvas":258,"./geometry/label/layout/limit-in-shape":259,"./geometry/label/layout/overlap":260,"./geometry/label/layout/pie/distribute":261,"./geometry/label/layout/pie/outer":262,"./geometry/label/pie":263,"./geometry/label/polar":264,"./geometry/line":265,"./geometry/path":266,"./geometry/point":267,"./geometry/polygon":268,"./geometry/schema":269,"./geometry/shape/area/line":271,"./geometry/shape/area/smooth":273,"./geometry/shape/area/smooth-line":272,"./geometry/shape/edge/arc":276,"./geometry/shape/edge/smooth":278,"./geometry/shape/edge/vhv":280,"./geometry/shape/interval/funnel":281,"./geometry/shape/interval/hollow-rect":282,"./geometry/shape/interval/line":284,"./geometry/shape/interval/pyramid":285,"./geometry/shape/interval/tick":286,"./geometry/shape/line/step":289,"./geometry/shape/point/hollow":291,"./geometry/shape/point/image":292,"./geometry/shape/point/solid":294,"./geometry/shape/polygon/square":297,"./geometry/shape/schema/box":298,"./geometry/shape/schema/candle":299,"./interaction/action/active-region":310,"./interaction/action/component/list-active":313,"./interaction/action/component/list-highlight":315,"./interaction/action/component/list-selected":316,"./interaction/action/component/list-unchecked":318,"./interaction/action/component/tooltip/ellipsis-text":319,"./interaction/action/component/tooltip/geometry":320,"./interaction/action/component/tooltip/sibling":321,"./interaction/action/cursor":322,"./interaction/action/data/filter":323,"./interaction/action/data/range-filter":324,"./interaction/action/data/sibling-filter":325,"./interaction/action/element/active":326,"./interaction/action/element/filter":327,"./interaction/action/element/highlight":331,"./interaction/action/element/highlight-by-color":328,"./interaction/action/element/highlight-by-x":329,"./interaction/action/element/link-by-color":332,"./interaction/action/element/range-active":333,"./interaction/action/element/range-highlight":334,"./interaction/action/element/range-selected":335,"./interaction/action/element/selected":337,"./interaction/action/element/sibling-filter":338,"./interaction/action/element/single-active":339,"./interaction/action/element/single-highlight":340,"./interaction/action/element/single-selected":341,"./interaction/action/mask/circle":347,"./interaction/action/mask/dim-rect":348,"./interaction/action/mask/path":349,"./interaction/action/mask/rect":350,"./interaction/action/mask/smooth-path":351,"./interaction/action/view/button":354,"./interaction/action/view/drag":355,"./interaction/action/view/move":356,"./interaction/action/view/scale-translate":358,"./interaction/action/view/scale-zoom":359,"./theme/style-sheet/dark":366,"./util/graphics":375,"./util/theme":382,"./util/transform":384,"@antv/g-canvas":127,"@antv/g-svg":186,"tslib":385}],310:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var graphics_1 = require("../../util/graphics");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * 背景框的 Action
 * @ignore
 */
var ActiveRegion = /** @class */ (function (_super) {
    tslib_1.__extends(ActiveRegion, _super);
    function ActiveRegion() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 显示
     */
    ActiveRegion.prototype.show = function () {
        var view = this.context.view;
        var ev = this.context.event;
        var tooltipItems = view.getTooltipItems({
            x: ev.x,
            y: ev.y,
        });
        if (util_1.isEqual(tooltipItems, this.items)) {
            // 如果拾取数据同上次相同，则不重复绘制
            return;
        }
        this.items = tooltipItems;
        if (tooltipItems.length) {
            var xField_1 = view.getXScale().field;
            var xValue_1 = tooltipItems[0].data[xField_1];
            // 根据 x 对应的值查找 elements
            var elements_1 = [];
            var geometries = view.geometries;
            util_1.each(geometries, function (geometry) {
                if (geometry.type === 'interval' || geometry.type === 'schema') {
                    var result = geometry.getElementsBy(function (ele) {
                        var eleData = ele.getData();
                        return eleData[xField_1] === xValue_1;
                    });
                    elements_1 = elements_1.concat(result);
                }
            });
            // 根据 bbox 计算背景框的面积区域
            if (elements_1.length) {
                var coordinate_1 = view.getCoordinate();
                var firstBBox_1 = elements_1[0].shape.getCanvasBBox();
                var lastBBox_1 = elements_1[0].shape.getCanvasBBox();
                var groupBBox_1 = firstBBox_1;
                util_1.each(elements_1, function (ele) {
                    var bbox = ele.shape.getCanvasBBox();
                    if (coordinate_1.isTransposed) {
                        if (bbox.minY < firstBBox_1.minY) {
                            firstBBox_1 = bbox;
                        }
                        if (bbox.maxY > lastBBox_1.maxY) {
                            lastBBox_1 = bbox;
                        }
                    }
                    else {
                        if (bbox.minX < firstBBox_1.minX) {
                            firstBBox_1 = bbox;
                        }
                        if (bbox.maxX > lastBBox_1.maxX) {
                            lastBBox_1 = bbox;
                        }
                    }
                    groupBBox_1.x = Math.min(bbox.minX, groupBBox_1.minX);
                    groupBBox_1.y = Math.min(bbox.minY, groupBBox_1.minY);
                    groupBBox_1.width = Math.max(bbox.maxX, groupBBox_1.maxX) - groupBBox_1.x;
                    groupBBox_1.height = Math.max(bbox.maxY, groupBBox_1.maxY) - groupBBox_1.y;
                });
                var backgroundGroup = view.backgroundGroup, coordinateBBox = view.coordinateBBox;
                var path = void 0;
                if (coordinate_1.isRect) {
                    var xScale = view.getXScale();
                    var appendRatio = xScale.isLinear ? 0 : 0.25; // 如果 x 轴是数值类型，如直方图，不需要家额外的宽度
                    var minX = void 0;
                    var minY = void 0;
                    var width = void 0;
                    var height = void 0;
                    if (coordinate_1.isTransposed) {
                        minX = coordinateBBox.minX;
                        minY = Math.min(lastBBox_1.minY, firstBBox_1.minY) - appendRatio * lastBBox_1.height;
                        width = coordinateBBox.width;
                        height = groupBBox_1.height + appendRatio * 2 * lastBBox_1.height;
                    }
                    else {
                        minX = Math.min(firstBBox_1.minX, lastBBox_1.minX) - appendRatio * firstBBox_1.width;
                        minY = Math.min(coordinateBBox.minY, firstBBox_1.minY);
                        width = groupBBox_1.width + appendRatio * 2 * firstBBox_1.width;
                        height = coordinateBBox.height;
                    }
                    path = [
                        ['M', minX, minY],
                        ['L', minX + width, minY],
                        ['L', minX + width, minY + height],
                        ['L', minX, minY + height],
                        ['Z'],
                    ];
                }
                else {
                    var firstElement = util_1.head(elements_1);
                    var lastElement = util_1.last(elements_1);
                    var startAngle = graphics_1.getAngle(firstElement.getModel(), coordinate_1).startAngle;
                    var endAngle = graphics_1.getAngle(lastElement.getModel(), coordinate_1).endAngle;
                    var center = coordinate_1.getCenter();
                    var radius = coordinate_1.getRadius();
                    var innterRadius = coordinate_1.innerRadius * radius;
                    path = graphics_1.getSectorPath(center.x, center.y, radius, startAngle, endAngle, innterRadius);
                }
                if (this.regionPath) {
                    this.regionPath.attr('path', path);
                    this.regionPath.show();
                }
                else {
                    this.regionPath = backgroundGroup.addShape({
                        type: 'path',
                        name: 'active-region',
                        capture: false,
                        attrs: {
                            path: path,
                            fill: '#CCD6EC',
                            opacity: 0.3,
                        },
                    });
                }
            }
        }
    };
    /**
     * 隐藏
     */
    ActiveRegion.prototype.hide = function () {
        if (this.regionPath) {
            this.regionPath.hide();
        }
        // this.regionPath = null;
        this.items = null;
    };
    /**
     * 销毁
     */
    ActiveRegion.prototype.destroy = function () {
        this.hide();
        if (this.regionPath) {
            this.regionPath.remove(true);
        }
        _super.prototype.destroy.call(this);
    };
    return ActiveRegion;
}(base_1.default));
exports.default = ActiveRegion;

},{"../../util/graphics":375,"./base":311,"@antv/util":803,"tslib":385}],311:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
/**
 * Action 的基类
 */
var Action = /** @class */ (function () {
    function Action(context, cfg) {
        this.context = context;
        this.cfg = cfg;
        context.addAction(this);
    }
    /**
     * 设置配置项传入的值
     * @param cfg
     */
    Action.prototype.applyCfg = function (cfg) {
        util_1.assign(this, cfg);
    };
    /**
     * Inits action，提供给子类用于继承
     */
    Action.prototype.init = function () {
        this.applyCfg(this.cfg);
    };
    /**
     * Destroys action
     */
    Action.prototype.destroy = function () {
        // 移除 action
        this.context.removeAction(this);
        // 清空
        this.context = null;
    };
    return Action;
}());
exports.default = Action;

},{"@antv/util":803}],312:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("./base"));
/** 回调函数构建的 Action */
var CallbackAction = /** @class */ (function (_super) {
    tslib_1.__extends(CallbackAction, _super);
    function CallbackAction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 执行
     */
    CallbackAction.prototype.execute = function () {
        if (this.callback) {
            this.callback(this.context);
        }
    };
    /**
     * 销毁
     */
    CallbackAction.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.callback = null;
    };
    return CallbackAction;
}(base_1.default));
exports.default = CallbackAction;

},{"./base":311,"tslib":385}],313:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var list_state_1 = tslib_1.__importDefault(require("./list-state"));
/**
 * 列表项（图例项、坐标轴文本）激活的 Action
 * @class
 * @ignore
 */
var ListActive = /** @class */ (function (_super) {
    tslib_1.__extends(ListActive, _super);
    function ListActive() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    /**
     * 激活选项
     */
    ListActive.prototype.active = function () {
        this.setState();
    };
    return ListActive;
}(list_state_1.default));
exports.default = ListActive;

},{"./list-state":317,"tslib":385}],314:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearList = void 0;
var util_1 = require("@antv/util");
var STATUS_UNACTIVE = 'inactive';
var STATUS_ACTIVE = 'active';
/**
 * 清理图例的 Highlight 效果
 * @param list 列表组件，图例或者坐标轴
 * @ignore
 */
function clearList(list) {
    var items = list.getItems();
    util_1.each(items, function (item) {
        if (list.hasState(item, STATUS_ACTIVE)) {
            list.setItemState(item, STATUS_ACTIVE, false);
        }
        if (list.hasState(item, STATUS_UNACTIVE)) {
            list.setItemState(item, STATUS_UNACTIVE, false);
        }
    });
}
exports.clearList = clearList;

},{"@antv/util":803}],315:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var list_highlight_util_1 = require("./list-highlight-util");
var list_state_1 = tslib_1.__importDefault(require("./list-state"));
var STATUS_UNACTIVE = 'inactive';
var STATUS_ACTIVE = 'active';
/**
 * highlight Action 的效果是 active 和 inactive 两个状态的组合
 * @class
 * @ignore
 */
var ListHighlight = /** @class */ (function (_super) {
    tslib_1.__extends(ListHighlight, _super);
    function ListHighlight() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = STATUS_ACTIVE;
        _this.ignoreItemStates = ['unchecked']; // 当存在 unchecked 状态时不触发
        return _this;
    }
    // 如果 item.name 匹配，则设置 highlight 以及取消
    ListHighlight.prototype.setItemsState = function (list, name, enable) {
        this.setHighlightBy(list, function (item) { return item.name === name; }, enable);
    };
    // 单个 item 设置状态
    ListHighlight.prototype.setItemState = function (list, item, enable) {
        var items = list.getItems();
        this.setHighlightBy(list, function (el) { return el === item; }, enable);
    };
    // 根据条件设置 highlight
    ListHighlight.prototype.setHighlightBy = function (list, callback, enable) {
        var items = list.getItems();
        if (enable) {
            // 设置 highlight 时，保留之前已经 Highlight 的项
            util_1.each(items, function (item) {
                if (callback(item)) {
                    if (list.hasState(item, STATUS_UNACTIVE)) {
                        list.setItemState(item, STATUS_UNACTIVE, false);
                    }
                    list.setItemState(item, STATUS_ACTIVE, true);
                }
                else if (!list.hasState(item, STATUS_ACTIVE)) {
                    list.setItemState(item, STATUS_UNACTIVE, true);
                }
            });
        }
        else {
            var activeItems = list.getItemsByState(STATUS_ACTIVE);
            var allCancel_1 = true;
            // 检测 activeItems 是否要全部取消
            util_1.each(activeItems, function (item) {
                if (!callback(item)) {
                    allCancel_1 = false;
                    return false;
                }
            });
            if (allCancel_1) {
                this.clear();
            }
            else {
                // 如果不是都要取消 highlight, 则设置匹配的 element 的状态为 unactive
                // 其他 element 状态不变
                util_1.each(items, function (item) {
                    if (callback(item)) {
                        if (list.hasState(item, STATUS_ACTIVE)) {
                            list.setItemState(item, STATUS_ACTIVE, false);
                        }
                        list.setItemState(item, STATUS_UNACTIVE, true);
                    }
                });
            }
        }
    };
    /**
     * highlight 图例项（坐标轴文本）
     */
    ListHighlight.prototype.highlight = function () {
        this.setState();
    };
    // 需要全部清理 active 和 unactive
    ListHighlight.prototype.clear = function () {
        var triggerInfo = this.getTriggerListInfo();
        if (triggerInfo) {
            list_highlight_util_1.clearList(triggerInfo.list);
        }
        else {
            // 如果不是 component 的事件触发，则所有满足触发条件的组件都清除该状态
            var components = this.getAllowComponents();
            util_1.each(components, function (component) {
                component.clearItemsState(STATUS_ACTIVE);
                component.clearItemsState(STATUS_UNACTIVE);
            });
        }
    };
    return ListHighlight;
}(list_state_1.default));
exports.default = ListHighlight;

},{"./list-highlight-util":314,"./list-state":317,"@antv/util":803,"tslib":385}],316:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var list_state_1 = tslib_1.__importDefault(require("./list-state"));
/**
 * 图例项和坐标轴文本选中的 Action
 * @ignore
 */
var ListSelected = /** @class */ (function (_super) {
    tslib_1.__extends(ListSelected, _super);
    function ListSelected() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'selected';
        return _this;
    }
    ListSelected.prototype.selected = function () {
        this.setState();
    };
    return ListSelected;
}(list_state_1.default));
exports.default = ListSelected;

},{"./list-state":317,"tslib":385}],317:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_2 = require("../util");
var util_3 = require("../util");
/**
 * 列表项状态 Action 的基础类
 * @class
 * @ignore
 */
var ListState = /** @class */ (function (_super) {
    tslib_1.__extends(ListState, _super);
    function ListState() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = '';
        _this.ignoreItemStates = [];
        return _this;
    }
    /** 获取触发的列表组件 */
    ListState.prototype.getTriggerListInfo = function () {
        var delegateObject = util_3.getDelegationObject(this.context);
        var info = null;
        if (util_3.isList(delegateObject)) {
            info = {
                item: delegateObject.item,
                list: delegateObject.component,
            };
        }
        return info;
    };
    // 获取所有允许执行 Action 的组件
    ListState.prototype.getAllowComponents = function () {
        var _this = this;
        var view = this.context.view;
        var components = util_2.getComponents(view);
        var rst = [];
        util_1.each(components, function (component) {
            if (component.isList() && _this.allowSetStateByElement(component)) {
                rst.push(component);
            }
        });
        return rst;
    };
    /** 是否存在指定的状态 */
    ListState.prototype.hasState = function (list, item) {
        return list.hasState(item, this.stateName);
    };
    /** 清理组件的状态 */
    ListState.prototype.clearAllComponentsState = function () {
        var _this = this;
        var components = this.getAllowComponents();
        util_1.each(components, function (component) {
            component.clearItemsState(_this.stateName);
        });
    };
    // 不是所有的 component 都能进行 active，目前仅支持分类 scale 对应的组件
    ListState.prototype.allowSetStateByElement = function (component) {
        var field = component.get('field');
        if (!field) {
            return false;
        }
        if (this.cfg && this.cfg.componentNames) {
            var name_1 = component.get('name');
            // 如果配置了限制的 component name，则要进行检测
            if (this.cfg.componentNames.indexOf(name_1) === -1) {
                return false;
            }
        }
        var view = this.context.view;
        var scale = util_3.getScaleByField(view, field);
        return scale && scale.isCategory;
    };
    // 检测是否允许触发对应的状态改变事件
    ListState.prototype.allowSetStateByItem = function (item, list) {
        var ignoreStates = this.ignoreItemStates;
        if (ignoreStates.length) {
            var filterStates = ignoreStates.filter(function (state) {
                return list.hasState(item, state);
            });
            return filterStates.length === 0;
        }
        return true; // 没有定义忽略的状态时，允许
    };
    // 设置组件的 item active
    ListState.prototype.setStateByElement = function (component, element, enable) {
        var field = component.get('field');
        var view = this.context.view;
        var scale = util_3.getScaleByField(view, field);
        var value = util_3.getElementValue(element, field);
        var text = scale.getText(value);
        this.setItemsState(component, text, enable);
    };
    // 设置状态
    ListState.prototype.setStateEnable = function (enable) {
        var _this = this;
        var element = util_3.getCurrentElement(this.context);
        if (element) {
            // trigger by element
            var components = this.getAllowComponents();
            util_1.each(components, function (component) {
                _this.setStateByElement(component, element, enable);
            });
        }
        else {
            // 被组件触发
            var delegateObject = util_3.getDelegationObject(this.context);
            if (util_3.isList(delegateObject)) {
                var item = delegateObject.item, component = delegateObject.component;
                if (this.allowSetStateByElement(component) && this.allowSetStateByItem(item, component)) {
                    this.setItemState(component, item, enable);
                }
            }
        }
    };
    // 多个 item 设置状态
    ListState.prototype.setItemsState = function (list, name, enable) {
        var _this = this;
        var items = list.getItems();
        util_1.each(items, function (item) {
            if (item.name === name) {
                _this.setItemState(list, item, enable);
            }
        });
    };
    // 单个 item 设置状态
    ListState.prototype.setItemState = function (list, item, enable) {
        list.setItemState(item, this.stateName, enable);
    };
    /**
     * 设置状态
     */
    ListState.prototype.setState = function () {
        this.setStateEnable(true);
    };
    /**
     * 取消状态
     */
    ListState.prototype.reset = function () {
        this.setStateEnable(false);
    };
    /**
     * 切换状态
     */
    ListState.prototype.toggle = function () {
        var triggerInfo = this.getTriggerListInfo();
        if (triggerInfo && triggerInfo.item) {
            var list = triggerInfo.list, item = triggerInfo.item;
            var enable = this.hasState(list, item);
            this.setItemState(list, item, !enable);
        }
    };
    /**
     * 取消状态
     */
    ListState.prototype.clear = function () {
        var triggerInfo = this.getTriggerListInfo();
        if (triggerInfo) {
            triggerInfo.list.clearItemsState(this.stateName);
        }
        else {
            this.clearAllComponentsState();
        }
    };
    return ListState;
}(base_1.default));
exports.default = ListState;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],318:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var list_state_1 = tslib_1.__importDefault(require("./list-state"));
/**
 * 图例项取消勾选的 Action
 * @ignore
 */
var ListUnchecked = /** @class */ (function (_super) {
    tslib_1.__extends(ListUnchecked, _super);
    function ListUnchecked() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'unchecked';
        return _this;
    }
    /**
     * 取消勾选
     */
    ListUnchecked.prototype.unchecked = function () {
        this.setState();
    };
    return ListUnchecked;
}(list_state_1.default));
exports.default = ListUnchecked;

},{"./list-state":317,"tslib":385}],319:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../../base"));
var dependents_1 = require("../../../../dependents");
/**
 * 用于组件文本省略后需要展示完整信息的 Tooltip Action
 * @ignore
 */
var EllipsisText = /** @class */ (function (_super) {
    tslib_1.__extends(EllipsisText, _super);
    function EllipsisText() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.timeStamp = 0;
        return _this;
    }
    EllipsisText.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.tooltip && this.tooltip.destroy();
    };
    /**
     * 显示 Tooltip
     * @returns
     */
    EllipsisText.prototype.show = function () {
        var context = this.context;
        var ev = context.event;
        var lastTimeStamp = this.timeStamp;
        var timeStamp = +new Date();
        if (timeStamp - lastTimeStamp > 16) {
            var preLoc = this.location;
            var curLoc = { x: ev.x, y: ev.y };
            if (!preLoc || !util_1.isEqual(preLoc, curLoc)) {
                this.showTooltip(curLoc);
            }
            this.timeStamp = timeStamp;
            this.location = curLoc;
        }
    };
    /**
     * 隐藏 Tooltip。
     * @returns
     */
    EllipsisText.prototype.hide = function () {
        this.hideTooltip();
        this.location = null;
    };
    EllipsisText.prototype.showTooltip = function (curLoc) {
        var context = this.context;
        var ev = context.event;
        var target = ev.target;
        if (target && target.get('tip')) {
            if (!this.tooltip) {
                this.renderTooltip(); // 延迟生成
            }
            var tipContent = target.get('tip');
            // 展示 tooltip
            this.tooltip.update(tslib_1.__assign({ title: tipContent }, curLoc));
            this.tooltip.show();
        }
    };
    EllipsisText.prototype.hideTooltip = function () {
        this.tooltip && this.tooltip.hide();
    };
    EllipsisText.prototype.renderTooltip = function () {
        var view = this.context.view;
        var canvas = view.canvas;
        var region = {
            start: { x: 0, y: 0 },
            end: { x: canvas.get('width'), y: canvas.get('height') },
        };
        var theme = view.getTheme();
        var tooltipStyles = util_1.get(theme, ['components', 'tooltip', 'domStyles'], {}); // 获取 tooltip 样式
        var tooltip = new dependents_1.HtmlTooltip({
            parent: canvas.get('el').parentNode,
            region: region,
            visible: false,
            crosshairs: null,
            domStyles: tooltipStyles,
        });
        tooltip.init();
        tooltip.setCapture(false); // 不允许捕获事件
        this.tooltip = tooltip;
    };
    return EllipsisText;
}(base_1.default));
exports.default = EllipsisText;

},{"../../../../dependents":239,"../../base":311,"@antv/util":803,"tslib":385}],320:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../../base"));
/**
 * Tooltip 展示隐藏的 Action
 * @ignore
 */
var TooltipAction = /** @class */ (function (_super) {
    tslib_1.__extends(TooltipAction, _super);
    function TooltipAction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.timeStamp = 0;
        return _this;
    }
    /**
     * 显示 Tooltip
     * @returns
     */
    TooltipAction.prototype.show = function () {
        var context = this.context;
        var ev = context.event;
        var view = context.view;
        var isTooltipLocked = view.isTooltipLocked();
        if (isTooltipLocked) {
            // 锁定时不移动 tooltip
            return;
        }
        var lastTimeStamp = this.timeStamp;
        var timeStamp = +new Date();
        if (timeStamp - lastTimeStamp > 16) {
            var preLoc = this.location;
            var curLoc = { x: ev.x, y: ev.y };
            if (!preLoc || !util_1.isEqual(preLoc, curLoc)) {
                this.showTooltip(view, curLoc);
            }
            this.timeStamp = timeStamp;
            this.location = curLoc;
        }
    };
    /**
     * 隐藏 Tooltip。
     * @returns
     */
    TooltipAction.prototype.hide = function () {
        var view = this.context.view;
        var isTooltipLocked = view.isTooltipLocked();
        if (isTooltipLocked) {
            // 锁定 tooltip 时不隐藏
            return;
        }
        this.hideTooltip(view);
        this.location = null;
    };
    TooltipAction.prototype.showTooltip = function (view, point) {
        // 相同位置不重复展示
        view.showTooltip(point);
    };
    TooltipAction.prototype.hideTooltip = function (view) {
        view.hideTooltip();
    };
    return TooltipAction;
}(base_1.default));
exports.default = TooltipAction;

},{"../../base":311,"@antv/util":803,"tslib":385}],321:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var util_2 = require("../../util");
var geometry_1 = tslib_1.__importDefault(require("./geometry"));
/**
 * 存在多个 view 时，控制其他 view 上的 tooltip 显示
 * @ignore
 */
var SiblingTooltip = /** @class */ (function (_super) {
    tslib_1.__extends(SiblingTooltip, _super);
    function SiblingTooltip() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 所有同一层级的 tooltip 显示
     * @param view
     * @param point
     */
    SiblingTooltip.prototype.showTooltip = function (view, point) {
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            var siblingPoint = util_2.getSiblingPoint(view, sibling, point);
            sibling.showTooltip(siblingPoint);
        });
    };
    /**
     * 隐藏同一层级的 tooltip
     * @param view
     */
    SiblingTooltip.prototype.hideTooltip = function (view) {
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            sibling.hideTooltip();
        });
    };
    return SiblingTooltip;
}(geometry_1.default));
exports.default = SiblingTooltip;

},{"../../util":353,"./geometry":320,"@antv/util":803,"tslib":385}],322:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @fileoverview 设置画布的箭头，参看：https://www.w3school.com.cn/jsref/prop_style_cursor.asp
 * @author dxq613
 */
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * 鼠标形状的 Action
 * @ignore
 */
var CursorAction = /** @class */ (function (_super) {
    tslib_1.__extends(CursorAction, _super);
    function CursorAction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CursorAction.prototype.setCursor = function (cursor) {
        var view = this.context.view;
        view.getCanvas().setCursor(cursor);
    };
    /**
     * 默认光标（通常是一个箭头）
     */
    CursorAction.prototype.default = function () {
        this.setCursor('default');
    };
    /** 光标呈现为指示链接的指针（一只手） */
    CursorAction.prototype.pointer = function () {
        this.setCursor('pointer');
    };
    /** 此光标指示某对象可被移动。 */
    CursorAction.prototype.move = function () {
        this.setCursor('move');
    };
    /** 光标呈现为十字线。 */
    CursorAction.prototype.crosshair = function () {
        this.setCursor('crosshair');
    };
    /** 此光标指示程序正忙（通常是一只表或沙漏）。 */
    CursorAction.prototype.wait = function () {
        this.setCursor('wait');
    };
    /** 此光标指示可用的帮助（通常是一个问号或一个气球）。 */
    CursorAction.prototype.help = function () {
        this.setCursor('help');
    };
    /** 此光标指示文本。 */
    CursorAction.prototype.text = function () {
        this.setCursor('text');
    };
    /**
     * 此光标指示矩形框的边缘可被向右（东）移动。
     */
    CursorAction.prototype.eResize = function () {
        this.setCursor('e-resize');
    };
    /**
     * 此光标指示矩形框的边缘可被向左（西）移动。
     */
    CursorAction.prototype.wResize = function () {
        this.setCursor('w-resize');
    };
    /**
     * 此光标指示矩形框的边缘可被向上（北）移动。
     */
    CursorAction.prototype.nResize = function () {
        this.setCursor('n-resize');
    };
    /**
     * 此光标指示矩形框的边缘可被向下（南）移动。
     */
    CursorAction.prototype.sResize = function () {
        this.setCursor('s-resize');
    };
    /**
     * 光标指示可移动的方向 右上方（东北）
     */
    CursorAction.prototype.neResize = function () {
        this.setCursor('ne-resize');
    };
    /**
     * 光标指示可移动的方向 左上方（西北）
     */
    CursorAction.prototype.nwResize = function () {
        this.setCursor('nw-resize');
    };
    /**
     * 光标指示可移动的方向右下方（东南）
     */
    CursorAction.prototype.seResize = function () {
        this.setCursor('se-resize');
    };
    /**
     * 光标指示可移动的方向左下方（西南）
     */
    CursorAction.prototype.swResize = function () {
        this.setCursor('sw-resize');
    };
    /**
     * 光标指示可以在上下方向移动
     */
    CursorAction.prototype.nsResize = function () {
        this.setCursor('ns-resize');
    };
    /**
     * 光标指示可以在左右方向移动
     */
    CursorAction.prototype.ewResize = function () {
        this.setCursor('ew-resize');
    };
    return CursorAction;
}(base_1.default));
exports.default = CursorAction;

},{"./base":311,"tslib":385}],323:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_2 = require("../util");
/**
 * 数据过滤。
 * @ignore
 */
var DataFilter = /** @class */ (function (_super) {
    tslib_1.__extends(DataFilter, _super);
    function DataFilter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DataFilter.prototype.filterView = function (view, field, filter) {
        var _this = this;
        // 只有存在这个 scale 时才生效
        if (view.getScaleByField(field)) {
            view.filter(field, filter);
        }
        if (view.views && view.views.length) {
            util_1.each(view.views, function (subView) {
                _this.filterView(subView, field, filter);
            });
        }
    };
    /**
     * 过滤数据
     */
    DataFilter.prototype.filter = function () {
        var delegateObject = util_2.getDelegationObject(this.context);
        if (delegateObject) {
            var view = this.context.view;
            var component = delegateObject.component;
            var field = component.get('field');
            // 列表类的组件能够触发
            if (util_2.isList(delegateObject)) {
                if (field) {
                    var unCheckedItems = component.getItemsByState('unchecked');
                    var scale_1 = util_2.getScaleByField(view, field);
                    var names_1 = unCheckedItems.map(function (item) { return item.name; });
                    if (names_1.length) {
                        this.filterView(view, field, function (value) {
                            var text = scale_1.getText(value);
                            return !names_1.includes(text);
                        });
                    }
                    else {
                        this.filterView(view, field, null);
                    }
                    view.render(true);
                }
            }
            else if (util_2.isSlider(delegateObject)) {
                var range = component.getValue();
                var min_1 = range[0], max_1 = range[1];
                this.filterView(view, field, function (value) {
                    return value >= min_1 && value <= max_1;
                });
                view.render(true);
            }
        }
    };
    return DataFilter;
}(base_1.default));
exports.default = DataFilter;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],324:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_1 = require("../util");
// 获取对应的 scale
function getFilter(scale, dim, point1, point2) {
    var min = Math.min(point1[dim], point2[dim]);
    var max = Math.max(point1[dim], point2[dim]);
    var _a = scale.range, rangeMin = _a[0], rangeMax = _a[1];
    // 约束值在 scale 的 range 之间
    if (min < rangeMin) {
        min = rangeMin;
    }
    if (max > rangeMax) {
        max = rangeMax;
    }
    // 范围大于整个 view 的范围，则返回 null
    if (min === rangeMax && max === rangeMax) {
        return null;
    }
    var minValue = scale.invert(min);
    var maxValue = scale.invert(max);
    if (scale.isCategory) {
        var minIndex = scale.values.indexOf(minValue);
        var maxIndex = scale.values.indexOf(maxValue);
        var arr_1 = scale.values.slice(minIndex, maxIndex + 1);
        return function (value) {
            return arr_1.includes(value);
        };
    }
    else {
        return function (value) {
            return value >= minValue && value <= maxValue;
        };
    }
}
/**
 * 范围过滤的 Action
 * @ignore
 */
var RangeFilter = /** @class */ (function (_super) {
    tslib_1.__extends(RangeFilter, _super);
    function RangeFilter() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * 范围过滤生效的字段/维度，可以是 x, y
         */
        _this.dims = ['x', 'y'];
        /** 起始点 */
        _this.startPoint = null;
        _this.isStarted = false;
        return _this;
    }
    // x,y 是否生效
    RangeFilter.prototype.hasDim = function (dim) {
        return this.dims.includes(dim);
    };
    /**
     * 开始范围过滤，记录范围过滤的起点
     */
    RangeFilter.prototype.start = function () {
        var context = this.context;
        this.isStarted = true;
        this.startPoint = context.getCurrentPoint();
    };
    /**
     * 过滤，以开始的点和当前点对数据进行过滤
     */
    RangeFilter.prototype.filter = function () {
        var startPoint;
        var currentPoint;
        if (util_1.isMask(this.context)) {
            var maskShape = this.context.event.target;
            var bbox = maskShape.getCanvasBBox();
            startPoint = { x: bbox.x, y: bbox.y };
            currentPoint = { x: bbox.maxX, y: bbox.maxY };
        }
        else {
            if (!this.isStarted) {
                // 如果没有开始，则不执行过滤
                return;
            }
            startPoint = this.startPoint;
            currentPoint = this.context.getCurrentPoint();
        }
        if (Math.abs(startPoint.x - currentPoint.x) < 5 || Math.abs(startPoint.x - currentPoint.y) < 5) {
            // 距离过小也不生效
            return;
        }
        var view = this.context.view;
        var coord = view.getCoordinate();
        var normalCurrent = coord.invert(currentPoint);
        var normalStart = coord.invert(startPoint);
        // 设置 x 方向的 filter
        if (this.hasDim('x')) {
            var xScale = view.getXScale();
            var filter = getFilter(xScale, 'x', normalCurrent, normalStart);
            this.filterView(view, xScale.field, filter);
        }
        // 设置 y 方向的 filter
        if (this.hasDim('y')) {
            var yScale = view.getYScales()[0];
            var filter = getFilter(yScale, 'y', normalCurrent, normalStart);
            this.filterView(view, yScale.field, filter);
        }
        this.reRender(view);
    };
    /**
     * 结束
     */
    RangeFilter.prototype.end = function () {
        this.isStarted = false;
    };
    /**
     * 取消同当前 Action 相关的过滤，指定的 x,y
     */
    RangeFilter.prototype.reset = function () {
        var view = this.context.view;
        this.isStarted = false;
        if (this.hasDim('x')) {
            var xScale = view.getXScale();
            this.filterView(view, xScale.field, null); // 取消过滤
        }
        if (this.hasDim('y')) {
            // y 轴过滤仅取第一个 yScale
            var yScale = view.getYScales()[0];
            this.filterView(view, yScale.field, null); // 取消过滤
        }
        this.reRender(view);
    };
    /**
     * 对 view 进行过滤
     */
    RangeFilter.prototype.filterView = function (view, field, filter) {
        view.filter(field, filter);
    };
    /**
     * 重新渲染
     * @param view
     */
    RangeFilter.prototype.reRender = function (view) {
        view.render(true);
    };
    return RangeFilter;
}(base_1.default));
exports.default = RangeFilter;

},{"../base":311,"../util":353,"tslib":385}],325:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var range_filter_1 = tslib_1.__importDefault(require("./range-filter"));
var util_2 = require("../util");
/**
 * 数据范围过滤，但不在当前的 view 上生效，而在当前的 view 同一层级的其他 views 上生效，用于实现联动过滤。
 * @ignore
 */
var SiblingFilter = /** @class */ (function (_super) {
    tslib_1.__extends(SiblingFilter, _super);
    function SiblingFilter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 对 view 进行过滤
     * @param view
     * @param field
     * @param filter
     */
    SiblingFilter.prototype.filterView = function (view, field, filter) {
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            sibling.filter(field, filter);
        });
    };
    /**
     * 重新渲染
     * @param view
     */
    SiblingFilter.prototype.reRender = function (view) {
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            sibling.render(true);
        });
    };
    return SiblingFilter;
}(range_filter_1.default));
exports.default = SiblingFilter;

},{"../util":353,"./range-filter":324,"@antv/util":803,"tslib":385}],326:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var state_1 = tslib_1.__importDefault(require("./state"));
/**
 * 元素 active 的 Action，允许多个元素同时 active
 * @class
 * @ignore
 */
var ElementActive = /** @class */ (function (_super) {
    tslib_1.__extends(ElementActive, _super);
    function ElementActive() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    /**
     * Active Element
     */
    ElementActive.prototype.active = function () {
        this.setState();
    };
    return ElementActive;
}(state_1.default));
exports.default = ElementActive;

},{"./state":344,"tslib":385}],327:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_2 = require("../util");
/**
 * 元素过滤的 Action，控制元素的显示隐藏
 * @ignore
 */
var ElementFilter = /** @class */ (function (_super) {
    tslib_1.__extends(ElementFilter, _super);
    function ElementFilter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 过滤
     */
    ElementFilter.prototype.filter = function () {
        var delegateObject = util_2.getDelegationObject(this.context);
        var view = this.context.view;
        var elements = util_2.getElements(view);
        if (util_2.isMask(this.context)) {
            var maskElements_1 = util_2.getMaskedElements(this.context, 10);
            if (maskElements_1) {
                util_1.each(elements, function (el) {
                    if (maskElements_1.includes(el)) {
                        el.show();
                    }
                    else {
                        el.hide();
                    }
                });
            }
        }
        else if (delegateObject) {
            var component = delegateObject.component;
            var field_1 = component.get('field');
            // 列表类的组件能够触发
            if (util_2.isList(delegateObject)) {
                if (field_1) {
                    var unCheckedItems = component.getItemsByState('unchecked');
                    var scale_1 = util_2.getScaleByField(view, field_1);
                    var names_1 = unCheckedItems.map(function (item) { return item.name; });
                    // 直接控制显示、隐藏
                    util_1.each(elements, function (el) {
                        var value = util_2.getElementValue(el, field_1);
                        var text = scale_1.getText(value);
                        if (names_1.indexOf(text) >= 0) {
                            el.hide();
                        }
                        else {
                            el.show();
                        }
                    });
                }
            }
            else if (util_2.isSlider(delegateObject)) {
                var range = component.getValue();
                var min_1 = range[0], max_1 = range[1];
                util_1.each(elements, function (el) {
                    var value = util_2.getElementValue(el, field_1);
                    if (value >= min_1 && value <= max_1) {
                        el.show();
                    }
                    else {
                        el.hide();
                    }
                });
            }
        }
    };
    /**
     * 清除过滤
     */
    ElementFilter.prototype.clear = function () {
        var elements = util_2.getElements(this.context.view);
        util_1.each(elements, function (el) {
            el.show();
        });
    };
    /**
     * 恢复发生的过滤，保持同 data-filter 命名的一致
     */
    ElementFilter.prototype.reset = function () {
        this.clear();
    };
    return ElementFilter;
}(base_1.default));
exports.default = ElementFilter;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],328:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util");
var highlight_1 = tslib_1.__importDefault(require("./highlight"));
/**
 * Highlight color
 * @ignore
 */
var HighlightColor = /** @class */ (function (_super) {
    tslib_1.__extends(HighlightColor, _super);
    function HighlightColor() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    HighlightColor.prototype.setStateByElement = function (element, enable) {
        var view = this.context.view;
        var colorAttr = element.geometry.getAttribute('color');
        if (!colorAttr) {
            return;
        }
        var scale = view.getScaleByField(colorAttr.getFields()[0]);
        var value = util_1.getElementValue(element, scale.field);
        var elements = util_1.getElements(view);
        var highlightElements = elements.filter(function (el) {
            return util_1.getElementValue(el, scale.field) === value;
        });
        this.setHighlightBy(elements, function (el) { return highlightElements.includes(el); }, enable);
    };
    return HighlightColor;
}(highlight_1.default));
exports.default = HighlightColor;

},{"../util":353,"./highlight":331,"tslib":385}],329:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util");
var highlight_1 = tslib_1.__importStar(require("./highlight"));
/**
 * Highlight x
 * @ignore
 */
var HighlightX = /** @class */ (function (_super) {
    tslib_1.__extends(HighlightX, _super);
    function HighlightX() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // 不允许多选
    HighlightX.prototype.setElementHighlight = function (el, callback) {
        if (callback(el)) {
            if (el.hasState(highlight_1.STATUS_UNACTIVE)) {
                el.setState(highlight_1.STATUS_UNACTIVE, false);
            }
            el.setState(highlight_1.STATUS_ACTIVE, true);
        }
        else {
            el.setState(highlight_1.STATUS_UNACTIVE, true);
            if (el.hasState(highlight_1.STATUS_ACTIVE)) {
                el.setState(highlight_1.STATUS_ACTIVE, false);
            }
        }
    };
    HighlightX.prototype.setStateByElement = function (element, enable) {
        var view = this.context.view;
        var scale = view.getXScale();
        var value = util_1.getElementValue(element, scale.field);
        var elements = util_1.getElements(view);
        var highlightElements = elements.filter(function (el) {
            return util_1.getElementValue(el, scale.field) === value;
        });
        this.setHighlightBy(elements, function (el) { return highlightElements.includes(el); }, enable);
    };
    /**
     * 切换状态
     */
    HighlightX.prototype.toggle = function () {
        var element = util_1.getCurrentElement(this.context);
        if (element) {
            var hasState = element.hasState(this.stateName);
            this.setStateByElement(element, !hasState);
        }
    };
    return HighlightX;
}(highlight_1.default));
exports.default = HighlightX;

},{"../util":353,"./highlight":331,"tslib":385}],330:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setHighlightBy = exports.clearHighlight = void 0;
var util_1 = require("@antv/util");
var util_2 = require("../util");
var STATUS_UNACTIVE = 'inactive';
var STATUS_ACTIVE = 'active';
/**
 * @ignore
 * 清理 highlight 效果
 * @param view View 或者 Chart
 */
function clearHighlight(view) {
    var elements = util_2.getElements(view);
    util_1.each(elements, function (el) {
        if (el.hasState(STATUS_ACTIVE)) {
            el.setState(STATUS_ACTIVE, false);
        }
        if (el.hasState(STATUS_UNACTIVE)) {
            el.setState(STATUS_UNACTIVE, false);
        }
    });
}
exports.clearHighlight = clearHighlight;
/**
 * @ignore
 * 设置多个元素的 highlight
 * @param elements 元素集合
 * @param callback 设置回调函数
 * @param enable 设置或者取消
 */
function setHighlightBy(elements, callback, enable) {
    util_1.each(elements, function (el) {
        // 需要处理 active 和 unactive 的互斥
        if (callback(el)) {
            if (el.hasState(STATUS_UNACTIVE)) {
                el.setState(STATUS_UNACTIVE, false);
            }
            el.setState(STATUS_ACTIVE, enable);
        }
        else {
            if (el.hasState(STATUS_ACTIVE)) {
                el.setState(STATUS_ACTIVE, false);
            }
            el.setState(STATUS_UNACTIVE, enable);
        }
    });
}
exports.setHighlightBy = setHighlightBy;

},{"../util":353,"@antv/util":803}],331:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.STATUS_ACTIVE = exports.STATUS_UNACTIVE = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var util_2 = require("../util");
var highlight_util_1 = require("./highlight-util");
var state_1 = tslib_1.__importDefault(require("./state"));
var constant_1 = require("../../../constant");
exports.STATUS_UNACTIVE = constant_1.ELEMENT_STATE.INACTIVE;
exports.STATUS_ACTIVE = constant_1.ELEMENT_STATE.ACTIVE;
/**
 * @ignore
 * highlight，指定图形高亮，其他图形变暗
 */
var ElementHighlight = /** @class */ (function (_super) {
    tslib_1.__extends(ElementHighlight, _super);
    function ElementHighlight() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = exports.STATUS_ACTIVE;
        return _this;
    }
    // 多个元素设置、取消 highlight
    ElementHighlight.prototype.setElementsStateByItem = function (elements, field, item, enable) {
        var _this = this;
        var callback = function (el) { return _this.isMathItem(el, field, item); };
        this.setHighlightBy(elements, callback, enable);
    };
    // 设置元素的 highlight
    ElementHighlight.prototype.setElementHighlight = function (el, callback) {
        if (callback(el)) {
            if (el.hasState(exports.STATUS_UNACTIVE)) {
                el.setState(exports.STATUS_UNACTIVE, false);
            }
            el.setState(exports.STATUS_ACTIVE, true);
        }
        else if (!el.hasState(exports.STATUS_ACTIVE)) {
            el.setState(exports.STATUS_UNACTIVE, true);
        }
    };
    ElementHighlight.prototype.setHighlightBy = function (elements, callback, enable) {
        var _this = this;
        if (enable) {
            // 如果是设置 highlight ，则将匹配的 element 设置成 active，
            // 其他如果不是 active，则设置成 unactive
            util_1.each(elements, function (el) {
                _this.setElementHighlight(el, callback);
            });
        }
        else {
            // 如果取消 highlight，则要检测是否全部取消 highlight
            var activeElements = util_2.getElementsByState(this.context.view, exports.STATUS_ACTIVE);
            var allCancel_1 = true;
            // 检测所有 activeElements 都要取消 highlight
            util_1.each(activeElements, function (el) {
                if (!callback(el)) {
                    allCancel_1 = false;
                    return false;
                }
            });
            if (allCancel_1) {
                // 都要取消，则取消所有的 active，unactive 状态
                this.clear();
            }
            else {
                // 如果不是都要取消 highlight, 则设置匹配的 element 的状态为 unactive
                // 其他 element 状态不变
                util_1.each(elements, function (el) {
                    if (callback(el)) {
                        if (el.hasState(exports.STATUS_ACTIVE)) {
                            el.setState(exports.STATUS_ACTIVE, false);
                        }
                        el.setState(exports.STATUS_UNACTIVE, true);
                    }
                });
            }
        }
    };
    // 单个元素设置和取消 highlight
    ElementHighlight.prototype.setElementState = function (element, enable) {
        var view = this.context.view;
        var elements = util_2.getElements(view);
        this.setHighlightBy(elements, function (el) { return element === el; }, enable);
    };
    ElementHighlight.prototype.highlight = function () {
        this.setState();
    };
    // 清理掉所有的 active， unactive 状态
    ElementHighlight.prototype.clear = function () {
        var view = this.context.view;
        highlight_util_1.clearHighlight(view);
    };
    return ElementHighlight;
}(state_1.default));
exports.default = ElementHighlight;

},{"../../../constant":237,"../util":353,"./highlight-util":330,"./state":344,"@antv/util":803,"tslib":385}],332:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_1 = require("../util");
var util_2 = require("@antv/util");
/**
 * Link Elements by color
 * @ignore
 */
var LinkByColor = /** @class */ (function (_super) {
    tslib_1.__extends(LinkByColor, _super);
    function LinkByColor() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.cache = {};
        return _this;
    }
    // 获取颜色对应的 scale
    LinkByColor.prototype.getColorScale = function (view, element) {
        var colorAttr = element.geometry.getAttribute('color');
        if (!colorAttr) {
            return null;
        }
        var scale = view.getScaleByField(colorAttr.getFields()[0]);
        return scale;
    };
    // 获取连接的 path
    LinkByColor.prototype.getLinkPath = function (element, nextElement) {
        var bbox = element.shape.getCanvasBBox();
        var nextBBox = nextElement.shape.getCanvasBBox();
        var path = [
            ['M', bbox.maxX, bbox.minY],
            ['L', nextBBox.minX, nextBBox.minY],
            ['L', nextBBox.minX, nextBBox.maxY],
            ['L', bbox.maxX, bbox.maxY],
            ['Z'],
        ];
        return path;
    };
    // 添加连接的图形
    LinkByColor.prototype.addLinkShape = function (group, element, nextElement) {
        group.addShape({
            type: 'path',
            attrs: {
                opacity: 0.4,
                fill: element.shape.attr('fill'),
                path: this.getLinkPath(element, nextElement),
            },
        });
    };
    // 使用图形连接
    LinkByColor.prototype.linkByElement = function (element) {
        var _this = this;
        var view = this.context.view;
        var scale = this.getColorScale(view, element);
        if (!scale) {
            return;
        }
        var value = util_1.getElementValue(element, scale.field);
        if (!this.cache[value]) {
            var elements_1 = util_1.getElementsByField(view, scale.field, value);
            var linkGroup = this.linkGroup;
            var group_1 = linkGroup.addGroup();
            this.cache[value] = group_1; // 缓存
            var count_1 = elements_1.length;
            util_2.each(elements_1, function (el, index) {
                if (index < count_1 - 1) {
                    var nextEl = elements_1[index + 1];
                    _this.addLinkShape(group_1, el, nextEl);
                }
            });
        }
    };
    // 移除连接
    LinkByColor.prototype.removeLink = function (element) {
        var scale = this.getColorScale(this.context.view, element);
        if (!scale) {
            return;
        }
        var value = util_1.getElementValue(element, scale.field);
        if (this.cache[value]) {
            this.cache[value].remove();
            this.cache[value] = null;
        }
    };
    /**
     * 连接 elements
     */
    LinkByColor.prototype.link = function () {
        var context = this.context;
        if (!this.linkGroup) {
            // 不允许被拾取
            this.linkGroup = context.view.foregroundGroup.addGroup({
                capture: false,
            });
        }
        var element = util_1.getCurrentElement(context);
        if (element) {
            this.linkByElement(element);
        }
    };
    /**
     * 取消连接 elements
     */
    LinkByColor.prototype.unlink = function () {
        var element = util_1.getCurrentElement(this.context);
        if (element) {
            this.removeLink(element);
        }
    };
    /**
     * 清除所有连接
     */
    LinkByColor.prototype.clear = function () {
        if (this.linkGroup) {
            this.linkGroup.clear();
        }
    };
    /**
     * 销毁
     */
    LinkByColor.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        if (this.linkGroup) {
            this.linkGroup.remove();
        }
    };
    return LinkByColor;
}(base_1.default));
exports.default = LinkByColor;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],333:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var range_state_1 = tslib_1.__importDefault(require("./range-state"));
/**
 * @ignore
 * 图表元素区域 Active 的 Action
 */
var ElementRangeActive = /** @class */ (function (_super) {
    tslib_1.__extends(ElementRangeActive, _super);
    function ElementRangeActive() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    /**
     * 图表元素 Active
     */
    ElementRangeActive.prototype.active = function () {
        this.setState();
    };
    return ElementRangeActive;
}(range_state_1.default));
exports.default = ElementRangeActive;

},{"./range-state":336,"tslib":385}],334:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var highlight_util_1 = require("./highlight-util");
var range_state_1 = tslib_1.__importDefault(require("./range-state"));
/**
 * @ignore
 * 区域 highlight 的 Action
 */
var ElementRangeHighlight = /** @class */ (function (_super) {
    tslib_1.__extends(ElementRangeHighlight, _super);
    function ElementRangeHighlight() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    // 清理掉所有的 active， unactive 状态
    ElementRangeHighlight.prototype.clearViewState = function (view) {
        highlight_util_1.clearHighlight(view);
    };
    /**
     * 设置 highlight
     */
    ElementRangeHighlight.prototype.highlight = function () {
        this.setState();
    };
    ElementRangeHighlight.prototype.setElementsState = function (elements, enable, allElements) {
        highlight_util_1.setHighlightBy(allElements, function (el) { return elements.indexOf(el) >= 0; }, enable);
    };
    return ElementRangeHighlight;
}(range_state_1.default));
exports.default = ElementRangeHighlight;

},{"./highlight-util":330,"./range-state":336,"tslib":385}],335:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var range_state_1 = tslib_1.__importDefault(require("./range-state"));
/**
 * @ignore
 * 区域选中的 Action
 */
var ElementRangeSelected = /** @class */ (function (_super) {
    tslib_1.__extends(ElementRangeSelected, _super);
    function ElementRangeSelected() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'selected';
        return _this;
    }
    /**
     * 选中
     */
    ElementRangeSelected.prototype.selected = function () {
        this.setState();
    };
    return ElementRangeSelected;
}(range_state_1.default));
exports.default = ElementRangeSelected;

},{"./range-state":336,"tslib":385}],336:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var util_2 = require("../util");
var state_base_1 = tslib_1.__importDefault(require("./state-base"));
/**
 * @ignore
 * 区域设置状态的基础 Action
 */
var ElementRangeState = /** @class */ (function (_super) {
    tslib_1.__extends(ElementRangeState, _super);
    function ElementRangeState() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.startPoint = null;
        _this.endPoint = null;
        _this.isStarted = false;
        /**
         * 是否作用于当前 view 的 siblings，默认是 false 仅作用于自己
         */
        _this.effectSiblings = false;
        /**
         * 是否受 element 的数据影响，还是受包围盒的影响
         */
        _this.effectByRecord = false;
        return _this;
    }
    // 获取当前的位置
    ElementRangeState.prototype.getCurrentPoint = function () {
        var event = this.context.event;
        return {
            x: event.x,
            y: event.y,
        };
    };
    /**
     * 开始，记录开始选中的位置
     */
    ElementRangeState.prototype.start = function () {
        this.clear(); // 开始的时候清理之前的状态
        this.startPoint = this.getCurrentPoint();
        this.isStarted = true;
    };
    ElementRangeState.prototype.getIntersectElements = function () {
        var elements = null;
        if (util_2.isMask(this.context)) {
            elements = util_2.getMaskedElements(this.context, 10);
        }
        else {
            var startPoint = this.startPoint;
            var endPoint = this.isStarted ? this.getCurrentPoint() : this.endPoint;
            // 如果没有开始，则不允许范围设置状态，保护性质
            if (!startPoint || !endPoint) {
                return;
            }
            // 计算框选区域
            var box = {
                minX: Math.min(startPoint.x, endPoint.x),
                minY: Math.min(startPoint.y, endPoint.y),
                maxX: Math.max(startPoint.x, endPoint.x),
                maxY: Math.max(startPoint.y, endPoint.y),
            };
            // this.clear(); // 不全部清理，会导致闪烁
            var view = this.context.view;
            elements = util_2.getIntersectElements(view, box);
        }
        return elements;
    };
    /**
     * 选中
     */
    ElementRangeState.prototype.setStateEnable = function (enable) {
        if (this.effectSiblings && !this.effectByRecord) {
            this.setSiblingsState(enable);
        }
        else {
            var allElements = util_2.getElements(this.context.view);
            var elements = this.getIntersectElements();
            if (elements && elements.length) {
                if (this.effectByRecord) {
                    this.setSiblingsStateByRecord(elements, enable);
                }
                else {
                    this.setElementsState(elements, enable, allElements);
                }
            }
            else {
                this.clear();
            }
        }
    };
    // 根据选中的 element 的数据进行设置状态
    ElementRangeState.prototype.setSiblingsStateByRecord = function (elements, enable) {
        var _this = this;
        var view = this.context.view;
        var siblings = util_2.getSilbings(view);
        var records = elements.map(function (el) {
            return el.getModel().data;
        });
        var xFiled = view.getXScale().field;
        var yField = view.getYScales()[0].field;
        util_1.each(siblings, function (sibling) {
            var allElements = util_2.getElements(sibling);
            var effectElements = allElements.filter(function (el) {
                var record = el.getModel().data;
                return util_2.isInRecords(records, record, xFiled, yField);
            });
            _this.setElementsState(effectElements, enable, allElements);
        });
    };
    // 设置兄弟 view 的状态
    ElementRangeState.prototype.setSiblingsState = function (enable) {
        var _this = this;
        var view = this.context.view;
        var siblings = util_2.getSilbings(view);
        if (util_2.isMask(this.context)) {
            // 受 mask 影响
            util_1.each(siblings, function (sibling) {
                var allElements = util_2.getElements(sibling);
                var effectElements = util_2.getSiblingMaskElements(_this.context, sibling, 10);
                if (effectElements && effectElements.length) {
                    _this.setElementsState(effectElements, enable, allElements);
                }
                else {
                    _this.clearViewState(sibling);
                }
            });
        }
    };
    ElementRangeState.prototype.setElementsState = function (elements, enable, allElements) {
        var _this = this;
        util_1.each(allElements, function (el) {
            if (!elements.includes(el)) {
                _this.setElementState(el, false);
            }
            else {
                _this.setElementState(el, enable);
            }
        });
    };
    /**
     * 结束
     */
    ElementRangeState.prototype.end = function () {
        this.isStarted = false;
        this.endPoint = this.getCurrentPoint();
    };
    // 复写 clear
    ElementRangeState.prototype.clear = function () {
        var _this = this;
        var view = this.context.view;
        // 判断是否影响 siblings
        if (this.effectSiblings) {
            var siblings = util_2.getSilbings(view);
            util_1.each(siblings, function (sibling) {
                _this.clearViewState(sibling);
            });
        }
        else {
            this.clearViewState(view);
        }
    };
    return ElementRangeState;
}(state_base_1.default));
exports.default = ElementRangeState;

},{"../util":353,"./state-base":343,"@antv/util":803,"tslib":385}],337:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var state_1 = tslib_1.__importDefault(require("./state"));
/**
 * @ignore
 * 允许多选的 Action
 * @class
 */
var ElementMultipleSelected = /** @class */ (function (_super) {
    tslib_1.__extends(ElementMultipleSelected, _super);
    function ElementMultipleSelected() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'selected';
        return _this;
    }
    /**
     * 选中节点，允许多选
     */
    ElementMultipleSelected.prototype.selected = function () {
        this.setState();
    };
    return ElementMultipleSelected;
}(state_1.default));
exports.default = ElementMultipleSelected;

},{"./state":344,"tslib":385}],338:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_2 = require("../util");
/**
 * Sibling filter
 * @ignore
 */
var SiblingFilter = /** @class */ (function (_super) {
    tslib_1.__extends(SiblingFilter, _super);
    function SiblingFilter() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.byRecord = false;
        return _this;
    }
    /**
     * 过滤隐藏图形
     */
    SiblingFilter.prototype.filter = function () {
        // 仅考虑 mask 导致的过滤
        if (util_2.isMask(this.context)) {
            if (this.byRecord) {
                this.filterByRecord();
            }
            else {
                this.filterByBBox();
            }
        }
    };
    // 根据框选的记录来做过滤
    SiblingFilter.prototype.filterByRecord = function () {
        var view = this.context.view;
        var maskElements = util_2.getMaskedElements(this.context, 10);
        if (!maskElements) {
            return;
        }
        var xFiled = view.getXScale().field;
        var yField = view.getYScales()[0].field;
        var records = maskElements.map(function (el) {
            return el.getModel().data;
        });
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            var elements = util_2.getElements(sibling);
            util_1.each(elements, function (el) {
                var record = el.getModel().data;
                // records.includes(record) 不生效，应该是数据的引用被改了
                if (util_2.isInRecords(records, record, xFiled, yField)) {
                    el.show();
                }
                else {
                    el.hide();
                }
            });
        });
    };
    // 根据被框选的包围盒做过滤
    SiblingFilter.prototype.filterByBBox = function () {
        var _this = this;
        var view = this.context.view;
        var siblings = util_2.getSilbings(view);
        util_1.each(siblings, function (sibling) {
            var maskElements = util_2.getSiblingMaskElements(_this.context, sibling, 10);
            var elements = util_2.getElements(sibling);
            if (maskElements) {
                // mask 过小时返回为 null，不能是空数组，否则同未框选到混淆
                util_1.each(elements, function (el) {
                    if (maskElements.includes(el)) {
                        el.show();
                    }
                    else {
                        el.hide();
                    }
                });
            }
        });
    };
    /**
     * 清理所有隐藏的图形
     */
    SiblingFilter.prototype.reset = function () {
        var siblings = util_2.getSilbings(this.context.view);
        util_1.each(siblings, function (sibling) {
            var elements = util_2.getElements(sibling);
            util_1.each(elements, function (el) {
                el.show();
            });
        });
    };
    return SiblingFilter;
}(base_1.default));
exports.default = SiblingFilter;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],339:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var single_state_1 = tslib_1.__importDefault(require("./single-state"));
/**
 * @ignore
 * 仅允许单个 Element Active 的 Action
 */
var ElementSingleActive = /** @class */ (function (_super) {
    tslib_1.__extends(ElementSingleActive, _super);
    function ElementSingleActive() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    /**
     * 当前事件相关的 Element Active
     */
    ElementSingleActive.prototype.active = function () {
        this.setState();
    };
    return ElementSingleActive;
}(single_state_1.default));
exports.default = ElementSingleActive;

},{"./single-state":342,"tslib":385}],340:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util");
var highlight_util_1 = require("./highlight-util");
var single_state_1 = tslib_1.__importDefault(require("./single-state"));
/**
 * @ignore
 * 单个 Element Highlight 的 Action
 */
var ElementSingleHighlight = /** @class */ (function (_super) {
    tslib_1.__extends(ElementSingleHighlight, _super);
    function ElementSingleHighlight() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'active';
        return _this;
    }
    /**
     * Element Highlight
     */
    ElementSingleHighlight.prototype.highlight = function () {
        this.setState();
    };
    ElementSingleHighlight.prototype.setElementState = function (element, enable) {
        var view = this.context.view;
        var elements = util_1.getElements(view);
        highlight_util_1.setHighlightBy(elements, function (el) { return element === el; }, enable);
    };
    // 清理掉所有的 active， unactive 状态
    ElementSingleHighlight.prototype.clear = function () {
        var view = this.context.view;
        highlight_util_1.clearHighlight(view);
    };
    return ElementSingleHighlight;
}(single_state_1.default));
exports.default = ElementSingleHighlight;

},{"../util":353,"./highlight-util":330,"./single-state":342,"tslib":385}],341:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var single_state_1 = tslib_1.__importDefault(require("./single-state"));
/**
 * @ignore
 * 单选的 Action
 */
var ElementSingleSelected = /** @class */ (function (_super) {
    tslib_1.__extends(ElementSingleSelected, _super);
    function ElementSingleSelected() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.stateName = 'selected';
        return _this;
    }
    /**
     * 选中
     */
    ElementSingleSelected.prototype.selected = function () {
        this.setState();
    };
    return ElementSingleSelected;
}(single_state_1.default));
exports.default = ElementSingleSelected;

},{"./single-state":342,"tslib":385}],342:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util");
var state_base_1 = tslib_1.__importDefault(require("./state-base"));
/**
 * 单状态量的 Action 基类
 * @class
 * @ignore
 */
var ElementSingleState = /** @class */ (function (_super) {
    tslib_1.__extends(ElementSingleState, _super);
    function ElementSingleState() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ElementSingleState.prototype.setStateEnable = function (enable) {
        var element = util_1.getCurrentElement(this.context);
        if (element) {
            // 在同一个 element 内部移动，忽视 label 和 shape 之间
            if (!util_1.isElementChange(this.context)) {
                return;
            }
            // 仅支持单个状态量的元素，只能由 element 触发
            if (enable) {
                this.clear();
                this.setElementState(element, true);
            }
            else if (this.hasState(element)) {
                this.setElementState(element, false);
            }
        }
    };
    /**
     * 切换选中，只允许选中一个
     */
    ElementSingleState.prototype.toggle = function () {
        var element = util_1.getCurrentElement(this.context);
        if (element) {
            var hasState = this.hasState(element); // 提前获取状态
            if (!hasState) {
                this.clear();
            }
            this.setElementState(element, !hasState);
        }
    };
    /**
     * 取消当前时间影响的状态
     */
    ElementSingleState.prototype.reset = function () {
        this.setStateEnable(false);
    };
    return ElementSingleState;
}(state_base_1.default));
exports.default = ElementSingleState;

},{"../util":353,"./state-base":343,"tslib":385}],343:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_2 = require("../util");
/**
 * 状态量 Action 的基类
 * @abstract
 * @class
 * @ignore
 */
var StateBase = /** @class */ (function (_super) {
    tslib_1.__extends(StateBase, _super);
    function StateBase() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * 状态名称
         */
        _this.stateName = '';
        return _this;
    }
    /**
     * 是否具有某个状态
     * @param element 图表 Element 元素
     */
    StateBase.prototype.hasState = function (element) {
        return element.hasState(this.stateName);
    };
    /**
     * 设置状态激活
     * @param enable 状态值
     */
    StateBase.prototype.setElementState = function (element, enable) {
        // 防止闪烁
        element.setState(this.stateName, enable);
    };
    /**
     * 设置状态
     */
    StateBase.prototype.setState = function () {
        this.setStateEnable(true);
    };
    /**
     * 清除所有 Element 的状态
     */
    StateBase.prototype.clear = function () {
        var view = this.context.view;
        this.clearViewState(view);
    };
    StateBase.prototype.clearViewState = function (view) {
        var _this = this;
        var elements = util_2.getElementsByState(view, this.stateName);
        util_1.each(elements, function (el) {
            _this.setElementState(el, false);
        });
    };
    return StateBase;
}(base_1.default));
exports.default = StateBase;

},{"../base":311,"../util":353,"@antv/util":803,"tslib":385}],344:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var util_2 = require("../util");
var state_base_1 = tslib_1.__importDefault(require("./state-base"));
function getItem(shape) {
    return util_1.get(shape.get('delegateObject'), 'item');
}
/**
 * 状态量 Action 的基类，允许多个 Element 同时拥有某个状态
 * @class
 * @ignore
 */
var ElementState = /** @class */ (function (_super) {
    tslib_1.__extends(ElementState, _super);
    function ElementState() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.ignoreListItemStates = ['unchecked'];
        return _this;
    }
    // 是否忽略触发的列表项
    ElementState.prototype.isItemIgnore = function (item, list) {
        var states = this.ignoreListItemStates;
        var filtered = states.filter(function (state) {
            return list.hasState(item, state);
        });
        return !!filtered.length;
    };
    // 设置由组件选项导致的状态变化
    ElementState.prototype.setStateByComponent = function (component, item, enable) {
        var view = this.context.view;
        var field = component.get('field');
        var elements = util_2.getElements(view);
        this.setElementsStateByItem(elements, field, item, enable);
    };
    // 处理触发源由 element 导致的状态变化
    ElementState.prototype.setStateByElement = function (element, enable) {
        this.setElementState(element, enable);
    };
    /** 组件的选项是否同 element 匹配 */
    ElementState.prototype.isMathItem = function (element, field, item) {
        var view = this.context.view;
        var scale = util_2.getScaleByField(view, field);
        var value = util_2.getElementValue(element, field);
        return !util_1.isNil(value) && item.name === scale.getText(value);
    };
    ElementState.prototype.setElementsStateByItem = function (elements, field, item, enable) {
        var _this = this;
        util_1.each(elements, function (el) {
            if (_this.isMathItem(el, field, item)) {
                el.setState(_this.stateName, enable);
            }
        });
    };
    /** 设置状态是否激活 */
    ElementState.prototype.setStateEnable = function (enable) {
        var element = util_2.getCurrentElement(this.context);
        if (element) {
            // 触发源由于 element 导致
            if (util_2.isElementChange(this.context)) {
                this.setStateByElement(element, enable);
            }
        }
        else {
            // 触发源由组件导致
            var delegateObject = util_2.getDelegationObject(this.context);
            // 如果触发源时列表，图例、坐标轴
            if (util_2.isList(delegateObject)) {
                var item = delegateObject.item, component = delegateObject.component;
                if (item && component && !this.isItemIgnore(item, component)) {
                    var event_1 = this.context.event.gEvent;
                    // 防止闪烁
                    if (event_1 && event_1.fromShape && event_1.toShape && getItem(event_1.fromShape) === getItem(event_1.toShape)) {
                        return;
                    }
                    this.setStateByComponent(component, item, enable);
                }
            }
        }
    };
    /**
     * 切换状态
     */
    ElementState.prototype.toggle = function () {
        var element = util_2.getCurrentElement(this.context);
        if (element) {
            var hasState = element.hasState(this.stateName);
            this.setElementState(element, !hasState);
        }
    };
    /**
     * 取消当前时间影响的状态
     */
    ElementState.prototype.reset = function () {
        this.setStateEnable(false);
    };
    return ElementState;
}(state_base_1.default));
exports.default = ElementState;

},{"../util":353,"./state-base":343,"@antv/util":803,"tslib":385}],345:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base"); // 导出 Action 基类
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return base_1.default; } });
var register_1 = require("./register");
Object.defineProperty(exports, "createAction", { enumerable: true, get: function () { return register_1.createAction; } });
Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return register_1.registerAction; } });
Object.defineProperty(exports, "getActionClass", { enumerable: true, get: function () { return register_1.getActionClass; } });

},{"./base":311,"./register":352}],346:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
/**
 * @ignore
 * 辅助框 Action 的基类
 */
var MaskBase = /** @class */ (function (_super) {
    tslib_1.__extends(MaskBase, _super);
    function MaskBase() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // mask 图形
        _this.maskShape = null;
        // 组成 mask 的各个点
        _this.points = [];
        // 开始 mask 的标记
        _this.starting = false;
        // 开始移动的标记
        _this.moving = false;
        _this.preMovePoint = null;
        _this.shapeType = 'path';
        return _this;
    }
    // 获取当前的位置
    MaskBase.prototype.getCurrentPoint = function () {
        var event = this.context.event;
        return {
            x: event.x,
            y: event.y,
        };
    };
    // 触发 mask 的事件
    MaskBase.prototype.emitEvent = function (type) {
        var eventName = "mask:" + type;
        var view = this.context.view;
        var event = this.context.event;
        view.emit(eventName, {
            target: this.maskShape,
            shape: this.maskShape,
            points: this.points,
            x: event.x,
            y: event.y,
        });
    };
    // 创建 mask
    MaskBase.prototype.createMask = function () {
        var view = this.context.view;
        var maskAttrs = this.getMaskAttrs();
        var maskShape = view.foregroundGroup.addShape({
            type: this.shapeType,
            name: 'mask',
            draggable: true,
            attrs: tslib_1.__assign({ fill: '#C5D4EB', opacity: 0.3 }, maskAttrs),
        });
        return maskShape;
    };
    // 生成 mask 的路径
    MaskBase.prototype.getMaskPath = function () {
        return [];
    };
    /**
     * 显示
     */
    MaskBase.prototype.show = function () {
        if (this.maskShape) {
            this.maskShape.show();
            this.emitEvent('show');
        }
    };
    /**
     * 开始
     */
    MaskBase.prototype.start = function () {
        this.starting = true;
        // 开始时，保证移动结束
        this.moving = false;
        this.points = [this.getCurrentPoint()];
        if (!this.maskShape) {
            this.maskShape = this.createMask();
            // 开始时设置 capture: false，可以避免创建、resize 时触发事件
            this.maskShape.set('capture', false);
        }
        this.updateMask();
        this.emitEvent('start');
    };
    /**
     * 开始移动
     */
    MaskBase.prototype.moveStart = function () {
        this.moving = true;
        this.preMovePoint = this.getCurrentPoint();
    };
    /**
     * 移动 mask
     */
    MaskBase.prototype.move = function () {
        if (!this.moving || !this.maskShape) {
            return;
        }
        var currentPoint = this.getCurrentPoint();
        var preMovePoint = this.preMovePoint;
        var dx = currentPoint.x - preMovePoint.x;
        var dy = currentPoint.y - preMovePoint.y;
        var points = this.points;
        util_1.each(points, function (point) {
            point.x += dx;
            point.y += dy;
        });
        this.updateMask();
        this.emitEvent('change');
        this.preMovePoint = currentPoint;
    };
    MaskBase.prototype.updateMask = function () {
        var attrs = this.getMaskAttrs();
        this.maskShape.attr(attrs);
    };
    /**
     * 结束移动
     */
    MaskBase.prototype.moveEnd = function () {
        this.moving = false;
        this.preMovePoint = null;
    };
    /**
     * 结束
     */
    MaskBase.prototype.end = function () {
        this.starting = false;
        this.emitEvent('end');
        if (this.maskShape) {
            this.maskShape.set('capture', true);
        }
    };
    /**
     * 隐藏
     */
    MaskBase.prototype.hide = function () {
        if (this.maskShape) {
            this.maskShape.hide();
            this.emitEvent('hide');
        }
    };
    /**
     * 大小变化
     */
    MaskBase.prototype.resize = function () {
        // 只有进行中，才会允许大小变化
        if (this.starting && this.maskShape) {
            this.points.push(this.getCurrentPoint());
            this.updateMask();
            this.emitEvent('change');
        }
    };
    /**
     * 销毁
     */
    MaskBase.prototype.destroy = function () {
        this.points = [];
        if (this.maskShape) {
            this.maskShape.remove();
        }
        this.maskShape = null;
        this.preMovePoint = null;
        _super.prototype.destroy.call(this);
    };
    return MaskBase;
}(base_1.default));
exports.default = MaskBase;

},{"../base":311,"@antv/util":803,"tslib":385}],347:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var util_2 = require("../util");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * @ignore
 * 圆形辅助框 Action
 */
var CircleMask = /** @class */ (function (_super) {
    tslib_1.__extends(CircleMask, _super);
    function CircleMask() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.shapeType = 'circle';
        return _this;
    }
    CircleMask.prototype.getMaskAttrs = function () {
        var points = this.points;
        var currentPoint = util_1.last(this.points);
        var r = 0;
        var x = 0;
        var y = 0;
        if (points.length) {
            var first = points[0];
            r = util_2.distance(first, currentPoint) / 2;
            x = (currentPoint.x + first.x) / 2;
            y = (currentPoint.y + first.y) / 2;
        }
        return {
            x: x,
            y: y,
            r: r,
        };
    };
    return CircleMask;
}(base_1.default));
exports.default = CircleMask;

},{"../util":353,"./base":346,"@antv/util":803,"tslib":385}],348:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var rect_1 = tslib_1.__importDefault(require("./rect"));
function clampPoint(point) {
    point.x = util_1.clamp(point.x, 0, 1);
    point.y = util_1.clamp(point.y, 0, 1);
}
/**
 * @ignore
 */
var DimRect = /** @class */ (function (_super) {
    tslib_1.__extends(DimRect, _super);
    function DimRect() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.dim = 'x';
        _this.inPlot = true;
        return _this;
    }
    DimRect.prototype.getRegion = function () {
        var start = null;
        var end = null;
        var points = this.points;
        var dim = this.dim;
        var coord = this.context.view.getCoordinate();
        var normalStart = coord.invert(util_1.head(points));
        var normalEnd = coord.invert(util_1.last(points));
        if (this.inPlot) {
            // 约束到 0 - 1 范围内
            clampPoint(normalStart);
            clampPoint(normalEnd);
        }
        if (dim === 'x') {
            // x 轴方向扩展, y 轴方向占满全部
            start = coord.convert({
                x: normalStart.x,
                y: 0,
            });
            end = coord.convert({
                x: normalEnd.x,
                y: 1,
            });
        }
        else {
            // y 轴方向扩展, x 轴方向占满全部
            start = coord.convert({
                x: 0,
                y: normalStart.y,
            });
            end = coord.convert({
                x: 1,
                y: normalEnd.y,
            });
        }
        return {
            start: start,
            end: end,
        };
    };
    return DimRect;
}(rect_1.default));
exports.default = DimRect;

},{"./rect":350,"@antv/util":803,"tslib":385}],349:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * @ignore
 * 多个点构成的 Path 辅助框 Action
 */
var PathMask = /** @class */ (function (_super) {
    tslib_1.__extends(PathMask, _super);
    function PathMask() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // 生成 mask 的路径
    PathMask.prototype.getMaskPath = function () {
        var points = this.points;
        var path = [];
        if (points.length) {
            util_1.each(points, function (point, index) {
                if (index === 0) {
                    path.push(['M', point.x, point.y]);
                }
                else {
                    path.push(['L', point.x, point.y]);
                }
            });
            path.push(['L', points[0].x, points[0].y]);
        }
        return path;
    };
    PathMask.prototype.getMaskAttrs = function () {
        return {
            path: this.getMaskPath(),
        };
    };
    /**
     * 添加一个点
     */
    PathMask.prototype.addPoint = function () {
        this.resize();
    };
    return PathMask;
}(base_1.default));
exports.default = PathMask;

},{"./base":346,"@antv/util":803,"tslib":385}],350:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
/**
 * @ignore
 * 矩形的辅助框 Action
 */
var RectMask = /** @class */ (function (_super) {
    tslib_1.__extends(RectMask, _super);
    function RectMask() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.shapeType = 'rect';
        return _this;
    }
    RectMask.prototype.getRegion = function () {
        var points = this.points;
        return {
            start: util_1.head(points),
            end: util_1.last(points),
        };
    };
    // 添加图形
    RectMask.prototype.getMaskAttrs = function () {
        var _a = this.getRegion(), start = _a.start, end = _a.end;
        var x = Math.min(start.x, end.x);
        var y = Math.min(start.y, end.y);
        var width = Math.abs(end.x - start.x);
        var height = Math.abs(end.y - start.y);
        return {
            x: x,
            y: y,
            width: width,
            height: height,
        };
    };
    return RectMask;
}(base_1.default));
exports.default = RectMask;

},{"./base":346,"@antv/util":803,"tslib":385}],351:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("../util");
var path_1 = tslib_1.__importDefault(require("./path"));
/**
 * Smooth path mask
 * @ignore
 */
var SmoothPathMask = /** @class */ (function (_super) {
    tslib_1.__extends(SmoothPathMask, _super);
    function SmoothPathMask() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // 生成 mask 的路径
    SmoothPathMask.prototype.getMaskPath = function () {
        var points = this.points;
        return util_1.getSpline(points, true);
    };
    return SmoothPathMask;
}(path_1.default));
exports.default = SmoothPathMask;

},{"../util":353,"./path":349,"tslib":385}],352:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCallbackAction = exports.unregisterAction = exports.registerAction = exports.getActionClass = exports.createAction = void 0;
var tslib_1 = require("tslib");
var callback_1 = tslib_1.__importDefault(require("./callback"));
var util_1 = require("@antv/util");
// Action 类的缓存
var ActionCache = {};
/**
 * 根据名称获取 Action 实例
 * @param actionName - action 的名称
 * @param context 上下文
 * @returns Action 实例
 */
function createAction(actionName, context) {
    var actionOption = ActionCache[actionName];
    var action = null;
    if (actionOption) {
        var ActionClass = actionOption.ActionClass, cfg = actionOption.cfg;
        action = new ActionClass(context, cfg);
        action.name = actionName;
        action.init();
    }
    return action;
}
exports.createAction = createAction;
/**
 * 根据 action 的 name 获取定义的类
 * @param actionName action 的 name
 */
function getActionClass(actionName) {
    var actionOption = ActionCache[actionName];
    return util_1.get(actionOption, 'ActionClass');
}
exports.getActionClass = getActionClass;
/**
 * 注册 Action
 * @param actionName - action 的名称
 * @param ActionClass - 继承自 action 的类
 */
function registerAction(actionName, ActionClass, cfg) {
    ActionCache[actionName] = {
        ActionClass: ActionClass,
        cfg: cfg,
    };
}
exports.registerAction = registerAction;
/**
 * 取消注册 Action
 * @param actionName action 名称
 */
function unregisterAction(actionName) {
    delete ActionCache[actionName];
}
exports.unregisterAction = unregisterAction;
/**
 * 根据回调函数获取 Action 实例
 * @param callback - action 的回调函数
 * @param context 上下文
 * @returns Action 实例
 */
function createCallbackAction(callback, context) {
    var action = new callback_1.default(context);
    action.callback = callback;
    action.name = 'callback';
    return action;
}
exports.createCallbackAction = createCallbackAction;

},{"./callback":312,"@antv/util":803,"tslib":385}],353:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getScaleByField = exports.isInRecords = exports.getSiblingPoint = exports.getSilbings = exports.isInBox = exports.getSpline = exports.distance = exports.getComponents = exports.getElementsByPath = exports.getIntersectElements = exports.intersectRect = exports.getElementValue = exports.getElementsByState = exports.getElementsByField = exports.getElements = exports.getSiblingMaskElements = exports.getMaskedElements = exports.isMask = exports.isSlider = exports.isList = exports.isElementChange = exports.getDelegationObject = exports.getCurrentElement = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var path_1 = require("../../geometry/shape/util/path");
var bbox_1 = require("../../util/bbox");
var is_polygons_intersect_1 = tslib_1.__importDefault(require("@antv/path-util/lib/is-polygons-intersect"));
function getMaskBBox(context, tolerance) {
    var event = context.event;
    var maskShape = event.target;
    var maskBBox = maskShape.getCanvasBBox();
    // 如果 bbox 过小则不返回
    if (!(maskBBox.width >= tolerance || maskBBox.height >= tolerance)) {
        return null;
    }
    return maskBBox;
}
function getMaskPath(context, tolerance) {
    var event = context.event;
    var maskShape = event.target;
    var maskBBox = maskShape.getCanvasBBox();
    // 如果 bbox 过小则不返回
    if (!(maskBBox.width >= tolerance || maskBBox.height >= tolerance)) {
        return null;
    }
    return maskShape.attr('path');
}
/**
 * 获取当前事件相关的图表元素
 * @param context 交互的上下文
 * @ignore
 */
function getCurrentElement(context) {
    var event = context.event;
    var element;
    var target = event.target;
    if (target) {
        element = target.get('element');
    }
    return element;
}
exports.getCurrentElement = getCurrentElement;
/**
 * 获取委托对象
 * @param context 上下文
 * @ignore
 */
function getDelegationObject(context) {
    var event = context.event;
    var target = event.target;
    var delegateObject;
    if (target) {
        delegateObject = target.get('delegateObject');
    }
    return delegateObject;
}
exports.getDelegationObject = getDelegationObject;
function isElementChange(context) {
    var event = context.event.gEvent;
    // 在同一个 element 内部移动，label 和 shape 之间
    if (event && event.fromShape && event.toShape && event.fromShape.get('element') === event.toShape.get('element')) {
        return false;
    }
    return true;
}
exports.isElementChange = isElementChange;
/**
 * 是否是列表组件
 * @param delegateObject 委托对象
 * @ignore
 */
function isList(delegateObject) {
    return delegateObject && delegateObject.component && delegateObject.component.isList();
}
exports.isList = isList;
/**
 * 是否是滑块组件
 * @param delegateObject 委托对象
 * @ignore
 */
function isSlider(delegateObject) {
    return delegateObject && delegateObject.component && delegateObject.component.isSlider();
}
exports.isSlider = isSlider;
/**
 * 是否由 mask 触发
 * @param context 上下文
 * @ignore
 */
function isMask(context) {
    var event = context.event;
    var target = event.target;
    return target && target.get('name') === 'mask';
}
exports.isMask = isMask;
/**
 * 获取被遮挡的 elements
 * @param context 上下文
 * @ignore
 */
function getMaskedElements(context, tolerance) {
    var target = context.event.target;
    if (target.get('type') === 'path') {
        var maskPath = getMaskPath(context, tolerance);
        if (!maskPath) {
            return;
        }
        return getElementsByPath(context.view, maskPath);
    }
    var maskBBox = getMaskBBox(context, tolerance);
    // 如果 bbox 过小则不返回
    if (!maskBBox) {
        return null;
    }
    return getIntersectElements(context.view, maskBBox);
}
exports.getMaskedElements = getMaskedElements;
/**
 * @ignore
 */
function getSiblingMaskElements(context, sibling, tolerance) {
    var maskBBox = getMaskBBox(context, tolerance);
    // 如果 bbox 过小则不返回
    if (!maskBBox) {
        return null;
    }
    var view = context.view;
    var start = getSiblingPoint(view, sibling, { x: maskBBox.x, y: maskBBox.y });
    var end = getSiblingPoint(view, sibling, { x: maskBBox.maxX, y: maskBBox.maxY });
    var box = {
        minX: start.x,
        minY: start.y,
        maxX: end.x,
        maxY: end.y,
    };
    return getIntersectElements(sibling, box);
}
exports.getSiblingMaskElements = getSiblingMaskElements;
/**
 * 获取所有的图表元素
 * @param view View/Chart
 * @ignore
 */
function getElements(view) {
    var geometries = view.geometries;
    var rst = [];
    util_1.each(geometries, function (geom) {
        var elements = geom.elements;
        rst = rst.concat(elements);
    });
    if (view.views && view.views.length) {
        util_1.each(view.views, function (subView) {
            rst = rst.concat(getElements(subView));
        });
    }
    return rst;
}
exports.getElements = getElements;
/**
 * 获取所有的图表元素
 * @param view View/Chart
 * @param field 字段名
 * @param value 字段值
 * @ignore
 */
function getElementsByField(view, field, value) {
    var elements = getElements(view);
    return elements.filter(function (el) {
        return getElementValue(el, field) === value;
    });
}
exports.getElementsByField = getElementsByField;
/**
 * 根据状态名获取图表元素
 * @param view View/Chart
 * @param stateName 状态名
 * @ignore
 */
function getElementsByState(view, stateName) {
    var geometries = view.geometries;
    var rst = [];
    util_1.each(geometries, function (geom) {
        var elements = geom.getElementsBy(function (el) { return el.hasState(stateName); });
        rst = rst.concat(elements);
    });
    return rst;
}
exports.getElementsByState = getElementsByState;
/**
 * 获取图表元素对应字段的值
 * @param element 图表元素
 * @param field 字段名
 * @ignore
 */
function getElementValue(element, field) {
    var model = element.getModel();
    var record = model.data;
    var value;
    if (util_1.isArray(record)) {
        value = record[0][field];
    }
    else {
        value = record[field];
    }
    return value;
}
exports.getElementValue = getElementValue;
/**
 * 两个包围盒是否相交
 * @param box1 包围盒1
 * @param box2 包围盒2
 * @ignore
 */
function intersectRect(box1, box2) {
    return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
exports.intersectRect = intersectRect;
/**
 * 获取包围盒内的图表元素
 * @param view View/Chart
 * @param box 包围盒
 * @ignore
 */
function getIntersectElements(view, box) {
    var elements = getElements(view);
    var rst = [];
    util_1.each(elements, function (el) {
        var shape = el.shape;
        var shapeBBox = shape.getCanvasBBox();
        if (intersectRect(box, shapeBBox)) {
            rst.push(el);
        }
    });
    return rst;
}
exports.getIntersectElements = getIntersectElements;
function pathToPoints(path) {
    var points = [];
    util_1.each(path, function (seg) {
        var command = seg[0];
        if (command !== 'A') {
            for (var i = 1; i < seg.length; i = i + 2) {
                points.push([seg[i], seg[i + 1]]);
            }
        }
        else {
            var length_1 = seg.length;
            points.push([seg[length_1 - 2], seg[length_1 - 1]]);
        }
    });
    return points;
}
/**
 * 获取包围盒内的图表元素
 * @param view View/Chart
 * @param path 路径
 * @ignore
 */
function getElementsByPath(view, path) {
    var elements = getElements(view);
    var points = pathToPoints(path);
    var rst = elements.filter(function (el) {
        var shape = el.shape;
        var shapePoints;
        if (shape.get('type') === 'path') {
            shapePoints = pathToPoints(shape.attr('path'));
        }
        else {
            var shapeBBox = shape.getCanvasBBox();
            shapePoints = bbox_1.toPoints(shapeBBox);
        }
        return is_polygons_intersect_1.default(points, shapePoints);
    });
    return rst;
}
exports.getElementsByPath = getElementsByPath;
/**
 * 获取当前 View 的所有组件
 * @param view View/Chart
 * @ignore
 */
function getComponents(view) {
    return view.getComponents().map(function (co) { return co.component; });
}
exports.getComponents = getComponents;
/** @ignore */
function distance(p1, p2) {
    var dx = p2.x - p1.x;
    var dy = p2.y - p1.y;
    return Math.sqrt(dx * dx + dy * dy);
}
exports.distance = distance;
/** @ignore */
function getSpline(points, z) {
    if (points.length <= 2) {
        return path_1.getLinePath(points, false);
    }
    var first = points[0];
    var arr = [];
    util_1.each(points, function (point) {
        arr.push(point.x);
        arr.push(point.y);
    });
    var path = path_1.catmullRom2bezier(arr, z, null);
    path.unshift(['M', first.x, first.y]);
    return path;
}
exports.getSpline = getSpline;
/**
 * 检测点是否在包围盒内
 * @param box 包围盒
 * @param point 点
 * @ignore
 */
function isInBox(box, point) {
    return box.x <= point.x && box.maxX >= point.x && box.y <= point.y && box.maxY > point.y;
}
exports.isInBox = isInBox;
/**
 * 获取同 view 同一级的 views
 * @param view 当前 view
 * @returns 同一级的 views
 * @ignore
 */
function getSilbings(view) {
    var parent = view.parent;
    var siblings = null;
    if (parent) {
        siblings = parent.views.filter(function (sub) { return sub !== view; });
    }
    return siblings;
}
exports.getSilbings = getSilbings;
function point2Normalize(view, point) {
    var coord = view.getCoordinate();
    return coord.invert(point);
}
/**
 * 将 view 上的一点转换成另一个 view 的点
 * @param view 当前的 view
 * @param sibling 同一层级的 view
 * @param point 指定点
 * @ignore
 */
function getSiblingPoint(view, sibling, point) {
    var normalPoint = point2Normalize(view, point);
    return sibling.getCoordinate().convert(normalPoint);
}
exports.getSiblingPoint = getSiblingPoint;
/**
 * 是否在记录中，临时因为所有的 view 中的数据不是引用，而使用的方法
 * 不同 view 上对数据的引用不相等，导致无法直接用 includes
 * 假设 x, y 值相等时是同一条数据，这个假设不完全正确，而改成 isEqual 则成本太高
 * 后面改成同一个引用时可以修改回来
 * @param records
 * @param record
 * @param xFiled
 * @param yField
 * @returns
 * @ignore
 */
function isInRecords(records, record, xFiled, yField) {
    var isIn = false;
    util_1.each(records, function (r) {
        if (r[xFiled] === record[xFiled] && r[yField] === record[yField]) {
            isIn = true;
            return false;
        }
    });
    return isIn;
}
exports.isInRecords = isInRecords;
// 级联获取 field 对应的 scale，如果 view 上没有，遍历子 view
function getScaleByField(view, field) {
    var scale = view.getScaleByField(field);
    if (!scale && view.views) {
        util_1.each(view.views, function (subView) {
            scale = getScaleByField(subView, field);
            if (scale) {
                return false; // 终止循环
            }
        });
    }
    return scale;
}
exports.getScaleByField = getScaleByField;

},{"../../geometry/shape/util/path":303,"../../util/bbox":370,"@antv/path-util/lib/is-polygons-intersect":725,"@antv/util":803,"tslib":385}],354:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var padding_1 = require("../../../util/padding");
var base_1 = tslib_1.__importDefault(require("../base"));
var PADDING_RIGHT = 10;
var PADDING_TOP = 5;
/**
 * Button action
 * @ignore
 */
var ButtonAction = /** @class */ (function (_super) {
    tslib_1.__extends(ButtonAction, _super);
    function ButtonAction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.buttonGroup = null;
        _this.buttonCfg = {
            name: 'button',
            text: 'button',
            textStyle: {
                x: 0,
                y: 0,
                fontSize: 12,
                fill: '#333333',
                cursor: 'pointer',
            },
            padding: [8, 10],
            style: {
                fill: '#f7f7f7',
                stroke: '#cccccc',
                cursor: 'pointer',
            },
            activeStyle: {
                fill: '#e6e6e6',
            },
        };
        return _this;
    }
    // mix 默认的配置和用户配置
    ButtonAction.prototype.getButtonCfg = function () {
        return util_1.deepMix(this.buttonCfg, this.cfg);
    };
    // 绘制 Button 和 文本
    ButtonAction.prototype.drawButton = function () {
        var config = this.getButtonCfg();
        var group = this.context.view.foregroundGroup.addGroup({
            name: config.name,
        });
        // 添加文本
        var textShape = group.addShape({
            type: 'text',
            name: 'button-text',
            attrs: tslib_1.__assign({ text: config.text }, config.textStyle),
        });
        var textBBox = textShape.getBBox();
        var padding = padding_1.parsePadding(config.padding);
        // 添加背景按钮
        var buttonShape = group.addShape({
            type: 'rect',
            name: 'button-rect',
            attrs: tslib_1.__assign({ x: textBBox.x - padding[3], y: textBBox.y - padding[0], width: textBBox.width + padding[1] + padding[3], height: textBBox.height + padding[0] + padding[2] }, config.style),
        });
        buttonShape.toBack(); // 在后面
        // active 效果内置
        group.on('mouseenter', function () {
            buttonShape.attr(config.activeStyle);
        });
        group.on('mouseleave', function () {
            buttonShape.attr(config.style);
        });
        this.buttonGroup = group;
    };
    // 重置位置
    ButtonAction.prototype.resetPosition = function () {
        var view = this.context.view;
        var coord = view.getCoordinate();
        var point = coord.convert({ x: 1, y: 1 }); // 后面直接改成左上角
        var buttonGroup = this.buttonGroup;
        var bbox = buttonGroup.getBBox();
        var matrix = matrix_util_1.ext.transform(null, [
            ['t', point.x - bbox.width - PADDING_RIGHT, point.y + bbox.height + PADDING_TOP],
        ]);
        buttonGroup.setMatrix(matrix);
    };
    /**
     * 显示
     */
    ButtonAction.prototype.show = function () {
        if (!this.buttonGroup) {
            this.drawButton();
        }
        this.resetPosition();
        this.buttonGroup.show();
    };
    /**
     * 隐藏
     */
    ButtonAction.prototype.hide = function () {
        if (this.buttonGroup) {
            this.buttonGroup.hide();
        }
    };
    /**
     * 销毁
     */
    ButtonAction.prototype.destroy = function () {
        var buttonGroup = this.buttonGroup;
        if (buttonGroup) {
            buttonGroup.remove();
        }
        _super.prototype.destroy.call(this);
    };
    return ButtonAction;
}(base_1.default));
exports.default = ButtonAction;

},{"../../../util/padding":380,"../base":311,"@antv/matrix-util":717,"@antv/util":803,"tslib":385}],355:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("../base"));
var util_1 = require("../util");
var DISTANCE = 4; // 移动的最小距离
/**
 * @ignore
 * View 支持 Drag 的 Action
 */
var Drag = /** @class */ (function (_super) {
    tslib_1.__extends(Drag, _super);
    function Drag() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // Action 开始，不等同于 拖拽开始，需要判定移动的范围
        _this.starting = false;
        // 拖拽开始
        _this.dragStart = false;
        return _this;
    }
    /**
     * 开始
     */
    Drag.prototype.start = function () {
        this.starting = true;
        this.startPoint = this.context.getCurrentPoint();
    };
    /**
     * 拖拽
     */
    Drag.prototype.drag = function () {
        if (!this.startPoint) {
            return;
        }
        var current = this.context.getCurrentPoint();
        var view = this.context.view;
        var event = this.context.event;
        if (!this.dragStart) {
            if (util_1.distance(current, this.startPoint) > DISTANCE) {
                view.emit('dragstart', {
                    target: event.target,
                    x: event.x,
                    y: event.y,
                });
                this.dragStart = true;
            }
        }
        else {
            view.emit('drag', {
                target: event.target,
                x: event.x,
                y: event.y,
            });
        }
    };
    /**
     * 结束
     */
    Drag.prototype.end = function () {
        if (this.dragStart) {
            var view = this.context.view;
            var event_1 = this.context.event;
            view.emit('dragend', {
                target: event_1.target,
                x: event_1.x,
                y: event_1.y,
            });
        }
        this.starting = false;
        this.dragStart = false;
    };
    return Drag;
}(base_1.default));
exports.default = Drag;

},{"../base":311,"../util":353,"tslib":385}],356:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var __1 = require("..");
var util_1 = require("../util");
var MIN_DISTANCE = 5;
/**
 * @ignore
 * View 移动的 Action
 */
var Move = /** @class */ (function (_super) {
    tslib_1.__extends(Move, _super);
    function Move() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.starting = false;
        _this.isMoving = false;
        // private cacheRange = null;
        _this.startPoint = null;
        _this.startMatrix = null;
        return _this;
    }
    /**
     * 开始移动
     */
    Move.prototype.start = function () {
        this.starting = true;
        this.startPoint = this.context.getCurrentPoint();
        // 缓存开始时的矩阵，防止反复拖拽
        this.startMatrix = this.context.view.middleGroup.getMatrix();
    };
    /**
     * 移动
     */
    Move.prototype.move = function () {
        if (!this.starting) {
            return;
        }
        var startPoint = this.startPoint;
        var currentPoint = this.context.getCurrentPoint();
        var d = util_1.distance(startPoint, currentPoint);
        if (d > MIN_DISTANCE && !this.isMoving) {
            this.isMoving = true;
        }
        if (this.isMoving) {
            var view = this.context.view;
            var matrix = matrix_util_1.ext.transform(this.startMatrix, [
                ['t', currentPoint.x - startPoint.x, currentPoint.y - startPoint.y],
            ]);
            view.backgroundGroup.setMatrix(matrix);
            view.foregroundGroup.setMatrix(matrix);
            view.middleGroup.setMatrix(matrix);
        }
    };
    /**
     * 结束移动
     */
    Move.prototype.end = function () {
        if (this.isMoving) {
            this.isMoving = false;
        }
        this.startMatrix = null;
        this.starting = false;
        this.startPoint = null;
    };
    /**
     * 回滚
     */
    Move.prototype.reset = function () {
        this.starting = false;
        this.startPoint = null;
        this.isMoving = false;
        var view = this.context.view;
        view.backgroundGroup.resetMatrix();
        view.foregroundGroup.resetMatrix();
        view.middleGroup.resetMatrix();
        this.isMoving = false;
    };
    return Move;
}(__1.Action));
exports.default = Move;

},{"..":345,"../util":353,"@antv/matrix-util":717,"tslib":385}],357:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var __1 = require("..");
var DIM_X = 'x';
var DIM_Y = 'y';
/**
 * Scale translate
 * @ignore
 */
var ScaleTranslate = /** @class */ (function (_super) {
    tslib_1.__extends(ScaleTranslate, _super);
    function ScaleTranslate() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.dims = [DIM_X, DIM_Y];
        _this.cfgFields = ['dims'];
        _this.cacheScaleDefs = {};
        return _this;
    }
    // 是否支持对应字段的平移
    ScaleTranslate.prototype.hasDim = function (dim) {
        return this.dims.includes(dim);
    };
    ScaleTranslate.prototype.getScale = function (dim) {
        var view = this.context.view;
        if (dim === 'x') {
            return view.getXScale();
        }
        else {
            return view.getYScales()[0];
        }
    };
    ScaleTranslate.prototype.resetDim = function (dim) {
        var view = this.context.view;
        if (this.hasDim(dim) && this.cacheScaleDefs[dim]) {
            var scale = this.getScale(dim);
            view.scale(scale.field, this.cacheScaleDefs[dim]);
            this.cacheScaleDefs[dim] = null;
        }
    };
    /**
     * 回滚
     */
    ScaleTranslate.prototype.reset = function () {
        this.resetDim(DIM_X);
        this.resetDim(DIM_Y);
        var view = this.context.view;
        view.render(true);
    };
    return ScaleTranslate;
}(__1.Action));
exports.default = ScaleTranslate;

},{"..":345,"tslib":385}],358:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var scale_transform_1 = tslib_1.__importDefault(require("./scale-transform"));
/**
 * 拖拽 Scale 的 Action
 * @ignore
 */
var ScaleTranslate = /** @class */ (function (_super) {
    tslib_1.__extends(ScaleTranslate, _super);
    function ScaleTranslate() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.startPoint = null;
        _this.starting = false;
        _this.startCache = {};
        return _this;
    }
    /**
     * 开始
     */
    ScaleTranslate.prototype.start = function () {
        var _this = this;
        this.startPoint = this.context.getCurrentPoint();
        this.starting = true;
        var dims = this.dims;
        util_1.each(dims, function (dim) {
            var scale = _this.getScale(dim);
            var min = scale.min, max = scale.max, values = scale.values;
            _this.startCache[dim] = { min: min, max: max, values: values };
        });
    };
    // 平移分类的度量
    // private translateCategory(dim, scale, normalPoint) {
    // }
    /**
     * 结束
     */
    ScaleTranslate.prototype.end = function () {
        this.startPoint = null;
        this.starting = false;
        this.startCache = {};
    };
    /**
     * 平移
     */
    ScaleTranslate.prototype.translate = function () {
        var _this = this;
        if (!this.starting) {
            return;
        }
        var startPoint = this.startPoint;
        var coord = this.context.view.getCoordinate();
        var currentPoint = this.context.getCurrentPoint();
        var normalStart = coord.invert(startPoint);
        var noramlCurrent = coord.invert(currentPoint);
        var dx = noramlCurrent.x - normalStart.x;
        var dy = noramlCurrent.y - normalStart.y;
        var view = this.context.view;
        var dims = this.dims;
        util_1.each(dims, function (dim) {
            _this.translateDim(dim, { x: dx * -1, y: dy * -1 });
        });
        view.render(true);
    };
    // 平移度量
    ScaleTranslate.prototype.translateDim = function (dim, normalPoint) {
        if (this.hasDim(dim)) {
            var scale = this.getScale(dim);
            if (scale.isLinear) {
                this.translateLinear(dim, scale, normalPoint);
            }
            //  else { // 暂时仅处理连续字段
            // this.translateCategory(dim, scale, normalPoint);
            // }
        }
    };
    // linear 度量平移
    ScaleTranslate.prototype.translateLinear = function (dim, scale, normalPoint) {
        var view = this.context.view;
        var _a = this.startCache[dim], min = _a.min, max = _a.max;
        var range = max - min;
        var d = normalPoint[dim] * range;
        // 只有第一次缓存，否则无法回滚
        if (!this.cacheScaleDefs[dim]) {
            this.cacheScaleDefs[dim] = {
                // @ts-ignore
                nice: scale.nice,
                min: min,
                max: max,
            };
        }
        view.scale(scale.field, {
            // @ts-ignore
            nice: false,
            min: min + d,
            max: max + d,
        });
    };
    // 平移分类的度量
    // private translateCategory(dim, scale, normalPoint) {
    // }
    /**
     * 回滚
     */
    ScaleTranslate.prototype.reset = function () {
        _super.prototype.reset.call(this);
        this.startPoint = null;
        this.starting = false;
    };
    return ScaleTranslate;
}(scale_transform_1.default));
exports.default = ScaleTranslate;

},{"./scale-transform":357,"@antv/util":803,"tslib":385}],359:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var scale_transform_1 = tslib_1.__importDefault(require("./scale-transform"));
/**
 * 缩放 Scale 的 Action
 * @ignore
 */
var ScaleTranslate = /** @class */ (function (_super) {
    tslib_1.__extends(ScaleTranslate, _super);
    function ScaleTranslate() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.zoomRatio = 0.05;
        return _this;
        // 平移分类的度量
        // private translateCategory(dim, scale, normalPoint) {
        // }
    }
    /**
     * 缩小
     */
    ScaleTranslate.prototype.zoomIn = function () {
        this.zoom(this.zoomRatio);
    };
    ScaleTranslate.prototype.zoom = function (scale) {
        var _this = this;
        var dims = this.dims;
        util_1.each(dims, function (dim) {
            _this.zoomDim(dim, scale);
        });
        this.context.view.render(true);
    };
    /**
     * 放大
     */
    ScaleTranslate.prototype.zoomOut = function () {
        this.zoom(-1 * this.zoomRatio);
    };
    // 缩放度量
    ScaleTranslate.prototype.zoomDim = function (dim, dRatio) {
        if (this.hasDim(dim)) {
            var scale = this.getScale(dim);
            if (scale.isLinear) {
                this.zoomLinear(dim, scale, dRatio);
            }
            //  else { // 暂时仅处理连续字段
            // this.zoomCategory(dim, scale, normalPoint);
            // }
        }
    };
    // linear 度量平移
    ScaleTranslate.prototype.zoomLinear = function (dim, scale, dRatio) {
        var view = this.context.view;
        // 只有第一次缓存，否则无法回滚
        if (!this.cacheScaleDefs[dim]) {
            this.cacheScaleDefs[dim] = {
                // @ts-ignore
                nice: scale.nice,
                min: scale.min,
                max: scale.max,
            };
        }
        // 使用使用原始度量作为缩放标准
        var scaleDef = this.cacheScaleDefs[dim];
        var range = scaleDef.max - scaleDef.min;
        var min = scale.min, max = scale.max;
        var d = dRatio * range;
        var toMin = min - d;
        var toMax = max + d;
        var curRange = toMax - toMin;
        var scaled = curRange / range;
        if (toMax > toMin && scaled < 100 && scaled > 0.01) {
            view.scale(scale.field, {
                // @ts-ignore
                nice: false,
                min: min - d,
                max: max + d,
            });
        }
    };
    return ScaleTranslate;
}(scale_transform_1.default));
exports.default = ScaleTranslate;

},{"./scale-transform":357,"@antv/util":803,"tslib":385}],360:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var util_2 = require("./action/util");
/**
 * 交互的上下文
 */
var Context = /** @class */ (function () {
    function Context(view) {
        /** 当前所有的 Action */
        this.actions = [];
        /** 当前事件对象 */
        this.event = null;
        this.cacheMap = {};
        this.view = view;
    }
    /**
     * 缓存信息
     * @param params 缓存的字段
     *  - 如果一个字段则获取缓存
     *  - 两个字段则设置缓存
     */
    Context.prototype.cache = function () {
        var params = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            params[_i] = arguments[_i];
        }
        if (params.length === 1) {
            return this.cacheMap[params[0]];
        }
        else if (params.length === 2) {
            this.cacheMap[params[0]] = params[1];
        }
    };
    /**
     * 获取 Action
     * @param name Action 的名称
     */
    Context.prototype.getAction = function (name) {
        return this.actions.find(function (action) { return action.name === name; });
    };
    /**
     * 获取 Action
     * @param action Action 对象
     */
    Context.prototype.addAction = function (action) {
        this.actions.push(action);
    };
    /**
     * 移除 Action
     * @param action Action 对象
     */
    Context.prototype.removeAction = function (action) {
        var actions = this.actions;
        var index = this.actions.indexOf(action);
        if (index >= 0) {
            actions.splice(index, 1);
        }
    };
    /**
     * 获取当前的点
     */
    Context.prototype.getCurrentPoint = function () {
        var event = this.event;
        if (event) {
            if (event.target instanceof HTMLElement) {
                var canvas = this.view.getCanvas();
                var point = canvas.getPointByClient(event.clientX, event.clientY);
                return point;
            }
            else {
                return {
                    x: event.x,
                    y: event.y,
                };
            }
        }
        return null;
    };
    /**
     * 获取当前 shape
     * @returns current shape
     */
    Context.prototype.getCurrentShape = function () {
        return util_1.get(this.event, ['gEvent', 'shape']);
    };
    /**
     * 当前的触发是否在 View 内
     */
    Context.prototype.isInPlot = function () {
        var point = this.getCurrentPoint();
        if (point) {
            return this.view.isPointInPlot(point);
        }
        return false;
    };
    /**
     * 是否在指定的图形内
     * @param name shape 的 name
     */
    Context.prototype.isInShape = function (name) {
        var shape = this.getCurrentShape(); // 不再考虑在 shape 的 parent 内的情况
        if (shape) {
            return shape.get('name') === name;
        }
        return false;
    };
    /**
     * 当前的触发是组件内部
     * @param name 组件名，可以为空
     */
    Context.prototype.isInComponent = function (name) {
        var components = util_2.getComponents(this.view);
        var point = this.getCurrentPoint();
        if (point) {
            return !!components.find(function (component) {
                var bbox = component.getBBox();
                if (name) {
                    return component.get('name') === name && util_2.isInBox(bbox, point);
                }
                else {
                    return util_2.isInBox(bbox, point);
                }
            });
        }
        return false;
    };
    /**
     * 销毁
     */
    Context.prototype.destroy = function () {
        this.view = null;
        this.event = null;
        // 先销毁 action 再清空，一边遍历，一边删除，所以数组需要更新引用
        util_1.each(this.actions.slice(), function (action) {
            action.destroy();
        });
        this.actions = null;
        this.cacheMap = null;
    };
    return Context;
}());
exports.default = Context;

},{"./action/util":353,"@antv/util":803}],361:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var register_1 = require("./action/register");
var context_1 = tslib_1.__importDefault(require("./context"));
var interaction_1 = tslib_1.__importDefault(require("./interaction"));
// 将字符串转换成 action
function parseAction(actionStr, context) {
    var arr = actionStr.split(':');
    var actionName = arr[0];
    // 如果已经初始化过 action ，则直接引用之前的 action
    var action = context.getAction(actionName) || register_1.createAction(actionName, context);
    if (!action) {
        throw new Error("There is no action named " + actionName);
    }
    var methodName = arr[1];
    return {
        action: action,
        methodName: methodName,
    };
}
// 执行 Action
function executeAction(actionObject) {
    var action = actionObject.action, methodName = actionObject.methodName;
    if (action[methodName]) {
        action[methodName]();
    }
    else {
        throw new Error("Action(" + action.name + ") doesn't have a method called " + methodName);
    }
}
var STEP_NAMES = {
    START: 'start',
    SHOW_ENABLE: 'showEnable',
    END: 'end',
    ROLLBACK: 'rollback',
    PROCESSING: 'processing',
};
/**
 * 支持语法的交互类
 */
var GrammarInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(GrammarInteraction, _super);
    function GrammarInteraction(view, steps) {
        var _this = _super.call(this, view, steps) || this;
        _this.callbackCaches = {};
        // 某个触发和反馈在本环节是否执行或
        _this.emitCaches = {};
        _this.steps = steps;
        return _this;
    }
    /**
     * 初始化
     */
    GrammarInteraction.prototype.init = function () {
        this.initContext();
        _super.prototype.init.call(this);
    };
    /**
     * 清理资源
     */
    GrammarInteraction.prototype.destroy = function () {
        _super.prototype.destroy.call(this); // 先清理事件
        this.steps = null;
        if (this.context) {
            this.context.destroy();
            this.context = null;
        }
        this.callbackCaches = null;
        this.view = null;
    };
    /**
     * 绑定事件
     */
    GrammarInteraction.prototype.initEvents = function () {
        var _this = this;
        util_1.each(this.steps, function (stepArr, stepName) {
            util_1.each(stepArr, function (step) {
                var callback = _this.getActionCallback(stepName, step);
                if (callback) {
                    // 如果存在 callback，才绑定，有时候会出现无 callback 的情况
                    _this.bindEvent(step.trigger, callback);
                }
            });
        });
    };
    /**
     * 清理绑定的事件
     */
    GrammarInteraction.prototype.clearEvents = function () {
        var _this = this;
        util_1.each(this.steps, function (stepArr, stepName) {
            util_1.each(stepArr, function (step) {
                var callback = _this.getActionCallback(stepName, step);
                if (callback) {
                    _this.offEvent(step.trigger, callback);
                }
            });
        });
    };
    // 初始化上下文，并初始化 action
    GrammarInteraction.prototype.initContext = function () {
        var view = this.view;
        var context = new context_1.default(view);
        this.context = context;
        var steps = this.steps;
        // 生成具体的 Action
        util_1.each(steps, function (subSteps) {
            util_1.each(subSteps, function (step) {
                if (util_1.isFunction(step.action)) {
                    // 如果传入回调函数，则直接生成 CallbackAction
                    step.actionObject = {
                        action: register_1.createCallbackAction(step.action, context),
                        methodName: 'execute',
                    };
                }
                else if (util_1.isString(step.action)) {
                    // 如果是字符串
                    step.actionObject = parseAction(step.action, context);
                }
                else if (util_1.isArray(step.action)) {
                    // 如果是数组
                    var actionArr = step.action;
                    step.actionObject = [];
                    util_1.each(actionArr, function (actionStr) {
                        step.actionObject.push(parseAction(actionStr, context));
                    });
                }
                // 如果 action 既不是字符串，也不是函数，则不会生成 actionObject
            });
        });
    };
    // 是否允许指定阶段名称执行
    GrammarInteraction.prototype.isAllowStep = function (stepName) {
        var currentStepName = this.currentStepName;
        var steps = this.steps;
        // 相同的阶段允许同时执行
        if (currentStepName === stepName) {
            return true;
        }
        if (stepName === STEP_NAMES.SHOW_ENABLE) {
            // 示能在整个过程中都可用
            return true;
        }
        if (stepName === STEP_NAMES.PROCESSING) {
            // 只有当前是 start 时，才允许 processing
            return currentStepName === STEP_NAMES.START;
        }
        if (stepName === STEP_NAMES.START) {
            // 如果当前是 processing，则无法 start，必须等待 end 后才能执行
            return currentStepName !== STEP_NAMES.PROCESSING;
        }
        if (stepName === STEP_NAMES.END) {
            return currentStepName === STEP_NAMES.PROCESSING || currentStepName === STEP_NAMES.START;
        }
        if (stepName === STEP_NAMES.ROLLBACK) {
            if (steps[STEP_NAMES.END]) {
                // 如果定义了 end, 只有 end 时才允许回滚
                return currentStepName === STEP_NAMES.END;
            }
            else if (currentStepName === STEP_NAMES.START) {
                // 如果未定义 end, 则判断是否是开始
                return true;
            }
        }
        return false;
    };
    // 具体的指定阶段是否允许执行
    GrammarInteraction.prototype.isAllowExcute = function (stepName, step) {
        if (this.isAllowStep(stepName)) {
            var key = this.getKey(stepName, step);
            // 如果是在本环节内仅允许触发一次，同时已经触发过，则不允许再触发
            if (step.once && this.emitCaches[key]) {
                return false;
            }
            // 如果是允许的阶段，则验证 isEnable 方法
            if (step.isEnable) {
                return step.isEnable(this.context);
            }
            return true; // 如果没有 isEnable 则允许执行
        }
        return false;
    };
    GrammarInteraction.prototype.enterStep = function (stepName) {
        this.currentStepName = stepName;
        this.emitCaches = {}; // 清除所有本环节触发的缓存
    };
    // 执行完某个触发和反馈（子环节）
    GrammarInteraction.prototype.afterExecute = function (stepName, step) {
        // show enable 不计入正常的流程，其他情况则设置当前的 step
        if (stepName !== STEP_NAMES.SHOW_ENABLE && this.currentStepName !== stepName) {
            this.enterStep(stepName);
        }
        var key = this.getKey(stepName, step);
        // 一旦执行，则缓存标记为，一直保持到跳出改环节
        this.emitCaches[key] = true;
    };
    // 获取某个环节的唯一的键值
    GrammarInteraction.prototype.getKey = function (stepName, step) {
        return stepName + step.trigger + step.action;
    };
    // 获取 step 的回调函数，如果已经生成，则直接返回，如果未生成，则创建
    GrammarInteraction.prototype.getActionCallback = function (stepName, step) {
        var _this = this;
        var context = this.context;
        var callbackCaches = this.callbackCaches;
        var actionObject = step.actionObject;
        if (step.action && actionObject) {
            var key = this.getKey(stepName, step);
            if (!callbackCaches[key]) {
                // 动态生成执行的方法，执行对应 action 的名称
                var actionCallback = function (event) {
                    context.event = event; // 保证检测时的 event
                    if (_this.isAllowExcute(stepName, step)) {
                        // 如果是数组时，则依次执行
                        if (util_1.isArray(actionObject)) {
                            util_1.each(actionObject, function (obj) {
                                context.event = event; // 可能触发新的事件，保证执行前的 context.event 是正确的
                                executeAction(obj);
                            });
                        }
                        else {
                            context.event = event; // 保证执行前的 context.event 是正确的
                            executeAction(actionObject);
                        }
                        _this.afterExecute(stepName, step);
                        if (step.callback) {
                            context.event = event; // 保证执行前的 context.event 是正确的
                            step.callback(context);
                        }
                    }
                    else {
                        // 如果未通过验证，则事件不要绑定在上面
                        context.event = null;
                    }
                };
                // 如果设置了 debounce
                if (step.debounce) {
                    callbackCaches[key] = util_1.debounce(actionCallback, step.debounce.wait, step.debounce.immediate);
                }
                else if (step.throttle) {
                    // 设置 throttle
                    callbackCaches[key] = util_1.throttle(actionCallback, step.throttle.wait, {
                        leading: step.throttle.leading,
                        trailing: step.throttle.trailing,
                    });
                }
                else {
                    // 直接设置
                    callbackCaches[key] = actionCallback;
                }
            }
            return callbackCaches[key];
        }
        return null;
    };
    GrammarInteraction.prototype.bindEvent = function (eventName, callback) {
        var nameArr = eventName.split(':');
        if (nameArr[0] === 'window') {
            window.addEventListener(nameArr[1], callback);
        }
        else if (nameArr[0] === 'document') {
            document.addEventListener(nameArr[1], callback);
        }
        else {
            this.view.on(eventName, callback);
        }
    };
    GrammarInteraction.prototype.offEvent = function (eventName, callback) {
        var nameArr = eventName.split(':');
        if (nameArr[0] === 'window') {
            window.removeEventListener(nameArr[1], callback);
        }
        else if (nameArr[0] === 'document') {
            document.removeEventListener(nameArr[1], callback);
        }
        else {
            this.view.off(eventName, callback);
        }
    };
    return GrammarInteraction;
}(interaction_1.default));
exports.default = GrammarInteraction;

},{"./action/register":352,"./context":360,"./interaction":363,"@antv/util":803,"tslib":385}],362:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createInteraction = exports.registerInteraction = exports.getInteraction = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var grammar_interaction_1 = tslib_1.__importDefault(require("./grammar-interaction"));
var Interactions = {};
/**
 * 根据交互行为名字获取对应的交互类
 * @param name 交互名字
 * @returns 交互类
 */
function getInteraction(name) {
    return Interactions[util_1.lowerCase(name)];
}
exports.getInteraction = getInteraction;
/**
 * 注册交互行为
 * @param name 交互行为名字
 * @param interaction 交互类
 */
function registerInteraction(name, interaction) {
    Interactions[util_1.lowerCase(name)] = interaction;
}
exports.registerInteraction = registerInteraction;
/**
 * 创建交互实例
 * @param name 交互名
 * @param view 交互应用的 View 实例
 * @param cfg 交互行为配置
 */
function createInteraction(name, view, cfg) {
    var interaciton = getInteraction(name);
    if (!interaciton) {
        return null;
    }
    if (util_1.isPlainObject(interaciton)) {
        // 如果不 clone 则会多个 interaction 实例共享 step 的定义
        var steps = util_1.mix(util_1.clone(interaciton), cfg);
        return new grammar_interaction_1.default(view, steps);
    }
    else {
        var cls = interaciton;
        return new cls(view, cfg);
    }
}
exports.createInteraction = createInteraction;
var interaction_1 = require("./interaction");
Object.defineProperty(exports, "Interaction", { enumerable: true, get: function () { return interaction_1.default; } });
var action_1 = require("./action");
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return action_1.Action; } });
Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return action_1.registerAction; } });
Object.defineProperty(exports, "getActionClass", { enumerable: true, get: function () { return action_1.getActionClass; } });

},{"./action":345,"./grammar-interaction":361,"./interaction":363,"@antv/util":803,"tslib":385}],363:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 交互的基类。
 */
var Interaction = /** @class */ (function () {
    function Interaction(view, cfg) {
        this.view = view;
        this.cfg = cfg;
    }
    /**
     * 初始化。
     */
    Interaction.prototype.init = function () {
        this.initEvents();
    };
    /**
     * 绑定事件
     */
    Interaction.prototype.initEvents = function () { };
    /**
     * 销毁事件
     */
    Interaction.prototype.clearEvents = function () { };
    /**
     * 销毁。
     */
    Interaction.prototype.destroy = function () {
        this.clearEvents();
    };
    return Interaction;
}());
exports.default = Interaction;

},{}],364:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

},{}],365:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerTheme = exports.getTheme = void 0;
var util_1 = require("@antv/util");
var theme_1 = require("../util/theme");
var light_1 = require("./style-sheet/light");
var defaultTheme = theme_1.createThemeByStylesheet(light_1.antvLight);
// 所有已经存在的主题
var Themes = {
    default: defaultTheme,
};
/**
 * 获取主题配置信息。
 * @param theme 主题名
 */
function getTheme(theme) {
    return util_1.get(Themes, util_1.lowerCase(theme), Themes.default);
}
exports.getTheme = getTheme;
/**
 * 注册新的主题配置信息。
 * @param theme 主题名。
 * @param value 具体的主题配置。
 */
function registerTheme(theme, value) {
    Themes[util_1.lowerCase(theme)] = util_1.deepMix({}, Themes.default, value);
}
exports.registerTheme = registerTheme;

},{"../util/theme":382,"./style-sheet/light":367,"@antv/util":803}],366:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.antvDark = void 0;
var WHITE_COLORS = {
    100: '#000',
    95: '#0D0D0D',
    85: '#262626',
    65: '#595959',
    45: '#8C8C8C',
    25: '#BFBFBF',
    15: '#D9D9D9',
    6: '#F0F0F0',
};
var BLACK_COLORS = {
    100: '#FFFFFF',
    95: '#F2F2F2',
    85: '#D9D9D9',
    65: '#A6A6A6',
    45: '#737373',
    25: '#404040',
    15: '#262626',
    6: '#0F0F0F',
};
var QUALITATIVE_10 = [
    '#5B8FF9',
    '#5AD8A6',
    '#5D7092',
    '#F6BD16',
    '#E86452',
    '#6DC8EC',
    '#945FB9',
    '#FF9845',
    '#1E9493',
    '#FF99C3',
];
var QUALITATIVE_20 = [
    '#5B8FF9',
    '#CDDDFD',
    '#5AD8A6',
    '#CDF3E4',
    '#5D7092',
    '#CED4DE',
    '#F6BD16',
    '#FCEBB9',
    '#E86452',
    '#F8D0CB',
    '#6DC8EC',
    '#D3EEF9',
    '#945FB9',
    '#DECFEA',
    '#FF9845',
    '#FFE0C7',
    '#1E9493',
    '#BBDEDE',
    '#FF99C3',
    '#FFE0ED',
];
exports.antvDark = {
    backgroundColor: '#141414',
    /** 主题色 */
    brandColor: QUALITATIVE_10[0],
    /** 分类色板 1，在数据量小于等于 10 时使用 */
    paletteQualitative10: QUALITATIVE_10,
    /** 分类色板 2，在数据量大于 10 时使用 */
    paletteQualitative20: QUALITATIVE_20,
    /** 语义色 */
    paletteSemanticRed: '#F4664A',
    /** 语义色 */
    paletteSemanticGreen: '#30BF78',
    /** 语义色 */
    paletteSemanticYellow: '#FAAD14',
    /** 字体 */
    fontFamily: "\"-apple-system\", \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial,\n  \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\",\n  \"Noto Color Emoji\"",
    // -------------------- 坐标轴 --------------------
    /** 坐标轴线颜色 */
    axisLineBorderColor: BLACK_COLORS[25],
    /** 坐标轴线粗细 */
    axisLineBorder: 0.5,
    /** 坐标轴线 lineDash 设置 */
    axisLineDash: null,
    /** 坐标轴标题颜色 */
    axisTitleTextFillColor: BLACK_COLORS[65],
    /** 坐标轴标题文本字体大小 */
    axisTitleTextFontSize: 12,
    /** 坐标轴标题文本行高 */
    axisTitleTextLineHeight: 12,
    /** 坐标轴标题文本字体粗细 */
    axisTitleTextFontWeight: 'normal',
    /** 坐标轴刻度线颜色 */
    axisTickLineBorderColor: BLACK_COLORS[25],
    /** 坐标轴刻度线长度 */
    axisTickLineLength: 4,
    /** 坐标轴刻度线粗细 */
    axisTickLineBorder: 0.5,
    /** 坐标轴次刻度线颜色 */
    axisSubTickLineBorderColor: BLACK_COLORS[15],
    /** 坐标轴次刻度线长度 */
    axisSubTickLineLength: 2,
    /** 坐标轴次刻度线粗细 */
    axisSubTickLineBorder: 0.5,
    /** 坐标轴刻度文本颜色 */
    axisLabelFillColor: BLACK_COLORS[45],
    /** 坐标轴刻度文本字体大小 */
    axisLabelFontSize: 12,
    /** 坐标轴刻度文本行高 */
    axisLabelLineHeight: 12,
    /** 坐标轴刻度文本字体粗细 */
    axisLabelFontWeight: 'normal',
    /** 坐标轴网格线颜色 */
    axisGridBorderColor: BLACK_COLORS[15],
    /** 坐标轴网格线粗细 */
    axisGridBorder: 0.5,
    /** 坐标轴网格线虚线设置 */
    axisGridLineDash: null,
    // -------------------- 图例 --------------------
    /** 图例标题颜色 */
    legendTitleTextFillColor: BLACK_COLORS[45],
    /** 图例标题文本字体大小 */
    legendTitleTextFontSize: 12,
    /** 图例标题文本行高 */
    legendTitleTextLineHeight: 21,
    /** 图例标题文本字体粗细 */
    legendTitleTextFontWeight: 'normal',
    /** 图例 marker 颜色 */
    legendMarkerColor: QUALITATIVE_10[0],
    /** 图例 marker 默认半径大小 */
    legendMarkerSize: 4,
    /** 图例 'circle' marker 半径 */
    legendCircleMarkerSize: 4,
    /** 图例 'square' marker 半径 */
    legendSquareMarkerSize: 4,
    /** 图例 'line' marker 半径 */
    legendLineMarkerSize: 5,
    /** 图例项文本颜色 */
    legendItemNameFillColor: BLACK_COLORS[65],
    /** 图例项文本字体大小 */
    legendItemNameFontSize: 12,
    /** 图例项文本行高 */
    legendItemNameLineHeight: 12,
    /** 图例项粗细 */
    legendItemNameFontWeight: 'normal',
    /** 连续图例滑块填充色 */
    sliderRailFillColor: BLACK_COLORS[15],
    /** 连续图例滑块边框粗细 */
    sliderRailBorder: 0,
    /** 连续图例滑块边框颜色 */
    sliderRailBorderColor: null,
    /** 连续图例滑块宽度 */
    sliderRailWidth: 100,
    /** 连续图例滑块高度 */
    sliderRailHeight: 12,
    /** 连续图例文本颜色 */
    sliderLabelTextFillColor: BLACK_COLORS[45],
    /** 连续图例文本字体大小 */
    sliderLabelTextFontSize: 12,
    /** 连续图例文本行高 */
    sliderLabelTextLineHeight: 12,
    /** 连续图例文本字体粗细 */
    sliderLabelTextFontWeight: 'normal',
    /** 连续图例滑块颜色 */
    sliderHandlerFillColor: WHITE_COLORS[6],
    /** 连续图例滑块宽度 */
    sliderHandlerWidth: 10,
    /** 连续图例滑块高度 */
    sliderHandlerHeight: 14,
    /** 连续图例滑块边框粗细 */
    sliderHandlerBorder: 1,
    /** 连续图例滑块边框颜色 */
    sliderHandlerBorderColor: WHITE_COLORS[25],
    // -------------------- Annotation，图形标注 --------------------
    /** arc 图形标注描边颜色 */
    annotationArcBorderColor: BLACK_COLORS[15],
    /** arc 图形标注粗细 */
    annotationArcBorder: 0.5,
    /** line 图形标注颜色 */
    annotationLineBorderColor: BLACK_COLORS[25],
    /** line 图形标注粗细 */
    annotationLineBorder: 0.5,
    /** lube 图形标注的虚线间隔 */
    annotationLineDash: null,
    /** text 图形标注文本颜色 */
    annotationTextFillColor: BLACK_COLORS[65],
    /** text 图形标注文本字体大小 */
    annotationTextFontSize: 12,
    /** text 图形标注文本行高 */
    annotationTextLineHeight: 12,
    /** text 图形标注文本字体粗细 */
    annotationTextFontWeight: 'normal',
    /** text 图形标注文本边框颜色 */
    annotationTextBorderColor: WHITE_COLORS[95],
    /** text 图形标注文本边框粗细 */
    annotationTextBorder: 1.5,
    /** region 图形标注填充颜色 */
    annotationRegionFillColor: BLACK_COLORS[100],
    /** region 图形标注填充颜色透明色 */
    annotationRegionFillOpacity: 0.06,
    /** region 图形标注描边粗细 */
    annotationRegionBorder: 0,
    /** region 图形标注描边颜色 */
    annotationRegionBorderColor: null,
    /** dataMarker 图形标注线的长度 */
    annotationDataMarkerLineLength: 16,
    // -------------------- Tooltip --------------------
    /** tooltip crosshairs 辅助线颜色 */
    tooltipCrosshairsBorderColor: BLACK_COLORS[25],
    /** tooltip crosshairs 辅助线粗细 */
    tooltipCrosshairsBorder: 0.5,
    /** tooltip crosshairs 辅助线虚线间隔 */
    tooltipCrosshairsLineDash: null,
    /** tooltip 内容框背景色 */
    tooltipContainerFillColor: '#1f1f1f',
    tooltipContainerFillOpacity: 0.95,
    /** tooltip 内容框阴影 */
    tooltipContainerShadow: '0px 2px 4px rgba(0,0,0,.5)',
    /** tooltip 内容框圆角 */
    tooltipContainerBorderRadius: 3,
    /** tooltip 文本颜色 */
    tooltipTextFillColor: BLACK_COLORS[65],
    /** tooltip 文本字体大小 */
    tooltipTextFontSize: 12,
    /** tooltip 文本行高 */
    tooltipTextLineHeight: 12,
    /** tooltip 文本字体粗细 */
    tooltipTextFontWeight: 'bold',
    // -------------------- Geometry labels --------------------
    /** Geometry label 文本颜色 */
    labelFillColor: BLACK_COLORS[65],
    /** Geometry label 文本字体大小 */
    labelFontSize: 12,
    /** Geometry label 文本行高 */
    labelLineHeight: 12,
    /** Geometry label 文本字体粗细 */
    labelFontWeight: 'normal',
    /** Geometry label 文本描边颜色 */
    labelBorderColor: null,
    /** Geometry label 文本描边粗细 */
    labelBorder: 0,
    /** Geometry innerLabel 文本颜色 */
    innerLabelFillColor: WHITE_COLORS[100],
    /** Geometry innerLabel 文本字体大小 */
    innerLabelFontSize: 12,
    /** Geometry innerLabel 文本行高 */
    innerLabelLineHeight: 12,
    /** Geometry innerLabel 文本字体粗细 */
    innerLabelFontWeight: 'normal',
    /** Geometry innerLabel 文本描边颜色 */
    innerLabelBorderColor: null,
    /** Geometry innerLabel 文本描边粗细 */
    innerLabelBorder: 0,
    /** Geometry label　文本连接线粗细 */
    labelLineBorder: 0.5,
    /** Geometry label 文本连接线颜色 */
    labelLineBorderColor: BLACK_COLORS[25],
    // -------------------- Geometry 图形样式--------------------
    /** 点图填充颜色 */
    pointFillColor: QUALITATIVE_10[0],
    /** 点图填充颜色透明度 */
    pointFillOpacity: 0.95,
    /** 点图大小 */
    pointSize: 4,
    /** 点图描边粗细 */
    pointBorder: 1,
    /** 点图描边颜色 */
    pointBorderColor: WHITE_COLORS[100],
    /** 点图描边透明度 */
    pointBorderOpacity: 1,
    /** 点图 active 状态下描边颜色 */
    pointActiveBorderColor: BLACK_COLORS[100],
    /** 点图 selected 状态下描边粗细 */
    pointSelectedBorder: 2,
    /** 点图 selected 状态下描边颜色 */
    pointSelectedBorderColor: BLACK_COLORS[100],
    /** 点图 inactive 状态下填充颜色透明度 */
    pointInactiveFillOpacity: 0.3,
    /** 点图 inactive 状态下描边透明度 */
    pointInactiveBorderOpacity: 0.3,
    /** 空心点图大小 */
    hollowPointSize: 4,
    /** 空心点图描边粗细 */
    hollowPointBorder: 1,
    /** 空心点图描边颜色 */
    hollowPointBorderColor: QUALITATIVE_10[0],
    /** 空心点图描边透明度 */
    hollowPointBorderOpacity: 0.95,
    hollowPointFillColor: WHITE_COLORS[100],
    /** 空心点图 active 状态下描边粗细 */
    hollowPointActiveBorder: 1,
    /** 空心点图 active 状态下描边颜色 */
    hollowPointActiveBorderColor: BLACK_COLORS[100],
    /** 空心点图 active 状态下描边透明度 */
    hollowPointActiveBorderOpacity: 1,
    /** 空心点图 selected 状态下描边粗细 */
    hollowPointSelectedBorder: 2,
    /** 空心点图 selected 状态下描边颜色 */
    hollowPointSelectedBorderColor: BLACK_COLORS[100],
    /** 空心点图 selected 状态下描边透明度 */
    hollowPointSelectedBorderOpacity: 1,
    /** 空心点图 inactive 状态下描边透明度 */
    hollowPointInactiveBorderOpacity: 0.3,
    /** 线图粗细 */
    lineBorder: 2,
    /** 线图颜色 */
    lineBorderColor: QUALITATIVE_10[0],
    /** 线图透明度 */
    lineBorderOpacity: 1,
    /** 线图 Active 状态下粗细 */
    lineActiveBorder: 3,
    /** 线图 selected 状态下粗细 */
    lineSelectedBorder: 3,
    /** 线图 inactive 状态下透明度 */
    lineInactiveBorderOpacity: 0.3,
    /** area 填充颜色 */
    areaFillColor: QUALITATIVE_10[0],
    /** area 填充透明度 */
    areaFillOpacity: 0.25,
    /** area 在 active 状态下的填充透明度 */
    areaActiveFillColor: QUALITATIVE_10[0],
    areaActiveFillOpacity: 0.5,
    /** area 在 selected 状态下的填充透明度 */
    areaSelectedFillColor: QUALITATIVE_10[0],
    areaSelectedFillOpacity: 0.5,
    /** area inactive 状态下填充透明度 */
    areaInactiveFillOpacity: 0.3,
    /** hollowArea 颜色 */
    hollowAreaBorderColor: QUALITATIVE_10[0],
    /** hollowArea 边框粗细 */
    hollowAreaBorder: 2,
    /** hollowArea 边框透明度 */
    hollowAreaBorderOpacity: 1,
    /** hollowArea active 状态下的边框粗细 */
    hollowAreaActiveBorder: 3,
    hollowAreaActiveBorderColor: BLACK_COLORS[100],
    /** hollowArea selected 状态下的边框粗细 */
    hollowAreaSelectedBorder: 3,
    hollowAreaSelectedBorderColor: BLACK_COLORS[100],
    /** hollowArea inactive 状态下的边框透明度 */
    hollowAreaInactiveBorderOpacity: 0.3,
    /** interval 填充颜色 */
    intervalFillColor: QUALITATIVE_10[0],
    /** interval 填充透明度 */
    intervalFillOpacity: 0.95,
    /** interval active 状态下边框粗细 */
    intervalActiveBorder: 1,
    /** interval active 状态下边框颜色 */
    intervalActiveBorderColor: BLACK_COLORS[100],
    intervalActiveBorderOpacity: 1,
    /** interval selected 状态下边框粗细 */
    intervalSelectedBorder: 2,
    /** interval selected 状态下边框颜色 */
    intervalSelectedBorderColor: BLACK_COLORS[100],
    /** interval selected 状态下边框透明度 */
    intervalSelectedBorderOpacity: 1,
    /** interval inactive 状态下边框透明度 */
    intervalInactiveBorderOpacity: 0.3,
    /** interval inactive 状态下填充透明度 */
    intervalInactiveFillOpacity: 0.3,
    /** interval 边框粗细 */
    hollowIntervalBorder: 2,
    /** hollowInterval 边框颜色 */
    hollowIntervalBorderColor: QUALITATIVE_10[0],
    /** hollowInterval 边框透明度 */
    hollowIntervalBorderOpacity: 1,
    hollowIntervalFillColor: WHITE_COLORS[100],
    /** hollowInterval active 状态下边框粗细 */
    hollowIntervalActiveBorder: 2,
    /** hollowInterval active 状态下边框颜色 */
    hollowIntervalActiveBorderColor: BLACK_COLORS[100],
    /** hollowInterval selected 状态下边框粗细 */
    hollowIntervalSelectedBorder: 3,
    /** hollowInterval selected 状态下边框颜色 */
    hollowIntervalSelectedBorderColor: BLACK_COLORS[100],
    /** hollowInterval selected 状态下边框透明度 */
    hollowIntervalSelectedBorderOpacity: 1,
    /** hollowInterval inactive 状态下边框透明度 */
    hollowIntervalInactiveBorderOpacity: 0.3,
};

},{}],367:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.antvLight = void 0;
var BLACK_COLORS = {
    100: '#000',
    95: '#0D0D0D',
    85: '#262626',
    65: '#595959',
    45: '#8C8C8C',
    25: '#BFBFBF',
    15: '#D9D9D9',
    6: '#F0F0F0',
};
var WHITE_COLORS = {
    100: '#FFFFFF',
    95: '#F2F2F2',
    85: '#D9D9D9',
    65: '#A6A6A6',
    45: '#737373',
    25: '#404040',
    15: '#262626',
    6: '#0F0F0F',
};
var QUALITATIVE_10 = [
    '#5B8FF9',
    '#5AD8A6',
    '#5D7092',
    '#F6BD16',
    '#E86452',
    '#6DC8EC',
    '#945FB9',
    '#FF9845',
    '#1E9493',
    '#FF99C3',
];
var QUALITATIVE_20 = [
    '#5B8FF9',
    '#CDDDFD',
    '#5AD8A6',
    '#CDF3E4',
    '#5D7092',
    '#CED4DE',
    '#F6BD16',
    '#FCEBB9',
    '#E86452',
    '#F8D0CB',
    '#6DC8EC',
    '#D3EEF9',
    '#945FB9',
    '#DECFEA',
    '#FF9845',
    '#FFE0C7',
    '#1E9493',
    '#BBDEDE',
    '#FF99C3',
    '#FFE0ED',
];
exports.antvLight = {
    backgroundColor: 'transparent',
    /** 主题色 */
    brandColor: QUALITATIVE_10[0],
    /** 分类色板 1，在数据量小于等于 10 时使用 */
    paletteQualitative10: QUALITATIVE_10,
    /** 分类色板 2，在数据量大于 10 时使用 */
    paletteQualitative20: QUALITATIVE_20,
    /** 语义色 */
    paletteSemanticRed: '#F4664A',
    /** 语义色 */
    paletteSemanticGreen: '#30BF78',
    /** 语义色 */
    paletteSemanticYellow: '#FAAD14',
    /** 字体 */
    fontFamily: "\"-apple-system\", \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial,\n  \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\",\n  \"Noto Color Emoji\"",
    // -------------------- 坐标轴 --------------------
    /** 坐标轴线颜色 */
    axisLineBorderColor: BLACK_COLORS[25],
    /** 坐标轴线粗细 */
    axisLineBorder: 0.5,
    /** 坐标轴线 lineDash 设置 */
    axisLineDash: null,
    /** 坐标轴标题颜色 */
    axisTitleTextFillColor: BLACK_COLORS[65],
    /** 坐标轴标题文本字体大小 */
    axisTitleTextFontSize: 12,
    /** 坐标轴标题文本行高 */
    axisTitleTextLineHeight: 12,
    /** 坐标轴标题文本字体粗细 */
    axisTitleTextFontWeight: 'normal',
    /** 坐标轴刻度线颜色 */
    axisTickLineBorderColor: BLACK_COLORS[25],
    /** 坐标轴刻度线长度 */
    axisTickLineLength: 4,
    /** 坐标轴刻度线粗细 */
    axisTickLineBorder: 0.5,
    /** 坐标轴次刻度线颜色 */
    axisSubTickLineBorderColor: BLACK_COLORS[15],
    /** 坐标轴次刻度线长度 */
    axisSubTickLineLength: 2,
    /** 坐标轴次刻度线粗细 */
    axisSubTickLineBorder: 0.5,
    /** 坐标轴刻度文本颜色 */
    axisLabelFillColor: BLACK_COLORS[45],
    /** 坐标轴刻度文本字体大小 */
    axisLabelFontSize: 12,
    /** 坐标轴刻度文本行高 */
    axisLabelLineHeight: 12,
    /** 坐标轴刻度文本字体粗细 */
    axisLabelFontWeight: 'normal',
    /** 坐标轴网格线颜色 */
    axisGridBorderColor: BLACK_COLORS[15],
    /** 坐标轴网格线粗细 */
    axisGridBorder: 0.5,
    /** 坐标轴网格线虚线设置 */
    axisGridLineDash: null,
    // -------------------- 图例 --------------------
    /** 图例标题颜色 */
    legendTitleTextFillColor: BLACK_COLORS[45],
    /** 图例标题文本字体大小 */
    legendTitleTextFontSize: 12,
    /** 图例标题文本行高 */
    legendTitleTextLineHeight: 21,
    /** 图例标题文本字体粗细 */
    legendTitleTextFontWeight: 'normal',
    /** 图例 marker 颜色 */
    legendMarkerColor: QUALITATIVE_10[0],
    /** 图例 marker 默认半径大小 */
    legendMarkerSize: 4,
    /** 图例 'circle' marker 半径 */
    legendCircleMarkerSize: 4,
    /** 图例 'square' marker 半径 */
    legendSquareMarkerSize: 4,
    /** 图例 'line' marker 半径 */
    legendLineMarkerSize: 5,
    /** 图例项文本颜色 */
    legendItemNameFillColor: BLACK_COLORS[65],
    /** 图例项文本字体大小 */
    legendItemNameFontSize: 12,
    /** 图例项文本行高 */
    legendItemNameLineHeight: 12,
    /** 图例项粗细 */
    legendItemNameFontWeight: 'normal',
    /** 连续图例滑块填充色 */
    sliderRailFillColor: BLACK_COLORS[15],
    /** 连续图例滑块边框粗细 */
    sliderRailBorder: 0,
    /** 连续图例滑块边框颜色 */
    sliderRailBorderColor: null,
    /** 连续图例滑块宽度 */
    sliderRailWidth: 100,
    /** 连续图例滑块高度 */
    sliderRailHeight: 12,
    /** 连续图例文本颜色 */
    sliderLabelTextFillColor: BLACK_COLORS[45],
    /** 连续图例文本字体大小 */
    sliderLabelTextFontSize: 12,
    /** 连续图例文本行高 */
    sliderLabelTextLineHeight: 12,
    /** 连续图例文本字体粗细 */
    sliderLabelTextFontWeight: 'normal',
    /** 连续图例滑块颜色 */
    sliderHandlerFillColor: BLACK_COLORS[6],
    /** 连续图例滑块宽度 */
    sliderHandlerWidth: 10,
    /** 连续图例滑块高度 */
    sliderHandlerHeight: 14,
    /** 连续图例滑块边框粗细 */
    sliderHandlerBorder: 1,
    /** 连续图例滑块边框颜色 */
    sliderHandlerBorderColor: BLACK_COLORS[25],
    // -------------------- Annotation，图形标注 --------------------
    /** arc 图形标注描边颜色 */
    annotationArcBorderColor: BLACK_COLORS[15],
    /** arc 图形标注粗细 */
    annotationArcBorder: 0.5,
    /** line 图形标注颜色 */
    annotationLineBorderColor: BLACK_COLORS[25],
    /** line 图形标注粗细 */
    annotationLineBorder: 0.5,
    /** lube 图形标注的虚线间隔 */
    annotationLineDash: null,
    /** text 图形标注文本颜色 */
    annotationTextFillColor: BLACK_COLORS[65],
    /** text 图形标注文本字体大小 */
    annotationTextFontSize: 12,
    /** text 图形标注文本行高 */
    annotationTextLineHeight: 12,
    /** text 图形标注文本字体粗细 */
    annotationTextFontWeight: 'normal',
    /** text 图形标注文本边框颜色 */
    annotationTextBorderColor: WHITE_COLORS[95],
    /** text 图形标注文本边框粗细 */
    annotationTextBorder: 1.5,
    /** region 图形标注填充颜色 */
    annotationRegionFillColor: BLACK_COLORS[100],
    /** region 图形标注填充颜色透明色 */
    annotationRegionFillOpacity: 0.06,
    /** region 图形标注描边粗细 */
    annotationRegionBorder: 0,
    /** region 图形标注描边颜色 */
    annotationRegionBorderColor: null,
    /** dataMarker 图形标注线的长度 */
    annotationDataMarkerLineLength: 16,
    // -------------------- Tooltip --------------------
    /** tooltip crosshairs 辅助线颜色 */
    tooltipCrosshairsBorderColor: BLACK_COLORS[25],
    /** tooltip crosshairs 辅助线粗细 */
    tooltipCrosshairsBorder: 0.5,
    /** tooltip crosshairs 辅助线虚线间隔 */
    tooltipCrosshairsLineDash: null,
    /** tooltip 内容框背景色 */
    tooltipContainerFillColor: 'rgb(255, 255, 255)',
    tooltipContainerFillOpacity: 0.95,
    /** tooltip 内容框阴影 */
    tooltipContainerShadow: '0px 0px 10px #aeaeae',
    /** tooltip 内容框圆角 */
    tooltipContainerBorderRadius: 3,
    /** tooltip 文本颜色 */
    tooltipTextFillColor: BLACK_COLORS[65],
    /** tooltip 文本字体大小 */
    tooltipTextFontSize: 12,
    /** tooltip 文本行高 */
    tooltipTextLineHeight: 12,
    /** tooltip 文本字体粗细 */
    tooltipTextFontWeight: 'bold',
    // -------------------- Geometry labels --------------------
    /** Geometry label 文本颜色 */
    labelFillColor: BLACK_COLORS[65],
    /** Geometry label 文本字体大小 */
    labelFontSize: 12,
    /** Geometry label 文本行高 */
    labelLineHeight: 12,
    /** Geometry label 文本字体粗细 */
    labelFontWeight: 'normal',
    /** Geometry label 文本描边颜色 */
    labelBorderColor: null,
    /** Geometry label 文本描边粗细 */
    labelBorder: 0,
    /** Geometry innerLabel 文本颜色 */
    innerLabelFillColor: WHITE_COLORS[100],
    /** Geometry innerLabel 文本字体大小 */
    innerLabelFontSize: 12,
    /** Geometry innerLabel 文本行高 */
    innerLabelLineHeight: 12,
    /** Geometry innerLabel 文本字体粗细 */
    innerLabelFontWeight: 'normal',
    /** Geometry innerLabel 文本描边颜色 */
    innerLabelBorderColor: null,
    /** Geometry innerLabel 文本描边粗细 */
    innerLabelBorder: 0,
    /** Geometry label　文本连接线粗细 */
    labelLineBorder: 0.5,
    /** Geometry label 文本连接线颜色 */
    labelLineBorderColor: BLACK_COLORS[25],
    // -------------------- Geometry 图形样式--------------------
    /** 点图填充颜色 */
    pointFillColor: QUALITATIVE_10[0],
    /** 点图填充颜色透明度 */
    pointFillOpacity: 0.95,
    /** 点图大小 */
    pointSize: 4,
    /** 点图描边粗细 */
    pointBorder: 1,
    /** 点图描边颜色 */
    pointBorderColor: WHITE_COLORS[100],
    /** 点图描边透明度 */
    pointBorderOpacity: 1,
    /** 点图 active 状态下描边颜色 */
    pointActiveBorderColor: BLACK_COLORS[100],
    /** 点图 selected 状态下描边粗细 */
    pointSelectedBorder: 2,
    /** 点图 selected 状态下描边颜色 */
    pointSelectedBorderColor: BLACK_COLORS[100],
    /** 点图 inactive 状态下填充颜色透明度 */
    pointInactiveFillOpacity: 0.3,
    /** 点图 inactive 状态下描边透明度 */
    pointInactiveBorderOpacity: 0.3,
    /** 空心点图大小 */
    hollowPointSize: 4,
    /** 空心点图描边粗细 */
    hollowPointBorder: 1,
    /** 空心点图描边颜色 */
    hollowPointBorderColor: QUALITATIVE_10[0],
    /** 空心点图描边透明度 */
    hollowPointBorderOpacity: 0.95,
    hollowPointFillColor: WHITE_COLORS[100],
    /** 空心点图 active 状态下描边粗细 */
    hollowPointActiveBorder: 1,
    /** 空心点图 active 状态下描边颜色 */
    hollowPointActiveBorderColor: BLACK_COLORS[100],
    /** 空心点图 active 状态下描边透明度 */
    hollowPointActiveBorderOpacity: 1,
    /** 空心点图 selected 状态下描边粗细 */
    hollowPointSelectedBorder: 2,
    /** 空心点图 selected 状态下描边颜色 */
    hollowPointSelectedBorderColor: BLACK_COLORS[100],
    /** 空心点图 selected 状态下描边透明度 */
    hollowPointSelectedBorderOpacity: 1,
    /** 空心点图 inactive 状态下描边透明度 */
    hollowPointInactiveBorderOpacity: 0.3,
    /** 线图粗细 */
    lineBorder: 2,
    /** 线图颜色 */
    lineBorderColor: QUALITATIVE_10[0],
    /** 线图透明度 */
    lineBorderOpacity: 1,
    /** 线图 Active 状态下粗细 */
    lineActiveBorder: 3,
    /** 线图 selected 状态下粗细 */
    lineSelectedBorder: 3,
    /** 线图 inactive 状态下透明度 */
    lineInactiveBorderOpacity: 0.3,
    /** area 填充颜色 */
    areaFillColor: QUALITATIVE_10[0],
    /** area 填充透明度 */
    areaFillOpacity: 0.25,
    /** area 在 active 状态下的填充透明度 */
    areaActiveFillColor: QUALITATIVE_10[0],
    areaActiveFillOpacity: 0.5,
    /** area 在 selected 状态下的填充透明度 */
    areaSelectedFillColor: QUALITATIVE_10[0],
    areaSelectedFillOpacity: 0.5,
    /** area inactive 状态下填充透明度 */
    areaInactiveFillOpacity: 0.3,
    /** hollowArea 颜色 */
    hollowAreaBorderColor: QUALITATIVE_10[0],
    /** hollowArea 边框粗细 */
    hollowAreaBorder: 2,
    /** hollowArea 边框透明度 */
    hollowAreaBorderOpacity: 1,
    /** hollowArea active 状态下的边框粗细 */
    hollowAreaActiveBorder: 3,
    hollowAreaActiveBorderColor: BLACK_COLORS[100],
    /** hollowArea selected 状态下的边框粗细 */
    hollowAreaSelectedBorder: 3,
    hollowAreaSelectedBorderColor: BLACK_COLORS[100],
    /** hollowArea inactive 状态下的边框透明度 */
    hollowAreaInactiveBorderOpacity: 0.3,
    /** interval 填充颜色 */
    intervalFillColor: QUALITATIVE_10[0],
    /** interval 填充透明度 */
    intervalFillOpacity: 0.95,
    /** interval active 状态下边框粗细 */
    intervalActiveBorder: 1,
    /** interval active 状态下边框颜色 */
    intervalActiveBorderColor: BLACK_COLORS[100],
    intervalActiveBorderOpacity: 1,
    /** interval selected 状态下边框粗细 */
    intervalSelectedBorder: 2,
    /** interval selected 状态下边框颜色 */
    intervalSelectedBorderColor: BLACK_COLORS[100],
    /** interval selected 状态下边框透明度 */
    intervalSelectedBorderOpacity: 1,
    /** interval inactive 状态下边框透明度 */
    intervalInactiveBorderOpacity: 0.3,
    /** interval inactive 状态下填充透明度 */
    intervalInactiveFillOpacity: 0.3,
    /** interval 边框粗细 */
    hollowIntervalBorder: 2,
    /** hollowInterval 边框颜色 */
    hollowIntervalBorderColor: QUALITATIVE_10[0],
    /** hollowInterval 边框透明度 */
    hollowIntervalBorderOpacity: 1,
    hollowIntervalFillColor: WHITE_COLORS[100],
    /** hollowInterval active 状态下边框粗细 */
    hollowIntervalActiveBorder: 2,
    /** hollowInterval active 状态下边框颜色 */
    hollowIntervalActiveBorderColor: BLACK_COLORS[100],
    /** hollowInterval selected 状态下边框粗细 */
    hollowIntervalSelectedBorder: 3,
    /** hollowInterval selected 状态下边框颜色 */
    hollowIntervalSelectedBorderColor: BLACK_COLORS[100],
    /** hollowInterval selected 状态下边框透明度 */
    hollowIntervalSelectedBorderOpacity: 1,
    /** hollowInterval inactive 状态下边框透明度 */
    hollowIntervalInactiveBorderOpacity: 0.3,
};

},{}],368:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMappingValue = void 0;
var tslib_1 = require("tslib");
/**
 * @ignore
 * get the mapping value by attribute, if mapping value is nil, return def
 * @param attr
 * @param value
 * @param def
 * @returns get mapping value
 */
function getMappingValue(attr, value, def) {
    if (!attr) {
        return def;
    }
    var r;
    // 多参数映射，阻止程序报错
    if (attr.callback && attr.callback.length > 1) {
        var restArgs = Array(attr.callback.length - 1).fill('');
        r = attr.mapping.apply(attr, tslib_1.__spreadArrays([value], restArgs)).join('');
    }
    else {
        r = attr.mapping(value).join('');
    }
    return r || def;
}
exports.getMappingValue = getMappingValue;

},{"tslib":385}],369:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAxisTitleText = exports.getAxisDirection = exports.getAxisOption = exports.getCircleAxisCenterRadius = exports.getAxisThemeCfg = exports.getAxisFactorByRegion = exports.isVertical = exports.getAxisFactor = exports.getAxisRegion = exports.getCircleAxisRelativeRegion = exports.getLineAxisRelativeRegion = void 0;
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var scale_1 = require("./scale");
var matrix_util_1 = require("@antv/matrix-util");
/**
 * @ignore
 * get axis relative region ( 0 ~ 1) by direction when coordinate is rect
 * @param direction
 * @returns axis coordinate region
 */
function getLineAxisRelativeRegion(direction) {
    var start;
    var end;
    switch (direction) {
        case constant_1.DIRECTION.TOP:
            start = { x: 0, y: 1 };
            end = { x: 1, y: 1 };
            break;
        case constant_1.DIRECTION.RIGHT:
            start = { x: 1, y: 0 };
            end = { x: 1, y: 1 };
            break;
        case constant_1.DIRECTION.BOTTOM:
            start = { x: 0, y: 0 };
            end = { x: 1, y: 0 };
            break;
        case constant_1.DIRECTION.LEFT:
            start = { x: 0, y: 0 };
            end = { x: 0, y: 1 };
            break;
        default:
            start = end = { x: 0, y: 0 };
    }
    return { start: start, end: end };
}
exports.getLineAxisRelativeRegion = getLineAxisRelativeRegion;
/**
 * @ignore
 * get axis relative region ( 0 ~ 1) by direction when coordinate is polar
 * @param coordinate
 * @returns axis coordinate region
 */
function getCircleAxisRelativeRegion(coordinate) {
    var start;
    var end;
    if (coordinate.isTransposed) {
        start = {
            x: 0,
            y: 0,
        };
        end = {
            x: 1,
            y: 0,
        };
    }
    else {
        start = {
            x: 0,
            y: 0,
        };
        end = {
            x: 0,
            y: 1,
        };
    }
    return { start: start, end: end };
}
exports.getCircleAxisRelativeRegion = getCircleAxisRelativeRegion;
/**
 * @ignore
 * get the axis region from coordinate
 * @param coordinate
 * @param direction
 * @returns the axis region (start point, end point)
 */
function getAxisRegion(coordinate, direction) {
    var region = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };
    if (coordinate.isRect) {
        region = getLineAxisRelativeRegion(direction);
    }
    else if (coordinate.isPolar) {
        region = getCircleAxisRelativeRegion(coordinate);
    }
    var start = region.start, end = region.end;
    return {
        start: coordinate.convert(start),
        end: coordinate.convert(end),
    };
}
exports.getAxisRegion = getAxisRegion;
/**
 * @ignore
 * get axis factor
 * @param coordinate
 * @param direction
 * @returns factor
 */
function getAxisFactor(coordinate, direction) {
    // rect coordinate, by direction
    if (coordinate.isRect) {
        return coordinate.isTransposed
            ? [constant_1.DIRECTION.RIGHT, constant_1.DIRECTION.BOTTOM].includes(direction)
                ? 1
                : -1
            : [constant_1.DIRECTION.BOTTOM, constant_1.DIRECTION.RIGHT].includes(direction)
                ? -1
                : 1;
    }
    // polar y axis, by angle
    if (coordinate.isPolar) {
        var startAngle = coordinate.x.start;
        return startAngle < 0 ? -1 : 1;
    }
    return 1;
}
exports.getAxisFactor = getAxisFactor;
/**
 * @ignore
 * whether the axis isVertical
 * @param region
 * @returns isVertical
 */
function isVertical(region) {
    var start = region.start, end = region.end;
    return start.x === end.x;
}
exports.isVertical = isVertical;
/**
 * @ignore
 * get factor by region (real position)
 * @param region
 * @param center
 * @returns factor
 */
function getAxisFactorByRegion(region, center) {
    var start = region.start, end = region.end;
    var isAxisVertical = isVertical(region);
    // 垂直
    if (isAxisVertical) {
        // 左方,从下到上、右方,从上到下
        if ((start.y - end.y) * (center.x - start.x) > 0) {
            return 1;
        }
        else {
            return -1;
        }
    }
    else {
        // 下方,从左到右、上方,从右到做
        if ((end.x - start.x) * (start.y - center.y) > 0) {
            return -1;
        }
        else {
            return 1;
        }
    }
}
exports.getAxisFactorByRegion = getAxisFactorByRegion;
/**
 * @ignore
 * get the axis cfg from theme
 * @param theme view theme object
 * @param direction axis direction
 * @returns axis theme cfg
 */
function getAxisThemeCfg(theme, direction) {
    return util_1.get(theme, ['components', 'axis', direction], {});
}
exports.getAxisThemeCfg = getAxisThemeCfg;
/**
 * @ignore
 * get circle axis center and radius
 * @param coordinate
 */
function getCircleAxisCenterRadius(coordinate) {
    // @ts-ignore
    var x = coordinate.x, y = coordinate.y, center = coordinate.circleCenter;
    var isReflectY = y.start > y.end;
    var start = coordinate.isTransposed
        ? coordinate.convert({
            x: isReflectY ? 0 : 1,
            y: 0,
        })
        : coordinate.convert({
            x: 0,
            y: isReflectY ? 0 : 1,
        });
    var startVector = [start.x - center.x, start.y - center.y];
    var normalVector = [1, 0];
    var startAngle = start.y > center.y ? matrix_util_1.vec2.angle(startVector, normalVector) : matrix_util_1.vec2.angle(startVector, normalVector) * -1;
    var endAngle = startAngle + (x.end - x.start);
    var radius = Math.sqrt(Math.pow((start.x - center.x), 2) + Math.pow((start.y - center.y), 2));
    return {
        center: center,
        radius: radius,
        startAngle: startAngle,
        endAngle: endAngle,
    };
}
exports.getCircleAxisCenterRadius = getCircleAxisCenterRadius;
/**
 * @ignore
 * 从配置中获取单个字段的 axis 配置
 * @param axes
 * @param field
 * @returns the axis option of field
 */
function getAxisOption(axes, field) {
    if (util_1.isBoolean(axes)) {
        return axes === false ? false : {};
    }
    return util_1.get(axes, [field]);
}
exports.getAxisOption = getAxisOption;
/**
 * @ignore
 * 如果配置了 position，则使用配置
 * @param axisOption
 * @param def
 */
function getAxisDirection(axisOption, def) {
    return util_1.get(axisOption, 'position', def);
}
exports.getAxisDirection = getAxisDirection;
/**
 * 获取 axis 的 title 文本
 * @param scale
 * @param axisOption
 */
function getAxisTitleText(scale, axisOption) {
    return util_1.get(axisOption, ['title', 'text'], scale_1.getName(scale));
}
exports.getAxisTitleText = getAxisTitleText;

},{"../constant":237,"./scale":381,"@antv/matrix-util":717,"@antv/util":803}],370:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toPoints = exports.getRegionBBox = exports.BBox = void 0;
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
/**
 * 用于包围盒计算。
 */
var BBox = /** @class */ (function () {
    function BBox(x, y, width, height) {
        if (x === void 0) { x = 0; }
        if (y === void 0) { y = 0; }
        if (width === void 0) { width = 0; }
        if (height === void 0) { height = 0; }
        this.x = x;
        this.y = y;
        this.height = height;
        this.width = width;
    }
    BBox.fromRange = function (minX, minY, maxX, maxY) {
        return new BBox(minX, minY, maxX - minX, maxY - minY);
    };
    Object.defineProperty(BBox.prototype, "minX", {
        get: function () {
            return this.x;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "maxX", {
        get: function () {
            return this.x + this.width;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "minY", {
        get: function () {
            return this.y;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "maxY", {
        get: function () {
            return this.y + this.height;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "tl", {
        get: function () {
            return { x: this.x, y: this.y };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "tr", {
        get: function () {
            return { x: this.maxX, y: this.y };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "bl", {
        get: function () {
            return { x: this.x, y: this.maxY };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "br", {
        get: function () {
            return { x: this.maxX, y: this.maxY };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "top", {
        get: function () {
            return {
                x: this.x + this.width / 2,
                y: this.minY,
            };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "right", {
        get: function () {
            return {
                x: this.maxX,
                y: this.y + this.height / 2,
            };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "bottom", {
        get: function () {
            return {
                x: this.x + this.width / 2,
                y: this.maxY,
            };
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BBox.prototype, "left", {
        get: function () {
            return {
                x: this.minX,
                y: this.y + this.height / 2,
            };
        },
        enumerable: false,
        configurable: true
    });
    // end 计算属性
    /**
     * 包围盒是否相等
     * @param {BBox} bbox 包围盒
     * @returns      包围盒是否相等
     */
    BBox.prototype.isEqual = function (bbox) {
        return this.x === bbox.x && this.y === bbox.y && this.width === bbox.width && this.height === bbox.height;
    };
    /**
     * 克隆包围盒
     * @returns 包围盒
     */
    BBox.prototype.clone = function () {
        return new BBox(this.x, this.y, this.width, this.height);
    };
    /**
     * 取并集
     * @param subBBox
     */
    BBox.prototype.add = function () {
        var subBBox = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            subBBox[_i] = arguments[_i];
        }
        var bbox = this.clone();
        util_1.each(subBBox, function (b) {
            bbox.x = Math.min(b.x, bbox.x);
            bbox.y = Math.min(b.y, bbox.y);
            bbox.width = Math.max(b.maxX, bbox.maxX) - bbox.x;
            bbox.height = Math.max(b.maxY, bbox.maxY) - bbox.y;
        });
        return bbox;
    };
    /**
     * 取交集
     * @param subBBox
     */
    BBox.prototype.merge = function () {
        var subBBox = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            subBBox[_i] = arguments[_i];
        }
        var bbox = this.clone();
        util_1.each(subBBox, function (b) {
            bbox.x = Math.max(b.x, bbox.x);
            bbox.y = Math.max(b.y, bbox.y);
            bbox.width = Math.min(b.maxX, bbox.maxX) - bbox.x;
            bbox.height = Math.min(b.maxY, bbox.maxY) - bbox.y;
        });
        return bbox;
    };
    /**
     * bbox 剪裁
     * @param subBBox
     * @param direction
     */
    BBox.prototype.cut = function (subBBox, direction) {
        var width = subBBox.width;
        var height = subBBox.height;
        switch (direction) {
            case constant_1.DIRECTION.TOP:
            case constant_1.DIRECTION.TOP_LEFT:
            case constant_1.DIRECTION.TOP_RIGHT:
                return BBox.fromRange(this.minX, this.minY + height, this.maxX, this.maxY);
            case constant_1.DIRECTION.RIGHT:
            case constant_1.DIRECTION.RIGHT_TOP:
            case constant_1.DIRECTION.RIGHT_BOTTOM:
                return BBox.fromRange(this.minX, this.minY, this.maxX - width, this.maxY);
            case constant_1.DIRECTION.BOTTOM:
            case constant_1.DIRECTION.BOTTOM_LEFT:
            case constant_1.DIRECTION.BOTTOM_RIGHT:
                return BBox.fromRange(this.minX, this.minY, this.maxX, this.maxY - height);
            case constant_1.DIRECTION.LEFT:
            case constant_1.DIRECTION.LEFT_TOP:
            case constant_1.DIRECTION.LEFT_BOTTOM:
                return BBox.fromRange(this.minX + width, this.minY, this.maxX, this.maxY);
            default:
                // 其他情况不裁剪，原样返回
                return this;
        }
    };
    /**
     * 收缩形成新的
     * @param gap
     */
    BBox.prototype.shrink = function (gap) {
        var top = gap[0], right = gap[1], bottom = gap[2], left = gap[3];
        return new BBox(this.x + left, this.y + top, this.width - left - right, this.height - top - bottom);
    };
    /**
     * get the gap of two bbox, if not exceed, then 0
     * @param bbox
     * @returns [top, right, bottom, left]
     */
    BBox.prototype.exceed = function (bbox) {
        return [
            Math.max(-this.minY + bbox.minY, 0),
            Math.max(this.maxX - bbox.maxX, 0),
            Math.max(this.maxY - bbox.maxY, 0),
            Math.max(-this.minX + bbox.minX, 0),
        ];
    };
    /**
     * 获取包围盒大小
     * @returns 包围盒大小
     */
    BBox.prototype.size = function () {
        return this.width * this.height;
    };
    return BBox;
}());
exports.BBox = BBox;
/**
 * 从一个 bbox 的 region 获取 bbox
 * @param bbox
 * @param region
 */
exports.getRegionBBox = function (bbox, region) {
    var start = region.start, end = region.end;
    return new BBox(bbox.x + bbox.width * start.x, bbox.y + bbox.height * start.y, bbox.width * Math.abs(end.x - start.x), bbox.height * Math.abs(end.y - start.y));
};
/**
 * 将 bbox 转换成 points
 * @param bbox
 */
function toPoints(bbox) {
    return [
        [bbox.minX, bbox.minY],
        [bbox.maxX, bbox.minY],
        [bbox.maxX, bbox.maxY],
        [bbox.minX, bbox.maxY],
    ];
}
exports.toPoints = toPoints;

},{"../constant":237,"@antv/util":803}],371:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCoordinateClipCfg = exports.getAngleByPoint = exports.isPointInCoordinate = exports.getDistanceToCenter = exports.isFullCircle = exports.getXDimensionLength = void 0;
var graphics_1 = require("./graphics");
var helper_1 = require("./helper");
/**
 * @ignore
 * Gets x dimension length
 * @param coordinate
 * @returns x dimension length
 */
function getXDimensionLength(coordinate) {
    if (coordinate.isPolar && !coordinate.isTransposed) {
        // 极坐标系下 width 为弧长
        return (coordinate.endAngle - coordinate.startAngle) * coordinate.getRadius();
    }
    // 直角坐标系
    var start = coordinate.convert({ x: 0, y: 0 });
    var end = coordinate.convert({ x: 1, y: 0 });
    // 坐标系有可能发生 transpose 等变换，所有通过两点之间的距离进行计算
    return Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
}
exports.getXDimensionLength = getXDimensionLength;
/**
 * @ignore
 * Determines whether full circle is
 * @param coordinate
 * @returns true if full circle
 */
function isFullCircle(coordinate) {
    if (coordinate.isPolar) {
        var startAngle = coordinate.startAngle, endAngle = coordinate.endAngle;
        return endAngle - startAngle === Math.PI * 2;
    }
    return false;
}
exports.isFullCircle = isFullCircle;
/**
 * @ignore
 * 获取当前点到坐标系圆心的距离
 * @param coordinate 坐标系
 * @param point 当前点
 * @returns distance to center
 */
function getDistanceToCenter(coordinate, point) {
    var center = coordinate.getCenter();
    return Math.sqrt(Math.pow((point.x - center.x), 2) + Math.pow((point.y - center.y), 2));
}
exports.getDistanceToCenter = getDistanceToCenter;
/**
 * @ignore
 * 坐标点是否在坐标系中
 * @param coordinate
 * @param point
 */
function isPointInCoordinate(coordinate, point) {
    var result = false;
    if (coordinate) {
        if (coordinate.type === 'theta') {
            var start = coordinate.start, end = coordinate.end;
            result = helper_1.isBetween(point.x, start.x, end.x) && helper_1.isBetween(point.y, start.y, end.y);
        }
        else {
            var invertPoint = coordinate.invert(point);
            result = helper_1.isBetween(invertPoint.x, 0, 1) && helper_1.isBetween(invertPoint.y, 0, 1);
        }
    }
    return result;
}
exports.isPointInCoordinate = isPointInCoordinate;
/**
 * @ignore
 * 获取点到圆心的连线与水平方向的夹角
 */
function getAngleByPoint(coordinate, point) {
    var center = coordinate.getCenter();
    return Math.atan2(point.y - center.y, point.x - center.x);
}
exports.getAngleByPoint = getAngleByPoint;
/**
 * @ignore
 * 获取同坐标系范围相同的剪切区域
 * @param coordinate
 * @returns
 */
function getCoordinateClipCfg(coordinate, margin) {
    if (margin === void 0) { margin = 0; }
    var start = coordinate.start, end = coordinate.end;
    var width = coordinate.getWidth();
    var height = coordinate.getHeight();
    if (coordinate.isPolar) {
        var startAngle_1 = coordinate.startAngle, endAngle_1 = coordinate.endAngle;
        var center_1 = coordinate.getCenter();
        var radius_1 = coordinate.getRadius();
        return {
            type: 'path',
            startState: {
                path: graphics_1.getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, startAngle_1),
            },
            endState: function (ratio) {
                var diff = (endAngle_1 - startAngle_1) * ratio + startAngle_1;
                var path = graphics_1.getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, diff);
                return {
                    path: path,
                };
            },
            attrs: {
                path: graphics_1.getSectorPath(center_1.x, center_1.y, radius_1 + margin, startAngle_1, endAngle_1),
            },
        };
    }
    var endState;
    if (coordinate.isTransposed) {
        endState = {
            height: height + margin * 2,
        };
    }
    else {
        endState = {
            width: width + margin * 2,
        };
    }
    return {
        type: 'rect',
        startState: {
            x: start.x - margin,
            y: end.y - margin,
            width: coordinate.isTransposed ? width + margin * 2 : 0,
            height: coordinate.isTransposed ? 0 : height + margin * 2,
        },
        endState: endState,
        attrs: {
            x: start.x - margin,
            y: end.y - margin,
            width: width + margin * 2,
            height: height + margin * 2,
        },
    };
}
exports.getCoordinateClipCfg = getCoordinateClipCfg;

},{"./graphics":375,"./helper":377}],372:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTranslateDirection = exports.directionToPosition = void 0;
var constant_1 = require("../constant");
/**
 * @ignore
 * 方位常量转实际的 bbox 位置大小
 * @param parentBBox
 * @param bbox
 * @param direction
 */
function directionToPosition(parentBBox, bbox, direction) {
    if (direction === constant_1.DIRECTION.TOP) {
        return [parentBBox.minX + parentBBox.width / 2 - bbox.width / 2, parentBBox.minY];
    }
    if (direction === constant_1.DIRECTION.BOTTOM) {
        return [parentBBox.minX + parentBBox.width / 2 - bbox.width / 2, parentBBox.maxY - bbox.height];
    }
    if (direction === constant_1.DIRECTION.LEFT) {
        return [parentBBox.minX, parentBBox.minY + parentBBox.height / 2 - bbox.height / 2];
    }
    if (direction === constant_1.DIRECTION.RIGHT) {
        return [parentBBox.maxX - bbox.width, parentBBox.minY + parentBBox.height / 2 - bbox.height / 2];
    }
    if (direction === constant_1.DIRECTION.TOP_LEFT || direction === constant_1.DIRECTION.LEFT_TOP) {
        return [parentBBox.tl.x, parentBBox.tl.y];
    }
    if (direction === constant_1.DIRECTION.TOP_RIGHT || direction === constant_1.DIRECTION.RIGHT_TOP) {
        return [parentBBox.tr.x - bbox.width, parentBBox.tr.y];
    }
    if (direction === constant_1.DIRECTION.BOTTOM_LEFT || direction === constant_1.DIRECTION.LEFT_BOTTOM) {
        return [parentBBox.bl.x, parentBBox.bl.y - bbox.height];
    }
    if (direction === constant_1.DIRECTION.BOTTOM_RIGHT || direction === constant_1.DIRECTION.RIGHT_BOTTOM) {
        return [parentBBox.br.x - bbox.width, parentBBox.br.y - bbox.height];
    }
    return [0, 0];
}
exports.directionToPosition = directionToPosition;
/**
 * get direction after coordinate transpose
 * @param direction
 * @param coordinate
 * @returns direction after transpose or not
 */
function getTransposedDirection(direction, coordinate) {
    if (coordinate.isTransposed) {
        switch (direction) {
            case constant_1.DIRECTION.BOTTOM:
                return constant_1.DIRECTION.LEFT;
            case constant_1.DIRECTION.LEFT:
                return constant_1.DIRECTION.BOTTOM;
            case constant_1.DIRECTION.RIGHT:
                return constant_1.DIRECTION.TOP;
            case constant_1.DIRECTION.TOP:
                return constant_1.DIRECTION.RIGHT;
        }
    }
    return direction;
}
function reflectX(direct) {
    if (direct === constant_1.DIRECTION.LEFT) {
        return constant_1.DIRECTION.RIGHT;
    }
    if (direct === constant_1.DIRECTION.RIGHT) {
        return constant_1.DIRECTION.LEFT;
    }
    return direct;
}
function reflectY(direct) {
    if (direct === constant_1.DIRECTION.TOP) {
        return constant_1.DIRECTION.BOTTOM;
    }
    if (direct === constant_1.DIRECTION.BOTTOM) {
        return constant_1.DIRECTION.TOP;
    }
    return direct;
}
/**
 * get direction after coordinate.scale
 * @param direction
 * @param coordinate
 */
function getScaleDirection(direction, coordinate) {
    var x = coordinate.matrix[0];
    var y = coordinate.matrix[4];
    var d = direction;
    if (x < 0) {
        d = reflectX(d);
    }
    if (y < 0) {
        d = reflectY(d);
    }
    return d;
}
/**
 *
 * @param direction
 * @param coordinate
 */
function getReflectDirection(direction, coordinate) {
    var d = direction;
    if (coordinate.isReflect('x')) {
        d = reflectX(d);
    }
    if (coordinate.isReflect('y')) {
        d = reflectY(d);
    }
    return d;
}
/**
 * @ignore
 * get direction after coordinate translate
 * @param direction
 * @param coordinate
 */
function getTranslateDirection(direction, coordinate) {
    var d = direction;
    d = getTransposedDirection(d, coordinate);
    d = getScaleDirection(d, coordinate);
    d = getReflectDirection(d, coordinate);
    return d;
}
exports.getTranslateDirection = getTranslateDirection;

},{"../constant":237}],373:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeDom = exports.getChartSize = void 0;
var constant_1 = require("../constant");
/**
 * get the element's bounding size
 * @param ele dom element
 * @returns the element width and height
 */
function getElementSize(ele) {
    var style = getComputedStyle(ele);
    return {
        width: (ele.clientWidth || parseInt(style.width, 10)) -
            parseInt(style.paddingLeft, 10) -
            parseInt(style.paddingRight, 10),
        height: (ele.clientHeight || parseInt(style.height, 10)) -
            parseInt(style.paddingTop, 10) -
            parseInt(style.paddingBottom, 10),
    };
}
/**
 * is value a valid number
 * @param v the input value
 * @returns whether it is a number
 */
function isNumber(v) {
    return typeof v === 'number' && !isNaN(v);
}
/**
 * @ignore
 * calculate the chart size
 * @param ele DOM element
 * @param autoFit should auto fit
 * @param width chart width which is set by user
 * @param height chart height which is set by user
 * @returns the chart width and height
 */
function getChartSize(ele, autoFit, width, height) {
    var w = width;
    var h = height;
    if (autoFit) {
        var size = getElementSize(ele);
        w = size.width ? size.width : w;
        h = size.height ? size.height : h;
    }
    return {
        width: Math.max(isNumber(w) ? w : constant_1.MIN_CHART_WIDTH, constant_1.MIN_CHART_WIDTH),
        height: Math.max(isNumber(h) ? h : constant_1.MIN_CHART_HEIGHT, constant_1.MIN_CHART_HEIGHT),
    };
}
exports.getChartSize = getChartSize;
/**
 * @ignore
 * remove html element from its parent
 * @param dom
 */
function removeDom(dom) {
    var parent = dom.parentNode;
    if (parent) {
        parent.removeChild(dom);
    }
}
exports.removeDom = removeDom;
/** @ignore */
var dom_util_1 = require("@antv/dom-util");
Object.defineProperty(exports, "createDom", { enumerable: true, get: function () { return dom_util_1.createDom; } });
Object.defineProperty(exports, "modifyCSS", { enumerable: true, get: function () { return dom_util_1.modifyCSS; } });

},{"../constant":237,"@antv/dom-util":92}],374:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAnglePoint = exports.getFactTitleConfig = void 0;
var constant_1 = require("../constant");
/**
 * @ignore
 * 获取 facet title 的最佳默认配置，防止
 */
function getFactTitleConfig(direction) {
    if ([constant_1.DIRECTION.TOP, constant_1.DIRECTION.BOTTOM].includes(direction)) {
        return {
            offsetX: 0,
            offsetY: direction === constant_1.DIRECTION.TOP ? -8 : 8,
            style: {
                textAlign: 'center',
                textBaseline: direction === constant_1.DIRECTION.TOP ? 'bottom' : 'top',
            },
        };
    }
    if ([constant_1.DIRECTION.LEFT, constant_1.DIRECTION.RIGHT].includes(direction)) {
        return {
            offsetX: direction === constant_1.DIRECTION.LEFT ? -8 : 8,
            offsetY: 0,
            style: {
                textAlign: direction === constant_1.DIRECTION.LEFT ? 'right' : 'left',
                textBaseline: 'middle',
                rotate: Math.PI / 2,
            },
        };
    }
    return {};
}
exports.getFactTitleConfig = getFactTitleConfig;
/**
 * @ignore
 * 根据角度，获取 ○ 上的点
 * @param center
 * @param r
 * @param angle
 */
function getAnglePoint(center, r, angle) {
    return {
        x: center.x + r * Math.cos(angle),
        y: center.y + r * Math.sin(angle),
    };
}
exports.getAnglePoint = getAnglePoint;

},{"../constant":237}],375:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getReplaceAttrs = exports.getPolygonCentroid = exports.getAngle = exports.getArcPath = exports.getSectorPath = exports.polarToCartesian = void 0;
var util_1 = require("@antv/util");
// 获取图形的包围盒
function getPointsBox(points) {
    if (util_1.isEmpty(points)) {
        return null;
    }
    var minX = points[0].x;
    var maxX = points[0].x;
    var minY = points[0].y;
    var maxY = points[0].y;
    util_1.each(points, function (point) {
        minX = minX > point.x ? point.x : minX;
        maxX = maxX < point.x ? point.x : maxX;
        minY = minY > point.y ? point.y : minY;
        maxY = maxY < point.y ? point.y : maxY;
    });
    return {
        minX: minX,
        maxX: maxX,
        minY: minY,
        maxY: maxY,
        centerX: (minX + maxX) / 2,
        centerY: (minY + maxY) / 2,
    };
}
/**
 * @ignore
 * 根据弧度计算极坐标系下的坐标点
 * @param centerX
 * @param centerY
 * @param radius
 * @param angleInRadian
 * @returns
 */
function polarToCartesian(centerX, centerY, radius, angleInRadian) {
    return {
        x: centerX + radius * Math.cos(angleInRadian),
        y: centerY + radius * Math.sin(angleInRadian),
    };
}
exports.polarToCartesian = polarToCartesian;
/**
 * @ignore
 * 根据起始角度计算绘制扇形的 path
 * @param centerX
 * @param centerY
 * @param radius
 * @param startAngleInRadian
 * @param endAngleInRadian
 * @returns
 */
function getSectorPath(centerX, centerY, radius, startAngleInRadian, endAngleInRadian, innerRadius) {
    if (innerRadius === void 0) { innerRadius = 0; }
    var start = polarToCartesian(centerX, centerY, radius, startAngleInRadian);
    var end = polarToCartesian(centerX, centerY, radius, endAngleInRadian);
    var innerStart = polarToCartesian(centerX, centerY, innerRadius, startAngleInRadian);
    var innerEnd = polarToCartesian(centerX, centerY, innerRadius, endAngleInRadian);
    if (endAngleInRadian - startAngleInRadian === Math.PI * 2) {
        // 整个圆是分割成两个圆
        var middlePoint = polarToCartesian(centerX, centerY, radius, startAngleInRadian + Math.PI);
        var innerMiddlePoint = polarToCartesian(centerX, centerY, innerRadius, startAngleInRadian + Math.PI);
        var circlePathCommands = [
            ['M', start.x, start.y],
            ['A', radius, radius, 0, 1, 1, middlePoint.x, middlePoint.y],
            ['A', radius, radius, 0, 1, 1, end.x, end.y],
            ['M', innerStart.x, innerStart.y],
        ];
        if (innerRadius) {
            circlePathCommands.push(['A', innerRadius, innerRadius, 0, 1, 0, innerMiddlePoint.x, innerMiddlePoint.y]);
            circlePathCommands.push(['A', innerRadius, innerRadius, 0, 1, 0, innerEnd.x, innerEnd.y]);
        }
        circlePathCommands.push(['M', start.x, start.y]);
        circlePathCommands.push(['Z']);
        return circlePathCommands;
    }
    var arcSweep = endAngleInRadian - startAngleInRadian <= Math.PI ? 0 : 1;
    var sectorPathCommands = [
        ['M', start.x, start.y],
        ['A', radius, radius, 0, arcSweep, 1, end.x, end.y],
        ['L', innerEnd.x, innerEnd.y],
    ];
    if (innerRadius) {
        sectorPathCommands.push(['A', innerRadius, innerRadius, 0, arcSweep, 0, innerStart.x, innerStart.y]);
    }
    sectorPathCommands.push(['L', start.x, start.y]);
    sectorPathCommands.push(['Z']);
    return sectorPathCommands;
}
exports.getSectorPath = getSectorPath;
/**
 * @ignore
 * Gets arc path
 * @param centerX
 * @param centerY
 * @param radius
 * @param startAngleInRadian
 * @param endAngleInRadian
 * @returns
 */
function getArcPath(centerX, centerY, radius, startAngleInRadian, endAngleInRadian) {
    var start = polarToCartesian(centerX, centerY, radius, startAngleInRadian);
    var end = polarToCartesian(centerX, centerY, radius, endAngleInRadian);
    if (util_1.isNumberEqual(endAngleInRadian - startAngleInRadian, Math.PI * 2)) {
        var middlePoint = polarToCartesian(centerX, centerY, radius, startAngleInRadian + Math.PI);
        return [
            ['M', start.x, start.y],
            ['A', radius, radius, 0, 1, 1, middlePoint.x, middlePoint.y],
            ['A', radius, radius, 0, 1, 1, start.x, start.y],
            ['A', radius, radius, 0, 1, 0, middlePoint.x, middlePoint.y],
            ['A', radius, radius, 0, 1, 0, start.x, start.y],
            ['Z'],
        ];
    }
    var arcSweep = endAngleInRadian - startAngleInRadian <= Math.PI ? 0 : 1;
    return [
        ['M', start.x, start.y],
        ['A', radius, radius, 0, arcSweep, 1, end.x, end.y],
    ];
}
exports.getArcPath = getArcPath;
/**
 * @ignore
 * 从数据模型中的 points 换算角度
 * @param shapeModel
 * @param coordinate
 * @returns
 */
function getAngle(shapeModel, coordinate) {
    var points = shapeModel.points;
    var box = getPointsBox(points);
    var endAngle;
    var startAngle;
    var coordStartAngle = coordinate.startAngle, coordEndAngle = coordinate.endAngle;
    var diffAngle = coordEndAngle - coordStartAngle;
    if (coordinate.isTransposed) {
        endAngle = box.maxY * diffAngle;
        startAngle = box.minY * diffAngle;
    }
    else {
        endAngle = box.maxX * diffAngle;
        startAngle = box.minX * diffAngle;
    }
    endAngle += coordStartAngle;
    startAngle += coordStartAngle;
    return {
        startAngle: startAngle,
        endAngle: endAngle,
    };
}
exports.getAngle = getAngle;
/**
 * @ignore
 * 计算多边形重心: https://en.wikipedia.org/wiki/Centroid#Of_a_polygon
 */
function getPolygonCentroid(xs, ys) {
    if (util_1.isNumber(xs) && util_1.isNumber(ys)) {
        // 普通色块图，xs 和 ys 是数值
        return [xs, ys];
    }
    var i = -1;
    var x = 0;
    var y = 0;
    var former;
    var current = xs.length - 1;
    var diff;
    var k = 0;
    while (++i < xs.length) {
        former = current;
        current = i;
        k += diff = xs[former] * ys[current] - xs[current] * ys[former];
        x += (xs[former] + xs[current]) * diff;
        y += (ys[former] + ys[current]) * diff;
    }
    k *= 3;
    return [x / k, y / k];
}
exports.getPolygonCentroid = getPolygonCentroid;
/**
 * @ignore
 * 获取需要替换的属性，如果原先图形元素存在，而新图形不存在，则设置 undefined
 */
function getReplaceAttrs(sourceShape, targetShape) {
    var originAttrs = sourceShape.attr();
    var newAttrs = targetShape.attr();
    util_1.each(originAttrs, function (v, k) {
        if (newAttrs[k] === undefined) {
            newAttrs[k] = undefined;
        }
    });
    return newAttrs;
}
exports.getReplaceAttrs = getReplaceAttrs;

},{"@antv/util":803}],376:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.showGrid = exports.getCircleGridItems = exports.getLineGridItems = exports.getGridThemeCfg = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * get the grid theme by type
 * @param theme
 * @param direction
 * @returns theme object
 */
function getGridThemeCfg(theme, direction) {
    return util_1.get(theme, ['components', 'axis', direction, 'grid'], {});
}
exports.getGridThemeCfg = getGridThemeCfg;
/**
 * @ignore
 * get axis grid items
 * @param coordinate
 * @param scale
 * @param dim
 * @return items
 */
function getLineGridItems(coordinate, scale, dim, alignTick) {
    var items = [];
    var ticks = scale.getTicks();
    if (coordinate.isPolar) {
        // 补全 ticks
        ticks.push({
            value: 1,
            text: '',
            tickValue: '',
        });
    }
    ticks.reduce(function (preTick, currentTick, currentIndex) {
        var currentValue = currentTick.value;
        if (alignTick) {
            items.push({
                points: [
                    coordinate.convert(dim === 'y' ? { x: 0, y: currentValue } : { x: currentValue, y: 0 }),
                    coordinate.convert(dim === 'y' ? { x: 1, y: currentValue } : { x: currentValue, y: 1 }),
                ],
            });
        }
        else {
            if (currentIndex) {
                var preValue = preTick.value;
                var middleValue = (preValue + currentValue) / 2;
                items.push({
                    points: [
                        coordinate.convert(dim === 'y' ? { x: 0, y: middleValue } : { x: middleValue, y: 0 }),
                        coordinate.convert(dim === 'y' ? { x: 1, y: middleValue } : { x: middleValue, y: 1 }),
                    ],
                });
            }
        }
        return currentTick;
    }, ticks[0]);
    return items;
}
exports.getLineGridItems = getLineGridItems;
/**
 * @ignore
 * get
 * @param coordinate
 * @param xScale
 * @param yScale
 * @param dim
 * @returns items
 */
function getCircleGridItems(coordinate, xScale, yScale, alignTick, dim) {
    var count = xScale.values.length;
    var items = [];
    var ticks = yScale.getTicks();
    ticks.reduce(function (preTick, currentTick) {
        var preValue = preTick ? preTick.value : currentTick.value; // 只有一项数据时取当前值
        var currentValue = currentTick.value;
        var middleValue = (preValue + currentValue) / 2;
        if (dim === 'x') {
            // 如果是 x 轴作为半径轴，那么只需要取圆弧收尾两个即可
            items.push({
                points: [
                    coordinate.convert({
                        x: alignTick ? currentValue : middleValue,
                        y: 0,
                    }),
                    coordinate.convert({
                        x: alignTick ? currentValue : middleValue,
                        y: 1,
                    }),
                ],
            });
        }
        else {
            items.push({
                points: util_1.map(Array(count + 1), function (__, idx) {
                    return coordinate.convert({
                        x: idx / count,
                        y: alignTick ? currentValue : middleValue,
                    });
                }),
            });
        }
        return currentTick;
    }, ticks[0]);
    return items;
}
exports.getCircleGridItems = getCircleGridItems;
/**
 * @ignore
 * show grid or not
 * @param axisTheme
 * @param axisOption
 */
function showGrid(axisTheme, axisOption) {
    var userGrid = util_1.get(axisOption, 'grid');
    if (userGrid === null) {
        return false;
    }
    var themeGrid = util_1.get(axisTheme, 'grid');
    return !(userGrid === undefined && themeGrid === null);
}
exports.showGrid = showGrid;

},{"@antv/util":803}],377:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uniq = exports.omit = exports.padEnd = exports.isBetween = void 0;
var util_1 = require("@antv/util");
/**
 * @ignore
 * Determines whether between is
 * @param value
 * @param start
 * @param end
 * @returns true if between
 */
function isBetween(value, start, end) {
    var min = Math.min(start, end);
    var max = Math.max(start, end);
    return value >= min && value <= max;
}
exports.isBetween = isBetween;
/**
 * @ignore
 * pads the current string/array with a given value (repeated, if needed) so that the resulting reaches a given length.
 * The padding is applied from the end of the current value.
 *
 * @param source
 * @param targetLength
 * @param padValue
 * @returns
 */
function padEnd(source, targetLength, padValue) {
    if (util_1.isString(source)) {
        return source.padEnd(targetLength, padValue);
    }
    else if (util_1.isArray(source)) {
        var sourceLength = source.length;
        if (sourceLength < targetLength) {
            var diff = targetLength - sourceLength;
            for (var i = 0; i < diff; i++) {
                source.push(padValue);
            }
        }
    }
    return source;
}
exports.padEnd = padEnd;
/**
 * @ignore
 * omit keys of an object.
 * @param obj
 * @param keys
 */
function omit(obj, keys) {
    keys.forEach(function (key) {
        delete obj[key];
    });
    return obj;
}
exports.omit = omit;
/**
 * @ignore
 * @param sourceArray
 * @param targetArray
 * @param map
 */
function uniq(sourceArray, targetArray, map) {
    if (targetArray === void 0) { targetArray = []; }
    if (map === void 0) { map = {}; }
    for (var _i = 0, sourceArray_1 = sourceArray; _i < sourceArray_1.length; _i++) {
        var source = sourceArray_1[_i];
        if (!map[source]) {
            targetArray.push(source);
            map[source] = true;
        }
    }
    return targetArray;
}
exports.uniq = uniq;

},{"@antv/util":803}],378:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCustomLegendItems = exports.getLegendItems = exports.getLegendLayout = void 0;
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var attr_1 = require("./attr");
var marker_1 = require("./marker");
function setMarkerSymbol(marker) {
    var symbol = marker.symbol;
    if (util_1.isString(symbol) && marker_1.MarkerSymbols[symbol]) {
        marker.symbol = marker_1.MarkerSymbols[symbol];
    }
}
/**
 * @ignore
 * get the legend layout from direction
 * @param direction
 * @returns layout 'horizontal' | 'vertical'
 */
function getLegendLayout(direction) {
    return direction.startsWith(constant_1.DIRECTION.LEFT) || direction.startsWith(constant_1.DIRECTION.RIGHT) ? 'vertical' : 'horizontal';
}
exports.getLegendLayout = getLegendLayout;
/**
 * @ignore
 * get the legend items
 * @param view
 * @param geometry
 * @param attr
 * @param themeMarker
 * @param userMarker
 * @returns legend items
 */
function getLegendItems(view, geometry, attr, themeMarker, userMarker) {
    var scale = attr.getScale(attr.type);
    if (scale.isCategory) {
        var field_1 = scale.field;
        var colorAttr_1 = geometry.getAttribute('color');
        var shapeAttr_1 = geometry.getAttribute('shape');
        var defaultColor_1 = view.getTheme().defaultColor;
        var isInPolar_1 = geometry.coordinate.isPolar;
        return scale.getTicks().map(function (tick) {
            var _a;
            var text = tick.text, scaleValue = tick.value;
            var name = text;
            var value = scale.invert(scaleValue);
            // 通过过滤图例项的数据，来看是否 unchecked
            var unchecked = view.filterFieldData(field_1, [(_a = {}, _a[field_1] = value, _a)]).length === 0;
            // @ts-ignore
            var color = attr_1.getMappingValue(colorAttr_1, value, defaultColor_1);
            var shape = attr_1.getMappingValue(shapeAttr_1, value, 'point');
            var marker = geometry.getShapeMarker(shape, {
                color: color,
                isInPolar: isInPolar_1,
            });
            // the marker configure order should be ensure
            marker = util_1.deepMix({}, themeMarker, marker, userMarker);
            setMarkerSymbol(marker);
            return { id: value, name: name, value: value, marker: marker, unchecked: unchecked };
        });
    }
    return [];
}
exports.getLegendItems = getLegendItems;
/**
 * @ignore
 * custom legend 的 items 获取
 * @param themeMarker
 * @param userMarker
 * @param customItems
 */
function getCustomLegendItems(themeMarker, userMarker, customItems) {
    // 如果有自定义的 item，那么就直接使用，并合并主题的 marker 配置
    return customItems.map(function (item) {
        var marker = util_1.deepMix({}, themeMarker, userMarker, item.marker);
        setMarkerSymbol(marker);
        item.marker = marker;
        return item;
    });
}
exports.getCustomLegendItems = getCustomLegendItems;

},{"../constant":237,"./attr":368,"./marker":379,"@antv/util":803}],379:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkerSymbols = void 0;
/** @ignore */
exports.MarkerSymbols = {
    hexagon: function (x, y, r) {
        var diffX = (r / 2) * Math.sqrt(3);
        return [
            ['M', x, y - r],
            ['L', x + diffX, y - r / 2],
            ['L', x + diffX, y + r / 2],
            ['L', x, y + r],
            ['L', x - diffX, y + r / 2],
            ['L', x - diffX, y - r / 2],
            ['Z'],
        ];
    },
    bowtie: function (x, y, r) {
        var diffY = r - 1.5;
        return [['M', x - r, y - diffY], ['L', x + r, y + diffY], ['L', x + r, y - diffY], ['L', x - r, y + diffY], ['Z']];
    },
    cross: function (x, y, r) {
        return [
            ['M', x - r, y - r],
            ['L', x + r, y + r],
            ['M', x + r, y - r],
            ['L', x - r, y + r],
        ];
    },
    tick: function (x, y, r) {
        return [
            ['M', x - r / 2, y - r],
            ['L', x + r / 2, y - r],
            ['M', x, y - r],
            ['L', x, y + r],
            ['M', x - r / 2, y + r],
            ['L', x + r / 2, y + r],
        ];
    },
    plus: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['L', x + r, y],
            ['M', x, y - r],
            ['L', x, y + r],
        ];
    },
    hyphen: function (x, y, r) {
        return [
            ['M', x - r, y],
            ['L', x + r, y],
        ];
    },
    line: function (x, y, r) {
        return [
            ['M', x, y - r],
            ['L', x, y + r],
        ];
    },
};

},{}],380:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePadding = exports.isAutoPadding = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
/**
 * @ignore
 * 是否是自动 padding
 * @param padding
 */
function isAutoPadding(padding) {
    return !util_1.isNumber(padding) && !util_1.isArray(padding);
}
exports.isAutoPadding = isAutoPadding;
/**
 * @ignore
 * padding 的解析逻辑
 * @param padding
 * @return [ top, right, bottom, left ]
 */
function parsePadding(padding) {
    if (padding === void 0) { padding = 0; }
    var paddingArray = util_1.isArray(padding) ? padding : [padding];
    switch (paddingArray.length) {
        case 0:
            paddingArray = [0, 0, 0, 0];
            break;
        case 1:
            paddingArray = new Array(4).fill(paddingArray[0]);
            break;
        case 2:
            paddingArray = tslib_1.__spreadArrays(paddingArray, paddingArray);
            break;
        case 3:
            paddingArray = tslib_1.__spreadArrays(paddingArray, [paddingArray[1]]);
            break;
        default:
            // 其他情况，只去四个
            paddingArray = paddingArray.slice(0, 4);
            break;
    }
    return paddingArray;
}
exports.parsePadding = parsePadding;

},{"@antv/util":803,"tslib":385}],381:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getName = exports.syncScale = exports.createScaleByField = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../dependents");
var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]+)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
/**
 * 获取字段对应数据的类型
 * @param field 数据字段名
 * @param data 数据源
 * @returns default type 返回对应的数据类型
 */
function getDefaultType(value) {
    var type = 'linear';
    if (dateRegex.test(value)) {
        type = 'time';
    }
    else if (util_1.isString(value)) {
        type = 'cat';
    }
    return type;
}
/**
 * @ignore
 * 为指定的 `field` 字段数据创建 scale
 * @param field 字段名
 * @param [data] 数据集，可为空
 * @param [scaleDef] 列定义，可为空
 * @returns scale 返回创建的 Scale 实例
 */
function createScaleByField(field, data, scaleDef) {
    var validData = data || [];
    if (util_1.isNumber(field) || (util_1.isNil(util_1.firstValue(validData, field)) && util_1.isEmpty(scaleDef))) {
        var Identity = dependents_1.getScale('identity');
        return new Identity({
            field: field.toString(),
            values: [field],
        });
    }
    var values = util_1.valuesOfKey(validData, field);
    // 如果已经定义过这个度量
    var type = util_1.get(scaleDef, 'type', getDefaultType(values[0]));
    var ScaleCtor = dependents_1.getScale(type);
    return new ScaleCtor(tslib_1.__assign({ field: field,
        values: values }, scaleDef));
}
exports.createScaleByField = createScaleByField;
/**
 * @ignore
 * 同步 scale
 * @todo 是否可以通过 scale.update() 方法进行更新
 * @param scale 需要同步的 scale 实例
 * @param newScale 同步源 Scale
 */
function syncScale(scale, newScale) {
    if (scale.type !== 'identity' && newScale.type !== 'identity') {
        var obj = {};
        for (var k in newScale) {
            if (Object.prototype.hasOwnProperty.call(newScale, k)) {
                obj[k] = newScale[k];
            }
        }
        scale.change(obj);
    }
}
exports.syncScale = syncScale;
/**
 * @ignore
 * get the scale name, if alias exist, return alias, or else field
 * @param scale
 * @returns the name of field
 */
function getName(scale) {
    return scale.alias || scale.field;
}
exports.getName = getName;

},{"../dependents":239,"@antv/util":803,"tslib":385}],382:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createThemeByStylesheet = void 0;
var tslib_1 = require("tslib");
var TOOLTIP_CSS_CONST = tslib_1.__importStar(require("@antv/component/lib/tooltip/css-const"));
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var graphics_1 = require("../util/graphics");
/**
 * 根据主题样式表生成主题结构
 * @param styleSheet 主题样式表
 */
function createThemeByStylesheet(styleSheet) {
    var _a;
    var shapeStyles = {
        point: {
            default: {
                fill: styleSheet.pointFillColor,
                r: styleSheet.pointSize,
                stroke: styleSheet.pointBorderColor,
                lineWidth: styleSheet.pointBorder,
                fillOpacity: styleSheet.pointFillOpacity,
            },
            active: {
                stroke: styleSheet.pointActiveBorderColor,
                lineWidth: styleSheet.pointActiveBorder,
            },
            selected: {
                stroke: styleSheet.pointSelectedBorderColor,
                lineWidth: styleSheet.pointSelectedBorder,
            },
            inactive: {
                fillOpacity: styleSheet.pointInactiveFillOpacity,
                strokeOpacity: styleSheet.pointInactiveBorderOpacity,
            },
        },
        hollowPoint: {
            default: {
                fill: styleSheet.hollowPointFillColor,
                lineWidth: styleSheet.hollowPointBorder,
                stroke: styleSheet.hollowPointBorderColor,
                strokeOpacity: styleSheet.hollowPointBorderOpacity,
                r: styleSheet.hollowPointSize,
            },
            active: {
                stroke: styleSheet.hollowPointActiveBorderColor,
                strokeOpacity: styleSheet.hollowPointActiveBorderOpacity,
            },
            selected: {
                lineWidth: styleSheet.hollowPointSelectedBorder,
                stroke: styleSheet.hollowPointSelectedBorderColor,
                strokeOpacity: styleSheet.hollowPointSelectedBorderOpacity,
            },
            inactive: {
                strokeOpacity: styleSheet.hollowPointInactiveBorderOpacity,
            },
        },
        area: {
            default: {
                fill: styleSheet.areaFillColor,
                fillOpacity: styleSheet.areaFillOpacity,
                stroke: null,
            },
            active: {
                fillOpacity: styleSheet.areaActiveFillOpacity,
            },
            selected: {
                fillOpacity: styleSheet.areaSelectedFillOpacity,
            },
            inactive: {
                fillOpacity: styleSheet.areaInactiveFillOpacity,
            },
        },
        hollowArea: {
            default: {
                fill: null,
                stroke: styleSheet.hollowAreaBorderColor,
                lineWidth: styleSheet.hollowAreaBorder,
                strokeOpacity: styleSheet.hollowAreaBorderOpacity,
            },
            active: {
                fill: null,
                lineWidth: styleSheet.hollowAreaActiveBorder,
            },
            selected: {
                fill: null,
                lineWidth: styleSheet.hollowAreaSelectedBorder,
            },
            inactive: {
                strokeOpacity: styleSheet.hollowAreaInactiveBorderOpacity,
            },
        },
        interval: {
            default: {
                fill: styleSheet.intervalFillColor,
                fillOpacity: styleSheet.intervalFillOpacity,
            },
            active: {
                stroke: styleSheet.intervalActiveBorderColor,
                lineWidth: styleSheet.intervalActiveBorder,
            },
            selected: {
                stroke: styleSheet.intervalSelectedBorderColor,
                lineWidth: styleSheet.intervalSelectedBorder,
            },
            inactive: {
                fillOpacity: styleSheet.intervalInactiveFillOpacity,
                strokeOpacity: styleSheet.intervalInactiveBorderOpacity,
            },
        },
        hollowInterval: {
            default: {
                fill: styleSheet.hollowIntervalFillColor,
                stroke: styleSheet.hollowIntervalBorderColor,
                lineWidth: styleSheet.hollowIntervalBorder,
                strokeOpacity: styleSheet.hollowIntervalBorderOpacity,
            },
            active: {
                stroke: styleSheet.hollowIntervalActiveBorderColor,
                lineWidth: styleSheet.hollowIntervalActiveBorder,
                strokeOpacity: styleSheet.hollowIntervalActiveBorderOpacity,
            },
            selected: {
                stroke: styleSheet.hollowIntervalSelectedBorderColor,
                lineWidth: styleSheet.hollowIntervalSelectedBorder,
                strokeOpacity: styleSheet.hollowIntervalSelectedBorderOpacity,
            },
            inactive: {
                stroke: styleSheet.hollowIntervalInactiveBorderColor,
                lineWidth: styleSheet.hollowIntervalInactiveBorder,
                strokeOpacity: styleSheet.hollowIntervalInactiveBorderOpacity,
            },
        },
        line: {
            default: {
                stroke: styleSheet.lineBorderColor,
                lineWidth: styleSheet.lineBorder,
                strokeOpacity: styleSheet.lineBorderOpacity,
                fill: null,
                lineAppendWidth: 10,
            },
            active: {
                lineWidth: styleSheet.lineActiveBorder,
            },
            selected: {
                lineWidth: styleSheet.lineSelectedBorder,
            },
            inactive: {
                strokeOpacity: styleSheet.lineInactiveBorderOpacity,
            },
        },
    };
    var axisStyles = {
        title: {
            autoRotate: true,
            position: 'center',
            style: {
                fill: styleSheet.axisTitleTextFillColor,
                fontSize: styleSheet.axisTitleTextFontSize,
                lineHeight: styleSheet.axisTitleTextLineHeight,
                textBaseline: 'middle',
                fontFamily: styleSheet.fontFamily,
            },
        },
        label: {
            autoRotate: true,
            autoEllipsis: true,
            autoHide: true,
            offset: 16,
            style: {
                fill: styleSheet.axisLabelFillColor,
                fontSize: styleSheet.axisLabelFontSize,
                lineHeight: styleSheet.axisLabelLineHeight,
                textBaseline: 'middle',
                fontFamily: styleSheet.fontFamily,
            },
        },
        line: {
            style: {
                lineWidth: styleSheet.axisLineBorder,
                stroke: styleSheet.axisLineBorderColor,
            },
        },
        tickLine: {
            style: {
                lineWidth: styleSheet.axisTickLineBorder,
                stroke: styleSheet.axisTickLineBorderColor,
            },
            alignTick: true,
            length: styleSheet.axisTickLineLength,
        },
        subTickLine: null,
        animate: true,
    };
    var axisGridStyles = {
        line: {
            type: 'line',
            style: {
                stroke: styleSheet.axisGridBorderColor,
                lineWidth: styleSheet.axisGridBorder,
                lineDash: styleSheet.axisGridLineDash,
            },
        },
        alignTick: true,
        animate: true,
    };
    var legendStyles = {
        title: null,
        marker: {
            symbol: 'circle',
            style: {
                r: styleSheet.legendCircleMarkerSize,
                fill: styleSheet.legendMarkerColor,
            },
        },
        itemName: {
            spacing: 5,
            style: {
                fill: styleSheet.legendItemNameFillColor,
                fontFamily: styleSheet.fontFamily,
                fontSize: styleSheet.legendItemNameFontSize,
                lineHeight: styleSheet.legendItemNameLineHeight,
                fontWeight: styleSheet.legendItemNameFontWeight,
                textAlign: 'start',
                textBaseline: 'middle',
            },
        },
        flipPage: true,
        animate: false,
        maxItemWidth: 0.2,
    };
    return {
        background: styleSheet.backgroundColor,
        defaultColor: styleSheet.brandColor,
        padding: 'auto',
        fontFamily: styleSheet.fontFamily,
        /** 一般柱状图宽度占比 */
        columnWidthRatio: 1 / 2,
        /** 柱状图最大宽度 */
        maxColumnWidth: null,
        /** 柱状图最小宽度 */
        minColumnWidth: null,
        /** 玫瑰图占比 */
        roseWidthRatio: 0.9999999,
        /** 多层饼图/环图占比 */
        multiplePieWidthRatio: 1 / 1.3,
        colors10: styleSheet.paletteQualitative10,
        colors20: styleSheet.paletteQualitative20,
        shapes: {
            point: [
                'hollow-circle',
                'hollow-square',
                'hollow-bowtie',
                'hollow-diamond',
                'hollow-hexagon',
                'hollow-triangle',
                'hollow-triangle-down',
                'circle',
                'square',
                'bowtie',
                'diamond',
                'hexagon',
                'triangle',
                'triangle-down',
                'cross',
                'tick',
                'plus',
                'hyphen',
                'line',
            ],
            line: ['line', 'dash', 'dot', 'smooth'],
            area: ['area', 'smooth', 'line', 'smooth-line'],
            interval: ['rect', 'hollow-rect', 'line', 'tick'],
        },
        sizes: [1, 10],
        geometries: {
            interval: {
                rect: {
                    default: {
                        style: shapeStyles.interval.default,
                    },
                    active: {
                        style: shapeStyles.interval.active,
                    },
                    inactive: {
                        style: shapeStyles.interval.inactive,
                    },
                    selected: {
                        style: function (element) {
                            var coordinate = element.geometry.coordinate;
                            if (coordinate.isPolar && coordinate.isTransposed) {
                                var _a = graphics_1.getAngle(element.getModel(), coordinate), startAngle = _a.startAngle, endAngle = _a.endAngle;
                                var middleAngle = (startAngle + endAngle) / 2;
                                var r = 7.5;
                                var x = r * Math.cos(middleAngle);
                                var y = r * Math.sin(middleAngle);
                                return {
                                    matrix: matrix_util_1.ext.transform(null, [['t', x, y]]),
                                };
                            }
                            return shapeStyles.interval.selected;
                        },
                    },
                },
                'hollow-rect': {
                    default: {
                        style: shapeStyles.hollowInterval.default,
                    },
                    active: {
                        style: shapeStyles.hollowInterval.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowInterval.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowInterval.selected,
                    },
                },
                line: {
                    default: {
                        style: shapeStyles.hollowInterval.default,
                    },
                    active: {
                        style: shapeStyles.hollowInterval.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowInterval.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowInterval.selected,
                    },
                },
                tick: {
                    default: {
                        style: shapeStyles.hollowInterval.default,
                    },
                    active: {
                        style: shapeStyles.hollowInterval.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowInterval.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowInterval.selected,
                    },
                },
                funnel: {
                    default: {
                        style: shapeStyles.interval.default,
                    },
                    active: {
                        style: shapeStyles.interval.active,
                    },
                    inactive: {
                        style: shapeStyles.interval.inactive,
                    },
                    selected: {
                        style: shapeStyles.interval.selected,
                    },
                },
                pyramid: {
                    default: {
                        style: shapeStyles.interval.default,
                    },
                    active: {
                        style: shapeStyles.interval.active,
                    },
                    inactive: {
                        style: shapeStyles.interval.inactive,
                    },
                    selected: {
                        style: shapeStyles.interval.selected,
                    },
                },
            },
            line: {
                line: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                dot: {
                    default: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.default), { lineDash: [1, 1] }),
                    },
                    active: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.active), { lineDash: [1, 1] }),
                    },
                    inactive: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.inactive), { lineDash: [1, 1] }),
                    },
                    selected: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.selected), { lineDash: [1, 1] }),
                    },
                },
                dash: {
                    default: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.default), { lineDash: [5.5, 1] }),
                    },
                    active: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.active), { lineDash: [5.5, 1] }),
                    },
                    inactive: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.inactive), { lineDash: [5.5, 1] }),
                    },
                    selected: {
                        style: tslib_1.__assign(tslib_1.__assign({}, shapeStyles.line.selected), { lineDash: [5.5, 1] }),
                    },
                },
                smooth: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                hv: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                vh: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                hvh: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                vhv: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
            },
            polygon: {
                polygon: {
                    default: {
                        style: shapeStyles.interval.default,
                    },
                    active: {
                        style: shapeStyles.interval.active,
                    },
                    inactive: {
                        style: shapeStyles.interval.inactive,
                    },
                    selected: {
                        style: shapeStyles.interval.selected,
                    },
                },
            },
            point: {
                circle: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                square: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                bowtie: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                diamond: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                hexagon: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                triangle: {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                'triangle-down': {
                    default: {
                        style: shapeStyles.point.default,
                    },
                    active: {
                        style: shapeStyles.point.active,
                    },
                    inactive: {
                        style: shapeStyles.point.inactive,
                    },
                    selected: {
                        style: shapeStyles.point.selected,
                    },
                },
                'hollow-circle': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-square': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-bowtie': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-diamond': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-hexagon': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-triangle': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                'hollow-triangle-down': {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                cross: {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                tick: {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                plus: {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                hyphen: {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
                line: {
                    default: {
                        style: shapeStyles.hollowPoint.default,
                    },
                    active: {
                        style: shapeStyles.hollowPoint.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowPoint.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowPoint.selected,
                    },
                },
            },
            area: {
                area: {
                    default: {
                        style: shapeStyles.area.default,
                    },
                    active: {
                        style: shapeStyles.area.active,
                    },
                    inactive: {
                        style: shapeStyles.area.inactive,
                    },
                    selected: {
                        style: shapeStyles.area.selected,
                    },
                },
                smooth: {
                    default: {
                        style: shapeStyles.area.default,
                    },
                    active: {
                        style: shapeStyles.area.active,
                    },
                    inactive: {
                        style: shapeStyles.area.inactive,
                    },
                    selected: {
                        style: shapeStyles.area.selected,
                    },
                },
                line: {
                    default: {
                        style: shapeStyles.hollowArea.default,
                    },
                    active: {
                        style: shapeStyles.hollowArea.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowArea.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowArea.selected,
                    },
                },
                'smooth-line': {
                    default: {
                        style: shapeStyles.hollowArea.default,
                    },
                    active: {
                        style: shapeStyles.hollowArea.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowArea.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowArea.selected,
                    },
                },
            },
            schema: {
                candle: {
                    default: {
                        style: shapeStyles.hollowInterval.default,
                    },
                    active: {
                        style: shapeStyles.hollowInterval.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowInterval.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowInterval.selected,
                    },
                },
                box: {
                    default: {
                        style: shapeStyles.hollowInterval.default,
                    },
                    active: {
                        style: shapeStyles.hollowInterval.active,
                    },
                    inactive: {
                        style: shapeStyles.hollowInterval.inactive,
                    },
                    selected: {
                        style: shapeStyles.hollowInterval.selected,
                    },
                },
            },
            edge: {
                line: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                vhv: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                smooth: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
                arc: {
                    default: {
                        style: shapeStyles.line.default,
                    },
                    active: {
                        style: shapeStyles.line.active,
                    },
                    inactive: {
                        style: shapeStyles.line.inactive,
                    },
                    selected: {
                        style: shapeStyles.line.selected,
                    },
                },
            },
        },
        components: {
            axis: {
                top: util_1.deepMix({}, axisStyles, {
                    position: 'top',
                    grid: null,
                    title: null,
                    verticalLimitLength: 1 / 2,
                }),
                bottom: util_1.deepMix({}, axisStyles, {
                    position: 'bottom',
                    grid: null,
                    title: null,
                    verticalLimitLength: 1 / 2,
                }),
                left: util_1.deepMix({}, axisStyles, {
                    position: 'left',
                    label: {
                        offset: 8,
                    },
                    title: null,
                    line: null,
                    tickLine: null,
                    grid: axisGridStyles,
                    verticalLimitLength: 1 / 3,
                }),
                right: util_1.deepMix({}, axisStyles, {
                    position: 'right',
                    label: {
                        offset: 8,
                    },
                    title: null,
                    line: null,
                    tickLine: null,
                    grid: axisGridStyles,
                    verticalLimitLength: 1 / 3,
                }),
                circle: util_1.deepMix({}, axisStyles, {
                    title: null,
                    label: {
                        offset: 8,
                    },
                    grid: util_1.deepMix({}, axisGridStyles, { line: { type: 'line' } }),
                }),
                radius: util_1.deepMix({}, axisStyles, {
                    title: null,
                    label: {
                        offset: 8,
                    },
                    grid: util_1.deepMix({}, axisGridStyles, { line: { type: 'circle' } }),
                }),
            },
            legend: {
                right: util_1.deepMix({}, legendStyles, {
                    layout: 'vertical',
                }),
                left: util_1.deepMix({}, legendStyles, {
                    layout: 'vertical',
                }),
                top: util_1.deepMix({}, legendStyles, {
                    layout: 'horizontal',
                }),
                bottom: util_1.deepMix({}, legendStyles, {
                    layout: 'horizontal',
                }),
                continuous: {
                    title: null,
                    background: null,
                    track: {},
                    rail: {
                        type: 'color',
                        size: styleSheet.sliderRailHeight,
                        defaultLength: styleSheet.sliderRailWidth,
                        style: {
                            fill: styleSheet.sliderRailFillColor,
                            stroke: styleSheet.sliderRailBorderColor,
                            lineWidth: styleSheet.sliderRailBorder,
                        },
                    },
                    label: {
                        align: 'rail',
                        spacing: 4,
                        formatter: null,
                        style: {
                            fill: styleSheet.sliderLabelTextFillColor,
                            fontSize: styleSheet.sliderLabelTextFontSize,
                            lineHeight: styleSheet.sliderLabelTextLineHeight,
                            textBaseline: 'middle',
                            fontFamily: styleSheet.fontFamily,
                        },
                    },
                    handler: {
                        size: styleSheet.sliderHandlerWidth,
                        style: {
                            fill: styleSheet.sliderHandlerFillColor,
                            stroke: styleSheet.sliderHandlerBorderColor,
                        },
                    },
                    slidable: true,
                },
                // 图例与四条边之间的间距
                margin: [0, 0, 0, 0],
            },
            tooltip: {
                showContent: true,
                follow: true,
                showCrosshairs: false,
                showMarkers: true,
                shared: false,
                enterable: false,
                position: 'auto',
                marker: {
                    symbol: 'circle',
                    stroke: '#fff',
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowOffSetY: 0,
                    shadowColor: 'rgba(0,0,0,0.09)',
                    lineWidth: 2,
                    r: 4,
                },
                crosshairs: {
                    line: {
                        style: {
                            stroke: styleSheet.tooltipCrosshairsBorderColor,
                            lineWidth: styleSheet.tooltipCrosshairsBorder,
                        },
                    },
                    text: null,
                    textBackground: {
                        padding: 2,
                        style: {
                            fill: 'rgba(0, 0, 0, 0.25)',
                            lineWidth: 0,
                            stroke: null,
                        },
                    },
                    follow: false,
                },
                // tooltip dom 样式
                domStyles: (_a = {},
                    _a["" + TOOLTIP_CSS_CONST.CONTAINER_CLASS] = {
                        position: 'absolute',
                        visibility: 'hidden',
                        zIndex: 8,
                        transition: 'left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s',
                        backgroundColor: styleSheet.tooltipContainerFillColor,
                        opacity: styleSheet.tooltipContainerFillOpacity,
                        boxShadow: styleSheet.tooltipContainerShadow,
                        borderRadius: styleSheet.tooltipContainerBorderRadius + "px",
                        color: styleSheet.tooltipTextFillColor,
                        fontSize: styleSheet.tooltipTextFontSize + "px",
                        fontFamily: styleSheet.fontFamily,
                        lineHeight: styleSheet.tooltipTextLineHeight + "px",
                        padding: '0 12px 0 12px',
                    },
                    _a["" + TOOLTIP_CSS_CONST.TITLE_CLASS] = {
                        marginBottom: '12px',
                        marginTop: '12px',
                    },
                    _a["" + TOOLTIP_CSS_CONST.LIST_CLASS] = {
                        margin: 0,
                        listStyleType: 'none',
                        padding: 0,
                    },
                    _a["" + TOOLTIP_CSS_CONST.LIST_ITEM_CLASS] = {
                        listStyleType: 'none',
                        padding: 0,
                        marginBottom: '12px',
                        marginTop: '12px',
                        marginLeft: 0,
                        marginRight: 0,
                    },
                    _a["" + TOOLTIP_CSS_CONST.MARKER_CLASS] = {
                        width: '8px',
                        height: '8px',
                        borderRadius: '50%',
                        display: 'inline-block',
                        marginRight: '8px',
                    },
                    _a["" + TOOLTIP_CSS_CONST.VALUE_CLASS] = {
                        display: 'inline-block',
                        float: 'right',
                        marginLeft: '30px',
                    },
                    _a),
            },
            annotation: {
                arc: {
                    style: {
                        stroke: styleSheet.annotationArcBorderColor,
                        lineWidth: styleSheet.annotationArcBorder,
                    },
                    animate: true,
                },
                line: {
                    style: {
                        stroke: styleSheet.annotationLineBorderColor,
                        lineDash: styleSheet.annotationLineDash,
                        lineWidth: styleSheet.annotationLineBorder,
                    },
                    text: {
                        position: 'start',
                        autoRotate: true,
                        style: {
                            fill: styleSheet.annotationTextFillColor,
                            stroke: styleSheet.annotationTextBorderColor,
                            lineWidth: styleSheet.annotationTextBorder,
                            fontSize: styleSheet.annotationTextFontSize,
                            textAlign: 'start',
                            fontFamily: styleSheet.fontFamily,
                            textBaseline: 'bottom',
                        },
                    },
                    animate: true,
                },
                text: {
                    style: {
                        fill: styleSheet.annotationTextFillColor,
                        stroke: styleSheet.annotationTextBorderColor,
                        lineWidth: styleSheet.annotationTextBorder,
                        fontSize: styleSheet.annotationTextFontSize,
                        textBaseline: 'middle',
                        textAlign: 'start',
                        fontFamily: styleSheet.fontFamily,
                    },
                    animate: true,
                },
                region: {
                    top: false,
                    style: {
                        lineWidth: styleSheet.annotationRegionBorder,
                        stroke: styleSheet.annotationRegionBorderColor,
                        fill: styleSheet.annotationRegionFillColor,
                        fillOpacity: styleSheet.annotationRegionFillOpacity,
                    },
                    animate: true,
                },
                image: {
                    top: false,
                    animate: true,
                },
                dataMarker: {
                    top: true,
                    point: {
                        style: {
                            r: 3,
                            stroke: styleSheet.brandColor,
                            lineWidth: 2,
                        },
                    },
                    line: {
                        style: {
                            stroke: styleSheet.annotationLineBorderColor,
                            lineWidth: styleSheet.annotationLineBorder,
                        },
                        length: styleSheet.annotationDataMarkerLineLength,
                    },
                    text: {
                        style: {
                            textAlign: 'start',
                            fill: styleSheet.annotationTextFillColor,
                            stroke: styleSheet.annotationTextBorderColor,
                            lineWidth: styleSheet.annotationTextBorder,
                            fontSize: styleSheet.annotationTextFontSize,
                            fontFamily: styleSheet.fontFamily,
                        },
                    },
                    direction: 'upward',
                    autoAdjust: true,
                    animate: true,
                },
                dataRegion: {
                    style: {
                        region: {
                            fill: styleSheet.annotationRegionFillColor,
                            fillOpacity: styleSheet.annotationRegionFillOpacity,
                        },
                        text: {
                            textAlign: 'center',
                            textBaseline: 'bottom',
                            fill: styleSheet.annotationTextFillColor,
                            stroke: styleSheet.annotationTextBorderColor,
                            lineWidth: styleSheet.annotationTextBorder,
                            fontSize: styleSheet.annotationTextFontSize,
                            fontFamily: styleSheet.fontFamily,
                        },
                    },
                    animate: true,
                },
            },
        },
        labels: {
            offset: 12,
            style: {
                fill: styleSheet.labelFillColor,
                fontSize: styleSheet.labelFontSize,
                fontFamily: styleSheet.fontFamily,
                stroke: styleSheet.labelBorderColor,
                lineWidth: styleSheet.labelBorder,
            },
            autoRotate: true,
        },
        innerLabels: {
            style: {
                fill: styleSheet.innerLabelFillColor,
                fontSize: styleSheet.innerLabelFontSize,
                fontFamily: styleSheet.fontFamily,
                stroke: styleSheet.innerLabelBorderColor,
                lineWidth: styleSheet.innerLabelBorder,
            },
            autoRotate: true,
        },
        pieLabels: {
            labelHeight: 14,
            offset: 30,
            labelLine: {
                style: {
                    lineWidth: styleSheet.labelLineBorder,
                },
            },
            autoRotate: true,
        },
    };
}
exports.createThemeByStylesheet = createThemeByStylesheet;

},{"../util/graphics":375,"@antv/component/lib/tooltip/css-const":62,"@antv/matrix-util":717,"@antv/util":803,"tslib":385}],383:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTooltipItems = exports.findDataByPoint = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var constant_1 = require("../constant");
var scale_1 = require("./scale");
function snapEqual(v1, v2, scale) {
    var value1 = scale.translate(v1);
    var value2 = scale.translate(v2);
    return util_1.isNumberEqual(value1, value2);
}
function getXValueByPoint(point, geometry) {
    var coordinate = geometry.coordinate;
    var xScale = geometry.getXScale();
    var range = xScale.range;
    var rangeMax = range[range.length - 1];
    var rangeMin = range[0];
    var invertPoint = coordinate.invert(point);
    var xValue = invertPoint.x;
    if (coordinate.isPolar && xValue > (1 + rangeMax) / 2) {
        xValue = rangeMin; // 极坐标下，scale 的 range 被做过特殊处理
    }
    return xScale.translate(xScale.invert(xValue));
}
function filterYValue(data, point, geometry) {
    var coordinate = geometry.coordinate;
    var yScale = geometry.getYScale();
    var yField = yScale.field;
    var invertPoint = coordinate.invert(point);
    var yValue = yScale.invert(invertPoint.y);
    var result = util_1.find(data, function (obj) {
        var originData = obj[constant_1.FIELD_ORIGIN];
        return originData[yField][0] <= yValue && originData[yField][1] >= yValue;
    });
    return result || data[data.length - 1];
}
var getXDistance = util_1.memoize(function (scale) {
    if (scale.isCategory) {
        return 1;
    }
    var scaleValues = scale.values; // values 是无序的
    var length = scaleValues.length;
    var min = scale.translate(scaleValues[0]);
    var max = min;
    for (var index = 0; index < length; index++) {
        var value = scaleValues[index];
        // 时间类型需要 translate
        var numericValue = scale.translate(value);
        if (numericValue < min) {
            min = numericValue;
        }
        if (numericValue > max) {
            max = numericValue;
        }
    }
    return (max - min) / (length - 1);
});
function getTooltipTitle(originData, geometry, title) {
    var titleField = title;
    if (!title) {
        var positionAttr = geometry.getAttribute('position');
        var fields = positionAttr.getFields();
        titleField = fields[0];
    }
    var scales = geometry.scales;
    if (scales[titleField]) {
        // 如果创建了该字段对应的 scale，则通过 scale.getText() 方式取值，因为用户可能对数据进行了格式化
        return scales[titleField].getText(originData[titleField]);
    }
    // 如果没有对应的 scale，则从原始数据中取值，如果原始数据中仍不存在，则直接放回 title 值
    return util_1.hasKey(originData, titleField) ? originData[titleField] : titleField;
}
function getAttributesForLegend(geometry) {
    var attributes = util_1.values(geometry.attributes);
    return util_1.filter(attributes, function (attribute) { return util_1.contains(constant_1.GROUP_ATTRS, attribute.type); });
}
function getTooltipValueScale(geometry) {
    var attributes = getAttributesForLegend(geometry);
    var scale;
    for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
        var attribute = attributes_1[_i];
        var tmpScale = attribute.getScale(attribute.type);
        if (tmpScale && tmpScale.isLinear) {
            // 如果指定字段是非 position 的，同时是连续的
            scale = tmpScale;
            break;
        }
    }
    var xScale = geometry.getXScale();
    var yScale = geometry.getYScale();
    return scale || yScale || xScale;
}
function getTooltipValue(originData, valueScale) {
    var field = valueScale.field;
    var value = originData[field];
    if (util_1.isArray(value)) {
        var texts = value.map(function (eachValue) {
            return valueScale.getText(eachValue);
        });
        return texts.join('-');
    }
    return valueScale.getText(value);
}
// 根据原始数据获取 tooltip item 中 name 值
function getTooltipName(originData, geometry) {
    var nameScale;
    var groupScales = geometry.getGroupScales();
    if (groupScales.length) {
        // 如果存在分组类型，取第一个分组类型
        nameScale = groupScales[0];
    }
    if (nameScale) {
        var field = nameScale.field;
        return nameScale.getText(originData[field]);
    }
    var valueScale = getTooltipValueScale(geometry);
    return scale_1.getName(valueScale);
}
/**
 * @ignore
 * Finds data from geometry by point
 * @param point canvas point
 * @param data an item of geometry.dataArray
 * @param geometry
 * @returns
 */
function findDataByPoint(point, data, geometry) {
    if (data.length === 0) {
        return null;
    }
    var geometryType = geometry.type;
    var xScale = geometry.getXScale();
    var yScale = geometry.getYScale();
    var xField = xScale.field;
    var yField = yScale.field;
    var rst = null;
    // 热力图采用最小逼近策略查找 point 击中的数据
    if (geometryType === 'heatmap' || geometryType === 'point') {
        // 将 point 画布坐标转换为原始数据值
        var coordinate = geometry.coordinate;
        var invertPoint = coordinate.invert(point); // 转换成归一化的数据
        var x = xScale.invert(invertPoint.x); // 转换为原始值
        var y = yScale.invert(invertPoint.y); // 转换为原始值
        var min = Infinity;
        for (var index = 0; index < data.length; index++) {
            var obj = data[index];
            var originData = obj[constant_1.FIELD_ORIGIN];
            var range = Math.pow((originData[xField] - x), 2) + Math.pow((originData[yField] - y), 2);
            if (range < min) {
                min = range;
                rst = obj;
            }
        }
        return rst;
    }
    // 其他 Geometry 类型按照 x 字段数据进行查找
    var first = data[0];
    var last = data[data.length - 1];
    var xValue = getXValueByPoint(point, geometry);
    var firstXValue = first[constant_1.FIELD_ORIGIN][xField];
    var firstYValue = first[constant_1.FIELD_ORIGIN][yField];
    var lastXValue = last[constant_1.FIELD_ORIGIN][xField];
    var isYArray = yScale.isLinear && util_1.isArray(firstYValue); // 考虑 x 维度相同，y 是数组区间的情况
    // 如果 x 的值是数组
    if (util_1.isArray(firstXValue)) {
        for (var index = 0; index < data.length; index++) {
            var record = data[index];
            var originData = record[constant_1.FIELD_ORIGIN];
            // xValue 在 originData[xField] 的数值区间内
            if (xScale.translate(originData[xField][0]) <= xValue && xScale.translate(originData[xField][1]) >= xValue) {
                if (isYArray) {
                    // 层叠直方图场景，x 和 y 都是数组区间
                    if (!util_1.isArray(rst)) {
                        rst = [];
                    }
                    rst.push(record);
                }
                else {
                    rst = record;
                    break;
                }
            }
        }
        if (util_1.isArray(rst)) {
            rst = filterYValue(rst, point, geometry);
        }
    }
    else {
        var next = void 0;
        if (!xScale.isLinear && xScale.type !== 'timeCat') {
            // x 轴对应的数据为非线性以及非时间类型的数据采用遍历查找
            for (var index = 0; index < data.length; index++) {
                var record = data[index];
                var originData = record[constant_1.FIELD_ORIGIN];
                if (snapEqual(originData[xField], xValue, xScale)) {
                    if (isYArray) {
                        if (!util_1.isArray(rst)) {
                            rst = [];
                        }
                        rst.push(record);
                    }
                    else {
                        rst = record;
                        break;
                    }
                }
                else if (xScale.translate(originData[xField]) <= xValue) {
                    last = record;
                    next = data[index + 1];
                }
            }
            if (util_1.isArray(rst)) {
                rst = filterYValue(rst, point, geometry);
            }
        }
        else {
            // x 轴对应的数据为线性以及时间类型，进行二分查找，性能更好
            if ((xValue > xScale.translate(lastXValue) || xValue < xScale.translate(firstXValue)) &&
                (xValue > xScale.max || xValue < xScale.min)) {
                // 不在数据范围内
                return null;
            }
            var firstIdx = 0;
            var lastIdx = data.length - 1;
            var middleIdx = void 0;
            while (firstIdx <= lastIdx) {
                middleIdx = Math.floor((firstIdx + lastIdx) / 2);
                var item = data[middleIdx][constant_1.FIELD_ORIGIN][xField];
                if (snapEqual(item, xValue, xScale)) {
                    return data[middleIdx];
                }
                if (xScale.translate(item) <= xScale.translate(xValue)) {
                    firstIdx = middleIdx + 1;
                    last = data[middleIdx];
                    next = data[middleIdx + 1];
                }
                else {
                    if (lastIdx === 0) {
                        last = data[0];
                    }
                    lastIdx = middleIdx - 1;
                }
            }
        }
        if (last && next) {
            // 计算最逼近的
            if (Math.abs(xScale.translate(last[constant_1.FIELD_ORIGIN][xField]) - xValue) >
                Math.abs(xScale.translate(next[constant_1.FIELD_ORIGIN][xField]) - xValue)) {
                last = next;
            }
        }
    }
    var distance = getXDistance(geometry.getXScale()); // 每个分类间的平均间距
    if (!rst && Math.abs(xScale.translate(last[constant_1.FIELD_ORIGIN][xField]) - xValue) <= distance / 2) {
        rst = last;
    }
    return rst;
}
exports.findDataByPoint = findDataByPoint;
/**
 * @ignore
 * Gets tooltip items
 * @param data
 * @param geometry
 * @param [title]
 * @returns
 */
function getTooltipItems(data, geometry, title) {
    if (title === void 0) { title = ''; }
    var originData = data[constant_1.FIELD_ORIGIN];
    var tooltipTitle = getTooltipTitle(originData, geometry, title);
    var tooltipOption = geometry.tooltipOption;
    var defaultColor = geometry.theme.defaultColor;
    var items = [];
    var name;
    var value;
    function addItem(itemName, itemValue) {
        if (!util_1.isNil(itemValue) && itemValue !== '') {
            // 值为 null的时候，忽视
            var item = {
                title: tooltipTitle,
                data: originData,
                mappingData: data,
                name: itemName,
                value: itemValue,
                color: data.color || defaultColor,
                marker: true,
            };
            items.push(item);
        }
    }
    if (util_1.isObject(tooltipOption)) {
        var fields = tooltipOption.fields, callback = tooltipOption.callback;
        if (callback) {
            // 用户定义了回调函数
            var callbackParams = fields.map(function (field) {
                return data[constant_1.FIELD_ORIGIN][field];
            });
            var cfg = callback.apply(void 0, callbackParams);
            var itemCfg = tslib_1.__assign({ data: data[constant_1.FIELD_ORIGIN], mappingData: data, title: tooltipTitle, color: data.color || defaultColor, marker: true }, cfg);
            items.push(itemCfg);
        }
        else {
            var scales = geometry.scales;
            for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {
                var field = fields_1[_i];
                if (!util_1.isNil(originData[field])) {
                    // 字段数据为null, undefined 时不显示
                    var scale = scales[field];
                    name = scale_1.getName(scale);
                    value = scale.getText(originData[field]);
                    addItem(name, value);
                }
            }
        }
    }
    else {
        var valueScale = getTooltipValueScale(geometry);
        if (!util_1.isNil(originData[valueScale.field])) {
            // 字段数据为null ,undefined时不显示
            value = getTooltipValue(originData, valueScale);
            name = getTooltipName(originData, geometry);
            addItem(name, value);
        }
    }
    return items;
}
exports.getTooltipItems = getTooltipItems;

},{"../constant":237,"./scale":381,"@antv/util":803,"tslib":385}],384:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.zoom = exports.getIdentityMatrix = exports.rotate = exports.translate = exports.transform = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var transform = matrix_util_1.ext.transform;
exports.transform = transform;
/**
 * 对元素进行平移操作。
 * @param element 进行变换的元素
 * @param x x 方向位移
 * @param y y 方向位移
 */
function translate(element, x, y) {
    var matrix = transform(element.getMatrix(), [['t', x, y]]);
    element.setMatrix(matrix);
}
exports.translate = translate;
/**
 * 对元素进行旋转操作。
 * @param element 进行变换的元素
 * @param rotateRadian 旋转弧度
 */
function rotate(element, rotateRadian) {
    var _a = element.attr(), x = _a.x, y = _a.y;
    var matrix = transform(element.getMatrix(), [
        ['t', -x, -y],
        ['r', rotateRadian],
        ['t', x, y],
    ]);
    element.setMatrix(matrix);
}
exports.rotate = rotate;
/**
 * 获取元矩阵。
 * @returns identity matrix
 */
function getIdentityMatrix() {
    return [1, 0, 0, 0, 1, 0, 0, 0, 1];
}
exports.getIdentityMatrix = getIdentityMatrix;
/**
 * 围绕图形中心点进行缩放
 * @param element 进行缩放的图形元素
 * @param ratio 缩放比例
 */
function zoom(element, ratio) {
    var bbox = element.getBBox();
    var x = (bbox.minX + bbox.maxX) / 2;
    var y = (bbox.minY + bbox.maxY) / 2;
    element.applyToMatrix([x, y, 1]);
    var matrix = transform(element.getMatrix(), [
        ['t', -x, -y],
        ['s', ratio, ratio],
        ['t', x, y],
    ]);
    element.setMatrix(matrix);
}
exports.zoom = zoom;

},{"@antv/matrix-util":717}],385:[function(require,module,exports){
(function (global){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __createBinding;
(function (factory) {
    var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
    if (typeof define === "function" && define.amd) {
        define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
    }
    else if (typeof module === "object" && typeof module.exports === "object") {
        factory(createExporter(root, createExporter(module.exports)));
    }
    else {
        factory(createExporter(root));
    }
    function createExporter(exports, previous) {
        if (exports !== root) {
            if (typeof Object.create === "function") {
                Object.defineProperty(exports, "__esModule", { value: true });
            }
            else {
                exports.__esModule = true;
            }
        }
        return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
    }
})
(function (exporter) {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };

    __extends = function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };

    __assign = Object.assign || function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };

    __rest = function (s, e) {
        var t = {};
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                    t[p[i]] = s[p[i]];
            }
        return t;
    };

    __decorate = function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };

    __param = function (paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    };

    __metadata = function (metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
    };

    __awaiter = function (thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    };

    __generator = function (thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    };

    __exportStar = function(m, o) {
        for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
    };

    __createBinding = Object.create ? (function(o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
    }) : (function(o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        o[k2] = m[k];
    });

    __values = function (o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m) return m.call(o);
        if (o && typeof o.length === "number") return {
            next: function () {
                if (o && i >= o.length) o = void 0;
                return { value: o && o[i++], done: !o };
            }
        };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };

    __read = function (o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    };

    __spread = function () {
        for (var ar = [], i = 0; i < arguments.length; i++)
            ar = ar.concat(__read(arguments[i]));
        return ar;
    };

    __spreadArrays = function () {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
                r[k] = a[j];
        return r;
    };

    __await = function (v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    };

    __asyncGenerator = function (thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
        function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
        function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);  }
        function fulfill(value) { resume("next", value); }
        function reject(value) { resume("throw", value); }
        function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
    };

    __asyncDelegator = function (o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
    };

    __asyncValues = function (o) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
    };

    __makeTemplateObject = function (cooked, raw) {
        if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
        return cooked;
    };

    var __setModuleDefault = Object.create ? (function(o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
        o["default"] = v;
    };

    __importStar = function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
        __setModuleDefault(result, mod);
        return result;
    };

    __importDefault = function (mod) {
        return (mod && mod.__esModule) ? mod : { "default": mod };
    };

    __classPrivateFieldGet = function (receiver, privateMap) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to get private field on non-instance");
        }
        return privateMap.get(receiver);
    };

    __classPrivateFieldSet = function (receiver, privateMap, value) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to set private field on non-instance");
        }
        privateMap.set(receiver, value);
        return value;
    };

    exporter("__extends", __extends);
    exporter("__assign", __assign);
    exporter("__rest", __rest);
    exporter("__decorate", __decorate);
    exporter("__param", __param);
    exporter("__metadata", __metadata);
    exporter("__awaiter", __awaiter);
    exporter("__generator", __generator);
    exporter("__exportStar", __exportStar);
    exporter("__createBinding", __createBinding);
    exporter("__values", __values);
    exporter("__read", __read);
    exporter("__spread", __spread);
    exporter("__spreadArrays", __spreadArrays);
    exporter("__await", __await);
    exporter("__asyncGenerator", __asyncGenerator);
    exporter("__asyncDelegator", __asyncDelegator);
    exporter("__asyncValues", __asyncValues);
    exporter("__makeTemplateObject", __makeTemplateObject);
    exporter("__importStar", __importStar);
    exporter("__importDefault", __importDefault);
    exporter("__classPrivateFieldGet", __classPrivateFieldGet);
    exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

},{}],386:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VIEW_LAYER_LIFE_CYCLE = void 0;
var VIEW_LAYER_LIFE_CYCLE;
(function (VIEW_LAYER_LIFE_CYCLE) {
    VIEW_LAYER_LIFE_CYCLE["BEFORE_INIT"] = "beforeinit";
    VIEW_LAYER_LIFE_CYCLE["AFTER_INIT"] = "afterinit";
    VIEW_LAYER_LIFE_CYCLE["BEFORE_RENDER"] = "beforerender";
    VIEW_LAYER_LIFE_CYCLE["AFTER_RENDER"] = "afterrender";
    VIEW_LAYER_LIFE_CYCLE["BEFORE_CHANGE_DATA"] = "beforechangedata";
    VIEW_LAYER_LIFE_CYCLE["AFTER_CHANGE_DATA"] = "afterchangedata";
})(VIEW_LAYER_LIFE_CYCLE = exports.VIEW_LAYER_LIFE_CYCLE || (exports.VIEW_LAYER_LIFE_CYCLE = {}));

},{}],387:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dom_util_1 = require("@antv/dom-util");
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
var resize_observer_polyfill_1 = tslib_1.__importDefault(require("resize-observer-polyfill"));
var global_1 = require("../../theme/global");
var theme_1 = tslib_1.__importDefault(require("./theme"));
/**
 * Canvas controller
 * 1. create G.Canvas, destroy G.Canvas
 * 2. process auto fit container
 * 3. API for G.Canvas
 */
var CanvasController = /** @class */ (function () {
    function CanvasController(cfg) {
        var _this = this;
        /**
         * when the container size changed, trigger it after 300ms.
         */
        this.onResize = util_1.debounce(function () {
            if (_this.plot.destroyed) {
                return;
            }
            var _a = _this.getCanvasSize(), width = _a.width, height = _a.height;
            /** height measure不准导致重复 forceFit */
            if (_this.width === width && _this.height === height) {
                return;
            }
            // got new width, height, re-render the plot
            _this.width = width;
            _this.height = height;
            _this.plot.updateConfig({ width: width, height: height });
            _this.plot.render();
        }, 300);
        var containerDOM = cfg.containerDOM, plot = cfg.plot;
        this.containerDOM = containerDOM;
        this.plot = plot;
        this.init();
    }
    /**
     * get canvas size from props.
     * @returns the width, height of canvas
     */
    CanvasController.prototype.getCanvasSize = function () {
        var theme = global_1.getGlobalTheme();
        var width = this.plot.width ? this.plot.width : theme.width;
        var height = this.plot.height ? this.plot.height : theme.height;
        // if forceFit = true, then use the container's size as default.
        if (this.plot.forceFit) {
            width = this.containerDOM.offsetWidth ? this.containerDOM.offsetWidth : width;
            height = this.containerDOM.offsetHeight ? this.containerDOM.offsetHeight : height;
        }
        return { width: width, height: height };
    };
    /**
     * get the canvas dom
     * @returns Canvas DOM
     */
    CanvasController.prototype.getCanvasDOM = function () {
        return this.canvas.get('container');
    };
    /**
     * update the plot size
     */
    CanvasController.prototype.updateCanvasSize = function () {
        var _a = this.getCanvasSize(), width = _a.width, height = _a.height;
        this.width = width;
        this.height = height;
        this.canvas.changeSize(width, height);
        // this.plot.updateRange();
    };
    /**
     * 根据主题调整canvas样式
     */
    CanvasController.prototype.updateCanvasTheme = function () {
        var theme = this.plot.theme;
        var globalTheme = theme_1.default.getGlobalTheme(theme);
        var fill = util_1.get(globalTheme, 'backgroundStyle.fill');
        if (fill) {
            this.updateCanvasStyle({
                backgroundColor: fill,
            });
        }
    };
    /**
     * update the canvas dom styles
     * @param styles
     */
    CanvasController.prototype.updateCanvasStyle = function (styles) {
        // 修改容器的样式
        dom_util_1.modifyCSS(this.getCanvasDOM(), styles);
        // 修改 canvas 的样式
        dom_util_1.modifyCSS(this.canvas.get('el'), {
            display: 'inline-block',
            verticalAlign: 'middle',
        });
    };
    /**
     * destroy the plot, remove resize event.
     */
    CanvasController.prototype.destroy = function () {
        // remove event
        if (this.resizeObserver) {
            this.resizeObserver.unobserve(this.containerDOM);
            this.resizeObserver.disconnect();
            this.containerDOM = null;
        }
        // remove G.Canvas
        this.canvas.destroy();
    };
    /**
     * when forceFit = true, then bind the event to listen the container size change
     */
    CanvasController.prototype.bindForceFit = function () {
        var forceFit = this.plot.forceFit;
        // use ResizeObserver to listen the container size change.
        if (forceFit) {
            this.resizeObserver = new resize_observer_polyfill_1.default(this.onResize);
            this.resizeObserver.observe(this.containerDOM);
        }
    };
    /**
     * init life circle
     */
    CanvasController.prototype.init = function () {
        this.initGCanvas();
        this.bindForceFit();
        // 追加容器的 css 样式，防止 tooltip 的位置参考点不正确
        this.updateCanvasStyle({ position: 'relative' });
    };
    /**
     * init G.Canvas instance
     */
    CanvasController.prototype.initGCanvas = function () {
        /** 创建canvas */
        var _a = this.plot, _b = _a.renderer, renderer = _b === void 0 ? 'canvas' : _b, pixelRatio = _a.pixelRatio, _c = _a.localRefresh, localRefresh = _c === void 0 ? false : _c;
        var _d = this.getCanvasSize(), width = _d.width, height = _d.height;
        var G = renderer === 'canvas' ? dependents_1.Canvas : dependents_1.SVG;
        this.canvas = new G({
            localRefresh: localRefresh,
            container: this.containerDOM,
            width: width,
            height: height,
            pixelRatio: pixelRatio,
        });
        this.width = width;
        this.height = height;
        this.updateCanvasTheme();
    };
    return CanvasController;
}());
exports.default = CanvasController;

},{"../../dependents":425,"../../theme/global":668,"./theme":391,"@antv/dom-util":92,"@antv/util":803,"resize-observer-polyfill":893,"tslib":894}],388:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
function isSameShape(shape1, shape2) {
    if (shape1 && shape2 && shape1 === shape2) {
        return true;
    }
    return false;
}
function isPointInBBox(point, bbox) {
    if (point.x >= bbox.minX && point.x <= bbox.maxX && point.y >= bbox.minY && point.y <= bbox.maxY) {
        return true;
    }
    return false;
}
var EventController = /** @class */ (function () {
    function EventController(cfg) {
        this.plot = cfg.plot;
        this.canvas = cfg.canvas;
        this.eventHandlers = [];
    }
    EventController.prototype.bindEvents = function () {
        this.addEvent(this.canvas, 'mousedown', util_1.wrapBehavior(this, 'onEvents'));
        this.addEvent(this.canvas, 'mousemove', util_1.wrapBehavior(this, 'onMove'));
        this.addEvent(this.canvas, 'mouseup', util_1.wrapBehavior(this, 'onEvents'));
        this.addEvent(this.canvas, 'click', util_1.wrapBehavior(this, 'onEvents'));
        this.addEvent(this.canvas, 'dblclick', util_1.wrapBehavior(this, 'onEvents'));
        this.addEvent(this.canvas, 'contextmenu', util_1.wrapBehavior(this, 'onEvents'));
        this.addEvent(this.canvas, 'wheel', util_1.wrapBehavior(this, 'onEvents'));
    };
    EventController.prototype.clearEvents = function () {
        var eventHandlers = this.eventHandlers;
        util_1.each(eventHandlers, function (eh) {
            eh.target.off(eh.type, eh.handler);
        });
    };
    EventController.prototype.addEvent = function (target, eventType, handler) {
        target.on(eventType, handler);
        this.eventHandlers.push({ target: target, type: eventType, handler: handler });
    };
    EventController.prototype.onEvents = function (ev) {
        var eventObj = this.getEventObj(ev);
        var target = ev.target;
        // 判断是否拾取到view以外的shape
        if (!this.isShapeInView(target) && target.name) {
            this.plot.emit(target.name + ":" + ev.type, ev);
        }
        this.plot.emit("" + ev.type, eventObj);
        // layer事件
        var layers = this.plot.getLayers();
        if (layers.length > 0) {
            this.onLayerEvent(layers, eventObj, ev.type);
        }
    };
    EventController.prototype.onMove = function (ev) {
        var target = ev.target;
        var eventObj = this.getEventObj(ev);
        // shape的mouseenter, mouseleave和mousemove事件
        if (!this.isShapeInView(target) && target.name) {
            this.plot.emit(target.name + ":" + ev.type, eventObj);
            // mouseleave & mouseenter
            if (this.lastShape && !isSameShape(target, this.lastShape)) {
                if (this.lastShape) {
                    this.plot.emit(this.lastShape.name + ":mouseleave", eventObj);
                }
                this.plot.emit(target.name + ":mouseenter", eventObj);
            }
            this.lastShape = target;
        }
        this.plot.emit('mousemove', eventObj);
        // layer事件
        var layers = this.plot.getLayers();
        if (layers.length > 0) {
            this.onLayerEvent(layers, eventObj, 'mousemove');
        }
    };
    EventController.prototype.isShapeInView = function (shape) {
        var groupName = ['frontgroundGroup', 'backgroundGroup', 'panelGroup'];
        var parent = shape.get('parent');
        while (parent) {
            var parentName = parent.get('name');
            if (parentName && util_1.contains(groupName, parentName)) {
                return true;
            }
            parent = parent.get('parent');
        }
        return false;
    };
    EventController.prototype.getEventObj = function (ev) {
        var obj = {
            clientX: ev.clientX,
            clientY: ev.clientY,
            x: ev.x,
            y: ev.y,
            plot: this.plot,
            data: ev.data ? ev.data.data : null,
            canvas: this.canvas,
            target: ev.target,
            gEvent: ev,
        };
        return obj;
    };
    EventController.prototype.onLayerEvent = function (layers, eventObj, eventName) {
        var _this = this;
        util_1.each(layers, function (layer) {
            var bbox = layer.getGlobalBBox();
            if (isPointInBBox({ x: eventObj.x, y: eventObj.y }, bbox)) {
                layer.emit("" + eventName, eventObj);
                var subLayers = layer.layers;
                if (subLayers.length > 0) {
                    _this.onLayerEvent(subLayers, eventObj, eventName);
                }
            }
        });
    };
    return EventController;
}());
exports.default = EventController;

},{"@antv/util":803}],389:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var bbox_1 = tslib_1.__importDefault(require("../../util/bbox"));
var common_1 = require("../../util/common");
/**
 * 处理图表padding的逻辑：
 * 注册参与padding的自定义组件
 */
var PaddingController = /** @class */ (function () {
    function PaddingController(cfg) {
        this.innerPaddingComponents = [];
        this.outerPaddingComponents = [];
        this.plot = cfg.plot;
    }
    PaddingController.prototype.registerPadding = function (component, type, checkIfExist) {
        if (type === void 0) { type = 'outer'; }
        if (checkIfExist === void 0) { checkIfExist = false; }
        if (type === 'inner') {
            if (checkIfExist) {
                if (!this.innerPaddingComponents.find(function (c) { return c == component; })) {
                    this.innerPaddingComponents.push(component);
                }
            }
            else {
                this.innerPaddingComponents.push(component);
            }
        }
        else {
            if (checkIfExist) {
                if (!this.outerPaddingComponents.find(function (c) { return c == component; })) {
                    this.outerPaddingComponents.push(component);
                }
            }
            else {
                this.outerPaddingComponents.push(component);
            }
        }
    };
    PaddingController.prototype.getPaddingComponents = function (type) {
        if (type === void 0) { type = 'outer'; }
        return (type === 'outer' ? this.outerPaddingComponents : this.innerPaddingComponents) || [];
    };
    /**
     * 清除已经注册的元素
     */
    PaddingController.prototype.clear = function () {
        this.innerPaddingComponents = [];
        // 一些组件是在view渲染完成之后渲染初始化的
        // TODO: afterRender的什么时候清除
        this.outerPaddingComponents = util_1.filter(this.outerPaddingComponents, function (component) { return component.afterRender; });
    };
    PaddingController.prototype.clearOuterComponents = function () {
        util_1.each(this.outerPaddingComponents, function (component) {
            if (component.afterRender) {
                component.destroy();
            }
        });
        this.outerPaddingComponents = [];
    };
    PaddingController.prototype.getPadding = function () {
        var props = this.plot.options;
        var padding = props.padding ? props.padding : this.plot.config.theme.padding;
        if (padding === 'auto') {
            return [0, 0, 0, 1];
        }
        return padding;
    };
    /** view层的padding计算 */
    PaddingController.prototype.processAutoPadding = function () {
        var padding = this._getInnerAutoPadding();
        this.plot.updateConfig({
            padding: padding,
        });
        this.plot.render();
    };
    PaddingController.prototype.processOuterPadding = function () {
        if (!this.plot.layerBBox) {
            this.plot.layerBBox = new bbox_1.default(this.plot.x, this.plot.y, this.plot.width, this.plot.height);
        }
        var viewMinX = this.plot.layerBBox.minX;
        var viewMaxX = this.plot.layerBBox.maxX;
        var viewMinY = this.plot.layerBBox.minY;
        var viewMaxY = this.plot.layerBBox.maxY;
        util_1.each(this.outerPaddingComponents, function (component) {
            var position = component.position;
            if (component.destroyed) {
                return;
            }
            var _a = component.getBBox(), minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;
            if (maxY >= viewMinY && maxY <= viewMaxY && position === 'top') {
                viewMinY = maxY;
            }
            if (minY >= viewMinY && minY <= viewMaxY && position === 'bottom') {
                viewMaxY = minY;
            }
            if (maxX > viewMinX && maxX <= viewMaxX && position === 'left') {
                viewMinX = maxX;
            }
            if (minX >= viewMinX && maxX <= viewMaxX && position === 'right') {
                viewMaxX = minX;
            }
        });
        return new bbox_1.default(viewMinX, viewMinY, viewMaxX - viewMinX, viewMaxY - viewMinY);
    };
    PaddingController.prototype._getInnerAutoPadding = function () {
        var _a;
        var props = this.plot.options;
        var view = this.plot.view;
        var viewRange = view.coordinateBBox;
        var maxX = viewRange.maxX, maxY = viewRange.maxY, minY = viewRange.minY, minX = viewRange.minX;
        var bleeding = this.plot.config.theme.bleeding;
        if (util_1.isArray(bleeding)) {
            util_1.each(bleeding, function (it, index) {
                if (typeof bleeding[index] === 'function') {
                    bleeding[index] = bleeding[index](props);
                }
            });
        }
        this.bleeding = util_1.clone(bleeding);
        // 参与auto padding的components: axis legend label annotation
        var components_bbox = [new bbox_1.default(viewRange.minX, viewRange.minY, viewRange.width, viewRange.height)];
        if (((_a = this.plot.config.coordinate) === null || _a === void 0 ? void 0 : _a.type) === 'cartesian') {
            this._getCartesianAxis(view, components_bbox[0], components_bbox);
        }
        var box = this._mergeBBox(components_bbox);
        this._getLegend(view, box, components_bbox);
        box = this._mergeBBox(components_bbox);
        // 参与auto padding的自定义组件
        var components = this.innerPaddingComponents;
        util_1.each(components, function (obj) {
            var component = obj;
            var bbox = component.getBBox();
            components_bbox.push(bbox);
        });
        box = this._mergeBBox(components_bbox);
        var padding = [
            minY - box.minY + this.bleeding[0],
            box.maxX - maxX + this.bleeding[1],
            box.maxY - maxY + this.bleeding[2],
            minX - box.minX + this.bleeding[3],
        ];
        // label、annotation等
        var panelPadding = this._getPanel(view);
        padding[0] += panelPadding[0];
        padding[1] += panelPadding[1];
        padding[2] += panelPadding[2];
        padding[3] += panelPadding[3];
        return padding;
    };
    PaddingController.prototype._getCartesianAxis = function (view, globalBBox, bboxes) {
        var axes = common_1.getAxisComponents(view);
        var isTransposed = view.getCoordinate().isTransposed;
        util_1.each(axes, function (axis) {
            if (axis.get('group').get('children').length === 0) {
                return;
            }
            var position = axis.get('position');
            var _a = axis.getLayoutBBox(), minX = _a.minX, minY = _a.minY, width = _a.width, height = _a.height;
            if (!isTransposed) {
                if (position === 'left') {
                    bboxes.push(new bbox_1.default(globalBBox.minX - width, minY, width, height));
                }
                else if (position === 'bottom') {
                    bboxes.push(new bbox_1.default(minX, globalBBox.maxY, width, height));
                }
                else if (position === 'right') {
                    bboxes.push(new bbox_1.default(globalBBox.maxX, minY, width, height));
                }
            }
            else {
                if (position === 'bottom') {
                    bboxes.push(new bbox_1.default(globalBBox.minX - width, minY, width, height));
                }
                else if (position === 'left') {
                    bboxes.push(new bbox_1.default(minX, globalBBox.maxY, width, height));
                }
                else if (position === 'top') {
                    bboxes.push(new bbox_1.default(globalBBox.maxX, minY, width, height));
                }
            }
        });
    };
    PaddingController.prototype._getLegend = function (view, globalBBox, bboxes) {
        var legends = common_1.getLegendComponents(view);
        util_1.each(legends, function (legend) {
            var position = legend.get('position').split('-')[0];
            var _a = legend.getLayoutBBox(), minX = _a.minX, minY = _a.minY, width = _a.width, height = _a.height;
            if (position === 'top') {
                bboxes.push(new bbox_1.default(minX, globalBBox.minY - height, width, height));
            }
            else if (position === 'bottom') {
                bboxes.push(new bbox_1.default(minX, globalBBox.maxY, width, height));
            }
            else if (position === 'left') {
                bboxes.push(new bbox_1.default(globalBBox.minX - width, minY, width, height));
            }
            else {
                bboxes.push(new bbox_1.default(globalBBox.maxX, minY, width, height));
            }
        });
    };
    PaddingController.prototype._getPanel = function (view) {
        var groups = [];
        var geoms = view.geometries;
        util_1.each(geoms, function (geom) {
            if (geom.labelsContainer) {
                groups.push(geom.labelsContainer);
            }
        });
        var minX = Infinity;
        var maxX = -Infinity;
        var minY = Infinity;
        var maxY = -Infinity;
        util_1.each(groups, function (group) {
            var children = group.get('children');
            children.forEach(function (child) {
                if (child.type === 'group' && child.get('children').length === 0) {
                    return;
                }
                var bbox = child.getBBox();
                if (bbox.minX < minX) {
                    minX = bbox.minX;
                }
                if (bbox.maxX > maxX) {
                    maxX = bbox.maxX;
                }
                if (bbox.minY < minY) {
                    minY = bbox.minY;
                }
                if (bbox.maxY > maxY) {
                    maxY = bbox.maxY;
                }
            });
        });
        var panelRange = view.coordinateBBox;
        //right
        var rightDist = Math.max(maxX - parseFloat(panelRange.maxX), 0);
        if (rightDist > 0) {
            var ratio = panelRange.width / (panelRange.width + rightDist);
            rightDist *= ratio;
        }
        //left
        var leftDist = Math.max(parseFloat(panelRange.minX) - minX, 0);
        if (leftDist > 0) {
            var ratio = panelRange.width / (panelRange.width + leftDist);
            leftDist *= ratio;
        }
        //top
        var topDist = Math.max(parseFloat(panelRange.minY) - minY, 0);
        if (topDist > 0) {
            var ratio = panelRange.height / (panelRange.height + topDist);
            topDist *= ratio;
        }
        //bottom
        var bottomDist = Math.max(maxY - parseFloat(panelRange.maxY), 0);
        if (bottomDist > 0) {
            var ratio = panelRange.height / (panelRange.height + bottomDist);
            bottomDist *= ratio;
        }
        return [topDist, rightDist, bottomDist, leftDist];
    };
    PaddingController.prototype._mergeBBox = function (bboxes) {
        var minX = Infinity;
        var maxX = -Infinity;
        var minY = Infinity;
        var maxY = -Infinity;
        util_1.each(bboxes, function (bbox) {
            var box = bbox;
            minX = Math.min(box.minX, minX);
            maxX = Math.max(box.maxX, maxX);
            minY = Math.min(box.minY, minY);
            maxY = Math.max(box.maxY, maxY);
        });
        return { minX: minX, maxX: maxX, minY: minY, maxY: maxY };
    };
    return PaddingController;
}());
exports.default = PaddingController;

},{"../../util/bbox":672,"../../util/common":674,"@antv/util":803,"tslib":894}],390:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compare = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var factory_1 = require("../../components/factory");
var event_1 = require("../../util/event");
var state_manager_1 = tslib_1.__importDefault(require("../../util/state-manager"));
function compare(origin, condition) {
    if (!util_1.isFunction(condition)) {
        var name_1 = condition.name, exp = condition.exp;
        if (util_1.isFunction(exp)) {
            return exp(origin[name_1]);
        }
        return origin[name_1] === exp;
    }
    return condition(origin);
}
exports.compare = compare;
var StateController = /** @class */ (function () {
    function StateController(cfg) {
        this.shapeContainers = [];
        util_1.assign(this, cfg);
    }
    StateController.prototype.createStateManager = function () {
        this.stateManager = new state_manager_1.default();
    };
    StateController.prototype.bindStateManager = function (manager, cfg) {
        this.stateManager = manager;
        if (cfg.setState) {
            this._updateStateProcess(cfg.setState);
        }
        if (cfg.onStateChange) {
            this._stateChangeProcess(cfg.onStateChange);
        }
    };
    StateController.prototype.defaultStates = function (states) {
        var _this = this;
        util_1.each(states, function (state, type) {
            var condition = state.condition, related = state.related;
            _this.setState({ type: type, condition: condition, related: related });
        });
    };
    StateController.prototype.setState = function (cfg) {
        var _this = this;
        var type = cfg.type, condition = cfg.condition, related = cfg.related;
        this.shapes = this._getShapes();
        this.originAttrs = this._getOriginAttrs();
        // this.resetZIndex();
        util_1.each(this.shapes, function (shape, index) {
            var shapeOrigin = shape.get('origin').data;
            var origin = util_1.isArray(shapeOrigin) ? shapeOrigin[0] : shapeOrigin;
            if (compare(origin, condition)) {
                var stateStyle = cfg.style ? cfg.style : _this._getDefaultStateStyle(type, shape);
                var originAttr = _this.originAttrs[index];
                var attrs = void 0;
                if (util_1.isFunction(stateStyle)) {
                    attrs = stateStyle(originAttr);
                }
                else {
                    attrs = util_1.mix({}, originAttr, stateStyle);
                }
                shape.attr(attrs);
                _this.setZIndex(type, shape);
                // const canvas = this.plot.canvas;
                // canvas.draw();
            }
        });
        // 组件与图形对状态量的响应不一定同步
        if (related) {
            this._parserRelated(type, related, condition);
        }
        this.plot.canvas.draw();
    };
    StateController.prototype._updateStateProcess = function (setStateCfg) {
        var _this = this;
        util_1.each(setStateCfg, function (cfg) {
            var state = cfg.state;
            var handler;
            if (util_1.isFunction(state)) {
                handler = function (e) {
                    var s = state(e);
                    _this.stateManager.setState(s.name, s.exp);
                };
            }
            else {
                handler = function () {
                    _this.stateManager.setState(state.name, state.exp);
                };
            }
            if (cfg.event) {
                event_1.onEvent(_this.plot, _this._eventParser(cfg.event), handler);
            }
            else {
                handler();
            }
        });
    };
    StateController.prototype._stateChangeProcess = function (onChangeCfg) {
        var _this = this;
        util_1.each(onChangeCfg, function (cfg) {
            _this.stateManager.on(cfg.name + ":change", function (props) {
                cfg.callback(props, _this.plot);
            });
        });
    };
    StateController.prototype._getShapes = function () {
        var _this = this;
        var shapes = [];
        var geoms = this.plot.view.geometries;
        util_1.each(geoms, function (geom) {
            var shapeContainer = geom.container;
            _this.shapeContainers.push(shapeContainer);
            if (!geom.destroyed) {
                shapes.push.apply(shapes, geom.getShapes());
            }
        });
        return shapes;
    };
    StateController.prototype._getOriginAttrs = function () {
        var attrs = [];
        util_1.each(this.shapes, function (shape) {
            attrs.push(util_1.clone(shape.attr()));
        });
        return attrs;
    };
    // 将g2 geomtry转为plot层geometry
    StateController.prototype._eventParser = function (event) {
        var eventCfg = event.split(':');
        var eventTarget = this.plot.geometryParser('g2', eventCfg[0]);
        var eventName = eventCfg[1];
        return eventTarget + ":" + eventName;
    };
    StateController.prototype._getDefaultStateStyle = function (type, shape) {
        var theme = this.plot.theme;
        var plotGeomType = this.plot.geometryParser('plot', shape.name);
        var styleField = plotGeomType + "Style";
        if (theme[styleField]) {
            var style = theme[styleField][type];
            if (util_1.isFunction(style)) {
                style = style(shape.attr());
            }
            return style;
        }
        return {};
    };
    StateController.prototype._parserRelated = function (type, related, condition) {
        var _this = this;
        util_1.each(related, function (r) {
            if (_this.plot[r]) {
                // fixme: 自定义组件
                // this.plot[r].setState(type, condition);
                var method = factory_1.getComponentStateMethod(r, type);
                method(_this.plot, condition);
            }
        });
    };
    // private set
    StateController.prototype.setZIndex = function (stateType, shape) {
        if (stateType === 'active' || stateType === 'selected') {
            // shape.setZIndex(1);
            var children = shape.get('parent').get('children');
            children[children.length - 1].setZIndex(0);
            shape.setZIndex(1);
        }
    };
    StateController.prototype.resetZIndex = function () {
        util_1.each(this.shapeContainers, function (container) {
            var children = container.get('children');
            children.sort(function (obj1, obj2) {
                return obj1._INDEX - obj2._INDEX;
            });
        });
    };
    return StateController;
}());
exports.default = StateController;

},{"../../components/factory":412,"../../util/event":677,"../../util/state-manager":713,"@antv/util":803,"tslib":894}],391:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
var theme_1 = require("../../theme");
var theme_2 = require("../../util/responsive/theme");
var theme_3 = require("../../theme/theme");
/**
 * 负责图表theme的管理
 */
var G2DefaultTheme = dependents_1.getTheme();
var ThemeController = /** @class */ (function () {
    function ThemeController() {
    }
    /**
     * 获取指定的全局theme
     * @param theme
     */
    ThemeController.getGlobalTheme = function (theme) {
        if (util_1.isString(theme)) {
            return theme_1.getGlobalTheme(theme);
        }
        return util_1.deepMix({}, theme_1.getGlobalTheme(), theme);
    };
    /**
     * 通过 theme 和图表类型，获取当前 plot 对应的主题
     * @param props
     * @param type
     */
    ThemeController.prototype.getPlotTheme = function (props, type) {
        var theme = props.theme;
        if (util_1.isString(theme)) {
            return util_1.deepMix({}, theme_1.getGlobalTheme(theme), theme_1.getTheme(type));
        }
        return util_1.deepMix({}, theme_1.getGlobalTheme(), theme_1.getTheme(type), theme_3.convertThemeToG2Theme(type, theme));
    };
    /**
     * 获取转化成 G2 的结构主题
     * @param props
     * @param type
     */
    ThemeController.prototype.getTheme = function (props, type) {
        var plotG2Theme = theme_1.convertToG2Theme(this.getPlotTheme(props, type));
        var g2Theme = util_1.deepMix({}, G2DefaultTheme, plotG2Theme);
        return g2Theme;
    };
    ThemeController.prototype.getResponsiveTheme = function (type) {
        return theme_2.getResponsiveTheme(type) || theme_2.getResponsiveTheme('default');
    };
    return ThemeController;
}());
exports.default = ThemeController;

},{"../../dependents":425,"../../theme":669,"../../theme/theme":670,"../../util/responsive/theme":711,"@antv/util":803}],392:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlotType = exports.registerPlotType = void 0;
/** 所有统计图形 */
var GLOBAL_PLOT_MAP = {};
function registerPlotType(name, ctr) {
    GLOBAL_PLOT_MAP[name.toLowerCase()] = ctr;
}
exports.registerPlotType = registerPlotType;
function getPlotType(name) {
    return GLOBAL_PLOT_MAP[name.toLowerCase()];
}
exports.getPlotType = getPlotType;

},{}],393:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
var util_1 = require("@antv/util");
var event_1 = require("../util/event");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var Layer = /** @class */ (function (_super) {
    tslib_1.__extends(Layer, _super);
    /**
     * layer base for g2plot
     */
    function Layer(props) {
        var _this = _super.call(this) || this;
        _this.layers = [];
        _this.destroyed = false;
        _this.visibility = true;
        _this.rendered = false;
        _this.eventHandlers = [];
        _this.options = _this.getOptions(props);
        _this.processOptions(_this.options);
        return _this;
    }
    Layer.prototype.processOptions = function (options) {
        this.id = options.id;
        this.x = options.x || 0;
        this.y = options.y || 0;
        this.width = options.width;
        this.height = options.height;
        this.canvas = options.canvas;
        this.parent = options.parent;
    };
    Layer.prototype.updateConfig = function (cfg) {
        this.options = util_1.deepMix({}, this.options, cfg);
        this.processOptions(this.options);
    };
    Layer.prototype.beforeInit = function () {
        return null;
    };
    /**
     * init life cycle
     */
    Layer.prototype.init = function () {
        this.layerBBox = this.getLayerBBox();
        this.layerRegion = this.getLayerRegion();
        this.eachLayer(function (layer) {
            layer.init();
        });
    };
    Layer.prototype.afterInit = function () {
        return null;
    };
    /**
     * render layer recursively
     */
    Layer.prototype.render = function () {
        // fixme: 等plot不再继承layer，这个就可以挪到构造函数里去，不需要再加是否render过的判断了
        if (!this.rendered) {
            this.container = this.parent ? this.parent.container.addGroup() : this.canvas.addGroup();
        }
        this.rendered = true;
        this.beforeInit();
        this.init();
        this.afterInit();
        //(this.container, [['t', this.x, this.y]]);
        this.eachLayer(function (layer) {
            layer.render();
        });
        this.canvas.draw();
    };
    /**
     * clear layer content
     */
    Layer.prototype.clear = function () {
        this.eachLayer(function (layer) {
            layer.destroy();
        });
        this.layers = [];
        this.container.clear();
    };
    /**
     * destroy layer recursively, remove the container of layer
     */
    Layer.prototype.destroy = function () {
        var _this = this;
        this.eachLayer(function (layer) {
            layer.destroy();
        });
        util_1.each(this.eventHandlers, function (h) {
            _this.off(h.eventName, h.handler);
        });
        this.container.remove(true);
        this.destroyed = true;
    };
    /**
     * display layer
     */
    Layer.prototype.show = function () {
        this.container.attr('visible', true);
        this.container.set('visible', true);
        this.visibility = true;
        this.canvas.draw();
    };
    /**
     * hide layer
     */
    Layer.prototype.hide = function () {
        this.container.attr('visible', false);
        this.container.set('visible', false);
        this.visibility = false;
        this.canvas.draw();
    };
    /**
     * add children layer
     * @param layer
     */
    Layer.prototype.addLayer = function (layer) {
        var idx = util_1.findIndex(this.layers, function (item) { return item === layer; });
        if (idx < 0) {
            if (layer.parent !== this) {
                layer.parent = this;
                layer.init();
            }
            this.layers.push(layer);
        }
    };
    /**
     * remove children layer
     * @param layer
     */
    Layer.prototype.removeLayer = function (layer) {
        var idx = util_1.findIndex(this.layers, function (item) { return item === layer; });
        if (idx >= 0) {
            this.layers.splice(idx, 1);
        }
    };
    /**
     * update layer's display range
     * @param props
     * @param recursive whether update children layers or not
     */
    Layer.prototype.updateBBox = function (props, recursive) {
        if (recursive === void 0) { recursive = false; }
        var originRange = {
            x: this.x,
            y: this.y,
            width: this.width,
            height: this.height,
        };
        var newRange = util_1.deepMix({}, originRange, props);
        this.x = newRange.x;
        this.y = newRange.y;
        this.width = newRange.width;
        this.height = newRange.height;
        this.layerBBox = this.getLayerBBox();
        this.layerRegion = this.getLayerRegion();
        this.render();
        if (recursive) {
            this.eachLayer(function (layer) {
                layer.updateBBoxByParent();
                layer.render();
            });
        }
        this.canvas.draw();
    };
    /**
     * update display range according to parent layer's range
     */
    Layer.prototype.updateBBoxByParent = function () {
        var region = this.layerRegion;
        this.x = this.parent.x + this.parent.width * region.start.x;
        this.y = this.parent.y + this.parent.height * region.start.y;
        this.width = this.parent.width * (region.end.x - region.start.x);
        this.height = this.parent.height * (region.end.y - region.start.y);
        this.layerBBox = this.getLayerBBox();
    };
    /**
     * get global position of layer
     */
    Layer.prototype.getGlobalPosition = function () {
        var globalX = this.x;
        var globalY = this.y;
        var parent = this.parent;
        while (parent) {
            globalX += parent.x;
            globalY += parent.y;
            parent = parent.parent;
        }
        return { x: globalX, y: globalY };
    };
    Layer.prototype.getGlobalBBox = function () {
        var globalPosition = this.getGlobalPosition();
        return new bbox_1.default(globalPosition.x, globalPosition.y, this.width, this.height);
    };
    Layer.prototype.getOptions = function (props) {
        var parentWidth = 0;
        var parentHeight = 0;
        if (props.parent) {
            parentWidth = props.parent.width;
            parentHeight = props.parent.height;
        }
        var defaultOptions = {
            x: 0,
            y: 0,
            width: parentWidth,
            height: parentHeight,
        };
        return util_1.deepMix({}, defaultOptions, props);
    };
    Layer.prototype.eachLayer = function (cb) {
        util_1.each(this.layers, cb);
    };
    Layer.prototype.parseEvents = function (eventParser) {
        var _this = this;
        var eventsName = util_1.keys(event_1.LAYER_EVENT_MAP);
        util_1.each(eventParser, function (e, k) {
            if (util_1.contains(eventsName, k) && util_1.isFunction(e)) {
                var eventName = event_1.LAYER_EVENT_MAP[k] || k;
                var handler = e;
                _this.on(eventName, handler);
                _this.eventHandlers.push({ name: eventName, handler: handler });
            }
        });
    };
    Layer.prototype.getLayerBBox = function () {
        return new bbox_1.default(this.x, this.y, this.width, this.height);
    };
    Layer.prototype.getLayerRegion = function () {
        if (this.parent) {
            var parentWidth = this.parent.width;
            var parentHeight = this.parent.height;
            var parentX = this.parent.x;
            var parentY = this.parent.y;
            var startX = (this.x - parentX) / parentWidth;
            var startY = (this.y - parentY) / parentHeight;
            var endX = (this.x + this.width - parentX) / parentWidth;
            var endY = (this.y + this.height - parentY) / parentHeight;
            return { start: { x: startX, y: startY }, end: { x: endX, y: endY } };
        }
        return { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } };
    };
    return Layer;
}(event_emitter_1.default));
exports.default = Layer;

},{"../util/bbox":672,"../util/event":677,"@antv/event-emitter":94,"@antv/util":803,"tslib":894}],394:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
var util_1 = require("@antv/util");
var canvas_1 = tslib_1.__importDefault(require("./controller/canvas"));
var event_1 = tslib_1.__importDefault(require("./controller/event"));
var global_1 = require("./global");
var layer_1 = tslib_1.__importDefault(require("./layer"));
var view_layer_1 = tslib_1.__importDefault(require("./view-layer"));
var event_2 = require("../util/event");
var BasePlot = /** @class */ (function (_super) {
    tslib_1.__extends(BasePlot, _super);
    function BasePlot(container, props) {
        var _this = _super.call(this) || this;
        _this.containerDOM = typeof container === 'string' ? document.getElementById(container) : container;
        _this.forceFit = !util_1.isNil(props.forceFit) ? props.forceFit : util_1.isNil(props.width) && util_1.isNil(props.height);
        _this.renderer = props.renderer || 'canvas';
        _this.pixelRatio = props.pixelRatio || null;
        _this.width = props.width;
        _this.height = props.height;
        _this.theme = props.theme;
        _this.localRefresh = props.localRefresh;
        _this.canvasController = new canvas_1.default({
            containerDOM: _this.containerDOM,
            plot: _this,
        });
        /** update layer properties */
        _this.width = _this.canvasController.width;
        _this.height = _this.canvasController.height;
        _this.canvas = _this.canvasController.canvas;
        _this.layers = [];
        _this.destroyed = false;
        _this.createLayers(props);
        /** bind events */
        _this.eventController = new event_1.default({
            plot: _this,
            canvas: _this.canvasController.canvas,
        });
        _this.eventController.bindEvents();
        _this.parseEvents(props);
        return _this;
    }
    /** 生命周期 */
    BasePlot.prototype.destroy = function () {
        this.eachLayer(function (layer) {
            layer.destroy();
        });
        this.canvasController.destroy();
        this.eventController.clearEvents();
        this.layers = [];
        this.destroyed = true;
    };
    /**
     * 重新绘制图形
     */
    BasePlot.prototype.repaint = function () {
        this.canvasController.canvas.draw();
    };
    BasePlot.prototype.updateConfig = function (config, all) {
        if (all === void 0) { all = false; }
        if (all) {
            this.eachLayer(function (layer) {
                if (layer instanceof view_layer_1.default) {
                    layer.updateConfig(config);
                }
            });
        }
        else {
            var layer = this.layers[0];
            if (layer instanceof layer_1.default) {
                layer.updateConfig(config);
            }
        }
        if (config.width) {
            this.width = config.width;
        }
        if (config.height) {
            this.height = config.height;
        }
        if (config.theme) {
            this.theme = config.theme;
        }
        this.canvasController.updateCanvasSize();
        this.canvasController.updateCanvasTheme();
    };
    BasePlot.prototype.changeData = function (data, all) {
        if (all === void 0) { all = false; }
        if (all) {
            this.eachLayer(function (layer) {
                if (layer instanceof view_layer_1.default) {
                    layer.changeData(data);
                }
            });
        }
        else {
            var layer = this.layers[0];
            if (layer instanceof view_layer_1.default) {
                layer.changeData(data);
            }
        }
    };
    BasePlot.prototype.getScaleByField = function (field) {
        return this.layers[0].getScaleByField(field);
    };
    BasePlot.prototype.getXScale = function () {
        return this.layers[0].getXScale();
    };
    BasePlot.prototype.getYScale = function () {
        return this.layers[0].getYScale();
    };
    BasePlot.prototype.getColorScale = function () {
        return this.layers[0].getColorScale();
    };
    BasePlot.prototype.getPlotTheme = function () {
        var layer = this.layers[0];
        return layer.getPlotTheme();
    };
    BasePlot.prototype.getData = function () {
        var layer = this.layers[0];
        return layer.getData();
    };
    /**
     * 绑定一个外部的stateManager
     * 先直接传递给各个子 Layer
     *
     *  @param stateManager
     *  @param cfg
     */
    BasePlot.prototype.bindStateManager = function (stateManager, cfg) {
        this.eachLayer(function (layer) {
            if (layer instanceof view_layer_1.default) {
                layer.bindStateManager(stateManager, cfg);
            }
        });
    };
    /**
     * 响应状态量更新的快捷方法
     *
     *  @param condition
     * @param style
     */
    BasePlot.prototype.setActive = function (condition, style) {
        this.eachLayer(function (layer) {
            if (layer instanceof view_layer_1.default) {
                layer.setActive(condition, style);
            }
        });
    };
    BasePlot.prototype.setSelected = function (condition, style) {
        this.eachLayer(function (layer) {
            if (layer instanceof view_layer_1.default) {
                layer.setSelected(condition, style);
            }
        });
    };
    BasePlot.prototype.setDisable = function (condition, style) {
        this.eachLayer(function (layer) {
            if (layer instanceof view_layer_1.default) {
                layer.setDisable(condition, style);
            }
        });
    };
    BasePlot.prototype.setDefault = function (condition, style) {
        this.eachLayer(function (layer) {
            if (layer instanceof view_layer_1.default) {
                layer.setDefault(condition, style);
            }
        });
    };
    /**
     * 获取 Plot 的 View
     */
    BasePlot.prototype.getView = function () {
        // 临时：避免 getLayer 的类型转换问题
        return this.layers[0].view;
    };
    /**
     * 获取图形下的图层 Layer，默认第一个 Layer
     * @param idx
     */
    BasePlot.prototype.getLayer = function (idx) {
        if (idx === void 0) { idx = 0; }
        return this.layers[idx];
    };
    BasePlot.prototype.getCanvas = function () {
        return this.canvasController.canvas;
    };
    BasePlot.prototype.getLayers = function () {
        return this.layers;
    };
    BasePlot.prototype.render = function () {
        this.eachLayer(function (layer) { return layer.render(); });
    };
    BasePlot.prototype.eachLayer = function (cb) {
        util_1.each(this.layers, cb);
    };
    /**
     * add children layer
     * @param layer
     */
    BasePlot.prototype.addLayer = function (layer) {
        var idx = util_1.findIndex(this.layers, function (item) { return item === layer; });
        if (idx < 0) {
            this.layers.push(layer);
        }
    };
    BasePlot.prototype.createLayers = function (props) {
        if (props.layers) {
            // TODO: combo plot
        }
        else if (props.type) {
            var viewLayerCtr = global_1.getPlotType(props.type);
            var viewLayerProps = util_1.deepMix({}, props, {
                canvas: this.canvasController.canvas,
                x: 0,
                y: 0,
                width: this.width,
                height: this.height,
            });
            var viewLayer = new viewLayerCtr(viewLayerProps);
            this.addLayer(viewLayer);
        }
    };
    BasePlot.prototype.parseEvents = function (props) {
        var _this = this;
        var eventsName = util_1.keys(event_2.CANVAS_EVENT_MAP);
        if (props.events) {
            util_1.each(props.events, function (e, k) {
                if (util_1.contains(eventsName, k) && util_1.isFunction(e)) {
                    var eventName = event_2.CANVAS_EVENT_MAP[k] || k;
                    var handler = e;
                    _this.on(eventName, handler);
                }
            });
        }
    };
    return BasePlot;
}(event_emitter_1.default));
exports.default = BasePlot;

},{"../util/event":677,"./controller/canvas":387,"./controller/event":388,"./global":392,"./layer":393,"./view-layer":395,"@antv/event-emitter":94,"@antv/util":803,"tslib":894}],395:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../dependents");
var description_1 = tslib_1.__importDefault(require("../components/description"));
var base_1 = require("../components/label/base");
var factory_1 = require("../components/factory");
var index_1 = tslib_1.__importDefault(require("../interaction/index"));
var event_1 = require("../util/event");
var padding_1 = tslib_1.__importDefault(require("./controller/padding"));
var state_1 = tslib_1.__importDefault(require("./controller/state"));
var theme_1 = tslib_1.__importDefault(require("./controller/theme"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var common_1 = require("../util/common");
var bbox_1 = tslib_1.__importStar(require("../util/bbox"));
var constants_1 = require("./constants");
var ViewLayer = /** @class */ (function (_super) {
    tslib_1.__extends(ViewLayer, _super);
    function ViewLayer(props) {
        var _this = _super.call(this, props) || this;
        _this.interactions = [];
        _this.labels = [];
        _this.options = _this.getOptions(props);
        _this.initialOptions = util_1.deepMix({}, _this.options);
        _this.paddingController = new padding_1.default({
            plot: _this,
        });
        _this.stateController = new state_1.default({
            plot: _this,
        });
        _this.themeController = new theme_1.default();
        return _this;
    }
    ViewLayer.getDefaultOptions = function () {
        return {
            renderer: 'canvas',
            title: {
                visible: false,
                alignTo: 'left',
                text: '',
            },
            description: {
                visible: false,
                text: '',
                alignTo: 'left',
            },
            padding: 'auto',
            legend: {
                visible: true,
                position: 'bottom-center',
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: true,
                crosshairs: {
                    type: 'x',
                },
                offset: 20,
            },
            xAxis: {
                visible: true,
                grid: {
                    visible: false,
                },
                line: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    visible: true,
                    autoRotate: true,
                    autoHide: true,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
            yAxis: {
                visible: true,
                grid: {
                    visible: true,
                },
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: false,
                },
                title: {
                    autoRotate: true,
                    visible: false,
                    spacing: 12,
                },
            },
            label: {
                visible: false,
            },
            interactions: [{ type: 'tooltip' }, { type: 'legend-active' }, { type: 'legend-filter' }],
            animation: true,
        };
    };
    ViewLayer.prototype.getOptions = function (props) {
        var curOptions = this.options || {};
        var options = _super.prototype.getOptions.call(this, props);
        // @ts-ignore
        var defaultOptions = this.constructor.getDefaultOptions(props);
        // interactions 需要合并去重下，如果有更新 interactions，需要去掉当前的 interactions 配置
        var interactions = util_1.reduce(util_1.flatten(util_1.map([options, defaultOptions, util_1.hasKey(props, 'interactions') ? props : curOptions], function (src) {
            return util_1.get(src, 'interactions', []);
        })), function (result, cur) {
            var idx = util_1.findIndex(result, function (item) { return item.type === cur.type; });
            if (idx >= 0) {
                result.splice(idx, 1);
            }
            return tslib_1.__spreadArrays(result, [cur]);
        }, []);
        return util_1.deepMix({}, options, defaultOptions, curOptions, props, { interactions: interactions });
    };
    ViewLayer.prototype.beforeInit = function () {
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.BEFORE_INIT);
        _super.prototype.beforeInit.call(this);
    };
    ViewLayer.prototype.init = function () {
        var _this = this;
        _super.prototype.init.call(this);
        this.theme = this.themeController.getTheme(this.options, this.type);
        this.config = {
            data: this.processData(this.options.data),
            scales: {},
            legends: {},
            tooltip: {
                showTitle: true,
            },
            axes: {},
            coordinate: { type: 'cartesian' },
            geometries: [],
            annotations: [],
            interactions: [],
            theme: this.theme,
            panelRange: {},
            animate: {},
            views: [],
        };
        this.paddingController.clear();
        this.drawTitle();
        this.drawDescription();
        // 有些interaction要调整配置项，所以顺序提前
        this.interaction();
        this.coord();
        this.scale();
        this.axis();
        this.tooltip();
        this.legend();
        this.addGeometry();
        this.annotation();
        this.animation();
        this.viewRange = this.getViewRange();
        var region = this.viewRangeToRegion(this.viewRange);
        this.view = new dependents_1.View({
            parent: null,
            canvas: this.canvas,
            backgroundGroup: this.container.addGroup(),
            middleGroup: this.container.addGroup(),
            foregroundGroup: this.container.addGroup(),
            padding: this.paddingController.getPadding(),
            theme: this.theme,
            options: this.config,
            limitInPlot: this.isLimitInPlot(),
            region: region,
        });
        this.applyInteractions();
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
            _this.afterRender();
        });
    };
    ViewLayer.prototype.afterInit = function () {
        _super.prototype.afterInit.call(this);
        if (!this.view || this.view.destroyed) {
            return;
        }
        if (this.options.padding !== 'auto') {
            this.parseEvents();
        }
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.AFTER_INIT);
    };
    ViewLayer.prototype.afterRender = function () {
        var _a, _b;
        if (!this.view || this.view.destroyed) {
            return;
        }
        var options = this.options;
        var padding = options.padding ? options.padding : this.config.theme.padding;
        /** defaultState */
        if (options.defaultState && padding !== 'auto') {
            this.stateController.defaultStates(options.defaultState);
        }
        /** autopadding */
        if (padding === 'auto') {
            this.paddingController.processAutoPadding();
        }
        if (((_b = (_a = options.tooltip) === null || _a === void 0 ? void 0 : _a.custom) === null || _b === void 0 ? void 0 : _b.onChange) && options.padding !== 'auto') {
            this.customTooltip();
        }
    };
    /** 完整生命周期渲染 */
    ViewLayer.prototype.render = function () {
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.BEFORE_RENDER);
        _super.prototype.render.call(this);
        var data = this.options.data;
        if (!util_1.isEmpty(data)) {
            this.view.render();
        }
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.AFTER_RENDER);
    };
    /** 画布重绘 */
    ViewLayer.prototype.repaint = function () {
        if (this.canvas) {
            this.canvas.draw();
        }
    };
    ViewLayer.prototype.getScaleByField = function (field) {
        return this.view.getScaleByField(field);
    };
    ViewLayer.prototype.getXScale = function () {
        var xField = this.options.xField;
        if (xField) {
            return this.view.getScaleByField(xField);
        }
    };
    ViewLayer.prototype.getYScale = function () {
        var yField = this.options.yField;
        if (yField) {
            return this.view.getScaleByField(yField);
        }
    };
    ViewLayer.prototype.getColorScale = function () {
        var options = this.options;
        if (util_1.contains(options, 'colorField')) {
            return this.view.getScaleByField(options);
        }
    };
    ViewLayer.prototype.getShapes = function () {
        var geometries = this.view.geometries;
        var shapes = {};
        // todo: geometry 类型转译
        util_1.each(geometries, function (geom) {
            var type = geom.type;
            shapes[type] = geom.getShapes();
        });
        return shapes;
    };
    /** 销毁 */
    ViewLayer.prototype.destroy = function () {
        this.doDestroy();
        _super.prototype.destroy.call(this);
    };
    /** 更新配置项 */
    ViewLayer.prototype.updateConfig = function (cfg) {
        this.doDestroy();
        if (!cfg.padding && this.initialOptions.padding && this.initialOptions.padding === 'auto') {
            cfg.padding = 'auto';
        }
        this.options = this.getOptions(cfg);
        this.processOptions(this.options);
    };
    ViewLayer.prototype.changeData = function (data) {
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.BEFORE_CHANGE_DATA);
        var isEmptyBefore = util_1.isEmpty(this.options.data);
        this.options.data = this.processData(data);
        // 如果之前没有 data
        if (isEmptyBefore) {
            this.options.padding = this.initialOptions.padding || 'auto';
            this.view.data(this.options.data);
            this.view.render();
        }
        else {
            this.view.changeData(this.options.data);
        }
        this.emit(constants_1.VIEW_LAYER_LIFE_CYCLE.AFTER_CHANGE_DATA);
    };
    // plot 不断销毁重建，需要一个api获取最新的plot
    ViewLayer.prototype.getPlot = function () {
        return this.view;
    };
    /**
     * 获取已渲染的数据标签组件
     */
    ViewLayer.prototype.getLabels = function () {
        return this.labels;
    };
    // 获取对应的G2 Theme
    ViewLayer.prototype.getTheme = function () {
        if (!this.theme) {
            return this.themeController.getTheme(this.options, this.type);
        }
        return this.theme;
    };
    ViewLayer.prototype.getResponsiveTheme = function () {
        return this.themeController.getResponsiveTheme(this.type);
    };
    // 获取对应的Plot Theme
    ViewLayer.prototype.getPlotTheme = function () {
        return this.themeController.getPlotTheme(this.options, this.type);
    };
    ViewLayer.prototype.getInteractions = function () {
        return this.interactions;
    };
    // 绑定一个外部的stateManager
    ViewLayer.prototype.bindStateManager = function (stateManager, cfg) {
        this.stateController.bindStateManager(stateManager, cfg);
    };
    // 响应状态量更新的快捷方法
    ViewLayer.prototype.setActive = function (condition, style) {
        this.stateController.setState({ type: 'active', condition: condition, style: style });
    };
    ViewLayer.prototype.setSelected = function (condition, style) {
        this.stateController.setState({ type: 'selected', condition: condition, style: style });
    };
    ViewLayer.prototype.setDisable = function (condition, style) {
        this.stateController.setState({ type: 'disable', condition: condition, style: style });
    };
    ViewLayer.prototype.setDefault = function (condition, style) {
        this.stateController.setState({ type: 'default', condition: condition, style: style });
    };
    // 获取 ViewLayer 的数据项
    ViewLayer.prototype.getData = function (start, end) {
        return this.processData((this.options.data || []).slice(start, end));
    };
    ViewLayer.prototype.processData = function (data) {
        return data;
    };
    ViewLayer.prototype.scale = function () {
        /** scale meta配置 */
        // 1. this.config.scales中已有子图形在处理xAxis/yAxis是写入的xField/yField对应的scale信息，这里再检查用户设置的meta，将meta信息合并到默认的scale中
        // 2. 同时xAxis/yAxis中的type优先级更高，覆盖meta中的type配置
        var scaleTypes = util_1.mapValues(this.config.scales, function (scaleConfig) {
            var type = scaleConfig.type;
            return type ? { type: type } : {};
        });
        var scales = util_1.deepMix({}, this.config.scales, this.options.meta || {}, scaleTypes);
        this.setConfig('scales', scales);
    };
    ViewLayer.prototype.axis = function () {
        var xAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'x',
        });
        var yAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'y',
        });
        var axesConfig = {};
        axesConfig[this.options.xField] = xAxis_parser;
        axesConfig[this.options.yField] = yAxis_parser;
        /** 存储坐标轴配置项到config */
        this.setConfig('axes', axesConfig);
    };
    ViewLayer.prototype.tooltip = function () {
        var _a, _b;
        if (this.options.tooltip.visible === false) {
            this.setConfig('tooltip', false);
            return;
        }
        var tooltipOptions = util_1.get(this.options, 'tooltip');
        if ((_a = tooltipOptions.custom) === null || _a === void 0 ? void 0 : _a.container) {
            tooltipOptions.container = tooltipOptions.custom.container;
        }
        if ((_b = tooltipOptions.custom) === null || _b === void 0 ? void 0 : _b.customContent) {
            tooltipOptions.customContent = tooltipOptions.custom.customContent;
        }
        this.setConfig('tooltip', util_1.deepMix({}, tooltipOptions));
        util_1.deepMix(this.config.theme.tooltip, this.options.tooltip.domStyles);
    };
    ViewLayer.prototype.createTooltipContainer = function () {
        var container = document.createElement('div');
        container.className = 'g2-tooltip';
        return container;
    };
    ViewLayer.prototype.customTooltip = function () {
        var customContentCfg = this.options.tooltip.custom;
        var container;
        if (customContentCfg.container) {
            container = util_1.isString(customContentCfg.container)
                ? document.getElementById(customContentCfg.container)
                : customContentCfg.container;
        }
        if (!container) {
            container = this.createTooltipContainer();
        }
        this.view.on('tooltip:show', function (ev) {
            if (customContentCfg === null || customContentCfg === void 0 ? void 0 : customContentCfg.onChange) {
                customContentCfg.onChange(container, ev);
            }
        });
        this.view.hideTooltip();
        this.view.on('tooltip:change', function (ev) {
            customContentCfg.onChange(container, ev);
        });
    };
    ViewLayer.prototype.getLegendPosition = function (position) {
        var positionList = position.split('-');
        // G2 4.0 兼容 XXX-center 到 XXX 的场景
        if (positionList && positionList.length > 1 && positionList[1] === 'center') {
            return positionList[0];
        }
        return position;
    };
    ViewLayer.prototype.legend = function () {
        var _a;
        if (this.options.legend.visible === false) {
            this.setConfig('legends', false);
            return;
        }
        var options = util_1.deepMix({}, this.theme.legend, this.options.legend);
        var legendConfig = {
            position: this.getLegendPosition(util_1.get(options, 'position')),
            offsetX: util_1.get(options, 'offsetX'),
            offsetY: util_1.get(options, 'offsetY'),
            flipPage: util_1.get(options, 'flipPage'),
            marker: util_1.get(options, 'marker'),
            title: ((_a = options.title) === null || _a === void 0 ? void 0 : _a.visible) ? util_1.get(options, 'title') : null,
            itemName: util_1.get(options, 'text'),
        };
        this.setConfig('legends', legendConfig);
    };
    ViewLayer.prototype.annotation = function () {
        var _this = this;
        var config = [];
        if (this.config.coordinate.type === 'cartesian' && this.options.guideLine) {
            util_1.each(this.options.guideLine, function (line) {
                var guideLine = factory_1.getComponent('guideLine', {
                    plot: _this,
                    cfg: line,
                });
                config.push(guideLine);
            });
        }
        this.setConfig('annotations', config);
    };
    ViewLayer.prototype.interaction = function () {
        var _this = this;
        var _a = this.options.interactions, interactions = _a === void 0 ? [] : _a;
        util_1.each(interactions, function (interaction) {
            var type = interaction.type;
            if (type === 'slider' || type === 'scrollbar') {
                var axisConfig = {
                    label: {
                        autoHide: true,
                        autoRotate: false,
                    },
                };
                _this.options.xAxis = util_1.deepMix({}, _this.options.xAxis, axisConfig);
            }
            _this.setConfig('interaction', interaction);
        });
    };
    ViewLayer.prototype.animation = function () {
        if (this.options.animation === false) {
            this.setConfig('animate', false);
        }
    };
    ViewLayer.prototype.applyInteractions = function () {
        var _this = this;
        var range = bbox_1.default.fromBBoxObject(this.layerBBox);
        // 临时去掉 title/description 的占用
        var titleOrDesc = this.title || this.description;
        var extraBBox = new bbox_1.default(range.minX, range.minY, range.width, titleOrDesc ? titleOrDesc.getBBox().maxY : 0);
        range = range.cut(extraBBox, bbox_1.DIRECTION.TOP);
        var _a = this.options.interactions, interactions = _a === void 0 ? [] : _a;
        if (this.interactions) {
            this.interactions.forEach(function (inst) {
                inst.destroy();
            });
        }
        this.interactions = [];
        interactions.forEach(function (interaction) {
            var Ctor = index_1.default.getInteraction(interaction.type, _this.type);
            if (Ctor) {
                var inst = new Ctor({ view: _this.view }, _this, Ctor.getInteractionRange(range, interaction.cfg), interaction.cfg);
                inst.render();
                _this.interactions.push(inst);
            }
        });
    };
    /** 设置G2 config，带有类型推导 */
    ViewLayer.prototype.setConfig = function (key, config) {
        if (key === 'geometry') {
            this.config.geometries.push(config);
            return;
        }
        if (key === 'interaction') {
            this.config.interactions.push(config);
            return;
        }
        if (config === false) {
            this.config[key] = false;
            return;
        }
        util_1.assign(this.config[key], config);
    };
    ViewLayer.prototype.parseEvents = function (eventParser) {
        var _this = this;
        var options = this.options;
        if (options.events) {
            _super.prototype.parseEvents.call(this, options.events);
            var eventmap_1 = eventParser ? eventParser.EVENT_MAP : event_1.EVENT_MAP;
            util_1.each(options.events, function (e, k) {
                if (util_1.isFunction(e)) {
                    var eventName = eventmap_1[k] || k;
                    var handler = e;
                    event_1.onEvent(_this, eventName, handler);
                }
            });
        }
    };
    ViewLayer.prototype.drawTitle = function () {
        var props = this.options;
        var range = this.layerBBox;
        if (this.title) {
            this.title.destroy();
            this.title = null;
        }
        if (common_1.isTextUsable(props.title)) {
            var width = this.width;
            var theme = this.config.theme;
            var title = new description_1.default({
                leftMargin: range.minX + theme.title.padding[3],
                rightMargin: range.maxX - theme.title.padding[1],
                topMargin: range.minY + theme.title.padding[0],
                text: props.title.text,
                style: util_1.mix(theme.title, props.title.style),
                wrapperWidth: width - theme.title.padding[3] - theme.title.padding[1],
                container: this.container.addGroup(),
                theme: theme,
                index: common_1.isTextUsable(props.description) ? 0 : 1,
                plot: this,
                alignTo: props.title.alignTo,
                name: 'title',
            });
            this.title = title;
            this.paddingController.registerPadding(title, 'outer');
        }
    };
    ViewLayer.prototype.drawDescription = function () {
        var props = this.options;
        var range = this.layerBBox;
        if (this.description) {
            this.description.destroy();
            this.description = null;
        }
        if (common_1.isTextUsable(props.description)) {
            var width = this.width;
            var theme = this.config.theme;
            var topMargin = 0;
            if (this.title) {
                var titleBBox = this.title.getBBox();
                topMargin += titleBBox.minY + titleBBox.height;
                topMargin += theme.description.padding[0];
            }
            else {
                // 无title的情况下使用title的上padding
                topMargin += range.minY + theme.title.padding[0];
            }
            var description = new description_1.default({
                leftMargin: range.minX + theme.description.padding[3],
                topMargin: topMargin,
                rightMargin: range.maxX - theme.title.padding[1],
                text: props.description.text,
                style: util_1.mix(theme.description, props.description.style),
                wrapperWidth: width - theme.description.padding[3] - theme.description.padding[1],
                container: this.container.addGroup(),
                theme: theme,
                index: 1,
                plot: this,
                alignTo: props.description.alignTo,
                name: 'description',
            });
            this.description = description;
            this.paddingController.registerPadding(description, 'outer');
        }
    };
    ViewLayer.prototype.doRenderLabel = function (geometry, label) {
        util_1.each(this.labels, function (item) {
            item.destroy();
        });
        this.labels = [];
        var config = {
            layer: this,
            container: geometry.labelsContainer,
            geometry: geometry,
            label: label,
        };
        var Ctor = base_1.getLabelComponent(label.type);
        if (Ctor) {
            var label_1 = new Ctor(config);
            label_1.init();
            label_1.render();
            this.labels.push(label_1);
        }
    };
    /** 抽取destroy和updateConfig共有代码为_destroy方法 */
    ViewLayer.prototype.doDestroy = function () {
        this.doDestroyInteractions();
        this.doDestroyLabels();
        /** 销毁g2.view实例 */
        if (!this.view.destroyed) {
            this.view.destroy();
        }
    };
    ViewLayer.prototype.doDestroyInteractions = function () {
        // 移除注册的 interactions
        if (this.interactions) {
            this.interactions.forEach(function (inst) {
                inst.destroy();
            });
        }
        this.interactions = [];
    };
    ViewLayer.prototype.doDestroyLabels = function () {
        // 移除各 geometry 的 label
        util_1.each(this.labels, function (label) {
            label.destroy();
        });
        this.labels = [];
    };
    ViewLayer.prototype.getViewRange = function () {
        var _this = this;
        // 有 Range 的 Interaction 参与 ViewMargin 计算
        var _a = this.options.interactions, interactions = _a === void 0 ? [] : _a;
        // const layerBBox = this.layerBBox;
        var layerBBox = this.paddingController.processOuterPadding();
        interactions.forEach(function (interaction) {
            var Ctor = index_1.default.getInteraction(interaction.type, _this.type);
            var range = Ctor && Ctor.getInteractionRange(layerBBox, interaction.cfg);
            var position = '';
            if (range) {
                // 先只考虑 Range 靠边的情况
                if (range.maxY === layerBBox.maxY && range.minY > layerBBox.minY) {
                    // margin[2] += range.height;
                    position = 'bottom';
                }
                else if (range.maxX === layerBBox.maxX && range.minX > layerBBox.minX) {
                    // margin[1] += range.width;
                    position = 'right';
                }
                else if (range.minX === layerBBox.minX && range.maxX > layerBBox.maxX) {
                    // margin[3] += range.width;
                    position = 'left';
                }
                else if (range.minY === layerBBox.minY && range.maxY < layerBBox.maxY) {
                    // margin[0] += range.height;
                    position = 'top';
                }
                _this.paddingController.registerPadding({
                    interaction: interaction.type,
                    name: interaction.type,
                    getBBox: function () {
                        return range;
                    },
                    position: position,
                }, 'outer');
            }
        });
        var viewRange = this.paddingController.processOuterPadding();
        return viewRange;
    };
    ViewLayer.prototype.isLimitInPlot = function () {
        var yAxisOptions = this.options.yAxis;
        if (util_1.hasKey(yAxisOptions, 'max') ||
            util_1.hasKey(yAxisOptions, 'min') ||
            util_1.hasKey(yAxisOptions, 'maxLimit') ||
            util_1.hasKey(yAxisOptions, 'minLimit')) {
            return true;
        }
        return false;
    };
    ViewLayer.prototype.viewRangeToRegion = function (viewRange) {
        var _a = this, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        var start = { x: 0, y: 0 }, end = { x: 1, y: 1 };
        start.x = viewRange.minX / (x + width);
        start.y = viewRange.minY / (y + height);
        end.x = viewRange.maxX / (x + width);
        end.y = viewRange.maxY / (y + height);
        return {
            start: start,
            end: end,
        };
    };
    return ViewLayer;
}(layer_1.default));
exports.default = ViewLayer;

},{"../components/description":411,"../components/factory":412,"../components/label/base":414,"../dependents":425,"../interaction/index":444,"../util/bbox":672,"../util/common":674,"../util/event":677,"./constants":386,"./controller/padding":389,"./controller/state":390,"./controller/theme":391,"./layer":393,"@antv/util":803,"tslib":894}],396:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var scale_1 = require("@antv/scale");
var description_1 = tslib_1.__importDefault(require("../components/description"));
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var layer_1 = tslib_1.__importDefault(require("../base/layer"));
var common_1 = require("../util/common");
var theme_1 = tslib_1.__importDefault(require("../base/controller/theme"));
var theme_2 = require("../theme");
var LEGEND_MARGIN = 5;
var ComboViewLayer = /** @class */ (function (_super) {
    tslib_1.__extends(ComboViewLayer, _super);
    function ComboViewLayer(props) {
        var _this = _super.call(this, props) || this;
        _this.geomLayers = [];
        _this.legends = [];
        _this.requiredField = ['xField', 'yField'];
        _this.options = _this.getOptions(props);
        _this.initialOptions = util_1.deepMix({}, props);
        _this.themeController = new theme_1.default();
        return _this;
    }
    ComboViewLayer.getDefaultOptions = function () {
        return {
            title: {
                visible: false,
                alignTo: 'left',
                text: '',
            },
            description: {
                visible: false,
                text: '',
                alignTo: 'left',
            },
        };
    };
    ComboViewLayer.prototype.getOptions = function (props) {
        var curOptions = this.options || {};
        var options = _super.prototype.getOptions.call(this, props);
        // @ts-ignore
        var defaultOptions = this.constructor.getDefaultOptions(props);
        return util_1.deepMix({}, options, defaultOptions, curOptions, props);
    };
    ComboViewLayer.prototype.checkData = function () {
        var _this = this;
        var _a, _b;
        var _c = this.options, data = _c.data, xField = _c.xField, yField = _c.yField;
        // 判断1: 没有配置必选字段时不绘制
        for (var i = 0; i < this.requiredField.length; i++) {
            var field = this.requiredField[i];
            if (!util_1.hasKey(this.options, field)) {
                return false;
            }
        }
        // 判断2: yField不是数组或只设置了一个字段时不绘制
        if (!util_1.isArray(yField) || yField.length < 2) {
            return false;
        }
        // 判断3:data为空时不绘制 data:[]
        if (!util_1.isArray(data) || data.length === 0) {
            return false;
        }
        // 判断4: 内嵌两层空数据时不绘制 data:[[],[]]
        if (((_a = data[0]) === null || _a === void 0 ? void 0 : _a.length) === 0 && ((_b = data[1]) === null || _b === void 0 ? void 0 : _b.length) === 0) {
            return false;
        }
        // 判断5：一层数据为空时，利用相关映射字段补齐数据 data:[[],[{type:'a',value:10}]
        util_1.each(data, function (d, index) {
            if (!util_1.isArray(d) || d.length === 0) {
                var mockData = _this.getMockData(index);
                data[index] = mockData;
            }
        });
        // 判断6: 两份数据xField或值不一致时不绘制
        if (!data[0][0][xField] || !data[1][0][xField]) {
            return false;
        }
        return true;
    };
    ComboViewLayer.prototype.init = function () {
        _super.prototype.init.call(this);
        this.theme = this.themeController.getTheme(this.options, this.type);
        this.drawTitle();
        this.drawDescription();
    };
    ComboViewLayer.prototype.updateConfig = function (cfg) {
        this.doDestroy();
        this.options = this.getOptions(cfg);
        this.processOptions(this.options);
    };
    ComboViewLayer.prototype.changeData = function (data) {
        if ((data && data.length < 2) || !util_1.isArray(data[0])) {
            return;
        }
        util_1.each(this.geomLayers, function (layer, index) {
            layer.changeData(data[index]);
        });
    };
    ComboViewLayer.prototype.changeDataByIndex = function (data, index) {
        if (util_1.isArray(data[0])) {
            return;
        }
        var geomLayer = this.geomLayers[index];
        geomLayer.changeData(data);
    };
    ComboViewLayer.prototype.doDestroy = function () {
        util_1.each(this.geomLayers, function (layer) {
            layer.doDestroy();
        });
        this.geomLayers = [];
        util_1.each(this.legends, function (legend) {
            legend.destroy();
        });
        this.legends = [];
    };
    ComboViewLayer.prototype.createLayer = function (LayerCtr, data, config) {
        var viewRange = this.getViewRange();
        var layer = new LayerCtr(tslib_1.__assign({ canvas: this.canvas, container: this.container, x: viewRange.minX, y: viewRange.minY, width: viewRange.width, height: viewRange.height, data: data }, config));
        this.geomLayers.push(layer);
        return layer;
    };
    // 临时修复 v1 双轴图在左侧数据为0的时候右侧scale处理错误的问题
    ComboViewLayer.prototype.getLeftYAxisMax = function () {
        var leftScaleData = this.getScaleData(0);
        var rightScaleData = this.getScaleData(1);
        return leftScaleData.min == 0 && leftScaleData.max === 0 ? Math.max(rightScaleData.max, 0) : leftScaleData.max;
    };
    ComboViewLayer.prototype.yAxis = function (index) {
        var leftScaleData = this.getScaleData(0);
        var yAxis = this.options.yAxis;
        var config = index === 0 ? yAxis.leftConfig : yAxis.rightConfig;
        var colorValue = this.colors[index];
        var yAxisConfig = util_1.clone(config);
        var styleMap = {
            title: 'stroke',
            line: 'stroke',
            label: 'fill',
            tickLine: 'stroke',
        };
        if (config.visible && config.colorMapping) {
            util_1.each(yAxisConfig, function (config, name) {
                if (!util_1.isString(config) && util_1.hasKey(styleMap, name)) {
                    var styleKey = styleMap[name];
                    if (!config.style) {
                        config.style = {};
                    }
                    config.style[styleKey] = colorValue;
                }
            });
        }
        if (!config.visible) {
            yAxisConfig.title.visible = false;
            yAxisConfig.tickLine.visible = false;
            yAxisConfig.label.visible = false;
            yAxisConfig.line.visible = false;
            yAxisConfig.visible = true;
        }
        var yAxisGlobalConfig = this.getYAxisGlobalConfig();
        if (index === 0 && leftScaleData.max === 0 && leftScaleData.min === 0) {
            yAxisConfig.max = this.getLeftYAxisMax();
        }
        return util_1.deepMix({}, yAxisGlobalConfig, yAxisConfig);
    };
    ComboViewLayer.prototype.getTicks = function () {
        var yAxis = this.options.yAxis;
        var leftScaleData = this.getScaleData(0);
        // 取到左轴ticks数量
        var Scale = scale_1.getScale('linear');
        var linearScale = new Scale(util_1.deepMix({}, {
            min: 0,
            max: this.getLeftYAxisMax(),
            nice: true,
            values: leftScaleData.values,
        }, {
            tickCount: yAxis.tickCount,
        }));
        var tickCount = linearScale.ticks.length;
        // 生成右轴ticks
        var max = yAxis.max ? linearScale.max : this.getScaleData(1).max;
        var tickInterval = max / (tickCount - 1);
        var ticks = [];
        for (var i = 0; i < tickCount; i++) {
            var tickValue = i * tickInterval;
            if (!Number.isInteger(tickValue)) {
                tickValue = parseFloat(tickValue.toFixed(1));
            }
            ticks.push(tickValue);
        }
        return ticks;
    };
    ComboViewLayer.prototype.getScaleData = function (index) {
        var _a = this.options, data = _a.data, yField = _a.yField, yAxis = _a.yAxis;
        var values = [];
        util_1.each(data[index], function (d) {
            values.push(d[yField[index]]);
        });
        values.sort(function (a, b) { return a - b; });
        var min = values[0];
        var max = yAxis.max ? yAxis.max : values[values.length - 1];
        return { min: min, max: max, values: values };
    };
    ComboViewLayer.prototype.getDataByXField = function (value, index) {
        var _a = this.options, data = _a.data, xField = _a.xField;
        var dataSource = data[index];
        return dataSource.filter(function (d) {
            return d[xField] === value;
        });
    };
    ComboViewLayer.prototype.getYAxisGlobalConfig = function () {
        var _a = this.options.yAxis, min = _a.min, max = _a.max, tickCount = _a.tickCount;
        return { min: min, max: max, tickCount: tickCount };
    };
    ComboViewLayer.prototype.adjustLayout = function () {
        var _this = this;
        var _a, _b;
        var bleeding = theme_2.getGlobalTheme().bleeding;
        if (util_1.isArray(bleeding)) {
            util_1.each(bleeding, function (it, index) {
                if (typeof bleeding[index] === 'function') {
                    bleeding[index] = bleeding[index](_this.options);
                }
            });
        }
        var viewRange = this.getViewRange();
        var leftPadding = this.transfromPadding(this.geomLayers[0].options.padding);
        var rightPadding = this.transfromPadding(this.geomLayers[1].options.padding);
        // 获取legendHeight并加入上部padding
        var legendHeight = 0;
        var legendABBox;
        var legendBBBox;
        if ((_a = this.options.legend) === null || _a === void 0 ? void 0 : _a.visible) {
            legendABBox = this.legends[0].getLayoutBBox();
            legendBBBox = this.legends[1].getLayoutBBox();
            legendHeight = legendABBox.height + LEGEND_MARGIN * 2;
        }
        // 同步左右padding
        // const uniquePadding = [leftPadding[0] + legendHeight, rightPadding[1], rightPadding[2], leftPadding[3]];
        var uniquePadding = leftPadding.map(function (item, index) {
            // 兼容老版本
            if (index === 0) {
                return Math.max.apply(null, [item + legendHeight, rightPadding[index]]);
            }
            return Math.max.apply(null, [item, rightPadding[index]]);
        });
        this.geomLayers[0].updateConfig({
            padding: uniquePadding,
        });
        this.geomLayers[0].render();
        this.geomLayers[1].updateConfig({
            padding: uniquePadding,
        });
        this.geomLayers[1].render();
        // 更新legend的位置
        if ((_b = this.options.legend) === null || _b === void 0 ? void 0 : _b.visible) {
            this.legends[0].setLocation({
                x: bleeding[3],
                y: viewRange.minY + LEGEND_MARGIN,
            });
            this.legends[1].setLocation({
                x: viewRange.maxX - bleeding[1] - legendBBBox.width,
                y: viewRange.minY + LEGEND_MARGIN,
            });
        }
    };
    /**
     * padding 预处理
     * @param {string | number | number[]} padding
     */
    ComboViewLayer.prototype.transfromPadding = function (padding) {
        if (typeof padding === 'string' || typeof padding === 'number') {
            return [Number(padding)];
        }
        return padding;
    };
    ComboViewLayer.prototype.legendFilter = function (index) {
        var _this = this;
        var legend = this.legends[index];
        var legend_group = legend.get('group');
        legend_group.on('click', function () {
            var item = legend.get('items')[0];
            if (!item.unchecked) {
                legend.setItemState(item, 'unchecked', true);
                _this.hideLayer(index);
            }
            else {
                legend.setItemState(item, 'unchecked', false);
                _this.showLayer(index);
            }
        });
    };
    ComboViewLayer.prototype.hideLayer = function (index) {
        var layer = this.geomLayers[index];
        var field = this.options.yField[index];
        // 隐藏layer时只隐藏yAxis和geometry
        var view = layer.view;
        var axisContainer = this.getYAxisContainer(view, field);
        if (axisContainer) {
            axisContainer.set('visible', false);
        }
        this.setGeometryVisibility(view, false);
        this.canvas.draw();
    };
    ComboViewLayer.prototype.showLayer = function (index) {
        var layer = this.geomLayers[index];
        var field = this.options.yField[index];
        var view = layer.view;
        var axisContainer = this.getYAxisContainer(view, field);
        if (axisContainer) {
            axisContainer.set('visible', true);
        }
        this.setGeometryVisibility(view, true);
        this.canvas.draw();
    };
    ComboViewLayer.prototype.setGeometryVisibility = function (view, show) {
        util_1.each(view.geometries, function (geom) {
            var container = geom.container, labelsContainer = geom.labelsContainer;
            if (container) {
                container.set('visible', show);
            }
            if (labelsContainer) {
                labelsContainer.set('visible', show);
            }
        });
    };
    ComboViewLayer.prototype.getYAxisContainer = function (view, field) {
        var container;
        var axisCtr = view.controllers.filter(function (ctr) {
            return util_1.hasKey(ctr, 'axisContainer');
        })[0];
        if (axisCtr) {
            var ctr = axisCtr;
            var axisGroups = ctr.axisContainer.get('children');
            util_1.each(axisGroups, function (g) {
                var axisField = g.get('component').get('field');
                if (axisField === field) {
                    container = g;
                }
            });
        }
        return container;
    };
    ComboViewLayer.prototype.getUnCheckedValue = function () {
        var value = [];
        util_1.each(this.legends, function (legend) {
            var uncheckedItems = legend.getItemsByState('unchecked');
            util_1.each(uncheckedItems, function (item) {
                value.push(item.name);
            });
        });
        return value;
    };
    ComboViewLayer.prototype.drawTitle = function () {
        var props = this.options;
        var range = this.layerBBox;
        if (this.title) {
            this.title.destroy();
            this.title = null;
        }
        if (common_1.isTextUsable(props.title)) {
            var width = this.width;
            var theme = this.theme;
            var title = new description_1.default({
                leftMargin: range.minX + theme.title.padding[3],
                rightMargin: range.maxX - theme.title.padding[1],
                topMargin: range.minY + theme.title.padding[0],
                text: props.title.text,
                style: util_1.mix(theme.title, props.title.style),
                wrapperWidth: width - theme.title.padding[3] - theme.title.padding[1],
                container: this.container.addGroup(),
                theme: theme,
                index: common_1.isTextUsable(props.description) ? 0 : 1,
                plot: this,
                alignTo: props.title.alignTo,
                name: 'title',
            });
            this.title = title;
        }
    };
    ComboViewLayer.prototype.drawDescription = function () {
        var props = this.options;
        var range = this.layerBBox;
        if (this.description) {
            this.description.destroy();
            this.description = null;
        }
        if (common_1.isTextUsable(props.description)) {
            var width = this.width;
            var theme = this.theme;
            var topMargin = 0;
            if (this.title) {
                var titleBBox = this.title.getBBox();
                topMargin += titleBBox.minY + titleBBox.height;
                topMargin += theme.description.padding[0];
            }
            else {
                // 无title的情况下使用title的上padding
                topMargin += range.minY + theme.title.padding[0];
            }
            var description = new description_1.default({
                leftMargin: range.minX + theme.description.padding[3],
                topMargin: topMargin,
                rightMargin: range.maxX - theme.title.padding[1],
                text: props.description.text,
                style: util_1.mix(theme.description, props.description.style),
                wrapperWidth: width - theme.description.padding[3] - theme.description.padding[1],
                container: this.container.addGroup(),
                theme: theme,
                index: 1,
                plot: this,
                alignTo: props.description.alignTo,
                name: 'description',
            });
            this.description = description;
        }
    };
    ComboViewLayer.prototype.getViewRange = function () {
        if (!this.layerBBox) {
            this.layerBBox = new bbox_1.default(this.x, this.y, this.width, this.height);
        }
        var viewMinX = this.layerBBox.minX;
        var viewMaxX = this.layerBBox.maxX;
        var viewMinY = this.layerBBox.minY;
        var viewMaxY = this.layerBBox.maxY;
        var components = [this.title, this.description];
        util_1.each(components, function (component) {
            if (component) {
                var position = component.position;
                var _a = component.getBBox(), minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;
                if (maxY >= viewMinY && maxY <= viewMaxY && position === 'top') {
                    viewMinY = maxY;
                }
                if (minY >= viewMinY && minY <= viewMaxY && position === 'bottom') {
                    viewMaxY = minY;
                }
                if (maxX > viewMinX && maxX <= viewMaxX && position === 'left') {
                    viewMinX = maxX;
                }
                if (minX >= viewMinX && maxX <= viewMaxX && position === 'right') {
                    viewMaxX = minX;
                }
            }
        });
        return new bbox_1.default(viewMinX, viewMinY, viewMaxX - viewMinX, viewMaxY - viewMinY);
    };
    ComboViewLayer.prototype.getMockData = function (index) {
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        var mock = {};
        mock[xField] = 'null';
        mock[yField[index]] = 0;
        return [mock];
    };
    return ComboViewLayer;
}(layer_1.default));
exports.default = ComboViewLayer;

},{"../base/controller/theme":391,"../base/layer":393,"../components/description":411,"../theme":669,"../util/bbox":672,"../util/common":674,"@antv/scale":747,"@antv/util":803,"tslib":894}],397:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var ColumnLine = /** @class */ (function (_super) {
    tslib_1.__extends(ColumnLine, _super);
    function ColumnLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ColumnLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'columnLine';
        _super.prototype.createLayers.call(this, layerProps);
    };
    ColumnLine.getDefaultOptions = layer_1.default.getDefaultOptions;
    return ColumnLine;
}(plot_1.default));
exports.default = ColumnLine;

},{"../../base/plot":394,"./layer":398,"@antv/util":803,"tslib":894}],398:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var component_1 = require("@antv/component");
var global_1 = require("../../base/global");
var base_1 = tslib_1.__importDefault(require("../base"));
var layer_1 = tslib_1.__importDefault(require("../../plots/line/layer"));
var layer_2 = tslib_1.__importDefault(require("../../plots/column/layer"));
var util_1 = require("@antv/util");
var theme_1 = require("../../theme");
var defaultLineConfig = {
    color: '#f5bc32',
    lineSize: 4,
    connectNull: true,
    point: {
        visible: false,
        size: 3,
        shape: 'circle',
        style: {
            stroke: '#fff',
        },
    },
    label: {
        visible: false,
    },
};
var defaultColumnConfig = {
    color: '#5B8FF9',
};
var defaultYAxisConfig = {
    visible: true,
    colorMapping: true,
    grid: {
        visible: true,
    },
    line: {
        visible: false,
    },
    tickLine: {
        visible: false,
    },
    label: {
        visible: true,
        autoHide: true,
        autoRotate: false,
    },
    title: {
        autoRotate: true,
        visible: false,
        spacing: 12,
    },
};
var ColumnLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(ColumnLineLayer, _super);
    function ColumnLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'columnLine';
        _this.legends = [];
        return _this;
    }
    ColumnLineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            yAxis: {
                leftConfig: defaultYAxisConfig,
                rightConfig: defaultYAxisConfig,
            },
            lineConfig: defaultLineConfig,
            columnConfig: defaultColumnConfig,
            legend: {
                visible: true,
            },
        });
    };
    ColumnLineLayer.prototype.beforeInit = function () {
        var _a, _b;
        var _c = this, options = _c.options, initialOptions = _c.initialOptions;
        if (options.lineSeriesField) {
            options.yAxis.rightConfig.colorMapping = false;
            if (!((_a = initialOptions.lineConfig) === null || _a === void 0 ? void 0 : _a.lineSize)) {
                options.lineConfig.lineSize = 3;
            }
            if (!((_b = initialOptions.lineConfig) === null || _b === void 0 ? void 0 : _b.color)) {
                var _d = theme_1.getGlobalTheme(), colors = _d.colors, colors_20 = _d.colors_20;
                var seriesValue = this.getValueBySeriesField();
                var colorSeries_1 = seriesValue.length > colors.length ? colors_20 : colors;
                var colorPlates_1 = [];
                util_1.each(seriesValue, function (v, index) {
                    colorPlates_1.push(colorSeries_1[index + 1]);
                });
                options.lineConfig.color = colorPlates_1;
            }
        }
    };
    ColumnLineLayer.prototype.init = function () {
        _super.prototype.init.call(this);
        if (!this.checkData()) {
            return;
        }
        var _a = this.options, data = _a.data, meta = _a.meta, xField = _a.xField, yField = _a.yField, lineSeriesField = _a.lineSeriesField, legend = _a.legend, lineConfig = _a.lineConfig, columnConfig = _a.columnConfig, events = _a.events, customMeta = _a.customMeta;
        this.colors = [columnConfig.color, lineConfig.color];
        // draw column
        this.drawColumn();
        //draw line
        var metaInfo = {};
        metaInfo[yField[1]] = { ticks: this.getTicks() };
        var line = this.createLayer(layer_1.default, data[1], tslib_1.__assign({ xField: xField, yField: yField[1], seriesField: lineSeriesField, meta: !customMeta ? util_1.deepMix({}, meta, metaInfo) : meta, xAxis: {
                visible: false,
            }, yAxis: util_1.deepMix({}, {
                position: 'right',
                grid: {
                    visible: false,
                },
                nice: true,
            }, this.yAxis(1)), tooltip: {
                visible: false,
            }, legend: {
                visible: false,
            }, events: events }, lineConfig));
        line.render();
        if (legend.visible) {
            this.customLegend();
        }
        this.adjustLayout();
    };
    ColumnLineLayer.prototype.drawColumn = function () {
        var _this = this;
        var _a = this.options, data = _a.data, xField = _a.xField, yField = _a.yField, xAxis = _a.xAxis, tooltip = _a.tooltip, columnConfig = _a.columnConfig, meta = _a.meta, events = _a.events;
        var column = this.createLayer(layer_2.default, data[0], tslib_1.__assign({ xField: xField, yField: yField[0], meta: meta,
            xAxis: xAxis, yAxis: util_1.deepMix({}, {
                grid: {
                    visible: true,
                },
                nice: true,
            }, this.yAxis(0)), tooltip: util_1.deepMix({}, {
                showMarkers: false,
                custom: {
                    onChange: function (containerDom, ev) {
                        _this.tooltip(containerDom, ev);
                    },
                },
            }, tooltip), events: events }, columnConfig));
        column.render();
    };
    ColumnLineLayer.prototype.tooltip = function (dom, ev) {
        var _this = this;
        var _a = this.options, xField = _a.xField, yField = _a.yField, tooltip = _a.tooltip;
        var originItem = util_1.clone(ev.items[0]);
        var dataItemsA = this.getDataByXField(ev.title, 1);
        var formatter = util_1.get(tooltip, 'formatter');
        if (dataItemsA) {
            util_1.each(dataItemsA, function (d, index) {
                var seriesField = _this.geomLayers[1].options.seriesField;
                var name = seriesField ? d[seriesField] : yField[1];
                // 如果有 formatter 就执行 formatter，否则不处理
                var item = formatter
                    ? formatter(d[xField], d[yField[1]], d[seriesField])
                    : {
                        name: name,
                        value: d[yField[1]],
                    };
                ev.items.push(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, originItem), { mappingData: util_1.deepMix({}, originItem.mappingData, { _origin: dataItemsA }), data: d }), item), { color: util_1.isArray(_this.colors[1]) ? _this.colors[1][index] : _this.colors[1] }));
            });
        }
        if (this.options.legend.visible) {
            var unCheckedValue_1 = this.getUnCheckedValue();
            var totalItems = this.legends[0].get('items').length + this.legends[1].get('items').length;
            // 如果legend全部是unchecked的状态，tooltip不显示
            if (unCheckedValue_1.length === totalItems) {
                dom.style.display = 'none';
                return;
            }
            else {
                dom.style.display = 'block';
            }
            // legend部分checked的时候，根据checked状态filter items
            var uniqKeys_1 = [];
            var uniqItems_1 = [];
            util_1.each(ev.items, function (item) {
                var name = item.name;
                if (!util_1.contains(uniqKeys_1, name) && !util_1.contains(unCheckedValue_1, name)) {
                    uniqKeys_1.push(name);
                    uniqItems_1.push(item);
                }
            });
            util_1.each(ev.items, function (item, index) {
                if (index < uniqItems_1.length) {
                    ev.items[index] = uniqItems_1[index];
                }
                else {
                    ev.items.pop();
                }
            });
        }
    };
    ColumnLineLayer.prototype.customLegend = function () {
        var _this = this;
        var _a = this.options, yField = _a.yField, legend = _a.legend;
        var colors = this.colors;
        var container = this.container.addGroup();
        var legendCfg = legend;
        var symbols = ['square', 'circle'];
        util_1.each(this.geomLayers, function (geom, index) {
            var legend;
            if (geom.options.seriesField) {
                var values = _this.getValueBySeriesField();
                legend = _this.createNormalLegend(values, symbols[index], colors[index], legendCfg, container);
            }
            else {
                legend = _this.createSingleLegend(yField[index], symbols[index], colors[index], legendCfg, container);
            }
            _this.legends.push(legend);
        });
        // 使用legend做图层筛选
        util_1.each(this.geomLayers, function (geom, index) {
            if (geom.options.seriesField) {
                _this.multipleLegendFilter(index, geom.options.seriesField);
            }
            else {
                _this.legendFilter(index);
            }
        });
    };
    ColumnLineLayer.prototype.createSingleLegend = function (name, symbol, color, cfg, container) {
        var markerCfg = util_1.deepMix({}, {
            symbol: symbol,
            style: {
                r: 4,
                fill: color,
            },
        }, cfg.marker);
        var items = [
            {
                name: name,
                unchecked: false,
                marker: markerCfg,
            },
        ];
        var legend = new component_1.Legend.Category({
            id: this.type,
            container: container,
            x: 0,
            y: 0,
            items: items,
            updateAutoRender: true,
            itemBackground: null,
            itemName: cfg.text,
        });
        legend.init();
        legend.render();
        return legend;
    };
    ColumnLineLayer.prototype.createNormalLegend = function (values, symbol, color, cfg, container) {
        var legendItems = [];
        util_1.each(values, function (v, index) {
            legendItems.push({
                name: v,
                unchecked: false,
                marker: {
                    symbol: symbol,
                    style: {
                        r: 4,
                        fill: color[index],
                    },
                },
            });
        });
        var legend = new component_1.Legend.Category({
            id: this.type,
            container: container,
            x: 0,
            y: 0,
            items: legendItems,
            updateAutoRender: true,
            itemBackground: null,
            itemName: cfg.text,
            offsetX: 0,
        });
        legend.init();
        legend.render();
        return legend;
    };
    ColumnLineLayer.prototype.multipleLegendFilter = function (index, field) {
        var _this = this;
        var legend = this.legends[index];
        var filteredValue = [];
        var legend_group = legend.get('group');
        var layerHide = false;
        legend_group.on('click', function (ev) {
            var view = _this.geomLayers[index].view;
            var item = ev.target.get('delegateObject').item;
            if (item.unchecked) {
                if (layerHide === true) {
                    _this.showLayer(index);
                    layerHide = false;
                }
                util_1.pull(filteredValue, item.name);
                view.filter(item.value, function (f) {
                    return !util_1.contains(filteredValue, f);
                });
                view.render();
                legend.setItemState(item, 'unchecked', false);
            }
            else {
                legend.setItemState(item, 'unchecked', true);
                filteredValue.push(item.name);
                if (filteredValue.length === _this.legends[index].get('items').length) {
                    // 如果分组分类全部被uncheck了，直接隐藏图层，这样仍然可以trigger tooltip
                    _this.hideLayer(index);
                    layerHide = true;
                }
                else {
                    view.filter(field, function (f) {
                        return !util_1.contains(filteredValue, f);
                    });
                    view.render();
                }
            }
            _this.canvas.draw();
        });
    };
    ColumnLineLayer.prototype.getValueBySeriesField = function () {
        var _a = this.options, lineSeriesField = _a.lineSeriesField, data = _a.data;
        var lineData = data[1];
        var values = [];
        util_1.each(lineData, function (d) {
            var v = d[lineSeriesField];
            if (!util_1.contains(values, v)) {
                values.push(v);
            }
        });
        return values;
    };
    return ColumnLineLayer;
}(base_1.default));
exports.default = ColumnLineLayer;
global_1.registerPlotType('columnLine', ColumnLineLayer);

},{"../../base/global":392,"../../plots/column/layer":490,"../../plots/line/layer":558,"../../theme":669,"../base":396,"@antv/component":51,"@antv/util":803,"tslib":894}],399:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var DualLine = /** @class */ (function (_super) {
    tslib_1.__extends(DualLine, _super);
    function DualLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DualLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'dualLine';
        _super.prototype.createLayers.call(this, layerProps);
    };
    DualLine.getDefaultOptions = layer_1.default.getDefaultOptions;
    return DualLine;
}(plot_1.default));
exports.default = DualLine;

},{"../../base/plot":394,"./layer":400,"@antv/util":803,"tslib":894}],400:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var component_1 = require("@antv/component");
var global_1 = require("../../base/global");
var base_1 = tslib_1.__importDefault(require("../base"));
var layer_1 = tslib_1.__importDefault(require("../../plots/line/layer"));
var util_1 = require("@antv/util");
var defaultLineConfig = {
    lineSize: 2,
    connectNull: true,
    point: {
        visible: false,
        size: 3,
        shape: 'circle',
        style: {
            stroke: '#fff',
        },
    },
    label: {
        visible: false,
    },
};
var defaultYAxisConfig = {
    visible: true,
    colorMapping: true,
    grid: {
        visible: true,
    },
    line: {
        visible: false,
    },
    tickLine: {
        visible: false,
    },
    label: {
        visible: true,
        autoHide: true,
        autoRotate: false,
    },
    title: {
        autoRotate: true,
        visible: false,
        offset: 12,
    },
};
var DualLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(DualLineLayer, _super);
    function DualLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'dualLine';
        return _this;
    }
    DualLineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            legend: {
                visible: true,
            },
            yAxis: {
                leftConfig: defaultYAxisConfig,
                rightConfig: defaultYAxisConfig,
            },
            // 自古红蓝出cp....
            lineConfigs: [
                util_1.deepMix({}, defaultLineConfig, { color: '#5B8FF9' }),
                util_1.deepMix({}, defaultLineConfig, { color: '#e76c5e' }),
            ],
        });
    };
    DualLineLayer.prototype.init = function () {
        var _this = this;
        _super.prototype.init.call(this);
        if (!this.checkData()) {
            return;
        }
        var _a = this.options, data = _a.data, meta = _a.meta, xField = _a.xField, yField = _a.yField, xAxis = _a.xAxis, tooltip = _a.tooltip, lineConfigs = _a.lineConfigs, legend = _a.legend, events = _a.events, customMeta = _a.customMeta;
        this.colors = [lineConfigs[0].color, lineConfigs[1].color];
        var yAxisGlobalConfig = this.getYAxisGlobalConfig();
        //draw first line
        var leftLine = this.createLayer(layer_1.default, data[0], tslib_1.__assign({ meta: meta,
            xField: xField, yField: yField[0], xAxis: {
                visible: false,
            }, yAxis: util_1.deepMix({}, yAxisGlobalConfig, {
                grid: {
                    visible: false,
                },
                nice: true,
            }, this.yAxis(0)), tooltip: {
                visible: false,
            }, events: events }, lineConfigs[0]));
        leftLine.render();
        //draw second line
        var metaInfo = {};
        metaInfo[yField[1]] = { ticks: this.getTicks() };
        var rightLine = this.createLayer(layer_1.default, data[1], tslib_1.__assign({ xField: xField, yField: yField[1], meta: !customMeta ? util_1.deepMix({}, meta, metaInfo) : meta, serieField: yField[1], xAxis: xAxis, yAxis: util_1.deepMix({}, yAxisGlobalConfig, {
                position: 'right',
                nice: false,
            }, this.yAxis(1)), tooltip: util_1.deepMix({}, {
                showMarkers: false,
                custom: {
                    onChange: function (containerDom, ev) {
                        _this.tooltip(containerDom, ev);
                    },
                },
            }, tooltip), events: events }, lineConfigs[1]));
        rightLine.render();
        if (legend.visible) {
            this.customLegend();
        }
        this.adjustLayout();
    };
    DualLineLayer.prototype.tooltip = function (dom, ev) {
        var unCheckedValue = this.getUnCheckedValue();
        // 如果legend全部是unchecked的状态，tooltip不显示
        if (unCheckedValue.length === this.colors.length) {
            dom.style.display = 'none';
            return;
        }
        else {
            dom.style.display = 'block';
        }
        var _a = this.options, yField = _a.yField, legend = _a.legend;
        var originItem = util_1.clone(ev.items[0]);
        var dataItemsA = this.getDataByXField(ev.title, 0)[0];
        if (dataItemsA) {
            if (util_1.findIndex(ev.items, function (item) { return item.name === yField[0]; }) < 0) {
                ev.items.push(tslib_1.__assign(tslib_1.__assign({}, originItem), { mappingData: util_1.deepMix({}, originItem.mappingData, { _origin: dataItemsA }), data: dataItemsA, name: yField[0], value: dataItemsA[yField[0]], color: this.colors[0] }));
            }
        }
        if (legend.visible) {
            util_1.each(this.legends, function (legend, index) {
                var item = legend.get('items')[0];
                if (item.unchecked) {
                    var spliceIndex = index === 0 ? 1 : 0;
                    ev.items.splice(spliceIndex, 1);
                }
            });
        }
    };
    DualLineLayer.prototype.customLegend = function () {
        var _this = this;
        var _a = this.options, yField = _a.yField, legend = _a.legend;
        var colors = this.colors;
        var container = this.container.addGroup();
        var legendCfg = legend;
        util_1.each(this.geomLayers, function (line, index) {
            var markerCfg = util_1.deepMix({}, {
                symbol: 'circle',
                style: {
                    r: 4,
                    fill: colors[index],
                },
            }, legendCfg.marker);
            var items = [
                {
                    name: yField[index],
                    unchecked: false,
                    marker: markerCfg,
                },
            ];
            var legend = new component_1.Legend.Category({
                id: _this.type,
                container: container,
                x: 0,
                y: 0,
                items: items,
                updateAutoRender: true,
                itemBackground: null,
                itemName: legendCfg.text,
            });
            legend.init();
            legend.render();
            _this.legends.push(legend);
        });
        // 使用legend做图层筛选
        util_1.each(this.geomLayers, function (line, index) {
            _this.legendFilter(index);
        });
    };
    return DualLineLayer;
}(base_1.default));
exports.default = DualLineLayer;
global_1.registerPlotType('dualLine', DualLineLayer);

},{"../../base/global":392,"../../plots/line/layer":558,"../base":396,"@antv/component":51,"@antv/util":803,"tslib":894}],401:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var GroupedColumnLine = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedColumnLine, _super);
    function GroupedColumnLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupedColumnLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedColumnLine';
        _super.prototype.createLayers.call(this, layerProps);
    };
    GroupedColumnLine.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupedColumnLine;
}(plot_1.default));
exports.default = GroupedColumnLine;

},{"../../base/plot":394,"./layer":402,"@antv/util":803,"tslib":894}],402:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var global_1 = require("../../base/global");
var util_1 = require("@antv/util");
var layer_1 = tslib_1.__importDefault(require("../column-line/layer"));
var layer_2 = tslib_1.__importDefault(require("../../plots/grouped-column/layer"));
var theme_1 = require("../../theme");
var defaultLineConfig = {
    color: '#f5bc32',
    lineSize: 4,
    connectNull: true,
    point: {
        visible: false,
        size: 3,
        shape: 'circle',
        style: {
            stroke: '#fff',
        },
    },
    label: {
        visible: false,
    },
};
var defaultColumnConfig = {
    color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16', '#E8684A', '#6DC8EC', '#9270CA', '#FF9D4D', '#269A99', '#FF99C3'],
};
var defaultYAxisConfig = {
    visible: true,
    colorMapping: true,
    grid: {
        visible: true,
    },
    line: {
        visible: false,
    },
    tickLine: {
        visible: false,
    },
    label: {
        visible: true,
        autoHide: true,
        autoRotate: false,
    },
    title: {
        autoRotate: true,
        visible: false,
        spacing: 12,
    },
};
var GroupedColumnLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedColumnLineLayer, _super);
    function GroupedColumnLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'groupedColumnLine';
        _this.requiredField = ['xField', 'yField', 'columnGroupField'];
        return _this;
    }
    GroupedColumnLineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            yAxis: {
                leftConfig: util_1.deepMix({}, defaultYAxisConfig, { colorMapping: false }),
                rightConfig: defaultYAxisConfig,
            },
            lineConfig: defaultLineConfig,
            columnConfig: defaultColumnConfig,
            legend: {
                visible: true,
            },
        });
    };
    GroupedColumnLineLayer.prototype.beforeInit = function () {
        var _a, _b;
        var _c = this, options = _c.options, initialOptions = _c.initialOptions;
        var groupedValue = this.getValueByGroupField();
        if (options.lineSeriesField) {
            options.yAxis.rightConfig.colorMapping = false;
            if (!((_a = initialOptions.lineConfig) === null || _a === void 0 ? void 0 : _a.lineSize)) {
                options.lineConfig.lineSize = 3;
            }
            if (!((_b = initialOptions.lineConfig) === null || _b === void 0 ? void 0 : _b.color)) {
                var _d = theme_1.getGlobalTheme(), colors = _d.colors, colors_20 = _d.colors_20;
                var seriesValue = this.getValueBySeriesField();
                var colorSeries_1 = seriesValue.length > colors.length ? colors_20 : colors;
                var colorPlates_1 = [];
                var startIndex_1 = groupedValue.length;
                util_1.each(seriesValue, function (v, index) {
                    colorPlates_1.push(colorSeries_1[index + startIndex_1]);
                });
                options.lineConfig.color = colorPlates_1;
            }
        }
        var color = this.options.columnConfig.color;
        this.options.columnConfig.color = color.slice(0, groupedValue.length);
    };
    GroupedColumnLineLayer.prototype.drawColumn = function () {
        var _this = this;
        var _a = this.options, data = _a.data, xField = _a.xField, yField = _a.yField, columnGroupField = _a.columnGroupField, xAxis = _a.xAxis, tooltip = _a.tooltip, columnConfig = _a.columnConfig, events = _a.events;
        var column = this.createLayer(layer_2.default, data[0], tslib_1.__assign({ xField: xField, yField: yField[0], groupField: columnGroupField, xAxis: xAxis, yAxis: util_1.deepMix({}, this.yAxis(0), {
                grid: {
                    visible: true,
                },
                nice: true,
            }), legend: {
                visible: false,
            }, tooltip: util_1.deepMix({}, tooltip, {
                showMarkers: false,
                custom: {
                    onChange: function (containerDom, ev) {
                        _this.tooltip(containerDom, ev);
                    },
                },
            }), events: events }, columnConfig));
        column.render();
    };
    GroupedColumnLineLayer.prototype.customLegend = function () {
        var _this = this;
        var _a = this.options, yField = _a.yField, legend = _a.legend;
        var colors = this.colors;
        var container = this.container.addGroup();
        var legendCfg = legend;
        var symbols = ['square', 'circle'];
        util_1.each(this.geomLayers, function (geom, index) {
            var legend;
            if (geom.options.seriesField) {
                var values = _this.getValueBySeriesField();
                legend = _this.createNormalLegend(values, symbols[index], colors[index], legendCfg, container);
            }
            else if (geom.options.groupField) {
                var values = _this.getValueByGroupField();
                legend = _this.createNormalLegend(values, symbols[index], colors[index], legendCfg, container);
            }
            else {
                legend = _this.createSingleLegend(yField[index], symbols[index], colors[index], legendCfg, container);
            }
            _this.legends.push(legend);
        });
        // 使用legend做图层筛选
        util_1.each(this.geomLayers, function (geom, index) {
            if (geom.options.seriesField) {
                _this.multipleLegendFilter(index, geom.options.seriesField);
            }
            else if (geom.options.groupField) {
                _this.multipleLegendFilter(index, geom.options.groupField);
            }
            else {
                _this.legendFilter(index);
            }
        });
    };
    GroupedColumnLineLayer.prototype.getValueByGroupField = function () {
        var _a = this.options, columnGroupField = _a.columnGroupField, data = _a.data;
        var columnData = data[0];
        var values = [];
        util_1.each(columnData, function (d) {
            var v = d[columnGroupField];
            if (!util_1.contains(values, v)) {
                values.push(v);
            }
        });
        return values;
    };
    GroupedColumnLineLayer.prototype.getMockData = function (index) {
        var _a = this.options, xField = _a.xField, yField = _a.yField, columnGroupField = _a.columnGroupField;
        var mockA = {};
        mockA[xField] = 'null_1';
        mockA[yField[index]] = 0;
        mockA[columnGroupField] = 'null_a';
        var mockB = {};
        mockB[xField] = 'null_1';
        mockB[yField[index]] = 1;
        mockB[columnGroupField] = 'null_a';
        return [mockA, mockB];
    };
    return GroupedColumnLineLayer;
}(layer_1.default));
exports.default = GroupedColumnLineLayer;
global_1.registerPlotType('groupedColumnLine', GroupedColumnLineLayer);

},{"../../base/global":392,"../../plots/grouped-column/layer":532,"../../theme":669,"../column-line/layer":398,"@antv/util":803,"tslib":894}],403:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var StackedColumnLine = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumnLine, _super);
    function StackedColumnLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedColumnLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedColumnLine';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StackedColumnLine.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackedColumnLine;
}(plot_1.default));
exports.default = StackedColumnLine;

},{"../../base/plot":394,"./layer":404,"@antv/util":803,"tslib":894}],404:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var global_1 = require("../../base/global");
var util_1 = require("@antv/util");
var layer_1 = tslib_1.__importDefault(require("../column-line/layer"));
var layer_2 = tslib_1.__importDefault(require("../../plots/stacked-column/layer"));
var theme_1 = require("../../theme");
var defaultLineConfig = {
    color: '#f5bc32',
    lineSize: 4,
    connectNull: true,
    point: {
        visible: false,
        size: 3,
        shape: 'circle',
        style: {
            stroke: '#fff',
        },
    },
    label: {
        visible: false,
    },
};
var defaultColumnConfig = {
    color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16', '#E8684A', '#6DC8EC', '#9270CA', '#FF9D4D', '#269A99', '#FF99C3'],
};
var defaultYAxisConfig = {
    visible: true,
    colorMapping: true,
    grid: {
        visible: true,
    },
    line: {
        visible: false,
    },
    tickLine: {
        visible: false,
    },
    label: {
        visible: true,
        autoHide: true,
        autoRotate: false,
    },
    title: {
        autoRotate: true,
        visible: false,
        spacing: 12,
    },
};
var StackedColumnLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumnLineLayer, _super);
    function StackedColumnLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'groupedColumnLine';
        _this.requiredField = ['xField', 'yField', 'columnStackField'];
        return _this;
    }
    StackedColumnLineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            yAxis: {
                leftConfig: util_1.deepMix({}, defaultYAxisConfig, { colorMapping: false }),
                rightConfig: defaultYAxisConfig,
            },
            lineConfig: defaultLineConfig,
            columnConfig: defaultColumnConfig,
            legend: {
                visible: true,
            },
        });
    };
    StackedColumnLineLayer.prototype.beforeInit = function () {
        var _a, _b;
        var stackedValue = this.getValueByStackField();
        var _c = this, options = _c.options, initialOptions = _c.initialOptions;
        if (options.lineSeriesField) {
            options.yAxis.rightConfig.colorMapping = false;
            if (!((_a = initialOptions.lineConfig) === null || _a === void 0 ? void 0 : _a.lineSize)) {
                options.lineConfig.lineSize = 3;
            }
            if (!((_b = initialOptions.lineConfig) === null || _b === void 0 ? void 0 : _b.color)) {
                var _d = theme_1.getGlobalTheme(), colors = _d.colors, colors_20 = _d.colors_20;
                var seriesValue = this.getValueBySeriesField();
                var colorSeries_1 = seriesValue.length > colors.length ? colors_20 : colors;
                var colorPlates_1 = [];
                var startIndex_1 = stackedValue.length;
                util_1.each(seriesValue, function (v, index) {
                    colorPlates_1.push(colorSeries_1[index + startIndex_1]);
                });
                options.lineConfig.color = colorPlates_1;
            }
        }
        var color = this.options.columnConfig.color;
        this.options.columnConfig.color = color.slice(0, stackedValue.length);
    };
    StackedColumnLineLayer.prototype.drawColumn = function () {
        var _this = this;
        var _a = this.options, data = _a.data, xField = _a.xField, yField = _a.yField, columnStackField = _a.columnStackField, xAxis = _a.xAxis, tooltip = _a.tooltip, columnConfig = _a.columnConfig, events = _a.events;
        var column = this.createLayer(layer_2.default, data[0], tslib_1.__assign({ xField: xField, yField: yField[0], stackField: columnStackField, xAxis: xAxis, yAxis: util_1.deepMix({}, this.yAxis(0), {
                grid: {
                    visible: true,
                },
                nice: true,
            }), legend: {
                visible: false,
            }, tooltip: util_1.deepMix({}, tooltip, {
                showMarkers: false,
                custom: {
                    onChange: function (containerDom, ev) {
                        _this.tooltip(containerDom, ev);
                    },
                },
            }), events: events }, columnConfig));
        column.render();
    };
    StackedColumnLineLayer.prototype.customLegend = function () {
        var _this = this;
        var _a = this.options, yField = _a.yField, legend = _a.legend;
        var colors = this.colors;
        var container = this.container.addGroup();
        var legendCfg = legend;
        var symbols = ['square', 'circle'];
        util_1.each(this.geomLayers, function (geom, index) {
            var legend;
            if (geom.options.seriesField) {
                var values = _this.getValueBySeriesField();
                legend = _this.createNormalLegend(values, symbols[index], colors[index], legendCfg, container);
            }
            else if (geom.options.stackField) {
                var values = _this.getValueByStackField();
                legend = _this.createNormalLegend(values, symbols[index], colors[index], legendCfg, container);
            }
            else {
                legend = _this.createSingleLegend(yField[index], symbols[index], colors[index], legendCfg, container);
            }
            _this.legends.push(legend);
        });
        // 使用legend做图层筛选
        util_1.each(this.geomLayers, function (geom, index) {
            if (geom.options.seriesField) {
                _this.multipleLegendFilter(index, geom.options.seriesField);
            }
            else if (geom.options.stackField) {
                _this.multipleLegendFilter(index, geom.options.stackField);
            }
            else {
                _this.legendFilter(index);
            }
        });
    };
    StackedColumnLineLayer.prototype.getValueByStackField = function () {
        var _a = this.options, columnStackField = _a.columnStackField, data = _a.data;
        var columnData = data[0];
        var values = [];
        util_1.each(columnData, function (d) {
            var v = d[columnStackField];
            if (!util_1.contains(values, v)) {
                values.push(v);
            }
        });
        return values;
    };
    StackedColumnLineLayer.prototype.getUnCheckedValue = function () {
        var value = [];
        util_1.each(this.legends, function (legend) {
            var uncheckedItems = legend.getItemsByState('unchecked');
            util_1.each(uncheckedItems, function (item) {
                value.push(item.name);
            });
        });
        return value;
    };
    StackedColumnLineLayer.prototype.getMockData = function (index) {
        var _a = this.options, xField = _a.xField, yField = _a.yField, columnStackField = _a.columnStackField;
        var mockA = {};
        mockA[xField] = 'null_1';
        mockA[yField[index]] = 0;
        mockA[columnStackField] = 'null_a';
        var mockB = {};
        mockB[xField] = 'null_1';
        mockB[yField[index]] = 1;
        mockB[columnStackField] = 'null_a';
        return [mockA, mockB];
    };
    return StackedColumnLineLayer;
}(layer_1.default));
exports.default = StackedColumnLineLayer;
global_1.registerPlotType('stackedColumnLine', StackedColumnLineLayer);

},{"../../base/global":392,"../../plots/stacked-column/layer":623,"../../theme":669,"../column-line/layer":398,"@antv/util":803,"tslib":894}],405:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var formatter_1 = require("../../util/formatter");
function propertyMapping(source, target, field) {
    if (source[field]) {
        target[field] = source[field];
    }
}
var AxisParser = /** @class */ (function () {
    function AxisParser(cfg) {
        this.config = false;
        this.plot = cfg.plot;
        this.dim = cfg.dim;
        this.init();
    }
    AxisParser.prototype.init = function () {
        this.config = false;
        var theme = this.plot.getPlotTheme();
        this.themeConfig = theme && theme.axis && theme.axis[this.dim];
        if (this._needDraw()) {
            this._styleParser();
        }
    };
    AxisParser.prototype._styleParser = function () {
        this.config = tslib_1.__assign({}, this.localProps);
        this._isVisible('line') ? this._lineParser() : (this.config.line = null);
        this._isVisible('grid') ? this._gridParser() : (this.config.grid = null);
        this._isVisible('tickLine') ? this._tickLineParser() : (this.config.tickLine = null);
        this._isVisible('label') ? this._labelParser() : (this.config.label = null);
        this._isVisible('title') ? this._titleParser() : (this.config.title = null);
        propertyMapping(this.localProps, this.config, 'autoHideLabel');
        propertyMapping(this.localProps, this.config, 'autoRotateLabel');
        propertyMapping(this.localProps, this.config, 'autoRotateTitle');
    };
    AxisParser.prototype._needDraw = function () {
        /** 如果在图表配置项里没有设置坐标轴整体的visibility则去对应的theme取 */
        var propos = this.plot.options;
        var propsConfig = propos[this.dim + "Axis"] ? propos[this.dim + "Axis"] : {};
        var config = util_1.deepMix({}, this.themeConfig, propsConfig);
        this.localProps = config;
        if (config.visible) {
            return true;
        }
        return false;
    };
    AxisParser.prototype._lineParser = function () {
        this.config.line = this.localProps.line;
        if (this.localProps.line.style) {
            this.config.line = { style: this.localProps.line.style };
        }
        this.applyThemeConfig('line');
    };
    AxisParser.prototype._gridParser = function () {
        var _this = this;
        var _a, _b, _c, _d, _e;
        var style = (_b = (_a = this.localProps.grid) === null || _a === void 0 ? void 0 : _a.line) === null || _b === void 0 ? void 0 : _b.style;
        var type = (_d = (_c = this.localProps.grid) === null || _c === void 0 ? void 0 : _c.line) === null || _d === void 0 ? void 0 : _d.type;
        var alternateColor = (_e = this.localProps.grid) === null || _e === void 0 ? void 0 : _e.alternateColor;
        if (util_1.isFunction(style)) {
            this.config.grid = function (text, index, count) {
                var cfg = style(text, index, count);
                return {
                    line: {
                        type: type,
                        style: util_1.deepMix({}, util_1.get(_this.themeConfig, "grid.line.style"), cfg),
                    },
                    alternateColor: alternateColor,
                };
            };
        }
        else if (style) {
            this.config.grid = {
                line: {
                    type: type,
                    style: style,
                },
                alternateColor: alternateColor,
            };
            this.applyThemeConfig('grid');
        }
    };
    AxisParser.prototype._tickLineParser = function () {
        this.config.tickLine = this.localProps.tickLine;
        if (this.localProps.tickLine.style) {
            this.config.tickLine = { style: this.localProps.tickLine.style };
        }
        this.applyThemeConfig('tickLine');
    };
    AxisParser.prototype._labelParser = function () {
        var _a = this.localProps.label, style = _a.style, restLabelProps = tslib_1.__rest(_a, ["style"]);
        var labelConfig = tslib_1.__assign({}, restLabelProps);
        if (style) {
            labelConfig.style = tslib_1.__assign({}, this.localProps.label.style);
        }
        labelConfig.style = util_1.deepMix({}, util_1.get(this.themeConfig, 'label.style'), labelConfig.style);
        var formatter = this.parseFormatter(labelConfig);
        labelConfig.formatter = formatter;
        this.config.label = labelConfig;
    };
    AxisParser.prototype._titleParser = function () {
        var titleConfig = tslib_1.__assign({}, this.localProps.title);
        var _a = this.localProps.title, visible = _a.visible, style = _a.style, text = _a.text;
        if (!visible) {
            this.config.showTitle = false;
        }
        else {
            this.config.showTitle = true;
            if (style) {
                titleConfig.style = style;
            }
            titleConfig.style = util_1.deepMix({}, util_1.get(this.config, 'title.style'), titleConfig.textStyle);
            if (text) {
                titleConfig.text = text;
            }
        }
        this.config.title = titleConfig;
    };
    AxisParser.prototype._isVisible = function (name) {
        if (this.localProps[name] && this.localProps[name].visible) {
            return true;
        }
        return false;
    };
    AxisParser.prototype.applyThemeConfig = function (type) {
        this.config[type] = util_1.deepMix({}, util_1.get(this.themeConfig, type + ".style"), this.config[type]);
    };
    AxisParser.prototype.parseFormatter = function (labelConfig) {
        var formatter = formatter_1.combineFormatter(formatter_1.getNoopFormatter(), formatter_1.getPrecisionFormatter(labelConfig.precision), formatter_1.getSuffixFormatter(labelConfig.suffix));
        if (labelConfig.formatter) {
            formatter = formatter_1.combineFormatter(formatter, labelConfig.formatter);
        }
        return formatter;
    };
    return AxisParser;
}());
exports.default = AxisParser;

},{"../../util/formatter":678,"@antv/util":803,"tslib":894}],406:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
// import { compare } from '../../base/controller/state';
// 对axis label和label样式进行缓存
var labels;
var originAttrs;
function onActive(plot, condition) {
    if (!labels) {
        getAllAxisLabels(plot);
    }
    util_1.each(labels, function (label) {
        var _a = beforeCompare(label, condition), labelData = _a.labelData, con = _a.con;
        if (compare(labelData, con)) {
            var disableStyle = labelActiveStyle();
            label.shape.attr(disableStyle);
        }
    });
}
function onDisable(plot, condition) {
    if (!labels) {
        getAllAxisLabels(plot);
    }
    util_1.each(labels, function (label, index) {
        var _a = beforeCompare(label, condition), labelData = _a.labelData, con = _a.con;
        if (compare(labelData, con)) {
            var originAttr = originAttrs[index];
            var disableStyle = labelDisableStyle(originAttr);
            label.shape.attr(disableStyle);
        }
    });
}
function getAllAxisLabels(plot) {
    var _a;
    labels = [];
    originAttrs = [];
    var axes = (_a = plot.view.getController('axis')) === null || _a === void 0 ? void 0 : _a.getComponents();
    util_1.each(axes, function (axisComponentOption) {
        var axis = axisComponentOption.component;
        var labelArr = [];
        var scale = getScale(plot, axis);
        var labelShapes = axis.get('labelRenderer').get('group').get('children');
        util_1.each(labelShapes, function (shape) {
            if (shape.type === 'text') {
                labelArr.push({ shape: shape });
                originAttrs.push(shape.attr());
            }
        });
        if (scale) {
            // 取到scale values作为原始数据，避免被label format的影响
            var ticks_1 = scale.ticks, field_1 = scale.field;
            util_1.each(labelArr, function (label, index) {
                label.value = ticks_1[index];
                label.scaleField = field_1;
                label.type = scale.type;
            });
        }
        labels.push.apply(labels, labelArr);
    });
}
// 获取坐标轴对应的scale
function getScale(plot, axis) {
    var props = plot.options;
    var dim = 'y';
    var position = axis.get('position');
    if (position === 'bottom' || position === 'top') {
        dim = 'x';
    }
    var scaleField = props[dim + "Field"];
    return plot.view.get('scales')[scaleField];
}
function beforeCompare(label, condition) {
    var _a;
    var labelData = (_a = {}, _a[label.scaleField] = label.value, _a);
    var con = util_1.clone(condition);
    if (label.type === 'time' && util_1.isObject(condition) && !util_1.isFunction(con.exp)) {
        con.exp = new Date(con.exp).getTime();
    }
    return { labelData: labelData, con: con };
}
function labelDisableStyle(style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.2 };
}
function labelActiveStyle() {
    return { opacity: 1, fontWeight: 600, fill: 'red' };
}
function compare(origin, condition) {
    if (!util_1.isFunction(condition)) {
        var name_1 = condition.name, exp = condition.exp;
        if (!origin[name_1]) {
            return false;
        }
        if (util_1.isFunction(exp)) {
            return exp(origin[name_1]);
        }
        return origin[name_1] === exp;
    }
    return condition(origin);
}
exports.default = {
    active: onActive,
    selected: onActive,
    disable: onDisable,
};

},{"@antv/util":803}],407:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
var util_1 = require("@antv/util");
/**
 * 组件基类
 *
 *  创建和渲染
 *  - 1. new Component()
 *  - 2. init()
 *  - 2. render()
 *  更新
 *  - 1. update()
 *  - 2. render()
 *
 */
var BaseComponent = /** @class */ (function (_super) {
    tslib_1.__extends(BaseComponent, _super);
    function BaseComponent(config) {
        var _this = _super.call(this) || this;
        _this.container = config.container;
        _this.destroyed = false;
        _this.config = config;
        _this.disposables = [];
        return _this;
    }
    BaseComponent.prototype.init = function () {
        if (!this.group) {
            this.initGroup();
        }
        this.initConfig(this.config);
    };
    BaseComponent.prototype.getGroup = function () {
        return this.group;
    };
    BaseComponent.prototype.getConfig = function () {
        return this.config;
    };
    BaseComponent.prototype.getBBox = function () {
        return this.getGroup().getBBox();
    };
    BaseComponent.prototype.clear = function () {
        this.group.clear();
    };
    BaseComponent.prototype.render = function () {
        this.group.clear();
        this.renderInner(this.group);
        this.getCanvas().draw();
    };
    BaseComponent.prototype.update = function (config) {
        this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), config);
        this.initConfig(this.config);
    };
    BaseComponent.prototype.destroy = function () {
        util_1.each(this.disposables, function (fn) {
            fn();
        });
        this.disposables = [];
        this.group.remove(true);
        this.destroyed = true;
    };
    BaseComponent.prototype.initGroup = function () {
        this.group = this.container.addGroup();
    };
    BaseComponent.prototype.getCanvas = function () {
        return this.container.get('canvas');
    };
    BaseComponent.prototype.addDisposable = function (fn) {
        this.disposables.push(fn);
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BaseComponent.prototype.initConfig = function (config) {
        return;
    };
    return BaseComponent;
}(event_emitter_1.default));
exports.default = BaseComponent;

},{"@antv/event-emitter":94,"@antv/util":803,"tslib":894}],408:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("./base"));
var g_util_1 = require("../util/g-util");
var Breadcrumb = /** @class */ (function (_super) {
    tslib_1.__extends(Breadcrumb, _super);
    function Breadcrumb() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.listeners = [];
        _this.onItemGroupToggleActive = function (itemGroup, active) { return function () {
            var rectShape = itemGroup.get('children').find(function (item) { return item.get('class') === 'item-background'; });
            if (rectShape) {
                rectShape.attr(active ? _this.itemActiveBackgroundStyle : _this.itemBackgroundStyle);
            }
            _this.getCanvas().draw();
        }; };
        return _this;
    }
    Breadcrumb.prototype.destroy = function () {
        this.offEvents();
        _super.prototype.destroy.call(this);
    };
    Breadcrumb.prototype.initConfig = function (config) {
        this.x = config.x;
        this.y = config.y;
        this.items = config.items || [];
        this.itemPadding = config.itemPadding || [2, 8, 2, 8];
        this.backgroundStyle = tslib_1.__assign({ lineWidth: 1, stroke: '#ffffff' }, (config.backgroundStyle || {}));
        this.itemBackgroundStyle = tslib_1.__assign({ fill: '#fff' }, (config.itemBackgroundStyle || {}));
        this.itemActiveBackgroundStyle = tslib_1.__assign({ fill: '#ccc', opacity: 0.2 }, (config.itemActiveBackgroundStyle || {}));
        this.separator = config.separator || '/';
        this.separatorStyle = tslib_1.__assign({ textBaseline: 'top', fill: '#000000', opacity: 0.45 }, (config.separatorStyle || {}));
        this.itemWidth = config.itemWidth;
        this.itemHeight = config.itemHeight;
        this.maxItemWidth = config.maxItemWidth;
        this.textStyle = tslib_1.__assign({ textBaseline: 'top', fill: '#000000', opacity: 0.45 }, (config.textStyle || {}));
    };
    Breadcrumb.prototype.renderInner = function (group) {
        var startX = 0;
        var startY = 0;
        this.offEvents();
        this.renderItems(group, startX, startY);
        //this.bindEvents(group);
        g_util_1.move(this.group, this.x, this.y);
    };
    Breadcrumb.prototype.renderItems = function (group, startX, startY) {
        var _this = this;
        var _a = this.itemPadding, topPadding = _a[0], rightPadding = _a[1], bottomPadding = _a[2], leftPadding = _a[3];
        var itemHeight;
        // background
        var backgroundRect = group.addShape('rect', {
            class: 'breadcrumb-background',
            attrs: tslib_1.__assign({ x: startX, y: startY, width: 1, height: 1 }, this.backgroundStyle),
        });
        this.items.forEach(function (item, idx) {
            // item group
            var itemGroup = group.addGroup({
                id: "item-group-" + item.key,
                // data: item.key,
                data: item,
                class: 'item-group',
                attrs: {
                    cursor: 'pointer',
                },
            });
            // background rect
            var rectShape = itemGroup.addShape('rect', {
                id: "item-background-" + item.key,
                class: 'item-background',
                attrs: tslib_1.__assign(tslib_1.__assign({ x: startX, y: startY, width: leftPadding + rightPadding, height: topPadding + bottomPadding }, _this.itemBackgroundStyle), { cursor: 'pointer' }),
            });
            rectShape.name = 'breadcrumb';
            // text shape
            var textShape = itemGroup.addShape('text', {
                id: "item-text-" + item.key,
                class: 'item-text',
                attrs: tslib_1.__assign(tslib_1.__assign({ x: startX + leftPadding, y: startY + topPadding, text: item.text }, _this.textStyle), { cursor: 'pointer' }),
            });
            textShape.name = 'breadcrumb';
            var textShapeBBox = textShape.getBBox();
            itemHeight = _this.itemHeight || textShapeBBox.height;
            var itemWidth = _this.itemWidth || textShapeBBox.width;
            if (_this.maxItemWidth) {
                itemWidth = Math.min(itemWidth, _this.maxItemWidth);
            }
            // update background rect
            var backgroundRectAttr = {
                x: startX,
                y: startY,
                width: itemWidth + leftPadding + rightPadding,
                height: itemHeight + topPadding + bottomPadding,
            };
            rectShape.attr('width', backgroundRectAttr.width);
            rectShape.attr('height', backgroundRectAttr.height);
            // clip
            itemGroup.setClip({
                type: 'rect',
                attrs: backgroundRectAttr,
            });
            startX += backgroundRectAttr.width;
            // separator
            if (idx !== _this.items.length - 1) {
                var sepShape = group.addShape('text', {
                    attrs: tslib_1.__assign({ x: startX, y: startY + topPadding, text: _this.separator }, _this.separatorStyle),
                    class: 'separator',
                });
                startX += sepShape.getBBox().width;
            }
        });
        // update background
        backgroundRect.attr({
            width: startX,
            height: itemHeight + topPadding + bottomPadding,
        });
    };
    Breadcrumb.prototype.bindEvents = function (group) {
        var _this = this;
        var items = this.items;
        var itemGroups = group.get('children').filter(function (item) { return item.get('class') === 'item-group'; });
        var callback = function (event, itemGroup, emitEventName) { return function () {
            var key = itemGroup.get('data');
            var item = items.find(function (val) { return val.key === key; });
            _this.emit(emitEventName, {
                item: item,
            });
        }; };
        itemGroups.forEach(function (itemGroup) {
            var clickCallback = callback('click', itemGroup, 'onItemClick');
            var dblclickCallback = callback('dblclick', itemGroup, 'onItemDblclick');
            var mouseEnterCallback = _this.onItemGroupToggleActive(itemGroup, true);
            var mouseLeaveCallback = _this.onItemGroupToggleActive(itemGroup, false);
            itemGroup.on('click', clickCallback);
            itemGroup.on('dblclick', dblclickCallback);
            itemGroup.on('mouseenter', mouseEnterCallback);
            itemGroup.on('mouseleave', mouseLeaveCallback);
            _this.listeners.push({ target: itemGroup, event: 'click', callback: clickCallback });
            _this.listeners.push({ target: itemGroup, event: 'dblclick', callback: dblclickCallback });
            _this.listeners.push({ target: itemGroup, event: 'mouseenter', callback: mouseEnterCallback });
            _this.listeners.push({ target: itemGroup, event: 'mouseleave', callback: mouseLeaveCallback });
        });
    };
    Breadcrumb.prototype.offEvents = function () {
        if (this.listeners) {
            this.listeners.forEach(function (_a) {
                var target = _a.target, event = _a.event, callback = _a.callback;
                target.off(event, callback);
            });
        }
        this.listeners = [];
    };
    return Breadcrumb;
}(base_1.default));
exports.default = Breadcrumb;

},{"../util/g-util":679,"./base":407,"tslib":894}],409:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 区域连接组件，用于堆叠柱状图和堆叠条形图
 */
var util_1 = require("@antv/util");
var state_1 = require("../base/controller/state");
function parsePoints(shape, coord) {
    var parsedPoints = [];
    var points = shape.get('origin').points;
    util_1.each(points, function (p) {
        parsedPoints.push(coord.convertPoint(p));
    });
    return parsedPoints;
}
function getDefaultStyle() {
    return {
        areaStyle: {
            opacity: 0.2,
        },
        lineStyle: {
            lineWidth: 2,
            opacity: 0.1,
        },
    };
}
var ConnectedArea = /** @class */ (function () {
    function ConnectedArea(cfg) {
        this.areas = [];
        this.lines = [];
        this._areaStyle = {};
        this._lineStyle = {};
        util_1.assign(this, cfg);
        this._init();
    }
    ConnectedArea.prototype.draw = function () {
        var _this = this;
        var groupedShapes = this._getGroupedShapes();
        util_1.each(groupedShapes, function (shapes, name) {
            if (shapes.length > 0) {
                _this._drawConnection(shapes, name);
            }
        });
        if (this.triggerOn) {
            this._addInteraction();
        }
        else if (this.animation) {
            // 如果定义了triggerOn的方式，则组件是响应交互的，初始化为不可见状态，因此无需动画
            this._initialAnimation();
        }
    };
    ConnectedArea.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
        this.areas = [];
        this.lines = [];
    };
    ConnectedArea.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
    };
    ConnectedArea.prototype.setState = function (state, condition) {
        if (state === 'active') {
            this._onActive(condition);
        }
        if (state === 'disabled') {
            this._onDisabled(condition);
        }
        if (state === 'selected') {
            this._onSelected(condition);
        }
    };
    ConnectedArea.prototype._init = function () {
        var _this = this;
        var layer = this.view.backgroundGroup;
        this.container = layer.addGroup();
        this.draw();
        this.view.on('beforerender', function () {
            _this.clear();
        });
    };
    ConnectedArea.prototype._getGroupedShapes = function () {
        var _this = this;
        // 根据堆叠字段对shape进行分组
        var values = this.view.getScaleByField(this.field).values;
        var geometry = this.view.geometries[0];
        var shapes = geometry.getShapes();
        // 创建分组
        var groups = {};
        util_1.each(values, function (v) {
            groups[v] = [];
        });
        // 执行分组
        util_1.each(shapes, function (shape) {
            var origin = shape.get('origin').data;
            var key = origin[_this.field];
            groups[key].push(shape);
        });
        return groups;
    };
    ConnectedArea.prototype._drawConnection = function (shapes, name) {
        // tslint:disable-next-line: prefer-for-of
        var originColor = shapes[0].attr('fill');
        this._areaStyle[name] = this._getShapeStyle(originColor, 'area');
        this._lineStyle[name] = this._getShapeStyle(originColor, 'line');
        var coord = this.view.geometries[0].coordinate;
        for (var i = 0; i < shapes.length - 1; i++) {
            var current = parsePoints(shapes[i], coord);
            var next = parsePoints(shapes[i + 1], coord);
            var areaStyle = util_1.mix({}, this._areaStyle[name]);
            var lineStyle = util_1.mix({}, this._lineStyle[name]);
            if (this.triggerOn) {
                areaStyle.opacity = 0;
                lineStyle.opacity = 0;
            }
            var area = this.container.addShape('path', {
                attrs: util_1.mix({}, areaStyle, {
                    path: [
                        ['M', current[2].x, current[2].y],
                        ['L', next[1].x, next[1].y],
                        ['L', next[0].x, next[0].y],
                        ['L', current[3].x, current[3].y],
                    ],
                }),
                name: 'connectedArea',
            });
            var line = this.container.addShape('path', {
                attrs: util_1.mix({}, lineStyle, {
                    path: [
                        ['M', current[2].x, current[2].y],
                        ['L', next[1].x, next[1].y],
                    ],
                }),
                name: 'connectedArea',
            });
            // 在辅助图形上记录数据，用以交互和响应状态量
            var originData = shapes[i].get('origin').data;
            area.set('data', originData);
            line.set('data', originData);
            this.areas.push(area);
            this.lines.push(line);
        }
    };
    ConnectedArea.prototype._getShapeStyle = function (originColor, shapeType) {
        var styleName = shapeType + "Style";
        // 如果用户自己指定了样式，则不采用默认颜色映射
        if (this[styleName]) {
            return this[styleName];
        }
        var defaultStyle = getDefaultStyle()[styleName];
        var mappedStyle = { fill: originColor };
        if (shapeType === 'line') {
            mappedStyle = { stroke: originColor };
        }
        return util_1.mix(defaultStyle, mappedStyle);
    };
    ConnectedArea.prototype._addInteraction = function () {
        var _this = this;
        var eventName = this.triggerOn;
        this.view.on("interval:" + eventName, function (e) {
            var origin = e.target.get('origin').data[_this.field];
            _this.setState('active', {
                name: _this.field,
                exp: origin,
            });
            _this.setState('disabled', {
                name: _this.field,
                exp: function (d) {
                    return d !== origin;
                },
            });
            _this.view.canvas.draw();
        });
        // 当鼠标移动到其他区域时取消显示
        this.view.on('mousemove', function (e) {
            if (e.gEvent.target.get('name') !== 'interval') {
                _this.setState('disabled', {
                    name: _this.field,
                    exp: function () {
                        return true;
                    },
                });
            }
        });
    };
    ConnectedArea.prototype._initialAnimation = function () {
        // clipIn动画
        var _a = this.view.coordinateBBox, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        this.container.setClip({
            type: 'rect',
            attrs: {
                x: x,
                y: y,
                width: 0,
                height: height,
            },
        });
        this.container.set('animating', true);
        this.container.getClip().animate({
            width: width,
        }, 600, 'easeQuadOut', function () { }, // eslint-disable-line @typescript-eslint/no-empty-function
        400);
    };
    ConnectedArea.prototype._onActive = function (condition) {
        var _this = this;
        util_1.each(this.areas, function (area) {
            var shapeData = area.get('data');
            var styleField = shapeData[_this.field];
            if (state_1.compare(shapeData, condition)) {
                var opacity = _this._areaStyle[styleField].opacity || 1;
                // area.attr('opacity',this._areaStyle[styleField].opacity || 1);
                area.stopAnimate();
                area.animate({ opacity: opacity }, 400, 'easeQuadOut');
            }
        });
        util_1.each(this.lines, function (line) {
            var shapeData = line.get('data');
            var styleField = shapeData[_this.field];
            if (state_1.compare(shapeData, condition)) {
                var opacity = _this._lineStyle[styleField].opacity || 1;
                // line.attr('opacity',this._lineStyle[styleField].opacity || 1);
                line.stopAnimate();
                line.animate({ opacity: opacity }, 400, 'easeQuadOut');
            }
        });
    };
    ConnectedArea.prototype._onDisabled = function (condition) {
        util_1.each(this.areas, function (area) {
            var shapeData = area.get('data');
            if (state_1.compare(shapeData, condition)) {
                // area.attr('opacity',0);
                area.stopAnimate();
                area.animate({
                    opacity: 0,
                }, 400, 'easeQuadOut');
            }
        });
        util_1.each(this.lines, function (line) {
            var shapeData = line.get('data');
            if (state_1.compare(shapeData, condition)) {
                // line.attr('opacity',0);
                line.stopAnimate();
                line.animate({
                    opacity: 0,
                }, 400, 'easeQuadOut');
            }
        });
    };
    ConnectedArea.prototype._onSelected = function (condition) {
        this._onActive(condition);
    };
    ConnectedArea.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'interval'; });
    };
    return ConnectedArea;
}());
exports.default = ConnectedArea;

},{"../base/controller/state":390,"@antv/util":803}],410:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var animate_1 = require("@antv/g2/lib/animate");
var util_1 = require("@antv/util");
function parsePoints(shape, coord) {
    var parsedPoints = [];
    var points = shape.get('origin').points;
    util_1.each(points, function (p) {
        parsedPoints.push(coord.convertPoint(p));
    });
    return parsedPoints;
}
var ConversionTag = /** @class */ (function () {
    function ConversionTag(cfg) {
        // @ts-ignore
        util_1.deepMix(this, this.constructor.getDefaultOptions(cfg), cfg);
        this._init();
    }
    ConversionTag.getDefaultOptions = function (_a) {
        var transpose = _a.transpose;
        return {
            visible: true,
            size: transpose ? 32 : 80,
            spacing: transpose ? 8 : 12,
            offset: transpose ? 32 : 0,
            arrow: {
                visible: true,
                headSize: 12,
                style: {
                    fill: 'rgba(0, 0, 0, 0.05)',
                },
            },
            value: {
                visible: true,
                style: {
                    fontSize: 12,
                    fill: 'rgba(0, 0, 0, 0.85)',
                },
                formatter: function (valueUpper, valueLower) { return ((100 * valueLower) / valueUpper).toFixed(2) + "%"; },
            },
            animation: util_1.deepMix({}, animate_1.DEFAULT_ANIMATE_CFG),
        };
    };
    ConversionTag.prototype._init = function () {
        var _this = this;
        var layer = this.view.backgroundGroup;
        this.container = layer.addGroup();
        this.draw();
        this.view.on('beforerender', function () {
            _this.clear();
        });
    };
    ConversionTag.prototype.draw = function () {
        var _this = this;
        var transpose = this.transpose;
        var values = this.view.getScaleByField(this.field).values;
        var geometry = this.view.geometries[0];
        var shapes = geometry.getShapes();
        var shapeLower, valueLower, shapeUpper, valueUpper;
        if (transpose) {
            shapes.forEach(function (shapeLower, i) {
                valueLower = values[i];
                if (i++ > 0) {
                    _this._drawTag(shapeUpper, valueUpper, shapeLower, valueLower);
                }
                valueUpper = valueLower;
                shapeUpper = shapeLower;
            });
        }
        else {
            shapes.forEach(function (shapeUpper, i) {
                valueUpper = values[i];
                if (i++ > 0) {
                    _this._drawTag(shapeUpper, valueUpper, shapeLower, valueLower);
                }
                valueLower = valueUpper;
                shapeLower = shapeUpper;
            });
        }
    };
    ConversionTag.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    ConversionTag.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
    };
    ConversionTag.prototype._drawTag = function (shapeUpper, valueUpper, shapeLower, valueLower) {
        var transpose = this.transpose;
        var coord = this.view.geometries[0].coordinate;
        var pointUpper = parsePoints(shapeUpper, coord)[transpose ? 3 : 0];
        var pointLower = parsePoints(shapeLower, coord)[transpose ? 0 : 3];
        this._drawTagArrow(pointUpper, pointLower);
        this._drawTagValue(pointUpper, valueUpper, pointLower, valueLower);
    };
    ConversionTag.prototype._drawTagArrow = function (pointUpper, pointLower) {
        var spacing = this.spacing;
        var _a = this, size = _a.size, offset = _a.offset, animation = _a.animation, transpose = _a.transpose;
        var headSize = this.arrow.headSize;
        var totalHeight = pointLower.y - pointUpper.y;
        var totalWidth = pointLower.x - pointUpper.x;
        var points;
        if (transpose) {
            if ((totalWidth - headSize) / 2 < spacing) {
                // 当柱间距不足容纳箭头尖与间隔时，画三角并挤占间隔
                spacing = Math.max(1, (totalWidth - headSize) / 2);
                points = [
                    [pointUpper.x + spacing, pointUpper.y - offset],
                    [pointUpper.x + spacing, pointUpper.y - offset - size],
                    [pointLower.x - spacing, pointLower.y - offset - size / 2],
                ];
            }
            else {
                // 当柱间距足够时，画完整图形并留出间隔。
                points = [
                    [pointUpper.x + spacing, pointUpper.y - offset],
                    [pointUpper.x + spacing, pointUpper.y - offset - size],
                    [pointLower.x - spacing - headSize, pointLower.y - offset - size],
                    [pointLower.x - spacing, pointLower.y - offset - size / 2],
                    [pointLower.x - spacing - headSize, pointLower.y - offset],
                ];
            }
        }
        else {
            if ((totalHeight - headSize) / 2 < spacing) {
                // 当柱间距不足容纳箭头尖与间隔时，画三角并挤占间隔
                spacing = Math.max(1, (totalHeight - headSize) / 2);
                points = [
                    [pointUpper.x + offset, pointUpper.y + spacing],
                    [pointUpper.x + offset + size, pointUpper.y + spacing],
                    [pointLower.x + offset + size / 2, pointLower.y - spacing],
                ];
            }
            else {
                // 当柱间距足够时，画完整图形并留出间隔。
                points = [
                    [pointUpper.x + offset, pointUpper.y + spacing],
                    [pointUpper.x + offset + size, pointUpper.y + spacing],
                    [pointLower.x + offset + size, pointLower.y - spacing - headSize],
                    [pointLower.x + offset + size / 2, pointLower.y - spacing],
                    [pointLower.x + offset, pointLower.y - spacing - headSize],
                ];
            }
        }
        var tagArrow = this.container.addShape('polygon', {
            name: 'arrow',
            attrs: tslib_1.__assign(tslib_1.__assign({}, this.arrow.style), { points: points }),
        });
        if (animation !== false) {
            this._fadeInTagShape(tagArrow);
        }
    };
    ConversionTag.prototype._drawTagValue = function (pointUpper, valueUpper, pointLower, valueLower) {
        var _a = this, size = _a.size, offset = _a.offset, animation = _a.animation, transpose = _a.transpose;
        var text = this.value.formatter(valueUpper, valueLower);
        var tagValue = this.container.addShape('text', {
            name: 'value',
            attrs: tslib_1.__assign(tslib_1.__assign({}, this.value.style), { text: text, x: transpose ? (pointUpper.x + pointLower.x) / 2 : pointUpper.x + offset + size / 2, y: transpose ? pointUpper.y - offset - size / 2 : (pointUpper.y + pointLower.y) / 2, textAlign: 'center', textBaseline: 'middle' }),
        });
        if (transpose) {
            var totalWidth = pointLower.x - pointUpper.x;
            var textWidth = tagValue.getBBox().width;
            if (textWidth > totalWidth) {
                var cWidth = textWidth / text.length;
                var cEnd = Math.max(1, Math.ceil(totalWidth / cWidth) - 1);
                var textAdjusted = text.slice(0, cEnd) + "...";
                tagValue.attr('text', textAdjusted);
            }
        }
        if (animation !== false) {
            this._fadeInTagShape(tagValue);
        }
    };
    ConversionTag.prototype._fadeInTagShape = function (shape) {
        var animation = this.animation;
        var opacity = shape.attr('opacity');
        shape.attr('opacity', 0);
        var duration = util_1.get(animation, 'appear', animate_1.DEFAULT_ANIMATE_CFG.appear).duration;
        shape.animate({ opacity: opacity }, duration);
    };
    return ConversionTag;
}());
exports.default = ConversionTag;

},{"@antv/g2/lib/animate":217,"@antv/util":803,"tslib":894}],411:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var common_1 = require("../util/common");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
/**
 * 图表的文字描述，一般用于生成图表的标题和副标题
 */
var TextDescription = /** @class */ (function () {
    function TextDescription(cfg) {
        this.position = 'top';
        this.destroyed = false;
        util_1.assign(this, cfg);
        this.init();
    }
    TextDescription.prototype.getBBox = function () {
        var _this = this;
        if (this.shape) {
            // @ts-ignore
            var bbox = this.shape.getBBox();
            if (this.index === 0) {
                return bbox_1.default.fromBBoxObject(bbox);
            }
            var padding_1 = this.plot.theme.description.padding;
            if (util_1.isArray(padding_1)) {
                util_1.each(padding_1, function (it, index) {
                    if (typeof padding_1[index] === 'function') {
                        padding_1[index] = padding_1[index](_this.plot.options.legend.position);
                    }
                });
            }
            return new bbox_1.default(bbox.maxX, bbox.minY, bbox.width, bbox.height);
        }
        return null;
    };
    TextDescription.prototype.clear = function () {
        if (this.shape) {
            // @ts-ignore
            this.shape.attr('text', '');
        }
    };
    TextDescription.prototype.destroy = function () {
        if (this.shape) {
            this.shape.remove();
        }
        this.destroyed = true;
    };
    TextDescription.prototype.init = function () {
        var content = this.textWrapper();
        var _a = this.getPosition(), x = _a.x, y = _a.y;
        this.shape = this.container.addShape('text', {
            attrs: util_1.mix({
                x: x,
                y: y,
                text: content,
            }, this.style, {
                textAlign: this.getTextAlign(),
            }),
        });
        // @ts-ignore
        this.shape.name = this.name;
    };
    TextDescription.prototype.getPosition = function () {
        if (this.alignTo === 'left') {
            return { x: this.leftMargin, y: this.topMargin };
        }
        else if (this.alignTo === 'middle') {
            return { x: this.leftMargin + this.wrapperWidth / 2, y: this.topMargin };
        }
        else {
            return { x: this.rightMargin, y: this.topMargin };
        }
    };
    TextDescription.prototype.getTextAlign = function () {
        if (this.alignTo === 'left') {
            return 'left';
        }
        else if (this.alignTo === 'middle') {
            return 'center';
        }
        else {
            return 'right';
        }
    };
    /**
     * 当text过长时，默认换行
     * 1. 注意初始text带换行符的场景
     */
    TextDescription.prototype.textWrapper = function () {
        var width = this.wrapperWidth;
        var style = this.style;
        var textContent = this.text;
        var tShape = this.container.addShape('text', {
            attrs: tslib_1.__assign({ text: '', x: 0, y: 0 }, style),
        });
        var textArr = textContent.split('\n');
        var wrappedTextArr = textArr.map(function (wrappedText) {
            var text = '';
            var chars = wrappedText.split('');
            var breakIndex = [];
            for (var i = 0; i < chars.length; i++) {
                var item = chars[i];
                tShape.attr('text', (text += item));
                var currentWidth = tShape.getBBox().width - 1;
                if (currentWidth > width) {
                    // 如果是第一个字符就大于宽度不做任何换行处理
                    if (i === 0) {
                        break;
                    }
                    breakIndex.push(i);
                    text = '';
                }
            }
            return common_1.breakText(chars, breakIndex);
        });
        tShape.remove();
        return wrappedTextArr.join('\n');
    };
    return TextDescription;
}());
exports.default = TextDescription;

},{"../util/bbox":672,"../util/common":674,"@antv/util":803,"tslib":894}],412:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getComponentStateMethod = exports.getComponent = void 0;
var tslib_1 = require("tslib");
// components parser
var parser_1 = tslib_1.__importDefault(require("./axis/parser"));
var guide_line_1 = tslib_1.__importDefault(require("./guide-line"));
var parser_2 = tslib_1.__importDefault(require("./label/parser"));
// components state methods
var state_1 = tslib_1.__importDefault(require("./axis/state"));
var state_2 = tslib_1.__importDefault(require("./label/state"));
var state_3 = tslib_1.__importDefault(require("./tooltip/state"));
var COMPONENT_MAPPER = {
    axis: parser_1.default,
    label: parser_2.default,
    guideLine: guide_line_1.default,
};
var STATE_MAPPER = {
    tooltip: state_3.default,
    label: state_2.default,
    axis: state_1.default,
};
function getComponent(name, cfg) {
    var Components = COMPONENT_MAPPER[name];
    return new Components(cfg).config;
}
exports.getComponent = getComponent;
function getComponentStateMethod(name, type) {
    return STATE_MAPPER[name][type];
}
exports.getComponentStateMethod = getComponentStateMethod;

},{"./axis/parser":405,"./axis/state":406,"./guide-line":413,"./label/parser":415,"./label/state":418,"./tooltip/state":424,"tslib":894}],413:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var scale_1 = require("@antv/scale");
var util_1 = require("@antv/util");
var math_1 = require("../util/math");
var GuideLine = /** @class */ (function () {
    function GuideLine(cfg) {
        util_1.assign(this, cfg);
        this._init();
    }
    GuideLine.prototype._init = function () {
        var _a = this.plot.options, yField = _a.yField, data = _a.data;
        var plotData = this.plot.processData(data);
        if (util_1.isEmpty(plotData) || !util_1.isNumber(plotData[0][yField])) {
            return;
        }
        var defaultStyle = this.getDefaultStyle();
        var baseConfig = {
            type: 'line',
            top: true,
            start: this.cfg.start,
            end: this.cfg.end,
        };
        baseConfig.style = util_1.deepMix({}, defaultStyle.line.style, this.cfg.lineStyle);
        baseConfig.text = util_1.deepMix({}, defaultStyle.text, this.cfg.text);
        if (this.cfg.type) {
            var stateValue = this._getState(this.cfg.type);
            var scale = this.getYScale();
            var percent = (1.0 - scale.scale(stateValue)) * 100 + "%";
            var start = ['0%', percent];
            var end = ['100%', percent];
            this.config = util_1.mix({
                start: start,
                end: end,
            }, baseConfig);
        }
        else {
            var _b = this.cfg, start_1 = _b.start, end_1 = _b.end;
            this.config = util_1.clone(baseConfig);
            var xScale_1 = this.getXScale();
            var yScale_1 = this.getYScale();
            var startData_1 = util_1.clone(start_1);
            var endData_1 = util_1.clone(end_1);
            util_1.each(start_1, function (value, index) {
                if (!util_1.contains(util_1.toArray(start_1[index]), '%') || util_1.isNumber(start_1[index])) {
                    if (index === 0) {
                        startData_1[index] = xScale_1.scale(start_1[0]) * 100 + "%";
                    }
                    else {
                        startData_1[index] = (1.0 - yScale_1.scale(start_1[1])) * 100 + "%";
                    }
                }
            });
            util_1.each(end_1, function (value, index) {
                if (!util_1.contains(util_1.toArray(end_1[index]), '%') || util_1.isNumber(end_1[index])) {
                    if (index === 0) {
                        endData_1[index] = xScale_1.scale(end_1[0]) * 100 + "%";
                    }
                    else {
                        endData_1[index] = (1.0 - yScale_1.scale(end_1[1])) * 100 + "%";
                    }
                }
            });
            this.config.start = startData_1;
            this.config.end = endData_1;
        }
    };
    GuideLine.prototype.getYScale = function () {
        var minValue = this._getState('min');
        var maxValue = this._getState('max');
        var Scale = scale_1.getScale('linear');
        // 重新组织scale并使用scale的min和max来计算guide point的百分比位置，以避免受nice的影响
        var scale = new Scale(util_1.mix({}, {
            min: this.plot.type === 'column' ? 0 : minValue,
            max: maxValue,
            nice: true,
            values: this.values,
        }, this.plot.config.scales[this.plot.options.yField]));
        return scale;
    };
    GuideLine.prototype.getXScale = function () {
        var values = this.extractXValue();
        if (util_1.isString(values[0])) {
            var Scale = scale_1.getScale('cat');
            var scale = new Scale(util_1.mix({}, {
                values: values,
            }, this.plot.config.scales[this.plot.options.xField]));
            return scale;
        }
        else {
            var min = Math.min.apply(Math, values);
            var max = Math.max.apply(Math, values);
            var Scale = scale_1.getScale('linear');
            var scale = new Scale(util_1.mix({}, {
                min: min,
                max: max,
                nice: true,
                values: values,
            }, this.plot.config.scales[this.plot.options.xField]));
            return scale;
        }
    };
    GuideLine.prototype._getState = function (type) {
        this.values = this._extractValues();
        if (type === 'median') {
            return math_1.getMedian(this.values);
        }
        if (type === 'mean') {
            return math_1.getMean(this.values);
        }
        if (type === 'max') {
            return Math.max.apply(Math, this.values);
        }
        if (type === 'min') {
            return Math.min.apply(Math, this.values);
        }
    };
    GuideLine.prototype._extractValues = function () {
        var props = this.plot.options;
        var field = props.yField;
        var values = [];
        var data = this.plot.processData(props.data);
        util_1.each(data, function (d) {
            if (util_1.isArray(d[field])) {
                values.push.apply(values, d[field]);
            }
            else {
                values.push(d[field]);
            }
        });
        return values;
    };
    GuideLine.prototype.extractXValue = function () {
        var props = this.plot.options;
        var field = props.xField;
        var values = [];
        var data = this.plot.processData(props.data);
        util_1.each(data, function (d) {
            if (util_1.isArray(d[field])) {
                values.push.apply(values, d[field]);
            }
            else {
                values.push(d[field]);
            }
        });
        return values;
    };
    GuideLine.prototype.getDefaultStyle = function () {
        this.getDefaultTextAlign();
        return {
            line: {
                style: {
                    lineWidth: 2,
                    stroke: '#333333',
                    opacity: 0.7,
                    lineDash: [0, 0],
                },
            },
            text: {
                content: '',
                offsetY: -5,
                style: {
                    fontSize: 14,
                    stroke: 'white',
                    lineWidth: 2,
                    textAlign: this.getDefaultTextAlign(),
                },
            },
        };
    };
    GuideLine.prototype.getDefaultTextAlign = function () {
        var textConfig = this.cfg.text;
        if (textConfig) {
            if (!textConfig.position || textConfig.position === 'start') {
                return 'left';
            }
            if (textConfig.position === 'center') {
                return 'center';
            }
            if (textConfig.position === 'end') {
                return 'right';
            }
        }
    };
    return GuideLine;
}());
exports.default = GuideLine;

},{"../util/math":680,"@antv/scale":747,"@antv/util":803}],414:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLabelComponent = exports.registerLabelComponent = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var dependents_1 = require("../../dependents");
var bbox_1 = tslib_1.__importDefault(require("../../util/bbox"));
var LabelComponent = /** @class */ (function (_super) {
    tslib_1.__extends(LabelComponent, _super);
    function LabelComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.labelsCfgMap = {};
        _this.lastLabelsCfgMap = {};
        return _this;
    }
    LabelComponent.prototype.getGeometry = function () {
        return this.geometry;
    };
    LabelComponent.prototype.getLabels = function () {
        return this.labels;
    };
    LabelComponent.prototype.show = function () {
        this.container.show();
    };
    LabelComponent.prototype.hide = function () {
        this.container.hide();
    };
    LabelComponent.prototype.initConfig = function (config) {
        var _this = this;
        this.layer = config.layer;
        var view = this.layer.view;
        this.view = view;
        this.geometry = config.geometry;
        this.coord = view.getCoordinate();
        this.options = util_1.deepMix(this.getDefaultOptions(), config.label);
        var callback = function () {
            _this.clear();
            _this.labelsCfgMap = {};
            _this.lastLabelsCfgMap = {};
            _this.render();
        };
        view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback);
        this.addDisposable(function () {
            view.off(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback);
        });
    };
    LabelComponent.prototype.renderInner = function (group) {
        var _this = this;
        this.labels = [];
        this.labelsCfgMap = {};
        // 绘制 Label 图形
        util_1.each(this.geometry.elements, function (element, elementIdx) {
            var labels = [].concat(_this.drawLabelItem(group, element, elementIdx));
            util_1.each(labels, function (label, idx) {
                _this.adjustLabel(label, element, idx);
                if (!label.destroyed) {
                    _this.labels.push(label);
                    _this.labelsCfgMap[label.get('id')] = util_1.clone(label.attrs);
                }
            });
        });
        // 执行布局
        this.layoutLabels(this.geometry, this.labels);
        // 执行动画：参照 G2 Label 动画
        var lastLabelsCfgMap = this.lastLabelsCfgMap;
        var labelsCfgMap = this.labelsCfgMap;
        var animateCfg = this.geometry.animateOption ? dependents_1.getDefaultAnimateCfg('label', this.coord) : false;
        util_1.each(labelsCfgMap, function (attrs, id) {
            var shape = group.findById(id);
            if (shape) {
                if (lastLabelsCfgMap[id]) {
                    var oldAttrs = lastLabelsCfgMap[id];
                    // 图形发生更新
                    var updateAnimateCfg = util_1.get(animateCfg, 'update');
                    if (updateAnimateCfg) {
                        shape.stopAnimate();
                        shape.attr(oldAttrs);
                        dependents_1.doAnimate(shape, updateAnimateCfg, {
                            toAttrs: tslib_1.__assign({}, attrs),
                            coordinate: _this.coord,
                        });
                    }
                }
                else {
                    // 新生成的 shape
                    var appearAnimateCfg = util_1.get(animateCfg, 'appear');
                    if (appearAnimateCfg) {
                        shape.stopAnimate();
                        dependents_1.doAnimate(shape, appearAnimateCfg, {
                            toAttrs: tslib_1.__assign({}, shape.attr()),
                            coordinate: _this.coord,
                        });
                    }
                }
            }
            delete lastLabelsCfgMap[id];
        });
        util_1.each(lastLabelsCfgMap, function (attrs, id) {
            // 移除
            var leaveAnimateCfg = util_1.get(animateCfg, 'leave');
            if (leaveAnimateCfg) {
                var tempShape = group.addShape('text', {
                    attrs: attrs,
                    id: id,
                    name: 'label',
                });
                tempShape.stopAnimate();
                dependents_1.doAnimate(tempShape, leaveAnimateCfg, {
                    toAttrs: null,
                    coordinate: _this.coord,
                });
            }
        });
        this.lastLabelsCfgMap = this.labelsCfgMap;
    };
    LabelComponent.prototype.drawLabelText = function (group, attrs, extraCfgs) {
        if (extraCfgs === void 0) { extraCfgs = {}; }
        return group.addShape('text', tslib_1.__assign({ attrs: attrs }, extraCfgs));
    };
    LabelComponent.prototype.drawLabelItem = function (group, element, elementIndex) {
        var _this = this;
        var model = element.getModel();
        var items = [].concat(this.getLabelItemAttrs(element, elementIndex));
        var offset = this.getDefaultOffset();
        var offsetPoint = this.getLabelOffset();
        return util_1.map(items, function (attrs, index) {
            var _a;
            var position = {
                x: attrs.x + offsetPoint.x,
                y: attrs.y + offsetPoint.y,
            };
            var dataItem = util_1.isArray(model.mappingData) ? model.mappingData[index] : model.mappingData;
            var id = _this.getLabelId(dataItem);
            return _this.drawLabelText(group, tslib_1.__assign(tslib_1.__assign({}, attrs), position), (_a = {
                    id: id,
                    name: 'label',
                    offset: offset,
                    element: element
                },
                _a[dependents_1.ORIGIN] = dataItem,
                _a));
        });
    };
    /** 获取当前 Label 的 offset */
    LabelComponent.prototype.getDefaultOffset = function () {
        return Number(this.options.offset);
    };
    /** 默认实现：获取当前 Label 的 offset 点：包括 offset、offsetX、offsetY */
    LabelComponent.prototype.getLabelOffset = function () {
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY;
        return {
            x: util_1.isNumber(offsetX) ? offsetX : 0,
            y: util_1.isNumber(offsetY) ? offsetY : 0,
        };
    };
    /** 通过指定方向和系数获取整体 offset 点 */
    LabelComponent.prototype.getLabelOffsetByDimAndFactor = function (dim, factor) {
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY;
        var offset = this.getDefaultOffset();
        var offsetPoint = {
            x: 0,
            y: 0,
        };
        offsetPoint[dim] = offset * factor;
        if (util_1.isNumber(offsetX)) {
            offsetPoint.x += offsetX;
        }
        if (util_1.isNumber(offsetY)) {
            offsetPoint.y += offsetY;
        }
        return offsetPoint;
    };
    /** 初始化默认全局配置 */
    LabelComponent.prototype.getDefaultOptions = function () {
        return {};
    };
    /** 整理对所有 Labels 的布局调整 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    LabelComponent.prototype.layoutLabels = function (geometry, labels) {
        // empty
    };
    LabelComponent.prototype.getLabelId = function (data) {
        var origin = data._origin;
        var type = this.geometry.type;
        var xScale = this.geometry.getXScale();
        var yScale = this.geometry.getYScale();
        var labelId = this.geometry.getElementId(data);
        if (type === 'line' || type === 'area') {
            // 折线图以及区域图，一条线会对应一组数据，即多个 labels，为了区分这些 labels，需要在 line id 的前提下加上 x 字段值
            labelId += " " + origin[xScale.field];
        }
        else if (type === 'path') {
            // path 路径图，无序，有可能存在相同 x 不同 y 的情况，需要通过 x y 来确定唯一 id
            labelId += " " + origin[xScale.field] + "-" + origin[yScale.field];
        }
        return labelId;
    };
    LabelComponent.prototype.getCoordinateBBox = function () {
        var coord = this.coord;
        var start = coord.start, end = coord.end;
        return new bbox_1.default(Math.min(start.x, end.x), Math.min(start.y, end.y), coord.getWidth(), coord.getHeight());
    };
    return LabelComponent;
}(base_1.default));
exports.default = LabelComponent;
// Label 组件注册
var LABEL_CONFIG_MAP = {};
function registerLabelComponent(type, component) {
    LABEL_CONFIG_MAP[type] = component;
}
exports.registerLabelComponent = registerLabelComponent;
function getLabelComponent(type) {
    return LABEL_CONFIG_MAP[type];
}
exports.getLabelComponent = getLabelComponent;

},{"../../dependents":425,"../../util/bbox":672,"../base":407,"@antv/util":803,"tslib":894}],415:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var formatter_1 = require("../../util/formatter");
var LabelParser = /** @class */ (function () {
    function LabelParser(cfg) {
        this.config = {};
        var plot = cfg.plot, rest = tslib_1.__rest(cfg, ["plot"]);
        this.plot = plot;
        this.originConfig = rest;
        this.init(cfg);
    }
    LabelParser.prototype.getConfig = function () {
        return this.config;
    };
    LabelParser.prototype.init = function (cfg) {
        var _this = this;
        util_1.assign(this.config, cfg);
        this.config.callback = function (val) {
            return _this.parseCallBack(val);
        };
    };
    LabelParser.prototype.parseCallBack = function (val) {
        var labelProps = this.originConfig;
        var theme = this.plot.getPlotTheme();
        var config = tslib_1.__assign({}, labelProps);
        this.parseOffset(labelProps, config);
        if (labelProps.position) {
            if (util_1.isFunction(labelProps.position)) {
                config.position = labelProps.position(val);
            }
            else {
                config.position = labelProps.position;
            }
        }
        this.parseFormatter(config);
        if (labelProps.style) {
            if (util_1.isFunction(labelProps.style)) {
                config.textStyle = labelProps.style(val);
            }
            else {
                config.textStyle = labelProps.style;
            }
        }
        config.textStyle = util_1.deepMix({}, util_1.get(theme, 'label.style'), config.textStyle);
        if (labelProps.autoRotate) {
            config.autoRotate = labelProps.autoRotate;
        }
        return config;
    };
    LabelParser.prototype.parseOffset = function (props, config) {
        var mapper = ['offset', 'offsetX', 'offsetY'];
        var count = 0;
        util_1.each(mapper, function (m) {
            if (util_1.has(props, m)) {
                config[m] = props[m];
                count++;
            }
        });
        // 如用户没有设置offset，而label position又为middle时，则默认设置offset为0
        if (count === 0 && util_1.get(props, 'position') === 'middle') {
            config.offset = 0;
        }
    };
    LabelParser.prototype.parseFormatter = function (config) {
        var labelProps = this.originConfig;
        config.content = function (data, index) {
            // @ts-ignore
            var text = data[labelProps.fields[0]];
            return formatter_1.combineFormatter(formatter_1.getNoopFormatter(), formatter_1.getPrecisionFormatter(labelProps.precision), formatter_1.getSuffixFormatter(labelProps.suffix), labelProps.formatter
                ? labelProps.formatter
                : formatter_1.getNoopFormatter())(text, data, index);
        };
    };
    return LabelParser;
}());
exports.default = LabelParser;

},{"../../util/formatter":678,"@antv/util":803,"tslib":894}],416:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
var point_1 = tslib_1.__importDefault(require("./point"));
var dependents_1 = require("../../dependents");
var view_1 = require("../../util/view");
var bbox_1 = tslib_1.__importDefault(require("../../util/bbox"));
var PointAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PointAutoLabel, _super);
    function PointAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PointAutoLabel.prototype.layoutLabels = function (geometry, labels) {
        var _this = this;
        var _a;
        var dones = [];
        var panel = bbox_1.default.fromBBoxObject(this.getCoordinateBBox());
        var _b = geometry.getXYFields(), xField = _b[0], yField = _b[1];
        var groupedMap = util_1.groupBy(labels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; });
        var offset = (_a = labels[0]) === null || _a === void 0 ? void 0 : _a.get('offset');
        util_1.each(util_1.keys(groupedMap).reverse(), function (xValue) {
            var group = _this.sortLabels(geometry, groupedMap[xValue]);
            while (group.length) {
                var label = group.shift();
                if (view_1.checkOriginEqual(label, dones, function (datumLeft, datumRight) {
                    return datumLeft._origin[xField] === datumRight._origin[xField] &&
                        datumLeft._origin[yField] === datumRight._origin[yField];
                })) {
                    label.set('visible', false);
                    continue;
                }
                view_1.moveInPanel(label, panel);
                var upFail = view_1.checkShapeOverlap(label, dones);
                var downFail = void 0;
                if (upFail) {
                    label.attr('y', label.attr('y') + 2 * offset);
                    view_1.moveInPanel(label, panel);
                    downFail = view_1.checkShapeOverlap(label, dones);
                }
                if (downFail) {
                    label.set('visible', false);
                    continue;
                }
                dones.push(label);
            }
        });
    };
    /** 对 Labels 排序，排序顺序决定自动布局优先级 */
    PointAutoLabel.prototype.sortLabels = function (geometry, labels) {
        var yField = geometry.getXYFields()[1];
        var sorted = [];
        // 顺序：第一个、最后一个、再其他
        labels.sort(function (a, b) {
            return b.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][yField] - a.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][yField];
        });
        if (labels.length > 0) {
            sorted.push(labels.shift());
        }
        if (labels.length > 0) {
            sorted.push(labels.pop());
        }
        sorted.push.apply(sorted, labels);
        return sorted;
    };
    return PointAutoLabel;
}(point_1.default));
exports.default = PointAutoLabel;
base_1.registerLabelComponent('point-auto', PointAutoLabel);

},{"../../dependents":425,"../../util/bbox":672,"../../util/view":715,"./base":414,"./point":417,"@antv/util":803,"tslib":894}],417:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../dependents");
var base_1 = tslib_1.__importStar(require("../../components/label/base"));
var common_1 = require("../../util/common");
/**
 * 说明:
 * 适用于展示面积图和折线图上数据点的label
 * */
var PointLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PointLabel, _super);
    function PointLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PointLabel.prototype.getDefaultOptions = function () {
        var theme = this.layer.theme;
        var _a = theme.label, label = _a === void 0 ? {} : _a;
        return tslib_1.__assign({ offsetX: 0, offsetY: 0 }, label);
    };
    PointLabel.prototype.getLabelOffset = function () {
        return this.getLabelOffsetByDimAndFactor('y', -1);
    };
    PointLabel.prototype.getLabelItemAttrs = function (element, index) {
        var _this = this;
        var _a = this.options, style = _a.style, formatter = _a.formatter;
        var mappingData = util_1.get(element, 'model.mappingData', []);
        return util_1.map(mappingData, function (datum, datumIndex) {
            var _a;
            var value = _this.getValue(datum);
            return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, _this.getPosition(datum)), { text: formatter
                    ? formatter(value, (_a = {},
                        _a[dependents_1._ORIGIN] = datum._origin,
                        _a.mappingDatum = datum,
                        _a.mappingDatumIndex = datumIndex,
                        _a.element = element,
                        _a.elementIndex = index,
                        _a), index)
                    : value, textAlign: 'center', textBaseline: 'middle' }), style);
        });
    };
    PointLabel.prototype.getValue = function (datum) {
        return util_1.get(datum._origin, this.layer.options.yField);
    };
    PointLabel.prototype.getPosition = function (datum) {
        var pos = {
            x: util_1.isArray(datum.x) ? util_1.last(datum.x) : datum.x,
            y: util_1.isArray(datum.y) ? util_1.last(datum.y) : datum.y,
        };
        return pos;
    };
    PointLabel.prototype.layoutLabels = function (geometry, labels) {
        var _this = this;
        if (!this.options.adjustPosition) {
            return;
        }
        var overlap = this.isOverlapped(labels);
        // 规则1：先横向，优先显示横向上变化趋势大的label
        if (overlap) {
            var tolerance_1 = this.getGlobalTolerance(labels);
            util_1.each(labels, function (label, index) {
                if (index > 1) {
                    _this.labelResamplingByChange(label, labels, index, tolerance_1);
                }
            });
        }
        overlap = this.isOverlapped(labels);
        // 规则2： 后纵向，优先保留纵向最高点label
        if (overlap) {
            util_1.each(labels, function (label, index) {
                if (label.get('visible')) {
                    _this.clearOverlapping(label, labels, index);
                }
            });
        }
    };
    PointLabel.prototype.adjustLabel = function () {
        return;
    };
    /** 根据变化进行抽样，保留变化较大的点，类似于点简化算法 */
    PointLabel.prototype.labelResamplingByChange = function (label, labels, index, tolerance) {
        var previous = this.findPrevious(index, labels);
        var currentCenter = this.getCenter(label);
        var previousCenter = this.getCenter(previous);
        var distX = previousCenter.x - currentCenter.x;
        var distY = previousCenter.y - currentCenter.y;
        var dist = Math.sqrt(distX * distX + distY * distY);
        if (dist < tolerance) {
            label.set('visible', false);
        }
    };
    PointLabel.prototype.clearOverlapping = function (label, labels, index) {
        // 找到所有与当前点overlap的node
        var overlapped = [];
        for (var i = 0; i < labels.length; i++) {
            var current = labels[i];
            if (i !== index && current.get('visible')) {
                var isOverlap = common_1.isBBoxIntersect(label.getBBox(), current.getBBox());
                if (isOverlap) {
                    overlapped.push(current);
                }
            }
        }
        // 对overapped label进行处理
        if (overlapped.length > 0) {
            overlapped.push(label);
            overlapped.sort(function (a, b) {
                return b.minY - a.minY;
            });
            // 隐藏除最高点以外的label
            util_1.each(overlapped, function (label, index) {
                if (index > 0) {
                    label.set('visible', false);
                }
            });
        }
    };
    /** 检测一组label中是否存在重叠 **/
    PointLabel.prototype.isOverlapped = function (labels) {
        for (var i = 0; i < labels.length; i++) {
            if (labels[i].get('visible')) {
                var labelABBox = labels[i].getBBox();
                for (var j = 0; j < labels.length; j++) {
                    if (j !== i && labels[j].get('visible')) {
                        var labelBBBox = labels[j].getBBox();
                        var intersection = common_1.isBBoxIntersect(labelABBox, labelBBBox);
                        if (intersection) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    };
    PointLabel.prototype.getGlobalTolerance = function (labels) {
        var labelsClone = labels.slice();
        labelsClone.sort(function (a, b) {
            return b.getBBox().width - a.getBBox().width;
        });
        return Math.round(labelsClone[0].getBBox().width);
    };
    PointLabel.prototype.findPrevious = function (index, labels) {
        for (var i = index - 1; i > 0; i--) {
            if (labels[i].get('visible')) {
                return labels[i];
            }
        }
    };
    PointLabel.prototype.getCenter = function (label) {
        var _a = label.getBBox(), minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;
        return { x: minX + (maxX - minX) / 2, y: minY + (maxY - minY) / 2 };
    };
    return PointLabel;
}(base_1.default));
exports.default = PointLabel;
base_1.registerLabelComponent('point', PointLabel);

},{"../../components/label/base":414,"../../dependents":425,"../../util/common":674,"@antv/util":803,"tslib":894}],418:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var state_1 = require("../../base/controller/state");
// 对label和label样式进行缓存
var labels;
var originAttrs;
function onActive(plot, condition) {
    if (!labels) {
        getAllLabels(plot);
    }
    util_1.each(labels, function (label, index) {
        var origin = label.get('origin');
        if (state_1.compare(origin, condition)) {
            var originAttr = originAttrs[index];
            var style = util_1.mix({}, originAttr, { opacity: 1 });
            label.attr(style);
        }
    });
}
function onDisable(plot, condition) {
    if (!labels) {
        getAllLabels(plot);
    }
    util_1.each(labels, function (label, index) {
        var origin = label.get('origin');
        if (state_1.compare(origin, condition)) {
            var originAttr = originAttrs[index];
            var disableStyle = labelDisableStyle(originAttr);
            label.attr(disableStyle);
        }
    });
}
function getAllLabels(plot) {
    labels = [];
    originAttrs = [];
    var geoms = plot.view.get('elements');
    util_1.each(geoms, function (geom) {
        var geomLabels = geom.get('labels');
        if (geomLabels) {
            util_1.each(geomLabels, function (label) {
                labels.push(label);
                originAttrs.push(label.attr());
            });
        }
    });
}
function labelDisableStyle(style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.2 };
}
exports.default = {
    active: onActive,
    selected: onActive,
    disable: onDisable,
};

},{"../../base/controller/state":390,"@antv/util":803}],419:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dependents_1 = require("../dependents");
var util_1 = require("@antv/util");
var animate_1 = require("@antv/g2/lib/animate");
var DEFAULT_STYLE = {
    stroke: 'transparent',
    fill: '#FCC509',
    lineWidth: 0,
};
var ACTIVE_STYLE = {
    stroke: '#FFF',
    fill: '#FCC509',
    lineWidth: 1,
};
var SELECTED_STYLE = {
    stroke: 'rgba(0,0,0,0.85)',
    fill: '#FCC509',
    lineWidth: 1,
};
/**
 * 标注点 绘制在最顶层
 */
var MarkerPoint = /** @class */ (function () {
    function MarkerPoint(cfg) {
        this.points = [];
        this.labels = [];
        this.name = 'markerPoints';
        this.defaultCfg = {
            offsetX: 0,
            offsetY: 0,
            style: { normal: DEFAULT_STYLE, selected: SELECTED_STYLE, active: ACTIVE_STYLE },
            label: {
                visible: false,
                offsetY: -8,
                position: 'top',
                style: {
                    fill: 'rgba(0, 0, 0, 0.85)',
                },
            },
            animation: false,
        };
        this.view = cfg.view;
        this.size = cfg.size || 6;
        this.config = util_1.deepMix({}, this.defaultCfg, cfg);
        this._init();
    }
    MarkerPoint.prototype.render = function () {
        var dataArray = this.getDataArray();
        this._renderPoints(dataArray);
        this.view.canvas.draw();
        this._addInteraction();
    };
    MarkerPoint.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    MarkerPoint.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.points = [];
        this.labels = [];
    };
    MarkerPoint.prototype.getDataArray = function () {
        var geometry = this.view.geometries[0];
        return geometry.dataArray;
    };
    MarkerPoint.prototype._init = function () {
        var _this = this;
        var layer = this.view.foregroundGroup;
        this.container = layer.addGroup();
        this.render();
        this.view.on('beforerender', function () {
            _this.clear();
        });
    };
    MarkerPoint.prototype._renderPoints = function (dataArray) {
        var _this = this;
        util_1.each(this.config.data, function (dataItem, dataItemIdx) {
            util_1.each(dataArray, function (dataum) {
                var origin = util_1.find(dataum, function (d) { return util_1.isMatch(d._origin, dataItem); });
                if (origin) {
                    var pointAttrs = _this.config.style.normal;
                    var group = _this.container.addGroup({ name: _this.name });
                    var x = origin.x, y = origin.y;
                    if (util_1.isArray(x)) {
                        x = x[0];
                    }
                    if (util_1.isArray(y)) {
                        y = y[0];
                    }
                    var symbol = _this.config.symbol;
                    var _a = _this.config, offsetX = _a.offsetX, offsetY = _a.offsetY;
                    var point = void 0;
                    if (util_1.isString(symbol) && symbol.startsWith('image://')) {
                        var imageUrl = symbol.substr(8);
                        point = group.addShape('image', {
                            attrs: {
                                x: x - _this.size / 2 + offsetX,
                                y: y - _this.size / 2 + offsetY,
                                img: imageUrl,
                                width: _this.size,
                                height: _this.size,
                            },
                        });
                    }
                    else {
                        symbol = util_1.isString(symbol) ? dependents_1.MarkerSymbols[symbol] : symbol;
                        point = group.addShape({
                            type: 'marker',
                            name: 'marker-point',
                            id: "point-" + dataItemIdx,
                            attrs: tslib_1.__assign(tslib_1.__assign({ x: x + offsetX, y: y + offsetY, r: _this.size / 2 }, pointAttrs), { symbol: symbol }),
                        });
                    }
                    _this.points.push(point);
                    _this._animatePoint(point);
                    _this._renderLabel(group, origin, dataItemIdx);
                    group.set('data', dataItem);
                    group.set('origin', origin);
                }
            });
        });
    };
    MarkerPoint.prototype._renderLabel = function (container, origin, index) {
        var labelCfg = this.config.label;
        if (labelCfg && labelCfg.visible) {
            var _a = labelCfg.offsetX, offsetX = _a === void 0 ? 0 : _a, _b = labelCfg.offsetY, offsetY = _b === void 0 ? 0 : _b, formatter = labelCfg.formatter, position = labelCfg.position, field = labelCfg.field;
            var text = origin._origin[field];
            if (formatter) {
                text = formatter(text, { _origin: origin._origin }, index);
            }
            var x = util_1.isArray(origin.x) ? origin.x[0] : origin.x;
            var y = util_1.isArray(origin.y) ? origin.y[0] : origin.y;
            var label = container.addShape('text', {
                name: 'marker-label',
                id: "label-" + index,
                attrs: tslib_1.__assign(tslib_1.__assign({ x: x + offsetX, y: y + offsetY, text: text || '' }, labelCfg.style), { textAlign: 'center', textBaseline: position === 'top' ? 'bottom' : 'top' }),
            });
            this.labels.push(label);
        }
    };
    MarkerPoint.prototype._addInteraction = function () {
        var _this = this;
        var events = this.config.events;
        util_1.each(events, function (cb, eventName) {
            _this.container.on(_this.name + ":" + eventName, function (e) {
                cb(e);
                var target = e.target.get('parent');
                var pointShape = target.get('children')[0];
                if (pointShape) {
                    var data = pointShape.get('data');
                    var id = pointShape.get('id');
                    var condition = { id: id, data: data };
                    if (eventName === 'click') {
                        if (_this.selectedPoint && _this.selectedPoint.get('id') === id) {
                            _this.selectedPoint = null;
                            _this.setState('inactive', condition);
                        }
                        else {
                            _this.selectedPoint = pointShape;
                            _this.setState('selected', condition);
                        }
                    }
                    else if (eventName === 'mouseenter') {
                        _this.setState('active', condition);
                    }
                    else if (eventName === 'mouseleave') {
                        _this.setState('inactive', condition);
                    }
                }
                _this.view.canvas.draw();
            });
            _this.view.on('click', function (e) {
                var target = e.target.get('parent');
                if (!target || (target.get('name') !== _this.name && _this.selectedPoint)) {
                    _this.selectedPoint = null;
                    _this.setState('inactive');
                }
            });
        });
    };
    MarkerPoint.prototype.setState = function (state, condition) {
        var _this = this;
        if (state === 'active') {
            if (!this.selectedPoint || condition.id !== this.selectedPoint.get('id')) {
                this._onActive(condition);
            }
        }
        else if (state === 'inactive') {
            this.points.forEach(function (p) { return _this._onInactive(p); });
        }
        else if (state === 'selected') {
            this._onSelected(condition);
        }
    };
    MarkerPoint.prototype._onActive = function (condition) {
        var _this = this;
        var active = this.config.style.active;
        util_1.each(this.points, function (point) {
            if (point.get('id') === condition.id) {
                util_1.each(active, function (v, k) {
                    point.attr(k, v);
                });
            }
            else {
                _this._onInactive(point);
            }
        });
    };
    MarkerPoint.prototype._onInactive = function (point) {
        var normal = this.config.style.normal;
        if (!this.selectedPoint || point.get('id') !== this.selectedPoint.get('id')) {
            util_1.each(normal, function (v, k) {
                point.attr(k, v);
            });
        }
    };
    MarkerPoint.prototype._onSelected = function (condition) {
        var _this = this;
        var selected = this.config.style.selected;
        util_1.each(this.points, function (point) {
            if (point.get('id') === condition.id) {
                util_1.each(selected, function (v, k) {
                    point.attr(k, v);
                });
            }
            else {
                _this._onInactive(point);
            }
        });
    };
    /** point animation, not for label */
    MarkerPoint.prototype._animatePoint = function (shape) {
        var _a = this.config, animation = _a.animation, size = _a.size;
        if (animation !== false) {
            var _b = animation, _c = _b.endState, endState = _c === void 0 ? {} : _c, _d = _b.animateCfg, animateCfg = _d === void 0 ? animate_1.DEFAULT_ANIMATE_CFG.appear : _d;
            shape.animate(tslib_1.__assign({ r: Number.isNaN(endState.size / 2) ? size / 2 : endState.size / 2 }, endState), animateCfg);
        }
    };
    return MarkerPoint;
}());
exports.default = MarkerPoint;

},{"../dependents":425,"@antv/g2/lib/animate":217,"@antv/util":803,"tslib":894}],420:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var dom_util_1 = require("@antv/dom-util");
var StatisticHtml = /** @class */ (function () {
    function StatisticHtml(cfg) {
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        this.x = this.options.x;
        this.y = this.options.y;
        this.html = this.options.html;
        this.container = this.options.container;
    }
    StatisticHtml.prototype.render = function () {
        if (util_1.isElement(this.container)) {
            this.wrapperNode = dom_util_1.createDom('<div class="g2plot-htmlStatistic"></div>');
            this.container.appendChild(this.wrapperNode);
            dom_util_1.modifyCSS(this.wrapperNode, {
                position: 'absolute',
                pointerEvents: 'none',
            });
            var htmlNode = this.html;
            this.wrapperNode.appendChild(htmlNode);
            this.setDomPosition(this.x, this.y);
        }
    };
    StatisticHtml.prototype.updateHtml = function (content) {
        if (util_1.isType(content, 'HTMLDivElement')) {
            this.wrapperNode.innerHTML = '';
            this.wrapperNode.appendChild(content);
        }
        else {
            this.wrapperNode.innerHTML = content;
        }
        this.setDomPosition(this.x, this.y);
    };
    StatisticHtml.prototype.updatePosition = function (x, y) {
        this.x = x;
        this.y = y;
        this.setDomPosition(x, y);
    };
    StatisticHtml.prototype.destroy = function () {
        this.container.removeChild(this.wrapperNode);
    };
    StatisticHtml.prototype.getDefaultOptions = function () {
        return {
            x: 0,
            y: 0,
            width: 0,
            height: 0,
            html: '',
            container: null,
            alignX: 'middle',
            alignY: 'middle',
        };
    };
    StatisticHtml.prototype.setDomPosition = function (x, y) {
        var xPosition = x;
        var yPosition = y;
        var width = dom_util_1.getOuterWidth(this.wrapperNode);
        var height = dom_util_1.getOuterHeight(this.wrapperNode);
        if (this.options.alignX === 'middle') {
            xPosition = x - width / 2;
        }
        if (this.options.alignY === 'middle') {
            yPosition = y - height / 2;
        }
        dom_util_1.modifyCSS(this.wrapperNode, {
            top: Math.round(yPosition) + "px",
            left: Math.round(xPosition) + "px",
            /**
             * 支持Ant Design Charts
             * render是异步的操作，获取到的 width 为 0
             */
            transform: width > 0 ? 'none' : 'translate(-50%, -50%)',
        });
    };
    return StatisticHtml;
}());
exports.default = StatisticHtml;

},{"@antv/dom-util":92,"@antv/util":803}],421:[function(require,module,exports){
"use strict";
/**
 * @file 播放轴组件按钮
 * @author blackganglion
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var Button = /** @class */ (function (_super) {
    tslib_1.__extends(Button, _super);
    function Button(cfg) {
        return _super.call(this, util_1.deepMix({}, cfg)) || this;
    }
    Button.prototype.renderInner = function (group) {
        var _this = this;
        this.initElement(group);
        this.updateElement();
        this.renderMarker();
        group.off('click');
        group.on('click', function () {
            _this.emit('click');
        });
    };
    Button.prototype.destroy = function () {
        this.group.off();
        _super.prototype.destroy.call(this);
    };
    Button.prototype.initElement = function (group) {
        this.circle = group.addShape('circle', {
            attrs: {
                x: this.config.x,
                y: this.config.y,
                r: this.config.r,
                fill: '#607889',
            },
        });
        this.startMarker = group.addShape('path', {
            attrs: {
                path: this.getStartMarkerPath(),
                fill: '#ffffff',
            },
        });
        this.pauseGroupMarker = group.addGroup();
        var width = (1 / 4) * this.config.r;
        var height = 0.5 * this.config.r * Math.sqrt(3);
        this.pauseLeftMarker = this.pauseGroupMarker.addShape('rect', {
            attrs: {
                x: this.config.x - (1 / 4 + 1 / 8) * this.config.r,
                y: this.config.y - height / 2,
                width: width,
                height: height,
                fill: '#ffffff',
            },
        });
        this.pauseRightMarker = this.pauseGroupMarker.addShape('rect', {
            attrs: {
                x: this.config.x + (1 / 8) * this.config.r,
                y: this.config.y - height / 2,
                width: width,
                height: height,
                fill: '#ffffff',
            },
        });
    };
    Button.prototype.updateElement = function () {
        this.circle.attr('x', this.config.x);
        this.circle.attr('y', this.config.y);
        this.circle.attr('r', this.config.r);
        this.startMarker.attr('path', this.getStartMarkerPath());
        var width = (1 / 4) * this.config.r;
        var height = 0.5 * this.config.r * Math.sqrt(3);
        this.pauseLeftMarker.attr('x', this.config.x - (1 / 4 + 1 / 8) * this.config.r);
        this.pauseLeftMarker.attr('y', this.config.y - height / 2);
        this.pauseLeftMarker.attr('width', width);
        this.pauseLeftMarker.attr('height', height);
        this.pauseRightMarker.attr('x', this.config.x + (1 / 8) * this.config.r);
        this.pauseRightMarker.attr('y', this.config.y - height / 2);
        this.pauseRightMarker.attr('width', width);
        this.pauseRightMarker.attr('height', height);
    };
    Button.prototype.renderMarker = function () {
        if (this.config.isPlay) {
            this.startMarker.hide();
            this.pauseGroupMarker.show();
        }
        else {
            this.startMarker.show();
            this.pauseGroupMarker.hide();
        }
    };
    /** 获取播放键 marker path */
    Button.prototype.getStartMarkerPath = function () {
        var sideLength = 0.5 * this.config.r * Math.sqrt(3);
        return [
            ['M', this.config.x - sideLength / Math.sqrt(3) / 2, this.config.y - sideLength / 2],
            ['L', this.config.x + sideLength / Math.sqrt(3), this.config.y],
            ['L', this.config.x - sideLength / Math.sqrt(3) / 2, this.config.y + sideLength / 2],
        ];
    };
    return Button;
}(base_1.default));
exports.default = Button;

},{"../base":407,"@antv/util":803,"tslib":894}],422:[function(require,module,exports){
"use strict";
/**
 * @file 基于 G 的播放轴组件
 * @author blackganglion
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var button_1 = tslib_1.__importDefault(require("./button"));
var base_1 = tslib_1.__importDefault(require("../base"));
var TIMELINE_START = 'timelinestart';
var TIMELINE_CHANGE = 'timelinechange';
var TIMELINE_END = 'timelineend';
var TIMELINE_UPDATE = 'timelineupdate';
var PADDING_LEFT = 20;
var PADDING_RIGHT = 20;
/**
 * 参考示例
 * https://www.gapminder.org/tools/#$state$time$value=1870&delay:100;;&chart-type=bubbles
 */
var TimeLine = /** @class */ (function (_super) {
    tslib_1.__extends(TimeLine, _super);
    function TimeLine(cfg) {
        var _this = _super.call(this, util_1.deepMix({}, {
            speed: 1,
            loop: false,
        }, cfg)) || this;
        _this.onTimeSelectMouseMove = function (e) {
            e.stopPropagation();
            e.preventDefault();
            var x = util_1.get(e, 'touches.0.pageX', e.pageX);
            var offsetX = x - _this.prevX;
            _this.setTimeSelectX(offsetX);
            _this.prevX = x;
        };
        _this.onTimeSelectMouseUp = function () {
            _this.syncCurrnentTick();
            _this.emit(TIMELINE_END, null);
            // 取消事件
            var containerDOM = _this.getCanvas().get('container');
            if (containerDOM) {
                containerDOM.removeEventListener('mousemove', _this.onTimeSelectMouseMove);
                containerDOM.removeEventListener('mouseup', _this.onTimeSelectMouseUp);
                // 防止滑动到 canvas 外部之后，状态丢失
                containerDOM.removeEventListener('mouseleave', _this.onTimeSelectMouseUp);
                // 移动端事件
                containerDOM.removeEventListener('touchmove', _this.onTimeSelectMouseMove);
                containerDOM.removeEventListener('touchend', _this.onTimeSelectMouseUp);
                containerDOM.removeEventListener('touchcancel', _this.onTimeSelectMouseUp);
            }
        };
        _this.onTimeSelectMouseDown = function (e) {
            // 取出原生事件
            var event = e.originalEvent;
            event.stopPropagation();
            event.preventDefault();
            if (_this.isPlay === false) {
                _this.emit(TIMELINE_START, null);
            }
            else {
                // 取消播放状态
                _this.isPlay = false;
                // 拖动过程中的播放暂停不需要调整 tick 位置，防止偏移
                _this.changePlayStatus(false);
            }
            _this.prevX = util_1.get(event, 'touches.0.pageX', event.pageX);
            // 开始滑动的时候，绑定 move 和 up 事件
            var containerDOM = _this.getCanvas().get('container');
            containerDOM.addEventListener('mousemove', _this.onTimeSelectMouseMove);
            containerDOM.addEventListener('mouseup', _this.onTimeSelectMouseUp);
            containerDOM.addEventListener('mouseleave', _this.onTimeSelectMouseUp);
            // 移动端事件
            containerDOM.addEventListener('touchmove', _this.onTimeSelectMouseMove);
            containerDOM.addEventListener('touchend', _this.onTimeSelectMouseUp);
            containerDOM.addEventListener('touchcancel', _this.onTimeSelectMouseUp);
        };
        return _this;
    }
    TimeLine.prototype.renderInner = function (group) {
        var _a = this.config, ticks = _a.ticks, defaultCurrentTick = _a.defaultCurrentTick;
        if (ticks && ticks.length) {
            this.currentTick = this.config.ticks.includes(defaultCurrentTick) ? defaultCurrentTick : ticks[0];
            this.renderPlayButton(group);
            this.renderTimeLine(group);
            this.renderTimeSelect(group, this.currentTick);
            this.initEvent();
        }
    };
    // 更新配置
    TimeLine.prototype.update = function (cfg) {
        _super.prototype.update.call(this, cfg);
        // 更新时需要触发一次，来过滤数据
        this.emit(TIMELINE_UPDATE, this.currentTick);
    };
    TimeLine.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.timeLineButton.destroy();
        this.timeLineButton.off();
        this.timeSelect.off();
        if (this.playHandler) {
            window.cancelAnimationFrame(this.playHandler);
        }
    };
    TimeLine.prototype.renderPlayButton = function (group) {
        var _a = this.config, height = _a.height, x = _a.x, y = _a.y;
        var ratio = 0.8;
        var r = (height / 2) * ratio;
        if (this.timeLineButton) {
            this.timeLineButton.update({
                x: x + r,
                y: y + r + (height * (1 - ratio)) / 2,
                r: r,
            });
        }
        else {
            this.timeLineButton = new button_1.default({
                container: group,
                x: x + r,
                y: y + r + (height * (1 - ratio)) / 2,
                r: r,
                isPlay: this.isPlay,
            });
            this.timeLineButton.init();
        }
        this.timeLineButton.render();
    };
    TimeLine.prototype.getTimeLinePath = function () {
        var _a = this.timeLine, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        var r = height / 2;
        if (width > 0) {
            return ("M" + x + ", " + y +
                ("A" + r + "," + r + " 90 0,0 " + x + "," + (y + height)) +
                ("L" + (x + width) + ", " + (y + height)) +
                ("A" + r + "," + r + " 90 0,0 " + (x + width) + "," + y) +
                ("L" + x + ", " + y));
        }
        return [];
    };
    TimeLine.prototype.renderTimeLine = function (group) {
        var _this = this;
        var _a = this.config, width = _a.width, height = _a.height, ticks = _a.ticks, x = _a.x, y = _a.y;
        if (!this.timeLine) {
            this.timeLine = {};
        }
        /** 默认高度是真实高度 15% */
        this.timeLine.height = height * 0.15;
        this.timeLine.x = x + height + PADDING_LEFT;
        this.timeLine.y = y + (height / 2 - this.timeLine.height / 2);
        this.timeLine.width = width - this.timeLine.x - PADDING_RIGHT;
        if (this.timeLine && this.timeLine.shape) {
            this.timeLine.shape.attr('path', this.getTimeLinePath());
        }
        else {
            this.timeLine.shape = group.addShape('path', {
                attrs: {
                    path: this.getTimeLinePath(),
                    fill: '#607889',
                    opacity: 0.2,
                },
            });
        }
        var interval = this.timeLine.width / (ticks.length - 1);
        this.tickPosList = [];
        if (this.timeLine.textList && this.timeLine.textList.length) {
            this.timeLine.textList.forEach(function (text) {
                text.destroy();
            });
        }
        var lastX = -Infinity;
        this.timeLine.textList = ticks.map(function (tick, index) {
            _this.tickPosList.push(_this.timeLine.x + index * interval);
            var text = group.addShape('text', {
                attrs: {
                    x: _this.timeLine.x + index * interval,
                    y: _this.timeLine.y + _this.timeLine.height + 5,
                    text: tick,
                    textAlign: 'center',
                    textBaseline: 'top',
                    fill: '#607889',
                    opacity: 0.35,
                },
            });
            var bbox = text.getBBox();
            // 抽样，标签与标签间距不小于 10
            if (bbox.minX > lastX) {
                text.show();
                lastX = bbox.minX + bbox.width + 10;
            }
            else {
                text.hide();
            }
            return text;
        });
    };
    TimeLine.prototype.renderTimeSelect = function (group, tickValue) {
        var _a = this.config, ticks = _a.ticks, height = _a.height;
        var interval = this.timeLine.width / (ticks.length - 1);
        var index = util_1.findIndex(ticks, function (tick) { return tick === tickValue; });
        var x = this.timeLine.x + index * interval;
        var y = this.config.y + height / 2;
        var r = height * 0.15;
        if (this.timeSelect) {
            this.timeSelect.attr('x', x);
            this.timeSelect.attr('y', y);
            this.timeSelect.attr('r', r);
        }
        else {
            this.timeSelect = group.addShape('circle', {
                attrs: {
                    x: x,
                    y: y,
                    r: r,
                    fill: '#607889',
                },
            });
        }
        if (this.timeSelectText) {
            this.timeSelectText.attr('x', x);
            this.timeSelectText.attr('y', y - height * 0.15 - 14);
            this.timeSelectText.attr('text', this.currentTick);
        }
        else {
            this.timeSelectText = group.addShape('text', {
                attrs: {
                    x: x,
                    y: y - height * 0.15 - 14,
                    text: this.currentTick,
                    textAlign: 'center',
                    textBaseline: 'top',
                    fill: '#607889',
                },
            });
        }
    };
    /** 输入当前圆点位置，输出离哪个 tick 的位置最近 */
    TimeLine.prototype.adjustTickIndex = function (timeSelectX) {
        for (var i = 0; i < this.tickPosList.length - 1; i++) {
            if (this.tickPosList[i] <= timeSelectX && timeSelectX <= this.tickPosList[i + 1]) {
                return Math.abs(this.tickPosList[i] - timeSelectX) < Math.abs(timeSelectX - this.tickPosList[i + 1])
                    ? i
                    : i + 1;
            }
        }
    };
    /** 拖动或自动播放过程中，设置 TimeSelect 的位置 */
    TimeLine.prototype.setTimeSelectX = function (offsetX) {
        var timeSelectX = this.timeSelect.attr('x') + offsetX;
        // 防止左右溢出
        if (timeSelectX < this.timeLine.x) {
            timeSelectX = this.timeLine.x;
        }
        if (timeSelectX > this.timeLine.x + this.timeLine.width) {
            timeSelectX = this.timeLine.x + this.timeLine.width;
            // 正在播放场景
            if (this.isPlay) {
                // 如果是循环
                if (this.config.loop) {
                    // 当前滑动点已经处于最后一个 tick 上，才能重置回去，继续循环
                    if (this.timeSelect.attr('x') === this.timeLine.x + this.timeLine.width) {
                        timeSelectX = this.timeLine.x;
                    }
                }
                else {
                    this.isPlay = false;
                    this.changePlayStatus();
                }
            }
        }
        this.timeSelect.attr('x', timeSelectX);
        this.timeSelectText.attr('x', timeSelectX);
        var index = this.adjustTickIndex(timeSelectX);
        if (this.currentTick !== this.config.ticks[index]) {
            this.currentTick = this.config.ticks[index];
            this.timeSelectText.attr('text', this.currentTick);
            this.emit(TIMELINE_CHANGE, this.currentTick);
        }
        this.getCanvas().draw();
    };
    /** 同步圆点到 currnentTick */
    TimeLine.prototype.syncCurrnentTick = function () {
        var _this = this;
        var ticks = this.config.ticks;
        var interval = this.timeLine.width / (ticks.length - 1);
        var index = util_1.findIndex(ticks, function (tick) { return tick === _this.currentTick; });
        var x = this.timeLine.x + index * interval;
        this.timeSelect.attr('x', x);
        this.timeSelectText.attr('x', x);
        this.getCanvas().draw();
    };
    TimeLine.prototype.startPlay = function () {
        var _this = this;
        return window.requestAnimationFrame(function () {
            var _a = _this.config, speed = _a.speed, ticks = _a.ticks;
            var width = _this.timeLine.width;
            var tickInterval = width / ticks.length;
            var offsetX = tickInterval / ((speed * 1000) / 60);
            _this.setTimeSelectX(offsetX);
            if (_this.isPlay) {
                _this.playHandler = _this.startPlay();
            }
        });
    };
    TimeLine.prototype.changePlayStatus = function (isSync) {
        if (isSync === void 0) { isSync = true; }
        this.timeLineButton.update({
            isPlay: this.isPlay,
        });
        if (this.isPlay) {
            // 开始播放
            this.playHandler = this.startPlay();
            this.emit(TIMELINE_START, null);
        }
        else {
            // 结束播放
            if (this.playHandler) {
                window.cancelAnimationFrame(this.playHandler);
                if (isSync) {
                    this.syncCurrnentTick();
                    this.emit(TIMELINE_END, null);
                }
            }
        }
        this.getCanvas().draw();
    };
    TimeLine.prototype.initEvent = function () {
        var _this = this;
        /** 播放/暂停事件 */
        this.timeLineButton.off('click');
        this.timeLineButton.on('click', function () {
            _this.isPlay = !_this.isPlay;
            _this.changePlayStatus();
        });
        /** 播放轴上圆点滑动事件 */
        this.timeSelect.off('mousedown');
        this.timeSelect.on('mousedown', function (event) {
            _this.onTimeSelectMouseDown(event);
        });
    };
    return TimeLine;
}(base_1.default));
exports.default = TimeLine;

},{"../base":407,"./button":421,"@antv/util":803,"tslib":894}],423:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EVENTS = exports.ELEMENT_NAMES = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
var dependents_1 = require("../dependents");
var g_util_1 = require("../util/g-util");
var text_1 = require("../util/text");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var ELEMENT_NAMES;
(function (ELEMENT_NAMES) {
    ELEMENT_NAMES["TOOLTIP_INDICATOR_INNER"] = "tooltip_indicator-inner";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_TITLE"] = "tooltip_indicator-title";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_BODY"] = "tooltip_indicator-body";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_GROUP"] = "tooltip_indicator-item-group";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_BACKGROUND"] = "tooltip_indicator-item-background";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_LINE"] = "tooltip_indicator-item-line";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_TITLE"] = "tooltip_indicator-item-title";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_BODY"] = "tooltip_indicator-item-body";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_VALUE_GROUP"] = "tooltip_indicator-item-value-group";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_NAME"] = "tooltip_indicator-item-name";
    ELEMENT_NAMES["TOOLTIP_INDICATOR_ITEM_VALUE"] = "tooltip_indicator-item-value";
})(ELEMENT_NAMES = exports.ELEMENT_NAMES || (exports.ELEMENT_NAMES = {}));
var EVENTS;
(function (EVENTS) {
    EVENTS["ON_SELECT_ITEM"] = "onSelectItem";
})(EVENTS = exports.EVENTS || (exports.EVENTS = {}));
var PADDING;
(function (PADDING) {
    PADDING[PADDING["LARGE"] = 12] = "LARGE";
    PADDING[PADDING["NORMAL"] = 8] = "NORMAL";
    PADDING[PADDING["SMALL"] = 4] = "SMALL";
})(PADDING || (PADDING = {}));
var MAX_ITEM_TITLE_WIDTH = 160;
/** 指标卡图例组件 */
var TooltipIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(TooltipIndicator, _super);
    function TooltipIndicator() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.curX = 0;
        _this.curY = 0;
        _this.offsetX = 0;
        _this.scrollWidth = 0;
        _this.onBodyGroupMousemove = function (evt) {
            var itemGroup = findTargetAncestor(evt.target, function (target) { return target.get('name') === ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_GROUP; });
            if (itemGroup) {
                var itemData = itemGroup.get('delegateObject');
                _this.doSelectItem(itemData.item.id);
            }
        };
        _this.onWheel = function (evt) {
            var _a = _this.config.width, width = _a === void 0 ? 0 : _a;
            var deltaX = evt.deltaX;
            var offsetMin = Math.min(_this.scrollWidth - width, 0) - (_this.scrollWidth / 2 + Math.max(0, (_this.scrollWidth - width) / 2));
            var offsetMax = Math.max(_this.scrollWidth - width, 0) + _this.scrollWidth / 2 + Math.max(0, (_this.scrollWidth - width) / 2);
            var newOffsetX = util_1.clamp(_this.offsetX + deltaX, offsetMin, offsetMax);
            if (newOffsetX !== _this.offsetX) {
                g_util_1.translate(_this.bodyGroup, _this.offsetX - newOffsetX, 0);
                _this.offsetX = newOffsetX;
            }
        };
        return _this;
    }
    TooltipIndicator.prototype.destroy = function () {
        this.offEvents();
        _super.prototype.destroy.call(this);
    };
    /** 选中某一项 */
    TooltipIndicator.prototype.selectItem = function (id) {
        this.doSelectItem(id);
    };
    /** 重置选中状态 */
    TooltipIndicator.prototype.resetSelect = function () {
        this.doSelectItem(this.selectedItemId);
    };
    TooltipIndicator.prototype.initConfig = function (config) {
        var _a;
        var _b = config.theme, theme = _b === void 0 ? {} : _b;
        var defaultCfg = {
            x: 0,
            y: 0,
            title: {
                text: '',
                spacingY: PADDING.NORMAL,
                style: {},
            },
            line: {
                spacingX: PADDING.SMALL,
                width: 2,
                style: {},
            },
            itemTitle: {
                spacingX: 0,
                spacingY: PADDING.SMALL,
                style: {},
            },
            itemName: {
                spacingX: PADDING.NORMAL,
                spacingY: PADDING.SMALL,
                style: {},
            },
            itemValue: {
                style: {},
            },
            itemBackground: {
                style: {
                    opacity: 0,
                    fill: '#000',
                },
            },
            itemSpacing: PADDING.LARGE,
        };
        this.config = util_1.deepMix({}, (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.tooltipIndicator, defaultCfg, config);
        this.selectedItemId = this.config.selectedItem;
    };
    TooltipIndicator.prototype.renderInner = function (group) {
        var _this = this;
        this.resetRender();
        var _a = this.config, items = _a.items, x = _a.x, y = _a.y;
        var itemGroups = [];
        var innerGroup = group.addGroup({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_INNER,
        });
        this.renderTitle(innerGroup);
        this.bodyGroup = innerGroup.addGroup({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_BODY,
        });
        items === null || items === void 0 ? void 0 : items.forEach(function (item, index) {
            itemGroups.push(_this.renderItem(_this.bodyGroup, item, index));
        });
        this.layoutItems(innerGroup);
        g_util_1.move(innerGroup, x, y);
        this.applyClip(group);
        this.bindEvents(innerGroup);
    };
    TooltipIndicator.prototype.renderTitle = function (group) {
        var title = this.config.title;
        if (title === null || title === void 0 ? void 0 : title.text) {
            var shape = group.addShape({
                type: 'text',
                name: ELEMENT_NAMES.TOOLTIP_INDICATOR_TITLE,
                attrs: tslib_1.__assign({ text: title === null || title === void 0 ? void 0 : title.text, textAlign: 'left', textBaseline: 'top' }, ((title === null || title === void 0 ? void 0 : title.style) || {})),
            });
            var bbox = shape.getBBox();
            this.curY += bbox.height;
            this.curY += title.spacingY || 0;
            return shape;
        }
    };
    TooltipIndicator.prototype.renderItem = function (group, item, index) {
        var itemBackground = this.config.itemBackground;
        var itemGroup = group.addGroup({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_GROUP,
            delegateObject: {
                item: item,
                index: index,
            },
        });
        var oldX = this.curX;
        var oldY = this.curY;
        var background = itemGroup.addShape({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_BACKGROUND,
            type: 'rect',
            attrs: tslib_1.__assign({ x: this.curX, y: this.curY, width: 1, height: 1 }, (itemBackground.style || {})),
        });
        var line = this.renderLine(itemGroup, item);
        this.renderItemTitle(itemGroup, item);
        this.renderItemValues(itemGroup, item);
        var itemGroupBBox = itemGroup.getBBox();
        // update line height
        line.attr({
            y2: line.attr('y1') + itemGroupBBox.height,
        });
        // spacing
        this.curX = oldX + itemGroupBBox.width;
        this.curX += this.config.itemSpacing || 0;
        // update background
        background.attr({
            width: this.curX - oldX - background.attr('lineWidth') * 2,
            height: this.curY - oldY - background.attr('lineWidth') * 2,
        });
        // reset Y
        this.curY = oldY;
        return itemGroup;
    };
    TooltipIndicator.prototype.renderLine = function (group, item) {
        var line = this.config.line;
        var width = line.width || 2;
        var attrs = tslib_1.__assign({ x1: this.curX + width / 2, y1: this.curY, x2: this.curX + width / 2, y2: this.curY, lineWidth: width, stroke: item.color }, ((line === null || line === void 0 ? void 0 : line.style) || {}));
        var shape = group.addShape({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_LINE,
            type: 'line',
            attrs: attrs,
        });
        var bbox = shape.getBBox();
        this.curX += bbox.width;
        this.curX += line.spacingX || 0;
        return shape;
    };
    TooltipIndicator.prototype.renderItemTitle = function (group, item) {
        var itemTitle = this.config.itemTitle;
        var text = text_1.getEllipsisText(item.title, MAX_ITEM_TITLE_WIDTH, itemTitle.style || {});
        var shape = group.addShape({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_TITLE,
            type: 'text',
            attrs: tslib_1.__assign({ x: this.curX, y: this.curY, textAlign: 'left', textBaseline: 'top', text: text }, (itemTitle.style || {})),
        });
        var bbox = shape.getBBox();
        this.curY += bbox.height;
        this.curY += itemTitle.spacingY || 0;
        return shape;
    };
    TooltipIndicator.prototype.renderItemValues = function (group, item) {
        var _this = this;
        var _a;
        var itemBodyGroup = group.addGroup({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_BODY,
        });
        var oldX = this.curX;
        (_a = item.values) === null || _a === void 0 ? void 0 : _a.forEach(function (value, valueIndex) {
            var valueGroup = itemBodyGroup.addGroup({
                name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE_GROUP,
                delegateObject: {
                    item: item,
                    valueIndex: valueIndex,
                },
            });
            // reset x
            _this.curX = oldX;
            _this.renderItemValueName(valueGroup, value);
            _this.renderItemValueValue(valueGroup, value);
        });
        this.layoutItemValues(itemBodyGroup);
        return itemBodyGroup;
    };
    TooltipIndicator.prototype.renderItemValueName = function (group, value) {
        var itemName = this.config.itemName;
        if (value.name) {
            var shape = group.addShape({
                name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_NAME,
                type: 'text',
                attrs: tslib_1.__assign({ x: this.curX, y: this.curY, textAlign: 'left', textBaseline: 'top', text: value.name }, (itemName.style || {})),
            });
            var bbox = shape.getBBox();
            if (value.wrapLine) {
                this.curY += bbox.height;
                this.curY += itemName.spacingY || 0;
            }
            else {
                this.curX += bbox.width;
                this.curX += itemName.spacingX || 0;
            }
            return shape;
        }
    };
    TooltipIndicator.prototype.renderItemValueValue = function (group, value) {
        var _a = this.config, itemName = _a.itemName, itemValue = _a.itemValue;
        var shape = group.addShape({
            name: ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE,
            type: 'text',
            attrs: tslib_1.__assign({ x: this.curX, y: this.curY, textAlign: 'left', textBaseline: 'top', text: value.value }, (itemValue.style || {})),
        });
        var bbox = shape.getBBox();
        this.curY += bbox.height;
        this.curY += itemName.spacingY || 0;
        return shape;
    };
    TooltipIndicator.prototype.layoutItems = function (group) {
        var bodyGroup = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_BODY)[0];
        var itemGroups = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_GROUP);
        if (!bodyGroup || itemGroups.length === 0) {
            return;
        }
        var bodyGroupBBox = bodyGroup.getBBox();
        this.scrollWidth = bodyGroupBBox.width;
    };
    TooltipIndicator.prototype.layoutItemValues = function (group) {
        var valueGroups = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE_GROUP);
        var valueGroupBBoxes = valueGroups.map(function (item) { return bbox_1.default.fromBBoxObject(item.getBBox()); });
        var valueShapes = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE);
        var valueShapeBBoxes = valueShapes.map(function (shape) { return bbox_1.default.fromBBoxObject(shape.getBBox()); });
        var maxX = Math.max.apply(Math, valueShapeBBoxes.map(function (bbox) { return bbox.maxX; }));
        valueGroups.forEach(function (valueGroup, index) {
            var bbox = valueGroupBBoxes[index];
            var nameShape = valueGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_NAME)[0];
            var valueShape = valueGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE)[0];
            if (nameShape && valueShape) {
                var nameShapeBBox = bbox_1.default.fromBBoxObject(nameShape.getBBox());
                var valueShapeBBox = bbox_1.default.fromBBoxObject(valueShape.getBBox());
                // horizontal align: name & value
                if (nameShapeBBox.height < bbox.height) {
                    nameShape.attr('y', nameShape.attr('y') + (bbox.height - nameShapeBBox.height) / 2);
                }
                if (valueShapeBBox.height < bbox.height) {
                    valueShape.attr('y', valueShape.attr('y') + (bbox.height - valueShapeBBox.height) / 2);
                }
                // vertical align values
                if (valueShapeBBox.maxX < maxX) {
                    valueShape.attr('x', valueShape.attr('x') + maxX - valueShapeBBox.maxX);
                }
            }
        });
    };
    TooltipIndicator.prototype.applyClip = function (group) {
        var _a = this.config, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        var bbox = group.getBBox();
        if (width || height) {
            group.setClip({
                type: 'rect',
                attrs: {
                    x: x,
                    y: y,
                    width: width || bbox.width,
                    height: height || bbox.height,
                },
            });
        }
    };
    TooltipIndicator.prototype.doSelectItem = function (id) {
        var _this = this;
        var group = this.getGroup();
        var itemGroups = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_GROUP);
        if (id !== this.selectedItemId) {
            itemGroups.forEach(function (itemGroup) {
                var curItemData = itemGroup.get('delegateObject');
                if (curItemData) {
                    _this.applyItemStyle(itemGroup, curItemData.item.id === id ? 'selected' : 'inactive');
                }
            });
            this.selectedItemId = id;
        }
        else {
            // 取消选中
            itemGroups.forEach(function (itemGroup) {
                _this.applyItemStyle(itemGroup);
            });
            this.selectedItemId = undefined;
        }
        this.emit(EVENTS.ON_SELECT_ITEM, this.selectedItemId);
    };
    TooltipIndicator.prototype.applyItemStyle = function (itemGroup, state) {
        var _a = this.config, line = _a.line, itemTitle = _a.itemTitle, itemName = _a.itemName, itemValue = _a.itemValue;
        var lineShape = itemGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_LINE)[0];
        var titleShape = itemGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_TITLE)[0];
        var itemNameShapes = itemGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_NAME);
        var itemValueShapes = itemGroup.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_ITEM_VALUE);
        var styleName = state && state + "Style";
        if (lineShape) {
            lineShape.attr(line.style);
            lineShape.attr(line[styleName] || {});
        }
        if (titleShape) {
            titleShape.attr(itemTitle.style);
            titleShape.attr(itemTitle[styleName] || {});
        }
        itemNameShapes.forEach(function (itemNameShape) {
            itemNameShape.attr(itemName.style);
            itemNameShape.attr(itemName[styleName] || {});
        });
        itemValueShapes.forEach(function (itemValueShape) {
            itemValueShape.attr(itemValue.style);
            itemValueShape.attr(itemValue[styleName] || {});
        });
    };
    TooltipIndicator.prototype.bindEvents = function (group) {
        var _this = this;
        this.offEvents();
        var bodyGroup = group.findAllByName(ELEMENT_NAMES.TOOLTIP_INDICATOR_BODY)[0];
        bodyGroup.on('mousemove', this.onBodyGroupMousemove);
        this.addDisposable(function () {
            bodyGroup.off('mousemove', _this.onBodyGroupMousemove);
        });
        this.gm = new dependents_1.GM(bodyGroup);
        this.wheel = new dependents_1.Wheel(bodyGroup);
        this.wheel.on('wheel', this.onWheel);
    };
    TooltipIndicator.prototype.offEvents = function () {
        if (this.gm) {
            this.gm.destroy();
        }
        if (this.wheel) {
            this.wheel.destroy();
        }
    };
    TooltipIndicator.prototype.resetRender = function () {
        this.curX = 0;
        this.curY = 0;
        this.offsetX = 0;
    };
    return TooltipIndicator;
}(base_1.default));
exports.default = TooltipIndicator;
function findTargetAncestor(element, predicate) {
    var cur = element;
    while (cur) {
        if (predicate(cur)) {
            return cur;
        }
        cur = cur.getParent();
    }
}

},{"../dependents":425,"../util/bbox":672,"../util/g-util":679,"../util/text":714,"./base":407,"@antv/util":803,"tslib":894}],424:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var state_1 = require("../../base/controller/state");
var POSITION_MAPPER = ['xField', 'yField', 'angleField'];
function onActive(plot, condition) {
    var props = plot.options;
    // 获取state condition对应在画布的位置，只有在state condition对应字段为位置映射字段时，tooltip才会对齐进行响应
    if (shouldActive(props, condition)) {
        var data = props.data;
        util_1.each(data, function (d) {
            if (state_1.compare(d, condition)) {
                var point = plot.view.getXY(d);
                // 调用showTooltip方法
                plot.view.on('tooltip:create', function (e) {
                    processState(condition, e, false);
                });
                plot.view.showTooltip(point);
            }
        });
    }
}
function onDisable(plot, condition) {
    plot.view.on('tooltip:change', function (e) {
        processState(condition, e, true);
    });
}
function processState(condition, e, inverse) {
    var expected = inverse ? false : true;
    var originItems = util_1.clone(e.items);
    e.items.splice(0);
    util_1.each(originItems, function (item) {
        var origin = item.point._origin;
        if (state_1.compare(origin, condition) === expected) {
            e.items.push(item);
        }
    });
}
function shouldActive(props, condition) {
    var fields = getPositionField(props);
    return !util_1.isFunction(condition) && fields.indexOf(condition.name);
}
function getPositionField(props) {
    var fields = [];
    util_1.each(POSITION_MAPPER, function (v) {
        if (util_1.has(props, v)) {
            fields.push(v);
        }
    });
    return fields;
}
exports.default = {
    active: onActive,
    selected: onActive,
    disable: onDisable,
};

},{"../../base/controller/state":390,"@antv/util":803}],425:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._ORIGIN = exports.ORIGIN = exports.TooltipCssConst = exports.HtmlTooltipTheme = exports.HtmlTooltip = exports.InteractionUtils = exports.GrammarInteraction = exports.GestureController = void 0;
var tslib_1 = require("tslib");
// dependents是基础依赖，以便按需使用plot
var gesture_1 = tslib_1.__importDefault(require("@antv/g2/lib/chart/controller/gesture"));
exports.GestureController = gesture_1.default;
var g2_1 = require("@antv/g2");
g2_1.registerComponentController('gesture', gesture_1.default);
// G
var g_base_1 = require("@antv/g-base");
Object.defineProperty(exports, "GraphicEvent", { enumerable: true, get: function () { return g_base_1.Event; } });
var g_canvas_1 = require("@antv/g-canvas");
Object.defineProperty(exports, "Canvas", { enumerable: true, get: function () { return g_canvas_1.Canvas; } });
var g_svg_1 = require("@antv/g-svg");
Object.defineProperty(exports, "SVG", { enumerable: true, get: function () { return g_svg_1.Canvas; } });
// G-Gesture
var g_gesture_1 = require("@antv/g-gesture");
Object.defineProperty(exports, "GM", { enumerable: true, get: function () { return g_gesture_1.GM; } });
Object.defineProperty(exports, "Wheel", { enumerable: true, get: function () { return g_gesture_1.Wheel; } });
// G2
var g2_2 = require("@antv/g2");
Object.defineProperty(exports, "View", { enumerable: true, get: function () { return g2_2.View; } });
Object.defineProperty(exports, "registerAnimation", { enumerable: true, get: function () { return g2_2.registerAnimation; } });
Object.defineProperty(exports, "registerGeometry", { enumerable: true, get: function () { return g2_2.registerGeometry; } });
Object.defineProperty(exports, "Geometry", { enumerable: true, get: function () { return g2_2.Geometry; } });
Object.defineProperty(exports, "Interaction", { enumerable: true, get: function () { return g2_2.Interaction; } });
Object.defineProperty(exports, "InteractionAction", { enumerable: true, get: function () { return g2_2.InteractionAction; } });
Object.defineProperty(exports, "registerInteraction", { enumerable: true, get: function () { return g2_2.registerInteraction; } });
Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return g2_2.registerAction; } });
Object.defineProperty(exports, "registerShape", { enumerable: true, get: function () { return g2_2.registerShape; } });
Object.defineProperty(exports, "getTheme", { enumerable: true, get: function () { return g2_2.getTheme; } });
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return g2_2.Util; } });
Object.defineProperty(exports, "getShapeFactory", { enumerable: true, get: function () { return g2_2.getShapeFactory; } });
Object.defineProperty(exports, "ComponentController", { enumerable: true, get: function () { return g2_2.ComponentController; } });
Object.defineProperty(exports, "registerComponentController", { enumerable: true, get: function () { return g2_2.registerComponentController; } });
var constant_1 = require("@antv/g2/lib/constant");
Object.defineProperty(exports, "VIEW_LIFE_CIRCLE", { enumerable: true, get: function () { return constant_1.VIEW_LIFE_CIRCLE; } });
Object.defineProperty(exports, "COMPONENT_TYPE", { enumerable: true, get: function () { return constant_1.COMPONENT_TYPE; } });
Object.defineProperty(exports, "FIELD_ORIGIN", { enumerable: true, get: function () { return constant_1.FIELD_ORIGIN; } });
var tooltip_1 = require("@antv/g2/lib/chart/controller/tooltip");
Object.defineProperty(exports, "TooltipController", { enumerable: true, get: function () { return tooltip_1.default; } });
var marker_1 = require("@antv/g2/lib/util/marker");
Object.defineProperty(exports, "MarkerSymbols", { enumerable: true, get: function () { return marker_1.MarkerSymbols; } });
var grammar_interaction_1 = tslib_1.__importDefault(require("@antv/g2/lib/interaction/grammar-interaction"));
exports.GrammarInteraction = grammar_interaction_1.default;
var InteractionUtils = tslib_1.__importStar(require("@antv/g2/lib/interaction/action/util"));
exports.InteractionUtils = InteractionUtils;
var animate_1 = require("@antv/g2/lib/animate");
Object.defineProperty(exports, "DEFAULT_ANIMATE_CFG", { enumerable: true, get: function () { return animate_1.DEFAULT_ANIMATE_CFG; } });
Object.defineProperty(exports, "getDefaultAnimateCfg", { enumerable: true, get: function () { return animate_1.getDefaultAnimateCfg; } });
Object.defineProperty(exports, "doAnimate", { enumerable: true, get: function () { return animate_1.doAnimate; } });
var element_1 = require("@antv/g2/lib/geometry/element");
Object.defineProperty(exports, "Element", { enumerable: true, get: function () { return element_1.default; } });
// Component
var html_1 = tslib_1.__importDefault(require("@antv/component/lib/tooltip/html"));
exports.HtmlTooltip = html_1.default;
var html_theme_1 = tslib_1.__importDefault(require("@antv/component/lib/tooltip/html-theme"));
exports.HtmlTooltipTheme = html_theme_1.default;
var TooltipCssConst = tslib_1.__importStar(require("@antv/component/lib/tooltip/css-const"));
exports.TooltipCssConst = TooltipCssConst;
var component_1 = require("@antv/component");
Object.defineProperty(exports, "GroupComponent", { enumerable: true, get: function () { return component_1.GroupComponent; } });
Object.defineProperty(exports, "Axis", { enumerable: true, get: function () { return component_1.Axis; } });
Object.defineProperty(exports, "Legend", { enumerable: true, get: function () { return component_1.Legend; } });
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return component_1.Tooltip; } });
Object.defineProperty(exports, "Slider", { enumerable: true, get: function () { return component_1.Slider; } });
Object.defineProperty(exports, "Scrollbar", { enumerable: true, get: function () { return component_1.Scrollbar; } });
// Coordinate
var coord_1 = require("@antv/coord");
Object.defineProperty(exports, "Coordinate", { enumerable: true, get: function () { return coord_1.Coordinate; } });
// Common
exports.ORIGIN = 'origin';
exports._ORIGIN = '_origin';

},{"@antv/component":51,"@antv/component/lib/tooltip/css-const":62,"@antv/component/lib/tooltip/html":64,"@antv/component/lib/tooltip/html-theme":63,"@antv/coord":83,"@antv/g-base":115,"@antv/g-canvas":127,"@antv/g-gesture":166,"@antv/g-svg":186,"@antv/g2":309,"@antv/g2/lib/animate":217,"@antv/g2/lib/chart/controller/gesture":224,"@antv/g2/lib/chart/controller/tooltip":228,"@antv/g2/lib/constant":237,"@antv/g2/lib/geometry/element":252,"@antv/g2/lib/interaction/action/util":353,"@antv/g2/lib/interaction/grammar-interaction":361,"@antv/g2/lib/util/marker":379,"tslib":894}],426:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var main_1 = tslib_1.__importDefault(require("./main"));
var mini_1 = tslib_1.__importDefault(require("./mini"));
exports.default = {
    main: main_1.default,
    mini: mini_1.default,
};

},{"./main":427,"./mini":428,"tslib":894}],427:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var AreaParser = /** @class */ (function (_super) {
    tslib_1.__extends(AreaParser, _super);
    function AreaParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AreaParser.prototype.init = function () {
        var props = this.plot.options;
        this.config = {
            type: 'area',
            position: {
                fields: [props.xField, props.yField],
            },
            connectNulls: props.connectNulls || false,
        };
        if (props.smooth) {
            this.config.shape = { values: ['smooth'] };
        }
        if (this._getColorMappingField() || props.color) {
            this.parseColor();
        }
        if (props.areaStyle || (props.area && props.area.style)) {
            this.parseStyle();
        }
    };
    AreaParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var config = {};
        var colorMappingField = this._getColorMappingField();
        if (colorMappingField) {
            config.fields = colorMappingField;
        }
        if (util_1.has(props, 'color')) {
            var color = props.color;
            if (util_1.isString(color)) {
                config.values = [color];
            }
            else if (util_1.isFunction(color)) {
                config.callback = color;
            }
            else if (util_1.isArray(color)) {
                if (colorMappingField) {
                    config.values = color;
                }
                else {
                    if (color.length > 0) {
                        config.values = [color[0]];
                    }
                }
            }
        }
        this.config.color = config;
    };
    AreaParser.prototype.parseStyle = function () {
        var props = this.plot.options;
        var styleProps = props.areaStyle ? props.areaStyle : props.area.style;
        var config = {};
        if (util_1.isFunction(styleProps) && props.seriesField) {
            config.fields = [props.seriesField];
            config.callback = styleProps;
        }
        else {
            config.cfg = styleProps;
        }
        this.config.style = config;
    };
    AreaParser.prototype._getColorMappingField = function () {
        var props = this.plot.options;
        var colorMapper = ['stackField', 'seriesField'];
        for (var _i = 0, colorMapper_1 = colorMapper; _i < colorMapper_1.length; _i++) {
            var m = colorMapper_1[_i];
            if (util_1.get(props, m)) {
                return [props[m]];
            }
        }
    };
    return AreaParser;
}(base_1.default));
exports.default = AreaParser;

},{"../base":429,"@antv/util":803,"tslib":894}],428:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/** 简化折线点 */
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
var math_1 = require("../../util/math");
var path_1 = require("../../util/path");
var main_1 = tslib_1.__importDefault(require("./main"));
var theme_1 = require("../../theme");
dependents_1.registerShape('area', 'miniArea', {
    draw: function (cfg, container) {
        var opacity = cfg.style ? cfg.style.opacity : null;
        var path = getPath(cfg, this, false);
        var style = util_1.deepMix({}, {
            lineJoin: 'round',
            lineCap: 'round',
        }, cfg.style);
        var shape = container.addShape('path', {
            attrs: {
                path: path,
                fill: parseGradient(cfg.color || theme_1.getGlobalTheme().defaultColor),
                opacity: opacity || 0.4,
            },
            style: style,
        });
        return shape;
    },
});
dependents_1.registerShape('area', 'miniAreaSmooth', {
    draw: function (cfg, container) {
        var opacity = cfg.style ? cfg.style.opacity : null;
        var path = getPath(cfg, this, true);
        var shape = container.addShape('path', {
            attrs: {
                path: path,
                fill: parseGradient(cfg.color || theme_1.getGlobalTheme().defaultColor),
                opacity: opacity || 0.5,
            },
        });
        return shape;
    },
});
function getPath(cfg, shape, isSmooth) {
    var constraint = [
        [0, 0],
        [1, 1],
    ];
    var topLinePoints = [];
    var bottomLinePoints = [];
    util_1.each(cfg.points, function (point) {
        topLinePoints.push(point[1]);
        bottomLinePoints.push(point[0]);
    });
    bottomLinePoints = shape.parsePoints(bottomLinePoints.reverse());
    topLinePoints = math_1.lineSimplification(shape.parsePoints(topLinePoints));
    var topPath = isSmooth ? path_1.getSplinePath(topLinePoints, false, constraint) : getStraightPath(topLinePoints);
    var bottomPath = getStraightPath(bottomLinePoints);
    bottomPath[0][0] = 'L';
    var path = topPath.concat(bottomPath);
    return path;
}
function getStraightPath(points) {
    var path = [];
    for (var i = 0; i < points.length; i++) {
        var p = points[i];
        var flag = i === 0 ? 'M' : 'L';
        path.push([flag, p.x, p.y]);
    }
    return path;
}
function parseGradient(color) {
    return "l(90) 0:" + color + " 1:#ffffff";
}
var MiniAreaParser = /** @class */ (function (_super) {
    tslib_1.__extends(MiniAreaParser, _super);
    function MiniAreaParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MiniAreaParser.prototype.init = function () {
        _super.prototype.init.call(this);
        this.parseShape();
    };
    MiniAreaParser.prototype.parseShape = function () {
        var props = this.plot.options;
        if (props.smooth) {
            this.config.shape = { values: ['miniAreaSmooth'] };
        }
        else {
            this.config.shape = { values: ['miniArea'] };
        }
    };
    return MiniAreaParser;
}(main_1.default));
exports.default = MiniAreaParser;

},{"../../dependents":425,"../../theme":669,"../../util/math":680,"../../util/path":681,"./main":427,"@antv/util":803,"tslib":894}],429:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var ElementParser = /** @class */ (function () {
    function ElementParser(cfg) {
        util_1.assign(this, cfg);
        this.init();
    }
    ElementParser.prototype.init = function () {
        this.config = {
            type: this.type,
            position: {
                fields: this.positionFields,
            },
        };
    };
    return ElementParser;
}());
exports.default = ElementParser;

},{"@antv/util":803}],430:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeom = void 0;
var tslib_1 = require("tslib");
var index_1 = tslib_1.__importDefault(require("./area/index"));
var index_2 = tslib_1.__importDefault(require("./interval/index"));
var index_3 = tslib_1.__importDefault(require("./line/index"));
var index_4 = tslib_1.__importDefault(require("./point/index"));
/**
 * 将element的配置逻辑拆离出来，并将每类element细分为主体图形、辅助图形、mini图形三种
 * 这样也方便未来更灵活的调用和组装g2的element模块
 */
var GEOMETRY_MAP = {
    area: index_1.default,
    line: index_3.default,
    point: index_4.default,
    interval: index_2.default,
};
function getGeom(name, type, cfg) {
    var Geom = GEOMETRY_MAP[name][type];
    return new Geom(cfg).config;
}
exports.getGeom = getGeom;

},{"./area/index":426,"./interval/index":432,"./line/index":435,"./point/index":440,"tslib":894}],431:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
var colorUtil = tslib_1.__importStar(require("../../util/color"));
var GAUSS_COEF = 0.3989422804014327;
var ZERO = 1.0 / 255.0 / 16.0;
var ORIGIN_FIELD = '_origin';
var LinearHeatmap = /** @class */ (function (_super) {
    tslib_1.__extends(LinearHeatmap, _super);
    function LinearHeatmap(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.type = 'heatmap';
        _this.paletteCache = {};
        _this.intensity = cfg.intensity;
        _this.radius = cfg.radius;
        return _this;
    }
    LinearHeatmap.prototype.createElements = function (mappingData /*index: number, isUpdate: boolean = false*/) {
        var range = this.prepareRange(mappingData);
        this.prepareSize();
        this.prepareBlur();
        this.prepareGreyScaleBlurredCircle(this.radius);
        this.drawWithRange(mappingData, range);
        return null;
    };
    LinearHeatmap.prototype.clear = function () {
        this.clearShadowCanvasCtx();
        _super.prototype.clear.call(this);
    };
    LinearHeatmap.prototype.prepareRange = function (data) {
        var colorAttr = this.getAttribute('color');
        var colorField = colorAttr.getFields()[0];
        var min = Infinity;
        var max = -Infinity;
        data.forEach(function (row) {
            var value = row[ORIGIN_FIELD][colorField];
            if (value > max) {
                max = value;
            }
            if (value < min) {
                min = value;
            }
        });
        if (min === max) {
            min = max - 1;
        }
        return [min, max];
    };
    LinearHeatmap.prototype.prepareSize = function () {
        var radius = this.radius;
        if (!this.radius) {
            radius = this.getDefaultValue('size');
            if (!util_1.isNumber(radius)) {
                radius = this.getDefaultSize();
            }
            this.radius = radius;
        }
    };
    LinearHeatmap.prototype.prepareBlur = function () {
        var blur = util_1.get(this.styleOption, ['style', 'shadowBlur']);
        if (!util_1.isNumber(blur)) {
            blur = this.radius / 2;
        }
        this.blur = blur;
    };
    LinearHeatmap.prototype.getDefaultSize = function () {
        var position = this.getAttribute('position');
        var coord = this.coordinate;
        var radius = Math.min(coord.getWidth() / (position.scales[0].ticks.length * 4), coord.getHeight() / (position.scales[1].ticks.length * 4));
        return radius;
    };
    LinearHeatmap.prototype.colorize = function (img) {
        var colorAttr = this.getAttribute('color');
        var pixels = img.data;
        var paletteCache = this.paletteCache;
        for (var i = 3; i < pixels.length; i += 4) {
            var alpha = pixels[i]; // get gradient color from opacity value
            if (alpha) {
                var palette = void 0;
                if (paletteCache[alpha]) {
                    palette = paletteCache[alpha];
                }
                else {
                    palette = colorUtil.rgb2arr(colorAttr.gradient(alpha / 256));
                    paletteCache[alpha] = palette;
                }
                // const palette = colorUtil.rgb2arr(colorAttr.gradient(alpha / 256));
                pixels[i - 3] = palette[0];
                pixels[i - 2] = palette[1];
                pixels[i - 1] = palette[2];
                pixels[i] = alpha;
            }
        }
    };
    LinearHeatmap.prototype.prepareGreyScaleBlurredCircle = function (r) {
        var circleCanvas = this.grayScaleCanvas;
        if (!circleCanvas) {
            circleCanvas = document.createElement('canvas');
            this.grayScaleCanvas = circleCanvas;
        }
        var intensity = this.intensity ? this.intensity : 2;
        var circleRadius = (Math.sqrt(-2.0 * Math.log(ZERO / r / intensity / GAUSS_COEF)) / 3.0) * r;
        var blur = circleRadius - r;
        var r2 = circleRadius + blur;
        var ctx = circleCanvas.getContext('2d');
        circleCanvas.width = circleCanvas.height = r2 * 2;
        ctx.clearRect(0, 0, circleCanvas.width, circleCanvas.height);
        ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
        ctx.shadowBlur = blur;
        ctx.shadowColor = 'black';
        ctx.beginPath();
        ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
        ctx.closePath();
        ctx.fill();
    };
    LinearHeatmap.prototype.drawGrayScaleBlurredCircle = function (x, y, r, alpha, ctx) {
        var circleCanvas = this.grayScaleCanvas;
        ctx.globalAlpha = alpha;
        ctx.drawImage(circleCanvas, x - r, y - r);
    };
    LinearHeatmap.prototype.getShadowCanvasCtx = function () {
        var canvas = this.shadowCanvas;
        if (!canvas) {
            canvas = document.createElement('canvas');
            this.shadowCanvas = canvas;
        }
        canvas.width = this.coordinate.getWidth();
        canvas.height = this.coordinate.getHeight();
        var context = canvas.getContext('2d');
        context.globalCompositeOperation = 'lighter';
        return context;
    };
    LinearHeatmap.prototype.clearShadowCanvasCtx = function () {
        var ctx = this.getShadowCanvasCtx();
        ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
    };
    LinearHeatmap.prototype.getImageShape = function () {
        var imageShape = this.imageShape;
        if (imageShape) {
            return imageShape;
        }
        var container = this.container;
        imageShape = container.addShape({
            type: 'image',
            attrs: {},
        });
        this.imageShape = imageShape;
    };
    LinearHeatmap.prototype.drawWithRange = function (data, range) {
        // canvas size
        var _a = this.coordinate, start = _a.start, end = _a.end;
        var width = this.coordinate.getWidth();
        var height = this.coordinate.getHeight();
        // value, range, etc
        var colorAttr = this.getAttribute('color');
        var valueField = colorAttr.getFields()[0];
        // prepare shadow canvas context
        this.clearShadowCanvasCtx();
        var ctx = this.getShadowCanvasCtx();
        // filter data
        if (range) {
            data = data.filter(function (row) {
                return row[ORIGIN_FIELD][valueField] <= range[1] && row[ORIGIN_FIELD][valueField] >= range[0];
            });
        }
        // step1. draw points with shadow
        var scale = this.scales[valueField];
        for (var i = 0; i < data.length; i++) {
            var obj = data[i];
            var cfg = this.getDrawCfg(obj);
            var alpha = scale.scale(obj[ORIGIN_FIELD][valueField]);
            // @ts-ignore
            this.drawGrayScaleBlurredCircle(cfg.x - start.x, cfg.y - end.y, this.radius + this.blur, alpha, ctx);
        }
        // step2. convert pixels
        var colored = ctx.getImageData(0, 0, width, height);
        this.clearShadowCanvasCtx();
        this.colorize(colored);
        ctx.putImageData(colored, 0, 0);
        var image = new Image();
        image.src = ctx.canvas.toDataURL('image/png');
        this.getImageShape();
        this.imageShape.attr('x', start.x);
        this.imageShape.attr('y', end.y);
        this.imageShape.attr('width', width);
        this.imageShape.attr('height', height);
        this.imageShape.attr('img', ctx.canvas);
        this.imageShape.set('origin', this.getShapeInfo(data)); // 存储绘图信息数据
    };
    LinearHeatmap.prototype.getShapeInfo = function (mappingData) {
        var shapeCfg = this.getDrawCfg(mappingData[0]);
        return tslib_1.__assign(tslib_1.__assign({}, shapeCfg), { mappingData: mappingData, data: this.getData(mappingData) });
    };
    LinearHeatmap.prototype.getData = function (mappingData) {
        return mappingData.map(function (obj) {
            return obj[ORIGIN_FIELD];
        });
    };
    return LinearHeatmap;
}(dependents_1.Geometry));
dependents_1.registerGeometry('linearHeatmap', LinearHeatmap);

},{"../../dependents":425,"../../util/color":673,"@antv/util":803,"tslib":894}],432:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var main_1 = tslib_1.__importDefault(require("./main"));
exports.default = {
    main: main_1.default,
};

},{"./main":433,"tslib":894}],433:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var COLOR_MAPPER = ['colorField', 'stackField', 'groupField'];
var IntervalParser = /** @class */ (function (_super) {
    tslib_1.__extends(IntervalParser, _super);
    function IntervalParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    IntervalParser.prototype.init = function () {
        this.type = 'interval';
        _super.prototype.init.call(this);
        var props = this.plot.options;
        if (this._needParserColor()) {
            this.parseColor();
        }
        if (!this.config.color) {
            this.config.color = { values: ['#5b8ff9'] };
        }
        var sizeProps = this._getSizeProps(props);
        if (sizeProps) {
            this.parseSize(sizeProps);
        }
        var styleProps = this._getStyleProps(props);
        if (styleProps) {
            this.parseStyle(styleProps);
        }
    };
    IntervalParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var colorField = this._getColorMappingField(props);
        var config = {};
        if (colorField) {
            config.fields = colorField;
        }
        if (props.color) {
            if (util_1.isString(props.color)) {
                config.values = [props.color];
            }
            else if (util_1.isFunction(props.color)) {
                config.callback = props.color;
            }
            else if (util_1.isArray(props.color)) {
                if (colorField) {
                    config.values = props.color;
                }
                else {
                    if (props.color.length > 0) {
                        config.values = [props.color[0]];
                    }
                }
            }
            else if (util_1.isObject(props.color)) {
                config.fields = colorField;
                config.callback = function (d) {
                    return props.color[d];
                };
            }
        }
        this.config.color = config;
    };
    IntervalParser.prototype.parseSize = function (sizeProps) {
        var props = this.plot.options;
        var config = {};
        if (util_1.isFunction(props[sizeProps])) {
            config.fields = [this.config.position.fields];
            config.callback = props[sizeProps];
        }
        else {
            config.values = [props[sizeProps]];
        }
        this.config.size = config;
    };
    IntervalParser.prototype.parseStyle = function (styleProps) {
        var props = this.plot.options;
        var color = this.config.color;
        var style = this.plot.options[styleProps];
        var config = {};
        if (util_1.isFunction(style)) {
            config.fields = (color === null || color === void 0 ? void 0 : color.fields) || [props.xField, props.yField];
            config.callback = style;
        }
        else {
            config.cfg = style;
        }
        this.config.style = config;
    };
    IntervalParser.prototype._getSizeProps = function (props) {
        var sizeMapper = ['columnSize', 'barSize'];
        for (var _i = 0, sizeMapper_1 = sizeMapper; _i < sizeMapper_1.length; _i++) {
            var m = sizeMapper_1[_i];
            if (util_1.get(props, m)) {
                return m;
            }
        }
    };
    IntervalParser.prototype._getStyleProps = function (props) {
        var sizeMapper = ['columnStyle', 'barStyle', 'pieStyle', 'ringStyle'];
        for (var _i = 0, sizeMapper_2 = sizeMapper; _i < sizeMapper_2.length; _i++) {
            var m = sizeMapper_2[_i];
            if (util_1.get(props, m)) {
                return m;
            }
        }
    };
    IntervalParser.prototype._getColorMappingField = function (props) {
        /**如果有colorFiled或stackField配置项(后者为堆叠interval)，则参与colorMapping的字段为对应值
         * 如没有特别设定，则一般是callback中的传参，传入位置映射的字段
         */
        for (var _i = 0, COLOR_MAPPER_1 = COLOR_MAPPER; _i < COLOR_MAPPER_1.length; _i++) {
            var m = COLOR_MAPPER_1[_i];
            if (util_1.get(props, m)) {
                return [props[m]];
            }
        }
    };
    IntervalParser.prototype._needParserColor = function () {
        var props = this.plot.options;
        if (props.color) {
            return true;
        }
        for (var _i = 0, COLOR_MAPPER_2 = COLOR_MAPPER; _i < COLOR_MAPPER_2.length; _i++) {
            var m = COLOR_MAPPER_2[_i];
            if (props[m]) {
                return true;
            }
        }
        return false;
    };
    return IntervalParser;
}(base_1.default));
exports.default = IntervalParser;

},{"../base":429,"@antv/util":803,"tslib":894}],434:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var main_1 = tslib_1.__importDefault(require("./main"));
var GuideLineParser = /** @class */ (function (_super) {
    tslib_1.__extends(GuideLineParser, _super);
    function GuideLineParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GuideLineParser.prototype.init = function () {
        var props = this.plot.options;
        if (!props.xField || !props.yField) {
            return;
        }
        this.config = {
            type: 'line',
            position: {
                fields: [props.xField, props.yField],
            },
            tooltip: false,
        };
        if (this._getColorMappingField() || this._needParseAttribute('color')) {
            this.parseColor();
        }
        if (this._needParseAttribute('size')) {
            this.parseSize();
        }
        if (props.line.style) {
            this.parseStyle();
        }
        if (props.smooth) {
            this.config.shape = { values: ['smooth'] };
        }
    };
    GuideLineParser.prototype.parseSize = function () {
        var props = this.plot.options;
        var config = {};
        if (props.line.size) {
            config.values = [props.line.size];
        }
        else {
            // line作为辅助图形没有在style里指定size属性的情况下，设置默认值
            config.values = [2];
        }
        this.config.size = config;
    };
    GuideLineParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var config = {};
        var colorField = this._getColorMappingField();
        if (colorField) {
            config.fields = colorField;
        }
        if (props.line.color) {
            config.values = [props.line.color];
        }
        else {
            // line作为辅助图形没有在style里指定color属性的情况下，默认接受主体图形的透传
            if (util_1.isString(props.color)) {
                config.values = [props.color];
            }
            else if (util_1.isFunction(props.color)) {
                config.fields = colorField;
                config.callback = props.color;
            }
            else if (util_1.isArray(props.color)) {
                if (colorField) {
                    config.values = props.color;
                }
                else {
                    if (props.color.length > 0) {
                        config.values = [props.color[0]];
                    }
                }
            }
        }
        this.config.color = config;
    };
    GuideLineParser.prototype.parseStyle = function () {
        var props = this.plot.options;
        var styleProps = props.line.style;
        var config = {};
        if (util_1.isFunction(styleProps)) {
            config.fields = this.config.position.fields;
            config.callback = styleProps;
        }
        else {
            config.cfg = styleProps;
        }
        this.config.style = config;
    };
    GuideLineParser.prototype._needParseAttribute = function (attr) {
        var props = this.plot.options;
        if (props[attr]) {
            return true;
        }
        else if (props.line[attr]) {
            return true;
        }
        return false;
    };
    GuideLineParser.prototype._getColorMappingField = function () {
        var props = this.plot.options;
        var colorMapper = ['stackField', 'seriesField'];
        for (var _i = 0, colorMapper_1 = colorMapper; _i < colorMapper_1.length; _i++) {
            var m = colorMapper_1[_i];
            if (util_1.get(props, m)) {
                return [props[m]];
            }
        }
    };
    return GuideLineParser;
}(main_1.default));
exports.default = GuideLineParser;

},{"./main":436,"@antv/util":803,"tslib":894}],435:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var guide_1 = tslib_1.__importDefault(require("./guide"));
var main_1 = tslib_1.__importDefault(require("./main"));
var mini_1 = tslib_1.__importDefault(require("./mini"));
exports.default = {
    main: main_1.default,
    guide: guide_1.default,
    mini: mini_1.default,
};

},{"./guide":434,"./main":436,"./mini":437,"tslib":894}],436:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var LineParser = /** @class */ (function (_super) {
    tslib_1.__extends(LineParser, _super);
    function LineParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LineParser.prototype.init = function () {
        var props = this.plot.options;
        this.config = {
            type: 'line',
            position: {
                fields: [props.xField, props.yField],
            },
            connectNulls: props.connectNulls,
        };
        if (props.lineSize) {
            this.parseSize();
        }
        if (props.smooth) {
            this.config.shape = { values: ['smooth'] };
        }
        if (props.step) {
            this.config.shape = { values: [props.step] };
        }
        if (props.seriesField || props.color) {
            this.parseColor();
        }
        if (props.lineStyle || util_1.get(props, ['line', 'style'])) {
            this.parseStyle();
        }
    };
    LineParser.prototype.parseSize = function () {
        var sizeProps = this.plot.options.lineSize;
        var config = {};
        if (util_1.isFunction(sizeProps)) {
            config.callback = sizeProps;
        }
        else {
            config.values = [sizeProps];
        }
        this.config.size = config;
    };
    LineParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var config = {};
        if (props.seriesField) {
            config.fields = [props.seriesField];
        }
        if (util_1.has(props, 'color')) {
            var color = props.color;
            if (util_1.isString(color)) {
                config.values = [color];
            }
            else if (util_1.isFunction(color)) {
                config.callback = color;
            }
            else if (util_1.isArray(color)) {
                if (props.seriesField) {
                    config.values = color;
                }
                else {
                    if (color.length > 0) {
                        config.values = [color[0]];
                    }
                }
            }
        }
        this.config.color = config;
    };
    LineParser.prototype.parseStyle = function () {
        var props = this.plot.options;
        var styleProps = props.lineStyle || util_1.get(props, ['line', 'style']);
        var config = {
            fields: null,
            callback: null,
            cfg: null,
        };
        if (util_1.isFunction(styleProps) && props.seriesField) {
            config.fields = [props.seriesField];
            config.callback = styleProps;
        }
        else {
            config.cfg = styleProps;
        }
        this.config.style = config;
    };
    return LineParser;
}(base_1.default));
exports.default = LineParser;

},{"../base":429,"@antv/util":803,"tslib":894}],437:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/** 简化折线点 */
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
var math_1 = require("../../util/math");
var path_1 = require("../../util/path");
var main_1 = tslib_1.__importDefault(require("./main"));
var theme_1 = require("../../theme");
dependents_1.registerShape('line', 'miniLine', {
    draw: function (cfg, container) {
        var points = math_1.lineSimplification(cfg.points);
        var path = [];
        for (var i = 0; i < points.length; i++) {
            var p = points[i];
            var flag = i === 0 ? 'M' : 'L';
            path.push([flag, p.x, p.y]);
        }
        var style = util_1.deepMix({}, {
            lineJoin: 'round',
            lineCap: 'round',
        }, cfg.style);
        var shape = container.addShape('path', {
            attrs: util_1.mix({
                path: path,
                stroke: cfg.color || theme_1.getGlobalTheme().defaultColor,
                lineWidth: cfg.size || 2,
            }, style),
        });
        return shape;
    },
});
dependents_1.registerShape('line', 'miniLineSmooth', {
    draw: function (cfg, container) {
        var points = math_1.lineSimplification(cfg.points);
        var constraint = [
            [0, 0],
            [1, 1],
        ];
        var path = path_1.getSplinePath(points, false, constraint);
        var shape = container.addShape('path', {
            attrs: util_1.mix({
                path: path,
                stroke: cfg.color || theme_1.getGlobalTheme().defaultColor,
                lineWidth: cfg.size || 2,
            }, cfg.style),
        });
        return shape;
    },
});
var MiniLineParser = /** @class */ (function (_super) {
    tslib_1.__extends(MiniLineParser, _super);
    function MiniLineParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MiniLineParser.prototype.init = function () {
        _super.prototype.init.call(this);
        this.parseShape();
    };
    MiniLineParser.prototype.parseShape = function () {
        var props = this.plot.options;
        if (props.smooth) {
            this.config.shape = { values: ['miniLineSmooth'] };
        }
        else {
            this.config.shape = { values: ['miniLine'] };
        }
    };
    return MiniLineParser;
}(main_1.default));
exports.default = MiniLineParser;

},{"../../dependents":425,"../../theme":669,"../../util/math":680,"../../util/path":681,"./main":436,"@antv/util":803,"tslib":894}],438:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
var CircleParser = /** @class */ (function (_super) {
    tslib_1.__extends(CircleParser, _super);
    function CircleParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CircleParser.prototype.init = function () {
        var props = this.plot.options;
        this.style = props.pointStyle;
        if (!props.xField || !props.yField) {
            return;
        }
        this.config = {
            type: 'point',
            position: {
                fields: [props.xField, props.yField],
            },
        };
        this.parseColor();
        this.parseSize();
        if (props.shape) {
            this.parseShape(props.shape);
        }
        if (props.pointStyle) {
            this.parseStyle();
        }
    };
    CircleParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var config = {};
        var colorField = props.colorField;
        if (colorField) {
            config.fields = util_1.isArray(colorField) ? colorField : [colorField];
        }
        if (props.color) {
            this._parseColor(props, config);
        }
        if (!util_1.isEmpty(config)) {
            this.config.color = config;
        }
    };
    CircleParser.prototype.parseSize = function () {
        var props = this.plot.options;
        var config = {};
        if (props.sizeField) {
            config.fields = [props.sizeField];
        }
        if (props.pointSize) {
            config.values = util_1.isArray(props.pointSize) ? props.pointSize : [props.pointSize];
        }
        this.config.size = config;
    };
    CircleParser.prototype.parseShape = function (shapeName) {
        this.config.shape = shapeName;
    };
    CircleParser.prototype.parseStyle = function () {
        var props = this.plot.options;
        var styleProps = props.pointStyle;
        var config = {
            fields: null,
            callback: null,
            cfg: null,
        };
        var xField = props.xField, yField = props.yField, colorField = props.colorField;
        if (util_1.isFunction(styleProps)) {
            if (colorField) {
                config.fields = util_1.isArray(colorField)
                    ? [xField, yField, colorField].concat(colorField)
                    : [xField, yField, colorField];
            }
            else {
                config.fields = [xField, yField];
            }
            config.callback = styleProps;
        }
        else {
            config.cfg = styleProps;
            // opacity 与 fillOpacity 兼容
            if (!util_1.isNil(styleProps.opacity)) {
                config.cfg.fillOpacity = styleProps.opacity;
            }
        }
        this.config.style = config;
    };
    CircleParser.prototype._parseColor = function (props, config) {
        if (util_1.isString(props.color)) {
            config.values = [props.color];
        }
        else if (util_1.isFunction(props.color)) {
            config.callback = props.color;
        }
        else if (util_1.isArray(props.color)) {
            config.values = props.color;
        }
    };
    return CircleParser;
}(base_1.default));
exports.default = CircleParser;

},{"../base":429,"@antv/util":803,"tslib":894}],439:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("../base"));
function getValuesByField(field, data) {
    var values = [];
    util_1.each(data, function (d) {
        var v = d[field];
        values.push(v);
    });
    return util_1.uniq(values);
}
var COLOR_MAPPER = ['seriesField', 'stackField'];
var GuidePointParser = /** @class */ (function (_super) {
    tslib_1.__extends(GuidePointParser, _super);
    function GuidePointParser() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GuidePointParser.prototype.init = function () {
        var props = this.plot.options;
        this.style = props.point.style;
        if (!props.xField || !props.yField) {
            return;
        }
        this.config = {
            type: 'point',
            position: {
                fields: [props.xField, props.yField],
            },
            tooltip: false,
        };
        // if (this._needParseAttribute('color')) {
        this.parseColor();
        // }
        if (this._needParseAttribute('size')) {
            this.parseSize();
        }
        if (props.point.shape) {
            this.parseShape(props.point.shape);
        }
        if (props.point.style) {
            this.parseStyle();
        }
    };
    GuidePointParser.prototype.parseColor = function () {
        var props = this.plot.options;
        var config = {};
        var mappingField = this._getColorMappingField(props);
        if (mappingField) {
            this._parseColorByField(props, config, mappingField);
        }
        else {
            if (props.point && props.point.color) {
                config.values = [props.point.color];
            }
            else if (props.color) {
                this._parseColor(props, config);
            }
            else {
                var theme = this.plot.getTheme();
                config.values = [theme.defaultColor];
            }
        }
        if (util_1.keys(config).length > 0) {
            this.config.color = config;
        }
    };
    GuidePointParser.prototype.parseSize = function () {
        var props = this.plot.options;
        var config = {};
        config.values = [props.point.size];
        this.config.size = config;
    };
    GuidePointParser.prototype.parseShape = function (shapeCfg) {
        var config = {};
        if (util_1.isString(shapeCfg)) {
            config.values = [shapeCfg];
        }
        else if (util_1.isObject(shapeCfg)) {
            config.fields = shapeCfg.fields;
            config.callback = shapeCfg.callback;
        }
        this.config.shape = config;
    };
    GuidePointParser.prototype.parseStyle = function () {
        var props = this.plot.options;
        var styleProps = props.point && props.point.style;
        var config = {
            fields: null,
            callback: null,
            cfg: null,
        };
        var field = this._getColorMappingField(props);
        if (util_1.isFunction(styleProps)) {
            config.fields = [props.xField, props.yField];
            config.callback = styleProps;
            if (field) {
                config.fields.unshift(field);
            }
        }
        else {
            config.cfg = styleProps;
        }
        this.config.style = config;
    };
    GuidePointParser.prototype._parseColorByField = function (props, config, field) {
        config.fields = [field];
        if (props.point.color) {
            var count = getValuesByField(field, props.data).length;
            var values = [];
            for (var i = 0; i < count; i++) {
                values.push(props.point.color);
            }
            config.values = values;
        }
        else if (props.color) {
            this._parseColor(props, config);
        }
    };
    GuidePointParser.prototype._parseColor = function (props, config) {
        var field = this._getColorMappingField(props);
        if (util_1.isString(props.color)) {
            config.values = [props.color];
        }
        else if (util_1.isFunction(props.color)) {
            config.callback = props.color;
        }
        else if (util_1.isArray(props.color)) {
            if (field) {
                config.values = props.color;
            }
            else {
                if (props.color.length > 0) {
                    config.values = [props.color[0]];
                }
            }
        }
    };
    GuidePointParser.prototype._needParseAttribute = function (attr) {
        var props = this.plot.options;
        var condition = props.point && util_1.has(props.point, attr);
        return condition;
        // const condition = !this.style || this.style[attr];
        // return condition;
    };
    GuidePointParser.prototype._getColorMappingField = function (props) {
        for (var _i = 0, COLOR_MAPPER_1 = COLOR_MAPPER; _i < COLOR_MAPPER_1.length; _i++) {
            var m = COLOR_MAPPER_1[_i];
            if (util_1.get(props, m)) {
                return [props[m]];
            }
        }
    };
    return GuidePointParser;
}(base_1.default));
exports.default = GuidePointParser;

},{"../base":429,"@antv/util":803,"tslib":894}],440:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var circle_1 = tslib_1.__importDefault(require("./circle"));
var guide_1 = tslib_1.__importDefault(require("./guide"));
exports.default = {
    guide: guide_1.default,
    circle: circle_1.default,
};

},{"./circle":438,"./guide":439,"tslib":894}],441:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var core_1 = tslib_1.__importDefault(require("./core"));
var BaseInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(BaseInteraction, _super);
    function BaseInteraction(cfg, viewLayer, interactionRange, interaction) {
        var _this = _super.call(this, cfg) || this;
        _this.viewLayer = viewLayer;
        _this.interactionRange = interactionRange;
        _this.interactionConfig = interaction;
        _this.disposables = [];
        return _this;
    }
    BaseInteraction.registerInteraction = function (type, ctor) {
        BaseInteraction.GLOBAL_INTERACTION_MAP[type] = ctor;
    };
    BaseInteraction.registerPlotInteraction = function (plotType, type, ctor) {
        if (!BaseInteraction.PLOT_INTERACTION_MAP[plotType]) {
            BaseInteraction.PLOT_INTERACTION_MAP[plotType] = {};
        }
        BaseInteraction.PLOT_INTERACTION_MAP[plotType][type] = ctor;
    };
    BaseInteraction.getInteraction = function (type, plotType) {
        if (plotType && BaseInteraction.PLOT_INTERACTION_MAP[plotType] && BaseInteraction[plotType][type]) {
            return BaseInteraction.PLOT_INTERACTION_MAP[plotType][type];
        }
        return BaseInteraction.GLOBAL_INTERACTION_MAP[type];
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BaseInteraction.getInteractionRange = function (layerRange, interaction) {
        return undefined;
    };
    BaseInteraction.prototype.destroy = function () {
        util_1.each(this.disposables, function (fn) {
            fn();
        });
        this.disposables = [];
        this.clear();
        _super.prototype.destroy.call(this);
    };
    BaseInteraction.prototype.getViewLayer = function () {
        return this.viewLayer;
    };
    BaseInteraction.prototype.getRange = function () {
        return this.interactionRange;
    };
    BaseInteraction.prototype.getInteractionConfig = function () {
        return this.interactionConfig;
    };
    BaseInteraction.prototype.addDisposable = function (fn) {
        this.disposables.push(fn);
    };
    BaseInteraction.prototype.render = function () {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BaseInteraction.prototype.start = function (ev) {
        return;
    };
    BaseInteraction.GLOBAL_INTERACTION_MAP = {};
    BaseInteraction.PLOT_INTERACTION_MAP = {};
    return BaseInteraction;
}(core_1.default));
exports.default = BaseInteraction;

},{"./core":442,"@antv/util":803,"tslib":894}],442:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var EVENT_TYPES = ['start', 'process', 'end', 'reset'];
var Interaction = /** @class */ (function () {
    function Interaction(cfg) {
        var defaultCfg = this.getDefaultCfg();
        util_1.assign(this, defaultCfg, cfg);
        this.canvas = this.view.canvas;
        this._eventHandlers = [];
        this._bindEvents();
    }
    Interaction.prototype.getDefaultCfg = function () {
        return {
            startEvent: 'mousedown',
            processEvent: 'mousemove',
            endEvent: 'mouseup',
            resetEvent: 'dblclick',
        };
    };
    Interaction.prototype._start = function (ev) {
        this.preStart(ev);
        this.start(ev);
        this.afterStart(ev);
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.preStart = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.afterStart = function (ev) {
        return;
    };
    Interaction.prototype._process = function (ev) {
        this.preProcess(ev);
        this.process(ev);
        this.afterProcess(ev);
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.preProcess = function (ev) {
        return;
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.process = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.afterProcess = function (ev) {
        return;
    };
    Interaction.prototype._end = function (ev) {
        this.preEnd(ev);
        this.end(ev);
        this.afterEnd(ev);
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.preEnd = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.end = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.afterEnd = function (ev) {
        return;
    };
    Interaction.prototype._reset = function (ev) {
        this.preReset(ev);
        this.reset(ev);
        this.afterReset(ev);
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.preReset = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.reset = function (ev) {
        return;
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    Interaction.prototype.afterReset = function (ev) {
        return;
    };
    Interaction.prototype._bindEvents = function () {
        var _this = this;
        util_1.each(EVENT_TYPES, function (type) {
            var eventName = _this[type + "Event"];
            var handler = util_1.wrapBehavior(_this, "_" + type);
            _this.view.on(eventName, handler);
            _this._eventHandlers.push({ type: eventName, handler: handler });
        });
    };
    Interaction.prototype._unbindEvents = function () {
        var _this = this;
        var eventHandlers = this._eventHandlers;
        util_1.each(eventHandlers, function (eh) {
            _this.view.off(eh.type, eh.handler);
        });
    };
    Interaction.prototype.destroy = function () {
        this._unbindEvents();
        this._reset();
    };
    return Interaction;
}());
exports.default = Interaction;

},{"@antv/util":803}],443:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDataByScaleRange = void 0;
var util_1 = require("@antv/util");
/**
 * 按照scale字段values中的start和end信息从全部数据中取出对应的部分
 *
 * @param field scale field
 * @param values scale values
 * @param data original data
 * @param range range start & end
 */
exports.getDataByScaleRange = function (field, values, data, _a, vertical) {
    var start = _a[0], end = _a[1];
    if (vertical === void 0) { vertical = false; }
    var groupedData = util_1.groupBy(data, field);
    var newValues = vertical ? values.slice(values.length - end, values.length - start) : values.slice(start, end);
    return util_1.flatten(util_1.map(newValues, function (value) { return groupedData[value] || []; }));
};

},{"@antv/util":803}],444:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = tslib_1.__importDefault(require("./base"));
var scrollbar_1 = tslib_1.__importDefault(require("./scrollbar"));
var slider_1 = tslib_1.__importDefault(require("./slider"));
var timeline_1 = tslib_1.__importDefault(require("./timeline"));
var tooltip_indicator_1 = tslib_1.__importDefault(require("./tooltip-indicator"));
base_1.default.registerInteraction('slider', slider_1.default);
base_1.default.registerInteraction('scrollbar', scrollbar_1.default);
base_1.default.registerInteraction('timeline', timeline_1.default);
base_1.default.registerInteraction('tooltip-indicator', tooltip_indicator_1.default);
tslib_1.__exportStar(require("./base"), exports);
exports.default = base_1.default;

},{"./base":441,"./scrollbar":445,"./slider":446,"./timeline":447,"./tooltip-indicator":448,"tslib":894}],445:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dependents_1 = require("../dependents");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
var data_range_1 = require("./helper/data-range");
var constant_1 = require("@antv/g2/lib/constant");
var constants_1 = require("../base/constants");
var DEFAULT_PADDING = 4;
var DEFAULT_SIZE = 8;
var DEFAULT_CATEGORY_SIZE = 32;
var MIN_THUMB_LENGTH = 20;
var SCROLL_BAR_Z_INDEX = 999;
var getValidScrollbarConfig = function (cfg) {
    if (cfg === void 0) { cfg = {}; }
    var _cfg = tslib_1.__assign({ type: 'horizontal', categorySize: DEFAULT_CATEGORY_SIZE, width: DEFAULT_SIZE, height: DEFAULT_SIZE, padding: [0, 0, 0, 0] }, cfg);
    // default padding
    if (!cfg.padding) {
        _cfg.padding =
            _cfg.type === 'horizontal' ? [DEFAULT_PADDING, 0, DEFAULT_PADDING, 0] : [0, DEFAULT_PADDING, 0, DEFAULT_PADDING];
    }
    return _cfg;
};
var ScrollbarInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(ScrollbarInteraction, _super);
    function ScrollbarInteraction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onChangeFn = util_1.throttle(_this.onChange.bind(_this), 20, {
            leading: true,
        });
        return _this;
    }
    ScrollbarInteraction.getInteractionRange = function (layerRange, interaction) {
        var config = getValidScrollbarConfig(interaction);
        var _a = config.padding, paddingTop = _a[0], paddingRight = _a[1], paddingBottom = _a[2], paddingLeft = _a[3];
        if (config.type === 'horizontal') {
            return new bbox_1.default(layerRange.minX, layerRange.maxY - config.height - paddingTop - paddingBottom, layerRange.width, config.height + paddingTop + paddingBottom);
        }
        else {
            return new bbox_1.default(layerRange.maxX - config.width - paddingLeft - paddingRight, layerRange.minY, config.width + paddingLeft + paddingRight, layerRange.height);
        }
    };
    ScrollbarInteraction.prototype.render = function () {
        var _this = this;
        var layer = this.getViewLayer();
        var view = this.view;
        this.ratio = 0;
        this.thumbOffset = 0;
        var callback = function () {
            var padding = _this.view.padding;
            // if we're not in `auto padding` process
            if (padding === 'auto' || util_1.isEqual(padding, [0, 0, 0, 1])) {
                return;
            }
            if (!_this.trackLen) {
                _this.measureScrollBar();
                _this.changeViewData(_this.getScrollRange(), true);
            }
            else {
                _this.renderScrollbar();
            }
        };
        var changeDataCallback = function () {
            // reset
            _this.trackLen = 0;
        };
        view.on(constant_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback);
        this.addDisposable(function () { return view.off(constant_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback); });
        view.on(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, callback);
        this.addDisposable(function () { return view.off(constant_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, callback); });
        layer.on(constants_1.VIEW_LAYER_LIFE_CYCLE.BEFORE_CHANGE_DATA, changeDataCallback);
        this.addDisposable(function () { return layer.off(constants_1.VIEW_LAYER_LIFE_CYCLE.BEFORE_CHANGE_DATA, changeDataCallback); });
    };
    ScrollbarInteraction.prototype.start = function () {
        return;
    };
    ScrollbarInteraction.prototype.clear = function () {
        if (this.scrollbar) {
            this.scrollbar.destroy();
            this.scrollbar = null;
        }
        if (this.container) {
            this.container.remove(true);
            this.container = null;
        }
        this.trackLen = null;
        this.thumbLen = null;
    };
    ScrollbarInteraction.prototype.renderScrollbar = function () {
        var config = getValidScrollbarConfig(this.getInteractionConfig());
        var range = this.getRange();
        var isHorizontal = config.type !== 'vertical';
        var panelRange = this.view.coordinateBBox;
        var _a = config.padding, paddingTop = _a[0], paddingLeft = _a[3];
        var position = isHorizontal
            ? { x: panelRange.minX + paddingLeft, y: range.minY + paddingTop }
            : { x: range.minX + paddingLeft, y: panelRange.minY + paddingTop };
        if (!this.scrollbar) {
            this.container = this.canvas.addGroup();
            this.scrollbar = new dependents_1.Scrollbar({
                container: this.container,
                x: position.x,
                y: position.y,
                isHorizontal: isHorizontal,
                trackLen: this.trackLen,
                thumbLen: this.thumbLen,
                thumbOffset: this.ratio * this.trackLen,
            });
            this.scrollbar.init();
            this.scrollbar.render();
            this.scrollbar.get('group').set('zIndex', SCROLL_BAR_Z_INDEX);
            this.scrollbar.on('scrollchange', this.onChangeFn);
        }
        else {
            this.scrollbar.update({
                trackLen: this.trackLen,
                thumbLen: this.thumbLen,
                thumbOffset: this.thumbOffset,
                x: position.x,
                y: position.y,
            });
            this.scrollbar.render();
        }
    };
    ScrollbarInteraction.prototype.measureScrollBar = function () {
        var config = getValidScrollbarConfig(this.getInteractionConfig());
        var _a = config.padding, paddingTop = _a[0], paddingRight = _a[1], paddingBottom = _a[2], paddingLeft = _a[3];
        var isHorizontal = config.type !== 'vertical';
        var panelRange = this.view.coordinateBBox;
        var xScale = this.view.getXScale();
        var yScales = this.view.getYScales().filter(function (scale) { return scale; });
        this.cnt = xScale.values.length;
        this.xScaleCfg = { field: xScale.field, values: xScale.values || [] };
        this.yScalesCfg = yScales;
        this.step = Math.floor((isHorizontal ? panelRange.width : panelRange.height) / config.categorySize);
        this.trackLen = isHorizontal
            ? panelRange.width - paddingLeft - paddingRight
            : panelRange.height - paddingTop - paddingBottom;
        this.thumbLen = Math.max(this.trackLen * util_1.clamp(this.step / xScale.values.length, 0, 1), MIN_THUMB_LENGTH);
    };
    ScrollbarInteraction.prototype.getScrollRange = function () {
        var startIdx = Math.floor((this.cnt - this.step) * util_1.clamp(this.ratio, 0, 1));
        var endIdx = Math.min(startIdx + this.step, this.cnt);
        return [startIdx, endIdx];
    };
    ScrollbarInteraction.prototype.changeViewData = function (_a, render) {
        var _this = this;
        var startIdx = _a[0], endIdx = _a[1];
        var config = getValidScrollbarConfig(this.getInteractionConfig());
        var viewLayer = this.getViewLayer();
        var meta = viewLayer.options.meta;
        var origData = viewLayer.getData();
        var newData = data_range_1.getDataByScaleRange(this.xScaleCfg.field, this.xScaleCfg.values, origData, [startIdx, endIdx], config.type === 'vertical');
        // ScrollBar在滚动过程中保持Y轴上scale配置: min/max/ticks
        this.yScalesCfg.forEach(function (cfg) {
            var metaCfg = util_1.get(meta, cfg.field) || {};
            _this.view.scale(cfg.field, tslib_1.__assign(tslib_1.__assign({ formatter: cfg.formatter }, metaCfg), { type: cfg.type, min: cfg.min, max: cfg.max }));
        });
        if (render) {
            this.view.data(newData);
            this.view.render();
        }
        else {
            this.view.changeData(newData);
        }
    };
    ScrollbarInteraction.prototype.onChange = function (_a) {
        var ratio = _a.ratio, thumbOffset = _a.thumbOffset;
        this.ratio = ratio;
        this.thumbOffset = thumbOffset;
        var origAnimate = this.view.getOptions().animate;
        this.view.animate(false);
        this.changeViewData(this.getScrollRange(), true);
        this.view.animate(origAnimate);
        // update scrollbar
        this.renderScrollbar();
    };
    return ScrollbarInteraction;
}(base_1.default));
exports.default = ScrollbarInteraction;

},{"../base/constants":386,"../dependents":425,"../util/bbox":672,"./base":441,"./helper/data-range":443,"@antv/g2/lib/constant":237,"@antv/util":803,"tslib":894}],446:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dependents_1 = require("../dependents");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
var data_range_1 = require("./helper/data-range");
var DEFAULT_PADDING = 4;
var DEFAULT_SIZE = 16;
var getValidSliderConfig = function (cfg) {
    if (cfg === void 0) { cfg = {}; }
    var _cfg = tslib_1.__assign({ type: 'horizontal', start: 0, end: 1, width: undefined, height: undefined, padding: [0, 0, 0, 0], backgroundStyle: {}, foregroundStyle: {}, handlerStyle: {}, textStyle: {}, trendCfg: {} }, cfg);
    // default padding
    if (!cfg.padding) {
        _cfg.padding =
            _cfg.type === 'horizontal' ? [DEFAULT_PADDING, 0, DEFAULT_PADDING, 0] : [0, DEFAULT_PADDING, 0, DEFAULT_PADDING];
    }
    // default size
    if (!cfg.height) {
        _cfg.height = DEFAULT_SIZE;
    }
    if (!cfg.width) {
        _cfg.width = DEFAULT_SIZE;
    }
    // start & end
    var start = util_1.clamp(Math.min(_cfg.start, _cfg.end), 0, 1);
    var end = util_1.clamp(Math.max(_cfg.start, _cfg.end), 0, 1);
    _cfg.start = start;
    _cfg.end = end;
    return _cfg;
};
var SliderInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(SliderInteraction, _super);
    function SliderInteraction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onChangeFn = util_1.throttle(_this.onChange.bind(_this), 20, { leading: true });
        return _this;
    }
    SliderInteraction.getInteractionRange = function (layerRange, interaction) {
        var config = getValidSliderConfig(interaction);
        var _a = config.padding || [0, 0, 0, 0], paddingTop = _a[0], paddingRight = _a[1], paddingBottom = _a[2], paddingLeft = _a[3];
        if (config.type === 'horizontal') {
            var bbox = new bbox_1.default(layerRange.minX, layerRange.maxY - config.height - paddingTop - paddingBottom, layerRange.width, config.height + paddingTop + paddingBottom);
            return bbox;
        }
        else {
            return new bbox_1.default(layerRange.maxX - config.width - paddingLeft - paddingRight, layerRange.minY, config.width + paddingLeft + paddingRight, layerRange.height);
        }
    };
    SliderInteraction.prototype.render = function () {
        var _this = this;
        var layer = this.getViewLayer();
        var view = this.view;
        // 设置初始化的 start/end
        var config = getValidSliderConfig(this.getInteractionConfig());
        this.curStart = config.start;
        this.curEnd = config.end;
        this.xScaleCfg = undefined;
        // 等待 view 每次 render 完成后更新 slider 组件
        var callback = function () {
            var padding = _this.view.padding;
            if (padding === 'auto' || util_1.isEqual(padding, [0, 0, 0, 1])) {
                return;
            }
            if (util_1.isEmpty(layer.options.data)) {
                return;
            }
            if (!_this.xScaleCfg) {
                // 初始化配置和数据
                var xScale = view.getXScale();
                _this.xScaleCfg = {
                    field: xScale.field,
                    values: xScale.values || [],
                };
                // 初始化 data
                view.data(_this.getSliderData(_this.curStart, _this.curEnd));
                view.render();
            }
            else {
                _this.renderSlider();
            }
        };
        view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback);
        this.addDisposable(function () { return view.off(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback); });
        view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, callback);
        this.addDisposable(function () { return view.off(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, callback); });
    };
    SliderInteraction.prototype.start = function () {
        return;
    };
    SliderInteraction.prototype.clear = function () {
        if (this.slider) {
            this.slider.destroy();
            this.slider = null;
        }
        if (this.container) {
            this.container.remove(true);
            this.container = null;
        }
    };
    SliderInteraction.prototype.renderSlider = function () {
        if (!this.slider) {
            this.container = this.canvas.addGroup();
            this.slider = new dependents_1.Slider(tslib_1.__assign(tslib_1.__assign({}, this.getSliderConfig()), { container: this.container }));
            this.slider.init();
            this.slider.render();
            this.slider.on('sliderchange', this.onChangeFn);
        }
        else {
            this.slider.update(this.getSliderConfig());
            this.slider.render();
        }
    };
    SliderInteraction.prototype.getSliderConfig = function () {
        var view = this.view;
        var panelRange = view.coordinateBBox;
        var range = this.getRange();
        var config = getValidSliderConfig(this.getInteractionConfig());
        var _a = config || {}, _b = _a.padding, padding = _b === void 0 ? [0, 0, 0, 0] : _b, backgroundStyle = _a.backgroundStyle, foregroundStyle = _a.foregroundStyle, handlerStyle = _a.handlerStyle, textStyle = _a.textStyle, _c = _a.trendCfg, trendCfg = _c === void 0 ? {} : _c;
        var paddingTop = padding[0], paddingRight = padding[1], paddingBottom = padding[2], paddingLeft = padding[3];
        var _d = this.getSliderMinMaxText(this.curStart, this.curEnd), minText = _d.minText, maxText = _d.maxText;
        var cfg = {
            x: panelRange.minX + paddingLeft,
            y: range.minY + paddingTop,
            width: panelRange.width - paddingLeft - paddingRight,
            height: range.height - paddingTop - paddingBottom,
            start: this.curStart,
            end: this.curEnd,
            minText: minText,
            maxText: maxText,
            backgroundStyle: backgroundStyle,
            foregroundStyle: foregroundStyle,
            handlerStyle: handlerStyle,
            textStyle: textStyle,
            trendCfg: tslib_1.__assign(tslib_1.__assign({ isArea: false, smooth: false }, trendCfg), { data: this.getSliderTrendData() }),
        };
        return cfg;
    };
    SliderInteraction.prototype.getSliderTrendData = function () {
        var _a = this.getViewLayer().options, data = _a.data, yField = _a.yField;
        return util_1.map(data, function (item) { return item[yField]; });
    };
    SliderInteraction.prototype.getSliderData = function (start, end) {
        var origData = this.getViewLayer().getData();
        var length = util_1.size(this.xScaleCfg.values);
        var startIdx = Math.round(start * length);
        var endIdx = Math.max(startIdx + 1, Math.round(end * length));
        return data_range_1.getDataByScaleRange(this.xScaleCfg.field, this.xScaleCfg.values, origData, [startIdx, endIdx]);
    };
    SliderInteraction.prototype.getSliderMinMaxText = function (start, end) {
        var _a = this.getViewLayer().options, _b = _a.data, data = _b === void 0 ? [] : _b, xField = _a.xField;
        var length = util_1.size(data);
        var startIdx = Math.round(start * length);
        var endIdx = Math.max(startIdx + 1, Math.round(end * length));
        var newData = data.slice(startIdx, endIdx);
        return {
            minText: newData.length > 0 ? util_1.head(newData)[xField] : '',
            maxText: newData.length > 0 ? util_1.last(newData)[xField] : '',
        };
    };
    SliderInteraction.prototype.onChange = function (range) {
        var view = this.view;
        var start = util_1.clamp(Math.min(range[0], range[1]), 0, 1);
        var end = util_1.clamp(Math.max(range[0], range[1]), 0, 1);
        var data = this.getSliderData(start, end);
        var _a = this.getSliderMinMaxText(start, end), minText = _a.minText, maxText = _a.maxText;
        this.curStart = start;
        this.curEnd = end;
        this.slider.update({
            start: start,
            end: end,
            minText: minText,
            maxText: maxText,
        });
        this.slider.render();
        var origAnimate = view.getOptions().animate;
        view.animate(false);
        view.data(data);
        view.render();
        view.animate(origAnimate);
    };
    return SliderInteraction;
}(base_1.default));
exports.default = SliderInteraction;

},{"../dependents":425,"../util/bbox":672,"./base":441,"./helper/data-range":443,"@antv/util":803,"tslib":894}],447:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../dependents");
var base_1 = tslib_1.__importDefault(require("./base"));
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var timeline_1 = tslib_1.__importDefault(require("../components/timeline"));
var DEFAULT_HEIGHT = 40;
function getValidTimeLineConfig(interaction) {
    return tslib_1.__assign({ loop: false, auto: true, height: DEFAULT_HEIGHT, padding: [0, 20, 0, 0], speed: 2 }, interaction);
}
var TimeLineInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(TimeLineInteraction, _super);
    function TimeLineInteraction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onChangeFn = util_1.throttle(_this.onChange.bind(_this), 20, { leading: true });
        return _this;
    }
    /** TimeLineInteraction new 时的范围参数 interactionRange */
    TimeLineInteraction.getInteractionRange = function (layerRange, interaction) {
        var config = getValidTimeLineConfig(interaction);
        var paddingTop = config.padding[0];
        var paddingBottom = config.padding[2];
        return new bbox_1.default(layerRange.minX, layerRange.maxY - config.height - paddingTop - paddingBottom, layerRange.width, config.height + paddingTop + paddingBottom);
    };
    TimeLineInteraction.prototype.setAnimate = function (isAnimate) {
        var geometries = this.view.geometries;
        this.view.animate(isAnimate);
        geometries.forEach(function (geom) {
            geom.animate(isAnimate);
        });
    };
    TimeLineInteraction.prototype.start = function () {
        return;
    };
    TimeLineInteraction.prototype.renderTimeLine = function () {
        var _this = this;
        this.config = getValidTimeLineConfig(this.getInteractionConfig());
        var viewRange = this.view.viewBBox;
        var _a = this.config, loop = _a.loop, padding = _a.padding, speed = _a.speed;
        var paddingTop = padding[0], paddingRight = padding[1], paddingBottom = padding[2], paddingLeft = padding[3];
        var range = this.getRange();
        var ticks = this.getTicks();
        var width = viewRange.width - paddingLeft - paddingRight;
        var timeLineConfig = {
            x: viewRange.minX + paddingLeft,
            y: range.tl.y + paddingTop,
            width: width,
            height: range.height - paddingTop - paddingBottom,
            loop: loop,
            ticks: ticks,
            speed: speed,
            defaultCurrentTick: ticks[0],
        };
        if (this.timeline) {
            if (!util_1.isEqual(timeLineConfig, this.timeLineConfig)) {
                this.timeLineConfig = timeLineConfig;
                this.timeline.update(timeLineConfig);
            }
        }
        else {
            this.container = this.canvas.addGroup();
            this.timeline = new timeline_1.default(tslib_1.__assign({ container: this.container }, timeLineConfig));
            this.timeline.init();
            this.timeline.render();
            this.timeline.on('timelinestart', function () {
                _this.originAnimation = _this.view.getOptions().animate;
                _this.setAnimate(true);
            });
            this.timeline.on('timelineend', function () {
                _this.setAnimate(_this.originAnimation);
            });
            this.timeline.on('timelinechange', this.onChangeFn);
            this.timeline.on('timelineupdate', this.onChange.bind(this));
            this.view.data(this.getFilterData(ticks[0]));
            this.timeLineConfig = timeLineConfig;
        }
    };
    TimeLineInteraction.prototype.onChange = function (tick) {
        var filterData = this.getFilterData(tick);
        this.view.changeData(filterData);
    };
    TimeLineInteraction.prototype.getFilterData = function (tick) {
        var field = this.config.field;
        var data = this.getViewLayer().options.data;
        return data.filter(function (item) { return item[field] === tick; });
    };
    TimeLineInteraction.prototype.getTicks = function () {
        var field = this.config.field;
        var data = this.getViewLayer().options.data;
        return util_1.uniq(data.map(function (item) { return item[field]; }));
    };
    /** 渲染 timeline */
    TimeLineInteraction.prototype.render = function () {
        var _this = this;
        this.firstRender = true;
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.BEFORE_RENDER, function () {
            _this.renderTimeLine();
        });
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.BEFORE_PAINT, function () {
            _this.renderTimeLine();
        });
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, function () {
            if (_this.config.auto && _this.firstRender) {
                _this.timeline.isPlay = true;
                _this.timeline.changePlayStatus();
            }
            _this.firstRender = false;
        });
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
            if (_this.config.auto && _this.firstRender) {
                _this.timeline.isPlay = true;
                _this.timeline.changePlayStatus();
            }
            _this.firstRender = false;
        });
    };
    TimeLineInteraction.prototype.clear = function () {
        if (this.timeline) {
            this.timeline.destroy();
            this.timeline = null;
        }
        if (this.container) {
            this.container.remove(true);
            this.container = null;
        }
    };
    return TimeLineInteraction;
}(base_1.default));
exports.default = TimeLineInteraction;

},{"../components/timeline":422,"../dependents":425,"../util/bbox":672,"./base":441,"@antv/util":803,"tslib":894}],448:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TooltipIndicationAction = exports.TOOLTIP_INDICATOR_EVENTS = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = tslib_1.__importDefault(require("./base"));
var dependents_1 = require("../dependents");
var tooltip_indicator_1 = tslib_1.__importStar(require("../components/tooltip-indicator"));
var view_1 = require("../util/view");
var bbox_1 = tslib_1.__importDefault(require("../util/bbox"));
var DEFAULT_PADDING = 8;
var getValidTooltipIndicatorConfig = function (cfg) {
    if (cfg === void 0) { cfg = {}; }
    var newCfg = tslib_1.__assign({ showTotal: false, showPercent: false, padding: [DEFAULT_PADDING, 24, DEFAULT_PADDING, 24], height: cfg.showPercent ? 72 : 54 }, cfg);
    return newCfg;
};
var TOOLTIP_INDICATOR_EVENTS;
(function (TOOLTIP_INDICATOR_EVENTS) {
    TOOLTIP_INDICATOR_EVENTS["ACTIVE_ELEMENT"] = "tooltip_indicator_active_element";
    TOOLTIP_INDICATOR_EVENTS["ACTIVE_ELEMENT_BY_X"] = "tooltip_indicator_active_element_by_x";
})(TOOLTIP_INDICATOR_EVENTS = exports.TOOLTIP_INDICATOR_EVENTS || (exports.TOOLTIP_INDICATOR_EVENTS = {}));
/**
 * Tooltip Indicator Action 实现
 */
var TooltipIndicationAction = /** @class */ (function (_super) {
    tslib_1.__extends(TooltipIndicationAction, _super);
    function TooltipIndicationAction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.state = 'selected';
        _this.isSingle = false;
        return _this;
    }
    /** 交互语法触发点 */
    TooltipIndicationAction.prototype.active = function () {
        var element = dependents_1.InteractionUtils.getCurrentElement(this.context);
        if (element.hasState('selected')) {
            if (this.isSingle) {
                this.setStateByX(element);
            }
            else {
                this.setState(element);
            }
        }
        else {
            this.setStateByX(element);
        }
    };
    /** 单个元素的 enable */
    TooltipIndicationAction.prototype.setState = function (element) {
        var _this = this;
        view_1.forEachElement(this.getView(), function (item) {
            if (item === element) {
                if (!item.hasState(_this.state)) {
                    item.setState(_this.state, true);
                }
            }
            else {
                item.setState(_this.state, false);
            }
        });
        this.isSingle = true;
        this.getView().emit(TOOLTIP_INDICATOR_EVENTS.ACTIVE_ELEMENT, { element: element, isSingle: true });
    };
    /** 同 X 的元素的 enable */
    TooltipIndicationAction.prototype.setStateByX = function (element) {
        var _this = this;
        var xField = this.getXField();
        var xValue = element.getData()[xField];
        view_1.forEachElement(this.getView(), function (item) {
            if (item.getData()[xField] === xValue) {
                if (!item.hasState(_this.state)) {
                    item.setState(_this.state, true);
                }
            }
            else {
                item.setState(_this.state, false);
            }
        });
        this.isSingle = false;
        this.getView().emit(TOOLTIP_INDICATOR_EVENTS.ACTIVE_ELEMENT_BY_X, { element: element, isSingle: false });
    };
    /** 通过字段值来 enable */
    TooltipIndicationAction.prototype.setStateByField = function (xFieldValue, groupFieldValue) {
        var _this = this;
        var xField = this.getView().getXScale().field;
        var groupField = this.getView().getGroupScales()[0].field;
        view_1.forEachElement(this.getView(), function (element) {
            var data = element.getData();
            element.setState(_this.state, data[xField] === xFieldValue && (groupFieldValue === undefined || data[groupField] === groupFieldValue));
        });
    };
    TooltipIndicationAction.prototype.getView = function () {
        return this.context.view;
    };
    TooltipIndicationAction.prototype.getXField = function () {
        var view = this.context.view;
        return view.getXScale().field;
    };
    return TooltipIndicationAction;
}(dependents_1.InteractionAction));
exports.TooltipIndicationAction = TooltipIndicationAction;
dependents_1.registerAction('tooltip-indicator', TooltipIndicationAction);
dependents_1.registerInteraction('element-tooltip-indicator', {
    start: [
        {
            trigger: 'element:mousemove',
            action: 'tooltip-indicator:active',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'element:touchmove',
            action: 'tooltip-indicator:active',
            throttle: { wait: 50, leading: true, trailing: false },
        },
    ],
});
/**
 * 组件 Interaction 实现
 */
var TooltipIndicatorInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(TooltipIndicatorInteraction, _super);
    function TooltipIndicatorInteraction() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onElementActive = function (_a) {
            var element = _a.element, isSingle = _a.isSingle;
            var xScale = _this.view.getXScale();
            var xField = _this.view.getXScale().field;
            var groupField = _this.view.getGroupScales()[0].field;
            var data = element.getData();
            var xValue = data[xField];
            var items = _this.getLegendItems(xValue);
            _this.component.update({ items: items, title: { text: xScale.getText(xValue) } });
            _this.component.render();
            if (isSingle) {
                _this.component.selectItem(data[groupField]);
            }
            _this.curX = xValue;
        };
        _this.onSelectTooltipIndicatorItem = function (itemId) {
            if (_this.component && itemId) {
                _this.getInteractionAction().setStateByField(_this.curX, itemId);
            }
        };
        return _this;
    }
    TooltipIndicatorInteraction.getInteractionRange = function (layerRange, interaction) {
        var config = getValidTooltipIndicatorConfig(interaction);
        var _a = config.padding, paddingTop = _a[0], paddingBottom = _a[2];
        return new bbox_1.default(layerRange.minX, layerRange.minY, layerRange.width, config.height + paddingTop + paddingBottom);
    };
    TooltipIndicatorInteraction.prototype.clear = function () {
        if (this.component) {
            this.component.destroy();
        }
        if (this.container) {
            this.container.remove(true);
        }
        this.component = null;
        this.container = null;
    };
    TooltipIndicatorInteraction.prototype.render = function () {
        var _this = this;
        var view = this.view;
        var callback = function () {
            var xScale = _this.view.getXScale();
            var lastX = util_1.last(xScale.getTicks()).tickValue;
            var padding = _this.view.padding;
            if (!util_1.isEqual([0, 0, 0, 0], padding)) {
                if (_this.component) {
                    _this.updateComponent();
                }
                else {
                    _this.createComponent();
                    _this.component.on(tooltip_indicator_1.EVENTS.ON_SELECT_ITEM, _this.onSelectTooltipIndicatorItem);
                }
                // 默认选中最后的 X
                _this.curX = lastX;
                _this.component.update({
                    title: { text: xScale.getText(_this.curX) },
                });
                _this.component.render();
                _this.getInteractionAction().setStateByField(lastX);
            }
        };
        // 移除冲突/重复的组件和交互
        view.legend(false);
        view.removeInteraction('active-region');
        view.removeInteraction('tooltip');
        view.interaction('element-tooltip-indicator');
        // 监听 View， 创建/更新组件
        view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, callback);
        view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, callback);
        // 监听组件事件，更新 action
        view.on(TOOLTIP_INDICATOR_EVENTS.ACTIVE_ELEMENT, this.onElementActive);
        view.on(TOOLTIP_INDICATOR_EVENTS.ACTIVE_ELEMENT_BY_X, this.onElementActive);
    };
    TooltipIndicatorInteraction.prototype.getInteractionAction = function () {
        var interaction = this.view.interactions['element-tooltip-indicator'];
        return interaction && interaction.context.getAction('tooltip-indicator');
    };
    TooltipIndicatorInteraction.prototype.createComponent = function () {
        var padding = getValidTooltipIndicatorConfig(this.getInteractionConfig()).padding;
        var paddingTop = padding[0], paddingRight = padding[1], paddingBottom = padding[2], paddingLeft = padding[3];
        var items = this.getLegendItems();
        var range = this.getRange();
        var xScale = this.view.getXScale();
        var lastX = util_1.last(xScale.getTicks()).tickValue;
        this.container = this.canvas.addGroup();
        this.component = new tooltip_indicator_1.default({
            container: this.container,
            x: range.x + paddingLeft,
            y: range.y + paddingTop,
            width: range.width - paddingLeft - paddingRight,
            height: range.height - paddingTop - paddingBottom,
            theme: this.getViewLayer().getPlotTheme(),
            items: items,
        });
        this.component.init();
        this.getInteractionAction().setStateByField(lastX);
    };
    TooltipIndicatorInteraction.prototype.updateComponent = function () {
        var items = this.getLegendItems();
        this.component.update({
            items: items,
        });
    };
    TooltipIndicatorInteraction.prototype.getLegendItems = function (xValue) {
        var view = this.view;
        var data = view.getData();
        var defaultColor = view.getTheme().defaultColor;
        var xScale = view.getXScale();
        var yScale = view.getYScales()[0];
        var curX = xValue || util_1.last(xScale.getTicks()).tickValue;
        var groupAttrs = view.getLegendAttributes();
        var colorAttr = groupAttrs.find(function (attr) { return attr.type === 'color'; });
        var items = [];
        // 取第一个分组scale，暂不考虑多个分组情况
        var groupScale = view.getGroupScales()[0];
        var groupField = groupScale.field;
        if (groupScale && groupScale.isCategory) {
            // 只处理离散情况
            groupScale.getTicks().forEach(function (tick) {
                var name = tick.text, value = tick.tickValue;
                var color = colorAttr.mapping(value).join('') || defaultColor;
                items.push({
                    id: value,
                    title: name,
                    color: color,
                    values: [],
                });
            });
        }
        var selectedData = (data === null || data === void 0 ? void 0 : data.filter(function (datum) { return datum[xScale.field] === curX; })) || [];
        items.forEach(function (item) {
            var datum = selectedData.find(function (curDatum) { return curDatum[groupField] === item.id; });
            item.values.push({
                value: yScale.formatter ? yScale.formatter(datum[yScale.field]) : datum[yScale.field],
            });
        });
        return items;
    };
    return TooltipIndicatorInteraction;
}(base_1.default));
exports.default = TooltipIndicatorInteraction;

},{"../components/tooltip-indicator":423,"../dependents":425,"../util/bbox":672,"../util/view":715,"./base":441,"@antv/util":803,"tslib":894}],449:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.timeIntervals = void 0;
var dependents_1 = require("../dependents");
var SECOND = 1000;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = DAY * 7;
var MONTH = DAY * 30;
var YEAR = DAY * 365;
exports.timeIntervals = {
    second: { value: SECOND, format: 'HH:mm:ss' },
    miniute: { value: MINUTE, format: 'HH:mm' },
    hour: { value: HOUR, format: 'HH' },
    day: { value: DAY, format: 'YYYY-MM-DD' },
    week: { value: WEEK, format: 'YYYY-MM-DD' },
    month: { value: MONTH, format: 'YYYY-MM' },
    year: { value: YEAR, format: 'YYYY' },
};

},{"../dependents":425}],450:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var axis_1 = tslib_1.__importDefault(require("../../../util/responsive/apply/axis"));
function responsiveAxis(layer) {
    var responsiveTheme = layer.getResponsiveTheme();
    var canvas = layer.canvas;
    // x-axis
    new axis_1.default({
        plot: layer,
        responsiveTheme: responsiveTheme,
        dim: 'x',
    });
    // y-axis
    new axis_1.default({
        plot: layer,
        responsiveTheme: responsiveTheme,
        dim: 'y',
    });
    canvas.draw();
}
exports.default = responsiveAxis;

},{"../../../util/responsive/apply/axis":682,"tslib":894}],451:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var axis_1 = tslib_1.__importDefault(require("./axis"));
var preRenderResponsive = [];
var afterRenderResponsive = [{ name: 'responsiveAxis', method: axis_1.default }];
exports.default = {
    preRender: preRenderResponsive,
    afterRender: afterRenderResponsive,
};

},{"./axis":450,"tslib":894}],452:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../../../../components/label/base");
var point_auto_1 = tslib_1.__importDefault(require("../../../../components/label/point-auto"));
var view_1 = require("../../../../util/view");
var math_1 = require("../../../../util/math");
var color_1 = require("../../../../util/color");
var AreaPointAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(AreaPointAutoLabel, _super);
    function AreaPointAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AreaPointAutoLabel.prototype.layoutLabels = function (geometry, labels) {
        _super.prototype.layoutLabels.call(this, geometry, labels);
        this.adjustAreaLabelsStyle(labels);
    };
    AreaPointAutoLabel.prototype.adjustAreaLabelsStyle = function (labels) {
        var view = this.view;
        var _a = this.options, darkStyle = _a.darkStyle, lightStyle = _a.lightStyle;
        var areaGeometry = view_1.getGeometryByType(view, 'area');
        var areas = view_1.getGeometryShapes(areaGeometry).sort(function (left, right) {
            return right.getBBox().height - left.getBBox().height;
        });
        util_1.each(labels, function (label) {
            var labelBBox = label.getBBox();
            var points = math_1.getStrokePoints(labelBBox.x, labelBBox.y, labelBBox.width, labelBBox.height);
            var match = util_1.map(areas, function (area) { return ({
                area: area,
                matches: util_1.filter(points, function (point) { return !!area.isHit(point[0], point[1]); }).length,
            }); }).sort(function (left, right) { return left.matches - right.matches; });
            if (util_1.last(match).matches > 0) {
                var bgColor = util_1.last(match).area.attr('fill');
                var fillWhite = color_1.isContrastColorWhite(bgColor);
                label.attr({
                    fill: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.fill : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.fill,
                    fillOpacity: fillWhite ? lightStyle.fillOpacity : darkStyle.fillOpacity,
                    stroke: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.stroke : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.stroke,
                });
            }
        });
    };
    return AreaPointAutoLabel;
}(point_auto_1.default));
exports.default = AreaPointAutoLabel;
base_1.registerLabelComponent('area-point-auto', AreaPointAutoLabel);

},{"../../../../components/label/base":414,"../../../../components/label/point-auto":416,"../../../../util/color":673,"../../../../util/math":680,"../../../../util/view":715,"@antv/util":803,"tslib":894}],453:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../../components/label/base");
var point_1 = tslib_1.__importDefault(require("../../../../components/label/point"));
var AreaPointLabel = /** @class */ (function (_super) {
    tslib_1.__extends(AreaPointLabel, _super);
    function AreaPointLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    return AreaPointLabel;
}(point_1.default));
exports.default = AreaPointLabel;
base_1.registerLabelComponent('area-point', AreaPointLabel);

},{"../../../../components/label/base":414,"../../../../components/label/point":417,"tslib":894}],454:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    area: 'area',
    line: 'line',
    point: 'point',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],455:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Area = /** @class */ (function (_super) {
    tslib_1.__extends(Area, _super);
    function Area() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Area.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'area';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Area.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Area;
}(plot_1.default));
exports.default = Area;

},{"../../base/plot":394,"./layer":456,"@antv/util":803,"tslib":894}],456:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
require("./component/label/area-point");
require("./component/label/area-point-auto");
var scale_1 = require("../../util/scale");
var apply_responsive_1 = tslib_1.__importDefault(require("./apply-responsive"));
var EventParser = tslib_1.__importStar(require("./event"));
require("./theme");
var view_1 = require("../../util/view");
var GEOM_MAP = {
    area: 'area',
    line: 'line',
    point: 'point',
};
var AreaLayer = /** @class */ (function (_super) {
    tslib_1.__extends(AreaLayer, _super);
    function AreaLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'area';
        return _this;
    }
    AreaLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            smooth: false,
            areaStyle: {
                opacity: 0.25,
            },
            line: {
                visible: true,
                size: 2,
                style: {
                    opacity: 1,
                    lineJoin: 'round',
                    lineCap: 'round',
                },
            },
            point: {
                visible: false,
                size: 4,
                shape: 'point',
            },
            label: {
                visible: false,
                type: 'point',
            },
            legend: {
                visible: true,
                position: 'top-left',
                wordSpacing: 4,
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: true,
                crosshairs: {
                    type: 'x',
                },
                offset: 20,
            },
        });
    };
    AreaLayer.prototype.beforeInit = function () {
        _super.prototype.beforeInit.call(this);
        /** 响应式图形 */
        if (this.options.responsive && this.options.padding !== 'auto') {
            this.applyResponsive('preRender');
        }
    };
    AreaLayer.prototype.afterRender = function () {
        this.renderLabel();
        /** 响应式 */
        if (this.options.responsive && this.options.padding !== 'auto') {
            this.applyResponsive('afterRender');
        }
        _super.prototype.afterRender.call(this);
    };
    AreaLayer.prototype.geometryParser = function (dim, type) {
        return GEOM_MAP[type];
    };
    AreaLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.xField] = {
            type: 'cat',
        };
        if (util_1.has(props, 'xAxis')) {
            scale_1.extractScale(scales[props.xField], props.xAxis);
        }
        /** 配置y-scale */
        scales[props.yField] = {};
        if (util_1.has(props, 'yAxis')) {
            scale_1.extractScale(scales[props.yField], props.yAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    AreaLayer.prototype.coord = function () {
        return null;
    };
    AreaLayer.prototype.addGeometry = function () {
        var props = this.options;
        var area = factory_1.getGeom('area', 'main', {
            plot: this,
        });
        this.area = area;
        if (props.label) {
            this.label();
        }
        if (props.tooltip && (props.tooltip.fields || props.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.adjustArea(area);
        this.setConfig('geometry', area);
        this.addLine();
        this.addPoint();
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    AreaLayer.prototype.adjustArea = function (area) {
        return;
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    AreaLayer.prototype.adjustLine = function (line) {
        return;
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    AreaLayer.prototype.adjustPoint = function (point) {
        return;
    };
    AreaLayer.prototype.addLine = function () {
        var props = this.options;
        var lineConfig = util_1.deepMix({}, props.line);
        if (lineConfig.visible) {
            var line = factory_1.getGeom('line', 'guide', {
                type: 'line',
                plot: this,
                line: lineConfig,
            });
            this.adjustLine(line);
            this.setConfig('geometry', line);
            this.line = line;
        }
    };
    AreaLayer.prototype.addPoint = function () {
        var props = this.options;
        var pointConfig = util_1.deepMix({}, props.point);
        if (pointConfig.visible) {
            var point = factory_1.getGeom('point', 'guide', {
                plot: this,
            });
            this.adjustPoint(point);
            this.setConfig('geometry', point);
            this.point = point;
        }
    };
    AreaLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, yField = _a.yField;
        var scale = scales[yField];
        if (label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'area');
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'area-point', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
        }
    };
    AreaLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            // 关闭动画
            this.area.animate = false;
            if (this.line)
                this.line.animate = false;
            if (this.point)
                this.point.animate = false;
        }
    };
    AreaLayer.prototype.label = function () {
        return;
    };
    AreaLayer.prototype.geometryTooltip = function () {
        this.area.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.area.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.area.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.area.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.seriesField) {
                    this.area.tooltip.fields.push(this.options.seriesField);
                }
            }
        }
    };
    AreaLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    AreaLayer.prototype.applyResponsive = function (stage) {
        var _this = this;
        var methods = apply_responsive_1.default[stage];
        util_1.each(methods, function (r) {
            var responsive = r;
            responsive.method(_this);
        });
    };
    return AreaLayer;
}(view_layer_1.default));
exports.default = AreaLayer;
global_1.registerPlotType('area', AreaLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../geoms/factory":430,"../../util/scale":712,"../../util/view":715,"./apply-responsive":451,"./component/label/area-point":453,"./component/label/area-point-auto":452,"./event":454,"./theme":457,"@antv/util":803,"tslib":894}],457:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_AREA_THEME = void 0;
var theme_1 = require("../../theme");
var AREA_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity };
};
var AREA_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var LINE_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity };
};
var LINE_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var LINE_SELECTED_STYLE = function (style) {
    var lineWidth = style.lineWidth || 1;
    return { lineWidth: lineWidth + 2 };
};
var POINT_ACTIVE_STYLE = function (style) {
    var color = style.fill || style.fillStyle;
    var radius = style.size || style.radius;
    return {
        radius: radius + 1,
        shadowBlur: radius,
        shadowColor: color,
        stroke: color,
        strokeOpacity: 1,
        lineWidth: 1,
    };
};
var POINT_SELECTED_STYLE = function (style) {
    var color = style.fill || style.fillStyle;
    var radius = style.size || style.radius;
    return {
        radius: radius + 2,
        shadowBlur: radius,
        shadowColor: color,
        stroke: color,
        strokeOpacity: 1,
        lineWidth: 2,
    };
};
var POINT_DISABLED_STYLE = function (style) {
    var opacity = style.opacity || style.fillOpacity || 1;
    return { opacity: opacity * 0.5 };
};
exports.DEFAULT_AREA_THEME = {
    areaStyle: {
        normal: {},
        active: AREA_ACTIVE_STYLE,
        disable: AREA_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: '#333333' },
    },
    lineStyle: {
        normal: {},
        active: LINE_ACTIVE_STYLE,
        disable: LINE_DISABLE_STYLE,
        selected: LINE_SELECTED_STYLE,
    },
    pointStyle: {
        normal: {},
        active: POINT_ACTIVE_STYLE,
        disable: POINT_DISABLED_STYLE,
        selected: POINT_SELECTED_STYLE,
    },
    label: {
        darkStyle: {
            fill: '#2c3542',
            stroke: '#ffffff',
            fillOpacity: 0.85,
        },
        lightStyle: {
            fill: '#ffffff',
            fillOpacity: 1,
            stroke: '#2c3542',
        },
    },
};
theme_1.registerTheme('area', exports.DEFAULT_AREA_THEME);

},{"../../theme":669}],458:[function(require,module,exports){
arguments[4][450][0].apply(exports,arguments)
},{"../../../util/responsive/apply/axis":682,"dup":450,"tslib":894}],459:[function(require,module,exports){
arguments[4][451][0].apply(exports,arguments)
},{"./axis":458,"dup":451,"tslib":894}],460:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../../../components/label/base");
var dependents_1 = require("../../../dependents");
var label_1 = tslib_1.__importDefault(require("./label"));
var view_1 = require("../../../util/view");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var color_1 = require("../../../util/color");
/** 自动模式的 Column 数据标签，会根据图形和数据标签自动优化数据标签布局和样式等 */
var BarAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(BarAutoLabel, _super);
    function BarAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BarAutoLabel.prototype.getPosition = function (element) {
        var offset = this.getDefaultOffset();
        var value = this.getValue(element);
        var bbox = this.getElementShapeBBox(element);
        var minX = bbox.minX, maxX = bbox.maxX, minY = bbox.minY, height = bbox.height;
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY;
        var y = minY + height / 2 + offsetY;
        var dir = value < 0 ? -1 : 1;
        var root = value > 0 ? maxX : minX;
        var x = root + offset * dir + offsetX;
        // 统一先设置为 right
        return { x: x, y: y };
    };
    BarAutoLabel.prototype.getTextAlign = function (element) {
        var value = this.getValue(element);
        return value > 0 ? 'left' : 'right';
    };
    /** 默认的 fill 取自用户配置或主题配置 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BarAutoLabel.prototype.getTextFill = function (element) {
        var style = this.options.style;
        return style.fill;
    };
    /** 默认不描边 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BarAutoLabel.prototype.getTextStroke = function (element) {
        return undefined;
    };
    /** 默认无处理：在 layout 阶段处理 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    BarAutoLabel.prototype.adjustLabel = function (label, element) {
        // empty
    };
    /** 自动布局所有的数据标签 */
    BarAutoLabel.prototype.layoutLabels = function (geometry, labels) {
        if (this.shouldInShapeLabels(labels)) {
            this.inShapeLabels(geometry, labels);
        }
        this.autoHideLabels(geometry, labels);
    };
    /** 判断是否可以把数据标签放置在柱子内部 */
    BarAutoLabel.prototype.shouldInShapeLabels = function (labels) {
        var _this = this;
        return util_1.every(labels, function (label) {
            var labelBBox = label.getBBox();
            var element = label.get('element');
            var bbox = _this.getElementShapeBBox(element);
            return bbox.height >= labelBBox.height;
        });
    };
    /** 内置数据标签，并自动设置颜色描边等属性 */
    BarAutoLabel.prototype.inShapeLabels = function (geometry, labels) {
        var _this = this;
        var coordinateBBox = this.getCoordinateBBox();
        var xField = geometry.getXYFields()[0];
        var _a = this.options, darkStyle = _a.darkStyle, lightStyle = _a.lightStyle;
        var groupedLabels = util_1.groupBy(labels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; });
        util_1.each(labels, function (label) {
            var curGroup = groupedLabels[label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]] || [];
            var element = label.get('element');
            var shape = element.shape;
            var fillWhite = color_1.isContrastColorWhite(shape.attr('fill'));
            var shapeBBox = _this.getElementShapeBBox(element);
            var labelBBox = bbox_1.default.fromBBoxObject(label.getBBox());
            // 如果 Column 本身就不可见，直接隐藏对应的 label
            if (view_1.getOverlapArea(coordinateBBox, shapeBBox) <= 0) {
                label.set('visible', false);
            }
            if (labelBBox.width > shapeBBox.width) {
                // 处理放不下的情况
                var idx = util_1.findIndex(curGroup, function (item) { return item === label; });
                if (idx !== curGroup.length - 1) {
                    label.set('visible', false);
                }
            }
            else {
                // 数据标签展示在图形中央
                label.attr({
                    x: shapeBBox.x + shapeBBox.width / 2,
                    textAlign: 'center',
                });
                var overflow = labelBBox.width > shapeBBox.width || labelBBox.height > shapeBBox.height;
                if (overflow) {
                    // 出现了溢出情况，添加描边
                    label.attr({
                        stroke: lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.stroke,
                    });
                }
                else {
                    // 放置在柱形内部，颜色取反
                    label.attr({
                        fill: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.fill : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.fill,
                        fillOpacity: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.fillOpacity : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.fillOpacity,
                        stroke: undefined,
                    });
                }
            }
        });
    };
    /** 数据标签防重叠抽样 */
    BarAutoLabel.prototype.autoHideLabels = function (geometry, labels) {
        var coordinateBBox = this.getCoordinateBBox();
        var filteredLabels = this.filterLabels(labels);
        var xField = geometry.getXYFields()[0];
        var dones = [];
        var todo = [];
        var groupedLabels = util_1.groupBy(filteredLabels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; });
        var xValues = util_1.uniq(util_1.map(filteredLabels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; }));
        var xValue;
        if (util_1.size(xValues) > 0) {
            // 第一组
            xValue = xValues.shift();
            util_1.each(groupedLabels[xValue], function (label) { return todo.push(label); });
        }
        if (util_1.size(xValues) > 0) {
            // 最后一组
            xValue = xValues.pop();
            util_1.each(groupedLabels[xValue], function (label) { return todo.push(label); });
        }
        util_1.each(xValues.reverse(), function (val) {
            // 其他组
            util_1.each(groupedLabels[val], function (label) { return todo.push(label); });
        });
        while (todo.length > 0) {
            var cur = todo.shift();
            if (cur.get('visible')) {
                view_1.moveInPanel(cur, coordinateBBox);
                if (view_1.checkShapeOverlap(cur, dones)) {
                    cur.set('visible', false);
                }
                else {
                    dones.push(cur);
                }
            }
        }
    };
    /** 抽样数据标签，设置最大数量的数据标签，其他的统一隐藏 */
    BarAutoLabel.prototype.filterLabels = function (labels) {
        var MAX_CNT = 500; // 最多显示 500 个数据标签
        var filteredLabels = [];
        var pages = Math.max(Math.floor(labels.length / MAX_CNT), 1);
        util_1.each(labels, function (label, idx) {
            if (idx % pages === 0) {
                filteredLabels.push(label);
            }
            else {
                label.set('visible', false);
            }
        });
        return filteredLabels;
    };
    return BarAutoLabel;
}(label_1.default));
exports.default = BarAutoLabel;
base_1.registerLabelComponent('bar-auto', BarAutoLabel);

},{"../../../components/label/base":414,"../../../dependents":425,"../../../util/bbox":672,"../../../util/color":673,"../../../util/view":715,"./label":461,"@antv/util":803,"tslib":894}],461:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../../dependents");
var base_1 = tslib_1.__importStar(require("../../../components/label/base"));
var color_1 = require("../../../util/color");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var BarLabel = /** @class */ (function (_super) {
    tslib_1.__extends(BarLabel, _super);
    function BarLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BarLabel.prototype.getLabelItemAttrs = function (element, index) {
        var _a;
        var _b = this.options, style = _b.style, formatter = _b.formatter;
        var mappingData = [].concat(element.getModel().mappingData);
        var value = this.getValue(element);
        return util_1.deepMix({}, style, tslib_1.__assign(tslib_1.__assign({}, this.getPosition(element)), { text: formatter
                ? formatter(value, (_a = {},
                    _a[dependents_1._ORIGIN] = mappingData[0]._origin,
                    _a.mappingDatum = mappingData[0],
                    _a.mappingDatumIndex = 0,
                    _a.element = element,
                    _a.elementIndex = index,
                    _a), index)
                : value, fill: this.getTextFill(element), stroke: this.getTextStroke(element), textAlign: this.getTextAlign(element), textBaseline: this.getTextBaseline() }));
    };
    BarLabel.prototype.adjustLabel = function (label, element) {
        var _a = this.options, adjustPosition = _a.adjustPosition, style = _a.style;
        if (adjustPosition) {
            var offset = this.getDefaultOffset();
            var labelRange = label.getBBox();
            var shapeRange = this.getElementShapeBBox(element);
            if (shapeRange.width <= labelRange.width) {
                var xPosition = shapeRange.maxX + this.options.offsetX + offset;
                label.attr('x', xPosition);
                label.attr('fill', style.fill);
            }
        }
    };
    BarLabel.prototype.getDefaultOptions = function () {
        var theme = this.layer.theme;
        var _a = theme.label, label = _a === void 0 ? {} : _a;
        return tslib_1.__assign({ offsetX: 0, offsetY: 0, adjustPosition: true }, label);
    };
    BarLabel.prototype.getValue = function (element) {
        return util_1.get(element.getData(), this.layer.options.xField);
    };
    BarLabel.prototype.getPosition = function (element) {
        var offset = this.getDefaultOffset();
        var value = this.getValue(element);
        var bbox = this.getElementShapeBBox(element);
        var minX = bbox.minX, maxX = bbox.maxX, minY = bbox.minY, height = bbox.height, width = bbox.width;
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY, position = _a.position;
        var y = minY + height / 2 + offsetY;
        var dir = value < 0 ? -1 : 1;
        var x;
        if (position === 'left') {
            var root = value > 0 ? minX : maxX;
            x = root + offset * dir + offsetX;
        }
        else if (position === 'right') {
            var root = value > 0 ? maxX : minX;
            x = root + offset * dir + offsetX;
        }
        else {
            x = minX + width / 2 + offsetX;
        }
        return { x: x, y: y };
    };
    BarLabel.prototype.getTextFill = function (element) {
        var shape = element.shape;
        if (this.options.adjustColor && this.options.position !== 'right') {
            var shapeColor = shape.attr('fill');
            var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
            var rgb = color_1.rgb2arr(shapeColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
            var colorBand = [
                { from: 0, to: 85, color: 'white' },
                { from: 85, to: 170, color: '#F6F6F6' },
                { from: 170, to: 255, color: 'black' },
            ];
            var reflect = color_1.mappingColor(colorBand, gray);
            return reflect;
        }
        var defaultColor = this.options.style.fill;
        return defaultColor;
    };
    BarLabel.prototype.getTextStroke = function (element) {
        var fill = this.getTextFill(element);
        var _a = this.options, position = _a.position, adjustColor = _a.adjustColor;
        return position !== 'right' && adjustColor && fill !== 'black' ? null : undefined;
    };
    BarLabel.prototype.getTextAlign = function (element) {
        var value = this.getValue(element);
        var position = this.options.position;
        var alignOptions = {
            right: 'left',
            left: 'left',
            middle: 'center',
        };
        var alignOptionsReverse = {
            right: 'right',
            left: 'right',
            middle: 'center',
        };
        if (value < 0) {
            return alignOptionsReverse[position];
        }
        return alignOptions[position];
    };
    BarLabel.prototype.getTextBaseline = function () {
        return 'middle';
    };
    BarLabel.prototype.getElementShapeBBox = function (element) {
        var _this = this;
        var shape = element.shape;
        var points = [];
        util_1.each(shape.get('origin').points, function (p) {
            points.push(_this.coord.convertPoint(p));
        });
        var xValues = points.map(function (point) { return point.x; });
        var xValuesMin = Math.min.apply(Math, xValues);
        var xValueMax = Math.max.apply(Math, xValues);
        var yValues = points.map(function (point) { return point.y; });
        var yValuesMin = Math.min.apply(Math, yValues);
        var yValuesMax = Math.max.apply(Math, yValues);
        var bbox = new bbox_1.default(xValuesMin, yValuesMin, xValueMax - xValuesMin, yValuesMax - yValuesMin);
        return bbox;
    };
    BarLabel.prototype.getLabelOffset = function () {
        // Column 的 offset 在 getPosition 中因 position 不同单独处理
        return {
            x: 0,
            y: 0,
        };
    };
    return BarLabel;
}(base_1.default));
exports.default = BarLabel;
base_1.registerLabelComponent('bar', BarLabel);

},{"../../../components/label/base":414,"../../../dependents":425,"../../../util/bbox":672,"../../../util/color":673,"@antv/util":803,"tslib":894}],462:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    bar: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],463:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Bar = /** @class */ (function (_super) {
    tslib_1.__extends(Bar, _super);
    function Bar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Bar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'bar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Bar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Bar;
}(plot_1.default));
exports.default = Bar;

},{"../../base/plot":394,"./layer":464,"@antv/util":803,"tslib":894}],464:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../components/factory");
var conversion_tag_1 = tslib_1.__importDefault(require("../../components/conversion-tag"));
var factory_2 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
var apply_responsive_1 = tslib_1.__importDefault(require("./apply-responsive"));
require("./theme");
require("./component/label");
require("./component/label-auto");
var EventParser = tslib_1.__importStar(require("./event"));
var view_1 = require("../../util/view");
var G2_GEOM_MAP = {
    bar: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'bar',
};
var BaseBarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(BaseBarLayer, _super);
    function BaseBarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'bar';
        return _this;
    }
    BaseBarLayer.getDefaultOptions = function () {
        var cfg = {
            xAxis: {
                visible: true,
                line: {
                    visible: false,
                },
                title: {
                    visible: true,
                },
                label: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: false,
                },
                nice: true,
            },
            yAxis: {
                visible: true,
                grid: {
                    visible: false,
                },
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoRotate: false,
                    autoHide: true,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: false,
                showMarkers: false,
            },
            label: {
                visible: true,
                position: 'left',
                adjustColor: true,
            },
            legend: {
                visible: false,
                position: 'top-left',
            },
            interactions: [
                { type: 'tooltip' },
                { type: 'active-region' },
                { type: 'legend-active' },
                { type: 'legend-filter' },
            ],
            conversionTag: {
                visible: false,
            },
        };
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), cfg);
    };
    BaseBarLayer.prototype.beforeInit = function () {
        _super.prototype.beforeInit.call(this);
        var props = this.options;
        /** 响应式图形 */
        if (props.responsive && props.padding !== 'auto') {
            this.applyResponsive('preRender');
        }
    };
    BaseBarLayer.prototype.afterRender = function () {
        var props = this.options;
        this.renderLabel();
        /** 响应式 */
        if (props.responsive && props.padding !== 'auto') {
            this.applyResponsive('afterRender');
        }
        if (props.conversionTag.visible) {
            this.conversionTag = new conversion_tag_1.default(tslib_1.__assign({ view: this.view, field: props.xField, animation: props.animation === false ? false : true }, props.conversionTag));
        }
        _super.prototype.afterRender.call(this);
    };
    BaseBarLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    BaseBarLayer.prototype.processData = function (originData) {
        var inputData = originData ? originData.slice().reverse() : originData;
        var yField = this.options.yField;
        var processedData = [];
        util_1.each(inputData, function (data) {
            var d = util_1.clone(data);
            d[yField] = d[yField].toString();
            processedData.push(d);
        });
        return processedData;
    };
    BaseBarLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.yField] = {
            type: 'cat',
        };
        if (util_1.has(props, 'yAxis')) {
            scale_1.extractScale(scales[props.yField], props.yAxis);
        }
        /** 配置y-scale */
        scales[props.xField] = {};
        if (util_1.has(props, 'xAxis')) {
            scale_1.extractScale(scales[props.xField], props.xAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    BaseBarLayer.prototype.coord = function () {
        this.setConfig('coordinate', {
            actions: [['transpose']],
        });
    };
    BaseBarLayer.prototype.axis = function () {
        var xAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'x',
        });
        var yAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'y',
        });
        /** 转置坐标系特殊配置 */
        if (xAxis_parser) {
            xAxis_parser.position = 'left';
        }
        if (yAxis_parser) {
            yAxis_parser.position = 'bottom';
        }
        var axesConfig = {};
        axesConfig[this.options.xField] = xAxis_parser;
        axesConfig[this.options.yField] = yAxis_parser;
        /** 存储坐标轴配置项到config */
        this.setConfig('axes', axesConfig);
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    BaseBarLayer.prototype.adjustBar = function (bar) {
        return null;
    };
    BaseBarLayer.prototype.addGeometry = function () {
        var props = this.options;
        var bar = factory_2.getGeom('interval', 'main', {
            positionFields: [props.yField, props.xField],
            plot: this,
        });
        if (props.conversionTag.visible) {
            this.setConfig('theme', util_1.deepMix({}, this.getTheme(), {
                columnWidthRatio: 1 / 3,
            }));
        }
        this.adjustBar(bar);
        this.bar = bar;
        if (props.tooltip && (props.tooltip.fields || props.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', bar);
    };
    BaseBarLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.bar.animate = false;
        }
    };
    BaseBarLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    BaseBarLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, xField = _a.xField;
        var scale = scales[xField];
        if (label === null || label === void 0 ? void 0 : label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'interval');
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'bar', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
        }
    };
    BaseBarLayer.prototype.geometryTooltip = function () {
        this.bar.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.bar.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.bar.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.bar.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.colorField) {
                    this.bar.tooltip.fields.push(this.options.colorField);
                }
            }
        }
    };
    BaseBarLayer.prototype.applyResponsive = function (stage) {
        var _this = this;
        var methods = apply_responsive_1.default[stage];
        util_1.each(methods, function (r) {
            var responsive = r;
            responsive.method(_this);
        });
    };
    BaseBarLayer.prototype.getLabelOptionsByPosition = function (position) {
        if (position === 'middle') {
            return {
                offset: 0,
            };
        }
        if (position === 'left') {
            return {
                offset: 7,
                style: {
                    stroke: null,
                    lineWidth: 0,
                },
            };
        }
        if (position === 'right') {
            return {
                offset: 4,
            };
        }
    };
    return BaseBarLayer;
}(view_layer_1.default));
exports.default = BaseBarLayer;
global_1.registerPlotType('bar', BaseBarLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/conversion-tag":410,"../../components/factory":412,"../../geoms/factory":430,"../../util/scale":712,"../../util/view":715,"./apply-responsive":459,"./component/label":461,"./component/label-auto":460,"./event":462,"./theme":465,"@antv/util":803,"tslib":894}],465:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_BAR_THEME = void 0;
var theme_1 = require("../../theme");
var BAR_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var BAR_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
exports.DEFAULT_BAR_THEME = {
    label: {
        darkStyle: {
            fill: '#2c3542',
            stroke: '#ffffff',
            fillOpacity: 0.85,
        },
        lightStyle: {
            fill: '#ffffff',
            stroke: '#ffffff',
            fillOpacity: 1,
        },
    },
    columnStyle: {
        normal: {},
        active: BAR_ACTIVE_STYLE,
        disable: BAR_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: 'black' },
    },
};
theme_1.registerTheme('bar', exports.DEFAULT_BAR_THEME);

},{"../../theme":669}],466:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Bubble = /** @class */ (function (_super) {
    tslib_1.__extends(Bubble, _super);
    function Bubble() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Bubble.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'bubble';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Bubble.prototype.getSizeScale = function () {
        var layer = this.layers[0];
        return layer.getSizeScale();
    };
    Bubble.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Bubble;
}(plot_1.default));
exports.default = Bubble;

},{"../../base/plot":394,"./layer":467,"@antv/util":803,"tslib":894}],467:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var EventParser = tslib_1.__importStar(require("../scatter/event"));
var layer_1 = tslib_1.__importDefault(require("../scatter/layer"));
require("./shape");
require("./theme");
var BubbleLayer = /** @class */ (function (_super) {
    tslib_1.__extends(BubbleLayer, _super);
    function BubbleLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'bubble';
        return _this;
    }
    BubbleLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            // 直径 min 4px；max 64px
            pointSize: [2, 32],
            pointStyle: {
                stroke: null,
                strokeOpacity: 1,
                fillOpacity: 0.5,
            },
            label: {
                position: 'middle',
                style: {
                    stroke: '#fff',
                    lineWidth: 2,
                },
            },
            shape: 'bubble-point',
        });
    };
    BubbleLayer.prototype.getSizeScale = function () {
        var sizeField = this.options.sizeField;
        if (sizeField) {
            this.view.getScaleByField(sizeField);
        }
    };
    BubbleLayer.prototype.legend = function () {
        var _a;
        _super.prototype.legend.call(this);
        if (this.options.legend && this.options.legend.visible === false) {
            return;
        }
        this.setConfig('legends', (_a = {},
            _a[this.options.sizeField] = false,
            _a));
    };
    BubbleLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return BubbleLayer;
}(layer_1.default));
exports.default = BubbleLayer;
global_1.registerPlotType('bubble', BubbleLayer);

},{"../../base/global":392,"../scatter/event":603,"../scatter/layer":605,"./shape":468,"./theme":469,"@antv/util":803,"tslib":894}],468:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var g2_1 = require("@antv/g2");
var util_1 = require("@antv/g2/lib/geometry/shape/point/util");
g2_1.registerShape('point', 'bubble-point', {
    draw: function (cfg, container) {
        var point = util_1.drawPoints(this, cfg, container, 'circle', false);
        // 如果用户未配置 stroke，气泡图 stroke 默认用 fill 颜色
        if (!cfg.style.stroke) {
            var fill = point.attr('fill');
            point.attr('stroke', fill);
        }
        return point;
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'circle',
            style: {
                r: 4.5,
                fill: color,
            },
        };
    },
});

},{"@antv/g2":309,"@antv/g2/lib/geometry/shape/point/util":295}],469:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var POINT_ACTIVE_STYLE = function (style) {
    var stroke = style.stroke || '#000';
    var fillOpacity = style.fillOpacity || style.opacity || 0.95;
    return {
        stroke: stroke,
        fillOpacity: fillOpacity,
    };
};
var POINT_SELECTED_STYLE = function (style) {
    var stroke = style.stroke || '#000';
    var lineWidth = style.lineWidth || 2;
    return {
        stroke: stroke,
        lineWidth: lineWidth,
    };
};
var POINT_INACTIVE_STYLE = function (style) {
    var fillOpacity = style.fillOpacity || style.opacity || 0.3;
    return {
        fillOpacity: fillOpacity,
    };
};
theme_1.registerTheme('bubble', {
    pointStyle: {
        normal: {},
        active: POINT_ACTIVE_STYLE,
        selected: POINT_SELECTED_STYLE,
        inactive: POINT_INACTIVE_STYLE,
    },
});

},{"../../theme":669}],470:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var BulletRect = /** @class */ (function () {
    function BulletRect(view, cfg) {
        this.view = view;
        this.cfg = cfg;
        this._init();
    }
    /** 绘制辅助labels */
    BulletRect.prototype.draw = function () {
        if (!this.view || this.view.destroyed) {
            return;
        }
        this.container = this.view.middleGroup.addGroup();
        this.container.set('name', 'rectGroups');
        this.container.setZIndex(-100);
        var geometry = this.getGeometry();
        var shapes = util_1.map(geometry === null || geometry === void 0 ? void 0 : geometry.elements, function (element) { return element.shape; });
        for (var i = 0; i < this.cfg.ranges.length; i += 1) {
            var shapeBox = shapes[i].getBBox();
            var widthRatio = shapeBox.width / shapes[i].get('origin').data[this.cfg.yField];
            this.drawRect(shapeBox, this.cfg.ranges[i] || [0, 1], widthRatio);
        }
        this.view.canvas.draw();
    };
    BulletRect.prototype.drawRect = function (box, ranges, widthRatio) {
        var options = this.cfg;
        var rangeColors = options.rangeColors;
        var xPos = box.minX;
        var yPos = box.minY - (box.height * (options.rangeSize - 1)) / 2;
        for (var i = 1; i < ranges.length; i += 1) {
            var width = (ranges[i] - ranges[i - 1]) * options.rangeMax * widthRatio;
            this.container
                .addShape('rect', {
                name: 'bullet-rect',
                attrs: {
                    width: width,
                    height: box.height * options.rangeSize,
                    x: xPos,
                    y: yPos,
                    fill: rangeColors[(i - 1) % rangeColors.length],
                    fillOpacity: 0.25,
                },
            })
                .set('zIndex', -1);
            xPos += width;
        }
        if (options.axis && options.axis.visible) {
            var tickInterval = options.rangeMax / (options.axis.tickCount - 1);
            var rangeBox = new bbox_1.default(box.x, yPos, xPos, box.height * options.rangeSize);
            this.drawBulletTicks(rangeBox, tickInterval, widthRatio);
        }
    };
    /** 添加 ticks  */
    BulletRect.prototype.drawBulletTicks = function (box, tickInterval, widthRatio) {
        var options = this.cfg;
        var ticksStyle = options.axis.style;
        var tickCount = options.axis.tickCount;
        var tickPosition = options.axis.position;
        var tickOffset = util_1.get(ticksStyle, 'lineHeight', 0) - ticksStyle.fontSize / 2;
        for (var tickIdx = 0; tickIdx < tickCount; tickIdx += 1) {
            var x = box.minX + tickInterval * tickIdx * widthRatio;
            var tickText = "" + tickInterval * tickIdx;
            if (options.axis.formatter) {
                tickText = options.axis.formatter(tickText, tickIdx);
            }
            this.container.addShape('text', {
                name: 'tick',
                attrs: tslib_1.__assign({ x: x, y: tickPosition === 'before' ? box.minY - tickOffset : box.maxY + tickOffset, text: "" + tickText }, ticksStyle),
            });
            if (options.axis.tickLine && options.axis.tickLine.visible) {
                var tickLineCfg = options.axis.tickLine;
                if (tickIdx > 0 && tickIdx !== tickCount - 1) {
                    this.container
                        .addShape('path', {
                        attrs: tslib_1.__assign({ path: [
                                ['M', x, box.minY],
                                ['L', x, box.maxY],
                            ] }, tickLineCfg),
                    })
                        .set('zIndex', -1);
                }
            }
        }
    };
    BulletRect.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    BulletRect.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
    };
    BulletRect.prototype._init = function () {
        var _this = this;
        this.view.on('beforerender', function () {
            _this.clear();
        });
        this.view.on('afterrender', function () {
            _this.draw();
        });
    };
    BulletRect.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geometry) { return geometry.type === 'interval'; });
    };
    return BulletRect;
}());
exports.default = BulletRect;

},{"../../../util/bbox":672,"@antv/util":803,"tslib":894}],471:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var BulletTarget = /** @class */ (function () {
    function BulletTarget(view, cfg) {
        this.view = view;
        this.cfg = cfg;
        this._init();
    }
    /** 绘制辅助labels */
    BulletTarget.prototype.draw = function () {
        if (!this.view || this.view.destroyed) {
            return;
        }
        this.container = this.view.foregroundGroup.addGroup();
        this.container.set('name', 'targetGroups');
        var shapes = util_1.map(this.getGeometry().elements, function (element) { return element.shape; });
        for (var i = 0; i < this.cfg.targets.length; i += 1) {
            var shapeBox = shapes[i].getBBox();
            var widthRatio = shapeBox.width / shapes[i].get('origin').data[this.cfg.yField];
            this.drawTarget(shapeBox, this.cfg.targets[i], widthRatio);
        }
        this.view.canvas.draw();
    };
    BulletTarget.prototype.drawTarget = function (box, targets, widthRatio) {
        var _this = this;
        var options = this.cfg;
        var colors = options.markerColors;
        /** 添加目标值 */
        targets.forEach(function (target, i) {
            var markerStyle = options.markerStyle;
            _this.container.addShape('rect', {
                name: 'bullet-target',
                attrs: tslib_1.__assign(tslib_1.__assign({ width: markerStyle.width, height: box.height * options.markerSize - markerStyle.width / 2, x: box.minX + target * widthRatio, y: box.minY - (box.height * (options.markerSize - 1)) / 2 }, markerStyle), { fill: colors[i % colors.length] || markerStyle.fill }),
            });
        });
    };
    BulletTarget.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    BulletTarget.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
    };
    BulletTarget.prototype._init = function () {
        var _this = this;
        this.view.on('beforerender', function () {
            _this.clear();
        });
        this.view.on('afterrender', function () {
            _this.draw();
        });
    };
    BulletTarget.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geometry) { return geometry.type === 'interval'; });
    };
    return BulletTarget;
}());
exports.default = BulletTarget;

},{"@antv/util":803,"tslib":894}],472:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    bullet: 'interval',
    bulletTarget: 'bullet-target',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],473:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Bullet = /** @class */ (function (_super) {
    tslib_1.__extends(Bullet, _super);
    function Bullet() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Bullet.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'bullet';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Bullet.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Bullet;
}(plot_1.default));
exports.default = Bullet;

},{"../../base/plot":394,"./layer":474,"@antv/util":803,"tslib":894}],474:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Y_FIELD = exports.X_FIELD = exports.STACK_FIELD = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var EventParser = tslib_1.__importStar(require("./event"));
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var scale_1 = require("../../util/scale");
var factory_1 = require("../../components/factory");
var factory_2 = require("../../geoms/factory");
var global_1 = require("../../base/global");
var bulletRect_1 = tslib_1.__importDefault(require("./component/bulletRect"));
var bulletTarget_1 = tslib_1.__importDefault(require("./component/bulletTarget"));
require("./theme");
var G2_GEOM_MAP = {
    bullet: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'bullet',
};
exports.STACK_FIELD = '$$stackField$$';
exports.X_FIELD = '$$xField$$';
exports.Y_FIELD = '$$yField$$';
var BulletLayer = /** @class */ (function (_super) {
    tslib_1.__extends(BulletLayer, _super);
    function BulletLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'bullet';
        return _this;
    }
    BulletLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            data: [],
            stackField: exports.STACK_FIELD,
            xField: exports.X_FIELD,
            yField: exports.Y_FIELD,
            rangeColors: ['rgba(91, 143, 249, 0.45)'],
            measureSize: 12,
            rangeSize: 2,
            markerSize: 2,
            markerColors: [],
            markerStyle: {
                width: 2,
                fill: '#5B8FF9',
                lineWidth: 0,
            },
            axis: {
                visible: false,
                position: 'before',
                tickCount: 6,
                formatter: function (text, idx) { return "" + idx; },
                style: {
                    fill: 'rgba(0, 0, 0, 0.25)',
                    textBaseline: 'middle',
                    textAlign: 'center',
                    fontSize: 12,
                    lineHeight: 16,
                },
                tickLine: {
                    visible: true,
                    lineWidth: 1,
                    stroke: '#FFF',
                    lineDash: [4, 2],
                },
            },
            xAxis: {
                visible: true,
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                },
            },
            yAxis: {
                visible: false,
                nice: false,
            },
            tooltip: {
                visible: false,
                trigger: 'item',
                crosshairs: false,
            },
            label: {
                visible: true,
                offset: 4,
                style: {
                    fill: 'rgba(0, 0, 0, 0.45)',
                    stroke: '#fff',
                    lineWidth: 1,
                },
            },
        });
    };
    BulletLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        this.view.removeInteraction('legend-filter');
    };
    BulletLayer.prototype.scale = function () {
        var options = this.options;
        var scales = {};
        /** 配置y-scale */
        scales[options.yField] = {};
        if (util_1.has(options, 'yAxis')) {
            scale_1.extractScale(scales[options.yField], options.yAxis);
        }
        /** 配置x-scale */
        scales[options.xField] = {
            type: 'cat',
        };
        if (util_1.has(options, 'xAxis')) {
            scale_1.extractScale(scales[options.xField], options.xAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    BulletLayer.prototype.getOptions = function (props) {
        var options = _super.prototype.getOptions.call(this, props);
        this.adjustOptions(options);
        return options;
    };
    BulletLayer.prototype.afterInit = function () {
        _super.prototype.afterInit.call(this);
        var options = this.options;
        var ranges = options.data.map(function (d) { return d.ranges; });
        var targets = options.data.map(function (d) { return d.targets; });
        this.bulletRect = new bulletRect_1.default(this.view, {
            ranges: ranges,
            rangeMax: options.rangeMax,
            yField: options.yField,
            rangeSize: options.rangeSize,
            rangeColors: options.rangeColors || [],
            axis: options.axis,
        });
        this.bulletTarget = new bulletTarget_1.default(this.view, {
            targets: targets,
            yField: options.yField,
            markerSize: options.markerSize,
            markerColors: options.markerColors || [],
            markerStyle: options.markerStyle,
        });
    };
    BulletLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    BulletLayer.prototype.coord = function () {
        this.setConfig('coordinate', {
            actions: [['transpose']],
        });
    };
    /** 自定义子弹图图例 */
    BulletLayer.prototype.legend = function () {
        var options = this.options;
        var markerColor = options.markerStyle.fill;
        var measureColors = options.measureColors || this.theme.colors;
        var items = [
            {
                name: '实际进度',
                value: '实际进度',
                marker: {
                    symbol: 'square',
                    style: {
                        fill: measureColors[0],
                    },
                },
            },
            {
                name: '目标值',
                value: '目标值',
                marker: {
                    symbol: 'line',
                    style: {
                        stroke: markerColor,
                        lineWidth: 2,
                    },
                },
            },
        ];
        var legendOptions = tslib_1.__assign({ custom: true, position: 'bottom', items: items }, options.legend);
        // @ts-ignore
        this.setConfig('legends', legendOptions);
    };
    BulletLayer.prototype.addGeometry = function () {
        var options = this.options;
        var bullet = factory_2.getGeom('interval', 'main', {
            positionFields: [options.xField, options.yField],
            plot: this,
        });
        bullet.adjust = [
            {
                type: 'stack',
            },
        ];
        if (options.label) {
            bullet.label = this.extractLabel();
        }
        this.bullet = bullet;
        this.setConfig('geometry', bullet);
    };
    BulletLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    BulletLayer.prototype.extractLabel = function () {
        var options = this.options;
        var label = util_1.deepMix({}, options.label);
        if (label.visible === false) {
            return false;
        }
        var labelConfig = factory_1.getComponent('label', tslib_1.__assign({ plot: this, labelType: 'barLabel', fields: [options.yField] }, label));
        return labelConfig;
    };
    BulletLayer.prototype.adjustOptions = function (options) {
        options.barSize = options.measureSize || 12;
        this.adjustYAxisOptions(options);
    };
    BulletLayer.prototype.adjustYAxisOptions = function (options) {
        var values = [];
        options.data.forEach(function (d) { return values.push(d.measures.reduce(function (a, b) { return a + b; }, 0)); });
        values.push(options.rangeMax);
        options.yAxis.max = Math.max.apply([], values);
    };
    BulletLayer.prototype.processData = function (dataOptions) {
        var options = this.options;
        var data = [];
        dataOptions.forEach(function (dataItem, dataIdx) {
            var _a;
            for (var valueIdx = 0; valueIdx < dataItem.measures.length; valueIdx += 1) {
                var value = dataItem.measures[valueIdx];
                var xField = dataItem.title || "" + dataIdx;
                data.push((_a = {},
                    _a[options.xField] = xField,
                    _a[options.yField] = value,
                    _a[options.stackField] = "" + valueIdx,
                    _a));
            }
        });
        return data;
    };
    return BulletLayer;
}(view_layer_1.default));
exports.default = BulletLayer;
global_1.registerPlotType('bullet', BulletLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../geoms/factory":430,"../../util/scale":712,"./component/bulletRect":470,"./component/bulletTarget":471,"./event":472,"./theme":475,"@antv/util":803,"tslib":894}],475:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var BULLET_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5, lineWidth: 0 };
};
var BULLET_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
theme_1.registerTheme('bullet', {
    columnStyle: {
        normal: {},
        active: BULLET_ACTIVE_STYLE,
        disable: BULLET_DISABLE_STYLE,
        selected: {},
    },
});

},{"../../theme":669}],476:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WEEKS = exports.MONTHS = exports.FORMATTER = exports.IS_MONTH_CENTER_FIELD = exports.DATE_FIELD = exports.WEEK_FIELD = exports.DAY_FIELD = void 0;
/**
 * 当前一周中的第几天（周日 = 0）
 */
exports.DAY_FIELD = '$$day$$';
/**
 * 当前是一年中的第几周
 */
exports.WEEK_FIELD = '$$week$$';
/**
 * 日期字段，Date 类型
 */
exports.DATE_FIELD = '$$date$$';
/**
 * 数据处理阶段，标记这周是否是当月中间
 */
exports.IS_MONTH_CENTER_FIELD = '$$is_month_center$$';
/**
 * 格式化日期
 */
exports.FORMATTER = 'YYYY-MM-DD';
/**
 * 月份枚举
 */
exports.MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
/**
 * 周枚举
 */
exports.WEEKS = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];

},{}],477:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    rect: 'polygon',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],478:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
// 注册日历图的自定义 shape
require("./shape");
/**
 * 日历图
 */
var Calendar = /** @class */ (function (_super) {
    tslib_1.__extends(Calendar, _super);
    function Calendar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 复写父类方法
     * @param props
     */
    Calendar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'calendar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Calendar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Calendar;
}(plot_1.default));
exports.default = Calendar;

},{"../../base/plot":394,"./layer":479,"./shape":480,"@antv/util":803,"tslib":894}],479:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var fecha_1 = tslib_1.__importDefault(require("fecha"));
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var constant_1 = require("./constant");
var util_2 = require("./util");
var global_1 = require("../../base/global");
var date_1 = require("../../util/date");
var factory_1 = require("../../components/factory");
var EventParser = tslib_1.__importStar(require("./event"));
/**
 * 日历图
 */
var CalendarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(CalendarLayer, _super);
    function CalendarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'calendar';
        return _this;
    }
    CalendarLayer.getDefaultOptions = function () {
        var _a;
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                line: {
                    visible: false,
                },
                grid: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoRotate: false,
                    autoHide: false,
                },
            },
            yAxis: {
                line: {
                    visible: false,
                },
                grid: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoRotate: false,
                    autoHide: false,
                },
            },
            legend: { visible: false },
            meta: (_a = {},
                _a[constant_1.DAY_FIELD] = {
                    type: 'cat',
                    alias: 'Day',
                    values: [0, 1, 2, 3, 4, 5, 6],
                },
                _a[constant_1.WEEK_FIELD] = {
                    type: 'cat',
                    alias: 'Month',
                },
                _a),
            tooltip: {
                visible: true,
                showTitle: true,
                showCrosshairs: false,
                showMarkers: false,
                title: 'date',
            },
        });
    };
    /**
     * 复写父类的数据处理类，主要完成：
     * 1. 生成 polygon 的 x y field（虚拟的，无需用户传入）
     *
     * @param data
     */
    CalendarLayer.prototype.processData = function (data) {
        var dateField = this.options.dateField;
        var dateRange = this.options.dateRange;
        // 给与默认值是当前这一年
        if (util_1.isNil(dateRange)) {
            var dates = util_1.map(data, function (datum) { return fecha_1.default.parse("" + datum[dateField], constant_1.FORMATTER); });
            dateRange = date_1.getDateRange(dates);
        }
        return util_2.generateCalendarData(data, dateRange, dateField);
    };
    CalendarLayer.prototype.addGeometry = function () {
        var _a = this.options, valueField = _a.valueField, colors = _a.colors, tooltip = _a.tooltip;
        var polygonConfig = {
            type: 'polygon',
            position: {
                fields: [constant_1.WEEK_FIELD, constant_1.DAY_FIELD],
            },
            shape: {
                values: ['calendar-polygon'],
            },
            color: {
                fields: [valueField],
                values: colors,
            },
            label: this.extractLabel(),
        };
        if (tooltip && (tooltip.fields || tooltip.formatter)) {
            this.geometryTooltip(polygonConfig);
        }
        this.setConfig('geometry', polygonConfig);
    };
    CalendarLayer.prototype.geometryTooltip = function (geomConfig) {
        geomConfig.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            geomConfig.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            geomConfig.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                geomConfig.tooltip.fields = [constant_1.WEEK_FIELD, constant_1.DAY_FIELD];
            }
        }
    };
    CalendarLayer.prototype.extractLabel = function () {
        var props = this.options;
        var label = props.label;
        if (label && label.visible === false) {
            return false;
        }
        var valueField = this.options.valueField;
        return factory_1.getComponent('label', tslib_1.__assign({ plot: this, fields: [valueField], position: 'top', offset: 0 }, label));
    };
    /**
     * 写入坐标系配置，默认增加镜像
     */
    CalendarLayer.prototype.coord = function () {
        // 默认做镜像处理
        var coordinateConfig = {
            type: 'rect',
            cfg: {},
            actions: [['reflect', 'y']],
        };
        this.setConfig('coordinate', coordinateConfig);
    };
    /**
     * 无需 geometry parser，直接使用 polygon 即可
     */
    CalendarLayer.prototype.geometryParser = function () {
        return '';
    };
    CalendarLayer.prototype.axis = function () {
        var xAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'x',
        });
        var yAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'y',
        });
        var axesConfig = {};
        axesConfig[constant_1.WEEK_FIELD] = xAxis_parser;
        axesConfig[constant_1.DAY_FIELD] = yAxis_parser;
        /** 存储坐标轴配置项到config */
        this.setConfig('axes', axesConfig);
    };
    CalendarLayer.prototype.scale = function () {
        _super.prototype.scale.call(this);
        var monthWeek = util_2.getMonthCenterWeek(this.options.dateRange);
        // 拿出 scale 二次加工，主要是配置 x y 中的标题显示
        var scales = this.config.scales;
        var _a = this.options, _b = _a.weeks, weeks = _b === void 0 ? constant_1.WEEKS : _b, _c = _a.months, months = _c === void 0 ? constant_1.MONTHS : _c;
        var x = scales[constant_1.WEEK_FIELD];
        var y = scales[constant_1.DAY_FIELD];
        // 1. 设置 formatter
        x.formatter = function (v) {
            var m = monthWeek[v];
            return m !== undefined ? months[m] : '';
        };
        y.formatter = function (v) { return weeks[v] || ''; };
        // 2. 设置 alias
        var _d = this.options, xAxis = _d.xAxis, yAxis = _d.yAxis;
        x.alias = util_1.get(xAxis, ['title', 'text'], x.alias);
        y.alias = util_1.get(yAxis, ['title', 'text'], y.alias);
        this.setConfig('scales', scales);
    };
    CalendarLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return CalendarLayer;
}(view_layer_1.default));
exports.default = CalendarLayer;
// 注册到池子中
global_1.registerPlotType('calendar', CalendarLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../util/date":676,"./constant":476,"./event":477,"./util":481,"@antv/util":803,"fecha":881,"tslib":894}],480:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var g2_1 = require("@antv/g2");
var constant_1 = require("./constant");
var date_1 = require("../../util/date");
/**
 * 注册自定义日历图的 shape
 * code from https://g2.antv.vision/zh/examples/heatmap/heatmap#calendar-horizontal
 */
g2_1.registerShape('polygon', 'calendar-polygon', {
    draw: function (cfg, container) {
        if (!util_1.isEmpty(cfg.points)) {
            var points = cfg.points;
            // rect path
            var path = [
                ['M', points[0].x, points[0].y],
                ['L', points[1].x, points[1].y],
                ['L', points[2].x, points[2].y],
                ['L', points[3].x, points[3].y],
                ['Z'],
            ];
            path = this.parsePath(path);
            var attrs = tslib_1.__assign(tslib_1.__assign({ stroke: '#fff', lineWidth: 1, fill: cfg.color }, cfg.style), { path: path });
            var polygon = container.addShape('path', {
                attrs: attrs,
            });
            var date = cfg.data[constant_1.DATE_FIELD];
            if (date_1.isLastWeekOfMonth(date)) {
                var linePath = [
                    ['M', points[2].x, points[2].y],
                    ['L', points[3].x, points[3].y],
                ];
                // 最后一周的多边形添加右侧边框
                container.addShape('path', {
                    zIndex: 1,
                    attrs: {
                        path: this.parsePath(linePath),
                        lineWidth: 1,
                        stroke: '#404040',
                    },
                });
                if (date_1.isLastDayOfMonth(date)) {
                    container.addShape('path', {
                        zIndex: 1,
                        attrs: {
                            path: this.parsePath([
                                ['M', points[1].x, points[1].y],
                                ['L', points[2].x, points[2].y],
                            ]),
                            lineWidth: 1,
                            stroke: '#404040',
                        },
                    });
                }
            }
            container.sort();
            return polygon;
        }
    },
});

},{"../../util/date":676,"./constant":476,"@antv/g2":309,"@antv/util":803,"tslib":894}],481:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMonthCenterWeek = exports.generateCalendarData = void 0;
var tslib_1 = require("tslib");
var fecha_1 = tslib_1.__importDefault(require("fecha"));
var util_1 = require("@antv/util");
var constant_1 = require("./constant");
var date_1 = require("../../util/date");
/**
 * 解析日期
 * @param dateRange
 */
function parseDateRange(dateRange) {
    var _a;
    var from = dateRange[0], to = dateRange[1];
    var fromDate = fecha_1.default.parse(from, constant_1.FORMATTER);
    var toDate = fecha_1.default.parse(to, constant_1.FORMATTER);
    // 交换顺序
    if (fromDate > toDate) {
        _a = [fromDate, toDate], toDate = _a[0], fromDate = _a[1];
    }
    return [fromDate, toDate];
}
/**
 * 根据 range 补齐日历图的数据
 * @param data 传入数据
 * @param dateRange 日期区间
 * @param dateField 日期字段
 */
function generateCalendarData(data, dateRange, dateField) {
    var all = [];
    var _a = parseDateRange(dateRange), fromDate = _a[0], toDate = _a[1];
    // copy 一份
    var curr = new Date(fromDate);
    var _loop_1 = function () {
        var _a;
        var dateString = fecha_1.default.format(curr, constant_1.FORMATTER);
        // 找到对应的数据
        var datum = util_1.find(data, function (datum) { return datum[dateField] === dateString; });
        all.push(tslib_1.__assign((_a = {}, _a[constant_1.DAY_FIELD] = date_1.getDay(curr), _a[constant_1.WEEK_FIELD] = "" + date_1.getWeek(curr), _a[dateField] = dateString, _a[constant_1.DATE_FIELD] = new Date(curr), _a), datum));
        // 向前移动一天
        date_1.advanceBy(curr, date_1.DAY_MS);
    };
    while (curr <= toDate) {
        _loop_1();
    }
    return all;
}
exports.generateCalendarData = generateCalendarData;
/**
 * 计算每个月的中间周。
 */
function getMonthCenterWeek(dateRange) {
    var _a = parseDateRange(dateRange), fromDate = _a[0], toDate = _a[1];
    var monthWeekMap = new Map();
    function append(current) {
        var month = current.getMonth(); // 从 0 开始
        var week = date_1.getWeek(current);
        if (!monthWeekMap.has(month)) {
            monthWeekMap.set(month, []);
        }
        monthWeekMap.get(month).push(week);
    }
    // copy 一份
    var curr = new Date(fromDate);
    while (curr <= toDate) {
        // 设置到 map 中
        append(curr);
        // 向前移动 7 天（一周）
        date_1.advanceBy(curr, date_1.DAY_MS * 7);
    }
    // 增加最后一个日期的计算
    if (toDate < curr) {
        append(toDate);
    }
    // 处理数据，返回结果
    var result = {}; // week -> month
    monthWeekMap.forEach(function (v, k) {
        var w = Math.ceil((util_1.head(v) + util_1.last(v)) / 2); // 取平均值
        result[w] = k;
    });
    return result;
}
exports.getMonthCenterWeek = getMonthCenterWeek;

},{"../../util/date":676,"./constant":476,"@antv/util":803,"fecha":881,"tslib":894}],482:[function(require,module,exports){
arguments[4][450][0].apply(exports,arguments)
},{"../../../util/responsive/apply/axis":682,"dup":450,"tslib":894}],483:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var axis_1 = tslib_1.__importDefault(require("./axis"));
var label_1 = tslib_1.__importDefault(require("./label"));
var preRenderResponsive = [];
var afterRenderResponsive = [
    { name: 'responsiveAxis', method: axis_1.default },
    { name: 'responsiveLabel', method: label_1.default },
];
exports.default = {
    preRender: preRenderResponsive,
    afterRender: afterRenderResponsive,
};

},{"./axis":482,"./label":484,"tslib":894}],484:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var label_1 = tslib_1.__importDefault(require("../../../util/responsive/apply/label"));
var ApplyResponsiveColumnLabel = /** @class */ (function (_super) {
    tslib_1.__extends(ApplyResponsiveColumnLabel, _super);
    function ApplyResponsiveColumnLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ApplyResponsiveColumnLabel.prototype.getType = function () {
        return util_1.get(this.plot.options, ['label', 'position'], 'inner');
    };
    return ApplyResponsiveColumnLabel;
}(label_1.default));
function responsivePointLabel(layer) {
    var responsiveTheme = layer.getResponsiveTheme();
    new ApplyResponsiveColumnLabel({
        plot: layer,
        responsiveTheme: responsiveTheme,
    });
}
exports.default = responsivePointLabel;

},{"../../../util/responsive/apply/label":684,"@antv/util":803,"tslib":894}],485:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../../util/responsive/theme");
/** 组装theme */
var columnTheme = {
    label: {
        top: {
            constraints: [{ name: 'elementCollision' }],
            rules: {
                elementCollision: [
                    { name: 'nodeJitterUpward' },
                    {
                        name: 'nodesResamplingByState',
                        option: {
                            keep: ['min', 'max', 'median'],
                        },
                    },
                    {
                        name: 'textHide',
                    },
                ],
            },
        },
    },
};
theme_1.registerResponsiveTheme('column', columnTheme);

},{"../../../util/responsive/theme":711}],486:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../../../components/label/base");
var dependents_1 = require("../../../dependents");
var label_1 = tslib_1.__importDefault(require("./label"));
var view_1 = require("../../../util/view");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var color_1 = require("../../../util/color");
/** 自动模式的 Column 数据标签，会根据图形和数据标签自动优化数据标签布局和样式等 */
var ColumnAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(ColumnAutoLabel, _super);
    function ColumnAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ColumnAutoLabel.prototype.getPosition = function (element) {
        var offset = this.getDefaultOffset();
        var value = this.getValue(element);
        var bbox = this.getElementShapeBBox(element);
        var minX = bbox.minX, minY = bbox.minY, maxY = bbox.maxY, width = bbox.width;
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY;
        var x = minX + width / 2 + offsetX;
        var dir = value > 0 ? -1 : 1;
        var root = value > 0 ? minY : maxY;
        var y = root + offset * dir + offsetY;
        // 默认全部先设置为 top
        return { x: x, y: y };
    };
    /** 默认的 fill 取自用户配置或主题配置 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    ColumnAutoLabel.prototype.getTextFill = function (element) {
        var style = this.options.style;
        return style.fill;
    };
    /** 默认不描边 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    ColumnAutoLabel.prototype.getTextStroke = function (element) {
        return undefined;
    };
    /** 默认无处理：在 layout 阶段处理 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    ColumnAutoLabel.prototype.adjustLabel = function (label, element) {
        // empty
    };
    /** 自动布局所有的数据标签 */
    ColumnAutoLabel.prototype.layoutLabels = function (geometry, labels) {
        if (this.shouldInShapeLabels(labels)) {
            this.inShapeLabels(geometry, labels);
        }
        this.autoHideLabels(geometry, labels);
    };
    /** 判断是否可以把数据标签放置在柱子内部 */
    ColumnAutoLabel.prototype.shouldInShapeLabels = function (labels) {
        var _this = this;
        return util_1.every(labels, function (label) {
            var labelBBox = label.getBBox();
            var element = label.get('element');
            var bbox = _this.getElementShapeBBox(element);
            return bbox.width >= labelBBox.width;
        });
    };
    /** 内置数据标签，并自动设置颜色描边等属性 */
    ColumnAutoLabel.prototype.inShapeLabels = function (geometry, labels) {
        var _this = this;
        var coordinateBBox = this.getCoordinateBBox();
        var xField = geometry.getXYFields()[0];
        var _a = this.options, darkStyle = _a.darkStyle, lightStyle = _a.lightStyle;
        var groupedLabels = util_1.groupBy(labels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; });
        util_1.each(labels, function (label) {
            var curGroup = groupedLabels[label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]] || [];
            var element = label.get('element');
            var shape = element.shape;
            var fillWhite = color_1.isContrastColorWhite(shape.attr('fill'));
            var shapeBBox = _this.getElementShapeBBox(element);
            var labelBBox = bbox_1.default.fromBBoxObject(label.getBBox());
            // 如果 Column 本身就不可见，直接隐藏对应的 label
            if (view_1.getOverlapArea(coordinateBBox, shapeBBox) <= 0) {
                label.set('visible', false);
            }
            if (labelBBox.height > shapeBBox.height) {
                // 处理放不下的情况
                var idx = util_1.findIndex(curGroup, function (item) { return item === label; });
                if (idx !== 0) {
                    label.set('visible', false);
                }
            }
            else {
                // 数据标签展示在图形中央
                label.attr({
                    y: shapeBBox.y + shapeBBox.height / 2,
                    textBaseline: 'middle',
                });
                var overflow = labelBBox.width > shapeBBox.width || labelBBox.height > shapeBBox.height;
                if (overflow) {
                    // 出现了溢出情况，添加描边
                    label.attr({
                        stroke: lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.stroke,
                    });
                }
                else {
                    // 放置在柱形内部，颜色取反
                    label.attr({
                        fill: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.fill : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.fill,
                        fillOpacity: fillWhite ? lightStyle === null || lightStyle === void 0 ? void 0 : lightStyle.fillOpacity : darkStyle === null || darkStyle === void 0 ? void 0 : darkStyle.fillOpacity,
                        stroke: undefined,
                    });
                }
            }
        });
    };
    /** 数据标签防重叠抽样 */
    ColumnAutoLabel.prototype.autoHideLabels = function (geometry, labels) {
        var coordinateBBox = this.getCoordinateBBox();
        var filteredLabels = this.filterLabels(labels);
        var xField = geometry.getXYFields()[0];
        var dones = [];
        var todo = [];
        var groupedLabels = util_1.groupBy(filteredLabels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; });
        var xValues = util_1.uniq(util_1.map(filteredLabels, function (label) { return label.get(dependents_1.ORIGIN)[dependents_1.FIELD_ORIGIN][xField]; }));
        var xValue;
        if (util_1.size(xValues) > 0) {
            // 第一组
            xValue = xValues.shift();
            util_1.each(groupedLabels[xValue], function (label) { return todo.push(label); });
        }
        if (util_1.size(xValues) > 0) {
            // 最后一组
            xValue = xValues.pop();
            util_1.each(groupedLabels[xValue], function (label) { return todo.push(label); });
        }
        util_1.each(xValues.reverse(), function (val) {
            // 其他组
            util_1.each(groupedLabels[val], function (label) { return todo.push(label); });
        });
        while (todo.length > 0) {
            var cur = todo.shift();
            if (cur.get('visible')) {
                view_1.moveInPanel(cur, coordinateBBox);
                if (view_1.checkShapeOverlap(cur, dones)) {
                    cur.set('visible', false);
                }
                else {
                    dones.push(cur);
                }
            }
        }
    };
    /** 抽样数据标签，设置最大数量的数据标签，其他的统一隐藏 */
    ColumnAutoLabel.prototype.filterLabels = function (labels) {
        var MAX_CNT = 500; // 最多显示 500 个数据标签
        var filteredLabels = [];
        var pages = Math.max(Math.floor(labels.length / MAX_CNT), 1);
        util_1.each(labels, function (label, idx) {
            if (idx % pages === 0) {
                filteredLabels.push(label);
            }
            else {
                label.set('visible', false);
            }
        });
        return filteredLabels;
    };
    return ColumnAutoLabel;
}(label_1.default));
exports.default = ColumnAutoLabel;
base_1.registerLabelComponent('column-auto', ColumnAutoLabel);

},{"../../../components/label/base":414,"../../../dependents":425,"../../../util/bbox":672,"../../../util/color":673,"../../../util/view":715,"./label":487,"@antv/util":803,"tslib":894}],487:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../../dependents");
var base_1 = tslib_1.__importStar(require("../../../components/label/base"));
var color_1 = require("../../../util/color");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var ColumnLabel = /** @class */ (function (_super) {
    tslib_1.__extends(ColumnLabel, _super);
    function ColumnLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ColumnLabel.prototype.getLabelItemAttrs = function (element, index) {
        var _a;
        var _b;
        var _c = this.options, style = _c.style, formatter = _c.formatter;
        var mappingData = [].concat(element.getModel().mappingData);
        var value = this.getValue(element);
        return util_1.deepMix({}, style, tslib_1.__assign(tslib_1.__assign({}, this.getPosition(element)), { text: formatter
                ? formatter(value, (_a = {},
                    _a[dependents_1._ORIGIN] = (_b = mappingData[0]) === null || _b === void 0 ? void 0 : _b._origin,
                    _a.mappingDatum = mappingData[0],
                    _a.mappingDatumIndex = 0,
                    _a.element = element,
                    _a.elementIndex = index,
                    _a), index)
                : value, fill: this.getTextFill(element), stroke: this.getTextStroke(element), textAlign: this.getTextAlign(), textBaseline: this.getTextBaseLine() }));
    };
    ColumnLabel.prototype.getDefaultOptions = function () {
        var theme = this.layer.theme;
        var _a = theme.label, label = _a === void 0 ? {} : _a;
        return tslib_1.__assign({ offsetX: 0, offsetY: 0, adjustPosition: true }, label);
    };
    ColumnLabel.prototype.adjustLabel = function (label, element) {
        var adjustPosition = this.options.adjustPosition;
        if (adjustPosition) {
            var offset = this.getDefaultOffset();
            var labelRange = label.getBBox();
            var shapeRange = this.getElementShapeBBox(element);
            if (shapeRange.height <= labelRange.height) {
                var yPosition = shapeRange.minY + this.options.offsetY - offset;
                label.attr('y', yPosition);
                label.attr('textBaseline', 'bottom');
                label.attr('fill', this.options.style.fill);
            }
        }
    };
    ColumnLabel.prototype.getValue = function (element) {
        return util_1.get(element.getData(), this.layer.options.yField);
    };
    ColumnLabel.prototype.getPosition = function (element) {
        var offset = this.getDefaultOffset();
        var value = this.getValue(element);
        var bbox = this.getElementShapeBBox(element);
        var minX = bbox.minX, minY = bbox.minY, maxY = bbox.maxY, height = bbox.height, width = bbox.width;
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY, position = _a.position;
        var x = minX + width / 2 + offsetX;
        var dir = value > 0 ? -1 : 1;
        var y;
        if (position === 'top') {
            var root = value > 0 ? minY : maxY;
            y = root + offset * dir + offsetY;
        }
        else if (position === 'bottom') {
            var root = value > 0 ? maxY : minY;
            y = root + offset * dir + offsetY;
        }
        else {
            y = minY + height / 2 + offsetY;
        }
        return { x: x, y: y };
    };
    ColumnLabel.prototype.getTextFill = function (element) {
        var shape = element.shape;
        if (this.options.adjustColor && this.options.position !== 'top') {
            var shapeColor = shape.attr('fill');
            var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
            var rgb = color_1.rgb2arr(shapeColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
            var colorBand = [
                { from: 0, to: 85, color: 'white' },
                { from: 85, to: 170, color: '#F6F6F6' },
                { from: 170, to: 255, color: 'black' },
            ];
            var reflect = color_1.mappingColor(colorBand, gray);
            return reflect;
        }
        var defaultColor = this.options.style.fill;
        return defaultColor;
    };
    ColumnLabel.prototype.getTextStroke = function (element) {
        var fill = this.getTextFill(element);
        var _a = this.options, position = _a.position, adjustColor = _a.adjustColor;
        return position !== 'top' && adjustColor && fill !== 'black' ? null : undefined;
    };
    ColumnLabel.prototype.getElementShapeBBox = function (element) {
        var _this = this;
        var shape = element.shape;
        var points = [];
        util_1.each(shape.get('origin').points, function (p) {
            points.push(_this.coord.convertPoint(p));
        });
        var xValues = points.map(function (point) { return point.x; });
        var xValuesMin = Math.min.apply(Math, xValues);
        var xValueMax = Math.max.apply(Math, xValues);
        var yValues = points.map(function (point) { return point.y; });
        var yValuesMin = Math.min.apply(Math, yValues);
        var yValuesMax = Math.max.apply(Math, yValues);
        var bbox = new bbox_1.default(xValuesMin, yValuesMin, xValueMax - xValuesMin, yValuesMax - yValuesMin);
        return bbox;
    };
    ColumnLabel.prototype.getTextAlign = function () {
        return 'center';
    };
    ColumnLabel.prototype.getTextBaseLine = function () {
        return 'middle';
    };
    ColumnLabel.prototype.getLabelOffset = function () {
        // Column 的 offset 在 getPosition 中因 position 不同单独处理
        return {
            x: 0,
            y: 0,
        };
    };
    return ColumnLabel;
}(base_1.default));
exports.default = ColumnLabel;
base_1.registerLabelComponent('column', ColumnLabel);

},{"../../../components/label/base":414,"../../../dependents":425,"../../../util/bbox":672,"../../../util/color":673,"@antv/util":803,"tslib":894}],488:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    column: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],489:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Column = /** @class */ (function (_super) {
    tslib_1.__extends(Column, _super);
    function Column() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Column.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'column';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Column.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Column;
}(plot_1.default));
exports.default = Column;

},{"../../base/plot":394,"./layer":490,"@antv/util":803,"tslib":894}],490:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
var conversion_tag_1 = tslib_1.__importDefault(require("../../components/conversion-tag"));
var scale_1 = require("../../util/scale");
var apply_responsive_1 = tslib_1.__importDefault(require("./apply-responsive"));
require("./apply-responsive/theme");
require("./component/label");
require("./component/label-auto");
var EventParser = tslib_1.__importStar(require("./event"));
require("./theme");
var view_1 = require("../../util/view");
var G2_GEOM_MAP = {
    column: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'column',
};
var BaseColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(BaseColumnLayer, _super);
    function BaseColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'column';
        return _this;
    }
    BaseColumnLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                tickLine: {
                    visible: false,
                },
                title: {
                    visible: true,
                },
            },
            yAxis: {
                nice: true,
                title: {
                    visible: true,
                },
                label: {
                    visible: true,
                },
                grid: {
                    visible: true,
                },
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: false,
                showMarkers: false,
            },
            label: {
                visible: false,
                position: 'top',
                adjustColor: true,
            },
            legend: {
                visible: true,
                position: 'top-left',
            },
            interactions: [
                { type: 'tooltip' },
                { type: 'active-region' },
                { type: 'legend-active' },
                { type: 'legend-filter' },
            ],
            conversionTag: {
                visible: false,
            },
        });
    };
    BaseColumnLayer.prototype.beforeInit = function () {
        _super.prototype.beforeInit.call(this);
        /** 响应式图形 */
        if (this.options.responsive && this.options.padding !== 'auto') {
            this.applyResponsive('preRender');
        }
    };
    BaseColumnLayer.prototype.afterRender = function () {
        var props = this.options;
        this.renderLabel();
        /** 响应式 */
        if (this.options.responsive && this.options.padding !== 'auto') {
            this.applyResponsive('afterRender');
        }
        if (props.conversionTag.visible) {
            this.conversionTag = new conversion_tag_1.default(tslib_1.__assign({ view: this.view, field: props.yField, transpose: true, animation: props.animation === false ? false : true }, props.conversionTag));
        }
        _super.prototype.afterRender.call(this);
    };
    BaseColumnLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    BaseColumnLayer.prototype.processData = function (originData) {
        var xField = this.options.xField;
        var processedData = [];
        util_1.each(originData, function (data) {
            var d = util_1.clone(data);
            d[xField] = d[xField].toString();
            processedData.push(d);
        });
        return processedData;
    };
    BaseColumnLayer.prototype.scale = function () {
        var options = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[options.xField] = { type: 'cat' };
        if (util_1.has(options, 'xAxis')) {
            scale_1.extractScale(scales[options.xField], options.xAxis);
        }
        /** 配置y-scale */
        scales[options.yField] = {};
        if (util_1.has(options, 'yAxis')) {
            scale_1.extractScale(scales[options.yField], options.yAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    BaseColumnLayer.prototype.coord = function () {
        return;
    };
    //eslint-disable-next-line @typescript-eslint/no-unused-vars
    BaseColumnLayer.prototype.adjustColumn = function (column) {
        return;
    };
    BaseColumnLayer.prototype.addGeometry = function () {
        var options = this.options;
        var column = factory_1.getGeom('interval', 'main', {
            positionFields: [options.xField, options.yField],
            plot: this,
        });
        if (options.conversionTag.visible) {
            this.setConfig('theme', util_1.deepMix({}, this.getTheme(), {
                columnWidthRatio: 1 / 3,
            }));
        }
        this.adjustColumn(column);
        this.column = column;
        if (options.tooltip && (options.tooltip.fields || options.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', column);
    };
    BaseColumnLayer.prototype.geometryTooltip = function () {
        this.column.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.column.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.column.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.column.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.colorField) {
                    this.column.tooltip.fields.push(this.options.colorField);
                }
            }
        }
    };
    BaseColumnLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        if (this.options.animation === false) {
            /** 关闭动画 */
            this.column.animate = false;
        }
    };
    BaseColumnLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    BaseColumnLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, yField = _a.yField;
        var scale = scales[yField];
        if (label === null || label === void 0 ? void 0 : label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'interval');
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'column', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
        }
    };
    BaseColumnLayer.prototype.applyResponsive = function (stage) {
        var _this = this;
        var methods = apply_responsive_1.default[stage];
        util_1.each(methods, function (r) {
            var responsive = r;
            responsive.method(_this);
        });
    };
    return BaseColumnLayer;
}(view_layer_1.default));
exports.default = BaseColumnLayer;
global_1.registerPlotType('column', BaseColumnLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/conversion-tag":410,"../../geoms/factory":430,"../../util/scale":712,"../../util/view":715,"./apply-responsive":483,"./apply-responsive/theme":485,"./component/label":487,"./component/label-auto":486,"./event":488,"./theme":491,"@antv/util":803,"tslib":894}],491:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_COLUMN_THEME = void 0;
var theme_1 = require("../../theme");
var COLUMN_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var COLUMN_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5, fillOpacity: opacity * 0.5 };
};
exports.DEFAULT_COLUMN_THEME = {
    label: {
        darkStyle: {
            fill: '#2c3542',
            stroke: '#ffffff',
            fillOpacity: 0.85,
        },
        lightStyle: {
            fill: '#ffffff',
            stroke: '#ffffff',
            fillOpacity: 1,
        },
    },
    columnStyle: {
        normal: {},
        active: COLUMN_ACTIVE_STYLE,
        disable: COLUMN_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: 'black' },
    },
};
theme_1.registerTheme('column', exports.DEFAULT_COLUMN_THEME);

},{"../../theme":669}],492:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../grouped-bar/layer"));
var GroupBar = /** @class */ (function (_super) {
    tslib_1.__extends(GroupBar, _super);
    function GroupBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedBar';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "GroupedBar" instead of "GroupBar" which was not recommended.');
    };
    GroupBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupBar;
}(plot_1.default));
exports.default = GroupBar;

},{"../../../base/plot":394,"../../grouped-bar/layer":529,"@antv/util":803,"tslib":894,"warning":895}],493:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../grouped-column/layer"));
var GroupColumn = /** @class */ (function (_super) {
    tslib_1.__extends(GroupColumn, _super);
    function GroupColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedColumn';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "GroupedColumn" instead of "GroupColumn" which was not recommended.');
    };
    GroupColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupColumn;
}(plot_1.default));
exports.default = GroupColumn;

},{"../../../base/plot":394,"../../grouped-column/layer":532,"@antv/util":803,"tslib":894,"warning":895}],494:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// 兼容 0.x的图表类型
var ring_1 = require("./ring");
Object.defineProperty(exports, "Ring", { enumerable: true, get: function () { return ring_1.default; } });
var group_column_1 = require("./group-column");
Object.defineProperty(exports, "GroupColumn", { enumerable: true, get: function () { return group_column_1.default; } });
var group_bar_1 = require("./group-bar");
Object.defineProperty(exports, "GroupBar", { enumerable: true, get: function () { return group_bar_1.default; } });
var percentage_stack_area_1 = require("./percentage-stack-area");
Object.defineProperty(exports, "PercentageStackArea", { enumerable: true, get: function () { return percentage_stack_area_1.default; } });
var percentage_stack_bar_1 = require("./percentage-stack-bar");
Object.defineProperty(exports, "PercentageStackBar", { enumerable: true, get: function () { return percentage_stack_bar_1.default; } });
var percentage_stack_column_1 = require("./percentage-stack-column");
Object.defineProperty(exports, "PercentageStackColumn", { enumerable: true, get: function () { return percentage_stack_column_1.default; } });
var stack_area_1 = require("./stack-area");
Object.defineProperty(exports, "StackArea", { enumerable: true, get: function () { return stack_area_1.default; } });
var stack_bar_1 = require("./stack-bar");
Object.defineProperty(exports, "StackBar", { enumerable: true, get: function () { return stack_bar_1.default; } });
var stack_column_1 = require("./stack-column");
Object.defineProperty(exports, "StackColumn", { enumerable: true, get: function () { return stack_column_1.default; } });

},{"./group-bar":492,"./group-column":493,"./percentage-stack-area":495,"./percentage-stack-bar":496,"./percentage-stack-column":497,"./ring":498,"./stack-area":499,"./stack-bar":500,"./stack-column":501}],495:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../percent-stacked-area/layer"));
var PercentageStackArea = /** @class */ (function (_super) {
    tslib_1.__extends(PercentageStackArea, _super);
    function PercentageStackArea() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentageStackArea.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedArea';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "PercentStackedArea" instead of "PercentageStackArea" which was not recommended.');
    };
    PercentageStackArea.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentageStackArea;
}(plot_1.default));
exports.default = PercentageStackArea;

},{"../../../base/plot":394,"../../percent-stacked-area/layer":570,"@antv/util":803,"tslib":894,"warning":895}],496:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../percent-stacked-bar/layer"));
var PercentageStackBar = /** @class */ (function (_super) {
    tslib_1.__extends(PercentageStackBar, _super);
    function PercentageStackBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentageStackBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedBar';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "PercentStackedBar" instead of "PercentageStackBar" which was not recommended.');
    };
    PercentageStackBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentageStackBar;
}(plot_1.default));
exports.default = PercentageStackBar;

},{"../../../base/plot":394,"../../percent-stacked-bar/layer":572,"@antv/util":803,"tslib":894,"warning":895}],497:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../percent-stacked-column/layer"));
var PercentageStackColumn = /** @class */ (function (_super) {
    tslib_1.__extends(PercentageStackColumn, _super);
    function PercentageStackColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentageStackColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedColumn';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "PercentStackedColumn" instead of "PercentageStackColumn" which was not recommended.');
    };
    PercentageStackColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentageStackColumn;
}(plot_1.default));
exports.default = PercentageStackColumn;

},{"../../../base/plot":394,"../../percent-stacked-column/layer":574,"@antv/util":803,"tslib":894,"warning":895}],498:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../donut/layer"));
var Ring = /** @class */ (function (_super) {
    tslib_1.__extends(Ring, _super);
    function Ring() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Ring.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'donut';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "Donut" instead of "Ring" which was not recommended.');
    };
    Ring.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Ring;
}(plot_1.default));
exports.default = Ring;

},{"../../../base/plot":394,"../../donut/layer":514,"@antv/util":803,"tslib":894,"warning":895}],499:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../stacked-area/layer"));
var StackArea = /** @class */ (function (_super) {
    tslib_1.__extends(StackArea, _super);
    function StackArea() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackArea.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedArea';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "StackedArea" instead of "StackArea" which was not recommended.');
    };
    StackArea.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackArea;
}(plot_1.default));
exports.default = StackArea;

},{"../../../base/plot":394,"../../stacked-area/layer":613,"@antv/util":803,"tslib":894,"warning":895}],500:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../stacked-bar/layer"));
var StackBar = /** @class */ (function (_super) {
    tslib_1.__extends(StackBar, _super);
    function StackBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedBar';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "StackedBar" instead of "StackBar" which was not recommended.');
    };
    StackBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackBar;
}(plot_1.default));
exports.default = StackBar;

},{"../../../base/plot":394,"../../stacked-bar/layer":618,"@antv/util":803,"tslib":894,"warning":895}],501:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../../base/plot"));
var warning_1 = tslib_1.__importDefault(require("warning"));
var layer_1 = tslib_1.__importDefault(require("../../stacked-column/layer"));
var StackColumn = /** @class */ (function (_super) {
    tslib_1.__extends(StackColumn, _super);
    function StackColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedColumn';
        _super.prototype.createLayers.call(this, layerProps);
        warning_1.default(false, 'Please use "StackedColumn" instead of "StackColumn" which was not recommended.');
    };
    StackColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackColumn;
}(plot_1.default));
exports.default = StackColumn;

},{"../../../base/plot":394,"../../stacked-column/layer":623,"@antv/util":803,"tslib":894,"warning":895}],502:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
var HeatmapBackground = /** @class */ (function (_super) {
    tslib_1.__extends(HeatmapBackground, _super);
    function HeatmapBackground(cfg) {
        var _this = _super.call(this) || this;
        _this.options = cfg;
        _this.view = _this.options.view;
        _this.init();
        return _this;
    }
    HeatmapBackground.prototype.init = function () {
        var coord = this.getCoordinate();
        this.width = coord.getWidth();
        this.height = coord.getHeight();
        this.x = coord.start.x;
        this.y = coord.end.y;
        this.container = this.view.backgroundGroup.addGroup({});
    };
    HeatmapBackground.prototype.render = function () {
        if (this.options.type === 'color') {
            this.renderColorBackground();
        }
        else if (this.options.type === 'image') {
            this.renderImageBackground();
        }
        else if (this.options.callback) {
            var callbackCfg = {
                x: this.x,
                y: this.y,
                width: this.width,
                height: this.height,
                container: this.container,
            };
            this.options.callback(callbackCfg);
        }
    };
    HeatmapBackground.prototype.renderColorBackground = function () {
        this.container.addShape('rect', {
            attrs: {
                x: this.x,
                y: this.y,
                width: this.width,
                height: this.height,
                fill: this.options.value,
            },
            name: 'heatmap-background',
        });
    };
    HeatmapBackground.prototype.renderImageBackground = function () {
        this.container.addShape('image', {
            attrs: {
                x: this.x,
                y: this.y,
                width: this.width,
                height: this.height,
                img: this.options.src,
            },
            name: 'heatmap-background',
        });
    };
    HeatmapBackground.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
            this.emit('background:clear');
        }
    };
    HeatmapBackground.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
            // 使用callback定制的html background需要自己监听销毁事件自行销毁
            this.emit('background:destroy');
        }
    };
    HeatmapBackground.prototype.getCoordinate = function () {
        var coordinate;
        util_1.each(this.view.geometries, function (geom) {
            if (geom.type === 'heatmap') {
                coordinate = geom.coordinate;
            }
        });
        return coordinate;
    };
    return HeatmapBackground;
}(event_emitter_1.default));
exports.default = HeatmapBackground;

},{"@antv/event-emitter":94,"@antv/util":803,"tslib":894}],503:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlotComponents = void 0;
var tslib_1 = require("tslib");
var background_1 = tslib_1.__importDefault(require("./background"));
var legend_1 = tslib_1.__importDefault(require("./legend"));
var ComponentsInfo = {
    background: { Ctr: background_1.default },
    legend: { Ctr: legend_1.default, padding: 'outer' },
};
function getPlotComponents(plot, type, cfg) {
    if (plot.options[type] && plot.options[type].visible) {
        var componentInfo = ComponentsInfo[type];
        var component = new componentInfo.Ctr(cfg);
        if (componentInfo.padding) {
            plot.paddingController.registerPadding(component, componentInfo.padding);
        }
        return component;
    }
}
exports.getPlotComponents = getPlotComponents;

},{"./background":502,"./legend":504,"tslib":894}],504:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var LABEL_MARGIN = 4;
var ACTIVE_OPACITY = 1;
var DEACTIVE_OPACITY = 0.1;
var HeatmapLegend = /** @class */ (function () {
    function HeatmapLegend(cfg) {
        this.destroyed = false;
        this.dataSlides = {};
        var defaultOptions = this.getDefaultOptions();
        if (cfg.plot.options.theme && cfg.plot.options.theme === 'dark') {
            defaultOptions = this.getDarkOptions();
        }
        this.options = util_1.deepMix({}, defaultOptions, cfg);
        this.view = this.options.view;
        this.afterRender = true;
        this.init();
    }
    HeatmapLegend.prototype.init = function () {
        this.layout = this.getLayout();
        this.width = this.options.width ? this.options.width : this.getDefaultWidth();
        this.height = this.options.height ? this.options.height : this.getDefaultHeight();
        var plotContainer = this.options.plot.container;
        this.container = plotContainer.addGroup();
    };
    HeatmapLegend.prototype.render = function () {
        var scales = this.getScales();
        var colorField = this.options.plot.options.colorField;
        this.colorScale = scales[colorField];
        var _a = this.colorScale, min = _a.min, max = _a.max;
        var color = this.options.plot.options.color;
        if (this.layout === 'horizontal') {
            this.renderHorizontal(min, max, color);
        }
        else {
            this.renderVertical(min, max, color);
        }
        this.legendLayout();
        this.addInteraction();
        this.options.plot.canvas.draw();
    };
    HeatmapLegend.prototype.hide = function () {
        this.container.set('visible', false);
        this.options.plot.canvas.draw();
    };
    HeatmapLegend.prototype.show = function () {
        this.container.set('visible', true);
        this.options.plot.canvas.draw();
    };
    HeatmapLegend.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    HeatmapLegend.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    HeatmapLegend.prototype.getBBox = function () {
        var origin_bbox = this.container.getBBox();
        return new bbox_1.default(this.x, this.y, origin_bbox.width, origin_bbox.height);
    };
    HeatmapLegend.prototype.renderVertical = function (min, max, colors) {
        var _this = this;
        var gridWidth = this.width;
        var gridHeight = this.height / colors.length;
        var gridLineContainer = this.container.addGroup();
        var gridColors = util_1.clone(colors).reverse();
        var valueStep = (max - min) / colors.length;
        // 绘制色彩格子
        util_1.each(gridColors, function (c, i) {
            var y = gridHeight * i;
            // 记录每个grid代表的区间信息用于legend交互
            var appendInfo = { to: max - valueStep * i, from: max - valueStep * (i + 1) };
            var rect = _this.container.addShape('rect', {
                attrs: {
                    x: 0,
                    y: y,
                    width: gridWidth,
                    height: gridHeight,
                    fill: c,
                    opacity: ACTIVE_OPACITY,
                    cursor: 'pointer',
                },
                name: 'legend',
            });
            rect.set('info', appendInfo);
            var dataSlide = _this.getDataSlide(appendInfo);
            _this.dataSlides[appendInfo.from + "-" + appendInfo.to] = { mode: 'active', data: dataSlide };
            gridLineContainer.addShape('path', {
                attrs: tslib_1.__assign({ path: [
                        ['M', 0, y + gridHeight],
                        ['L', gridWidth, y + gridHeight],
                    ] }, _this.options.gridlineStyle),
            });
        });
        // 绘制两边的label
        this.container.addShape('text', {
            attrs: tslib_1.__assign({ text: max, x: gridWidth / 2, y: -LABEL_MARGIN, textAlign: 'center', textBaseline: 'bottom' }, this.options.text.style),
            name: 'legend-label',
        });
        this.container.addShape('text', {
            attrs: tslib_1.__assign(tslib_1.__assign({ text: min, x: gridWidth / 2, y: this.height + LABEL_MARGIN, textAlign: 'center', textBaseline: 'top' }, this.options.text.style), { name: 'legend-label' }),
        });
        // 绘制包围线
        gridLineContainer.addShape('path', {
            attrs: tslib_1.__assign({ path: [
                    ['M', 0, 0],
                    ['L', this.width, 0],
                    ['L', this.width, this.height],
                    ['L', 0, this.height],
                    ['L', 0, 0],
                ] }, this.options.gridlineStyle),
        });
    };
    HeatmapLegend.prototype.renderHorizontal = function (min, max, colors) {
        var _this = this;
        var gridWidth = this.width / colors.length;
        var gridHeight = this.height;
        var gridLineContainer = this.container.addGroup();
        var valueStep = (max - min) / colors.length;
        // 绘制色彩格子
        util_1.each(colors, function (c, i) {
            var x = gridWidth * i;
            // 记录每个grid代表的区间信息用于legend交互
            var appendInfo = { from: valueStep * i, to: valueStep * (i + 1) };
            var rect = _this.container.addShape('rect', {
                attrs: {
                    x: x,
                    y: 0,
                    width: gridWidth,
                    height: gridHeight,
                    fill: c,
                    opacity: 0.8,
                    cursor: 'pointer',
                },
                name: 'legend',
            });
            rect.set('info', appendInfo);
            gridLineContainer.addShape('path', {
                attrs: tslib_1.__assign({ path: [
                        ['M', x + gridWidth, 0],
                        ['L', x + gridWidth, gridHeight],
                    ] }, _this.options.gridlineStyle),
            });
        });
        // 绘制两边的label
        this.container.addShape('text', {
            attrs: tslib_1.__assign(tslib_1.__assign({ text: min, x: -LABEL_MARGIN, y: gridHeight / 2 }, this.options.text.style), { textAlign: 'right', textBaseline: 'middle' }),
            name: 'legend-label',
        });
        this.container.addShape('text', {
            attrs: tslib_1.__assign({ text: max, x: this.width + LABEL_MARGIN, y: gridHeight / 2, textAlign: 'left', textBaseline: 'middle' }, this.options.text.style),
            name: 'legend-label',
        });
        // 绘制包围线
        gridLineContainer.addShape('path', {
            attrs: tslib_1.__assign({ path: [
                    ['M', 0, 0],
                    ['L', this.width, 0],
                    ['L', this.width, this.height],
                    ['L', 0, this.height],
                    ['L', 0, 0],
                ] }, this.options.gridlineStyle),
        });
    };
    HeatmapLegend.prototype.getLayout = function () {
        var positions = this.options.position.split('-');
        this.position = positions[0];
        if (positions[0] === 'left' || positions[0] === 'right') {
            return 'vertical';
        }
        return 'horizontal';
    };
    HeatmapLegend.prototype.getDefaultWidth = function () {
        if (this.layout === 'horizontal') {
            var width = this.options.plot.options.width;
            return width * 0.5;
        }
        return 10;
    };
    HeatmapLegend.prototype.getDefaultHeight = function () {
        if (this.layout === 'vertical') {
            var height = this.options.plot.options.height;
            return height * 0.5;
        }
        return 10;
    };
    HeatmapLegend.prototype.legendLayout = function () {
        var _this = this;
        var bleeding = this.options.plot.getPlotTheme().bleeding;
        if (util_1.isArray(bleeding)) {
            util_1.each(bleeding, function (it, index) {
                if (typeof bleeding[index] === 'function') {
                    bleeding[index] = bleeding[index](_this.options.plot.options);
                }
            });
        }
        var bbox = this.container.getBBox();
        var x = 0;
        var y = 0;
        var positions = this.options.position.split('-');
        var plotWidth = this.options.plot.width;
        var plotHeight = this.options.plot.height;
        // 先确定x
        if (positions[0] === 'left') {
            x = bleeding[3];
        }
        else if (positions[0] === 'right') {
            x = plotWidth - bleeding[1] - bbox.width;
        }
        else if (positions[1] === 'center') {
            x = (plotWidth - bbox.width) / 2;
        }
        else if (positions[1] === 'left') {
            x = bleeding[3];
        }
        else if (positions[1] === 'right') {
            x = this.options.plot.width - bleeding[1] - bbox.width;
        }
        // 再确定y
        if (positions[0] === 'bottom') {
            y = plotHeight - bleeding[2] - bbox.height;
        }
        else if (positions[0] === 'top') {
            y = this.getTopPosition(bleeding);
        }
        else if (positions[1] === 'center') {
            y = (plotHeight - bbox.height) / 2;
        }
        else if (positions[1] === 'top') {
            y = bleeding[0];
        }
        else if (positions[1] === 'bottom') {
            y = plotHeight - bleeding[2] - bbox.height;
        }
        this.x = x;
        this.y = y;
        this.container.translate(x, y);
    };
    HeatmapLegend.prototype.getDefaultOptions = function () {
        return {
            text: {
                style: {
                    fontSize: 12,
                    fill: 'rgba(0, 0, 0, 0.45)',
                },
            },
            gridlineStyle: {
                lineWidth: 1,
                stroke: 'rgba(0, 0, 0, 0.45)',
            },
        };
    };
    HeatmapLegend.prototype.getDarkOptions = function () {
        return {
            text: {
                style: {
                    fontSize: 12,
                    fill: 'rgba(255, 255, 255, 0.45)',
                },
            },
            gridlineStyle: {
                lineWidth: 1,
                stroke: 'rgba(255, 255, 255, 0.25)',
            },
        };
    };
    HeatmapLegend.prototype.addInteraction = function () {
        var _this = this;
        var colorField = this.options.plot.options.colorField;
        this.container.on('click', function (ev) {
            var target = ev.target;
            if (target.get('name') === 'legend') {
                var appendInfo = target.get('info');
                var targetInfo = appendInfo.from + "-" + appendInfo.to;
                var relativeData = _this.dataSlides[targetInfo];
                if (relativeData.mode === 'active') {
                    relativeData.mode = 'deactive';
                    target.stopAnimate();
                    target.animate({
                        opacity: DEACTIVE_OPACITY,
                    }, 200);
                }
                else {
                    relativeData.mode = 'active';
                    target.stopAnimate();
                    target.animate({
                        opacity: ACTIVE_OPACITY,
                    }, 200);
                }
                var filteredData = _this.getFilteredData();
                if (filteredData.length > 0) {
                    _this.view.changeData(filteredData);
                    //this.view.set('data', filteredData);
                    _this.view.scale(colorField, {
                        min: _this.colorScale.min,
                        max: _this.colorScale.max,
                        nice: _this.colorScale.nice,
                    });
                    _this.view.render();
                }
            }
        });
    };
    HeatmapLegend.prototype.getFilteredData = function () {
        var filteredData = [];
        util_1.each(this.dataSlides, function (s) {
            if (s.mode == 'active') {
                filteredData.push.apply(filteredData, s.data);
            }
        });
        return filteredData;
    };
    //预先对数据进行分组
    HeatmapLegend.prototype.getDataSlide = function (range) {
        var slide = [];
        var _a = this.options.plot.options, colorField = _a.colorField, data = _a.data;
        util_1.each(data, function (d) {
            var value = d[colorField];
            if (value >= range.from && value < range.to) {
                slide.push(d);
            }
        });
        return slide;
    };
    HeatmapLegend.prototype.getTopPosition = function (bleeding) {
        if (this.options.plot.description) {
            var bbox = this.options.plot.description.getBBox();
            return bbox.maxY + 10;
        }
        else if (this.options.plot.title) {
            var bbox = this.options.plot.title.getBBox();
            return bbox.maxY + 10;
        }
        return bleeding[0];
    };
    HeatmapLegend.prototype.getScales = function () {
        var scales;
        util_1.each(this.view.geometries, function (geom) {
            if (geom.type === 'heatmap') {
                scales = geom.scales;
            }
        });
        return scales;
    };
    return HeatmapLegend;
}());
exports.default = HeatmapLegend;

},{"../../../util/bbox":672,"@antv/util":803,"tslib":894}],505:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    heatmap: 'heatmap',
    legendLabel: 'legend-label',
    heatmapBackground: 'heatmap-background',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],506:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var DensityHeatmap = /** @class */ (function (_super) {
    tslib_1.__extends(DensityHeatmap, _super);
    function DensityHeatmap() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DensityHeatmap.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'densityHeatmap';
        _super.prototype.createLayers.call(this, layerProps);
    };
    DensityHeatmap.getDefaultOptions = layer_1.default.getDefaultOptions;
    return DensityHeatmap;
}(plot_1.default));
exports.default = DensityHeatmap;

},{"../../base/plot":394,"./layer":507,"@antv/util":803,"tslib":894}],507:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../components/factory");
var factory_2 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
require("../../geoms/heatmap/linear");
var components_1 = require("./components");
var EventParser = tslib_1.__importStar(require("./event"));
var DensityHeatmapLayer = /** @class */ (function (_super) {
    tslib_1.__extends(DensityHeatmapLayer, _super);
    function DensityHeatmapLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'densityHeatmap';
        _this.plotComponents = [];
        return _this;
    }
    DensityHeatmapLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                autoRotateTitle: false,
                grid: {
                    visible: false,
                },
                line: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: true,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
            yAxis: {
                visible: true,
                autoRotateTitle: true,
                grid: {
                    visible: false,
                },
                line: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: false,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
            tooltip: {
                visible: true,
                showCrosshairs: true,
                crosshairs: {
                    type: 'xy',
                    line: {
                        style: {
                            stroke: '#000000',
                            lineWidth: 1,
                            opacity: 0.5,
                        },
                    },
                },
                showMarkers: false,
            },
            legend: {
                visible: true,
                position: 'bottom-center',
            },
            color: [
                'rgba(33,102,172,0)',
                'rgb(103,169,207)',
                'rgb(209,229,240)',
                'rgb(253,219,199)',
                'rgb(239,138,98)',
                'rgb(178,24,43)',
            ],
            interactions: [{ type: 'tooltip' }],
        });
    };
    DensityHeatmapLayer.prototype.afterRender = function () {
        this.renderPlotComponents();
        _super.prototype.afterRender.call(this);
    };
    DensityHeatmapLayer.prototype.destroy = function () {
        util_1.each(this.plotComponents, function (component) {
            component.destroy();
        });
        _super.prototype.destroy.call(this);
    };
    DensityHeatmapLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.xField] = {};
        if (util_1.has(props, 'xAxis')) {
            scale_1.extractScale(scales[props.xField], props.xAxis);
        }
        /** 配置y-scale */
        scales[props.yField] = {};
        if (util_1.has(props, 'yAxis')) {
            scale_1.extractScale(scales[props.yField], props.yAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    DensityHeatmapLayer.prototype.coord = function () {
        return;
    };
    DensityHeatmapLayer.prototype.geometryParser = function () {
        return 'heatmap';
    };
    DensityHeatmapLayer.prototype.addGeometry = function () {
        if (this.options.data.length > 1) {
            var config = {
                type: 'linearheatmap',
                position: {
                    fields: [this.options.xField, this.options.yField],
                },
                color: {
                    fields: [this.options.colorField],
                    values: this.options.color,
                },
                cfg: {
                    intensity: this.options.intensity,
                    radius: this.options.radius,
                },
            };
            if (this.options.radius) {
                config.radius = this.options.radius;
            }
            if (this.options.intensity) {
                config.intensity = this.options.intensity;
            }
            if (this.options.tooltip && (this.options.tooltip.fields || this.options.tooltip.formatter)) {
                this.geometryTooltip(config);
            }
            this.setConfig('geometry', config);
            this.addPoint();
        }
    };
    DensityHeatmapLayer.prototype.addPoint = function () {
        var props = this.options;
        var defaultConfig = { visible: false, size: 0 };
        if (props.point && props.point.visible) {
            props.point = util_1.deepMix(defaultConfig, props.point);
        }
        else {
            props.point = defaultConfig;
        }
        var point = factory_2.getGeom('point', 'guide', {
            plot: this,
        });
        point.active = false;
        // point.label = this.extractLabel();
        this.setConfig('geometry', point);
    };
    DensityHeatmapLayer.prototype.extractLabel = function () {
        var props = this.options;
        var label = props.label;
        if (label && label.visible === false) {
            return false;
        }
        var labelConfig = factory_1.getComponent('label', tslib_1.__assign({ plot: this, labelType: 'scatterLabel', fields: [props.xField, props.yField], position: 'middle', offset: 0 }, label));
        return labelConfig;
    };
    DensityHeatmapLayer.prototype.legend = function () {
        this.setConfig('legends', false);
    };
    DensityHeatmapLayer.prototype.geometryTooltip = function (config) {
        config.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            config.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            config.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                config.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.colorField) {
                    config.tooltip.fields.push(this.options.colorField);
                }
            }
        }
    };
    DensityHeatmapLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    DensityHeatmapLayer.prototype.renderPlotComponents = function () {
        var _this = this;
        util_1.each(this.plotComponents, function (component) {
            component.destroy();
        });
        var componentsType = ['legend', 'background'];
        util_1.each(componentsType, function (t) {
            var cfg = tslib_1.__assign({ view: _this.view, plot: _this }, _this.options[t]);
            var component = components_1.getPlotComponents(_this, t, cfg);
            if (component) {
                component.render();
                _this.plotComponents.push(component);
            }
        });
    };
    return DensityHeatmapLayer;
}(view_layer_1.default));
exports.default = DensityHeatmapLayer;
global_1.registerPlotType('densityHeatmap', DensityHeatmapLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../geoms/factory":430,"../../geoms/heatmap/linear":431,"../../util/scale":712,"./components":503,"./event":505,"@antv/util":803,"tslib":894}],508:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Density = /** @class */ (function (_super) {
    tslib_1.__extends(Density, _super);
    function Density() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Density.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'density';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Density.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Density;
}(plot_1.default));
exports.default = Density;

},{"../../base/plot":394,"./layer":509,"@antv/util":803,"tslib":894}],509:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var scale_1 = require("@antv/scale");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var math_1 = require("../../util/math");
var layer_1 = tslib_1.__importDefault(require("../area/layer"));
var kernels = {
    epanechnikov: function (dist) {
        return Math.abs(dist) <= 1 ? 0.75 * (1 - dist * dist) : 0;
    },
    gaussian: function (dist) {
        return (1 / Math.sqrt(Math.PI * 2)) * Math.exp(-0.5 * Math.pow(dist, 2));
    },
    uniform: function (dist) {
        return Math.abs(dist) <= 1 ? 0.5 : 0;
    },
    triangle: function (dist) {
        return Math.abs(dist) <= 1 ? 1 - Math.abs(dist) : 0;
    },
    quartic: function (dist) {
        var v = 1 - dist * dist;
        return Math.abs(dist) <= 1 ? (15 / 16) * v * v : 0;
    },
    triweight: function (dist) {
        var v = 1 - dist * dist;
        return Math.abs(dist) <= 1 ? (15 / 16) * Math.pow(v, 3) : 0;
    },
    cosinus: function (dist) {
        var v = (Math.PI / 4) * Math.cos(0.5 * Math.PI * dist);
        return Math.abs(dist) <= 1 ? v : 0;
    },
};
var DensityLayer = /** @class */ (function (_super) {
    tslib_1.__extends(DensityLayer, _super);
    function DensityLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'density';
        return _this;
    }
    DensityLayer.prototype.init = function () {
        var originXAxisConfig = this.options.xAxis ? util_1.clone(this.options.xAxis) : {};
        this.options.xField = 'value';
        this.options.yField = 'density';
        this.options.xAxis = util_1.deepMix({}, originXAxisConfig, { type: 'linear' });
        this.options.smooth = true;
        _super.prototype.init.call(this);
    };
    DensityLayer.prototype.processData = function (originData) {
        var _this = this;
        var _a = this.options, binField = _a.binField, binWidth = _a.binWidth, binNumber = _a.binNumber, kernel = _a.kernel;
        var _kernel = kernel ? kernel : 'epanechnikov';
        var kernelFunc = kernels[_kernel];
        var originDataCopy = util_1.clone(originData);
        util_1.sortBy(originDataCopy, binField);
        // 计算分箱，直方图分箱的计算基于binWidth，如配置了binNumber则将其转为binWidth进行计算
        var values = util_1.valuesOfKey(originDataCopy, binField);
        var range = util_1.getRange(values);
        var rangeWidth = range.max - range.min;
        var _binNumber = binNumber;
        var _binWidth = binWidth;
        if (!binNumber && binWidth) {
            _binNumber = Math.floor(rangeWidth / binWidth);
        }
        if (!binWidth && binNumber) {
            _binWidth = rangeWidth / binNumber;
        }
        // 当binWidth和binNumber都没有指定的情况，采用Sturges formula自动生成binWidth
        if (!binNumber && !binWidth) {
            _binNumber = math_1.sturges(values);
            _binWidth = rangeWidth / binNumber;
        }
        // 根据binNumber获取samples
        var LinearScale = scale_1.getScale('linear');
        var scale = new LinearScale({
            min: range.min,
            max: range.max,
            tickCount: _binNumber,
            nice: false,
        });
        var samples = scale.getTicks();
        // 计算KDE
        var densities = [];
        util_1.each(samples, function (s) {
            var density = _this.kernelDensityEstimator(_binWidth, kernelFunc, s, values);
            densities.push({ value: s.text, density: density });
        });
        return densities;
    };
    DensityLayer.prototype.kernelDensityEstimator = function (binWidth, kernelFunc, x, values) {
        var sum = 0;
        util_1.each(values, function (v) {
            var dist = (x.tickValue - v) / binWidth;
            sum += kernelFunc(dist);
        });
        return values.length === 0 ? 0 : sum / values.length;
    };
    return DensityLayer;
}(layer_1.default));
exports.default = DensityLayer;
global_1.registerPlotType('density', DensityLayer);

},{"../../base/global":392,"../../util/math":680,"../area/layer":456,"@antv/scale":747,"@antv/util":803,"tslib":894}],510:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var statistic_1 = tslib_1.__importDefault(require("../../../components/statistic"));
var statistic_template_1 = require("./statistic-template");
var util_2 = require("@antv/util");
var RingStatistic = /** @class */ (function (_super) {
    tslib_1.__extends(RingStatistic, _super);
    function RingStatistic(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.view = cfg.view;
        _this.plot = cfg.plot;
        _this.statisticClass = cfg.statisticClass;
        _this.adjustOptions();
        return _this;
    }
    RingStatistic.prototype.triggerOn = function () {
        var _this = this;
        var triggerOnEvent = this.options.triggerOn;
        this.view.on("interval:" + triggerOnEvent, util_2.debounce(function (e) {
            var displayData = _this.parseStatisticData('item', e.data.data, e.data.color);
            var htmlString = _this.getStatisticHtmlString(displayData);
            _this.updateHtml(htmlString);
        }, 150));
        var triggerOffEvent = this.options.triggerOff ? this.options.triggerOff : 'mouseleave';
        this.view.on("interval:" + triggerOffEvent, util_2.debounce(function () {
            var htmlString = _this.getTotalHtmlString();
            _this.updateHtml(htmlString);
        }, 150));
    };
    RingStatistic.prototype.getTotalHtmlString = function () {
        var displayData;
        if (this.options.content) {
            displayData = this.options.content;
        }
        else {
            /** 用户没有指定文本内容时，默认显示总计 */
            var data = this.getTotalValue();
            displayData = this.parseStatisticData('total', data);
        }
        /** 中心文本显示 */
        var htmlContent;
        if (this.options.htmlContent) {
            htmlContent = this.options.htmlContent(displayData, this.getStatisticSize());
        }
        else {
            htmlContent = this.getStatisticTemplate(displayData);
        }
        var statisticContainer = document.createElement('div');
        if (util_1.isType(htmlContent, 'HTMLDivElement')) {
            // @ts-ignore
            statisticContainer.appendChild(htmlContent);
        }
        else {
            statisticContainer.innerHTML = htmlContent;
        }
        return statisticContainer;
    };
    RingStatistic.prototype.adjustOptions = function () {
        this.html = this.getTotalHtmlString();
        var _a = this.view.coordinateBBox, minX = _a.minX, minY = _a.minY, width = _a.width, height = _a.height;
        this.x = minX + width / 2;
        this.y = minY + height / 2;
    };
    RingStatistic.prototype.getTotalValue = function () {
        var _a;
        var total = 0;
        var _b = this.plot.options, angleField = _b.angleField, colorField = _b.colorField;
        var totalLabel = this.options.totalLabel;
        util_2.each(this.plot.options.data, function (item) {
            if (typeof item[angleField] === 'number') {
                total += item[angleField];
            }
        });
        var data = (_a = {},
            _a[angleField] = total,
            _a[colorField] = totalLabel,
            _a);
        return data;
    };
    RingStatistic.prototype.parseStatisticData = function (type, data, color) {
        var plot = this.plot;
        var _a = plot.options, angleField = _a.angleField, colorField = _a.colorField;
        var angleScale = plot.getScaleByField(angleField);
        var colorScale = plot.getScaleByField(colorField);
        var statisticData = {
            name: colorScale ? colorScale.getText(data[colorField]) : null,
            value: angleScale.getText(data[angleField]),
        };
        if (type === 'item') {
            // 每一个扇形区域的数据
            statisticData.itemData = data;
            statisticData.color = color;
        }
        return statisticData;
    };
    RingStatistic.prototype.getStatisticTemplate = function (data) {
        var size = this.getStatisticSize();
        var htmlString = statistic_template_1.getTemplate(data.name, data.value, this.statisticClass, size);
        /** 更为复杂的文本要求用户自行制定html模板 */
        return htmlString;
    };
    RingStatistic.prototype.getStatisticSize = function () {
        var viewRange = this.plot.view.coordinateBBox;
        var _a = this.plot.options, radius = _a.radius, innerRadius = _a.innerRadius;
        var minContainerSize = Math.min(viewRange.width, viewRange.height);
        var size = minContainerSize * radius * innerRadius;
        return size;
    };
    RingStatistic.prototype.getStatisticHtmlString = function (data) {
        var htmlContent = this.options.htmlContent;
        var htmlString;
        if (htmlContent) {
            htmlString = htmlContent(data, this.getStatisticSize());
        }
        else {
            htmlString = this.getStatisticTemplate(data);
        }
        return htmlString;
    };
    return RingStatistic;
}(statistic_1.default));
exports.default = RingStatistic;

},{"../../../components/statistic":420,"./statistic-template":511,"@antv/util":803,"tslib":894}],511:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTemplate = void 0;
/*tslint:disable*/
var containerStyle = "color:#4d4d4d;font-size:14px;text-align:center;line-height:2;font-family:'-apple-system',BlinkMacSystemFont,'SegoeUI',Roboto,'HelveticaNeue',Helvetica,'PingFangSC','HiraginoSansGB','MicrosoftYaHei',SimSun,'sans-serif';pointer-events:none;";
var nameStyle = 'font-weight:300;white-space: nowrap;text-overflow: ellipsis;';
var valueStyle = 'font-size:32px;font-weight:bold;color:#4D4D4D';
function getTemplate(name, value, classId, size) {
    var domStyle = containerStyle + "width:" + size + "px;";
    var nameDomStr = name ? "<span class=\"ring-guide-name\" style=" + nameStyle + ">" + name + "</span><br/>" : '';
    var valueDomStr = "<span class=\"ring-guide-value\" style=" + valueStyle + ">" + value + "</span>";
    return "<div class=\"ring-guide-html " + classId + "\" style=" + domStyle + ">" + nameDomStr + valueDomStr + "</div>";
}
exports.getTemplate = getTemplate;

},{}],512:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    ring: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],513:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Donut = /** @class */ (function (_super) {
    tslib_1.__extends(Donut, _super);
    function Donut() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Donut.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'donut';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Donut.prototype.getAngleScale = function () {
        var layer = this.layers[0];
        return layer.getAngleScale();
    };
    Donut.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Donut;
}(plot_1.default));
exports.default = Donut;

},{"../../base/plot":394,"./layer":514,"@antv/util":803,"tslib":894}],514:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var dom_util_1 = require("@antv/dom-util");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../pie/layer"));
var EventParser = tslib_1.__importStar(require("./event"));
var ring_statistic_1 = tslib_1.__importDefault(require("./component/ring-statistic"));
var G2_GEOM_MAP = {
    ring: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'ring',
};
var DonutLayer = /** @class */ (function (_super) {
    tslib_1.__extends(DonutLayer, _super);
    function DonutLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'donut';
        return _this;
    }
    DonutLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            radius: 0.8,
            innerRadius: 0.64,
            tooltip: {
                visible: false,
            },
            statistic: {
                visible: true,
                totalLabel: '总计',
                triggerOn: 'mouseenter',
                triggerOff: 'mouseleave',
            },
        });
    };
    DonutLayer.prototype.beforeInit = function () {
        _super.prototype.beforeInit.call(this);
        DonutLayer.centralId++;
        this.statisticClass = "statisticClassId" + DonutLayer.centralId;
        this.adjustLabelDefaultOptions();
        // if (this.options.statistic.visible && this.options.statistic.triggerOn) {
        //   this.options.tooltip.visible = false;
        // }
    };
    DonutLayer.prototype.afterRender = function () {
        var container = this.canvas.get('container');
        if (this.statistic) {
            container.removeChild(this.statistic.wrapperNode);
            this.statistic = null;
        }
        /**环图中心文本 */
        if (this.options.statistic && this.options.statistic.visible) {
            var container_1 = this.canvas.get('container');
            dom_util_1.modifyCSS(container_1, { position: 'relative' });
            this.statistic = new ring_statistic_1.default(tslib_1.__assign({ container: container_1, view: this.view, plot: this, statisticClass: this.statisticClass }, this.options.statistic));
            this.statistic.render();
            /**响应交互 */
            if (this.options.statistic.triggerOn) {
                this.statistic.triggerOn();
            }
        }
        _super.prototype.afterRender.call(this);
    };
    DonutLayer.prototype.destroy = function () {
        if (this.statistic) {
            this.statistic.destroy();
        }
        _super.prototype.destroy.call(this);
    };
    DonutLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    DonutLayer.prototype.coord = function () {
        var props = this.options;
        var coordConfig = {
            type: 'theta',
            cfg: {
                radius: props.radius,
                innerRadius: props.innerRadius,
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    DonutLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    /** @override 调整 label 默认 options */
    DonutLayer.prototype.adjustLabelDefaultOptions = function () {
        var labelConfig = this.options.label;
        if (labelConfig && labelConfig.type === 'inner') {
            var labelStyleConfig = (labelConfig.style || {});
            if (!labelStyleConfig.textAlign) {
                labelStyleConfig.textAlign = 'center';
            }
            labelConfig.style = labelStyleConfig;
            if (!labelConfig.offset) {
                labelConfig.offset = ((this.options.innerRadius - 1) / 2) * 100 + "%";
            }
        }
    };
    DonutLayer.centralId = 0;
    return DonutLayer;
}(layer_1.default));
exports.default = DonutLayer;
global_1.registerPlotType('donut', DonutLayer);

},{"../../base/global":392,"../pie/layer":584,"./component/ring-statistic":510,"./event":512,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],515:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var FanGauge = /** @class */ (function (_super) {
    tslib_1.__extends(FanGauge, _super);
    function FanGauge() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    FanGauge.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'fanGauge';
        _super.prototype.createLayers.call(this, layerProps);
    };
    FanGauge.getDefaultOptions = layer_1.default.getDefaultOptions;
    return FanGauge;
}(plot_1.default));
exports.default = FanGauge;

},{"../../base/plot":394,"./layer":516,"@antv/util":803,"tslib":894}],516:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../gauge/layer"));
var gauge_shape_1 = require("../gauge/geometry/shape/gauge-shape");
var FanGaugeLayer = /** @class */ (function (_super) {
    tslib_1.__extends(FanGaugeLayer, _super);
    function FanGaugeLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'fanGauge';
        return _this;
    }
    FanGaugeLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            rangeColor: '#F6445A',
            rangeSize: 70,
            axis: {
                visible: true,
                offset: 5,
                tickCount: 10,
                subTickCount: 4,
                tickLine: {
                    visible: true,
                    length: 3,
                    style: {
                        stroke: '#aaa',
                        lineWidth: 3,
                    },
                },
                label: {
                    visible: true,
                    style: {
                        fill: '#aaa',
                        fontSize: 16,
                        textAlign: 'center',
                        textBaseline: 'middle',
                    },
                },
            },
        });
    };
    FanGaugeLayer.prototype.initG2Shape = function () {
        this.gaugeShape = new gauge_shape_1.GaugeShape(util_1.uniqueId());
        this.gaugeShape.setOption(this.type, util_1.deepMix({}, this.options, {
            radius: 1,
            angle: 120,
            textPosition: '125%',
            bottomRatio: 3.5,
        }));
        this.gaugeShape.render();
    };
    FanGaugeLayer.prototype.axis = function () {
        var axesConfig = {
            value: false,
            1: false,
        };
        this.setConfig('axes', axesConfig);
    };
    FanGaugeLayer.prototype.annotation = function () {
        var statistic = this.options.statistic;
        var annotationConfigs = [];
        // @ts-ignore
        if (statistic && statistic.visible) {
            var statistics = this.renderStatistic();
            annotationConfigs.push(statistics);
        }
        var siderTexts = this.renderSideText();
        var allAnnotations = annotationConfigs.concat(siderTexts);
        this.setConfig('annotations', allAnnotations);
    };
    FanGaugeLayer.prototype.renderSideText = function () {
        var _a = this.options, max = _a.max, min = _a.min, format = _a.format, rangeSize = _a.rangeSize, axis = _a.axis;
        var OFFSET_Y = 12;
        return [min, max].map(function (value, index) {
            return {
                type: 'text',
                top: true,
                position: ['50%', '50%'],
                content: format(value),
                style: util_1.deepMix({}, axis.label.style, {
                    textAlign: 'center',
                }),
                offsetX: !index ? -rangeSize : rangeSize,
                offsetY: OFFSET_Y,
            };
        });
    };
    return FanGaugeLayer;
}(layer_1.default));
exports.default = FanGaugeLayer;
global_1.registerPlotType('fanGauge', FanGaugeLayer);

},{"../../base/global":392,"../gauge/geometry/shape/gauge-shape":525,"../gauge/layer":527,"@antv/util":803,"tslib":894}],517:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var matrix_util_1 = require("@antv/matrix-util");
var g2_1 = require("@antv/g2");
function funnelScaleInX(shape, animateCfg) {
    var _a = animateCfg || {}, _b = _a.duration, duration = _b === void 0 ? 200 : _b, delay = _a.delay, easing = _a.easing, callback = _a.callback, reverse = _a.reverse;
    var bbox = shape.getBBox();
    var originX = reverse ? bbox.maxX : bbox.minX;
    var originY = (bbox.minY + bbox.maxY) / 2;
    var clip = shape.setClip({
        type: 'rect',
        attrs: {
            x: bbox.x,
            y: bbox.y,
            width: bbox.width,
            height: bbox.height,
        },
    });
    var clipTargetAttrs = {
        matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
    };
    clip.setMatrix(matrix_util_1.ext.transform(clip.getMatrix(), [
        ['t', -originX, -originY],
        ['s', 0, 1],
        ['t', originX, originY],
    ]));
    var shapeTargetAttrs = {
        fillOpacity: shape.attr('fillOpacity'),
        strokeOpacity: shape.attr('strokeOpacity'),
        opacity: shape.attr('opacity'),
    };
    shape.attr({
        fillOpacity: 0,
        strokeOpacity: 0,
        opacity: 0,
    });
    clip.animate(clipTargetAttrs, {
        duration: 200,
        easing: easing,
        callback: function () {
            shape.setClip(null);
            clip.remove();
        },
        delay: delay,
    });
    shape.animate(shapeTargetAttrs, { duration: duration, easing: easing, delay: delay });
    callback && setTimeout(function () { return callback(shape); }, duration + delay);
}
funnelScaleInX.animationName = 'funnelScaleInX';
g2_1.registerAnimation('funnelScaleInX', funnelScaleInX);

},{"@antv/g2":309,"@antv/matrix-util":717}],518:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var matrix_util_1 = require("@antv/matrix-util");
var g2_1 = require("@antv/g2");
function funnelScaleInY(shape, animateCfg) {
    var _a = animateCfg || {}, _b = _a.duration, duration = _b === void 0 ? 200 : _b, delay = _a.delay, easing = _a.easing, callback = _a.callback, reverse = _a.reverse;
    var bbox = shape.getBBox();
    var originX = (bbox.minX + bbox.maxX) / 2;
    var originY = reverse ? bbox.maxY : bbox.minY;
    var clip = shape.setClip({
        type: 'rect',
        attrs: {
            x: bbox.x,
            y: bbox.y,
            width: bbox.width,
            height: bbox.height,
        },
    });
    var clipTargetAttrs = {
        matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
    };
    clip.setMatrix(matrix_util_1.ext.transform(clip.getMatrix(), [
        ['t', -originX, -originY],
        ['s', 1, 0],
        ['t', originX, originY],
    ]));
    var shapeTargetAttrs = {
        fillOpacity: shape.attr('fillOpacity'),
        strokeOpacity: shape.attr('strokeOpacity'),
        opacity: shape.attr('opacity'),
    };
    shape.attr({
        fillOpacity: 0,
        strokeOpacity: 0,
        opacity: 0,
    });
    clip.animate(clipTargetAttrs, {
        duration: 200,
        easing: easing,
        callback: function () {
            shape.setClip(null);
            clip.remove();
        },
        delay: delay,
    });
    shape.animate(shapeTargetAttrs, { duration: duration, easing: easing, delay: delay });
    callback && setTimeout(function () { return callback(shape); }, duration + delay);
}
funnelScaleInY.animationName = 'funnelScaleInY';
g2_1.registerAnimation('funnelScaleInY', funnelScaleInY);

},{"@antv/g2":309,"@antv/matrix-util":717}],519:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var g2_1 = require("@antv/g2");
var get_style_1 = require("@antv/g2/lib/geometry/shape/util/get-style");
// 根据数据点生成矩形的四个关键点
function _getRectPoints(cfg, isPyramid) {
    if (isPyramid === void 0) { isPyramid = false; }
    var x = cfg.x, y = cfg.y, y0 = cfg.y0, size = cfg.size;
    // 有 4 种情况，
    // 1. x, y 都不是数组
    // 2. y是数组，x不是
    // 3. x是数组，y不是
    // 4. x, y 都是数组
    var yMin;
    var yMax;
    if (util_1.isArray(y)) {
        yMin = y[0];
        yMax = y[1];
    }
    else {
        yMin = y0;
        yMax = y;
    }
    var xMin;
    var xMax;
    if (util_1.isArray(x)) {
        xMin = x[0];
        xMax = x[1];
    }
    else {
        xMin = x - size / 2;
        xMax = x + size / 2;
    }
    var points = [
        { x: xMin, y: yMin },
        { x: xMin, y: yMax },
    ];
    if (isPyramid) {
        // 绘制尖底漏斗图
        // 金字塔漏斗图的关键点
        // 1
        // |   2
        // 0
        points.push({
            x: xMax,
            y: (yMax + yMin) / 2,
        });
    }
    else {
        // 矩形的四个关键点，结构如下（左下角顺时针连接）
        // 1 ---- 2
        // |      |
        // 0 ---- 3
        points.push({ x: xMax, y: yMax }, { x: xMax, y: yMin });
    }
    return points;
}
// 根据关键点绘制漏斗图的 path
function _getFunnelPath(cfg, compare) {
    var path = [];
    var points = cfg.points, nextPoints = cfg.nextPoints;
    if (compare) {
        // 对比漏斗
        var yValues = compare.yValues, yValuesMax = compare.yValuesMax, yValuesNext = compare.yValuesNext;
        var originY = (points[0].y + points[1].y) / 2;
        var yValueTotal_1 = yValues[0] + yValues[1];
        var yRatios = yValues.map(function (yValue) { return yValue / yValueTotal_1 / 0.5; });
        var yOffset = (yValuesMax[0] / (yValuesMax[0] + yValuesMax[1]) - 0.5) * 0.9;
        var spacing = 0.001;
        if (!util_1.isNil(nextPoints)) {
            var yValueTotalNext_1 = yValuesNext[0] + yValuesNext[1];
            var yRatiosNext = yValuesNext.map(function (yValueNext) { return yValueNext / yValueTotalNext_1 / 0.5; });
            path.push(['M', points[0].x, yOffset + (points[0].y - originY) * yRatios[0] + originY - spacing], ['L', points[1].x, yOffset + originY - spacing], ['L', nextPoints[1].x, yOffset + originY - spacing], ['L', nextPoints[0].x, yOffset + (nextPoints[3].y - originY) * yRatiosNext[0] + originY - spacing], ['Z']);
            path.push(['M', points[0].x, yOffset + originY + spacing], ['L', points[1].x, yOffset + (points[1].y - originY) * yRatios[1] + originY + spacing], ['L', nextPoints[1].x, yOffset + (nextPoints[2].y - originY) * yRatiosNext[1] + originY + spacing], ['L', nextPoints[0].x, yOffset + originY + spacing], ['Z']);
        }
        else {
            path.push(['M', points[0].x, yOffset + (points[0].y - originY) * yRatios[0] + originY], ['L', points[1].x, yOffset + originY], ['L', points[2].x, yOffset + originY], ['L', points[3].x, yOffset + (points[3].y - originY) * yRatios[0] + originY], ['Z']);
            path.push(['M', points[0].x, yOffset + 0.002 + originY], ['L', points[1].x, yOffset + 0.002 + (points[1].y - originY) * yRatios[1] + originY], ['L', points[2].x, yOffset + 0.002 + (points[2].y - originY) * yRatios[1] + originY], ['L', points[3].x, yOffset + 0.002 + originY], ['Z']);
        }
    }
    else {
        // 标准漏斗
        if (!util_1.isNil(nextPoints)) {
            path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', nextPoints[1].x, nextPoints[1].y], ['L', nextPoints[0].x, nextPoints[0].y], ['Z']);
        }
        else {
            path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['Z']);
        }
    }
    return path;
}
g2_1.registerShape('interval', 'funnel-basic-rect', {
    getPoints: function (pointInfo) {
        pointInfo.size = pointInfo.size * 1.8; // 调整面积
        return _getRectPoints(pointInfo);
    },
    draw: function (cfg, container) {
        var _a;
        var style = get_style_1.getStyle(cfg, false, true);
        var compare = util_1.get(cfg, 'data.__compare__');
        var path = this.parsePath(_getFunnelPath(cfg, compare));
        return container.addShape('path', (_a = {
                name: 'interval',
                attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path })
            },
            _a['__compare__'] = compare,
            _a));
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color;
        return {
            symbol: 'square',
            style: {
                r: 4,
                fill: color,
            },
        };
    },
});

},{"@antv/g2":309,"@antv/g2/lib/geometry/shape/util/get-style":302,"@antv/util":803,"tslib":894}],520:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var g2_1 = require("@antv/g2");
var get_style_1 = require("@antv/g2/lib/geometry/shape/util/get-style");
function lerp(a, b, factor) {
    return (1 - factor) * a + factor * b;
}
// 根据矩形关键点绘制 path
function _getRectPath(points, _a) {
    var reverse = _a.reverse, ratioUpper = _a.ratioUpper, ratioLower = _a.ratioLower;
    var path = [];
    var firstPoint = points[0];
    var originX = (points[1].x + points[2].x) / 2;
    var factorTop = 1.2;
    var factorBottom = 0.6;
    if (reverse) {
        var tmp = ratioLower;
        ratioLower = ratioUpper;
        ratioUpper = tmp;
    }
    var firstPointX = (firstPoint.x - originX) * lerp(factorBottom, factorTop, ratioLower) + originX;
    path.push(['M', firstPointX, firstPoint.y]);
    for (var i = 1, len = points.length; i < len; i++) {
        var pointX = points[i].x;
        switch (i) {
            case 1:
            case 2:
                pointX = (pointX - originX) * lerp(factorBottom, factorTop, ratioUpper) + originX;
                break;
            case 3:
                pointX = (pointX - originX) * lerp(factorBottom, factorTop, ratioLower) + originX;
                break;
        }
        path.push(['L', pointX, points[i].y]);
    }
    path.push(['L', firstPointX, firstPoint.y]); // 需要闭合
    path.push(['z']);
    return path;
}
g2_1.registerShape('interval', 'funnel-dynamic-rect', {
    draw: function (cfg, container) {
        var style = get_style_1.getStyle(cfg, false, true);
        var custom = util_1.get(cfg, 'data.__custom__');
        var path = this.parsePath(_getRectPath(cfg.points, custom));
        return container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
        });
    },
    getMarker: function (markerCfg) {
        var color = markerCfg.color, isInPolar = markerCfg.isInPolar;
        return {
            symbol: isInPolar ? 'circle' : 'square',
            style: {
                r: isInPolar ? 4.5 : 4,
                fill: color,
            },
        };
    },
});

},{"@antv/g2":309,"@antv/g2/lib/geometry/shape/util/get-style":302,"@antv/util":803,"tslib":894}],521:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Funnel = /** @class */ (function (_super) {
    tslib_1.__extends(Funnel, _super);
    function Funnel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Funnel.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'funnel';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Funnel.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Funnel;
}(plot_1.default));
exports.default = Funnel;

},{"../../base/plot":394,"./layer":522,"@antv/util":803,"tslib":894}],522:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dom_util_1 = require("@antv/dom-util");
var dependents_1 = require("../../dependents");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
require("./theme");
require("./geometry/shape/funnel-basic-rect");
require("./geometry/shape/funnel-dynamic-rect");
require("./animation/funnel-scale-in-x");
require("./animation/funnel-scale-in-y");
var color_1 = require("../../util/color");
function lerp(a, b, factor) {
    return (1 - factor) * a + factor * b;
}
var G2_GEOM_MAP = {
    column: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'funnel',
};
var FunnelLayer = /** @class */ (function (_super) {
    tslib_1.__extends(FunnelLayer, _super);
    function FunnelLayer(props) {
        var _this = _super.call(this, props) || this;
        _this.type = 'funnel';
        _this._shouldResetPercentages = true;
        _this._shouldResetLabels = true;
        _this._shouldResetCompareTexts = true;
        _this._legendsListenerAttached = false;
        _this._onLegendContainerMouseDown = function (e) {
            var props = _this.options;
            var targetName = e.target.get('name');
            if (targetName.startsWith('legend-item')) {
                var legendItem = e.target.get('parent');
                legendItem.set('unchecked', !legendItem.get('unchecked'));
                _this.refreshPercentages();
                _this.refreshLabels();
                if (props.dynamicHeight) {
                    var data = _this._findCheckedDataByMouseDownLegendItem(legendItem);
                    _this._genCustomFieldForDynamicHeight(data);
                }
                if (props.compareField) {
                    var data = _this._findCheckedDataByMouseDownLegendItem(legendItem);
                    _this._updateDataForCompare(data);
                    _this.refreshCompareTexts();
                }
            }
        };
        _this.adjustProps(_this.options);
        if (props.dynamicHeight) {
            _this._genCustomFieldForDynamicHeight(_this.getData());
        }
        if (props.compareField) {
            _this.options.data = _this._reduceDataForCompare(_this.getData());
        }
        return _this;
    }
    FunnelLayer.getDefaultOptions = function (props) {
        var cfg = {
            label: {
                visible: true,
                adjustColor: true,
            },
            percentage: {
                visible: true,
                offsetX: props.transpose ? 0 : 40,
                offsetY: props.transpose ? 40 : 0,
                spacing: 4,
                line: {
                    visible: true,
                    style: {
                        lineWidth: 1,
                        stroke: 'rgba(0, 0, 0, 0.15)',
                    },
                },
                text: {
                    content: '转化率',
                    style: {
                        fill: 'rgba(0, 0, 0, 0.65)',
                    },
                },
                value: {
                    visible: true,
                    style: {
                        fill: 'black',
                    },
                    formatter: function (yValueUpper, yValueLower) { return ((100 * yValueLower) / yValueUpper).toFixed(2) + "%"; },
                },
            },
            tooltip: {
                visible: true,
                shared: true,
                showTitle: false,
                showCrosshairs: false,
                showMarkers: false,
            },
            animation: util_1.deepMix({}, dependents_1.DEFAULT_ANIMATE_CFG, {
                appear: {
                    duration: 800,
                },
            }),
            dynamicHeight: false,
            compareText: {
                visible: true,
                offsetX: -16,
                offsetY: -16,
                style: {
                    fill: 'black',
                },
            },
            legend: {
                position: 'bottom-center',
            },
            interactions: [{ type: 'tooltip' }, { type: 'legend-filter' }],
        };
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), cfg);
    };
    FunnelLayer.prototype.getColorScale = function () {
        var xField = this.options.xField;
        if (xField) {
            return this.view.getScaleByField(xField);
        }
    };
    FunnelLayer.prototype.coord = function () {
        var props = this.options;
        var coordConfig = {
            type: 'rect',
            actions: props.transpose
                ? props.dynamicHeight
                    ? [['transpose'], ['scale', 1, -1]]
                    : [['scale', 1, -1]]
                : props.dynamicHeight
                    ? []
                    : [['transpose'], ['scale', 1, -1]],
        };
        // @ts-ignore
        this.setConfig('coordinate', coordConfig);
    };
    FunnelLayer.prototype.axis = function () {
        this.setConfig('axes', false);
    };
    FunnelLayer.prototype.adjustFunnel = function (funnel) {
        var props = this.options;
        // @ts-ignore
        funnel.shape = props.dynamicHeight ? 'funnel-dynamic-rect' : 'funnel-basic-rect';
        funnel.color = {
            fields: [props.xField],
            values: props.color && (Array.isArray(props.color) ? props.color : [props.color]),
        };
        if (util_1.isFunction(props.funnelStyle)) {
            // @ts-ignore
            funnel.style = { callback: props.funnelStyle };
        }
        else {
            // @ts-ignore
            funnel.style = { cfg: props.funnelStyle };
        }
        funnel.adjust = [
            {
                type: props.dynamicHeight ? 'stack' : 'symmetric',
            },
        ];
    };
    FunnelLayer.prototype.tooltip = function () {
        var props = this.options;
        if (props.compareField) {
            util_1.deepMix(props.tooltip, {
                htmlContent: function (title, items) {
                    var clss, el, color, elMarker;
                    clss = dependents_1.TooltipCssConst.CONTAINER_CLASS;
                    el = dom_util_1.createDom("<div class=\"" + clss + "\"></div>");
                    dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                    var elRoot = el;
                    if (title) {
                        clss = dependents_1.TooltipCssConst.TITLE_CLASS;
                        el = dom_util_1.createDom("<div class=\"" + clss + "\"></div>");
                        dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                        elRoot.appendChild(el);
                        var elTitle = el;
                        clss = dependents_1.TooltipCssConst.MARKER_CLASS;
                        el = dom_util_1.createDom("<span class=\"" + clss + "\"></span>");
                        dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                        dom_util_1.modifyCSS(el, { width: '10px', height: '10px' });
                        elTitle.appendChild(el);
                        elMarker = el;
                        el = dom_util_1.createDom("<span>" + title + "</span>");
                        elTitle.appendChild(el);
                    }
                    if (items) {
                        clss = dependents_1.TooltipCssConst.LIST_CLASS;
                        el = dom_util_1.createDom("<ul class=\"" + clss + "\"></ul>");
                        dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                        elRoot.appendChild(el);
                        var elList_1 = el;
                        items
                            .reduce(function (pairs, item) {
                            if (!color) {
                                color = item.color;
                            }
                            var compareValues = util_1.get(item, 'point._origin.__compare__.compareValues');
                            var yValues = util_1.get(item, 'point._origin.__compare__.yValues');
                            yValues.forEach(function (yValue, i) { return pairs.push([compareValues[i], yValue]); });
                            return pairs;
                        }, [])
                            .forEach(function (_a, index) {
                            var compareValue = _a[0], yValue = _a[1];
                            clss = dependents_1.TooltipCssConst.LIST_ITEM_CLASS;
                            el = dom_util_1.createDom("<li class=\"" + clss + "\" data-index=" + index + "></li>");
                            dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                            elList_1.appendChild(el);
                            var elListItem = el;
                            clss = dependents_1.TooltipCssConst.NAME_CLASS;
                            el = dom_util_1.createDom("<span class=\"" + clss + "\">" + compareValue + "</span>");
                            dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                            elListItem.appendChild(el);
                            clss = dependents_1.TooltipCssConst.VALUE_CLASS;
                            el = dom_util_1.createDom("<span class=\"" + clss + "\">" + yValue + "</span>");
                            dom_util_1.modifyCSS(el, dependents_1.HtmlTooltipTheme[clss]);
                            elListItem.appendChild(el);
                        });
                    }
                    if (color && elMarker) {
                        dom_util_1.modifyCSS(elMarker, { backgroundColor: color });
                    }
                    return elRoot;
                },
            });
        }
        _super.prototype.tooltip.call(this);
    };
    FunnelLayer.prototype.addGeometry = function () {
        var props = this.options;
        var funnel = factory_1.getGeom('interval', 'main', {
            positionFields: [props.dynamicHeight ? '_' : props.xField, props.yField],
            plot: this,
        });
        this.adjustFunnel(funnel);
        this.funnel = funnel;
        this.setConfig('geometry', funnel);
        if (!props.compareField) {
            this.geometryTooltip();
        }
    };
    FunnelLayer.prototype.geometryTooltip = function () {
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            if (!this.funnel.tooltip) {
                this.funnel.tooltip = {};
            }
            this.funnel.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            if (!this.funnel.tooltip) {
                this.funnel.tooltip = {};
            }
            this.funnel.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.funnel.tooltip.fields = [this.options.xField, this.options.yField];
            }
        }
    };
    FunnelLayer.prototype.animation = function () {
        var _this = this;
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.funnel.animate = false;
        }
        else {
            var data_1 = this.getData();
            var appearDuration = util_1.get(props, 'animation.appear.duration');
            var appearDurationEach_1 = appearDuration / (data_1.length || 1);
            if (this._animationAppearTimeoutHandler) {
                clearTimeout(this._animationAppearTimeoutHandler);
                delete this._animationAppearTimeoutHandler;
            }
            this._animationAppearTimeoutHandler = setTimeout(function () {
                _this.fadeInPercentages(appearDurationEach_1);
                if (props.compareField) {
                    _this.fadeInCompareTexts(appearDurationEach_1);
                }
                delete _this._animationAppearTimeoutHandler;
            }, appearDuration);
            this.funnel.animate = util_1.deepMix({}, props.animation, {
                appear: {
                    animation: props.transpose ? 'funnelScaleInX' : 'funnelScaleInY',
                    duration: appearDurationEach_1,
                    delay: function (datum) { return util_1.findIndex(data_1, function (o) { return util_1.isEqual(o, datum); }) * appearDurationEach_1; },
                    callback: function (shape) {
                        _this.fadeInLabels(shape, 0.5 * appearDurationEach_1);
                    },
                },
                enter: {
                    animation: 'fade-in',
                },
            });
        }
    };
    FunnelLayer.prototype.afterRender = function () {
        var props = this.options;
        this.resetLabels();
        this.resetPercentages();
        if (props.compareField) {
            this.resetCompareTexts();
        }
        if (props.padding == 'auto') {
            var percentageContainer = this._findPercentageContainer();
            if (percentageContainer) {
                this.paddingController.registerPadding(percentageContainer, 'inner', true);
            }
            var compareTextContainer = this._findCompareTextContainer();
            if (compareTextContainer) {
                this.paddingController.registerPadding(compareTextContainer, 'inner', true);
            }
        }
        _super.prototype.afterRender.call(this);
        if (props.animation === false) {
            this.fadeInLabels();
            this.fadeInPercentages();
            if (props.compareField) {
                this.fadeInCompareTexts();
            }
        }
        if (!this._legendsListenerAttached) {
            this._legendsListenerAttached = true;
            // @ts-ignore
            var legendContainer = this.view.getController('legend').container;
            legendContainer.on('mousedown', this._onLegendContainerMouseDown);
        }
    };
    FunnelLayer.prototype.updateConfig = function (cfg) {
        cfg = this.adjustProps(cfg);
        _super.prototype.updateConfig.call(this, cfg);
        this._legendsListenerAttached = false;
    };
    FunnelLayer.prototype.changeData = function (data) {
        var props = this.options;
        if (props.animation !== false) {
            this._shouldResetPercentages = false;
            this._shouldResetLabels = false;
        }
        if (props.dynamicHeight) {
            var checkedData = this._findCheckedDataInNewData(data);
            this._genCustomFieldForDynamicHeight(checkedData);
        }
        if (props.compareField) {
            data = this._reduceDataForCompare(data);
            var checkedData = this._findCheckedDataInNewData(data);
            this._updateDataForCompare(checkedData);
        }
        _super.prototype.changeData.call(this, data);
        this.refreshPercentages();
        this.refreshLabels();
        if (props.compareField) {
            this.fadeInCompareTexts();
        }
    };
    FunnelLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    FunnelLayer.prototype.adjustProps = function (props) {
        if (props.compareField) {
            props.dynamicHeight = false;
        }
        if (props.dynamicHeight) {
            util_1.set(props, "meta." + props.yField + ".nice", false);
            util_1.set(props, 'tooltip.shared', false);
        }
        return props;
    };
    FunnelLayer.prototype.resetPercentages = function () {
        var _this = this;
        if (!this._shouldResetPercentages)
            return;
        var props = this.options;
        var _a = props.percentage || {}, offsetX = _a.offsetX, offsetY = _a.offsetY, spacing = _a.spacing, _b = _a.line, percentageLine = _b === void 0 ? {} : _b, _c = _a.text, percentageText = _c === void 0 ? {} : _c, _d = _a.value, percentageValue = _d === void 0 ? {} : _d;
        var adjustTimestamp = Date.now();
        var container = this._findPercentageContainer(true);
        this._eachShape(function (shape, index, datumLower, datumUpper) {
            if (index > 0) {
                var _a = shape.getBBox(), minX = _a.minX, maxX = _a.maxX, maxY = _a.maxY, minY = _a.minY;
                var x1 = props.transpose ? minX : maxX;
                var y1 = props.transpose ? (props.compareField ? maxY : minY) : minY;
                var _b = _this._findPercentageMembersInContainerByIndex(container, index, true), line_1 = _b.line, text_1 = _b.text, value_1 = _b.value;
                var eachProcs_1 = [
                    function (x, y, line, text, value) {
                        if (line) {
                            line.attr(util_1.deepMix({}, percentageLine.style, {
                                x1: x,
                                y1: y,
                                x2: props.transpose ? x + offsetX : x - offsetX,
                                y2: props.transpose ? y - offsetY : y + offsetY,
                                opacity: 0,
                            }));
                            line.set('adjustTimestamp', adjustTimestamp);
                        }
                        var textWidth = 0;
                        var valueWidth = 0;
                        var textProc = function () {
                            if (text) {
                                text.attr(util_1.deepMix({}, percentageText.style, {
                                    x: props.transpose ? x + offsetX : x - offsetX - spacing - valueWidth - spacing,
                                    y: props.transpose ? y - offsetY - spacing : y + offsetY,
                                    opacity: 0,
                                    text: percentageText.content,
                                    textAlign: props.transpose ? 'left' : 'right',
                                    textBaseline: props.transpose ? 'bottom' : 'middle',
                                }));
                                text.set('adjustTimestamp', adjustTimestamp);
                                textWidth = text.getBBox().width;
                            }
                        };
                        var valueProc = function () {
                            if (value) {
                                value.attr(util_1.deepMix({}, percentageValue.style, {
                                    x: props.transpose ? x + offsetX + textWidth + spacing : x - offsetX - spacing,
                                    y: props.transpose ? y - offsetY - spacing : y + offsetY,
                                    opacity: 0,
                                    text: util_1.isFunction(percentageValue.formatter)
                                        ? props.compareField
                                            ? percentageValue.formatter(util_1.get(datumUpper, '__compare__.yValues.0'), util_1.get(datumLower, '__compare__.yValues.0'))
                                            : percentageValue.formatter(datumUpper[props.yField], datumLower[props.yField])
                                        : '',
                                    textAlign: props.transpose ? 'left' : 'right',
                                    textBaseline: props.transpose ? 'bottom' : 'middle',
                                }));
                                value.set('adjustTimestamp', adjustTimestamp);
                                valueWidth = value.getBBox().width;
                            }
                        };
                        if (props.transpose) {
                            textProc();
                            valueProc();
                        }
                        else {
                            valueProc();
                            textProc();
                        }
                    },
                    function (x, y, line, text, value) {
                        if (line) {
                            line.attr(util_1.deepMix({}, percentageLine.style, {
                                x1: x,
                                y1: y,
                                x2: x + offsetX,
                                y2: props.transpose ? (props.compareField ? y + offsetY : y - offsetY) : y + offsetY,
                                opacity: 0,
                            }));
                            line.set('adjustTimestamp', adjustTimestamp);
                        }
                        var textWidth = 0;
                        if (text) {
                            text.attr(util_1.deepMix({}, percentageText.style, {
                                x: props.transpose ? x + offsetX : x + offsetX + spacing,
                                y: props.transpose
                                    ? props.compareField
                                        ? y + offsetY + spacing
                                        : y - offsetY - spacing
                                    : y + offsetY,
                                opacity: 0,
                                text: percentageText.content,
                                textAlign: 'left',
                                textBaseline: props.transpose ? (props.compareField ? 'top' : 'bottom') : 'middle',
                            }));
                            text.set('adjustTimestamp', adjustTimestamp);
                            textWidth = text.getBBox().width;
                        }
                        if (value) {
                            value.attr(util_1.deepMix({}, percentageValue.style, {
                                x: props.transpose ? x + offsetX + textWidth + spacing : x + offsetX + spacing + textWidth + spacing,
                                y: props.transpose
                                    ? props.compareField
                                        ? y + offsetY + spacing
                                        : y - offsetY - spacing
                                    : y + offsetY,
                                opacity: 0,
                                text: util_1.isFunction(percentageValue.formatter)
                                    ? props.compareField
                                        ? percentageValue.formatter(util_1.get(datumUpper, "__compare__.yValues.1"), util_1.get(datumLower, "__compare__.yValues.1"))
                                        : percentageValue.formatter(datumUpper[props.yField], datumLower[props.yField])
                                    : '',
                                textAlign: 'left',
                                textBaseline: props.transpose ? (props.compareField ? 'top' : 'bottom') : 'middle',
                            }));
                            value.set('adjustTimestamp', adjustTimestamp);
                        }
                    },
                ];
                if (props.compareField) {
                    var _c = [minX, minY], x0 = _c[0], y0 = _c[1];
                    [
                        [x0, y0],
                        [x1, y1],
                    ].forEach(function (_a, i) {
                        var x = _a[0], y = _a[1];
                        return eachProcs_1[i](x, y, line_1 && line_1[i], text_1 && text_1[i], value_1 && value_1[i]);
                    });
                }
                else {
                    eachProcs_1[1](x1, y1, line_1, text_1, value_1);
                }
            }
            datumUpper = datumLower;
            index++;
        });
        container.get('children').forEach(function (child) {
            if (child.get('adjustTimestamp') != adjustTimestamp) {
                child.attr({ opacity: 0 });
                container.set(child.get('id'), null);
                setTimeout(function () { return child.remove(); }, 0);
            }
        });
    };
    FunnelLayer.prototype.fadeInPercentages = function (duration, callback) {
        var _this = this;
        var props = this.options;
        var container = this._findPercentageContainer();
        var eachProc = function (i) {
            var lastBBox = { minX: Infinity, maxX: -Infinity, minY: Infinity, maxY: -Infinity };
            _this._eachShape(function (shape, index) {
                var members = _this._findPercentageMembersInContainerByIndex(container, index);
                var currBBox = { minX: Infinity, maxX: -Infinity, minY: Infinity, maxY: -Infinity };
                var eachCalc = function (member) {
                    if (member && member.get('type') == 'text') {
                        var _a = member.getBBox(), minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;
                        if (minX < currBBox.minX)
                            currBBox.minX = minX;
                        if (maxX > currBBox.maxX)
                            currBBox.maxX = maxX;
                        if (minY < currBBox.minY)
                            currBBox.minY = minY;
                        if (maxY > currBBox.maxY)
                            currBBox.maxY = maxY;
                    }
                };
                util_1.each(members, function (member) { return (util_1.isArray(member) ? eachCalc(member[i]) : eachCalc(member)); });
                if (currBBox.minX > lastBBox.maxX ||
                    currBBox.maxX < lastBBox.minX ||
                    currBBox.minY > lastBBox.maxY ||
                    currBBox.maxY < lastBBox.minY) {
                    var eachShow_1 = function (member) {
                        if (member) {
                            var attrs = {
                                opacity: 1,
                            };
                            duration ? member.animate(attrs, duration) : member.attr(attrs);
                        }
                    };
                    util_1.each(members, function (member) { return (util_1.isArray(member) ? eachShow_1(member[i]) : eachShow_1(member)); });
                    util_1.assign(lastBBox, currBBox);
                }
            });
        };
        props.compareField ? [0, 1].forEach(eachProc) : eachProc();
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.fadeOutPercentages = function (duration, callback) {
        var _this = this;
        var container = this._findPercentageContainer();
        this._eachShape(function (shape, index) {
            var members = _this._findPercentageMembersInContainerByIndex(container, index);
            var eachProc = function (member) {
                if (member) {
                    var attrs = {
                        opacity: 0,
                    };
                    duration ? member.animate(attrs, duration) : member.attr(attrs);
                }
            };
            util_1.each(members, function (member) { return (util_1.isArray(member) ? member.forEach(eachProc) : eachProc(member)); });
        });
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.refreshPercentages = function (callback) {
        var _this = this;
        var props = this.options;
        if (props.animation !== false) {
            var _a = this._calcRefreshFadeDurations(), fadeOutDuration = _a.fadeOutDuration, fadeInDuration_1 = _a.fadeInDuration;
            this._shouldResetPercentages = false;
            this.fadeOutPercentages(fadeOutDuration, function () {
                _this._shouldResetPercentages = true;
                _this.resetPercentages();
                _this.fadeInPercentages(fadeInDuration_1, callback);
            });
        }
    };
    FunnelLayer.prototype._findPercentageContainer = function (createIfNotFound) {
        if (createIfNotFound === void 0) { createIfNotFound = false; }
        var middleGroup = this.view.middleGroup;
        var percentageContainer = middleGroup.get('percentageContainer');
        if (!percentageContainer && createIfNotFound) {
            percentageContainer = middleGroup.addGroup();
            middleGroup.set('percentageContainer', percentageContainer);
        }
        return percentageContainer;
    };
    FunnelLayer.prototype._findPercentageMembersInContainerByIndex = function (container, index, createIfNotFound) {
        if (createIfNotFound === void 0) { createIfNotFound = false; }
        var props = this.options;
        var _a = props.percentage || {}, visible = _a.visible, _b = _a.line, percentageLine = _b === void 0 ? {} : _b, _c = _a.text, percentageText = _c === void 0 ? {} : _c, _d = _a.value, percentageValue = _d === void 0 ? {} : _d;
        var members = {
            line: undefined,
            text: undefined,
            value: undefined,
        };
        if (visible === false || !container) {
            return members;
        }
        if (percentageLine.visible !== false) {
            var find = function (i) {
                var lineId = "_percentage-line-" + index + "-" + i;
                var line = container.get(lineId);
                if (!line && createIfNotFound) {
                    line = container.addShape({ id: lineId, type: 'line', attrs: {} });
                    container.set(lineId, line);
                }
                return line;
            };
            var line = props.compareField ? [0, 1].map(find) : find(0);
            members.line = line;
        }
        if (percentageText.visible !== false) {
            var find = function (i) {
                var textId = "_percentage-text-" + index + "-" + i;
                var text = container.get(textId);
                if (!text && createIfNotFound) {
                    text = container.addShape({ id: textId, type: 'text', attrs: {} });
                    container.set(textId, text);
                }
                return text;
            };
            var text = props.compareField ? [0, 1].map(find) : find(0);
            members.text = text;
        }
        if (percentageValue.visible !== false) {
            var find = function (i) {
                var valueId = "_percentage-value-" + index + "-" + i;
                var value = container.get(valueId);
                if (!value && createIfNotFound) {
                    value = container.addShape({ id: valueId, type: 'text', attrs: {} });
                    container.set(valueId, value);
                }
                return value;
            };
            var value = props.compareField ? [0, 1].map(find) : find(0);
            members.value = value;
        }
        return members;
    };
    FunnelLayer.prototype._calcRefreshFadeDurations = function () {
        var props = this.options;
        var updateDuration = util_1.get(props, 'animation.update.duration');
        var enterDuration = util_1.get(props, 'animation.enter.duration');
        var fadeInDuration = Math.min(enterDuration, updateDuration) * 0.6;
        var fadeOutDuration = Math.max(enterDuration, updateDuration) * 1.2;
        return { fadeInDuration: fadeInDuration, fadeOutDuration: fadeOutDuration };
    };
    FunnelLayer.prototype.resetLabels = function () {
        var _this = this;
        if (!this._shouldResetLabels)
            return;
        var props = this.options;
        var xField = props.xField, yField = props.yField;
        var adjustTimestamp = Date.now();
        var labelsContainer = this._getGeometry().labelsContainer;
        var labelProps = props.label || {};
        var labelStyle = util_1.deepMix(tslib_1.__assign({}, this.theme.label), props.label.style, {
            opacity: 0,
            textAlign: 'center',
            textBaseline: 'middle',
        });
        var datumTop;
        this._eachShape(function (shape, index, datum, elementIndex) {
            var _a;
            var element = shape.get('element');
            if (index == 0) {
                datumTop = datum;
            }
            var _b = shape.getBBox(), minX = _b.minX, maxX = _b.maxX, minY = _b.minY, maxY = _b.maxY;
            var xValue = datum[xField];
            var yValue = datum[yField];
            if (labelProps.adjustColor) {
                labelStyle.fill = _this._getAdjustedTextFillByShape(shape);
            }
            var compare = datum.__compare__;
            var content;
            var formatArgs = (_a = {},
                _a[dependents_1._ORIGIN] = datum,
                _a.element = element,
                _a.elementIndex = elementIndex,
                _a.mappingDatum = [].concat(element.getModel().mappingData)[0],
                _a.mappingDatumIndex = 0,
                _a);
            if (labelProps.formatter) {
                content = labelProps.formatter(xValue, formatArgs, index, yValue, datumTop[yField]);
            }
            else {
                if (compare) {
                    content = [0, 1].map(function () { return "" + yValue; }).join(props.transpose ? '\n\n' : '    ');
                }
                else {
                    content = xValue + " " + yValue;
                }
            }
            var label = _this._findLabelInContainerByIndex(labelsContainer, index, true);
            var ratio = compare ? compare.yValues[0] / (compare.yValues[0] + compare.yValues[1]) : 0.5;
            if (label) {
                label.attr(tslib_1.__assign(tslib_1.__assign({}, labelStyle), { x: lerp(minX, maxX, !props.transpose ? ratio : 0.5), y: lerp(minY, maxY, props.transpose ? ratio : 0.5), text: content }));
                label.set('adjustTimestamp', adjustTimestamp);
            }
        });
        labelsContainer.get('children').forEach(function (label) {
            if (label.get('adjustTimestamp') != adjustTimestamp) {
                label.attr({ opacity: 0 });
                labelsContainer.set(label.get('id'), null);
                setTimeout(function () { return label.remove(); });
            }
        });
    };
    FunnelLayer.prototype.fadeInLabels = function (targetShape, duration, callback) {
        var _this = this;
        var labelsContainer = this._getGeometry().labelsContainer;
        this._eachShape(function (shape, index) {
            if (!targetShape || targetShape == shape) {
                var label = _this._findLabelInContainerByIndex(labelsContainer, index);
                if (label) {
                    var shapeBBox = shape.getBBox();
                    var labelBBox = label.getBBox();
                    if (labelBBox.minX >= shapeBBox.minX &&
                        labelBBox.maxX <= shapeBBox.maxX &&
                        labelBBox.minY >= shapeBBox.minY &&
                        labelBBox.maxY <= shapeBBox.maxY) {
                        var attrs = {
                            opacity: 1,
                        };
                        duration ? label.animate(attrs, duration) : label.attr(attrs);
                    }
                }
            }
        });
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.fadeOutLabels = function (targetShape, duration, callback) {
        var _this = this;
        var labelsContainer = this._getGeometry().labelsContainer;
        this._eachShape(function (shape, index) {
            if (!targetShape || targetShape == shape) {
                var label = _this._findLabelInContainerByIndex(labelsContainer, index);
                if (label) {
                    var attrs = {
                        opacity: 0,
                    };
                    duration ? label.animate(attrs, duration) : label.attr(attrs);
                }
            }
        });
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.refreshLabels = function (callback) {
        var _this = this;
        var props = this.options;
        if (props.animation !== false) {
            var _a = this._calcRefreshFadeDurations(), fadeOutDuration = _a.fadeOutDuration, fadeInDuration_2 = _a.fadeInDuration;
            this._shouldResetLabels = false;
            this.fadeOutLabels(null, fadeOutDuration, function () {
                _this._shouldResetLabels = true;
                _this.resetLabels();
                _this.fadeInLabels(null, fadeInDuration_2, callback);
            });
        }
    };
    FunnelLayer.prototype._findLabelInContainerByIndex = function (container, index, createIfNotFound) {
        var _a;
        if (createIfNotFound === void 0) { createIfNotFound = false; }
        var props = this.options;
        var label;
        if (((_a = props.label) === null || _a === void 0 ? void 0 : _a.visible) === false) {
            return label;
        }
        var labelId = "_label-" + index;
        label = container.get(labelId);
        if (!label && createIfNotFound) {
            label = container.addShape({
                id: labelId,
                type: 'text',
                attrs: {},
            });
            container.set(labelId, label);
        }
        return label;
    };
    FunnelLayer.prototype.resetCompareTexts = function () {
        if (!this._shouldResetCompareTexts)
            return;
        var props = this.options;
        var shapeParentBBox;
        var compare;
        this._eachShape(function (shape, index, datum) {
            if (index == 0) {
                shapeParentBBox = shape.get('parent').getBBox();
                compare = util_1.get(datum, '__compare__');
            }
        });
        if (shapeParentBBox && compare && util_1.get(props, 'compareText.visible') !== false) {
            var container_1 = this._findCompareTextContainer(true);
            var yValuesMax_1 = compare.yValuesMax, compareValues_1 = compare.compareValues;
            var minX_1 = shapeParentBBox.minX, maxX_1 = shapeParentBBox.maxX, minY_1 = shapeParentBBox.minY, maxY_1 = shapeParentBBox.maxY;
            var compareTexts_1 = container_1.get('children');
            [0, 1].forEach(function (i) {
                var compareText = compareTexts_1[i];
                if (!compareText) {
                    compareText = container_1.addShape({ type: 'text' });
                }
                compareText.attr(util_1.deepMix({}, util_1.get(props, 'compareText.style'), {
                    text: props.transpose ? compareValues_1[i] : i ? "  " + compareValues_1[i] : compareValues_1[i] + "  ",
                    x: props.transpose
                        ? minX_1 + util_1.get(props, 'compareText.offsetX')
                        : lerp(minX_1, maxX_1, yValuesMax_1[0] / (yValuesMax_1[0] + yValuesMax_1[1])),
                    y: props.transpose
                        ? lerp(minY_1, maxY_1, yValuesMax_1[0] / (yValuesMax_1[0] + yValuesMax_1[1])) + (i ? 8 : -8)
                        : minY_1 + util_1.get(props, 'compareText.offsetY'),
                    opacity: 0,
                    textAlign: props.transpose ? 'right' : i ? 'left' : 'right',
                    textBaseline: props.transpose ? (i ? 'top' : 'bottom') : 'bottom',
                }));
            });
        }
    };
    FunnelLayer.prototype.fadeInCompareTexts = function (duration, callback) {
        var container = this._findCompareTextContainer();
        if (container) {
            var compareTexts_2 = container.get('children');
            [0, 1].forEach(function (i) {
                var compareText = compareTexts_2[i];
                if (compareText) {
                    var attrs = {
                        opacity: 1,
                    };
                    duration ? compareText.animate(attrs, duration) : compareText.attr(attrs);
                }
            });
        }
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.fadeOutCompareTexts = function (duration, callback) {
        var container = this._findCompareTextContainer();
        if (container) {
            var compareTexts_3 = container.get('children');
            [0, 1].forEach(function (i) {
                var compareText = compareTexts_3[i];
                if (compareText) {
                    var attrs = {
                        opacity: 0,
                    };
                    duration ? compareText.animate(attrs, duration) : compareText.attr(attrs);
                }
            });
        }
        duration && callback && setTimeout(callback, duration);
    };
    FunnelLayer.prototype.refreshCompareTexts = function (callback) {
        var _this = this;
        var props = this.options;
        if (props.animation !== false) {
            var _a = this._calcRefreshFadeDurations(), fadeInDuration_3 = _a.fadeInDuration, fadeOutDuration = _a.fadeOutDuration;
            this._shouldResetCompareTexts = false;
            this.fadeOutCompareTexts(fadeOutDuration, function () {
                _this._shouldResetCompareTexts = true;
                _this.resetCompareTexts();
                _this.fadeInCompareTexts(fadeInDuration_3, callback);
            });
        }
    };
    FunnelLayer.prototype._findCompareTextContainer = function (createIfNotFound) {
        if (createIfNotFound === void 0) { createIfNotFound = false; }
        var middleGroup = this.view.middleGroup;
        var compareTextContainer = middleGroup.get('compareTextContainer');
        if (!compareTextContainer && createIfNotFound) {
            compareTextContainer = middleGroup.addGroup();
            middleGroup.set('compareTextContainer', compareTextContainer);
        }
        return compareTextContainer;
    };
    FunnelLayer.prototype._eachShape = function (fn) {
        var _a;
        var data = this._findCheckedData(this.getData());
        var dataLen = data.length;
        var index = 0;
        var datumUpper;
        (_a = this._getGeometry()) === null || _a === void 0 ? void 0 : _a.elements.forEach(function (element, elementIndex) {
            var shape = element.shape;
            var datumLower = data[index];
            if (index < dataLen) {
                fn(shape, index, datumLower, datumUpper, elementIndex);
            }
            datumUpper = datumLower;
            index++;
        });
    };
    FunnelLayer.prototype._getGeometry = function () {
        return this.view.geometries[0];
    };
    FunnelLayer.prototype._getAdjustedTextFillByShape = function (shape) {
        var shapeColor = shape.attr('fill');
        var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
        var rgb = color_1.rgb2arr(shapeColor);
        var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
        var colorBand = [
            { from: 0, to: 85, color: 'white' },
            { from: 85, to: 170, color: '#F6F6F6' },
            { from: 170, to: 255, color: 'black' },
        ];
        var reflect = color_1.mappingColor(colorBand, gray);
        return reflect;
    };
    FunnelLayer.prototype._genCustomFieldForDynamicHeight = function (data) {
        var props = this.options;
        var total = data.reduce(function (total, datum) { return total + datum[props.yField]; }, 0);
        var ratioUpper = 1;
        data.forEach(function (datum, index) {
            var value = datum[props.yField];
            var share = value / total;
            var ratioLower = ratioUpper - share;
            datum['__custom__'] = {
                datumIndex: index,
                dataLength: data.length,
                ratioUpper: ratioUpper,
                ratioLower: ratioLower,
                reverse: props.transpose,
            };
            ratioUpper = ratioLower;
        });
    };
    FunnelLayer.prototype._findCheckedDataByMouseDownLegendItem = function (legendItem) {
        var flags = legendItem
            .get('parent')
            .get('children')
            .map(function (legendItem) { return !legendItem.get('unchecked'); });
        var data = this.getData().filter(function (datum, index) { return flags[index]; });
        return data;
    };
    FunnelLayer.prototype._findCheckedDataInNewData = function (newData) {
        var props = this.options;
        // @ts-ignore
        var legendContainer = this.view.getController('legend').container;
        var uncheckedXValues = legendContainer
            .findAll(function (shape) { return shape.get('name') == 'legend-item'; })
            .filter(function (legendItem) { return legendItem.get('unchecked'); })
            .map(function (legendItem) { return legendItem.get('id').replace('-legend-item-', ''); });
        var checkedData = newData.filter(function (datum) { return !util_1.contains(uncheckedXValues, datum[props.xField]); });
        return checkedData;
    };
    FunnelLayer.prototype._findCheckedData = function (data) {
        var _a;
        var props = this.options;
        if ((_a = props.legend) === null || _a === void 0 ? void 0 : _a.visible) {
            // @ts-ignore
            var legendContainer = this.view.getController('legend').container;
            var checkedXValues_1 = legendContainer
                .findAll(function (shape) { return shape.get('name') == 'legend-item'; })
                .filter(function (legendItem) { return !legendItem.get('unchecked'); })
                .map(function (legendItem) { return legendItem.get('id').replace('-legend-item-', ''); });
            var checkedData = data.filter(function (datum) { return util_1.contains(checkedXValues_1, datum[props.xField]); });
            return checkedData;
        }
        else {
            return this.processData(props.data);
        }
    };
    FunnelLayer.prototype._reduceDataForCompare = function (data) {
        var props = this.options;
        var compareValueFirstVisited;
        var yValuesMax = [-Infinity, -Infinity];
        data = data.reduce(function (newData, datum) {
            var _a;
            var xValue = datum[props.xField];
            var yValue = datum[props.yField];
            var compareValue = datum[props.compareField];
            if (!compareValueFirstVisited)
                compareValueFirstVisited = compareValue;
            var newDatum = newData.find(function (newDatum) { return newDatum[props.xField] == xValue; });
            if (!newDatum) {
                newDatum = (_a = {},
                    _a[props.xField] = xValue,
                    _a[props.yField] = 0,
                    _a['__compare__'] = {
                        compareValues: [],
                        yValues: [],
                        yValuesMax: [],
                        yValuesNext: undefined,
                        transpose: props.transpose,
                    },
                    _a);
                newData.push(newDatum);
            }
            var idx = compareValue == compareValueFirstVisited ? 0 : 1;
            newDatum['__compare__'].yValues[idx] = yValue;
            if (yValuesMax[idx] < yValue) {
                yValuesMax[idx] = yValue;
            }
            newDatum['__compare__'].compareValues[idx] = compareValue;
            return newData;
        }, []);
        data.forEach(function (datum, index) {
            datum[props.yField] = util_1.get(datum, '__compare__.yValues', []).reduce(function (yTotal, yValue) { return (yTotal += yValue); }, 0);
            util_1.set(datum, '__compare__.yValuesMax', yValuesMax);
            util_1.set(datum, '__compare__.yValuesNext', util_1.get(data, index + 1 + ".__compare__.yValues"));
        });
        return data;
    };
    FunnelLayer.prototype._updateDataForCompare = function (data) {
        var yValuesMax = [-Infinity, -Infinity];
        data.forEach(function (datum) {
            var yValues = util_1.get(datum, '__compare__.yValues');
            [0, 1].forEach(function (i) {
                if (yValues[i] > yValuesMax[i]) {
                    yValuesMax[i] = yValues[i];
                }
            });
        });
        data.forEach(function (datum, index) {
            util_1.set(datum, '__compare__.yValuesMax', yValuesMax);
            util_1.set(datum, '__compare__.yValuesNext', util_1.get(data, index + 1 + ".__compare__.yValues"));
        });
    };
    return FunnelLayer;
}(view_layer_1.default));
exports.default = FunnelLayer;
global_1.registerPlotType('funnel', FunnelLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../dependents":425,"../../geoms/factory":430,"../../util/color":673,"./animation/funnel-scale-in-x":517,"./animation/funnel-scale-in-y":518,"./geometry/shape/funnel-basic-rect":519,"./geometry/shape/funnel-dynamic-rect":520,"./theme":523,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],523:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var BAR_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var BAR_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
theme_1.registerTheme('funnel', {
    columnStyle: {
        normal: {},
        active: BAR_ACTIVE_STYLE,
        disable: BAR_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: 'black' },
    },
});

},{"../../theme":669}],524:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    range: 'point',
    statistic: 'annotation-text',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],525:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GaugeShape = void 0;
var tslib_1 = require("tslib");
/**
 * @author linhuiw
 * @description 仪表盘形状
 */
var util_1 = require("@antv/util");
var g2_1 = require("@antv/g2");
var theme_1 = require("../../../../theme");
var common_1 = require("../../../../util/common");
/**
 * 仪表盘指针图形
 * 指针主体由梯形和一大一小圆形组成，
 * 中心处由灰色圆底和小白圆加以装饰
 */
var GaugeShape = /** @class */ (function () {
    function GaugeShape(uid) {
        this.uid = uid;
    }
    GaugeShape.prototype.setOption = function (type, options) {
        this.type = type;
        this.options = options;
        this.axis = options.axis;
        this.pivot = options.pivot;
    };
    GaugeShape.prototype.render = function () {
        var Gauge = this; // eslint-disable-line @typescript-eslint/no-this-alias
        g2_1.registerShape('point', 'gauge', {
            draw: function (cfg, group) {
                var _a, _b, _c;
                this.gauge = {};
                this.gauge.options = Gauge.options;
                this.gauge.axis = Gauge.axis;
                this.gauge.pivot = Gauge.pivot;
                this.gauge.type = Gauge.type;
                var gauge = this.gauge;
                var type = this.gauge.type;
                var point = cfg.points[0];
                var center = this.parsePoint({
                    x: 0,
                    y: 0,
                });
                var target = this.parsePoint({
                    x: point.x || 0,
                    y: 1,
                });
                gauge.center = center;
                gauge.group = group;
                var r = { x: center.x - target.x, y: center.y - target.y };
                this.gauge.ringRadius = Math.sqrt(r.x * r.x + r.y * r.y);
                var _d = this.getAngleRange(), starAngle = _d.starAngle, endAngle = _d.endAngle;
                var currentAngle = point.x * (endAngle - starAngle) + starAngle;
                switch (type) {
                    case 'meterGauge':
                        this.drawBarGauge(currentAngle);
                        if (this.gauge.axis.visible && ((_a = this.gauge.axis.tickLine) === null || _a === void 0 ? void 0 : _a.visible)) {
                            this.drawInSideAxis();
                        }
                        break;
                    case 'fanGauge':
                        this.drawGauge(currentAngle);
                        if (this.gauge.axis.visible && ((_b = this.gauge.axis.tickLine) === null || _b === void 0 ? void 0 : _b.visible)) {
                            this.drawOutSideAxis();
                        }
                        break;
                    case 'standardGauge':
                    default:
                        this.drawGauge(currentAngle);
                        if (this.gauge.axis.visible && ((_c = this.gauge.axis.tickLine) === null || _c === void 0 ? void 0 : _c.visible)) {
                            this.drawAxis();
                        }
                        break;
                }
                // 绘制指针
                if (this.gauge.pivot.visible) {
                    this.drawPivot(cfg, group);
                }
            },
            drawGauge: function (currentAngle) {
                var range = this.gauge.options.range;
                this.drawBottomRing(); // 绘制灰底色
                if (range && range.length) {
                    this.drawRangeColor();
                }
                else {
                    this.drawCurrentRing(currentAngle);
                }
            },
            drawRangeColor: function () {
                var _a = this.gauge.options, min = _a.min, max = _a.max, range = _a.range, color = _a.color, rangeStyle = _a.rangeStyle;
                var colors = color || theme_1.getGlobalTheme().colors;
                var _b = this.getAngleRange(), starAngle = _b.starAngle, endAngle = _b.endAngle;
                var config = {
                    min: min,
                    max: max,
                    starAngle: starAngle,
                    endAngle: endAngle,
                };
                for (var i = 0; i < range.length; i++) {
                    var start = this.valueToAngle(range[i], config);
                    var end = this.valueToAngle(range[i + 1], config);
                    if (end >= start) {
                        var path2 = this.getPath(start, end);
                        var style = util_1.deepMix({ fill: colors[i] }, rangeStyle);
                        this.drawRing(path2, style);
                    }
                }
            },
            drawBottomRing: function () {
                var _a = this.getAngleRange(), starAngle = _a.starAngle, endAngle = _a.endAngle;
                var backgroundStyle = this.gauge.options.rangeBackgroundStyle;
                var path = this.getPath(starAngle, endAngle);
                this.drawRing(path, backgroundStyle);
            },
            drawCurrentRing: function (current) {
                var starAngle = this.getAngleRange().starAngle;
                var rangeStyle = this.gauge.rangeStyle;
                var path3 = this.getPath(starAngle, current);
                this.drawRing(path3, rangeStyle);
            },
            drawInSideAxis: function () {
                var _a = this.gauge.options, min = _a.min, max = _a.max, axis = _a.axis;
                var _b = this.getAngleRange(), starAngle = _b.starAngle, endAngle = _b.endAngle;
                var config = {
                    min: min,
                    max: max,
                    starAngle: starAngle,
                    endAngle: endAngle,
                };
                var interval = (max - min) / axis.tickCount;
                for (var i = 0; i < axis.tickCount; i++) {
                    var startValue = min + i * interval;
                    var angle = this.valueToAngle(startValue + interval / 2, config);
                    this.drawRect(angle, {
                        length: axis.tickLine.length,
                        style: axis.tickLine.style,
                    });
                }
            },
            drawAxis: function () {
                var axis = this.gauge.axis;
                var _a = this.gauge.options, min = _a.min, max = _a.max;
                var _b = this.getAngleRange(), starAngle = _b.starAngle, endAngle = _b.endAngle;
                var config = {
                    min: min,
                    max: max,
                    starAngle: starAngle,
                    endAngle: endAngle,
                };
                var interval = (max - min) / (axis.tickCount - 1);
                for (var i = 0; i < axis.tickCount; i++) {
                    var startValue = min + i * interval;
                    var angle = this.valueToAngle(startValue, config);
                    var tickLineStyle = util_1.clone(axis.tickLine.style);
                    if (i % 5 !== 0) {
                        tickLineStyle.lineWidth = tickLineStyle.lineWidth / 2;
                    }
                    this.drawRect(angle, {
                        length: i % 5 === 0 ? axis.tickLine.length : axis.tickLine.length / 2,
                        style: tickLineStyle,
                    });
                }
            },
            drawOutSideAxis: function () {
                var axis = this.gauge.axis;
                var _a = this.gauge.options, min = _a.min, max = _a.max;
                var _b = this.getAngleRange(), starAngle = _b.starAngle, endAngle = _b.endAngle;
                var config = {
                    min: min,
                    max: max,
                    starAngle: starAngle,
                    endAngle: endAngle,
                };
                var interval = (max - min) / (axis.tickCount - 1);
                for (var i = 0; i < axis.tickCount; i++) {
                    var startValue = min + i * interval;
                    var angle = this.valueToAngle(startValue, config);
                    this.drawRect(angle, {
                        length: axis.tickLine.length,
                        style: axis.tickLine.style,
                    });
                }
            },
            drawBarGauge: function (current) {
                var _this = this;
                var _a = this.gauge.options, min = _a.min, max = _a.max, range = _a.range, color = _a.color, rangeStyle = _a.rangeStyle, rangeBackgroundStyle = _a.rangeBackgroundStyle;
                var colors = color || theme_1.getGlobalTheme().colors;
                var _b = this.getAngleRange(), starAngle = _b.starAngle, endAngle = _b.endAngle;
                var config = {
                    min: min,
                    max: max,
                    starAngle: starAngle,
                    endAngle: endAngle,
                };
                var interval = (endAngle - starAngle) / (50 - 1);
                var offset = interval / 3;
                // 由50个柱子组成
                for (var i = 0; i < 50; i++) {
                    var start = starAngle + i * interval;
                    var path2 = this.getPath(start - offset / 2, start + offset - offset / 2);
                    var style = rangeBackgroundStyle;
                    if (range && range.length) {
                        var result1 = range.map(function (item) {
                            return _this.valueToAngle(item, config);
                        });
                        var index = common_1.sortedLastIndex(result1, start);
                        /** 最后一个值也在最后一个区间内 */
                        var colorIndex = Math.min(index, range.length - 1);
                        style = util_1.deepMix({}, { fill: colors[colorIndex - 1] }, rangeStyle) || rangeBackgroundStyle;
                    }
                    else {
                        style = current >= start ? util_1.deepMix({}, { fill: color }, rangeStyle) : rangeBackgroundStyle;
                    }
                    this.drawRing(path2, style);
                }
            },
            getAngleRange: function () {
                var angle = this.gauge.options.angle;
                var angleValue = 90 - (360 - angle) * 0.5;
                var starAngle = ((270 - 90 - angleValue) * Math.PI) / 180;
                var endAngle = ((270 + 90 + angleValue) * Math.PI) / 180;
                return { starAngle: starAngle, endAngle: endAngle };
            },
            valueToAngle: function (value, config) {
                var min = config.min, max = config.max, starAngle = config.starAngle, endAngle = config.endAngle;
                if (value === max) {
                    return endAngle;
                }
                if (value === min) {
                    return starAngle;
                }
                var ratio = (value - min) / (max - min);
                if (max === min) {
                    ratio = 1;
                }
                var angle = ratio * (endAngle - starAngle) + starAngle;
                angle = Math.max(angle, starAngle);
                angle = Math.min(angle, endAngle);
                return angle;
            },
            drawRing: function (path, style) {
                this.gauge.group.addShape('path', {
                    attrs: util_1.deepMix({}, {
                        path: path,
                    }, style),
                });
            },
            drawRect: function (angle, param) {
                var axis = this.gauge.axis;
                var config = tslib_1.__assign(tslib_1.__assign({}, axis), param);
                var offset = config.offset, length = config.length;
                var center = this.gauge.center;
                var radius;
                if (offset < 0) {
                    radius = this.gauge.ringRadius - this.gauge.options.rangeSize + offset;
                }
                else {
                    radius = this.gauge.ringRadius + offset;
                }
                var xA1 = radius * Math.cos(angle) + center.x;
                var yA1 = radius * Math.sin(angle) + center.y;
                var xB1 = (radius + length) * Math.cos(angle) + center.x;
                var yB1 = (radius + length) * Math.sin(angle) + center.y;
                var line = this.gauge.group.addShape('line', {
                    attrs: util_1.deepMix({}, {
                        x1: xA1,
                        y1: yA1,
                        x2: xB1,
                        y2: yB1,
                    }, param.style),
                });
                line.set('name', 'axis-tickLine');
            },
            getPath: function (starAngle, endAngle) {
                /* const type = this.gauge.type;
                const height = get(gauge, 'options.height');
                const width = get(gauge, 'options.width');*/
                var center = this.gauge.center;
                var length = this.gauge.ringRadius;
                /*let thick;
                 const { minThickness, minThickCanvsSize } = this.gauge.ringStyle;
                const size = Math.min(width, height);
                if (type === 'fan' && size < minThickCanvsSize) {
                  thick = length - minThickness;
                } else {*/
                var thick = this.gauge.options.rangeSize;
                //}
                var xA1 = length * Math.cos(starAngle) + center.x;
                var yA1 = length * Math.sin(starAngle) + center.y;
                var xA2 = (length - thick) * Math.cos(starAngle) + center.x;
                var yA2 = (length - thick) * Math.sin(starAngle) + center.y;
                var xB1 = length * Math.cos(endAngle) + center.x;
                var yB1 = length * Math.sin(endAngle) + center.y;
                var xB2 = (length - thick) * Math.cos(endAngle) + center.x;
                var yB2 = (length - thick) * Math.sin(endAngle) + center.y;
                var largeArcFlag = Math.abs(starAngle - endAngle) > Math.PI ? 1 : 0;
                return [
                    ['M', xA1, yA1],
                    ['A', length, length, 0, largeArcFlag, 1, xB1, yB1],
                    ['L', xB2, yB2],
                    ['A', length - thick, length - thick, 0, largeArcFlag, 0, xA2, yA2],
                    ['Z'],
                ];
            },
            drawPivot: function (cfg) {
                var _a = this.getAngleRange(), starAngle = _a.starAngle, endAngle = _a.endAngle;
                var _b = this.gauge.options, radius = _b.radius, rangeSize = _b.rangeSize;
                var pivotConfig = this.gauge.pivot;
                var bigCircle = pivotConfig.thickness;
                var smCircle = pivotConfig.thickness / 2.5;
                var group = this.gauge.group;
                var point = cfg.points[0];
                var center = this.parsePoint({
                    x: 0,
                    y: 0,
                });
                // radius
                var current = point.x * (endAngle - starAngle) + starAngle;
                var x = (this.gauge.ringRadius - rangeSize) * radius * Math.cos(current) + this.gauge.center.x;
                var y = (this.gauge.ringRadius - rangeSize) * radius * Math.sin(current) + this.gauge.center.y;
                var target = {
                    x: x,
                    y: y,
                };
                // 外底色灰圆
                if (pivotConfig.base.visible) {
                    group.addShape('circle', {
                        attrs: util_1.deepMix({}, {
                            x: center.x,
                            y: center.y,
                            r: pivotConfig.base.size ? pivotConfig.base.size / 2 : bigCircle * 2.2,
                        }, pivotConfig.base.style),
                    });
                }
                // 指针
                if (pivotConfig.pointer.visible) {
                    var dirVec = { x: center.x - target.x, y: center.y - target.y };
                    var length_1 = Math.sqrt(dirVec.x * dirVec.x + dirVec.y * dirVec.y);
                    dirVec.x *= 1 / length_1;
                    dirVec.y *= 1 / length_1;
                    var angle1 = -Math.PI / 2;
                    var x1 = Math.cos(angle1) * dirVec.x - Math.sin(angle1) * dirVec.y;
                    var y1 = Math.sin(angle1) * dirVec.x + Math.cos(angle1) * dirVec.y;
                    var angle2 = Math.PI / 2;
                    var x2 = Math.cos(angle2) * dirVec.x - Math.sin(angle2) * dirVec.y;
                    var y2 = Math.sin(angle2) * dirVec.x + Math.cos(angle2) * dirVec.y;
                    var path = [
                        ['M', target.x + x1 * smCircle, target.y + y1 * smCircle],
                        ['L', center.x + x1 * bigCircle, center.y + y1 * bigCircle],
                        ['L', center.x + x2 * bigCircle, center.y + y2 * bigCircle],
                        ['L', target.x + x2 * smCircle, target.y + y2 * smCircle],
                        ['Z'],
                    ];
                    group.addShape('path', {
                        attrs: util_1.deepMix({}, {
                            path: path,
                        }, pivotConfig.pointer.style),
                    });
                    group.addShape('circle', {
                        attrs: {
                            x: target.x,
                            y: target.y,
                            r: smCircle,
                            fill: pivotConfig.pointer.style.fill,
                        },
                    });
                    group.addShape('circle', {
                        attrs: {
                            x: center.x,
                            y: center.y,
                            r: bigCircle,
                            fill: pivotConfig.pointer.style.fill,
                        },
                    });
                }
                if (pivotConfig.pin.visible) {
                    // 内部白色小圆
                    group.addShape('circle', {
                        attrs: util_1.deepMix({}, {
                            x: center.x,
                            y: center.y,
                            r: smCircle / 1.2,
                        }, pivotConfig.pin.style),
                    });
                }
            },
        });
    };
    return GaugeShape;
}());
exports.GaugeShape = GaugeShape;

},{"../../../../theme":669,"../../../../util/common":674,"@antv/g2":309,"@antv/util":803,"tslib":894}],526:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Gauge = /** @class */ (function (_super) {
    tslib_1.__extends(Gauge, _super);
    function Gauge() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Gauge.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'gauge';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Gauge.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Gauge;
}(plot_1.default));
exports.default = Gauge;

},{"../../base/plot":394,"./layer":527,"@antv/util":803,"tslib":894}],527:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * @author linhuiw
 * @description 仪表盘 layer
 */
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var scale_1 = require("../../util/scale");
var gauge_shape_1 = require("./geometry/shape/gauge-shape");
var EventParser = tslib_1.__importStar(require("./event"));
var GaugeLayer = /** @class */ (function (_super) {
    tslib_1.__extends(GaugeLayer, _super);
    function GaugeLayer(props) {
        var _this = _super.call(this, props) || this;
        _this.type = 'gauge';
        return _this;
    }
    GaugeLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            startAngle: -7 / 6,
            endAngle: 1 / 6,
            rangeBackgroundStyle: {
                fill: '#f0f0f0',
            },
            rangeSize: 24,
            statistic: {
                position: ['50%', '80%'],
            },
            axis: {
                visible: true,
                offset: -10,
                tickCount: 21,
                subTickCount: 4,
                tickLine: {
                    visible: true,
                    length: 5,
                    style: {
                        stroke: '#aaa',
                        lineWidth: 2,
                    },
                },
                label: {
                    visible: true,
                    offset: 8,
                    style: {
                        fill: '#aaa',
                        fontSize: 16,
                        textAlign: 'center',
                        textBaseline: 'middle',
                    },
                },
            },
            pivot: {
                visible: true,
                thickness: 6,
                pin: {
                    visible: true,
                    size: 2,
                    style: {
                        fill: '#2E364B',
                    },
                },
                base: {
                    visible: true,
                    style: {
                        fill: '#EEEEEE',
                    },
                },
                pointer: {
                    visible: true,
                    style: {
                        fill: '#CFCFCF',
                    },
                },
            },
        });
    };
    GaugeLayer.prototype.init = function () {
        var _a = this.options, value = _a.value, range = _a.range;
        var rangeSorted = (range || []).map(function (d) { return +d; }).sort(function (a, b) { return a - b; });
        var _b = this.options, _c = _b.min, min = _c === void 0 ? rangeSorted[0] : _c, _d = _b.max, max = _d === void 0 ? rangeSorted[rangeSorted.length - 1] : _d, _e = _b.format, format = _e === void 0 ? function (d) { return "" + d; } : _e;
        var valueText = format(value);
        //const styleMix = this.getStyleMix();
        //this.options.styleMix = styleMix;
        this.options.data = [{ value: value || 0 }];
        this.options.valueText = valueText;
        this.options.min = min;
        this.options.max = max;
        this.options.format = format;
        this.initG2Shape();
        _super.prototype.init.call(this);
    };
    /**
     * 绘制指针
     */
    GaugeLayer.prototype.initG2Shape = function () {
        this.gaugeShape = new gauge_shape_1.GaugeShape(util_1.uniqueId());
        this.gaugeShape.setOption(this.type, util_1.deepMix({}, this.options, {
            radius: 0.6,
            angle: 240,
            textPosition: '100%',
        }));
        this.gaugeShape.render();
    };
    GaugeLayer.prototype.geometryParser = function () {
        return 'gauge';
    };
    GaugeLayer.prototype.scale = function () {
        var _a = this.options, min = _a.min, max = _a.max, format = _a.format;
        var scales = {
            value: {},
        };
        scale_1.extractScale(scales.value, {
            min: min,
            max: max,
            minLimit: min,
            maxLimit: max,
            nice: true,
            formatter: format,
            // 自定义 tick step
            tickInterval: 20,
        });
        // @ts-ignore
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    GaugeLayer.prototype.coord = function () {
        var coordConfig = {
            type: 'polar',
            cfg: {
                radius: 1,
                startAngle: this.options.startAngle * Math.PI,
                endAngle: this.options.endAngle * Math.PI,
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    GaugeLayer.prototype.axis = function () {
        var axis = this.options.axis;
        var axesConfig = {
            value: {
                line: null,
                grid: null,
                tickLine: null,
            },
        };
        var offsetValue;
        if (axis.offset < 0) {
            offsetValue = axis.offset - this.options.rangeSize - axis.tickLine.length - axis.label.offset;
        }
        else {
            offsetValue = axis.offset + axis.tickLine.length + axis.label.offset;
        }
        if (axis.label.visible) {
            axesConfig.value.label = {
                offset: offsetValue,
                textStyle: axis.label.style,
                autoRotate: true,
            };
        }
        else {
            axesConfig.value.label = {
                style: {
                    opacity: 0,
                },
            };
        }
        axesConfig['1'] = false;
        axesConfig['value'] = axis.visible ? axesConfig['value'] : false;
        this.setConfig('axes', axesConfig);
    };
    GaugeLayer.prototype.addGeometry = function () {
        var pointerColor = this.options.pivot.pointer.style.fill || this.theme.defaultColor;
        var pointer = {
            type: 'point',
            position: {
                fields: ['value', '1'],
            },
            shape: {
                values: ['gauge'],
            },
            color: {
                values: [pointerColor],
            },
        };
        this.setConfig('geometry', pointer);
    };
    GaugeLayer.prototype.annotation = function () {
        var statistic = this.options.statistic;
        var annotationConfigs = [];
        // @ts-ignore
        if (statistic && statistic.visible) {
            var statistics = this.renderStatistic();
            annotationConfigs.push(statistics);
        }
        this.setConfig('annotations', annotationConfigs);
    };
    GaugeLayer.prototype.renderStatistic = function () {
        var containerSize = Math.max(this.options.width, this.options.height) / 20;
        var statistic = this.options.statistic;
        var text = {
            type: 'text',
            content: statistic.text,
            top: true,
            position: statistic.position,
            style: {
                fill: statistic.color,
                fontSize: statistic.size ? statistic.size : containerSize * 1.2,
                textAlign: 'center',
                textBaseline: 'middle',
            },
        };
        return text;
    };
    GaugeLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return GaugeLayer;
}(view_layer_1.default));
exports.default = GaugeLayer;
global_1.registerPlotType('gauge', GaugeLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../util/scale":712,"./event":524,"./geometry/shape/gauge-shape":525,"@antv/util":803,"tslib":894}],528:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var GroupedBar = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedBar, _super);
    function GroupedBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupedBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedBar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    GroupedBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupedBar;
}(plot_1.default));
exports.default = GroupedBar;

},{"../../base/plot":394,"./layer":529,"@antv/util":803,"tslib":894}],529:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../bar/layer"));
require("./theme");
var GroupedBarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedBarLayer, _super);
    function GroupedBarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'groupedBar';
        _this.baseType = 'bar';
        return _this;
    }
    GroupedBarLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                grid: {
                    visible: true,
                },
            },
            yAxis: {
                visible: true,
                title: {
                    visible: false,
                },
            },
            label: {
                visible: true,
                position: 'right',
                adjustColor: true,
            },
            legend: {
                visible: true,
                position: 'right-top',
                offsetY: 0,
            },
        });
    };
    GroupedBarLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        var names = util_1.valuesOfKey(this.options.data, this.options.groupField) || [];
        this.view.on('tooltip:change', function (e) {
            var _a = e.items, items = _a === void 0 ? [] : _a;
            var fixedItems = util_1.sortBy(items.slice(), function (item) {
                return names.indexOf(item.name);
            }).reverse();
            fixedItems.forEach(function (item, idx) {
                e.items[idx] = item;
            });
        });
    };
    GroupedBarLayer.prototype.getColorScale = function () {
        var groupField = this.options.groupField;
        if (groupField) {
            return this.view.getScaleByField(groupField);
        }
    };
    GroupedBarLayer.prototype.scale = function () {
        var defaultMeta = {};
        defaultMeta[this.options.groupField] = {
            values: util_1.valuesOfKey(this.options.data, this.options.groupField),
        };
        if (!this.options.meta) {
            this.options.meta = defaultMeta;
        }
        else {
            this.options.meta = util_1.deepMix({}, this.options.meta, defaultMeta);
        }
        _super.prototype.scale.call(this);
    };
    GroupedBarLayer.prototype.adjustBar = function (bar) {
        bar.adjust = [
            {
                type: 'dodge',
                marginRatio: 0.1,
            },
        ];
    };
    GroupedBarLayer.prototype.geometryTooltip = function () {
        this.bar.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.bar.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.bar.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.bar.tooltip.fields = [this.options.xField, this.options.yField, this.options.groupField];
            }
        }
    };
    return GroupedBarLayer;
}(layer_1.default));
exports.default = GroupedBarLayer;
global_1.registerPlotType('groupedBar', GroupedBarLayer);

},{"../../base/global":392,"../bar/layer":464,"./theme":530,"@antv/util":803,"tslib":894}],530:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var theme_2 = require("../bar/theme");
theme_1.registerTheme('groupedBar', theme_2.DEFAULT_BAR_THEME);

},{"../../theme":669,"../bar/theme":465}],531:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var GroupedColumn = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedColumn, _super);
    function GroupedColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupedColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedColumn';
        _super.prototype.createLayers.call(this, layerProps);
    };
    GroupedColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupedColumn;
}(plot_1.default));
exports.default = GroupedColumn;

},{"../../base/plot":394,"./layer":532,"@antv/util":803,"tslib":894}],532:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../column/layer"));
require("./theme");
var GroupedColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedColumnLayer, _super);
    function GroupedColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.baseType = 'column';
        _this.type = 'groupedColumn';
        return _this;
    }
    GroupedColumnLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            yAxis: {
                title: {
                    visible: true,
                },
            },
        });
    };
    GroupedColumnLayer.prototype.getResponsiveTheme = function () {
        return this.themeController.getResponsiveTheme('column');
    };
    GroupedColumnLayer.prototype.getColorScale = function () {
        var groupField = this.options.groupField;
        if (groupField) {
            return this.view.getScaleByField(groupField);
        }
    };
    GroupedColumnLayer.prototype.addGeometry = function () {
        _super.prototype.addGeometry.call(this);
    };
    GroupedColumnLayer.prototype.adjustColumn = function (column) {
        column.adjust = [
            {
                type: 'dodge',
                marginRatio: 0.1,
            },
        ];
    };
    GroupedColumnLayer.prototype.geometryTooltip = function () {
        this.column.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.column.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.column.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.column.tooltip.fields = [this.options.xField, this.options.yField, this.options.groupField];
            }
        }
    };
    return GroupedColumnLayer;
}(layer_1.default));
exports.default = GroupedColumnLayer;
global_1.registerPlotType('groupedColumn', GroupedColumnLayer);

},{"../../base/global":392,"../column/layer":490,"./theme":533,"@antv/util":803,"tslib":894}],533:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var theme_2 = require("../column/theme");
theme_1.registerTheme('groupedColumn', theme_2.DEFAULT_COLUMN_THEME);

},{"../../theme":669,"../column/theme":491}],534:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var GroupedRose = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedRose, _super);
    function GroupedRose() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupedRose.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'groupedRose';
        _super.prototype.createLayers.call(this, layerProps);
    };
    GroupedRose.getDefaultOptions = layer_1.default.getDefaultOptions;
    return GroupedRose;
}(plot_1.default));
exports.default = GroupedRose;

},{"../../base/plot":394,"./layer":535,"@antv/util":803,"tslib":894}],535:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../rose/layer"));
var GroupedRoseLayer = /** @class */ (function (_super) {
    tslib_1.__extends(GroupedRoseLayer, _super);
    function GroupedRoseLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'groupedRose';
        _this.baseType = 'rose';
        return _this;
    }
    GroupedRoseLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: true,
                    alignTick: false,
                    style: {
                        lineWidth: 0.5,
                    },
                },
                label: {
                    offset: 5,
                    autoRotate: true,
                },
            },
            yAxis: {
                visible: false,
            },
        });
    };
    GroupedRoseLayer.prototype.getColorScale = function () {
        var groupField = this.options.groupField;
        if (groupField) {
            return this.view.getScaleByField(groupField);
        }
    };
    GroupedRoseLayer.prototype.adjustRoseAdjust = function () {
        return [
            {
                type: 'dodge',
                marginRatio: 1,
            },
        ];
    };
    GroupedRoseLayer.prototype.geometryTooltip = function () {
        this.rose.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.rose.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.rose.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.rose.tooltip.fields = [this.options.radiusField, this.options.categoryField, this.options.groupField];
            }
        }
    };
    return GroupedRoseLayer;
}(layer_1.default));
exports.default = GroupedRoseLayer;
global_1.registerPlotType('groupedRose', GroupedRoseLayer);

},{"../../base/global":392,"../rose/layer":600,"@antv/util":803,"tslib":894}],536:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlotComponents = void 0;
var tslib_1 = require("tslib");
var label_1 = tslib_1.__importDefault(require("./label"));
var legend_1 = tslib_1.__importDefault(require("./legend"));
var ComponentsInfo = {
    label: { Ctr: label_1.default },
    legend: { Ctr: legend_1.default, padding: 'outer' },
};
function getPlotComponents(plot, type, cfg) {
    if (plot.options[type] && plot.options[type].visible) {
        var componentInfo = ComponentsInfo[type];
        var component = new componentInfo.Ctr(cfg);
        if (componentInfo.padding) {
            plot.paddingController.registerPadding(component, componentInfo.padding);
        }
        return component;
    }
}
exports.getPlotComponents = getPlotComponents;

},{"./label":537,"./legend":538,"tslib":894}],537:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var color_1 = require("../../../util/color");
var MatrixLabel = /** @class */ (function () {
    function MatrixLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        this.init();
    }
    MatrixLabel.prototype.init = function () {
        var _this = this;
        this.container = this.view.geometries[0].labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    MatrixLabel.prototype.render = function () {
        var _this = this;
        var elements = this.view.geometries[0].elements;
        util_1.each(elements, function (ele) {
            var shape = ele.shape;
            var _a = _this.options, style = _a.style, offsetX = _a.offsetX, offsetY = _a.offsetY;
            var formatter = _this.options.formatter;
            var content = formatter ? formatter(_this.getContent(shape)) : _this.getContent(shape);
            var position = _this.getPosition(shape);
            var color = _this.getTextColor(shape);
            var label = _this.container.addShape('text', {
                attrs: util_1.deepMix({}, style, {
                    x: position.x + offsetX,
                    y: position.y + offsetY,
                    text: content,
                    fill: color,
                    textAlign: 'center',
                    textBaseline: 'middle',
                }),
                name: 'label',
            });
            if (_this.options.adjustPosition) {
                _this.adjustLabel(label, shape);
            }
        });
    };
    MatrixLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    MatrixLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    MatrixLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    MatrixLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    MatrixLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    MatrixLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            offsetX: 0,
            offsetY: 0,
            style: util_1.clone(labelStyle),
        };
    };
    MatrixLabel.prototype.getContent = function (shape) {
        var data = shape.get('origin').data;
        var field = this.plot.options.colorField;
        return data[field];
    };
    MatrixLabel.prototype.getPosition = function (shape) {
        var bbox = shape.getBBox();
        return {
            x: bbox.minX + bbox.width / 2,
            y: bbox.minY + bbox.height / 2,
        };
    };
    MatrixLabel.prototype.getTextColor = function (shape) {
        if (this.options.adjustColor) {
            var shapeColor = shape.attr('fill');
            var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
            var rgb = color_1.rgb2arr(shapeColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
            var colorBand = [
                { from: 0, to: 85, color: 'white' },
                { from: 85, to: 170, color: '#F6F6F6' },
                { from: 170, to: 255, color: 'black' },
            ];
            var reflect = color_1.mappingColor(colorBand, gray);
            return reflect;
        }
        var defaultColor = this.options.style.fill;
        return defaultColor;
    };
    MatrixLabel.prototype.adjustLabel = function (label, shape) {
        var labelRange = label.getBBox();
        var shapeRange = shape.getBBox();
        if (labelRange.width > shapeRange.width || labelRange.height > shapeRange.height) {
            label.attr('text', '');
        }
    };
    return MatrixLabel;
}());
exports.default = MatrixLabel;

},{"../../../util/color":673,"@antv/util":803}],538:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var LABEL_MARGIN = 4;
var MatrixLegend = /** @class */ (function () {
    function MatrixLegend(cfg) {
        this.destroyed = false;
        this.dataSlides = {};
        this.interactiveEvents = {};
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix({}, defaultOptions, cfg);
        this.view = this.options.view;
        this.afterRender = true;
        this.init();
    }
    MatrixLegend.prototype.init = function () {
        var _this = this;
        this.layout = this.getLayout();
        this.width = this.options.width ? this.options.width : this.getDefaultWidth();
        this.height = this.options.height ? this.options.height : this.getDefaultHeight();
        var plotContainer = this.options.plot.container;
        if (this.container) {
            this.container.remove();
        }
        this.container = plotContainer.addGroup();
        this.view.on('beforerender', function () {
            _this.clear();
            _this.options.plot.canvas.draw();
        });
    };
    MatrixLegend.prototype.render = function () {
        var scales = this.view.geometries[0].scales;
        var colorField = this.options.plot.options.colorField;
        this.colorScale = scales[colorField];
        var _a = this.colorScale, min = _a.min, max = _a.max;
        var color = this.options.plot.options.color;
        if (this.layout === 'horizontal') {
            this.renderHorizontal(min, max, color);
        }
        else {
            this.renderVertical(min, max, color);
        }
        this.legendLayout();
        this.addInteraction();
    };
    MatrixLegend.prototype.hide = function () {
        this.container.set('visible', false);
        this.options.plot.canvas.draw();
    };
    MatrixLegend.prototype.show = function () {
        this.container.set('visible', true);
        this.options.plot.canvas.draw();
    };
    MatrixLegend.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    MatrixLegend.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.offEvent();
        this.destroyed = true;
    };
    MatrixLegend.prototype.getBBox = function () {
        var origin_bbox = this.container.getBBox();
        return new bbox_1.default(this.x, this.y, origin_bbox.width, origin_bbox.height);
    };
    MatrixLegend.prototype.renderVertical = function (min, max, colors) {
        var _this = this;
        var valueStep = (max - min) / (colors.length - 1);
        var colorStep = 1 / (colors.length - 1);
        var tickStep = this.height / (colors.length - 1);
        var gradientColor = 'l(90)';
        util_1.each(colors, function (c, index) {
            var stepNum = colorStep * index;
            gradientColor += stepNum + ":" + c + " ";
        });
        this.container.addShape('rect', {
            attrs: {
                x: 0,
                y: 0,
                width: this.width,
                height: this.height,
                fill: gradientColor,
            },
            name: 'legend',
        });
        // draw tick and label
        util_1.each(colors, function (c, index) {
            // tick
            var step = tickStep * index;
            _this.container.addShape('path', {
                attrs: tslib_1.__assign({ path: [
                        ['M', 0, step],
                        ['L', _this.width, step],
                    ] }, _this.options.ticklineStyle),
            });
            // value
            var value = Math.round(valueStep * index);
            _this.container.addShape('text', {
                attrs: tslib_1.__assign({ text: value, textAlign: 'left', textBaseline: 'middle', x: _this.width + LABEL_MARGIN, y: step }, _this.options.text.style),
                name: 'legend-label',
            });
        });
        //anchor
        var tri_width = 10;
        var tri_height = 14;
        var tri_path = [['M', -tri_width, -tri_height / 2], ['L', 0, 0], ['L', -tri_width, tri_height / 2], ['Z']];
        this.anchor = this.container.addShape('path', {
            attrs: tslib_1.__assign({ path: tri_path }, this.options.anchorStyle),
        });
        this.anchor.set('visible', false);
    };
    MatrixLegend.prototype.renderHorizontal = function (min, max, colors) {
        var _this = this;
        var valueStep = (max - min) / (colors.length - 1);
        var colorStep = 1 / (colors.length - 1);
        var tickStep = this.width / (colors.length - 1);
        var gradientColor = 'l(0)';
        util_1.each(colors, function (c, index) {
            var stepNum = colorStep * index;
            gradientColor += stepNum + ":" + c + " ";
        });
        this.container.addShape('rect', {
            attrs: {
                x: 0,
                y: 0,
                width: this.width,
                height: this.height,
                fill: gradientColor,
            },
            name: 'legend',
        });
        // draw tick and label
        util_1.each(colors, function (c, index) {
            // tick
            var step = tickStep * index;
            _this.container.addShape('path', {
                attrs: tslib_1.__assign({ path: [
                        ['M', step, 0],
                        ['L', step, _this.height],
                    ] }, _this.options.ticklineStyle),
                name: 'legend-label',
            });
            // value
            var value = Math.round(valueStep * index);
            _this.container.addShape('text', {
                attrs: tslib_1.__assign({ text: value, textAlign: 'center', textBaseline: 'top', x: step, y: _this.height + LABEL_MARGIN }, _this.options.text.style),
            });
        });
        //anchor
        var tri_width = 14;
        var tri_height = 10;
        var tri_path = [['M', 0, 0], ['L', -tri_width / 2, -tri_height], ['L', tri_width / 2, -tri_height], ['Z']];
        this.anchor = this.container.addShape('path', {
            attrs: tslib_1.__assign({ path: tri_path }, this.options.anchorStyle),
        });
        this.anchor.set('visible', false);
    };
    MatrixLegend.prototype.getLayout = function () {
        var positions = this.options.position.split('-');
        this.position = positions[0];
        if (positions[0] === 'left' || positions[0] === 'right') {
            return 'vertical';
        }
        return 'horizontal';
    };
    MatrixLegend.prototype.getDefaultWidth = function () {
        if (this.layout === 'horizontal') {
            var width = this.view.coordinateBBox.width;
            return width;
        }
        return 10;
    };
    MatrixLegend.prototype.getDefaultHeight = function () {
        if (this.layout === 'vertical') {
            var height = this.view.coordinateBBox.height;
            return height;
        }
        return 10;
    };
    MatrixLegend.prototype.legendLayout = function () {
        var _this = this;
        var panelRange = this.view.coordinateBBox;
        var bleeding = this.options.plot.getPlotTheme().bleeding;
        if (util_1.isArray(bleeding)) {
            util_1.each(bleeding, function (it, index) {
                if (typeof bleeding[index] === 'function') {
                    bleeding[index] = bleeding[index](_this.options.plot.options);
                }
            });
        }
        var bbox = this.container.getBBox();
        var x = 0;
        var y = 0;
        var positions = this.options.position.split('-');
        var plotWidth = this.options.plot.width;
        var plotHeight = this.options.plot.height;
        // 先确定x
        if (positions[0] === 'left') {
            x = bleeding[3];
        }
        else if (positions[0] === 'right') {
            x = plotWidth - bleeding[1] - bbox.width;
        }
        else if (positions[1] === 'center') {
            // default
            if (this.width === panelRange.width) {
                x = panelRange.x;
            }
            else {
                x = (plotWidth - bbox.width) / 2;
            }
        }
        else if (positions[1] === 'left') {
            x = bleeding[3];
        }
        else if (positions[1] === 'right') {
            x = this.options.plot.width - bleeding[1] - bbox.width;
        }
        // 再确定y
        if (positions[0] === 'bottom') {
            y = plotHeight - bleeding[2] - bbox.height;
        }
        else if (positions[0] === 'top') {
            y = this.getTopPosition(bleeding);
        }
        else if (positions[1] === 'center') {
            // default
            if (this.height === panelRange.height) {
                y = panelRange.y;
            }
            else {
                //用户自行设定
                y = (plotHeight - bbox.height) / 2;
            }
        }
        else if (positions[1] === 'top') {
            y = bleeding[0];
        }
        else if (positions[1] === 'bottom') {
            y = plotHeight - bleeding[2] - bbox.height;
        }
        this.x = x;
        this.y = y;
        this.container.translate(x, y);
    };
    MatrixLegend.prototype.getDefaultOptions = function () {
        return {
            text: {
                style: {
                    fontSize: 12,
                    fill: 'rgba(0, 0, 0, 0.45)',
                },
            },
            ticklineStyle: {
                lineWidth: 1,
                stroke: 'rgba(0, 0, 0, 0.8)',
            },
            anchorStyle: {
                fill: 'rgba(0,0,0,0.5)',
            },
            triggerOn: 'mousemove',
        };
    };
    MatrixLegend.prototype.addInteraction = function () {
        var _this = this;
        var geomType;
        if (this.options.plot.options.shapeType === 'rect') {
            geomType = 'polygon';
        }
        else {
            geomType = 'point';
        }
        var eventName = geomType + ":" + this.options.triggerOn;
        //const labelEventName = `label:${this.options.triggerOn}`;
        var field = this.options.plot.options.colorField;
        var _a = this.colorScale, min = _a.min, max = _a.max;
        var geomEventHandler = function (ev) {
            var value = ev.data.data[field];
            var ratio = (value - min) / (max - min);
            _this.moveAnchor(ratio);
        };
        this.view.on(eventName, geomEventHandler);
        this.interactiveEvents[eventName] = {
            target: this.view,
            handler: geomEventHandler,
        };
        /*this.view.on(labelEventName, (ev) => {
          const value = ev.data[field];
          const ratio = (value - min) / (max - min);
          this.moveAnchor(ratio);
        });*/
        var mouseleaveHandler = function () {
            _this.anchor.set('visible', false);
        };
        this.options.plot.canvas.on('mouseleave', mouseleaveHandler);
        this.interactiveEvents.mouseleave = {
            target: this.options.plot.canvas,
            handler: mouseleaveHandler,
        };
    };
    MatrixLegend.prototype.moveAnchor = function (ratio) {
        this.anchor.set('visible', true);
        if (this.layout === 'vertical') {
            var pos = this.height * ratio;
            var ulMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
            ulMatrix[7] = pos;
            this.anchor.stopAnimate();
            this.anchor.animate({
                matrix: ulMatrix,
            }, 400, 'easeLinear');
        }
        else {
            var pos = this.width * ratio;
            var ulMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
            ulMatrix[6] = pos;
            this.anchor.stopAnimate();
            this.anchor.animate({
                matrix: ulMatrix,
            }, 400, 'easeLinear');
        }
    };
    MatrixLegend.prototype.getTopPosition = function (bleeding) {
        if (this.options.plot.description) {
            var bbox = this.options.plot.description.getBBox();
            return bbox.maxY + 10;
        }
        else if (this.options.plot.title) {
            var bbox = this.options.plot.title.getBBox();
            return bbox.maxY + 10;
        }
        return bleeding[0];
    };
    MatrixLegend.prototype.offEvent = function () {
        util_1.each(this.interactiveEvents, function (event, key) {
            var target = event.target, handler = event.handler;
            target.off(key, handler);
        });
    };
    return MatrixLegend;
}());
exports.default = MatrixLegend;

},{"../../../util/bbox":672,"@antv/util":803,"tslib":894}],539:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Heatmap = /** @class */ (function (_super) {
    tslib_1.__extends(Heatmap, _super);
    function Heatmap() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Heatmap.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'heatmap';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Heatmap.prototype.changeShape = function (type) {
        var layer = this.layers[0];
        layer.changeShape(type);
    };
    Heatmap.prototype.mappingSize = function (field) {
        var layer = this.layers[0];
        layer.mappingSize(field);
    };
    Heatmap.prototype.disableMappingSize = function () {
        var layer = this.layers[0];
        layer.disableMappingSize();
    };
    Heatmap.prototype.getSizeScale = function () {
        var layer = this.layers[0];
        return layer.getSizeScale();
    };
    Heatmap.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Heatmap;
}(plot_1.default));
exports.default = Heatmap;

},{"../../base/plot":394,"./layer":540,"@antv/util":803,"tslib":894}],540:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var scale_1 = require("@antv/scale");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var shape_1 = require("./shape");
var component_1 = require("./component");
var HeatmapLayer = /** @class */ (function (_super) {
    tslib_1.__extends(HeatmapLayer, _super);
    function HeatmapLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'heatmap';
        _this.gridSize = [];
        _this.plotComponents = [];
        return _this;
    }
    HeatmapLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            shapeType: 'rect',
            legend: {
                visible: true,
                position: 'right-center',
            },
            tooltip: {
                shared: false,
                showCrosshairs: false,
                showMarkers: false,
            },
            xAxis: {
                visible: true,
                gridAlign: 'center',
                grid: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                line: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: true,
                },
            },
            yAxis: {
                visible: true,
                gridAlign: 'center',
                grid: {
                    visible: true,
                    align: 'center',
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    autoHide: true,
                    autoRotate: false,
                },
            },
            color: ['#9ae3d5', '#66cdbb', '#e7a744', '#f1e066', '#f27664', '#e7c1a2'],
            label: {
                visible: true,
                adjustColor: true,
                adjustPosition: true,
                offset: 0,
                style: {
                    stroke: 'rgba(255,255,255,0)',
                    lineWidth: 0,
                },
            },
            interactions: [{ type: 'tooltip' }],
        });
    };
    HeatmapLayer.prototype.afterRender = function () {
        this.renderPlotComponents();
        _super.prototype.afterRender.call(this);
    };
    HeatmapLayer.prototype.changeShape = function (type) {
        if (this.options.shapeType === type) {
            return;
        }
        this.options.shapeType = type;
        if (type === 'rect') {
            var shapes = this.getShape();
            this.circleToRect(shapes);
        }
        else if (type === 'circle') {
            var shapes = this.getShape();
            this.rectToCircle(shapes);
        }
    };
    HeatmapLayer.prototype.mappingSize = function (field) {
        if (this.options.sizeField && this.options.sizeField === field) {
            return;
        }
        this.options.sizeField = field;
        // 创建scale
        var values = util_1.valuesOfKey(this.options.data, field);
        var min = Math.min.apply(Math, values);
        var max = Math.max.apply(Math, values);
        var LinearScale = scale_1.getScale('linear');
        var scale = new LinearScale({
            min: min,
            max: max,
        });
        var shapes = this.getShape();
        if (this.options.shapeType === 'rect') {
            this.rectSizeMapping(shapes, scale, field);
        }
        else if (this.options.shapeType === 'circle') {
            this.circleSizeMapping(shapes, scale, field);
        }
    };
    HeatmapLayer.prototype.disableMappingSize = function () {
        var shapes = this.getShape();
        if (this.options.shapeType === 'rect') {
            this.rectDisableSizeMapping(shapes);
        }
        else if (this.options.shapeType === 'circle') {
            this.circleDisableSizeMapping(shapes);
        }
    };
    HeatmapLayer.prototype.destroy = function () {
        util_1.each(this.plotComponents, function (component) {
            component.destroy();
        });
        _super.prototype.destroy.call(this);
    };
    HeatmapLayer.prototype.getSizeScale = function () {
        var sizeField = this.options.sizeField;
        if (sizeField) {
            this.view.getScaleByField(sizeField);
        }
    };
    HeatmapLayer.prototype.geometryParser = function () {
        return '';
    };
    HeatmapLayer.prototype.coord = function () {
        return;
    };
    HeatmapLayer.prototype.legend = function () {
        this.setConfig('legends', false);
    };
    HeatmapLayer.prototype.addGeometry = function () {
        this.gridSize = this.getGridSize();
        var geomConfig;
        if (this.options.shapeType === 'rect') {
            geomConfig = this.addRect();
        }
        else {
            var circle = this.addCircle();
            geomConfig = circle;
        }
        if (this.options.shapeStyle) {
            var styleConfig = {};
            if (util_1.isFunction(this.options.shapeStyle)) {
                styleConfig.fields = [
                    this.options.colorField,
                    this.options.xField,
                    this.options.yField,
                    this.options.sizeField,
                ];
                styleConfig.callback = this.options.shapeStyle;
            }
            else if (util_1.isObject(this.options.shapeStyle)) {
                styleConfig.cfg = this.options.shapeStyle;
            }
            geomConfig.style = styleConfig;
        }
        if (this.options.tooltip && (this.options.tooltip.fields || this.options.tooltip.formatter)) {
            this.geometryTooltip(geomConfig);
        }
        this.setConfig('geometry', geomConfig);
    };
    HeatmapLayer.prototype.addRect = function () {
        // 如果用户设置了size，将size数值转换为[0,1]区间
        var size = [0.3, 0.9];
        if (this.options.shapeSize) {
            size[0] = this.options.shapeSize[0] / this.gridSize[0];
            size[1] = this.options.shapeSize[1] / this.gridSize[1];
        }
        var rect = {
            type: 'polygon',
            position: {
                fields: [this.options.xField, this.options.yField],
            },
            color: {
                fields: [this.options.colorField],
                values: this.options.color,
            },
            shape: {
                values: ['rect'],
            },
            label: false,
        };
        if (this.options.sizeField) {
            rect.size = {
                fields: [this.options.sizeField],
                values: size,
            };
        }
        else {
            rect.size = {
                values: [1],
            };
        }
        return rect;
    };
    HeatmapLayer.prototype.addCircle = function () {
        var size = [0.3, 0.9];
        if (this.options.shapeSize) {
            size = this.options.shapeSize;
        }
        else {
            size[0] = this.gridSize[0] * size[0] * 0.5;
            size[1] = this.gridSize[1] * size[1] * 0.5;
        }
        var circle = {
            type: 'point',
            position: {
                fields: [this.options.xField, this.options.yField],
            },
            color: {
                fields: [this.options.colorField],
                values: this.options.color,
            },
            shape: {
                values: ['curvePoint'],
            },
            label: false,
        };
        if (this.options.sizeField) {
            circle.size = {
                fields: [this.options.sizeField],
                values: size,
            };
        }
        else {
            circle.size = {
                values: [Math.min(this.gridSize[0], this.gridSize[1]) * 0.5 * 0.9],
            };
        }
        return circle;
    };
    HeatmapLayer.prototype.geometryTooltip = function (config) {
        config.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            config.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            config.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                config.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.colorField) {
                    config.tooltip.fields.push(this.options.colorField);
                }
            }
        }
    };
    HeatmapLayer.prototype.getGridSize = function () {
        if (this.options.padding === 'auto') {
            return [0, 0];
        }
        else {
            var viewRange = this.getViewRange();
            var _a = this.options, padding = _a.padding, xField = _a.xField, yField = _a.yField, data = _a.data;
            var width = viewRange.width - padding[1] - padding[3];
            var height = viewRange.height - padding[0] - padding[2];
            var xCount = util_1.valuesOfKey(data, xField).length;
            var yCount = util_1.valuesOfKey(data, yField).length;
            return [width / xCount, height / yCount];
        }
    };
    HeatmapLayer.prototype.circleToRect = function (shapes) {
        var _this = this;
        var gridSize = this.gridSize;
        util_1.each(shapes, function (shape) {
            var _a = shape.get('origin'), x = _a.x, y = _a.y, size = _a.size;
            var sizeRatio = (size * 2) / Math.min(gridSize[0], gridSize[1]);
            if (!_this.options.sizeField) {
                sizeRatio = 1;
            }
            var curvePath = shape_1.getCircleCurve(x, y, size);
            var rectPath = shape_1.getRectPath(x, y, gridSize[0], gridSize[1], sizeRatio);
            shape.stopAnimate();
            shape.attr('path', curvePath);
            shape.animate({
                path: rectPath,
            }, 500, 'easeLinear');
        });
    };
    HeatmapLayer.prototype.rectToCircle = function (shapes) {
        var _this = this;
        util_1.each(shapes, function (shape) {
            var coord = shape.get('coord');
            var points = shape.get('origin').points;
            var ps = [];
            util_1.each(points, function (p) {
                ps.push(coord.convertPoint(p));
            });
            var bbox = shape.getBBox();
            var width = bbox.width;
            var height = bbox.height;
            var centerX = bbox.minX + width / 2;
            var centerY = bbox.minY + height / 2;
            var offsetRatio = _this.options.sizeField ? 1 : 0.9;
            var curvePath = shape_1.getCircleCurve(centerX, centerY, (Math.min(width, height) / 2) * offsetRatio);
            var circlePath = shape_1.getCirclePath(centerX, centerY, (Math.min(width, height) / 2) * offsetRatio);
            shape.stopAnimate();
            shape.animate({
                path: curvePath,
            }, 500, 'easeLinear', function () {
                shape.attr('path', circlePath);
            });
        });
    };
    HeatmapLayer.prototype.rectSizeMapping = function (shapes, scale, field) {
        util_1.each(shapes, function (shape) {
            var data = shape.get('origin').data;
            var ratio = 0.3 + scale.scale(data[field]) * 0.6;
            shape.get('origin').size = ratio;
            var bbox = shape.getBBox();
            var width = bbox.width;
            var height = bbox.height;
            var centerX = bbox.minX + width / 2;
            var centerY = bbox.minY + height / 2;
            var path = shape_1.getRectPath(centerX, centerY, width, height, ratio);
            shape.stopAnimate();
            shape.animate({
                path: path,
            }, 500, 'easeLinear');
        });
    };
    HeatmapLayer.prototype.circleSizeMapping = function (shapes, scale, field) {
        util_1.each(shapes, function (shape) {
            var data = shape.get('origin').data;
            var ratio = 0.3 + scale.scale(data[field]) * 0.6;
            var _a = shape.get('origin'), x = _a.x, y = _a.y, size = _a.size;
            var path = shape_1.getCirclePath(x, y, size * ratio);
            shape.get('origin').size = size * ratio;
            shape.stopAnimate();
            shape.animate({
                path: path,
            }, 500, 'easeLinear');
        });
    };
    HeatmapLayer.prototype.circleDisableSizeMapping = function (shapes) {
        var _this = this;
        this.options.sizeField = null;
        util_1.each(shapes, function (shape) {
            var _a = shape.get('origin'), x = _a.x, y = _a.y;
            var size = Math.min(_this.gridSize[0], _this.gridSize[1]) * 0.9;
            shape.get('origin').size = size / 2;
            var path = shape_1.getCirclePath(x, y, size / 2);
            shape.stopAnimate();
            shape.animate({
                path: path,
            }, 500, 'easeLinear');
        });
    };
    HeatmapLayer.prototype.rectDisableSizeMapping = function (shapes) {
        var _this = this;
        this.options.sizeField = null;
        util_1.each(shapes, function (shape) {
            var bbox = shape.getBBox();
            var width = bbox.width;
            var height = bbox.height;
            var centerX = bbox.minX + width / 2;
            var centerY = bbox.minY + height / 2;
            var path = shape_1.getRectPath(centerX, centerY, _this.gridSize[0], _this.gridSize[1], 1);
            shape.get('origin').size = 1;
            shape.stopAnimate();
            shape.animate({
                path: path,
            }, 500, 'easeLinear');
        });
    };
    HeatmapLayer.prototype.getShape = function () {
        var elements = this.view.geometries[0].elements;
        var shapes = [];
        util_1.each(elements, function (ele) {
            shapes.push(ele.shape);
        });
        return shapes;
    };
    HeatmapLayer.prototype.renderPlotComponents = function () {
        var _this = this;
        util_1.each(this.plotComponents, function (component) {
            component.destroy();
        });
        this.plotComponents = [];
        var componentsType = ['label', 'legend'];
        util_1.each(componentsType, function (t) {
            var cfg = tslib_1.__assign({ view: _this.view, plot: _this }, _this.options[t]);
            var component = component_1.getPlotComponents(_this, t, cfg);
            if (component) {
                component.render();
                _this.plotComponents.push(component);
            }
        });
    };
    return HeatmapLayer;
}(view_layer_1.default));
exports.default = HeatmapLayer;
global_1.registerPlotType('heatmap', HeatmapLayer);

},{"../../base/global":392,"../../base/view-layer":395,"./component":536,"./shape":541,"@antv/scale":747,"@antv/util":803,"tslib":894}],541:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCircleCurve = exports.getCirclePath = exports.getRectPath = void 0;
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
function getRectPath(cx, cy, width, height, size) {
    var w = width * size;
    var h = height * size;
    var path = [
        ['M', cx - w / 2, cy + h / 2],
        ['Q', cx - w / 2, cy, cx - w / 2, cy - h / 2],
        ['Q', cx, cy - h / 2, cx + w / 2, cy - h / 2],
        ['Q', cx + w / 2, cy, cx + w / 2, cy + h / 2],
        ['Q', cx, cy + h / 2, cx - w / 2, cy + h / 2],
        ['Z'],
    ];
    return path;
}
exports.getRectPath = getRectPath;
function getCirclePath(x, y, size) {
    var path = [
        ['M', x, y],
        ['l', -size, 0],
        ['a', size, size, 0, 1, 0, size * 2, 0],
        ['a', size, size, 0, 1, 0, -(size * 2), 0],
        ['Z'],
    ];
    return path;
}
exports.getCirclePath = getCirclePath;
function getCircleCurve(x, y, size) {
    // 计算四个角和中点
    var path = [
        ['M', x - size, y],
        ['Q', x - size, y - size, x, y - size],
        ['Q', x + size, y - size, x + size, y],
        ['Q', x + size, y + size, x, y + size],
        ['Q', x - size, y + size, x - size, y],
        ['Z'],
    ];
    return path;
}
exports.getCircleCurve = getCircleCurve;
dependents_1.registerShape('polygon', 'rect', {
    draw: function (cfg, container) {
        var points = this.parsePoints(cfg.points);
        var width = points[2].x - points[0].x;
        var height = points[0].y - points[1].y;
        var centerX = points[0].x + width / 2;
        var centerY = points[1].y + height / 2;
        /*
            const path = [
              ['M', centerX - w / 2, centerY + h / 2],
              ['L', centerX - w / 2, centerY - h / 2],
              ['L', centerX + w / 2, centerY - h / 2],
              ['L', centerX + w / 2, centerY + h / 2],
              ['Z'],
            ];
            */
        var path = getRectPath(centerX, centerY, width, height, cfg.size);
        return container.addShape('path', {
            attrs: util_1.deepMix({}, {
                path: path,
                fill: cfg.color,
                opacity: 1,
            }, cfg.style),
        });
    },
});
dependents_1.registerShape('point', 'curvePoint', {
    draw: function (cfg, container) {
        var path = getCirclePath(cfg.x, cfg.y, cfg.size);
        return container.addShape('path', {
            attrs: util_1.deepMix({}, {
                path: path,
                fill: cfg.color,
                opacity: 1,
            }, cfg.style),
        });
    },
});

},{"../../dependents":425,"@antv/util":803}],542:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Histogram = /** @class */ (function (_super) {
    tslib_1.__extends(Histogram, _super);
    function Histogram() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Histogram.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'histogram';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Histogram.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Histogram;
}(plot_1.default));
exports.default = Histogram;

},{"../../base/plot":394,"./layer":543,"@antv/util":803,"tslib":894}],543:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var math_1 = require("../../util/math");
var layer_1 = tslib_1.__importDefault(require("../column/layer"));
var HistogramLayer = /** @class */ (function (_super) {
    tslib_1.__extends(HistogramLayer, _super);
    function HistogramLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'histogram';
        return _this;
    }
    HistogramLayer.prototype.init = function () {
        this.options.xField = 'range';
        this.options.yField = 'count';
        _super.prototype.init.call(this);
    };
    HistogramLayer.prototype.processData = function (originData) {
        var _this = this;
        var _a = this.options, binField = _a.binField, binWidth = _a.binWidth, binNumber = _a.binNumber;
        var originData_copy = util_1.clone(originData);
        // 根据binField value对源数据进行排序
        util_1.sortBy(originData_copy, binField);
        // 获取源数据binField values的range
        var values = util_1.valuesOfKey(originData_copy, binField);
        var range = util_1.getRange(values);
        var rangeWidth = range.max - range.min;
        // 计算分箱，直方图分箱的计算基于binWidth，如配置了binNumber则将其转为binWidth进行计算
        var _binWidth = binWidth;
        if (!binWidth && binNumber) {
            _binWidth = rangeWidth / binNumber;
        }
        // 当binWidth和binNumber都没有指定的情况，采用Sturges formula自动生成binWidth
        if (!binWidth && !binNumber) {
            var _defaultBinNumber = math_1.sturges(values);
            _binWidth = rangeWidth / _defaultBinNumber;
        }
        var bins = {};
        util_1.each(originData_copy, function (data) {
            var value = data[binField];
            var bin = _this.getBin(value, _binWidth);
            var binName = bin[0] + "-" + bin[1];
            if (!util_1.hasKey(bins, binName)) {
                bins[binName] = { name: binName, range: bin, count: 0, data: [] };
            }
            bins[binName].data.push(data);
            bins[binName].count += 1;
        });
        // 将分箱数据转换为plotData
        var plotData = [];
        util_1.each(bins, function (bin) {
            plotData.push(bin);
        });
        return plotData;
    };
    HistogramLayer.prototype.scale = function () {
        _super.prototype.scale.call(this);
        // fixme: 类型定义
        var range = this.config.scales.range;
        range.nice = false;
        range.type = 'linear';
    };
    HistogramLayer.prototype.getBin = function (value, binWidth) {
        var index = Math.floor(value / binWidth);
        return [binWidth * index, binWidth * (index + 1)];
    };
    return HistogramLayer;
}(layer_1.default));
exports.default = HistogramLayer;
global_1.registerPlotType('histogram', HistogramLayer);

},{"../../base/global":392,"../../util/math":680,"../column/layer":490,"@antv/util":803,"tslib":894}],544:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.default; } });
var treemap_1 = require("./treemap");
Object.defineProperty(exports, "Treemap", { enumerable: true, get: function () { return treemap_1.default; } });
var step_line_1 = require("./step-line");
Object.defineProperty(exports, "StepLine", { enumerable: true, get: function () { return step_line_1.default; } });
var bar_1 = require("./bar");
Object.defineProperty(exports, "Bar", { enumerable: true, get: function () { return bar_1.default; } });
var stacked_bar_1 = require("./stacked-bar");
Object.defineProperty(exports, "StackedBar", { enumerable: true, get: function () { return stacked_bar_1.default; } });
var grouped_bar_1 = require("./grouped-bar");
Object.defineProperty(exports, "GroupedBar", { enumerable: true, get: function () { return grouped_bar_1.default; } });
var percent_stacked_bar_1 = require("./percent-stacked-bar");
Object.defineProperty(exports, "PercentStackedBar", { enumerable: true, get: function () { return percent_stacked_bar_1.default; } });
var range_bar_1 = require("./range-bar");
Object.defineProperty(exports, "RangeBar", { enumerable: true, get: function () { return range_bar_1.default; } });
var area_1 = require("./area");
Object.defineProperty(exports, "Area", { enumerable: true, get: function () { return area_1.default; } });
var stacked_area_1 = require("./stacked-area");
Object.defineProperty(exports, "StackedArea", { enumerable: true, get: function () { return stacked_area_1.default; } });
var percent_stacked_area_1 = require("./percent-stacked-area");
Object.defineProperty(exports, "PercentStackedArea", { enumerable: true, get: function () { return percent_stacked_area_1.default; } });
var column_1 = require("./column");
Object.defineProperty(exports, "Column", { enumerable: true, get: function () { return column_1.default; } });
var label_1 = require("./column/component/label");
Object.defineProperty(exports, "ColumnLabel", { enumerable: true, get: function () { return label_1.default; } });
var grouped_column_1 = require("./grouped-column");
Object.defineProperty(exports, "GroupedColumn", { enumerable: true, get: function () { return grouped_column_1.default; } });
var stacked_column_1 = require("./stacked-column");
Object.defineProperty(exports, "StackedColumn", { enumerable: true, get: function () { return stacked_column_1.default; } });
var label_2 = require("./stacked-column/component/label");
Object.defineProperty(exports, "StackedColumnLabel", { enumerable: true, get: function () { return label_2.default; } });
var range_column_1 = require("./range-column");
Object.defineProperty(exports, "RangeColumn", { enumerable: true, get: function () { return range_column_1.default; } });
var percent_stacked_column_1 = require("./percent-stacked-column");
Object.defineProperty(exports, "PercentStackedColumn", { enumerable: true, get: function () { return percent_stacked_column_1.default; } });
var pie_1 = require("./pie");
Object.defineProperty(exports, "Pie", { enumerable: true, get: function () { return pie_1.default; } });
var density_heatmap_1 = require("./density-heatmap");
Object.defineProperty(exports, "DensityHeatmap", { enumerable: true, get: function () { return density_heatmap_1.default; } });
var heatmap_1 = require("./heatmap");
Object.defineProperty(exports, "Heatmap", { enumerable: true, get: function () { return heatmap_1.default; } });
var word_cloud_1 = require("./word-cloud");
Object.defineProperty(exports, "WordCloud", { enumerable: true, get: function () { return word_cloud_1.default; } });
var rose_1 = require("./rose");
Object.defineProperty(exports, "Rose", { enumerable: true, get: function () { return rose_1.default; } });
var funnel_1 = require("./funnel");
Object.defineProperty(exports, "Funnel", { enumerable: true, get: function () { return funnel_1.default; } });
var stacked_rose_1 = require("./stacked-rose");
Object.defineProperty(exports, "StackedRose", { enumerable: true, get: function () { return stacked_rose_1.default; } });
var grouped_rose_1 = require("./grouped-rose");
Object.defineProperty(exports, "GroupedRose", { enumerable: true, get: function () { return grouped_rose_1.default; } });
var radar_1 = require("./radar");
Object.defineProperty(exports, "Radar", { enumerable: true, get: function () { return radar_1.default; } });
var liquid_1 = require("./liquid");
Object.defineProperty(exports, "Liquid", { enumerable: true, get: function () { return liquid_1.default; } });
var histogram_1 = require("./histogram");
Object.defineProperty(exports, "Histogram", { enumerable: true, get: function () { return histogram_1.default; } });
var density_1 = require("./density");
Object.defineProperty(exports, "Density", { enumerable: true, get: function () { return density_1.default; } });
var donut_1 = require("./donut");
Object.defineProperty(exports, "Donut", { enumerable: true, get: function () { return donut_1.default; } });
var waterfall_1 = require("./waterfall");
Object.defineProperty(exports, "Waterfall", { enumerable: true, get: function () { return waterfall_1.default; } });
var scatter_1 = require("./scatter");
Object.defineProperty(exports, "Scatter", { enumerable: true, get: function () { return scatter_1.default; } });
var bubble_1 = require("./bubble");
Object.defineProperty(exports, "Bubble", { enumerable: true, get: function () { return bubble_1.default; } });
var bullet_1 = require("./bullet");
Object.defineProperty(exports, "Bullet", { enumerable: true, get: function () { return bullet_1.default; } });
var calendar_1 = require("./calendar");
Object.defineProperty(exports, "Calendar", { enumerable: true, get: function () { return calendar_1.default; } });
var gauge_1 = require("./gauge");
Object.defineProperty(exports, "Gauge", { enumerable: true, get: function () { return gauge_1.default; } });
var fan_gauge_1 = require("./fan-gauge");
Object.defineProperty(exports, "FanGauge", { enumerable: true, get: function () { return fan_gauge_1.default; } });
var meter_gauge_1 = require("./meter-gauge");
Object.defineProperty(exports, "MeterGauge", { enumerable: true, get: function () { return meter_gauge_1.default; } });
tslib_1.__exportStar(require("./compatiblePlots"), exports);

},{"./area":455,"./bar":463,"./bubble":466,"./bullet":473,"./calendar":478,"./column":489,"./column/component/label":487,"./compatiblePlots":494,"./density":508,"./density-heatmap":506,"./donut":513,"./fan-gauge":515,"./funnel":521,"./gauge":526,"./grouped-bar":528,"./grouped-column":531,"./grouped-rose":534,"./heatmap":539,"./histogram":542,"./line":552,"./liquid":565,"./meter-gauge":567,"./percent-stacked-area":569,"./percent-stacked-bar":571,"./percent-stacked-column":573,"./pie":583,"./radar":587,"./range-bar":592,"./range-column":596,"./rose":599,"./scatter":604,"./stacked-area":612,"./stacked-bar":617,"./stacked-column":622,"./stacked-column/component/label":621,"./stacked-rose":625,"./step-line":627,"./treemap":631,"./waterfall":643,"./word-cloud":645,"tslib":894}],545:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlotOption = void 0;
var dependents_1 = require("../../../dependents");
var util_1 = require("@antv/util");
var plotInfo;
function clipingWithData(shape, animateCfg) {
    var defaultCfg = {
        easing: 'easeLinear',
        duration: 10000,
    };
    var animationConfig = util_1.deepMix({}, animateCfg, defaultCfg);
    var geometry = shape.get('element').geometry;
    geometry.labelsContainer.set('visible', false);
    /** 动画初始状态 */
    var index = shape.get('index');
    var coord = geometry.coordinate;
    var scales = geometry.scales;
    var yScale = scales[plotInfo.options.yField];
    var shapeData = util_1.clone(shape.get('origin'));
    setClip(shape, coord);
    var clip = shape.get('clipShape');
    var parent = shape.get('parent');
    var offsetX = 12;
    var title = null;
    var seriesField = plotInfo.options.seriesField;
    if (seriesField) {
        title = parent.addShape('text', {
            attrs: {
                x: coord.start.x + offsetX,
                y: 0,
                text: shapeData.data[0][seriesField],
                fill: shape.attr('stroke'),
                fontSize: 12,
                textAlign: 'start',
                textBaseline: 'middle',
            },
        });
    }
    var offsetY = title ? 16 : 0;
    var marker = parent.addShape('text', {
        attrs: {
            x: coord.start.x + offsetX,
            y: offsetY,
            text: "test" + index,
            fill: shape.attr('stroke'),
            fontSize: 12,
            textAlign: 'start',
            textBaseline: 'middle',
        },
    });
    /** 动画执行之后 */
    animationConfig.callback = function () {
        if (shape && !shape.get('destroyed')) {
            shape.setClip(null);
            clip.remove();
            marker.animate({
                opacity: 0,
            }, 300, function () {
                marker.remove();
                if (!util_1.isNil(title)) {
                    title.remove();
                }
                var labelsContainer = geometry.labelsContainer;
                if (!labelsContainer.get('visible')) {
                    labelsContainer.set('visible', true);
                }
            });
        }
    };
    /** 执行动画 */
    /** 准备动画参数 */
    var delay = animationConfig.delay;
    if (util_1.isFunction(delay)) {
        delay = animationConfig.delay(index);
    }
    var easing = animationConfig.easing;
    if (util_1.isFunction(easing)) {
        easing = animationConfig.easing(index);
    }
    /** 动起来 */
    clip.animate({
        width: coord.getWidth(),
    }, animationConfig.duration, easing, animationConfig.callback, delay);
    (animationConfig.onFrame = function (ratio) {
        var position = getPositionByRatio(ratio, shapeData, coord);
        if (!position)
            return;
        marker.attr('x', position[0] + offsetX);
        marker.attr('y', position[1] + offsetY);
        var yText = getDataByPosition(yScale, position[1], coord);
        // use formatter
        if (yScale.formatter) {
            yText = yScale.formatter(yText);
        }
        marker.attr('text', yText);
    }),
        marker.animate(animationConfig.onFrame, {
            duration: animationConfig.duration,
            easing: easing,
            callback: animationConfig.callback,
            delay: delay,
        });
    if (title) {
        title.animate({
            onFrame: function (ratio) {
                var position = getPositionByRatio(ratio, shapeData, coord);
                if (!position)
                    return;
                title.attr('x', position[0] + offsetX);
                title.attr('y', position[1]);
            },
        }, animationConfig.duration, easing, animationConfig.callback, delay);
    }
}
function setClip(shape, coord) {
    var start = coord.start, end = coord.end, height = coord.height;
    shape.setClip({
        type: 'rect',
        attrs: {
            x: start.x,
            y: end.y,
            width: 0,
            height: height,
        },
    });
}
function getPositionByRatio(ratio, dataPoints, coord) {
    var points = dataPoints.points;
    var currentX = coord.start.x + coord.getWidth() * ratio;
    for (var i = 0; i < points.length - 1; i++) {
        var current = points[i];
        var next = points[i + 1];
        if (currentX >= current.x && currentX <= next.x) {
            var m = (next.y - current.y) / (next.x - current.x); // 斜率
            var y = current.y + m * (currentX - current.x);
            return [currentX, y];
        }
    }
}
function getDataByPosition(scale, y, coord) {
    var yRatio = (y - coord.start.y) / (coord.end.y - coord.start.y);
    return scale.invert(yRatio).toFixed(2);
}
function getPlotOption(option) {
    plotInfo = option;
}
exports.getPlotOption = getPlotOption;
dependents_1.registerAnimation('clipingWithData', clipingWithData);

},{"../../../dependents":425,"@antv/util":803}],546:[function(require,module,exports){
arguments[4][450][0].apply(exports,arguments)
},{"../../../util/responsive/apply/axis":682,"dup":450,"tslib":894}],547:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var axis_1 = tslib_1.__importDefault(require("./axis"));
var label_1 = tslib_1.__importDefault(require("./label"));
var preRenderResponsive = [];
var afterRenderResponsive = [
    { name: 'responsiveAxis', method: axis_1.default },
    { name: 'responsivePointLabel', method: label_1.default },
];
exports.default = {
    preRender: preRenderResponsive,
    afterRender: afterRenderResponsive,
};

},{"./axis":546,"./label":548,"tslib":894}],548:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var label_1 = tslib_1.__importDefault(require("../../../util/responsive/apply/label"));
var util_1 = require("@antv/util");
var ApplyResponsiveLineLabel = /** @class */ (function (_super) {
    tslib_1.__extends(ApplyResponsiveLineLabel, _super);
    function ApplyResponsiveLineLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ApplyResponsiveLineLabel.prototype.getType = function () {
        return util_1.get(this.plot.options, ['label', 'type'], 'point');
    };
    return ApplyResponsiveLineLabel;
}(label_1.default));
function responsivePointLabel(layer) {
    var responsiveTheme = layer.getResponsiveTheme();
    new ApplyResponsiveLineLabel({
        plot: layer,
        responsiveTheme: responsiveTheme,
    });
}
exports.default = responsivePointLabel;

},{"../../../util/responsive/apply/label":684,"@antv/util":803,"tslib":894}],549:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../../util/responsive/theme");
/** 组装theme */
var lineTheme = {
    label: {
        point: {
            constraints: [{ name: 'elementCollision' }],
            rules: {
                elementCollision: [{ name: 'nodesResamplingByChange' }, { name: 'clearOverlapping' }],
            },
        },
    },
};
theme_1.registerResponsiveTheme('line', lineTheme);

},{"../../../util/responsive/theme":711}],550:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var DEFAULT_OFFSET = 8;
var LineLabel = /** @class */ (function () {
    function LineLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        this.init();
    }
    LineLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    LineLabel.prototype.render = function () {
        var _this = this;
        var elements = this.getGeometry().elements;
        util_1.each(elements, function (ele) {
            var shapeInfo = _this.getShapeInfo(ele.shape);
            var _a = _this.options, style = _a.style, offsetX = _a.offsetX, offsetY = _a.offsetY;
            var formatter = _this.options.formatter;
            var content = formatter ? formatter(shapeInfo.name) : shapeInfo.name;
            _this.container.addShape('text', {
                attrs: util_1.deepMix({}, {
                    x: shapeInfo.x + offsetX,
                    y: shapeInfo.y + offsetY,
                    text: content,
                    fill: shapeInfo.color,
                    textAlign: 'left',
                    textBaseline: 'middle',
                }, style),
                name: 'label',
            });
        });
    };
    LineLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    LineLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    LineLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    LineLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    LineLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    LineLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = util_1.clone(theme.label.style);
        delete labelStyle.fill;
        return {
            offsetX: DEFAULT_OFFSET,
            offsetY: 0,
            style: labelStyle,
        };
    };
    LineLabel.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'line'; });
    };
    LineLabel.prototype.getShapeInfo = function (shape) {
        var originPoints = shape.get('origin').points;
        var lastPoint = originPoints[originPoints.length - 1];
        var color = shape.attr('stroke');
        var seriesField = this.plot.options.seriesField;
        var name = shape.get('origin').data[0][seriesField];
        return { x: lastPoint.x, y: lastPoint.y, color: color, name: name };
    };
    return LineLabel;
}());
exports.default = LineLabel;

},{"@antv/util":803}],551:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    line: 'line',
    point: 'point',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],552:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Line = /** @class */ (function (_super) {
    tslib_1.__extends(Line, _super);
    function Line() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Line.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'line';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Line.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Line;
}(plot_1.default));
exports.default = Line;

},{"../../base/plot":394,"./layer":558,"@antv/util":803,"tslib":894}],553:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LineSelect = exports.LineActive = void 0;
var tslib_1 = require("tslib");
var line_active_1 = tslib_1.__importDefault(require("./line-active"));
exports.LineActive = line_active_1.default;
var line_select_1 = tslib_1.__importDefault(require("./line-select"));
exports.LineSelect = line_select_1.default;
var dependents_1 = require("../../../dependents");
var selected_tooltip_1 = require("./selected-tooltip");
var marker_active_1 = tslib_1.__importDefault(require("./marker-active"));
dependents_1.registerAction('selected-tooltip', selected_tooltip_1.SelectedTooltipAction);
dependents_1.registerInteraction('selected-tooltip', {
    start: [
        { trigger: dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, action: 'selected-tooltip:show' },
        { trigger: dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, action: 'selected-tooltip:show' },
        {
            trigger: 'plot:mousemove',
            action: 'selected-tooltip:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'plot:touchmove',
            action: 'selected-tooltip:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
    ],
});
dependents_1.registerAction('marker-active', marker_active_1.default);
dependents_1.registerInteraction('marker-active', {
    start: [
        { trigger: dependents_1.VIEW_LIFE_CIRCLE.AFTER_PAINT, action: 'marker-active:show' },
        { trigger: dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, action: 'marker-active:show' },
        {
            trigger: 'plot:mousemove',
            action: 'marker-active:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'plot:touchmove',
            action: 'marker-active:show',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'plot:mouseleave',
            action: 'marker-active:hide',
            throttle: { wait: 50, leading: true, trailing: false },
        },
        {
            trigger: 'plot:touchend',
            action: 'marker-active:hide',
            throttle: { wait: 50, leading: true, trailing: false },
        },
    ],
});

},{"../../../dependents":425,"./line-active":554,"./line-select":555,"./marker-active":556,"./selected-tooltip":557,"tslib":894}],554:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var core_1 = tslib_1.__importDefault(require("../../../interaction/core"));
var LineActive = /** @class */ (function (_super) {
    tslib_1.__extends(LineActive, _super);
    function LineActive(cfg) {
        return _super.call(this, tslib_1.__assign({ 
            /** 没有用 line:mouseenter 和 line:mouseleave 事件，是因为可能在多条折线的情况下，从一条线滑动到另一条会同时触发process和reset，使画面出现闪动 */
            processEvent: 'mousemove' }, cfg)) || this;
    }
    LineActive.prototype.start = function () {
        return;
    };
    LineActive.prototype.process = function (ev) {
        var lines = util_1.filter(this.view.geometries, function (geom) { return geom.type == 'line'; });
        var target = ev.target;
        if (target.get('name') === 'line') {
            var data_1 = util_1.get(ev, 'data.data');
            util_1.each(lines, function (line) {
                util_1.each(line.elements, function (element) {
                    element.setState('active', element.data === data_1);
                });
            });
        }
        else {
            util_1.each(lines, function (line) {
                util_1.each(line.elements, function (element) {
                    element.setState('active', false);
                });
            });
        }
    };
    return LineActive;
}(core_1.default));
exports.default = LineActive;

},{"../../../interaction/core":442,"@antv/util":803,"tslib":894}],555:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var core_1 = tslib_1.__importDefault(require("../../../interaction/core"));
var LineSelect = /** @class */ (function (_super) {
    tslib_1.__extends(LineSelect, _super);
    function LineSelect(cfg) {
        return _super.call(this, tslib_1.__assign({ endEvent: 'click' }, cfg)) || this;
    }
    LineSelect.prototype.start = function () {
        return;
    };
    LineSelect.prototype.end = function (ev) {
        var target = ev.target;
        var lines = util_1.filter(this.view.geometries, function (geom) { return geom.type == 'line'; });
        if (target.get('name') === 'line') {
            var data_1 = util_1.get(ev, 'data.data');
            util_1.each(lines, function (line) {
                util_1.each(line.elements, function (element) {
                    element.setState('inactive', element.data !== data_1);
                });
            });
            // TODO： 设置z-index
        }
        else {
            util_1.each(lines, function (line) {
                util_1.each(line.elements, function (element) {
                    element.setState('inactive', false);
                });
            });
            // TODO: 重置z-index
        }
    };
    return LineSelect;
}(core_1.default));
exports.default = LineSelect;

},{"../../../interaction/core":442,"@antv/util":803,"tslib":894}],556:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActiveTooltipController = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../../dependents");
// @ts-ignore
var ActiveTooltipController = /** @class */ (function (_super) {
    tslib_1.__extends(ActiveTooltipController, _super);
    function ActiveTooltipController() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(ActiveTooltipController.prototype, "name", {
        get: function () {
            return 'tooltip-active';
        },
        enumerable: false,
        configurable: true
    });
    ActiveTooltipController.prototype.getTooltipCfg = function () {
        // @ts-ignore
        var cfg = _super.prototype.getTooltipCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { showCrosshairs: true, showMarkers: false, shared: true });
    };
    return ActiveTooltipController;
}(dependents_1.TooltipController));
exports.ActiveTooltipController = ActiveTooltipController;
dependents_1.registerComponentController('tooltip-active', ActiveTooltipController);
var MarkerActiveAction = /** @class */ (function (_super) {
    tslib_1.__extends(MarkerActiveAction, _super);
    function MarkerActiveAction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MarkerActiveAction.prototype.init = function () {
        // 移除默认的tooltip交互
        this.getView().removeInteraction('tooltip');
    };
    MarkerActiveAction.prototype.show = function () {
        var curLocation = this.getPoint();
        if (curLocation) {
            this.showTooltip(curLocation);
        }
    };
    MarkerActiveAction.prototype.hide = function () {
        var view = this.getView();
        var controller = this.getTooltipController();
        controller.hideTooltip();
        var points = util_1.filter(view.geometries, function (geom) { return geom.type == 'point'; });
        util_1.each(points, function (point) {
            util_1.each(point.elements, function (element) {
                element.setState('active', false);
            });
        });
    };
    MarkerActiveAction.prototype.showTooltip = function (point) {
        var view = this.getView();
        var controller = this.getTooltipController();
        controller.showTooltip(point);
        var items = controller.getTooltipItems(point);
        var points = util_1.filter(view.geometries, function (geom) { return geom.type == 'point'; });
        util_1.each(points, function (point) {
            util_1.each(point.elements, function (element) {
                element.setState('active', util_1.findIndex(items, function (item) { return item.data === element.data; }) !== -1);
            });
        });
    };
    MarkerActiveAction.prototype.getPoint = function () {
        var ev = this.context.event;
        return ev ? { x: ev.x, y: ev.y } : null;
    };
    MarkerActiveAction.prototype.getView = function () {
        return this.context.view;
    };
    MarkerActiveAction.prototype.getTooltipController = function () {
        return this.getView().getController('tooltip-active');
    };
    return MarkerActiveAction;
}(dependents_1.InteractionAction));
exports.default = MarkerActiveAction;

},{"../../../dependents":425,"@antv/util":803,"tslib":894}],557:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectedTooltipAction = exports.SelectedTooltipController = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dependents_1 = require("../../../dependents");
// @ts-ignore
var SelectedTooltipController = /** @class */ (function (_super) {
    tslib_1.__extends(SelectedTooltipController, _super);
    function SelectedTooltipController() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(SelectedTooltipController.prototype, "name", {
        get: function () {
            return 'selected-tooltip';
        },
        enumerable: false,
        configurable: true
    });
    SelectedTooltipController.prototype.getTooltipCfg = function () {
        // @ts-ignore
        var cfg = _super.prototype.getTooltipCfg.call(this);
        return tslib_1.__assign(tslib_1.__assign({}, cfg), { showContent: false, showCrosshairs: true, showMarkers: true, shared: true });
    };
    return SelectedTooltipController;
}(dependents_1.TooltipController));
exports.SelectedTooltipController = SelectedTooltipController;
dependents_1.registerComponentController('selected-tooltip', SelectedTooltipController);
var SelectedTooltipAction = /** @class */ (function (_super) {
    tslib_1.__extends(SelectedTooltipAction, _super);
    function SelectedTooltipAction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SelectedTooltipAction.prototype.show = function () {
        var curLocation = this.getPoint();
        if (!util_1.isEqual(curLocation, this.location)) {
            this.location = curLocation;
            this.showTooltip(curLocation);
        }
    };
    SelectedTooltipAction.prototype.hide = function () {
        var controller = this.getTooltipController();
        controller.hideTooltip();
    };
    SelectedTooltipAction.prototype.showTooltip = function (point) {
        var controller = this.getTooltipController();
        controller.showTooltip(point);
    };
    SelectedTooltipAction.prototype.getPoint = function () {
        var ev = this.context.event;
        return ev ? { x: ev.x, y: ev.y } : this.getLastXPoint();
    };
    SelectedTooltipAction.prototype.getLastXPoint = function () {
        var view = this.getView();
        var xScale = view.getXScale();
        var yScale = view.getYScales()[0];
        var coordinate = view.getCoordinate();
        var lastX = util_1.last(xScale.getTicks()).value;
        return coordinate.convert({ x: lastX, y: (yScale.range[0] + yScale.range[1]) / 2 });
    };
    SelectedTooltipAction.prototype.getView = function () {
        return this.context.view;
    };
    SelectedTooltipAction.prototype.getTooltipController = function () {
        return this.getView().getController('selected-tooltip');
    };
    return SelectedTooltipAction;
}(dependents_1.InteractionAction));
exports.SelectedTooltipAction = SelectedTooltipAction;

},{"../../../dependents":425,"@antv/util":803,"tslib":894}],558:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
var clipIn_with_data_1 = require("./animation/clipIn-with-data");
var apply_responsive_1 = tslib_1.__importDefault(require("./apply-responsive"));
require("../../components/label/point");
require("../../components/label/point-auto");
var line_label_1 = tslib_1.__importDefault(require("./component/label/line-label"));
var EventParser = tslib_1.__importStar(require("./event"));
var marker_point_1 = tslib_1.__importDefault(require("../../components/marker-point"));
require("./theme");
require("./apply-responsive/theme");
var index_1 = require("./interaction/index");
var view_1 = require("../../util/view");
var GEOM_MAP = {
    line: 'line',
    point: 'point',
};
var LineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(LineLayer, _super);
    function LineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'line';
        _this.markerPoints = [];
        return _this;
    }
    LineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            connectNulls: false,
            smooth: false,
            lineSize: 2,
            lineStyle: {
                lineJoin: 'round',
                lineCap: 'round',
            },
            point: {
                visible: false,
                size: 3,
                shape: 'circle',
            },
            label: {
                visible: false,
                type: 'point',
            },
            legend: {
                visible: true,
                position: 'top-left',
                wordSpacing: 4,
            },
            tooltip: {
                showContent: true,
                crosshairs: {
                    line: {
                        style: {
                            stroke: 'rgba(0,0,0,0.45)',
                        },
                    },
                },
            },
            markerPoints: [],
        });
    };
    LineLayer.prototype.afterRender = function () {
        var _this = this;
        var options = this.options;
        this.renderLabel();
        if (options.markerPoints) {
            // 清空
            util_1.each(this.markerPoints, function (markerPoint) { return markerPoint.destroy(); });
            this.markerPoints = [];
            options.markerPoints.forEach(function (markerPointOpt) {
                if (markerPointOpt.visible) {
                    var markerPoint = new marker_point_1.default(tslib_1.__assign(tslib_1.__assign({}, markerPointOpt), { view: _this.view }));
                    _this.markerPoints.push(markerPoint);
                }
            });
        }
        // 响应式
        if (options.responsive && options.padding !== 'auto') {
            this.applyResponsive('afterRender');
        }
        _super.prototype.afterRender.call(this);
    };
    LineLayer.prototype.getColorScale = function () {
        var seriesField = this.options.seriesField;
        if (seriesField) {
            return this.view.getScaleByField(seriesField);
        }
    };
    LineLayer.prototype.geometryParser = function (dim, type) {
        return GEOM_MAP[type];
    };
    LineLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.xField] = {};
        if (util_1.has(props, 'xAxis')) {
            scale_1.extractScale(scales[props.xField], props.xAxis);
        }
        /** 配置y-scale */
        scales[props.yField] = {};
        if (util_1.has(props, 'yAxis')) {
            scale_1.extractScale(scales[props.yField], props.yAxis);
        }
        this.setConfig('scales', scales);
        scale_1.trySetScaleMinToZero(scales[props.yField], util_1.map(props.data || [], function (item) { return item[props.yField]; }));
        _super.prototype.scale.call(this);
    };
    LineLayer.prototype.coord = function () {
        return;
    };
    LineLayer.prototype.tooltip = function () {
        // 如果有标注点，则不展示markers
        if (util_1.some(this.options.markerPoints, function (markerPointOpt) { return markerPointOpt.visible; })) {
            this.options.tooltip.showMarkers = false;
        }
        _super.prototype.tooltip.call(this);
    };
    LineLayer.prototype.addGeometry = function () {
        // 配置线
        this.addLine();
        // 配置数据点
        this.addPoint();
    };
    LineLayer.prototype.addLine = function () {
        var props = this.options;
        this.line = factory_1.getGeom('line', 'main', {
            plot: this,
        });
        if (props.tooltip && (props.tooltip.fields || props.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', this.line);
    };
    LineLayer.prototype.addPoint = function () {
        var props = this.options;
        var defaultConfig = { visible: false };
        if (props.point) {
            props.point = util_1.deepMix(defaultConfig, props.point);
        }
        if (props.point && props.point.visible) {
            this.point = factory_1.getGeom('point', 'guide', {
                plot: this,
            });
            this.setConfig('geometry', this.point);
        }
    };
    LineLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, yField = _a.yField;
        var scale = scales[yField];
        if (label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'line');
            if (label.type === 'line') {
                // TODO: Line Label 迁移
                var label_1 = new line_label_1.default(tslib_1.__assign({ view: this.view, plot: this }, this.options.label));
                label_1.render();
            }
            else {
                this.doRenderLabel(geometry, tslib_1.__assign({ type: 'point', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
            }
        }
    };
    LineLayer.prototype.geometryTooltip = function () {
        this.line.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.line.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.line.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.line.tooltip.fields = [this.options.xField, this.options.yField];
                if (this.options.seriesField) {
                    this.line.tooltip.fields.push(this.options.seriesField);
                }
            }
        }
    };
    LineLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (!props.animation) {
            // 关闭动画
            this.line.animate = false;
            if (this.point)
                this.point.animate = false;
        }
        else {
            clipIn_with_data_1.getPlotOption({
                options: this.options,
                view: this.view,
            });
            this.line.animate = props.animation;
        }
    };
    LineLayer.prototype.applyInteractions = function () {
        _super.prototype.applyInteractions.call(this);
        this.interactions.push(new index_1.LineActive({
            view: this.view,
        }));
        this.interactions.push(new index_1.LineSelect({
            view: this.view,
        }));
    };
    LineLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    LineLayer.prototype.applyResponsive = function (stage) {
        var _this = this;
        var methods = apply_responsive_1.default[stage];
        util_1.each(methods, function (r) {
            var responsive = r;
            responsive.method(_this);
        });
    };
    LineLayer.prototype.singleLineLabelCheck = function () {
        // 不允许单折线设置尾部跟随label
        return !this.options.seriesField && this.options.label.type && this.options.label.type === 'line';
    };
    return LineLayer;
}(view_layer_1.default));
exports.default = LineLayer;
global_1.registerPlotType('line', LineLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/label/point":417,"../../components/label/point-auto":416,"../../components/marker-point":419,"../../geoms/factory":430,"../../util/scale":712,"../../util/view":715,"./animation/clipIn-with-data":545,"./apply-responsive":547,"./apply-responsive/theme":549,"./component/label/line-label":550,"./event":551,"./interaction/index":553,"./theme":559,"@antv/util":803,"tslib":894}],559:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var LINE_ACTIVE_STYLE = function (_a) {
    var shape = _a.shape;
    var lineWidth = shape.attr('lineWidth') || 1;
    return { lineWidth: lineWidth + 1 };
};
var LINE_DISABLE_STYLE = function (_a) {
    var shape = _a.shape;
    var opacity = shape.attr('opacity') || 1;
    return { opacity: opacity * 0.2 };
};
var LINE_SELECTED_STYLE = function (_a) {
    var shape = _a.shape;
    var lineWidth = shape.attr('lineWidth') || 1;
    return { lineWidth: lineWidth + 2 };
};
theme_1.registerTheme('line', {
    lineStyle: {
        normal: {},
        active: LINE_ACTIVE_STYLE,
        disable: LINE_DISABLE_STYLE,
        selected: LINE_SELECTED_STYLE,
    },
    pointStyle: {
        normal: {},
        active: {},
        disable: {},
        selected: {},
    },
});

},{"../../theme":669}],560:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dependents_1 = require("../../../dependents");
var util_1 = require("@antv/util");
var g_util_1 = require("../../../util/g-util");
function liquidMoveIn(shape, animateCfg) {
    var container = shape.get('parent');
    var box = container.getBBox();
    var factor = Math.min(Math.max(0, util_1.get(animateCfg, 'factor', 0.5)), 1);
    var delay = util_1.get(animateCfg, 'delay', 0);
    var duration = util_1.get(animateCfg, 'duration', 800);
    var callback = animateCfg.callback;
    var originX = (box.minX + box.maxX) / 2;
    var originY = box.maxY;
    var wrap = container.find(function (shape) { return shape.get('name') == 'wrap'; });
    var wrapTargetOpacity = wrap.attr('opacity');
    wrap.attr('opacity', 0);
    wrap.animate({ opacity: wrapTargetOpacity }, duration * factor, 'easeLinear', null, delay);
    var waves = container.find(function (shape) { return shape.get('name') == 'waves'; });
    var wavesTargetMatrix = util_1.clone(waves.attr('matrix')) || [1, 0, 0, 0, 1, 0, 0, 0, 1];
    var transformMatrix = g_util_1.transform(wavesTargetMatrix, [
        ['t', -originX, -originY],
        ['s', 1, 0],
        ['t', originX, originY],
    ]);
    waves.setMatrix(transformMatrix);
    waves.animate({ matrix: wavesTargetMatrix }, duration, animateCfg.easing, function () { return callback && callback(container, wrap, waves); }, delay);
}
liquidMoveIn.animationName = 'liquidMoveIn';
dependents_1.registerAnimation('liquidMoveIn', liquidMoveIn);

},{"../../../dependents":425,"../../../util/g-util":679,"@antv/util":803}],561:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var statistic_1 = tslib_1.__importDefault(require("../../../components/statistic"));
var statistic_template_1 = require("./statistic-template");
var RingStatistic = /** @class */ (function (_super) {
    tslib_1.__extends(RingStatistic, _super);
    function RingStatistic(cfg) {
        var _this = _super.call(this, cfg) || this;
        _this.view = cfg.view;
        _this.plot = cfg.plot;
        _this.statisticClass = cfg.statisticClass;
        _this.adjustOptions();
        return _this;
    }
    /** 中心文本显示 */
    RingStatistic.prototype.getTotalHtmlString = function () {
        var statisticContainer = document.createElement('div');
        var _a = this.plot.options, _b = _a.value, value = _b === void 0 ? 0 : _b, statistic = _a.statistic;
        if (statistic && !statistic.visible) {
            return statisticContainer;
        }
        var htmlContent = this.options.htmlContent(value);
        if (util_1.isType(htmlContent, 'HTMLDivElement')) {
            statisticContainer.appendChild(htmlContent);
        }
        else {
            statisticContainer.innerHTML = statistic_template_1.getTemplate(htmlContent, this.statisticClass);
        }
        return statisticContainer;
    };
    RingStatistic.prototype.adjustOptions = function () {
        this.html = this.getTotalHtmlString();
        var _a = this.view.coordinateBBox, minX = _a.minX, minY = _a.minY, width = _a.width, height = _a.height;
        this.x = minX + width / 2;
        this.y = minY + height / 2;
    };
    return RingStatistic;
}(statistic_1.default));
exports.default = RingStatistic;

},{"../../../components/statistic":420,"./statistic-template":562,"@antv/util":803,"tslib":894}],562:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTemplate = void 0;
/*tslint:disable*/
var containerStyle = "color:#4d4d4d;font-size:14px;text-align:center;line-height:2;font-family:'-apple-system',BlinkMacSystemFont,'SegoeUI',Roboto,'HelveticaNeue',Helvetica,'PingFangSC','HiraginoSansGB','MicrosoftYaHei',SimSun,'sans-serif';pointer-events:none;";
var valueStyle = 'font-size:32px;font-weight:bold;color:#4D4D4D';
function getTemplate(value, className) {
    var valueDomStr = "<span class=\"liquid-guide-value\" style=" + valueStyle + ">" + value + "</span>";
    return "<div class=\"liquid-guide-html " + className + "\" style=" + containerStyle + ">" + valueDomStr + "</div>";
}
exports.getTemplate = getTemplate;

},{}],563:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    liquid: 'intervl',
    statistic: 'annotation-text',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],564:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dependents_1 = require("../../../../dependents");
var util_1 = require("@antv/util");
var theme_1 = require("../../../../theme");
var g_util_1 = require("../../../../util/g-util");
var globalTheme = theme_1.getGlobalTheme();
var ShapeUtil = {
    splitPoints: function (obj) {
        var points = [];
        var x = obj.x;
        var y = obj.y;
        y = util_1.isArray(y) ? y : [y];
        util_1.each(y, function (yItem, index) {
            var point = {
                x: util_1.isArray(x) ? x[index] : x,
                y: yItem,
            };
            points.push(point);
        });
        return points;
    },
    addFillAttrs: function (attrs, cfg) {
        if (cfg.color && !attrs.fill) {
            attrs.fill = cfg.color;
        }
        if (util_1.isNumber(cfg.opacity)) {
            attrs.opacity = attrs.fillOpacity = cfg.opacity;
        }
    },
    addStrokeAttrs: function (attrs, cfg) {
        if (cfg.color && !attrs.stroke) {
            attrs.stroke = cfg.color;
        }
        if (util_1.isNumber(cfg.opacity)) {
            attrs.opacity = attrs.strokeOpacity = cfg.opacity;
        }
    },
};
var ValueUtil = {
    lerp: function (a, b, factor) {
        return (1 - factor) * a + factor * b;
    },
};
var getFillAttrs = function (cfg) {
    var defaultAttrs = {
        lineWidth: 0,
        fill: globalTheme.color,
        fillOpacity: 0.85,
    };
    var attrs = util_1.mix({}, defaultAttrs, cfg.style);
    ShapeUtil.addFillAttrs(attrs, cfg);
    if (cfg.color && !attrs.stroke) {
        attrs.stroke = attrs.stroke || cfg.color;
    }
    return attrs;
};
var getLineAttrs = function (cfg) {
    var defaultAttrs = {
        fill: '#fff',
        stroke: globalTheme.color,
        fillOpacity: 0,
        lineWidth: 2,
    };
    var attrs = util_1.mix({}, defaultAttrs, cfg.style);
    ShapeUtil.addStrokeAttrs(attrs, cfg);
    return attrs;
};
/**
 * 用贝塞尔曲线模拟正弦波
 * Using Bezier curves to fit sine wave.
 * There is 4 control points for each curve of wave,
 * which is at 1/4 wave length of the sine wave.
 *
 * The control points for a wave from (a) to (d) are a-b-c-d:
 *          c *----* d
 *     b *
 *       |
 * ... a * ..................
 *
 * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)
 *
 * @param {number} x          x position of the left-most point (a)
 * @param {number} stage      0-3, stating which part of the wave it is
 * @param {number} waveLength wave length of the sine wave
 * @param {number} amplitude  wave amplitude
 * @return {Array} 正弦片段曲线
 */
function getWaterWavePositions(x, stage, waveLength, amplitude) {
    if (stage === 0) {
        return [
            [x + ((1 / 2) * waveLength) / Math.PI / 2, amplitude / 2],
            [x + ((1 / 2) * waveLength) / Math.PI, amplitude],
            [x + waveLength / 4, amplitude],
        ];
    }
    if (stage === 1) {
        return [
            [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), amplitude],
            [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), amplitude / 2],
            [x + waveLength / 4, 0],
        ];
    }
    if (stage === 2) {
        return [
            [x + ((1 / 2) * waveLength) / Math.PI / 2, -amplitude / 2],
            [x + ((1 / 2) * waveLength) / Math.PI, -amplitude],
            [x + waveLength / 4, -amplitude],
        ];
    }
    return [
        [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 2), -amplitude],
        [x + (((1 / 2) * waveLength) / Math.PI / 2) * (Math.PI - 1), -amplitude / 2],
        [x + waveLength / 4, 0],
    ];
}
/**
 * 获取水波路径
 * @param  {number} radius          半径
 * @param  {number} waterLevel      水位
 * @param  {number} waveLength      波长
 * @param  {number} phase           相位
 * @param  {number} amplitude       震幅
 * @param  {number} cx              圆心x
 * @param  {number} cy              圆心y
 * @return {Array}  path            路径
 * @reference http://gitlab.alipay-inc.com/datavis/g6/blob/1.2.0/src/graph/utils/path.js#L135
 */
function getWaterWavePath(radius, waterLevel, waveLength, phase, amplitude, cx, cy) {
    var curves = Math.ceil(((2 * radius) / waveLength) * 4) * 2;
    var path = [];
    var _phase = phase;
    // map phase to [-Math.PI * 2, 0]
    while (_phase < -Math.PI * 2) {
        _phase += Math.PI * 2;
    }
    while (_phase > 0) {
        _phase -= Math.PI * 2;
    }
    _phase = (_phase / Math.PI / 2) * waveLength;
    var left = cx - radius + _phase - radius * 2;
    /**
     * top-left corner as start point
     *
     * draws this point
     *  |
     * \|/
     *  ~~~~~~~~
     *  |      |
     *  +------+
     */
    path.push(['M', left, waterLevel]);
    /**
     * top wave
     *
     * ~~~~~~~~ <- draws this sine wave
     * |      |
     * +------+
     */
    var waveRight = 0;
    for (var c = 0; c < curves; ++c) {
        var stage = c % 4;
        var pos = getWaterWavePositions((c * waveLength) / 4, stage, waveLength, amplitude);
        path.push([
            'C',
            pos[0][0] + left,
            -pos[0][1] + waterLevel,
            pos[1][0] + left,
            -pos[1][1] + waterLevel,
            pos[2][0] + left,
            -pos[2][1] + waterLevel,
        ]);
        if (c === curves - 1) {
            waveRight = pos[2][0];
        }
    }
    /**
     * top-right corner
     *
     *                       ~~~~~~~~
     * 3. draws this line -> |      | <- 1. draws this line
     *                       +------+
     *                          ^
     *                          |
     *                  2. draws this line
     */
    path.push(['L', waveRight + left, cy + radius]);
    path.push(['L', left, cy + radius]);
    path.push(['L', left, waterLevel]);
    return path;
}
/**
 * 添加水波
 * @param {number} x           中心x
 * @param {number} y           中心y
 * @param {number} level       水位等级 0～1
 * @param {number} waveCount   水波数
 * @param {number} colors      色值
 * @param {number} group       图组
 * @param {number} clip        用于剪切的图形
 * @param {number} radius      绘制图形的高度
 */
function addWaterWave(x, y, level, waveCount, color, group, clip, radius) {
    var bbox = clip.getBBox();
    var width = bbox.maxX - bbox.minX;
    var height = bbox.maxY - bbox.minY;
    var duration = 5000;
    for (var i = 0; i < waveCount; i++) {
        var factor = waveCount <= 1 ? 0 : i / (waveCount - 1);
        var wave = group.addShape('path', {
            attrs: {
                path: getWaterWavePath(radius, bbox.minY + height * level, width / 4, 0, width / ValueUtil.lerp(56, 64, factor), x, y),
                fill: color,
                opacity: ValueUtil.lerp(0.6, 0.3, factor),
            },
        });
        /*wave.setClip({
          type:'circle',
          attrs: clip.attrs
        })*/
        // FIXME wave animation error in svg
        // if (Global.renderer === 'canvas') {
        var matrix = g_util_1.transform([['t', width / 2, 0]]);
        wave.animate({ matrix: matrix }, {
            duration: ValueUtil.lerp(duration, 0.7 * duration, factor),
            repeat: true,
        });
        //}
    }
}
dependents_1.registerShape('interval', 'liquid-fill-gauge', {
    draw: function (cfg, container) {
        var cy = 0.5;
        var minX = Infinity;
        util_1.each(cfg.points, function (p) {
            if (p.x < minX) {
                minX = p.x;
            }
        });
        var cx = 0.5;
        var cp = this.parsePoint({ x: cx, y: cy });
        var minP = this.parsePoint({ x: minX, y: 0.5 });
        var xWidth = cp.x - minP.x;
        var radius = Math.min(xWidth, minP.y);
        var fill = getFillAttrs(cfg).fill;
        var waves = container.addGroup({
            name: 'waves',
            attrs: {
                x: cp.x,
                y: cp.y,
            },
        });
        waves.setClip({
            type: 'circle',
            attrs: {
                x: cp.x,
                y: cp.y,
                r: radius,
            },
        });
        var clipCircle = waves.get('clipShape');
        addWaterWave(cp.x, cp.y, 1 - cfg.points[1].y, // cfg.y / (2 * cp.y),
        3, fill, waves, clipCircle, radius * 4);
        container.addShape('circle', {
            name: 'wrap',
            attrs: util_1.mix(getLineAttrs(cfg), {
                x: cp.x,
                y: cp.y,
                r: radius,
                fill: 'transparent',
            }),
        });
        return waves[0];
    },
});

},{"../../../../dependents":425,"../../../../theme":669,"../../../../util/g-util":679,"@antv/util":803}],565:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Liquid = /** @class */ (function (_super) {
    tslib_1.__extends(Liquid, _super);
    function Liquid() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Liquid.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'liquid';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Liquid.prototype.changeValue = function (value, all) {
        if (all === void 0) { all = false; }
        if (all) {
            this.eachLayer(function (layer) {
                if (layer instanceof layer_1.default) {
                    layer.changeValue(value);
                }
            });
        }
        else {
            var layer = this.layers[0];
            if (layer instanceof layer_1.default) {
                layer.changeValue(value);
            }
        }
    };
    Liquid.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Liquid;
}(plot_1.default));
exports.default = Liquid;

},{"../../base/plot":394,"./layer":566,"@antv/util":803,"tslib":894}],566:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var dom_util_1 = require("@antv/dom-util");
var bbox_1 = tslib_1.__importDefault(require("../../util/bbox"));
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
var color_1 = require("../../util/color");
var liquid_statistic_1 = tslib_1.__importDefault(require("./component/liquid-statistic"));
var EventParser = tslib_1.__importStar(require("./event"));
require("./geometry/shape/liquid");
require("./animation/liquid-move-in");
var G2_GEOM_MAP = {
    column: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'liquid',
};
var LiquidLayer = /** @class */ (function (_super) {
    tslib_1.__extends(LiquidLayer, _super);
    function LiquidLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'liquid';
        _this.shouldFadeInAnnotation = true;
        return _this;
    }
    LiquidLayer.getDefaultOptions = function () {
        var cfg = {
            padding: [0, 0, 0, 0],
            animation: {
                factor: 0.4,
                easing: 'easeExpOut',
                duration: 800,
            },
            liquidStyle: {
                lineWidth: 2,
            },
            color: '#6a99f9',
            interactions: [],
            statistic: {
                visible: true,
            },
        };
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), cfg);
    };
    LiquidLayer.prototype.beforeInit = function () {
        var _a = this.options, min = _a.min, max = _a.max, value = _a.value;
        if (!util_1.isNumber(min)) {
            throw new Error('The min value of Liquid is required, and the type of min must be Number.');
        }
        if (!util_1.isNumber(max)) {
            throw new Error('The max value of Liquid is required, and the type of max must be Number.');
        }
        if (!util_1.isNumber(value)) {
            throw new Error('The value of Liquid is required, and the type of value must be Number.');
        }
    };
    LiquidLayer.prototype.init = function () {
        this.options.data = [{}];
        _super.prototype.init.call(this);
    };
    LiquidLayer.prototype.coord = function () {
        return;
    };
    LiquidLayer.prototype.scale = function () {
        var props = this.options;
        var min = props.min, max = props.max;
        var scales = {
            value: {},
        };
        scale_1.extractScale(scales.value, {
            min: Math.min(min, max),
            max: Math.max(min, max),
        });
        // @ts-ignore
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    LiquidLayer.prototype.axis = function () {
        this.setConfig('axes', false);
    };
    LiquidLayer.prototype.adjustLiquid = function (liquid) {
        var props = this.options;
        liquid.shape = {
            values: ['liquid-fill-gauge'],
        };
        liquid.tooltip = false;
        var liquidStyle = props.liquidStyle;
        if (util_1.isFunction(liquidStyle))
            liquidStyle = liquidStyle();
        if (liquidStyle) {
            liquid.style = liquidStyle;
        }
    };
    LiquidLayer.prototype.addGeometry = function () {
        var liquid = factory_1.getGeom('interval', 'main', {
            positionFields: [1, 'value'],
            plot: this,
        });
        this.adjustLiquid(liquid);
        var viewRange = this.getViewRange();
        var defaultSize = Math.min(viewRange.width, viewRange.height) * 0.8;
        var liquidSize = this.options.liquidSize ? this.options.liquidSize : defaultSize;
        liquid.size = { values: [liquidSize] };
        this.liquid = liquid;
        this.setConfig('geometry', liquid);
    };
    LiquidLayer.prototype.animation = function () {
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.liquid.animate = false;
        }
        else {
            var factor = util_1.get(props, 'animation.factor');
            var easing = util_1.get(props, 'animation.easing');
            var duration = util_1.get(props, 'animation.duration');
            this.liquid.animate = {
                appear: {
                    animation: 'liquidMoveIn',
                    factor: factor,
                    easing: easing,
                    duration: duration,
                },
            };
        }
    };
    LiquidLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    LiquidLayer.prototype.annotation = function () {
        var annotationConfigs = [];
        var statisticConfig = this.extractStatistic();
        annotationConfigs.push(statisticConfig);
        this.setConfig('annotations', annotationConfigs);
    };
    // 新增 htmlContent 支持，兼容旧功能
    LiquidLayer.prototype.useHtmlContent = function () {
        var props = this.options;
        var statistic = props.statistic || {};
        return util_1.isFunction(statistic.htmlContent);
    };
    LiquidLayer.prototype.extractStatistic = function () {
        if (this.useHtmlContent()) {
            return;
        }
        var props = this.options;
        var statistic = props.statistic || {};
        var content;
        if (util_1.isFunction(statistic.formatter)) {
            content = statistic.formatter(props.value);
        }
        else {
            content = "" + props.value;
        }
        var fontSize;
        var shadowBlur;
        if (content) {
            var contentWidth = Math.min(this.width, this.height);
            fontSize = (contentWidth / content.length) * 0.5;
            shadowBlur = Math.max(1, Math.ceil(0.025 * fontSize));
        }
        var opacity;
        if (statistic.visible === false) {
            return;
        }
        var statisticConfig = util_1.deepMix({
            style: {
                fontSize: fontSize,
                shadowBlur: shadowBlur,
            },
        }, {
            top: true,
            content: content,
            type: 'text',
            position: ['50%', '50%'],
            style: {
                opacity: opacity,
                fill: 'transparent',
                shadowColor: 'transparent',
                textAlign: 'center',
            },
        }, statistic);
        delete statisticConfig.visible;
        delete statisticConfig.formatter;
        delete statisticConfig.adjustColor;
        return statisticConfig;
    };
    LiquidLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    LiquidLayer.prototype.afterRender = function () {
        var _a;
        if (((_a = this.options.statistic) === null || _a === void 0 ? void 0 : _a.visible) && !this.useHtmlContent()) {
            this.fadeInAnnotation();
        }
        var options = this.options;
        var padding = options.padding ? options.padding : this.config.theme.padding;
        /** defaultState */
        if (options.defaultState && padding !== 'auto') {
            this.stateController.defaultStates(options.defaultState);
        }
        /** autopadding */
        if (padding === 'auto') {
            this.paddingController.processAutoPadding();
        }
        if (this.useHtmlContent()) {
            var container = this.canvas.get('container');
            if (this.statistic) {
                container.removeChild(this.statistic.wrapperNode);
            }
            /**图中心文本 */
            if (this.options.statistic && this.options.statistic.visible) {
                var container_1 = this.canvas.get('container');
                dom_util_1.modifyCSS(container_1, { position: 'relative' });
                this.statistic = new liquid_statistic_1.default(tslib_1.__assign({ container: container_1, view: this.view, plot: this }, this.options.statistic));
                this.statistic.render();
            }
            _super.prototype.afterRender.call(this);
        }
    };
    LiquidLayer.prototype.processData = function () {
        var props = this.options;
        return [{ _: '_', value: props.value }];
    };
    LiquidLayer.prototype.changeValue = function (value) {
        var props = this.options;
        props.value = value;
        this.changeData([]);
    };
    LiquidLayer.prototype.fadeInAnnotation = function () {
        var _this = this;
        var props = this.options;
        var textShape = this.view.foregroundGroup.findAll(function (el) {
            return el.get('name') === 'annotation-text';
        })[0];
        var animation = props.animation || {};
        var colorStyle = this.calcAnnotationColorStyle();
        if (this.shouldFadeInAnnotation) {
            textShape.animate(colorStyle, animation.duration * Math.min(1, 1.5 * animation.factor), null, function () {
                _this.shouldFadeInAnnotation = false;
            });
        }
        else {
            util_1.forIn(colorStyle, function (v, k) { return textShape.attr(k, v); });
        }
    };
    LiquidLayer.prototype.calcAnnotationColorStyle = function () {
        var props = this.options;
        var lightColorStyle = { fill: '#f6f6f6', shadowColor: 'black' };
        var darkColorStyle = { fill: '#303030', shadowColor: 'white' };
        if (util_1.get(props, 'statistic.adjustColor') === false) {
            return {
                fill: util_1.get(props, 'statistic.style.fill', darkColorStyle.fill),
                shadowColor: util_1.get(props, 'statistic.style.shadowColor', darkColorStyle.shadowColor),
            };
        }
        var min = props.min, max = props.max;
        var value = props.value;
        min = Math.min(min, max);
        max = Math.max(min, max);
        var percent;
        if (min == max) {
            percent = 1;
        }
        else {
            percent = (value - min) / (max - min);
        }
        if (percent > 0.55) {
            var waveColor = this.options.color;
            var waveOpacity = 0.8;
            var rgb = color_1.rgb2arr(waveColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / waveOpacity;
            return gray < 156 ? lightColorStyle : darkColorStyle;
        }
        return darkColorStyle;
    };
    LiquidLayer.prototype.updateConfig = function (cfg) {
        _super.prototype.updateConfig.call(this, cfg);
        this.shouldFadeInAnnotation = true;
    };
    LiquidLayer.prototype.getViewRange = function () {
        var viewRange = _super.prototype.getViewRange.call(this);
        var liquidStyle = this.options.liquidStyle;
        var strokeWidth = liquidStyle.lineWidth ? liquidStyle.lineWidth : 2;
        var minX = viewRange.minX, minY = viewRange.minY, width = viewRange.width, height = viewRange.height;
        var size = Math.min(width, height) - strokeWidth * 2;
        var cx = minX + width / 2;
        var cy = minY + height / 2;
        var x = cx - size / 2;
        var y = cy - size / 2;
        return new bbox_1.default(x, y, size, size);
    };
    return LiquidLayer;
}(view_layer_1.default));
exports.default = LiquidLayer;
global_1.registerPlotType('liquid', LiquidLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../geoms/factory":430,"../../util/bbox":672,"../../util/color":673,"../../util/scale":712,"./animation/liquid-move-in":560,"./component/liquid-statistic":561,"./event":563,"./geometry/shape/liquid":564,"@antv/dom-util":92,"@antv/util":803,"tslib":894}],567:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var MeterGauge = /** @class */ (function (_super) {
    tslib_1.__extends(MeterGauge, _super);
    function MeterGauge() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MeterGauge.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'meterGauge';
        _super.prototype.createLayers.call(this, layerProps);
    };
    MeterGauge.getDefaultOptions = layer_1.default.getDefaultOptions;
    return MeterGauge;
}(plot_1.default));
exports.default = MeterGauge;

},{"../../base/plot":394,"./layer":568,"@antv/util":803,"tslib":894}],568:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../gauge/layer"));
var MeterGaugeLayer = /** @class */ (function (_super) {
    tslib_1.__extends(MeterGaugeLayer, _super);
    function MeterGaugeLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'meterGauge';
        return _this;
    }
    MeterGaugeLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            axis: {
                visible: true,
                offset: -10,
                tickCount: 25,
                subTickCount: 4,
                tickLine: {
                    visible: true,
                    length: 2,
                    style: {
                        stroke: '#aaa',
                        lineWidth: 1,
                    },
                },
            },
        });
    };
    return MeterGaugeLayer;
}(layer_1.default));
exports.default = MeterGaugeLayer;
global_1.registerPlotType('meterGauge', MeterGaugeLayer);

},{"../../base/global":392,"../gauge/layer":527,"@antv/util":803,"tslib":894}],569:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var PercentStackedArea = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedArea, _super);
    function PercentStackedArea() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentStackedArea.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedArea';
        _super.prototype.createLayers.call(this, layerProps);
    };
    PercentStackedArea.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentStackedArea;
}(plot_1.default));
exports.default = PercentStackedArea;

},{"../../base/plot":394,"./layer":570,"@antv/util":803,"tslib":894}],570:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../stacked-area/layer"));
var data_1 = require("../../util/data");
var PercentStackedAreaLayer = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedAreaLayer, _super);
    function PercentStackedAreaLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'percentStackedArea';
        _this.baseType = 'stackedArea';
        return _this;
    }
    PercentStackedAreaLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            yAxis: {
                visible: true,
                label: {
                    visible: true,
                    formatter: function (v) {
                        var reg = /%/gi;
                        return v.replace(reg, '');
                    },
                },
            },
        });
    };
    PercentStackedAreaLayer.prototype.processData = function (originData) {
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        return data_1.transformDataPercentage(originData, xField, [yField]);
    };
    PercentStackedAreaLayer.prototype.scale = function () {
        var metaConfig = {};
        var yField = this.options.yField;
        metaConfig[this.options.yField] = {
            tickCount: 6,
            alias: yField + " (%)",
            min: 0,
            max: 1,
            formatter: function (v) {
                var formattedValue = (v * 100).toFixed(1);
                return formattedValue + "%";
            },
        };
        this.options.meta = util_1.deepMix({}, metaConfig, this.options.meta);
        _super.prototype.scale.call(this);
    };
    return PercentStackedAreaLayer;
}(layer_1.default));
exports.default = PercentStackedAreaLayer;
global_1.registerPlotType('percentStackedArea', PercentStackedAreaLayer);

},{"../../base/global":392,"../../util/data":675,"../stacked-area/layer":613,"@antv/util":803,"tslib":894}],571:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var PercentStackedBar = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedBar, _super);
    function PercentStackedBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentStackedBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedBar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    PercentStackedBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentStackedBar;
}(plot_1.default));
exports.default = PercentStackedBar;

},{"../../base/plot":394,"./layer":572,"@antv/util":803,"tslib":894}],572:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../stacked-bar/layer"));
var data_1 = require("../../util/data");
var PercentStackedBarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedBarLayer, _super);
    function PercentStackedBarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'percentStackedBar';
        return _this;
    }
    PercentStackedBarLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: false,
                },
                title: {
                    visible: true,
                    formatter: function (v) { return v + " (%)"; },
                },
                label: {
                    visible: false,
                    formatter: function (v) {
                        var reg = /%/gi;
                        return v.replace(reg, '');
                    },
                },
            },
        });
    };
    PercentStackedBarLayer.prototype.processData = function (originData) {
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        var processData = _super.prototype.processData.call(this, originData);
        return data_1.transformDataPercentage(processData, yField, [xField]);
    };
    PercentStackedBarLayer.prototype.scale = function () {
        var metaConfig = {};
        var xField = this.options.xField;
        metaConfig[xField] = {
            tickCount: 6,
            alias: xField + " (%)",
            min: 0,
            max: 1,
            formatter: function (v) {
                var formattedValue = (v * 100).toFixed(1);
                return formattedValue + "%";
            },
        };
        this.options.meta = util_1.deepMix({}, this.options.meta, metaConfig);
        _super.prototype.scale.call(this);
    };
    return PercentStackedBarLayer;
}(layer_1.default));
exports.default = PercentStackedBarLayer;
global_1.registerPlotType('percentStackedBar', PercentStackedBarLayer);

},{"../../base/global":392,"../../util/data":675,"../stacked-bar/layer":618,"@antv/util":803,"tslib":894}],573:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var PercentStackedColumn = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedColumn, _super);
    function PercentStackedColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentStackedColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'percentStackedColumn';
        _super.prototype.createLayers.call(this, layerProps);
    };
    PercentStackedColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return PercentStackedColumn;
}(plot_1.default));
exports.default = PercentStackedColumn;

},{"../../base/plot":394,"./layer":574,"@antv/util":803,"tslib":894}],574:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../stacked-column/layer"));
var data_1 = require("../../util/data");
var PercentStackedColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(PercentStackedColumnLayer, _super);
    function PercentStackedColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'percentStackedColumn';
        return _this;
    }
    PercentStackedColumnLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            label: {
                visible: true,
                position: 'middle',
                offset: 0,
            },
            yAxis: {
                visible: true,
                tick: {
                    visible: false,
                },
                grid: {
                    visible: false,
                },
                title: {
                    visible: true,
                },
                label: {
                    visible: false,
                },
            },
        });
    };
    PercentStackedColumnLayer.prototype.processData = function (originData) {
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        return data_1.transformDataPercentage(originData || [], xField, [yField]);
    };
    PercentStackedColumnLayer.prototype.scale = function () {
        var metaConfig = {};
        var yField = this.options.yField;
        metaConfig[yField] = {
            tickCount: 6,
            alias: yField + " (%)",
            min: 0,
            max: 1,
            formatter: function (v) {
                var formattedValue = (v * 100).toFixed(1);
                return formattedValue + "%";
            },
        };
        this.options.meta = util_1.deepMix({}, this.options.meta, metaConfig);
        _super.prototype.scale.call(this);
    };
    return PercentStackedColumnLayer;
}(layer_1.default));
exports.default = PercentStackedColumnLayer;
global_1.registerPlotType('percentStackedColumn', PercentStackedColumnLayer);

},{"../../base/global":392,"../../util/data":675,"../stacked-column/layer":623,"@antv/util":803,"tslib":894}],575:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.percent2Number = exports.CROOK_DISTANCE = void 0;
var tslib_1 = require("tslib");
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var utils_1 = require("./utils");
var text_1 = require("../../../../util/text");
/** label text和line距离 4px */
exports.CROOK_DISTANCE = 4;
function percent2Number(value) {
    var percentage = Number(value.endsWith('%') ? value.slice(0, -1) : value);
    return percentage / 100;
}
exports.percent2Number = percent2Number;
/**
 * 超出panel边界的标签默认隐藏
 */
function checkInPanel(label, panel) {
    var box = label.getBBox();
    //  横向溢出 暂不隐藏
    if (!(panel.y <= box.y && panel.y + panel.height >= box.y + box.height)) {
        label.get('parent').set('visible', false);
    }
}
var PieBaseLabel = /** @class */ (function () {
    function PieBaseLabel(plot, cfg) {
        this.destroyed = false;
        this.plot = plot;
        this.coordinateBBox = this.plot.view.coordinateBBox;
        var options = util_1.deepMix(this.getDefaultOptions(), cfg, {});
        this.adjustOption(options);
        this.options = options;
        this.init();
    }
    /** 处理标签遮挡问题 */
    PieBaseLabel.prototype.adjustOverlap = function (labels, panel) {
        // clearOverlap;
        for (var i = 1; i < labels.length; i++) {
            var label = labels[i];
            var overlapArea = 0;
            for (var j = i - 1; j >= 0; j--) {
                var prev = labels[j];
                // fix: start draw point.x is error when textAlign is right
                var prevBox = prev.getBBox();
                var currBox = label.getBBox();
                // if the previous one is invisible, skip
                if (prev.get('parent').get('visible')) {
                    overlapArea = utils_1.getOverlapArea(prevBox, currBox);
                    if (!utils_1.near(overlapArea, 0)) {
                        label.get('parent').set('visible', false);
                        break;
                    }
                }
            }
        }
        labels.forEach(function (label) { return checkInPanel(label, panel); });
    };
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    PieBaseLabel.prototype.adjustItem = function (item) {
        return;
    };
    PieBaseLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.plot.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    PieBaseLabel.prototype.render = function () {
        // 先清空 再重新渲染（避免双次绘制）
        this.clear();
        this.initArcPoints();
        this.drawTexts();
        this.drawLines();
    };
    PieBaseLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    PieBaseLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    PieBaseLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    PieBaseLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    PieBaseLabel.prototype.getFilteredSum = function () {
        var angleField = this.plot.options.angleField;
        var filteredData = this.plot.view.filteredData || [];
        return filteredData.reduce(function (pre, filteredDataItem) {
            return pre + filteredDataItem[angleField];
        }, 0);
    };
    /** 绘制文本 */
    PieBaseLabel.prototype.drawTexts = function () {
        var _this = this;
        var _a = this.options, style = _a.style, formatter = _a.formatter, autoRotate = _a.autoRotate, offsetX = _a.offsetX, offsetY = _a.offsetY, adjustPosition = _a.adjustPosition, allowOverlap = _a.allowOverlap;
        var shapeInfos = this.getItems();
        var shapes = [];
        shapeInfos.map(function (shapeInfo, idx) {
            var attrs = util_1.deepMix({}, shapeInfo, style);
            var filteredSum = _this.getFilteredSum();
            var angleField = _this.plot.options.angleField;
            var percent = shapeInfo.origin[angleField] / filteredSum;
            var content = formatter
                ? formatter(shapeInfo.name, {
                    _origin: shapeInfo.origin,
                    percent: percent,
                }, idx)
                : shapeInfo.name;
            var itemGroup = _this.container.addGroup({
                name: 'itemGroup',
                index: idx,
                capture: false,
            });
            var textShape = itemGroup.addShape('text', {
                attrs: util_1.deepMix({}, attrs, {
                    x: shapeInfo.x + offsetX,
                    y: shapeInfo.y + offsetY,
                    text: content,
                }),
            });
            textShape.set('id', "text-" + shapeInfo.name + "-" + idx);
            shapes.push(textShape);
        });
        shapes.forEach(function (shape) {
            var panelBox = _this.coordinateBBox;
            _this.adjustText(shape, panelBox);
        });
        if (adjustPosition) {
            this.layout(shapes, shapeInfos, this.coordinateBBox);
        }
        if (!allowOverlap) {
            this.adjustOverlap(shapes, this.coordinateBBox);
        }
        shapes.forEach(function (label, idx) {
            if (autoRotate) {
                _this.rotateLabel(label, utils_1.getLabelRotate(shapeInfos[idx].angle));
            }
        });
    };
    PieBaseLabel.prototype.adjustText = function (label, panelBox) {
        var box = label.getBBox();
        var width = box.width;
        var deltaWidth = 0;
        if (box.maxX > panelBox.maxX) {
            width = panelBox.maxX - box.minX;
        }
        else if (box.minX < panelBox.minX) {
            width = box.maxX - panelBox.minX;
        }
        if (label.attr('textAlign') === 'left') {
            label.attr('x', Math.max(box.x - deltaWidth, 0));
        }
        else if (label.attr('textAlign') === 'right') {
            label.attr('x', Math.max(box.maxX - deltaWidth, 0));
        }
        if (width !== box.width) {
            var font_1 = {};
            ['fontSize', 'fontFamily', 'fontWeight'].forEach(function (k) {
                font_1[k] = label.attr(k);
            });
            var ellipsisTexts = label
                .attr('text')
                .split('\n')
                .map(function (t) { return text_1.getEllipsisText(t, width, font_1); });
            label.attr('text', ellipsisTexts.join('\n'));
        }
    };
    /** 绘制拉线 */
    PieBaseLabel.prototype.drawLines = function () {
        var _this = this;
        if (this.options.line.visible) {
            var itemGroups = this.container.get('children');
            var center_1 = this.getCoordinate().center;
            itemGroups.forEach(function (labelGroup, idx) {
                var label = labelGroup.get('children')[0];
                var anchor = _this.arcPoints[idx];
                var inLeft = anchor.x < center_1.x;
                // 拉线 和 label 之间的距离
                var distance = _this.options.offset > 4 ? 4 : 0;
                var path = _this.getLinePath(label, anchor, distance);
                var style = _this.options.line;
                labelGroup.addShape('path', {
                    attrs: tslib_1.__assign({ path: path, stroke: anchor.color }, style),
                });
                // 由于拉线的存在 label 需要进行偏移
                label.attr('x', label.attr('x') + (inLeft ? -distance : distance));
            });
        }
    };
    /** 获取label leader-line, 默认 not smooth */
    PieBaseLabel.prototype.getLinePath = function (label, anchor, distance) {
        var smooth = this.options.line ? this.options.line.smooth : false;
        var angle = anchor.angle;
        var _a = this.getCoordinate(), center = _a.center, radius = _a.radius;
        var breakAt = utils_1.getEndPoint(center, angle, radius + distance);
        if (distance < 4) {
            breakAt = anchor;
        }
        var inLeft = anchor.x < center.x;
        var box = label.getBBox();
        var labelPosition = { x: inLeft ? box.maxX : box.minX, y: box.y + box.height / 2 };
        var smoothPath = [
            'C',
            // 1st control point (of the curve)
            labelPosition.x +
                // 4 gives the connector a little horizontal bend
                (inLeft ? 1 : -1) * (distance < 4 ? distance / 2 : 4),
            labelPosition.y,
            2 * breakAt.x - anchor.x,
            2 * breakAt.y - anchor.y,
            breakAt.x,
            breakAt.y,
        ];
        var straightPath = ['L', /** pointy break */ breakAt.x, breakAt.y];
        var linePath = smooth ? smoothPath : straightPath;
        var path = ['M', labelPosition.x, labelPosition.y].concat(linePath).concat('L', anchor.x, anchor.y);
        return path.join(',');
    };
    PieBaseLabel.prototype.getGeometry = function () {
        return this.plot.view.geometries[0];
    };
    PieBaseLabel.prototype.getCoordinate = function () {
        var coordinate = this.getGeometry().coordinate;
        var center = coordinate.getCenter();
        // @ts-ignore
        var radius = coordinate.getRadius();
        var startAngle = coordinate.startAngle;
        return { center: center, radius: radius, startAngle: startAngle };
    };
    PieBaseLabel.prototype.adjustOption = function (options) {
        var offset = options.offset;
        var radius = this.getCoordinate().radius;
        if (util_1.isString(offset)) {
            offset = radius * percent2Number(offset);
        }
        options.offset = offset;
    };
    PieBaseLabel.prototype.rotateLabel = function (label, angle) {
        var x = label.attr('x');
        var y = label.attr('y');
        var matrix = matrix_util_1.ext.transform(label.getMatrix(), [
            ['t', -x, -y],
            ['r', angle],
            ['t', x, y],
        ]);
        label.setMatrix(matrix);
    };
    PieBaseLabel.prototype.getItems = function () {
        var _this = this;
        var offset = this.options.offset;
        var _a = this.getCoordinate(), center = _a.center, radius = _a.radius;
        var items = this.arcPoints.map(function (anchor) {
            var point = utils_1.getEndPoint(center, anchor.angle, radius + offset);
            var item = tslib_1.__assign(tslib_1.__assign({}, anchor), point);
            _this.adjustItem(item);
            return item;
        });
        return items;
    };
    // 初始化圆弧上锚点
    PieBaseLabel.prototype.initArcPoints = function () {
        var _this = this;
        var angleField = this.plot.options.angleField;
        var elements = this.getGeometry().elements;
        var coord = this.getCoordinate();
        var center = coord.center, radius = coord.radius;
        var startAngle = this.getCoordinate().startAngle;
        // 位置信息使用 positionScale
        var positionScales = this.getGeometry().attributes.position.scales;
        var scale = positionScales[1];
        var scaleField = scale.field;
        var anchors = elements.map(function (ele) {
            var origin = ele.shape.get('origin');
            var color = origin.color;
            var originData = origin.data[0] || origin.data;
            var endAngle = startAngle + Math.PI * 2 * scale.scale(originData[scaleField]);
            var angle = (startAngle + endAngle) / 2;
            var point = utils_1.getEndPoint(center, angle, radius);
            startAngle = endAngle;
            // 标签名 使用 angleField
            var name = scale.getText(originData[angleField]);
            var textAlign = point.x > center.x ? 'left' : 'right';
            return {
                x: point.x,
                y: point.y,
                color: color,
                name: name,
                origin: originData,
                // 实际的角度
                angle: utils_1.getAngleByPoint(_this.getGeometry().coordinate, point),
                textAlign: textAlign,
            };
        });
        this.arcPoints = anchors;
    };
    return PieBaseLabel;
}());
exports.default = PieBaseLabel;

},{"../../../../util/text":714,"./utils":581,"@antv/matrix-util":717,"@antv/util":803,"tslib":894}],576:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPieLabel = void 0;
var tslib_1 = require("tslib");
var inner_label_1 = tslib_1.__importDefault(require("./inner-label"));
var outer_label_1 = tslib_1.__importDefault(require("./outer-label"));
var outer_center_label_1 = tslib_1.__importDefault(require("./outer-center-label"));
var PieLabels = {
    inner: inner_label_1.default,
    outer: outer_label_1.default,
    'outer-center': outer_center_label_1.default,
};
function getPieLabel(type) {
    if (!PieLabels[type]) {
        console.warn("this label " + type + " is not registered");
        return;
    }
    return PieLabels[type];
}
exports.getPieLabel = getPieLabel;

},{"./inner-label":577,"./outer-center-label":578,"./outer-label":579,"tslib":894}],577:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.percent2Number = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_label_1 = tslib_1.__importDefault(require("./base-label"));
var utils_1 = require("./utils");
var math_1 = require("../../../../util/math");
function percent2Number(value) {
    var percentage = Number(value.endsWith('%') ? value.slice(0, -1) : value);
    return percentage / 100;
}
exports.percent2Number = percent2Number;
var PieInnerLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PieInnerLabel, _super);
    function PieInnerLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** @override 不能大于0 */
    PieInnerLabel.prototype.adjustOption = function (options) {
        _super.prototype.adjustOption.call(this, options);
        if (options.offset > 0) {
            options.offset = 0;
        }
    };
    PieInnerLabel.prototype.adjustItem = function (item) {
        item.textAlign = 'middle';
    };
    /** @override 不绘制拉线 */
    PieInnerLabel.prototype.drawLines = function () {
        return;
    };
    PieInnerLabel.prototype.layout = function (labels, shapeInfos) {
        var _this = this;
        labels.forEach(function (label, idx) {
            if (idx > 0) {
                util_1.each(labels.slice(0, idx), function (prevLabel) {
                    _this.resolveCollision(label, prevLabel, shapeInfos[idx]);
                });
            }
        });
    };
    PieInnerLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            offsetX: 0,
            offsetY: 0,
            offset: '-30%',
            style: tslib_1.__assign(tslib_1.__assign({}, labelStyle), { textAlign: 'center', textBaseline: 'middle' }),
        };
    };
    /** label 碰撞调整 */
    PieInnerLabel.prototype.resolveCollision = function (label, prev, shapeInfo) {
        var center = this.getCoordinate().center;
        var angle = shapeInfo.angle;
        var box = label.getBBox();
        var prevBBox = prev.getBBox();
        var pos = { x: (box.minX + box.maxX) / 2, y: (box.minY + box.maxY) / 2 };
        // 两种调整方案
        /** 先偏移 x 方向 -> 再计算 y 位置 */
        var pos1 = util_1.clone(pos);
        /** 先偏移 y 方向 -> 再计算 x 位置 */
        var pos2 = util_1.clone(pos);
        // check overlap
        if (prev.get('id') !== label.get('id')) {
            var _a = utils_1.getOverlapInfo(box, prevBBox), xOverlap = _a.xOverlap, yOverlap = _a.yOverlap;
            if (xOverlap) {
                pos1.x = pos.x + xOverlap;
                pos1.y = pos.y + Math.tan(angle) * xOverlap;
            }
            if (yOverlap) {
                // fix issue-460
                var yMover = yOverlap;
                if (pos.y < center.y) {
                    // 上方label优先往上偏移
                    yMover = yMover < 0 ? yMover : prevBBox.minY - box.maxY;
                }
                else {
                    // 下方label优先往下偏移
                    yMover = yMover > 0 ? yMover : prevBBox.maxY - box.minY;
                }
                pos2.y = pos.y + yMover;
                pos2.x = pos.x + yMover / Math.tan(angle);
            }
            var dist1 = math_1.distBetweenPoints(pos, pos1);
            var dist2 = math_1.distBetweenPoints(pos, pos2);
            var actualPos = dist1 < dist2 ? pos1 : pos2;
            // 取偏移距离最小的
            label.attr('x', actualPos.x);
            label.attr('y', actualPos.y);
        }
    };
    return PieInnerLabel;
}(base_label_1.default));
exports.default = PieInnerLabel;

},{"../../../../util/math":680,"./base-label":575,"./utils":581,"@antv/util":803,"tslib":894}],578:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_OFFSET = void 0;
var tslib_1 = require("tslib");
var base_label_1 = tslib_1.__importDefault(require("./base-label"));
// 默认label和element的偏移 16px
exports.DEFAULT_OFFSET = 16;
var PieOuterCenterLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PieOuterCenterLabel, _super);
    function PieOuterCenterLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** @override 不能大于0 */
    PieOuterCenterLabel.prototype.adjustOption = function (options) {
        _super.prototype.adjustOption.call(this, options);
        if (options.offset < 0) {
            options.offset = 0;
        }
    };
    PieOuterCenterLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            offsetX: 0,
            offsetY: 0,
            offset: 12,
            style: tslib_1.__assign(tslib_1.__assign({}, labelStyle), { textBaseline: 'middle' }),
        };
    };
    PieOuterCenterLabel.prototype.adjustItem = function (item) {
        var offset = this.options.offset;
        if (item.textAlign === 'left') {
            item.x += offset > 4 ? 4 : offset / 2;
        }
        else if (item.textAlign === 'right') {
            item.x -= offset > 4 ? 4 : offset / 2;
        }
    };
    /** label 碰撞调整 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
    PieOuterCenterLabel.prototype.layout = function (labels, items, panel) { };
    return PieOuterCenterLabel;
}(base_label_1.default));
exports.default = PieOuterCenterLabel;

},{"./base-label":575,"tslib":894}],579:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_OFFSET = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_label_1 = tslib_1.__importDefault(require("./base-label"));
var utils_1 = require("./utils");
// 默认label和element的偏移 16px
exports.DEFAULT_OFFSET = 16;
var PieOuterLabel = /** @class */ (function (_super) {
    tslib_1.__extends(PieOuterLabel, _super);
    function PieOuterLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** @override 不能大于0 */
    PieOuterLabel.prototype.adjustOption = function (options) {
        _super.prototype.adjustOption.call(this, options);
        if (options.offset < 0) {
            options.offset = 0;
        }
    };
    PieOuterLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            offsetX: 0,
            offsetY: 0,
            offset: 12,
            style: tslib_1.__assign(tslib_1.__assign({}, labelStyle), { textBaseline: 'middle' }),
        };
    };
    /** label 碰撞调整 */
    PieOuterLabel.prototype.layout = function (labels, items, panel) {
        var _this = this;
        var center = this.getCoordinate().center;
        var leftHalf = util_1.filter(labels, function (l) { return l.attr('x') <= center.x; });
        var rightHalf = util_1.filter(labels, function (l) { return l.attr('x') > center.x; });
        [rightHalf, leftHalf].forEach(function (half, isLeft) {
            _this._antiCollision(half, !isLeft, panel);
        });
    };
    /** labels 碰撞处理（重点算法） */
    PieOuterLabel.prototype._antiCollision = function (labels, isRight, panelBox) {
        var _this = this;
        var labelHeight = this.getLabelHeight(labels);
        var _a = this.getCoordinate(), center = _a.center, radius = _a.radius;
        var offset = this.options.offset;
        var totalR = radius + offset;
        var totalHeight = Math.min(panelBox.height, Math.max(totalR * 2 + labelHeight * 2, labels.length * labelHeight));
        var maxLabelsCount = Math.floor(totalHeight / labelHeight);
        // fix-bug, maxLabelsCount 之后的labels 在非 allowOverlap 不显示（避免出现尾部label展示，而前置label不展示）
        if (!this.options.allowOverlap) {
            labels.slice(maxLabelsCount).forEach(function (label) {
                label.get('parent').set('visible', false);
            });
        }
        labels.splice(maxLabelsCount, labels.length - maxLabelsCount);
        // sort by y DESC
        labels.sort(function (a, b) { return a.getBBox().y - b.getBBox().y; });
        // adjust y position of labels to avoid overlapping
        var overlapping = true;
        var i;
        var maxY = center.y + totalHeight / 2;
        var minY = center.y - totalHeight / 2;
        var boxes = labels.map(function (label) {
            var labelBox = label.getBBox();
            if (labelBox.maxY > maxY) {
                maxY = Math.min(panelBox.maxY, labelBox.maxY);
            }
            if (labelBox.minY < minY) {
                minY = Math.max(panelBox.minY, labelBox.minY);
            }
            return {
                text: label.attr('text'),
                size: labelHeight,
                pos: labelBox.y,
                targets: [],
            };
        });
        var j = 0;
        while (j < boxes.length) {
            if (j === boxes.length - 1) {
                boxes[j].targets[0] = maxY;
            }
            else {
                boxes[j].targets[0] = boxes[j + 1].pos - boxes[j + 1].size / 2;
            }
            j++;
        }
        while (overlapping) {
            boxes.forEach(function (box) {
                var target = util_1.last(box.targets);
                box.pos = Math.max(minY, Math.min(box.pos, target - box.size));
            });
            // detect overlapping and join boxes
            overlapping = false;
            i = boxes.length;
            while (i--) {
                if (i > 0) {
                    var previousBox = boxes[i - 1];
                    var box = boxes[i];
                    if (previousBox.pos + previousBox.size > box.pos) {
                        // overlapping
                        previousBox.size += box.size;
                        previousBox.targets = previousBox.targets.concat(box.targets);
                        // overflow, shift up
                        var target = util_1.last(previousBox.targets);
                        if (previousBox.pos + previousBox.size > target) {
                            previousBox.pos = target - previousBox.size;
                        }
                        boxes.splice(i, 1); // removing box
                        overlapping = true;
                    }
                    else {
                        // 换掉最后一个
                        previousBox.targets.splice(-1, 1, box.pos);
                    }
                }
            }
        }
        i = 0;
        // step 4: normalize y and adjust x
        boxes.forEach(function (b) {
            var posInCompositeBox = labelHeight / 2; // middle of the label
            b.targets.forEach(function () {
                labels[i].attr('y', b.pos + posInCompositeBox);
                posInCompositeBox += labelHeight;
                i++;
            });
        });
        // 调整 x 位置在椭圆轨道上
        var topLabels = [];
        var bottomLabels = [];
        labels.forEach(function (label, idx) {
            var anchor = _this.arcPoints[idx];
            if (anchor.angle >= 0 && anchor.angle <= Math.PI) {
                bottomLabels.push(label);
            }
            else {
                topLabels.push(label);
            }
        });
        [topLabels, bottomLabels].forEach(function (adjustLabels, isBottom) {
            if (!adjustLabels.length) {
                return;
            }
            var ry = isBottom ? util_1.last(adjustLabels).getBBox().maxY - center.y : center.y - util_1.head(adjustLabels).getBBox().minY;
            ry = Math.max(totalR, ry);
            var distance = offset > 4 ? 4 : 0;
            var maxLabelWidth = Math.max.apply(0, util_1.map(labels, function (label) { return label.getBBox().width; })) +
                offset +
                distance;
            var rx = Math.max(totalR, Math.min((ry + totalR) / 2, center.x - (panelBox.minX + maxLabelWidth)));
            var rxPow2 = rx * rx;
            var ryPow2 = ry * ry;
            adjustLabels.forEach(function (label, idx) {
                var anchor = _this.arcPoints[idx];
                var box = label.getBBox();
                var boxCenter = { x: box.minX + box.width / 2, y: box.minY + box.height / 2 };
                var dyPow2 = Math.pow(boxCenter.y - center.y, 2);
                var endPoint = utils_1.getEndPoint(center, anchor.angle, radius);
                var distance_offset = (isRight ? 1 : -1) * distance * 2;
                if (dyPow2 > ryPow2) {
                    console.warn('异常(一般不会出现)', label.attr('text'));
                    label.attr('x', endPoint.x + distance_offset);
                }
                else {
                    // (x - cx)^2 / rx ^ 2 + (y - cy)^2 / ry ^ 2 = 1
                    // 避免 label的 拉线 在 element 上
                    var xPos = center.x + (isRight ? 1 : -1) * Math.sqrt((1 - dyPow2 / ryPow2) * rxPow2);
                    if ((center.x === endPoint.x && boxCenter.y === endPoint.y) ||
                        (center.y === endPoint.y && xPos === endPoint.x)) {
                        xPos = endPoint.x;
                    }
                    else {
                        // const k1 = (center.y - endPoint.y) / (center.x - endPoint.x);
                        // const k2 = (boxCenter.y - endPoint.y) / (xPos - endPoint.x);
                        // const theta = Math.atan((k1 - k2) / (1 + k1 * k2));
                        // 切角 < 90度（目前的坐标系 无法精准计算切角）
                        // if (Math.cos(theta) > 0 && (!isRight ? xPos > endPoint.x : xPos < endPoint.x)) {
                        //   xPos = endPoint.x;
                        // }
                    }
                    label.attr('x', xPos + distance_offset);
                }
            });
        });
    };
    /** 获取label height */
    PieOuterLabel.prototype.getLabelHeight = function (labels) {
        if (!this.options.labelHeight) {
            return util_1.head(labels) ? util_1.head(labels).getBBox().height : 14;
        }
        return this.options.labelHeight;
    };
    return PieOuterLabel;
}(base_label_1.default));
exports.default = PieOuterLabel;

},{"./base-label":575,"./utils":581,"@antv/util":803,"tslib":894}],580:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var layer_1 = require("../../layer");
var ANCHOR_OFFSET = 0; // 锚点偏移量
var INFLECTION_OFFSET = 15; // 拐点偏移量
var DEFAULT_COLOR = '#CCC';
var LABEL1_OFFSETY = 2;
var LABEL2_OFFSETY = -2;
var ADJUSTOFFSET = 15;
function getEndPoint(center, angle, r) {
    return {
        x: center.x + r * Math.cos(angle),
        y: center.y + r * Math.sin(angle),
    };
}
var SpiderLabel = /** @class */ (function () {
    function SpiderLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.options = util_1.deepMix({}, this.getDefaultOptions(), cfg);
        this._adjustOptions(this.options);
        this.init();
    }
    SpiderLabel.prototype.init = function () {
        var _this = this;
        this.container = this.view.geometries[0].labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
        });
    };
    SpiderLabel.prototype.render = function () {
        var _this = this;
        if (!this.view || this.view.destroyed) {
            return;
        }
        /** 如果有formatter则事先处理数据 */
        var data = util_1.clone(this.view.getData());
        this.halves = [[], []];
        var shapes = [];
        var elements = this.view.geometries[0].elements;
        util_1.each(elements, function (ele) {
            shapes.push(ele.shape);
        });
        this.coord = this.view.geometries[0].coordinate;
        var _a = this.options, allZero = _a.allZero, trueAngleField = _a.angleField;
        var angleField = this.options.fields[0];
        var scale = this.view.getScalesByDim('y')[angleField];
        var center = this.coord.getCenter();
        var startAngle = this.coord.startAngle;
        var radius = this.coord.polarRadius;
        var _b = this.view.coordinateBBox, width = _b.width, height = _b.height;
        this.width = width;
        this.height = height;
        var angle = startAngle;
        var _loop_1 = function (idx) {
            var d = data[idx];
            // 计算每个切片的middle angle
            var angleValue = scale.scale(d[angleField]);
            var targetAngle = angle + Math.PI * 2 * angleValue;
            var middleAngle = angle + (targetAngle - angle) / 2;
            angle = targetAngle;
            // 根据middle angle计算锚点和拐点距离
            var anchorPoint = getEndPoint(center, middleAngle, radius + ANCHOR_OFFSET);
            var inflectionPoint = getEndPoint(center, middleAngle, radius + INFLECTION_OFFSET);
            // 获取对应shape的color
            var color = DEFAULT_COLOR;
            if (this_1.options.fields.length === 2) {
                var colorField = this_1.options.fields[1];
                var colorScale = this_1.view.geometries[0].scales[colorField];
                var colorIndex = colorScale.scale(d[colorField]);
                if (colorIndex) {
                    var shapeIndex = Math.floor(colorIndex * (shapes.length - 1));
                    color = shapes[shapeIndex].attr('fill');
                }
            }
            // 组装label数据
            var label = {
                _anchor: anchorPoint,
                _inflection: inflectionPoint,
                _data: d,
                x: inflectionPoint.x,
                y: inflectionPoint.y,
                r: radius + INFLECTION_OFFSET,
                fill: color,
                textGroup: null,
                _side: null,
            };
            // 创建label文本
            var texts = [];
            util_1.each(this_1.options.fields, function (f) {
                if (allZero && f === layer_1.percentageField) {
                    texts.push(d[trueAngleField]);
                }
                else {
                    texts.push(d[f]);
                }
            });
            if (this_1.options.formatter) {
                var formatted = this_1.options.formatter(d[trueAngleField], { _origin: d, color: color }, idx);
                if (util_1.isString(formatted)) {
                    formatted = [formatted];
                }
                texts = formatted;
            }
            var textGroup = this_1.container.addGroup({
                capture: false,
                visible: false,
            });
            var textAttrs = {
                x: 0,
                y: 0,
                fontSize: this_1.options.text.fontSize,
                lineHeight: this_1.options.text.fontSize,
                fontWeight: this_1.options.text.fontWeight,
                fill: this_1.options.text.fill,
            };
            // label1:下部label
            var lowerText = d[trueAngleField];
            if (this_1.options.formatter) {
                lowerText = texts[0];
            }
            var lowerTextAttrs = util_1.clone(textAttrs);
            if (texts.length === 2) {
                lowerTextAttrs.fontWeight = 700;
            }
            var lowerTextShape = textGroup.addShape('text', {
                attrs: util_1.mix({
                    textBaseline: texts.length === 2 ? 'top' : 'middle',
                    text: lowerText,
                }, lowerTextAttrs),
                data: d,
                offsetY: texts.length === 2 ? LABEL1_OFFSETY : 0,
                name: 'label',
            });
            lowerTextShape.name = 'label'; // 用于事件标记 shapeName
            /** label2:上部label */
            if (texts.length === 2) {
                var topTextShape = textGroup.addShape('text', {
                    attrs: util_1.mix({
                        textBaseline: 'bottom',
                        text: texts[1],
                    }, textAttrs),
                    data: d,
                    offsetY: LABEL2_OFFSETY,
                    name: 'label',
                });
                topTextShape.name = 'label'; // 用于事件标记 shapeName
            }
            label.textGroup = textGroup;
            /** 将label分组 */
            if (anchorPoint.x < center.x) {
                label._side = 'left';
                this_1.halves[0].push(label);
            }
            else {
                label._side = 'right';
                this_1.halves[1].push(label);
            }
        };
        var this_1 = this;
        // tslint:disable-next-line: prefer-for-of
        for (var idx = 0; idx < data.length; idx++) {
            _loop_1(idx);
        }
        /** 绘制label */
        var maxCountForOneSide = Math.floor(height / this.options.lineHeight);
        util_1.each(this.halves, function (half) {
            if (half.length > maxCountForOneSide) {
                half.splice(maxCountForOneSide, half.length - maxCountForOneSide);
            }
            half.sort(function (a, b) {
                return a.y - b.y;
            });
            _this._antiCollision(half);
        });
        this.view.canvas.draw();
    };
    SpiderLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    SpiderLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.view.canvas.draw();
    };
    SpiderLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.view.canvas.draw();
    };
    SpiderLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    SpiderLabel.prototype.getDefaultOptions = function () {
        return {
            text: {
                fill: 'rgba(0, 0, 0, 0.65)',
                fontSize: 12,
            },
            line: {
                lineWidth: 0.5,
                stroke: 'rgba(0, 0, 0, 0.45)',
            },
            lineHeight: 32,
            /** distance between label and edge */
            sidePadding: 20,
        };
    };
    SpiderLabel.prototype._antiCollision = function (half) {
        var _this = this;
        var coord = this.coord;
        var canvasHeight = coord.getHeight();
        var center = coord.center;
        var radius = coord.getRadius();
        var startY = center.y - radius - INFLECTION_OFFSET - this.options.lineHeight;
        var overlapping = true;
        var totalH = canvasHeight;
        var i;
        var maxY = 0;
        var minY = Number.MIN_VALUE;
        var maxLabelWidth = 0;
        var boxes = half.map(function (label) {
            var labelY = label.y;
            if (labelY > maxY) {
                maxY = labelY;
            }
            if (labelY < minY) {
                minY = labelY;
            }
            var textGroup = label.textGroup;
            var labelWidth = textGroup.getBBox().width;
            if (labelWidth >= maxLabelWidth) {
                maxLabelWidth = labelWidth;
            }
            return {
                size: _this.options.lineHeight,
                targets: [labelY - startY],
            };
        });
        if (maxY - startY > totalH) {
            totalH = maxY - startY;
        }
        var iteratorBoxed = function (items) {
            items.forEach(function (box) {
                var target = (Math.min.apply(minY, box.targets) + Math.max.apply(minY, box.targets)) / 2;
                box.pos = Math.min(Math.max(minY, target - box.size / 2), totalH - box.size);
            });
        };
        while (overlapping) {
            iteratorBoxed(boxes);
            // detect overlapping and join boxes
            overlapping = false;
            i = boxes.length;
            while (i--) {
                if (i > 0) {
                    var previousBox = boxes[i - 1];
                    var box = boxes[i];
                    if (previousBox.pos + previousBox.size > box.pos) {
                        // overlapping
                        previousBox.size += box.size;
                        previousBox.targets = previousBox.targets.concat(box.targets);
                        // overflow, shift up
                        if (previousBox.pos + previousBox.size > totalH) {
                            previousBox.pos = totalH - previousBox.size;
                        }
                        boxes.splice(i, 1); // removing box
                        overlapping = true;
                    }
                }
            }
        }
        i = 0;
        boxes.forEach(function (b) {
            var posInCompositeBox = startY; // middle of the label
            b.targets.forEach(function () {
                half[i].y = b.pos + posInCompositeBox + _this.options.lineHeight / 2;
                posInCompositeBox += _this.options.lineHeight;
                i++;
            });
        });
        var drawnLabels = [];
        half.forEach(function (label) {
            var textGroup = _this._drawLabel(label);
            _this._drawLabelLine(label, maxLabelWidth, textGroup);
            drawnLabels.push(textGroup);
        });
    };
    SpiderLabel.prototype._drawLabel = function (label) {
        var coord = this.coord;
        var center = coord.getCenter();
        var radius = coord.getRadius();
        var y = label.y, textGroup = label.textGroup;
        var children = textGroup.get('children');
        var x_dir = label._side === 'left' ? 1 : -1;
        var textAttrs = tslib_1.__assign({ textAlign: label._side === 'left' ? 'right' : 'left', x: label._side === 'left'
                ? center.x - radius - this.options.sidePadding
                : center.x + radius + this.options.sidePadding }, this.options.style);
        if (this.options.offsetX) {
            textAttrs.x += this.options.offsetX * x_dir;
        }
        children.forEach(function (child) {
            var offsetY = child.get('offsetY');
            var yPosition = y + offsetY;
            child.attr(textAttrs);
            child.attr('y', yPosition);
        });
        textGroup.show();
        return textGroup;
    };
    SpiderLabel.prototype._drawLabelLine = function (label, maxLabelWidth, container) {
        var _anchor = [label._anchor.x, label._anchor.y];
        var _inflection = [label._inflection.x, label._inflection.y];
        var y = label.y, textGroup = label.textGroup;
        if (!textGroup)
            return;
        var lastPoint = [label._side === 'left' ? textGroup.getBBox().maxX + 4 : textGroup.getBBox().minX - 4, y];
        var points = [_anchor, _inflection, lastPoint];
        if (_inflection[1] !== y) {
            // 展示全部文本文本位置做过调整
            if ((_inflection[1] < this.height / 2 && _inflection[1] < y) ||
                (_inflection[1] >= this.height / 2 && _inflection[1] > y)) {
                // 文本被调整下去了，则添加拐点连接线
                var point1 = _inflection;
                var leftPoint = lastPoint[0] + ADJUSTOFFSET;
                var rightPoint = lastPoint[0] - ADJUSTOFFSET;
                var point2 = [label._side === 'left' ? leftPoint : rightPoint, _inflection[1]];
                points = [_anchor, point1, point2, lastPoint];
                if ((label._side === 'right' && point2[0] < point1[0]) || (label._side === 'left' && point2[0] > point1[0])) {
                    points = [_anchor, point1, lastPoint];
                }
            }
            else {
                points = [_anchor, [_inflection[0], y], lastPoint];
            }
        }
        var path = [];
        for (var i = 0; i < points.length; i++) {
            var p = points[i];
            var starter = 'L';
            if (i === 0) {
                starter = 'M';
            }
            path.push([starter, p[0], p[1]]);
        }
        container.addShape('path', {
            attrs: {
                path: path,
                lineWidth: this.options.line.lineWidth,
                stroke: this.options.line.stroke,
            },
        });
        // 绘制锚点
        // container.addShape('circle', {
        //   attrs: {
        //     x: _anchor[0],
        //     y: _anchor[1],
        //     r: this.config.anchorSize,
        //     fill,
        //   },
        // });
    };
    SpiderLabel.prototype._adjustOptions = function (config) {
        if (config.text.fontSize) {
            config.lineHeight = config.text.fontSize * 3;
        }
    };
    return SpiderLabel;
}());
exports.default = SpiderLabel;

},{"../../layer":584,"@antv/util":803,"tslib":894}],581:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLabelRotate = exports.getAngleByPoint = exports.near = exports.inPanel = exports.getOverlapInfo = exports.getOverlapArea = exports.getCenter = exports.getEndPoint = void 0;
function getEndPoint(center, angle, r) {
    return {
        x: center.x + r * Math.cos(angle),
        y: center.y + r * Math.sin(angle),
    };
}
exports.getEndPoint = getEndPoint;
/** 获取矩形中点 */
function getCenter(box) {
    return {
        x: box.x + box.width / 2,
        y: box.y + box.height / 2,
    };
}
exports.getCenter = getCenter;
function getOverlapArea(a, b, margin) {
    if (margin === void 0) { margin = 0; }
    var xOverlap = Math.max(0, Math.min(a.x + a.width + margin, b.x + b.width + margin) - Math.max(a.x - margin, b.x - margin));
    var yOverlap = Math.max(0, Math.min(a.y + a.height + margin, b.y + b.height + margin) - Math.max(a.y - margin, b.y - margin));
    return xOverlap * yOverlap;
}
exports.getOverlapArea = getOverlapArea;
/**
 * 计算两个矩形之间的堆叠情况
 * @return xOverlap x方向重叠大小
 * @return yOverlap y方向重叠大小
 */
function getOverlapInfo(a, b, margin) {
    if (margin === void 0) { margin = 0; }
    var xOverlap = Math.max(0, Math.min(a.x + a.width + margin, b.x + b.width + margin) - Math.max(a.x - margin, b.x - margin));
    var yOverlap = Math.max(0, Math.min(a.y + a.height + margin, b.y + b.height + margin) - Math.max(a.y - margin, b.y - margin));
    // 添加 sign
    if (xOverlap && a.x < b.x) {
        xOverlap = -xOverlap;
    }
    if (yOverlap && a.y < b.y) {
        yOverlap = -yOverlap;
    }
    // 重叠
    if (a.x === b.x && a.width === b.width) {
        xOverlap = b.width;
    }
    if (a.y === b.y && a.height === b.height) {
        yOverlap = b.height;
    }
    return { xOverlap: xOverlap, yOverlap: yOverlap };
}
exports.getOverlapInfo = getOverlapInfo;
/**
 * 粗略地判断是否在panel内部
 * @param panel
 * @param shape
 */
function inPanel(panel, shape) {
    return (panel.x < shape.x &&
        panel.x + panel.width > shape.x + shape.width &&
        panel.y < shape.y &&
        panel.y + panel.height > shape.y + shape.height);
}
exports.inPanel = inPanel;
/**
 * 判断两个数值 是否接近
 * - 解决精度问题（由于无法确定精度上限，根据具体场景可传入 精度 参数）
 */
exports.near = function (x, y, e) {
    if (e === void 0) { e = Math.pow(Number.EPSILON, 0.5); }
    return [x, y].includes(Infinity) ? Math.abs(x) === Math.abs(y) : Math.abs(x - y) < e;
};
/**
 * 获取点到圆心的连线与水平方向的夹角
 */
function getAngleByPoint(coordinate, point) {
    var center = coordinate.getCenter();
    return Math.atan2(point.y - center.y, point.x - center.x);
}
exports.getAngleByPoint = getAngleByPoint;
/**
 * 获取 label 的旋转角度
 * @param angle
 */
function getLabelRotate(angle) {
    var HALF_PI = Math.PI / 2;
    var rotate = angle;
    if (rotate > HALF_PI || rotate < -HALF_PI) {
        rotate = rotate + Math.PI;
    }
    return rotate;
}
exports.getLabelRotate = getLabelRotate;

},{}],582:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    pie: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],583:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Pie = /** @class */ (function (_super) {
    tslib_1.__extends(Pie, _super);
    function Pie() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Pie.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'pie';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Pie.prototype.getAngleScale = function () {
        var layer = this.layers[0];
        return layer.getAngleScale();
    };
    Pie.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Pie;
}(plot_1.default));
exports.default = Pie;

},{"../../base/plot":394,"./layer":584,"@antv/util":803,"tslib":894}],584:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.percentageField = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var EventParser = tslib_1.__importStar(require("./event"));
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
var label_1 = require("./component/label");
var spider_label_1 = tslib_1.__importDefault(require("./component/label/spider-label"));
var global_1 = require("../../base/global");
require("./theme");
exports.percentageField = '$$percentage$$';
var G2_GEOM_MAP = {
    pie: 'interval',
};
var PLOT_GEOM_MAP = {
    pie: 'column',
};
// @ts-ignore
var PieLayer = /** @class */ (function (_super) {
    tslib_1.__extends(PieLayer, _super);
    function PieLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'pie';
        return _this;
    }
    PieLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            width: 400,
            height: 400,
            title: {
                visible: false,
            },
            description: {
                visible: false,
            },
            forceFit: true,
            padding: 'auto',
            radius: 0.8,
            label: {
                visible: true,
                type: 'inner',
                autoRotate: false,
                adjustPosition: true,
                allowOverlap: false,
                line: {
                    visible: true,
                    smooth: true,
                },
            },
            legend: {
                visible: true,
                position: 'right-center',
            },
            tooltip: {
                visible: true,
                shared: false,
                showCrosshairs: false,
                showMarkers: false,
            },
            pieStyle: {
                stroke: 'white',
                lineWidth: 1,
            },
        });
    };
    PieLayer.prototype.afterInit = function () {
        _super.prototype.afterInit.call(this);
        var _a = this.options, angleField = _a.angleField, colorField = _a.colorField, data = _a.data;
        var allZero = util_1.every(data, function (d) { return d[angleField] === 0; });
        if (allZero) {
            var pieGeom = this.view.geometries[0];
            pieGeom.tooltip(colorField + "*" + angleField);
        }
    };
    PieLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        var options = this.options;
        /** 蜘蛛布局label */
        if (options.label && options.label.visible) {
            // 清除，避免二次渲染
            if (this.labelComponent) {
                this.labelComponent.clear();
            }
            var labelConfig = options.label;
            if (labelConfig.type === 'spider') {
                var data = options.data, colorField = options.colorField, angleField_1 = options.angleField;
                var allZero = util_1.every(data, function (d) { return d[angleField_1] === 0; });
                var valueField = allZero ? exports.percentageField : angleField_1;
                this.labelComponent = new spider_label_1.default(tslib_1.__assign({ view: this.view, fields: colorField ? [valueField, colorField] : [valueField], angleField: angleField_1,
                    allZero: allZero }, this.options.label));
                this.labelComponent.render();
            }
            else {
                var LabelCtor = label_1.getPieLabel(labelConfig.type);
                this.labelComponent = new LabelCtor(this, options.label);
                this.labelComponent.render();
            }
        }
    };
    PieLayer.prototype.getAngleScale = function () {
        var angleField = this.options.angleField;
        if (angleField) {
            return this.view.getScaleByField(angleField);
        }
    };
    PieLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    PieLayer.prototype.scale = function () {
        var props = this.options;
        _super.prototype.scale.call(this);
        var scales = {};
        scales[props.angleField] = {};
        scales[props.colorField] = { type: 'cat' };
        scales = util_1.deepMix({}, this.config.scales, scales);
        this.setConfig('scales', scales);
    };
    PieLayer.prototype.processData = function (data) {
        var key = this.options.angleField;
        var allZero = util_1.every(data, function (d) { return d[key] === 0; });
        if (allZero) {
            return data.map(function (item) {
                var _a;
                return (tslib_1.__assign(tslib_1.__assign({}, item), (_a = {}, _a[key] = typeof item[key] === 'string' ? Number.parseFloat(item[key]) : item[key], _a[exports.percentageField] = 1 / data.length, _a)));
            });
        }
        return data.map(function (item) {
            var _a;
            var value = item[key];
            return tslib_1.__assign(tslib_1.__assign({}, item), (_a = {}, _a[key] = value && !isNaN(value) ? +value : value, _a));
        });
    };
    PieLayer.prototype.axis = function () {
        return;
    };
    PieLayer.prototype.coord = function () {
        var props = this.options;
        var coordConfig = {
            type: 'theta',
            cfg: {
                radius: props.radius,
                // @ts-ignore 业务定制,不开放配置
                innerRadius: props.innerRadius || 0,
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    PieLayer.prototype.addGeometry = function () {
        var props = this.options;
        var data = props.data, angleField = props.angleField;
        var pie;
        var allZero = util_1.every(data, function (d) { return d[angleField] === 0; });
        if (allZero) {
            pie = factory_1.getGeom('interval', 'main', {
                plot: this,
                positionFields: [1, exports.percentageField],
            });
        }
        else {
            pie = factory_1.getGeom('interval', 'main', {
                plot: this,
                positionFields: [1, props.angleField],
            });
        }
        pie.adjust = [{ type: 'stack' }];
        this.pie = pie;
        if (props.label) {
            this.label();
        }
        if (props.tooltip && (props.tooltip.fields || props.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', pie);
    };
    PieLayer.prototype.geometryTooltip = function () {
        this.pie.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.pie.tooltip.fields = tooltipOptions.fields;
        }
        else {
            this.pie.tooltip.fields = [this.options.angleField, this.options.colorField];
        }
        if (tooltipOptions.formatter) {
            this.pie.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.pie.tooltip.fields = [this.options.angleField, this.options.colorField];
            }
        }
    };
    PieLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.pie.animate = false;
        }
    };
    PieLayer.prototype.annotation = function () {
        return;
    };
    PieLayer.prototype.parseEvents = function (eventParser) {
        if (eventParser) {
            _super.prototype.parseEvents.call(this, eventParser);
        }
        else {
            _super.prototype.parseEvents.call(this, EventParser);
        }
    };
    PieLayer.prototype.label = function () {
        // 不使用 g2 内置label
        this.pie.label = false;
    };
    return PieLayer;
}(view_layer_1.default));
exports.default = PieLayer;
global_1.registerPlotType('pie', PieLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../geoms/factory":430,"./component/label":576,"./component/label/spider-label":580,"./event":582,"./theme":585,"@antv/util":803,"tslib":894}],585:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var PIE_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { fillOpacity: opacity * 0.8 };
};
var PIE_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { fillOpacity: opacity * 0.5 };
};
theme_1.registerTheme('pie', {
    columnStyle: {
        normal: {},
        active: PIE_ACTIVE_STYLE,
        disable: PIE_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: 'black' },
    },
});

},{"../../theme":669}],586:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    area: 'area',
    line: 'line',
    point: 'point',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],587:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Radar = /** @class */ (function (_super) {
    tslib_1.__extends(Radar, _super);
    function Radar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Radar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'radar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Radar.prototype.getAngleScale = function () {
        var layer = this.layers[0];
        return layer.getAngleScale();
    };
    Radar.prototype.getRadiusScale = function () {
        var layer = this.layers[0];
        return layer.getRadiusScale();
    };
    Radar.prototype.getColorScale = function () {
        var layer = this.layers[0];
        return layer.getColorScale();
    };
    Radar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Radar;
}(plot_1.default));
exports.default = Radar;

},{"../../base/plot":394,"./layer":588,"@antv/util":803,"tslib":894}],588:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../components/factory");
var factory_2 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
var EventParser = tslib_1.__importStar(require("./event"));
require("./theme");
var GEOM_MAP = {
    area: 'area',
    line: 'line',
    point: 'point',
};
var RadarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(RadarLayer, _super);
    function RadarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'radar';
        return _this;
    }
    RadarLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            width: 400,
            height: 400,
            title: {
                visible: false,
            },
            description: {
                visible: false,
            },
            forceFit: true,
            padding: 'auto',
            radius: 0.8,
            smooth: false,
            line: {
                visible: true,
                size: 2,
                style: {
                    opacity: 1,
                },
            },
            area: {
                visible: true,
                style: {
                    opacity: 0.25,
                },
            },
            point: {
                visible: false,
                size: 4,
                shape: 'point',
                style: {
                    opacity: 1,
                },
            },
            angleAxis: {
                visible: true,
                autoRotateTitle: true,
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: true,
                    line: {
                        style: {
                            lineDash: [0, 0],
                        },
                    },
                },
                label: {
                    visible: true,
                    offset: 16,
                    autoRotate: true,
                    autoHide: true,
                },
                title: {
                    visible: false,
                },
            },
            radiusAxis: {
                min: 0,
                visible: true,
                /** G2 4.0 默认 nice 不生效，需要手动添加 */
                nice: true,
                autoRotateTitle: true,
                line: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                gridType: 'line',
                grid: {
                    visible: true,
                    line: {
                        style: {
                            lineDash: [0, 0],
                        },
                    },
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: true,
                },
                title: {
                    visible: false,
                },
            },
            label: {
                visible: false,
                type: 'point',
            },
            legend: {
                visible: true,
                position: 'left-top',
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: false,
            },
        });
    };
    RadarLayer.prototype.init = function () {
        var props = this.options;
        props.xField = props.angleField;
        props.yField = props.radiusField;
        _super.prototype.init.call(this);
    };
    RadarLayer.prototype.getAngleScale = function () {
        var angleField = this.options.angleField;
        return this.view.getScaleByField(angleField);
    };
    RadarLayer.prototype.getRadiusScale = function () {
        var radiusField = this.options.radiusField;
        return this.view.getScaleByField(radiusField);
    };
    RadarLayer.prototype.getColorScale = function () {
        var seriesField = this.options.seriesField;
        return this.view.getScaleByField(seriesField);
    };
    RadarLayer.prototype.geometryParser = function (dim, type) {
        return GEOM_MAP[type];
    };
    RadarLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.angleField] = {};
        if (util_1.has(props, 'angleAxis')) {
            scale_1.extractScale(scales[props.angleField], props.angleAxis);
        }
        /** 配置y-scale */
        scales[props.radiusField] = {};
        if (util_1.has(props, 'radiusAxis')) {
            scale_1.extractScale(scales[props.radiusField], props.radiusAxis);
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    RadarLayer.prototype.coord = function () {
        var props = this.options;
        var coordConfig = {
            type: 'polar',
            cfg: {
                radius: props.radius,
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    RadarLayer.prototype.axis = function () {
        var props = this.options;
        var xAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'angle',
        });
        var yAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'radius',
        });
        var axesConfig = {};
        axesConfig[props.angleField] = xAxis_parser;
        axesConfig[props.radiusField] = yAxis_parser;
        /** 存储坐标轴配置项到config */
        this.setConfig('axes', axesConfig);
    };
    RadarLayer.prototype.addGeometry = function () {
        var props = this.options;
        /** 配置面积 */
        if (props.area.visible) {
            var area = factory_2.getGeom('area', 'main', {
                plot: this,
            });
            this.setConfig('geometry', area);
            this.area = area;
        }
        /** 配置线 */
        if (props.line && props.line.visible) {
            var line = factory_2.getGeom('line', 'main', {
                plot: this,
            });
            this.setConfig('geometry', line);
            this.line = line;
        }
        /** 配置点 */
        if (props.point && props.point.visible) {
            var point = factory_2.getGeom('point', 'guide', {
                plot: this,
            });
            this.setConfig('geometry', point);
            this.point = point;
        }
        if (props.label) {
            this.label();
        }
        if (props.tooltip && (props.tooltip.fields || props.tooltip.formatter)) {
            this.geometryTooltip();
        }
    };
    RadarLayer.prototype.geometryTooltip = function () {
        var geomConfig = this.line ? this.line : this.area;
        geomConfig.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            geomConfig.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            geomConfig.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                geomConfig.tooltip.fields = [this.options.angleField, this.options.radiusField];
            }
            if (this.options.seriesField) {
                geomConfig.tooltip.fields.push(this.options.seriesField);
            }
        }
    };
    RadarLayer.prototype.label = function () {
        var props = this.options;
        if (props.label.visible === false) {
            if (this.point) {
                this.point.label = false;
            }
            if (this.line) {
                this.line.label = false;
            }
            if (this.area) {
                this.area.label = false;
            }
            return;
        }
        // @Todo 雷达图标签布局算法后续补充
        var label = factory_1.getComponent('label', tslib_1.__assign({ fields: [props.radiusField], cfg: {
                type: 'polar',
                autoRotate: false,
            }, plot: this }, props.label));
        if (this.point) {
            this.point.label = label;
        }
        else if (this.line) {
            this.line.label = label;
        }
        else if (this.area) {
            this.area.label = label;
        }
    };
    RadarLayer.prototype.annotation = function () {
        return;
    };
    RadarLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            // 关闭动画
            if (this.area)
                this.area.animate = false;
            if (this.line)
                this.line.animate = false;
            if (this.point)
                this.point.animate = false;
        }
    };
    RadarLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return RadarLayer;
}(view_layer_1.default));
exports.default = RadarLayer;
global_1.registerPlotType('radar', RadarLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../geoms/factory":430,"../../util/scale":712,"./event":586,"./theme":589,"@antv/util":803,"tslib":894}],589:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var theme_1 = require("../../theme");
var AREA_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity };
};
var AREA_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var LINE_ACTIVE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity };
};
var LINE_DISABLE_STYLE = function (style) {
    var opacity = style.opacity || 1;
    return { opacity: opacity * 0.5 };
};
var LINE_SELECTED_STYLE = function (style) {
    var lineWidth = style.lineWidth || 1;
    return { lineWidth: lineWidth + 2 };
};
var POINT_ACTIVE_STYLE = function (style) {
    var color = style.fill || style.fillStyle;
    var radius = style.size || style.radius;
    return {
        radius: radius + 1,
        shadowBlur: radius,
        shadowColor: color,
        stroke: color,
        strokeOpacity: 1,
        lineWidth: 1,
    };
};
var POINT_SELECTED_STYLE = function (style) {
    var color = style.fill || style.fillStyle;
    var radius = style.size || style.radius;
    return {
        radius: radius + 2,
        shadowBlur: radius,
        shadowColor: color,
        stroke: color,
        strokeOpacity: 1,
        lineWidth: 2,
    };
};
var POINT_DISABLED_STYLE = function (style) {
    var opacity = style.opacity || style.fillOpacity || 1;
    return { opacity: opacity * 0.5 };
};
theme_1.registerTheme('radar', {
    areaStyle: {
        normal: {},
        active: AREA_ACTIVE_STYLE,
        disable: AREA_DISABLE_STYLE,
        selected: { lineWidth: 1, stroke: '#333333' },
    },
    lineStyle: {
        normal: {},
        active: LINE_ACTIVE_STYLE,
        disable: LINE_DISABLE_STYLE,
        selected: LINE_SELECTED_STYLE,
    },
    pointStyle: {
        normal: {},
        active: POINT_ACTIVE_STYLE,
        disable: POINT_DISABLED_STYLE,
        selected: POINT_SELECTED_STYLE,
    },
});

},{"../../theme":669}],590:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setShapeCache = void 0;
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
// 记录之前的状态
var shapeCache;
function clipInFromCenter(shape, animateCfg) {
    var bbox = shape.getBBox();
    var centerX = bbox.minX + bbox.width / 2;
    shape.setClip({
        type: 'rect',
        attrs: {
            x: centerX,
            y: bbox.minY,
            width: 0,
            height: bbox.height,
        },
    });
    var cliper = shape.get('clipShape');
    cliper.animate({
        width: bbox.width,
        x: bbox.minX,
    }, animateCfg.duration, animateCfg.easing, function () {
        shape.setClip(null);
    }, animateCfg.delay);
}
clipInFromCenter.animationName = 'clipInFromCenter';
function setShapeCache(shapes) {
    shapeCache = shapes;
}
exports.setShapeCache = setShapeCache;
function updateFromCenter(shape, animateCfg) {
    var fromPath = getShapeFromCache(shape).attr('path');
    var toPath = util_1.clone(shape.attr('path'));
    shape.attr('path', fromPath);
    shape.animate({
        path: toPath,
    }, animateCfg.duration, animateCfg.easing, animateCfg.callback, 100);
}
function getShapeFromCache(shape) {
    var id = shape.id;
    var target;
    util_1.each(shapeCache, function (s) {
        if (s.id === id) {
            target = s;
        }
    });
    return target;
}
updateFromCenter.animationName = 'updateFromCenter';
dependents_1.registerAnimation('clipInFromCenter', clipInFromCenter);
dependents_1.registerAnimation('updateFromCenter', updateFromCenter);

},{"../../dependents":425,"@antv/util":803}],591:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var color_1 = require("../../../util/color");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var DEFAULT_OFFSET = 8;
function mappingColor(band, gray) {
    var reflect;
    util_1.each(band, function (b) {
        var map = b;
        if (gray >= map.from && gray < map.to) {
            reflect = map.color;
        }
    });
    return reflect;
}
var RangeBarLabel = /** @class */ (function () {
    function RangeBarLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        if (!this.options.leftStyle) {
            this.options.leftStyle = this.options.style;
        }
        if (!this.options.rightStyle) {
            this.options.rightStyle = this.options.style;
        }
        this.init();
    }
    RangeBarLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    RangeBarLabel.prototype.render = function () {
        var _this = this;
        var _a = this.getGeometry(), elements = _a.elements, coordinate = _a.coordinate;
        this.coord = coordinate;
        util_1.each(elements, function (ele) {
            var shape = ele.shape;
            var positions = _this.getPosition(shape);
            var values = _this.getValue(shape);
            var textAlign = _this.getTextAlign();
            var labels = [];
            util_1.each(positions, function (pos, i) {
                var style = i === 0 ? _this.options.leftStyle : _this.options.rightStyle;
                var color = _this.getTextColor(shape, i);
                if (_this.options.position === 'inner' && _this.options.adjustColor && color !== 'black') {
                    style.stroke = null;
                }
                var formatter = _this.options.formatter;
                var content = formatter ? formatter(values[i]) : values[i];
                var label = _this.container.addShape('text', {
                    attrs: util_1.deepMix({}, style, {
                        x: pos.x,
                        y: pos.y,
                        text: content,
                        fill: color,
                        textAlign: textAlign[i],
                        textBaseline: 'middle',
                    }),
                    name: 'label',
                });
                labels.push(label);
                _this.doAnimation(label);
            });
            shape.set('labelShapes', labels);
            _this.adjustPosition(labels[0], labels[1], shape);
        });
        this.plot.canvas.draw();
    };
    RangeBarLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    RangeBarLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    RangeBarLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    RangeBarLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    RangeBarLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    RangeBarLabel.prototype.getShapeBbox = function (shape) {
        var _this = this;
        var points = [];
        util_1.each(shape.get('origin').points, function (p) {
            points.push(_this.coord.convertPoint(p));
        });
        var bbox = new bbox_1.default(points[0].x, points[1].y, Math.abs(points[2].x - points[0].x), Math.abs(points[0].y - points[1].y));
        return bbox;
    };
    RangeBarLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            position: 'outer',
            offsetX: DEFAULT_OFFSET,
            offsetY: 0,
            style: util_1.clone(labelStyle),
            adjustColor: true,
            adjustPosition: true,
        };
    };
    RangeBarLabel.prototype.getPosition = function (shape) {
        var bbox = this.getShapeBbox(shape);
        var minX = bbox.minX, maxX = bbox.maxX, minY = bbox.minY, height = bbox.height;
        var _a = this.options, offsetX = _a.offsetX, offsetY = _a.offsetY;
        var y = minY + height / 2 + offsetY;
        var x1, x2;
        if (this.options.position === 'outer') {
            x1 = minX - offsetX;
            x2 = maxX + offsetX;
        }
        else {
            x1 = minX + offsetX;
            x2 = maxX - offsetX;
        }
        return [
            { x: x1, y: y },
            { x: x2, y: y },
        ];
    };
    RangeBarLabel.prototype.getValue = function (shape) {
        var xField = this.plot.options.xField;
        return shape.get('origin').data[xField];
    };
    RangeBarLabel.prototype.getTextAlign = function () {
        if (this.options.position === 'outer') {
            return ['right', 'left'];
        }
        else {
            return ['left', 'right'];
        }
    };
    RangeBarLabel.prototype.getTextColor = function (shape, index) {
        if (this.options.adjustColor && this.options.position === 'inner') {
            var shapeColor = shape.attr('fill');
            var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
            var rgb = color_1.rgb2arr(shapeColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
            var colorBand = [
                { from: 0, to: 85, color: 'white' },
                { from: 85, to: 170, color: '#F6F6F6' },
                { from: 170, to: 255, color: 'black' },
            ];
            var reflect = mappingColor(colorBand, gray);
            return reflect;
        }
        var defaultColor = index === 0 ? this.options.leftStyle.fill : this.options.rightStyle.fill;
        return defaultColor;
    };
    RangeBarLabel.prototype.doAnimation = function (label) {
        if (this.plot.animation && this.plot.animation === false) {
            return;
        }
        label.attr('fillOpacity', 0);
        label.attr('strokeOpacity', 0);
        label.stopAnimate();
        label.animate({
            fillOpacity: 1,
            strokeOpacity: 1,
        }, 800, 'easeLinear', 500);
    };
    RangeBarLabel.prototype.adjustPosition = function (la, lb, shape) {
        var origin = shape.get('origin');
        var shapeMinX = origin.x[0];
        var shapeMaxX = origin.x[1];
        var shapeWidth = Math.abs(shapeMaxX - shapeMinX);
        var panelRange = this.view.coordinateBBox;
        var boxes = [la.getBBox(), lb.getBBox()];
        var ax = la.attr('x');
        var bx = lb.attr('x');
        if (this.options.adjustPosition && this.options.position === 'inner') {
            var totalLength = boxes[0].width + boxes[1].width;
            var isOverlap = boxes[0].maxX - boxes[1].minX > 2;
            var isTooShort = totalLength > shapeWidth;
            if (isOverlap || isTooShort) {
                ax = shapeMinX - this.options.offsetX;
                la.attr('fill', this.options.leftStyle.fill);
                la.attr('textAlign', 'right');
                boxes[0] = la.getBBox();
                bx = shapeMaxX + this.options.offsetX;
                lb.attr('fill', this.options.rightStyle.fill);
                lb.attr('textAlign', 'left');
                boxes[1] = lb.getBBox();
            }
        }
        if (boxes[0].minX < panelRange.minX) {
            ax = panelRange.minX + DEFAULT_OFFSET;
            la.attr('textAlign', 'left');
        }
        la.attr('x', ax);
        lb.attr('x', bx);
        this.plot.canvas.draw();
    };
    RangeBarLabel.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'interval'; });
    };
    return RangeBarLabel;
}());
exports.default = RangeBarLabel;

},{"../../../util/bbox":672,"../../../util/color":673,"@antv/util":803,"tslib":894}],592:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var RangeBar = /** @class */ (function (_super) {
    tslib_1.__extends(RangeBar, _super);
    function RangeBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RangeBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'rangeBar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    RangeBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return RangeBar;
}(plot_1.default));
exports.default = RangeBar;

},{"../../base/plot":394,"./layer":593,"@antv/util":803,"tslib":894}],593:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../bar/layer"));
var label_1 = tslib_1.__importDefault(require("./component/label"));
var animation_1 = require("./animation");
var RangeBarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(RangeBarLayer, _super);
    function RangeBarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'rangeBar';
        return _this;
    }
    RangeBarLayer.getDefaultOptions = function () {
        return util_1.deepMix(_super.getDefaultOptions.call(this), {
            label: {
                visible: true,
                position: 'outer',
            },
            xAxis: {
                visible: true,
                autoRotateTitle: false,
                grid: {
                    visible: true,
                },
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoRotate: true,
                    autoHide: true,
                },
                title: {
                    visible: true,
                    spacing: 12,
                },
            },
            yAxis: {
                visible: true,
                autoRotateTitle: true,
                grid: {
                    visible: false,
                },
                line: {
                    visible: true,
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    visible: true,
                    autoHide: true,
                    autoRotate: false,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
        }, {});
    };
    RangeBarLayer.prototype.afterRender = function () {
        this.renderLabel();
        // 为更新动画缓存shape
        var shapeCaches = [];
        var geoms = this.view.geometries;
        util_1.each(geoms, function (geom) {
            var elements = geom.elements;
            util_1.each(elements, function (ele) {
                shapeCaches.push(ele.shape);
            });
        });
        animation_1.setShapeCache(shapeCaches);
        _super.prototype.afterRender.call(this);
    };
    RangeBarLayer.prototype.renderLabel = function () {
        if (this.options.label && this.options.label.visible) {
            var label = new label_1.default(tslib_1.__assign({ view: this.view, plot: this }, this.options.label));
            label.render();
        }
    };
    RangeBarLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
    };
    return RangeBarLayer;
}(layer_1.default));
exports.default = RangeBarLayer;
global_1.registerPlotType('rangeBar', RangeBarLayer);

},{"../../base/global":392,"../bar/layer":464,"./animation":590,"./component/label":591,"@antv/util":803,"tslib":894}],594:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setShapeCache = void 0;
var dependents_1 = require("../../dependents");
var util_1 = require("@antv/util");
// 记录之前的状态
var shapeCache;
function clipInFromCenterVertical(shape, animateCfg) {
    var bbox = shape.getBBox();
    var centerY = bbox.minY + bbox.height / 2;
    shape.setClip({
        type: 'rect',
        attrs: {
            x: bbox.minX,
            y: centerY,
            width: bbox.width,
            height: 0,
        },
    });
    var cliper = shape.get('clipShape');
    cliper.animate({
        height: bbox.height,
        y: bbox.minY,
    }, animateCfg.duration, animateCfg.easing, function () {
        shape.setClip(null);
    }, animateCfg.delay);
}
clipInFromCenterVertical.animationName = 'clipInFromCenterVertical';
function setShapeCache(shapes) {
    shapeCache = shapes;
}
exports.setShapeCache = setShapeCache;
function updateFromCenterVertical(shape, animateCfg) {
    var fromPath = getShapeFromCache(shape).attr('path');
    var toPath = util_1.clone(shape.attr('path'));
    shape.attr('path', fromPath);
    shape.animate({
        path: toPath,
    }, animateCfg.duration, animateCfg.easing, animateCfg.callback, 100);
}
function getShapeFromCache(shape) {
    var id = shape.id;
    var target;
    util_1.each(shapeCache, function (s) {
        if (s.id === id) {
            target = s;
        }
    });
    return target;
}
updateFromCenterVertical.animationName = 'updateFromCenterVertical';
dependents_1.registerAnimation('clipInFromCenterVertical', clipInFromCenterVertical);
dependents_1.registerAnimation('updateFromCenterVertical', updateFromCenterVertical);

},{"../../dependents":425,"@antv/util":803}],595:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var color_1 = require("../../../util/color");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var DEFAULT_OFFSET = 8;
function mappingColor(band, gray) {
    var reflect;
    util_1.each(band, function (b) {
        var map = b;
        if (gray >= map.from && gray < map.to) {
            reflect = map.color;
        }
    });
    return reflect;
}
var RangeColumnLabel = /** @class */ (function () {
    function RangeColumnLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        if (!this.options.topStyle) {
            this.options.topStyle = this.options.style;
        }
        if (!this.options.bottomStyle) {
            this.options.bottomStyle = this.options.style;
        }
        this.init();
    }
    RangeColumnLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    RangeColumnLabel.prototype.render = function () {
        var _this = this;
        var _a = this.getGeometry(), coordinate = _a.coordinate, elements = _a.elements;
        this.coord = coordinate;
        util_1.each(elements, function (ele) {
            var shape = ele.shape;
            var positions = _this.getPosition(shape);
            var values = _this.getValue(shape);
            var textBaeline = _this.getTextBaseline();
            var labels = [];
            util_1.each(positions, function (pos, i) {
                var style = i === 1 ? _this.options.topStyle : _this.options.bottomStyle;
                var color = _this.getTextColor(shape, i);
                if (_this.options.position === 'inner' && _this.options.adjustColor && color !== 'black') {
                    style.stroke = null;
                }
                var formatter = _this.options.formatter;
                var content = formatter ? formatter(values[i]) : values[i];
                var label = _this.container.addShape('text', {
                    attrs: util_1.deepMix({}, style, {
                        x: pos.x,
                        y: pos.y,
                        text: content,
                        fill: color,
                        textAlign: 'center',
                        textBaseline: textBaeline[i],
                    }),
                    name: 'label',
                });
                labels.push(label);
                _this.doAnimation(label);
            });
            shape.set('labelShapes', labels);
            _this.adjustPosition(labels[0], labels[1], shape);
        });
        this.plot.canvas.draw();
    };
    RangeColumnLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    RangeColumnLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    RangeColumnLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    RangeColumnLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    RangeColumnLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    RangeColumnLabel.prototype.getShapeBbox = function (shape) {
        var _this = this;
        var points = [];
        util_1.each(shape.get('origin').points, function (p) {
            points.push(_this.coord.convertPoint(p));
        });
        var bbox = new bbox_1.default(points[0].x, points[1].y, Math.abs(points[2].x - points[0].x), Math.abs(points[0].y - points[1].y));
        return bbox;
    };
    RangeColumnLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            position: 'outer',
            offsetX: 0,
            offsetY: DEFAULT_OFFSET,
            style: util_1.clone(labelStyle),
            adjustColor: true,
            adjustPosition: true,
        };
    };
    RangeColumnLabel.prototype.getPosition = function (shape) {
        var bbox = this.getShapeBbox(shape);
        var minX = bbox.minX, minY = bbox.minY, maxY = bbox.maxY, width = bbox.width;
        var offsetY = this.options.offsetY;
        var x = minX + width / 2;
        var y1, y2;
        if (this.options.position === 'outer') {
            y1 = minY - offsetY;
            y2 = maxY + offsetY;
        }
        else {
            y1 = minY + offsetY;
            y2 = maxY - offsetY;
        }
        return [
            { x: x, y: y2 },
            { x: x, y: y1 },
        ];
    };
    RangeColumnLabel.prototype.getValue = function (shape) {
        var yField = this.plot.options.yField;
        return shape.get('origin').data[yField];
    };
    RangeColumnLabel.prototype.getTextBaseline = function () {
        if (this.options.position === 'outer') {
            return ['top', 'bottom'];
        }
        else {
            return ['bottom', 'top'];
        }
    };
    RangeColumnLabel.prototype.getTextColor = function (shape, index) {
        if (this.options.adjustColor && this.options.position === 'inner') {
            var shapeColor = shape.attr('fill');
            var shapeOpacity = shape.attr('opacity') ? shape.attr('opacity') : 1;
            var rgb = color_1.rgb2arr(shapeColor);
            var gray = Math.round(rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) / shapeOpacity;
            var colorBand = [
                { from: 0, to: 85, color: 'white' },
                { from: 85, to: 170, color: '#F6F6F6' },
                { from: 170, to: 255, color: 'black' },
            ];
            var reflect = mappingColor(colorBand, gray);
            return reflect;
        }
        var defaultColor = index === 1 ? this.options.topStyle.fill : this.options.bottomStyle.fill;
        return defaultColor;
    };
    RangeColumnLabel.prototype.doAnimation = function (label) {
        if (this.plot.animation && this.plot.animation === false) {
            return;
        }
        label.attr('fillOpacity', 0);
        label.attr('strokeOpacity', 0);
        label.stopAnimate();
        label.animate({
            fillOpacity: 1,
            strokeOpacity: 1,
        }, 800, 'easeLinear', 500);
    };
    RangeColumnLabel.prototype.adjustPosition = function (la, lb, shape) {
        var origin = shape.get('origin');
        var shapeMinY = origin.y[1];
        var shapeMaxY = origin.y[0];
        var bbox = shape.getBBox();
        var height = bbox.height;
        var shapeHeight = height;
        var panelRange = this.view.coordinateBBox;
        var boxes = [la.getBBox(), lb.getBBox()];
        var ay = la.attr('y');
        var by = lb.attr('y');
        if (this.options.adjustPosition && this.options.position === 'inner') {
            var totalLength = boxes[0].height + boxes[1].height;
            var isOverlap = boxes[1].maxY - boxes[0].minY > 2;
            var isTooShort = totalLength > shapeHeight;
            if (isOverlap || isTooShort) {
                by = shapeMinY - this.options.offsetY;
                lb.attr('fill', this.options.topStyle.fill);
                lb.attr('textBaseline', 'bottom');
                ay = shapeMaxY + this.options.offsetY;
                la.attr('fill', this.options.bottomStyle.fill);
                la.attr('textBaseline', 'top');
                boxes[0] = la.getBBox();
                boxes[1] = lb.getBBox();
            }
        }
        // fixme: textBaseline 取不准bbox
        if (boxes[0].maxY > panelRange.maxY - DEFAULT_OFFSET) {
            ay = panelRange.maxY - DEFAULT_OFFSET / 2;
            la.attr('textBaseline', 'bottom');
        }
        la.attr('y', ay);
        lb.attr('y', by);
        this.plot.canvas.draw();
    };
    RangeColumnLabel.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'interval'; });
    };
    return RangeColumnLabel;
}());
exports.default = RangeColumnLabel;

},{"../../../util/bbox":672,"../../../util/color":673,"@antv/util":803,"tslib":894}],596:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var RangeColumn = /** @class */ (function (_super) {
    tslib_1.__extends(RangeColumn, _super);
    function RangeColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RangeColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'rangeColumn';
        _super.prototype.createLayers.call(this, layerProps);
    };
    RangeColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return RangeColumn;
}(plot_1.default));
exports.default = RangeColumn;

},{"../../base/plot":394,"./layer":597,"@antv/util":803,"tslib":894}],597:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../column/layer"));
var label_1 = tslib_1.__importDefault(require("./component/label"));
var animation_1 = require("./animation");
var RangeColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(RangeColumnLayer, _super);
    function RangeColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'rangeColumn';
        return _this;
    }
    RangeColumnLayer.getDefaultOptions = function () {
        return util_1.deepMix(_super.getDefaultOptions.call(this), {
            label: {
                visible: true,
                position: 'outer',
            },
        }, {});
    };
    RangeColumnLayer.prototype.afterRender = function () {
        this.renderLabel();
        // 为更新动画缓存shape
        var shapeCaches = [];
        var geoms = this.view.geometries;
        util_1.each(geoms, function (geom) {
            var elements = geom.elements;
            util_1.each(elements, function (ele) {
                shapeCaches.push(ele.shape);
            });
        });
        animation_1.setShapeCache(shapeCaches);
        _super.prototype.afterRender.call(this);
    };
    RangeColumnLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        this.column.animate = {
            appear: {
                animation: 'clipInFromCenterVertical',
                duration: 600,
            },
            update: {
                animation: 'updateFromCenterVertical',
                duration: 600,
            },
        };
    };
    RangeColumnLayer.prototype.renderLabel = function () {
        if (this.options.label && this.options.label.visible) {
            var label = new label_1.default(tslib_1.__assign({ view: this.view, plot: this }, this.options.label));
            label.render();
        }
    };
    return RangeColumnLayer;
}(layer_1.default));
exports.default = RangeColumnLayer;
global_1.registerPlotType('rangeColumn', RangeColumnLayer);

},{"../../base/global":392,"../column/layer":490,"./animation":594,"./component/label":595,"@antv/util":803,"tslib":894}],598:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    rose: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],599:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-17
 */
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
// TODO label的优化，可能要重新参考 https://github.com/antvis/G2Plot/blob/master/src/plots/rose/component/label/rose-label.ts
var Rose = /** @class */ (function (_super) {
    tslib_1.__extends(Rose, _super);
    function Rose() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Rose.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'rose';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Rose.prototype.getRadiusScale = function () {
        var layer = this.layers[0];
        return layer.getRadiusScale();
    };
    Rose.prototype.getAngleScale = function () {
        var layer = this.layers[0];
        return layer.getAngleScale();
    };
    Rose.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Rose;
}(plot_1.default));
exports.default = Rose;

},{"../../base/plot":394,"./layer":600,"@antv/util":803,"tslib":894}],600:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-17
 */
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../components/factory");
var factory_2 = require("../../geoms/factory");
var EventParser = tslib_1.__importStar(require("./event"));
var G2_GEOM_MAP = {
    rose: 'interval',
};
var PLOT_GEOM_MAP = {
    rose: 'column',
};
var RoseLayer = /** @class */ (function (_super) {
    tslib_1.__extends(RoseLayer, _super);
    function RoseLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'rose';
        return _this;
    }
    RoseLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            width: 400,
            height: 400,
            title: {
                visible: false,
            },
            description: {
                visible: false,
            },
            forceFit: true,
            padding: 'auto',
            radius: 0.8,
            innerRadius: 0,
            label: {
                visible: true,
                type: 'inner',
                autoRotate: true,
                adjustColor: false,
            },
            legend: {
                visible: true,
                position: 'right',
            },
            tooltip: {
                visible: true,
                shared: false,
                showCrosshairs: false,
                showMarkers: false,
            },
            columnStyle: {
                stroke: 'white',
                lineWidth: 1,
            },
            xAxis: {
                visible: false,
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: true,
                    alignTick: false,
                    style: {
                        lineWidth: 0.5,
                    },
                },
                label: {
                    offset: 5,
                    autoRotate: true,
                },
            },
            yAxis: {
                visible: false,
            },
        });
    };
    RoseLayer.prototype.getOptions = function (props) {
        var options = _super.prototype.getOptions.call(this, props);
        var columnStyle = props.sectorStyle;
        var xField = props.categoryField;
        var yField = props.radiusField;
        return util_1.deepMix({}, options, { columnStyle: columnStyle, xField: xField, yField: yField });
    };
    RoseLayer.prototype.getRadiusScale = function () {
        var radiusField = this.options.radiusField;
        if (radiusField) {
            this.view.getScaleByField(radiusField);
        }
    };
    RoseLayer.prototype.getAngleScale = function () {
        var categoryField = this.options.categoryField;
        if (categoryField) {
            this.view.getScaleByField(categoryField);
        }
    };
    RoseLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    RoseLayer.prototype.scale = function () {
        // super.scale();
        var props = this.options;
        var scales = {};
        scales[props.radiusField] = {};
        scales[props.categoryField] = { type: 'cat' };
        this.setConfig('scales', scales);
    };
    /** 不显示坐标轴 */
    /*protected axis() {
      super.axis();
      const options = this.options;
      if (!options.stackField && !options.groupField) {
        this.setConfig('axes', false);
      }
    }*/
    RoseLayer.prototype.coord = function () {
        var props = this.options;
        var coordConfig = {
            type: 'polar',
            cfg: {
                radius: props.radius,
                innerRadius: props.innerRadius || 0,
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    RoseLayer.prototype.addGeometry = function () {
        var options = this.options;
        var rose = factory_2.getGeom('interval', 'main', {
            plot: this,
            positionFields: [options.categoryField, options.radiusField],
            widthRatio: {
                rose: 1,
            },
        });
        rose.label = this.extractLabel();
        rose.adjust = this.adjustRoseAdjust();
        this.rose = rose;
        if (options.tooltip && (options.tooltip.fields || options.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', rose);
    };
    RoseLayer.prototype.adjustRoseAdjust = function () {
        return;
    };
    RoseLayer.prototype.geometryTooltip = function () {
        this.rose.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.rose.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.rose.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.rose.tooltip.fields = [this.options.radiusField, this.options.categoryField, this.options.colorField];
            }
        }
    };
    RoseLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.rose.animate = false;
        }
    };
    RoseLayer.prototype.annotation = function () {
        return;
    };
    RoseLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    RoseLayer.prototype.extractLabel = function () {
        var options = this.options;
        if (!options.label || !options.label.visible) {
            return false;
        }
        var label = util_1.deepMix({}, options.label);
        this.adjustLabelOptions(label);
        var fields = [options.categoryField, options.radiusField];
        var labelConfig = factory_1.getComponent('label', tslib_1.__assign({ plot: this, labelType: 'polar', fields: fields }, label));
        return labelConfig;
    };
    RoseLayer.prototype.adjustLabelOptions = function (labelOptions) {
        var radiusField = this.options.radiusField;
        if (labelOptions) {
            var offset = labelOptions.offset, type = labelOptions.type, content = labelOptions.content;
            if (type === 'inner') {
                labelOptions.offset = offset < 0 ? offset : -10;
            }
            else if (type === 'outer') {
                labelOptions.offset = offset >= 0 ? offset : 10;
            }
            if (!content) {
                // 默认显示 数值
                labelOptions.content = function (text, item) { return "" + item._origin[radiusField]; };
            }
        }
    };
    return RoseLayer;
}(view_layer_1.default));
exports.default = RoseLayer;
global_1.registerPlotType('rose', RoseLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../geoms/factory":430,"./event":598,"@antv/util":803,"tslib":894}],601:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var Quadrant = /** @class */ (function () {
    function Quadrant(cfg) {
        this.quadrantGroups = [];
        this.regionData = [];
        this.lineData = [];
        this.options = cfg;
        this.view = this.options.view;
        this.init();
    }
    Quadrant.prototype.init = function () {
        var _a = this.options, xBaseline = _a.xBaseline, yBaseline = _a.yBaseline;
        var coord = this.view.getCoordinate();
        // TODO: xBaseline和yBaseline支持百分比
        // 根据 xBaseline 和 yBaseline 分割象限
        var xScale = this.view.getScaleByField(this.options.plotOptions.xField);
        var yScale = this.view.getScaleByField(this.options.plotOptions.yField);
        // 先进行 x 方向的分割
        var xRegion;
        if (xBaseline > xScale.min && xBaseline < xScale.max) {
            var ratio = (xBaseline - xScale.min) / (xScale.max - xScale.min);
            xRegion = [
                new bbox_1.default(coord.start.x, coord.end.y, coord.getWidth() * ratio, coord.getHeight()),
                new bbox_1.default(coord.start.x + coord.getWidth() * ratio, coord.end.y, coord.getWidth() * (1 - ratio), coord.getHeight()),
            ];
            var verticalLineData = {
                start: { x: coord.start.x + coord.getWidth() * ratio, y: coord.end.y },
                end: { x: coord.start.x + coord.getWidth() * ratio, y: coord.start.y },
            };
            this.lineData.push(verticalLineData);
        }
        else {
            xRegion = [new bbox_1.default(coord.start.x, coord.end.y, coord.getWidth(), coord.getHeight())];
        }
        // 再进行 y 方向的分割
        if (yBaseline > yScale.min && yBaseline < yScale.max) {
            var ratio = (yBaseline - yScale.min) / (yScale.max - yScale.min);
            var horizontalLineData = {
                start: { x: coord.start.x, y: coord.start.y - coord.getHeight() * ratio },
                end: { x: coord.end.x, y: coord.start.y - coord.getHeight() * ratio },
            };
            this.lineData.push(horizontalLineData);
            var topQuadrant = {
                name: xBaseline <= xScale.min ? 'top-right' : 'top-left',
                bbox: new bbox_1.default(xRegion[0].minX, xRegion[0].minY, xRegion[0].width, xRegion[0].height * (1 - ratio)),
                index: xBaseline <= xScale.min ? 2 : 0,
            };
            this.regionData.push(topQuadrant);
            var bottomQuadrant = {
                name: xBaseline <= xScale.min ? 'bottom-right' : 'bottom-left',
                bbox: new bbox_1.default(xRegion[0].minX, xRegion[0].minY + xRegion[0].height * (1 - ratio), xRegion[0].width, xRegion[0].height * ratio),
                index: xBaseline <= xScale.min ? 3 : 1,
            };
            this.regionData.push(bottomQuadrant);
            // 四象限齐全
            if (xRegion.length > 1) {
                var rightTopQuadrant = {
                    name: 'top-right',
                    bbox: new bbox_1.default(xRegion[1].minX, xRegion[1].minY, xRegion[1].width, xRegion[1].height * (1 - ratio)),
                    index: 2,
                };
                this.regionData.push(rightTopQuadrant);
                var rightBottomQuadrant = {
                    name: 'bottom-right',
                    bbox: new bbox_1.default(xRegion[1].minX, xRegion[1].minY + xRegion[1].height * (1 - ratio), xRegion[1].width, xRegion[1].height * ratio),
                    index: 3,
                };
                this.regionData.push(rightBottomQuadrant);
            }
        }
        else if (xRegion.length === 2) {
            if (yBaseline <= yScale.min) {
                var leftTopQuadrant = {
                    name: 'top-left',
                    bbox: xRegion[0],
                    index: 0,
                };
                this.regionData.push(leftTopQuadrant);
                var rightTopQuadrant = {
                    name: 'top-right',
                    bbox: xRegion[1],
                    index: 2,
                };
                this.regionData.push(rightTopQuadrant);
            }
            else {
                var leftBottomQuadrant = {
                    name: 'bottom-left',
                    bbox: xRegion[0],
                    index: 1,
                };
                this.regionData.push(leftBottomQuadrant);
                var rightBottomQuadrant = {
                    name: 'bottom-right',
                    bbox: xRegion[1],
                    index: 3,
                };
                this.regionData.push(rightBottomQuadrant);
            }
        }
        else {
            // 当前绘制区域全部在一个象限中
            if (xBaseline <= xScale.min) {
                if (yBaseline <= yScale.min) {
                    var rightTopQuadrant = {
                        name: 'top-right',
                        bbox: xRegion[0],
                        index: 2,
                    };
                    this.regionData.push(rightTopQuadrant);
                }
                else {
                    var rightBottomQuadrant = {
                        name: 'bottom-right',
                        bbox: xRegion[0],
                        index: 3,
                    };
                    this.regionData.push(rightBottomQuadrant);
                }
            }
            else {
                if (yBaseline <= yScale.min) {
                    var leftTopQuadrant = {
                        name: 'top-left',
                        bbox: xRegion[0],
                        index: 0,
                    };
                    this.regionData.push(leftTopQuadrant);
                }
                else {
                    var leftBottomQuadrant = {
                        name: 'bottom-left',
                        bbox: xRegion[0],
                        index: 1,
                    };
                    this.regionData.push(leftBottomQuadrant);
                }
            }
        }
        // 创建container
        this.container = this.view.backgroundGroup.addGroup();
    };
    Quadrant.prototype.render = function () {
        var _this = this;
        if (this.regionData.length > 0) {
            var defaultStyle_1 = this.getDefaultStyle();
            var regionStyle_1 = this.getRegionStyle(this.regionData);
            util_1.each(this.regionData, function (d) {
                var index = d.index;
                var group = _this.container.addGroup();
                var rect = group.addShape('rect', {
                    attrs: tslib_1.__assign({ x: d.bbox.minX, y: d.bbox.minY, width: d.bbox.width, height: d.bbox.height }, regionStyle_1[index]),
                    name: 'quadrant',
                });
                if (_this.options.label && _this.options.label.text) {
                    var labelOptions = util_1.deepMix({}, defaultStyle_1.label, _this.options.label);
                    var labelCfg = _this.getLabelConfig(d, labelOptions);
                    group.addShape('text', {
                        attrs: tslib_1.__assign({}, labelCfg),
                        name: 'quadrant-label',
                    });
                }
                // rect.setSilent('data', d);
                rect.set('data', d);
                _this.quadrantGroups.push(group);
            });
            // 绘制象限辅助线
            var lineStyle_1 = util_1.deepMix({}, defaultStyle_1.line, this.options.lineStyle);
            util_1.each(this.lineData, function (d) {
                _this.container.addShape('path', {
                    attrs: tslib_1.__assign({ path: [
                            ['M', d.start.x, d.start.y],
                            ['L', d.end.x, d.end.y],
                        ] }, lineStyle_1),
                    name: 'quadrant-line',
                });
            });
            this.view.canvas.draw();
        }
    };
    Quadrant.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    Quadrant.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
    };
    Quadrant.prototype.getDefaultStyle = function () {
        return {
            line: {
                stroke: '#9ba29a',
                lineWidth: 1,
            },
            regionStyle: [
                { fill: '#000000', opacity: 0.05 },
                { fill: '#ffffff', opacity: 0 },
                { fill: '#ffffff', opacity: 0 },
                { fill: '#000000', opacity: 0.05 },
            ],
            label: {
                position: 'outter-inner',
                offset: 10,
                style: {
                    fontSize: 14,
                    fill: '#ccc',
                },
            },
        };
    };
    Quadrant.prototype.getRegionStyle = function (regionData) {
        var defaultStyle = this.getDefaultStyle();
        var style = defaultStyle.regionStyle;
        if (this.options.regionStyle) {
            var regionStyle_2 = this.options.regionStyle;
            if (util_1.isArray(regionStyle_2)) {
                style = style.map(function (s, index) {
                    if (regionStyle_2.length > index && regionStyle_2[index]) {
                        return regionStyle_2[index];
                    }
                    return s;
                });
            }
            else if (util_1.isFunction(regionStyle_2)) {
                util_1.each(regionData, function (d, index) {
                    style[index] = regionStyle_2(d);
                });
            }
        }
        return style;
    };
    Quadrant.prototype.getLabelConfig = function (region, labelOptions) {
        var index = region.index;
        var x = 0;
        var y = 0;
        var style = {};
        var text = labelOptions.text;
        if (util_1.isFunction(text)) {
            text = text(region);
        }
        else if (util_1.isArray(text)) {
            text = text[index];
        }
        var position = labelOptions.position;
        var pos = position.split('-');
        var dim = region.name.split('-');
        // x方向
        if (dim[1] === 'left') {
            if (pos[0] === 'inner') {
                x = region.bbox.maxX - labelOptions.offset;
                style.textAlign = 'right';
            }
            if (pos[0] === 'outter') {
                x = region.bbox.minX + labelOptions.offset;
                style.textAlign = 'left';
            }
        }
        else if (dim[1] === 'right') {
            if (pos[0] === 'inner') {
                x = region.bbox.minX + labelOptions.offset;
                style.textAlign = 'left';
            }
            if (pos[0] === 'outter') {
                x = region.bbox.maxX - labelOptions.offset;
                style.textAlign = 'right';
            }
        }
        // y方向
        if (dim[0] === 'top') {
            if (pos[1] === 'inner') {
                y = region.bbox.maxY - labelOptions.offset;
                style.textBaseline = 'bottom';
            }
            if (pos[1] === 'outter') {
                y = region.bbox.minY + labelOptions.offset;
                style.textBaseline = 'top';
            }
        }
        else if (dim[0] === 'bottom') {
            if (pos[1] === 'inner') {
                y = region.bbox.minY + labelOptions.offset;
                style.textBaseline = 'top';
            }
            if (pos[1] === 'outter') {
                y = region.bbox.maxY - labelOptions.offset;
                style.textBaseline = 'bottom';
            }
        }
        style = util_1.deepMix({}, labelOptions.style, style);
        style.lineHeight = style.fontSize;
        return tslib_1.__assign({ x: x,
            y: y,
            text: text }, style);
    };
    return Quadrant;
}());
exports.default = Quadrant;

},{"../../../util/bbox":672,"@antv/util":803,"tslib":894}],602:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var scale_1 = require("@antv/scale");
var d3_regression_1 = require("d3-regression");
var path_1 = require("../../../util/path");
var REGRESSION_MAP = {
    exp: d3_regression_1.regressionExp,
    linear: d3_regression_1.regressionLinear,
    loess: d3_regression_1.regressionLoess,
    log: d3_regression_1.regressionLog,
    poly: d3_regression_1.regressionPoly,
    pow: d3_regression_1.regressionPow,
    quad: d3_regression_1.regressionQuad,
};
function se95(p, n) {
    return Math.sqrt((p * (1 - p)) / n) * 1.96;
}
var TrendLine = /** @class */ (function () {
    function TrendLine(cfg) {
        var defaultOptions = {
            type: 'linear',
            style: {
                stroke: '#9ba29a',
                lineWidth: 2,
                opacity: 0.5,
                lineJoin: 'round',
                lineCap: 'round',
            },
            showConfidence: false,
            confidenceStyle: {
                fill: '#ccc',
                opacity: 0.1,
            },
        };
        this.options = util_1.deepMix({}, defaultOptions, cfg);
        this.view = this.options.view;
        this.init();
    }
    TrendLine.prototype.init = function () {
        // 处理数据
        var _a = this.options.plotOptions, xField = _a.xField, yField = _a.yField, data = _a.data;
        var reg = REGRESSION_MAP[this.options.type]()
            .x(function (d) { return d[xField]; })
            .y(function (d) { return d[yField]; });
        this.data = this.processData(reg(data));
        // 创建container
        this.container = this.view.backgroundGroup.addGroup();
    };
    TrendLine.prototype.render = function () {
        var xscale_view = this.view.getScaleByField(this.options.plotOptions.xField);
        var yscale_view = this.view.getScaleByField(this.options.plotOptions.yField);
        var coord = this.view.getCoordinate();
        var trendlineData = this.data.trendlineData;
        // 创建图形绘制的scale
        var LinearScale = scale_1.getScale('linear');
        var xRange = this.adjustScale(xscale_view, trendlineData, 'x');
        var xScale = new LinearScale({
            min: xRange.min,
            max: xRange.max,
        });
        var yRange = this.adjustScale(yscale_view, trendlineData, 'y');
        var yScale = new LinearScale({
            min: yRange.min,
            max: yRange.max,
        });
        // 绘制置信区间曲线
        if (this.options.showConfidence) {
            var confidencePath = this.getConfidencePath(xScale, yScale, coord);
            this.container.addShape('path', {
                attrs: tslib_1.__assign({ path: confidencePath }, this.options.confidenceStyle),
                name: 'confidence',
            });
        }
        // 绘制trendline
        var points = this.getTrendlinePoints(xScale, yScale, coord);
        var constraint = [
            [0, 0],
            [1, 1],
        ];
        var path = path_1.getSplinePath(points, false, constraint);
        this.shape = this.container.addShape('path', {
            attrs: tslib_1.__assign({ path: path }, this.options.style),
            name: 'trendline',
        });
    };
    TrendLine.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    TrendLine.prototype.destroy = function () {
        if (this.container) {
            this.container.destroy();
        }
    };
    TrendLine.prototype.processData = function (data) {
        var trendline = [];
        var confidence = [];
        util_1.each(data, function (d) {
            trendline.push({ x: d[0], y: d[1] });
            var conf = se95(data.rSquared, d[1]);
            confidence.push({ x: d[0], y0: d[1] - conf, y1: d[1] + conf });
        });
        return { trendlineData: trendline, confidenceData: confidence };
    };
    TrendLine.prototype.getTrendlinePoints = function (xScale, yScale, coord) {
        var points = [];
        util_1.each(this.data.trendlineData, function (d) {
            var xRatio = xScale.scale(d.x);
            var yRatio = yScale.scale(d.y);
            var x = coord.start.x + coord.width * xRatio;
            var y = coord.start.y - coord.height * yRatio;
            points.push({ x: x, y: y });
        });
        return points;
    };
    TrendLine.prototype.getConfidencePath = function (xScale, yScale, coord) {
        var upperPoints = [];
        var lowerPoints = [];
        var path = [];
        util_1.each(this.data.confidenceData, function (d) {
            var xRatio = xScale.scale(d.x);
            var y0Ratio = yScale.scale(d.y0);
            var y1Ratio = yScale.scale(d.y1);
            var x = coord.start.x + coord.width * xRatio;
            var y0 = coord.start.y - coord.height * y0Ratio;
            var y1 = coord.start.y - coord.height * y1Ratio;
            upperPoints.push({ x: x, y: y0 });
            lowerPoints.push({ x: x, y: y1 });
        });
        for (var i = 0; i < upperPoints.length; i++) {
            var flag = i === 0 ? 'M' : 'L';
            var p = upperPoints[i];
            if (!isNaN(p.x) && !isNaN(p.y)) {
                path.push([flag, p.x, p.y]);
            }
        }
        for (var j = lowerPoints.length - 1; j > 0; j--) {
            var p = lowerPoints[j];
            if (!isNaN(p.x) && !isNaN(p.y)) {
                path.push(['L', p.x, p.y]);
            }
        }
        return path;
    };
    TrendLine.prototype.adjustScale = function (viewScale, trendlineData, dim) {
        // 处理用户自行配置min max的情况
        var min = viewScale.min, max = viewScale.max;
        var _a = this.options.plotOptions, data = _a.data, xField = _a.xField, yField = _a.yField;
        var field = dim === 'x' ? xField : yField;
        var dataMin = util_1.minBy(data, field)[field];
        var dataMax = util_1.maxBy(data, field)[field];
        var minRatio = (min - dataMin) / (dataMax - dataMin);
        var maxRatio = (max - dataMax) / (dataMax - dataMin);
        var trendMin = util_1.minBy(trendlineData, dim)[dim];
        var trendMax = util_1.maxBy(trendlineData, dim)[dim];
        return {
            min: trendMin + minRatio * (trendMax - trendMin),
            max: trendMax + maxRatio * (trendMax - trendMin),
        };
    };
    return TrendLine;
}());
exports.default = TrendLine;

},{"../../../util/path":681,"@antv/scale":747,"@antv/util":803,"d3-regression":878,"tslib":894}],603:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    point: 'point',
    trendline: 'trendline',
    confidence: 'confidence',
    quadrant: 'quadrant',
    quadrantLabel: 'quadrant-label',
    quadrantLine: 'quadrant-line',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],604:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Scatter = /** @class */ (function (_super) {
    tslib_1.__extends(Scatter, _super);
    function Scatter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Scatter.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'scatter';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Scatter.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Scatter;
}(plot_1.default));
exports.default = Scatter;

},{"../../base/plot":394,"./layer":605,"@antv/util":803,"tslib":894}],605:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var factory_1 = require("../../geoms/factory");
var scale_1 = require("../../util/scale");
var quadrant_1 = tslib_1.__importDefault(require("./components/quadrant"));
var trendline_1 = tslib_1.__importDefault(require("./components/trendline"));
var EventParser = tslib_1.__importStar(require("./event"));
var factory_2 = require("../../components/factory");
require("./theme");
var G2_GEOM_MAP = {
    scatter: 'point',
};
var PLOT_GEOM_MAP = {
    point: 'point',
};
var ScatterLayer = /** @class */ (function (_super) {
    tslib_1.__extends(ScatterLayer, _super);
    function ScatterLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'scatter';
        return _this;
    }
    ScatterLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            pointSize: 4,
            pointStyle: {
                lineWidth: 1,
                strokeOpacity: 1,
                fillOpacity: 0.95,
                stroke: '#fff',
            },
            xAxis: {
                nice: true,
                grid: {
                    visible: true,
                },
                line: {
                    visible: true,
                },
            },
            yAxis: {
                nice: true,
                grid: {
                    visible: true,
                },
                line: {
                    visible: true,
                },
            },
            tooltip: {
                visible: true,
                // false 会造成 tooltip 只能显示一条数据，true 会造成 tooltip 在空白区域也会显示
                shared: null,
                showTitle: false,
                showMarkers: false,
                showCrosshairs: false,
            },
            label: {
                visible: false,
            },
            shape: 'circle',
        });
    };
    ScatterLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        if (this.quadrant) {
            this.quadrant.destroy();
        }
        if (this.trendline) {
            this.trendline.destroy();
        }
        if (this.options.quadrant && this.options.quadrant.visible) {
            this.quadrant = new quadrant_1.default(tslib_1.__assign({ view: this.view, plotOptions: this.options }, this.options.quadrant));
            this.quadrant.render();
        }
        if (this.options.trendline && this.options.trendline.visible) {
            this.trendline = new trendline_1.default(tslib_1.__assign({ view: this.view, plotOptions: this.options }, this.options.trendline));
            this.trendline.render();
        }
    };
    ScatterLayer.prototype.destroy = function () {
        if (this.quadrant) {
            this.quadrant.destroy();
            this.quadrant = null;
        }
        if (this.trendline) {
            this.trendline.destroy();
            this.trendline = null;
        }
        _super.prototype.destroy.call(this);
    };
    ScatterLayer.prototype.isValidLinearValue = function (value) {
        if (util_1.isNil(value)) {
            return false;
        }
        else if (Number.isNaN(Number(value))) {
            return false;
        }
        return true;
    };
    ScatterLayer.prototype.processData = function (data) {
        var _this = this;
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        var xAxisType = util_1.get(this.options, ['xAxis', 'type'], 'linear');
        var yAxisType = util_1.get(this.options, ['yAxis', 'type'], 'linear');
        if (xAxisType && yAxisType) {
            var fiteredData = data
                .filter(function (item) {
                if (xAxisType === 'linear' && !_this.isValidLinearValue(item[xField])) {
                    return false;
                }
                if (yAxisType === 'linear' && !_this.isValidLinearValue(item[yField])) {
                    return false;
                }
                return true;
            })
                .map(function (item) {
                var _a;
                return tslib_1.__assign(tslib_1.__assign({}, item), (_a = {}, _a[xField] = xAxisType === 'linear' ? Number(item[xField]) : String(item[xField]), _a[yField] = yAxisType === 'linear' ? Number(item[yField]) : String(item[yField]), _a));
            });
            return fiteredData;
        }
        return data;
    };
    ScatterLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    ScatterLayer.prototype.scale = function () {
        var props = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[props.xField] = {};
        if (util_1.has(props, 'xAxis')) {
            scale_1.extractScale(scales[props.xField], props.xAxis);
        }
        /** 配置y-scale */
        scales[props.yField] = {};
        if (util_1.has(props, 'yAxis')) {
            scale_1.extractScale(scales[props.yField], props.yAxis);
        }
        var timeLineInteraction = util_1.find(props.interactions, function (interaction) {
            return interaction.type === 'timeline';
        });
        if (timeLineInteraction && util_1.get(timeLineInteraction, 'cfg.key')) {
            var keyField = timeLineInteraction.cfg.key;
            if (scales[keyField]) {
                scales[keyField].key = true;
            }
            else {
                scales[keyField] = { key: true };
            }
        }
        this.setConfig('scales', scales);
        _super.prototype.scale.call(this);
    };
    ScatterLayer.prototype.coord = function () {
        return;
    };
    ScatterLayer.prototype.annotation = function () {
        return;
    };
    ScatterLayer.prototype.addGeometry = function () {
        var points = factory_1.getGeom('point', 'circle', {
            plot: this,
        });
        this.points = points;
        if (this.options.tooltip && this.options.tooltip.visible) {
            var _a = this.options.tooltip, showTitle = _a.showTitle, titleField = _a.titleField;
            this.extractTooltip();
            this.setConfig('tooltip', tslib_1.__assign({ showTitle: showTitle, title: showTitle ? titleField : undefined }, this.options.tooltip));
        }
        if (this.options.label) {
            this.label();
        }
        this.setConfig('geometry', points);
    };
    ScatterLayer.prototype.label = function () {
        var props = this.options;
        if (props.label.visible === false) {
            if (this.points) {
                this.points.label = false;
            }
            return;
        }
        var label = factory_2.getComponent('label', tslib_1.__assign(tslib_1.__assign({ fields: props.label.field ? [props.label.field] : [props.yField] }, props.label), { plot: this }));
        if (this.points) {
            this.points.label = label;
        }
    };
    ScatterLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        var props = this.options;
        if (props.animation === false) {
            /** 关闭动画 */
            this.points.animate = false;
        }
    };
    ScatterLayer.prototype.parseEvents = function (eventParser) {
        // 气泡图继承散点图时，会存在 eventParser
        _super.prototype.parseEvents.call(this, eventParser || EventParser);
    };
    ScatterLayer.prototype.extractTooltip = function () {
        this.points.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.points.tooltip.fields = tooltipOptions.fields;
        }
        else {
            this.points.tooltip.fields = [this.options.xField, this.options.yField];
        }
        if (tooltipOptions.formatter) {
            this.points.tooltip.callback = tooltipOptions.formatter;
            if (this.options.colorField) {
                this.points.tooltip.fields.push(this.options.colorField);
            }
        }
    };
    return ScatterLayer;
}(view_layer_1.default));
exports.default = ScatterLayer;
global_1.registerPlotType('scatter', ScatterLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../geoms/factory":430,"../../util/scale":712,"./components/quadrant":601,"./components/trendline":602,"./event":603,"./theme":606,"@antv/util":803,"tslib":894}],606:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var POINT_ACTIVE_STYLE = function (style) {
    var stroke = style.stroke || '#000';
    return {
        stroke: stroke,
    };
};
var POINT_SELECTED_STYLE = function (style) {
    var stroke = style.stroke || '#000';
    var lineWidth = style.lineWidth || 2;
    return {
        stroke: stroke,
        lineWidth: lineWidth,
    };
};
var POINT_INACTIVE_STYLE = function (style) {
    var fillOpacity = style.fillOpacity || style.opacity || 0.3;
    return {
        fillOpacity: fillOpacity,
    };
};
theme_1.registerTheme('scatter', {
    pointStyle: {
        normal: {},
        active: POINT_ACTIVE_STYLE,
        selected: POINT_SELECTED_STYLE,
        inactive: POINT_INACTIVE_STYLE,
    },
});

},{"../../theme":669}],607:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlotComponents = void 0;
var tslib_1 = require("tslib");
var line_label_1 = tslib_1.__importDefault(require("./label/line-label"));
var area_label_1 = tslib_1.__importDefault(require("./label/area-label"));
var ComponentsInfo = {
    lineLabel: { Ctr: line_label_1.default },
    areaLabel: { Ctr: area_label_1.default },
};
function getPlotComponents(plot, type, cfg) {
    if (plot.options[type] && plot.options[type].visible) {
        var componentInfo = ComponentsInfo[type];
        var component = new componentInfo.Ctr(cfg);
        if (componentInfo.padding) {
            plot.paddingController.registerPadding(component, componentInfo.padding);
        }
        return component;
    }
}
exports.getPlotComponents = getPlotComponents;

},{"./label/area-label":608,"./label/line-label":611,"tslib":894}],608:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var DEFAULT_SIZE = 12;
var TOLERANCE = 0.01;
var MAX_ITERATION = 100;
var MIN_HEIGHT = 12;
function getRange(points) {
    var maxHeight = -Infinity;
    var min = Infinity;
    var max = -Infinity;
    util_1.each(points, function (p) {
        min = Math.min(p.x, min);
        max = Math.max(p.x, max);
        var height = Math.abs(p.y[0] - p.y[1]);
        maxHeight = Math.max(maxHeight, height);
    });
    return {
        xRange: [min, max],
        maxHeight: maxHeight,
    };
}
function interpolateY(x, points, index) {
    var leftPoint = points[0];
    var rightPoint = points[points.length - 1];
    util_1.each(points, function (p) {
        if (p.x === x) {
            return p.y[index];
        }
        if (p.x < x && p.x > leftPoint.x) {
            leftPoint = p;
        }
        if (p.x > x && p.x < rightPoint.x) {
            rightPoint = p;
        }
    });
    var t = (x - leftPoint.x) / (rightPoint.x - leftPoint.x);
    return leftPoint.y[index] * (1 - t) + rightPoint.y[index] * t;
}
function getXIndex(data, x) {
    // tslint:disable-next-line: prefer-for-of
    var i;
    for (i = 0; i < data.length; i++) {
        var d = data[i];
        if (d.x === x || d.x > x) {
            break;
        }
    }
    return i;
}
var AreaLabel = /** @class */ (function () {
    function AreaLabel(cfg) {
        this.destroyed = false;
        this.scaleFactor = [];
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        this.init();
    }
    AreaLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    AreaLabel.prototype.render = function () {
        var _this = this;
        var stackField = this.plot.options.stackField;
        var groupedPoints = this.getGeometry().dataArray;
        var labelPoints = [];
        util_1.each(groupedPoints, function (pointArray, name) {
            var labelPoint = _this.drawLabel(pointArray, name);
            if (labelPoint) {
                labelPoints.push(util_1.deepMix({}, pointArray[0], labelPoint));
                _this.scaleFactor.push(labelPoint.scaleFactor);
            }
        });
        var labelShapes = [];
        util_1.each(labelPoints, function (p, index) {
            var _a = _this.options, style = _a.style, offsetX = _a.offsetX, offsetY = _a.offsetY;
            var labelSize = _this.getFontSize(index);
            var formatter = _this.options.formatter;
            var content = formatter ? formatter(p._origin[stackField]) : p._origin[stackField];
            var text = _this.container.addShape('text', {
                attrs: util_1.deepMix({}, {
                    x: p.x + offsetX,
                    y: p.y + offsetY,
                    text: content,
                    fill: p.color,
                    fontSize: labelSize,
                    textAlign: 'center',
                    textBaseline: 'top',
                }, style),
                name: 'label',
            });
            labelShapes.push(text);
        });
        this.plot.canvas.draw();
    };
    AreaLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    AreaLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    AreaLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    AreaLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    AreaLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    AreaLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = util_1.clone(theme.label.style);
        labelStyle.stroke = null;
        delete labelStyle.fill;
        return {
            offsetX: 0,
            offsetY: 0,
            style: labelStyle,
            autoScale: true,
        };
    };
    AreaLabel.prototype.drawLabel = function (points, name) {
        var _a = getRange(points), xRange = _a.xRange, maxHeight = _a.maxHeight;
        // 根据area宽度在x方向各点间做插值
        var resolution = xRange[1] - xRange[0];
        var interpolatedPoints = this.getInterpolatedPoints(xRange[0], resolution, points);
        // 获取label的bbox
        var bbox = this.getLabelBbox(name);
        var fitOption = {
            xRange: xRange,
            aspect: bbox.width / bbox.height,
            data: interpolatedPoints,
            justTest: true,
        };
        var height = this.bisection(MIN_HEIGHT, maxHeight, this.testFit, fitOption, TOLERANCE, MAX_ITERATION);
        if (height === null) {
            return;
        }
        fitOption.justTest = false;
        var fit = this.testFit(fitOption);
        fit.x = fit.x;
        fit.y = fit.y0 + (fit.y1 - fit.y0) / 2;
        fit.scaleFactor = (height / bbox.height) * 0.2;
        return fit;
    };
    AreaLabel.prototype.getInterpolatedPoints = function (minX, resolution, points) {
        var interpolatedPoints = [];
        var step = 2;
        for (var i = minX; i < resolution; i += step) {
            var y0 = interpolateY(i, points, 0);
            var y1 = interpolateY(i, points, 1);
            interpolatedPoints.push({
                x: i,
                y: [y0, y1],
            });
        }
        return interpolatedPoints;
    };
    AreaLabel.prototype.bisection = function (min, max, test, testOption, tolerance, maxIteration) {
        for (var i = 0; i < maxIteration; i++) {
            var middle = (min + max) / 2;
            var options = testOption;
            options.height = middle;
            options.width = middle * options.aspect;
            var passesTest = test(options);
            var withinTolerance = (max - min) / 2 < tolerance;
            if (passesTest && withinTolerance) {
                return middle;
            }
            if (passesTest) {
                min = middle;
            }
            else {
                max = middle;
            }
        }
        return null;
    };
    AreaLabel.prototype.testFit = function (option) {
        var xRange = option.xRange, width = option.width, height = option.height, data = option.data, justTest = option.justTest;
        for (var i = 0; i < data.length; i++) {
            var d = data[i];
            var x0 = d.x;
            var x1 = x0 + width;
            if (x1 > xRange[1]) {
                break;
            }
            var x1_index = getXIndex(data, x1);
            var ceiling = -Infinity;
            var ceilingFloor = null; // 保存ceiling时对应的bottom位置，ceil和floor不一定是一对坐标
            var floor = Infinity;
            for (var j = i; j < x1_index; j++) {
                var top_1 = data[j].y[1];
                var bottom = data[j].y[0];
                if (bottom < floor) {
                    floor = bottom;
                }
                if (top_1 > ceiling) {
                    ceiling = top_1;
                    ceilingFloor = bottom;
                }
                if (floor - ceiling < height) {
                    break;
                }
            }
            if (floor - ceiling >= height) {
                if (justTest) {
                    return true;
                }
                return {
                    x: x0,
                    y0: ceiling,
                    y1: ceilingFloor,
                    width: width,
                    height: height,
                };
            }
        }
        return false;
    };
    AreaLabel.prototype.getLabelBbox = function (text) {
        var labelStyle = util_1.clone(this.plot.theme.label.textStyle);
        labelStyle.fontSize = DEFAULT_SIZE;
        var tShape = this.container.addShape('text', {
            attrs: tslib_1.__assign({ text: text, x: 0, y: 0 }, labelStyle),
        });
        var bbox = tShape.getBBox();
        tShape.remove();
        return bbox;
    };
    AreaLabel.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'area'; });
    };
    AreaLabel.prototype.getFontSize = function (index) {
        if (this.options.autoScale) {
            var scaleFactor = this.scaleFactor[index];
            return DEFAULT_SIZE * scaleFactor;
        }
        return DEFAULT_SIZE;
    };
    return AreaLabel;
}());
exports.default = AreaLabel;

},{"@antv/util":803,"tslib":894}],609:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../../components/label/base");
var area_point_auto_1 = tslib_1.__importDefault(require("../../../area/component/label/area-point-auto"));
var StackedAreaPointAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedAreaPointAutoLabel, _super);
    function StackedAreaPointAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** 对堆积面积使用自定义的排序 */
    StackedAreaPointAutoLabel.prototype.sortLabels = function (geometry, labels) {
        var sorted = [];
        if (labels.length > 0) {
            sorted.push(labels.shift());
        }
        if (labels.length > 0) {
            sorted.push(labels.pop());
        }
        sorted.push.apply(sorted, labels);
        return sorted;
    };
    return StackedAreaPointAutoLabel;
}(area_point_auto_1.default));
exports.default = StackedAreaPointAutoLabel;
base_1.registerLabelComponent('stackedArea-point-auto', StackedAreaPointAutoLabel);

},{"../../../../components/label/base":414,"../../../area/component/label/area-point-auto":452,"tslib":894}],610:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../../components/label/base");
var area_point_1 = tslib_1.__importDefault(require("../../../area/component/label/area-point"));
var StackedAreaPointLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedAreaPointLabel, _super);
    function StackedAreaPointLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    return StackedAreaPointLabel;
}(area_point_1.default));
exports.default = StackedAreaPointLabel;
base_1.registerLabelComponent('stackedArea-point', StackedAreaPointLabel);

},{"../../../../components/label/base":414,"../../../area/component/label/area-point":453,"tslib":894}],611:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var line_label_1 = tslib_1.__importDefault(require("../../../line/component/label/line-label"));
/**
 * 复用扎线图的 label，并修改取值方式
 */
var AreaLineLabel = /** @class */ (function (_super) {
    tslib_1.__extends(AreaLineLabel, _super);
    function AreaLineLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AreaLineLabel.prototype.getShapeInfo = function (shape) {
        var originPoints = shape.get('origin').points;
        var lastPoint = originPoints[originPoints.length - 1];
        var color = shape.attr('stroke');
        var stackField = this.plot.options.stackField;
        var name = shape.get('origin').data[0][stackField];
        var y = util_1.reduce(lastPoint.y, function (r, a) {
            return r + a;
        }, 0) / util_1.size(lastPoint.y);
        return { x: lastPoint.x, y: y, color: color, name: name };
    };
    return AreaLineLabel;
}(line_label_1.default));
exports.default = AreaLineLabel;

},{"../../../line/component/label/line-label":550,"@antv/util":803,"tslib":894}],612:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var StackedArea = /** @class */ (function (_super) {
    tslib_1.__extends(StackedArea, _super);
    function StackedArea() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedArea.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedArea';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StackedArea.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackedArea;
}(plot_1.default));
exports.default = StackedArea;

},{"../../base/plot":394,"./layer":613,"@antv/util":803,"tslib":894}],613:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../area/layer"));
var component_1 = require("./component");
require("./component/label/area-point");
require("./component/label/area-point-auto");
require("./theme");
var StackedAreaLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StackedAreaLayer, _super);
    function StackedAreaLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.plotComponents = [];
        _this.type = 'stackedArea';
        _this.baseType = 'area';
        return _this;
    }
    StackedAreaLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            label: {
                visible: false,
                type: 'area',
            },
        });
    };
    StackedAreaLayer.prototype.beforeInit = function () {
        var visible = util_1.get(this.options, ['label', 'visible']);
        var type = util_1.get(this.options, ['label', 'type']);
        var options = this.options;
        if (visible) {
            if (type === 'line') {
                options.lineLabel = this.options.label;
            }
            if (type === 'area') {
                options.areaLabel = this.options.label;
            }
        }
        _super.prototype.beforeInit.call(this);
    };
    StackedAreaLayer.prototype.getColorScale = function () {
        var stackField = this.options.stackField;
        return this.view.getScaleByField(stackField);
    };
    StackedAreaLayer.prototype.label = function () {
        var props = this.options;
        var label = props.label;
        if (label && label.visible === false) {
            if (this.line) {
                this.line.label = false;
            }
            if (this.point) {
                this.point.label = false;
            }
            this.area.label = false;
            return;
        }
    };
    StackedAreaLayer.prototype.adjustArea = function (ele) {
        ele.adjust = [
            {
                type: 'stack',
            },
        ];
    };
    StackedAreaLayer.prototype.adjustLine = function (ele) {
        ele.adjust = [
            {
                type: 'stack',
            },
        ];
    };
    StackedAreaLayer.prototype.adjustPoint = function (ele) {
        ele.adjust = [
            {
                type: 'stack',
            },
        ];
    };
    StackedAreaLayer.prototype.afterRender = function () {
        this.renderPlotComponents();
        this.options.responsive = false;
        _super.prototype.afterRender.call(this);
    };
    StackedAreaLayer.prototype.geometryTooltip = function () {
        this.area.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.area.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.area.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.area.tooltip.fields = [this.options.xField, this.options.yField, this.options.stackField];
            }
        }
    };
    StackedAreaLayer.prototype.renderPlotComponents = function () {
        var _this = this;
        var componentsType = ['areaLabel', 'lineLabel'];
        util_1.each(componentsType, function (t) {
            var cfg = tslib_1.__assign({ view: _this.view, plot: _this }, _this.options[t]);
            var component = component_1.getPlotComponents(_this, t, cfg);
            if (component) {
                component.render();
                _this.plotComponents.push(component);
            }
        });
    };
    return StackedAreaLayer;
}(layer_1.default));
exports.default = StackedAreaLayer;
global_1.registerPlotType('stackedArea', StackedAreaLayer);

},{"../../base/global":392,"../area/layer":456,"./component":607,"./component/label/area-point":610,"./component/label/area-point-auto":609,"./theme":614,"@antv/util":803,"tslib":894}],614:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var theme_2 = require("../area/theme");
theme_1.registerTheme('stackedArea', theme_2.DEFAULT_AREA_THEME);

},{"../../theme":669,"../area/theme":457}],615:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../components/label/base");
var label_auto_1 = tslib_1.__importDefault(require("../../bar/component/label-auto"));
/** 自动模式的 StackedBar 数据标签，会根据图形和数据标签自动优化数据标签布局和样式等 */
var StackedBarAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedBarAutoLabel, _super);
    function StackedBarAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** 堆积柱形图全部内置 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    StackedBarAutoLabel.prototype.shouldInShapeLabels = function (labels) {
        return true;
    };
    return StackedBarAutoLabel;
}(label_auto_1.default));
exports.default = StackedBarAutoLabel;
base_1.registerLabelComponent('stacked-bar-auto', StackedBarAutoLabel);

},{"../../../components/label/base":414,"../../bar/component/label-auto":460,"tslib":894}],616:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../components/label/base");
var label_1 = tslib_1.__importDefault(require("../../bar/component/label"));
var StackedBarLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedBarLabel, _super);
    function StackedBarLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedBarLabel.prototype.adjustLabel = function (label, element) {
        if (this.options.adjustPosition) {
            var labelRange = label.getBBox();
            var shapeRange = this.getElementShapeBBox(element);
            // label 有 offset
            if (shapeRange.maxX <= labelRange.maxX) {
                label.set('visible', false);
            }
        }
    };
    return StackedBarLabel;
}(label_1.default));
exports.default = StackedBarLabel;
base_1.registerLabelComponent('stacked-bar', StackedBarLabel);

},{"../../../components/label/base":414,"../../bar/component/label":461,"tslib":894}],617:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var StackedBar = /** @class */ (function (_super) {
    tslib_1.__extends(StackedBar, _super);
    function StackedBar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedBar.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedBar';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StackedBar.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackedBar;
}(plot_1.default));
exports.default = StackedBar;

},{"../../base/plot":394,"./layer":618,"@antv/util":803,"tslib":894}],618:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../bar/layer"));
require("./theme");
require("./component/label");
require("./component/label-auto");
var view_1 = require("../../util/view");
var StackedBarLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StackedBarLayer, _super);
    function StackedBarLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'stackedBar';
        _this.baseType = 'bar';
        return _this;
    }
    StackedBarLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                autoRotateTitle: false,
                grid: {
                    visible: true,
                },
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: true,
                },
                label: {
                    visible: true,
                    autoRotate: true,
                    autoHide: true,
                },
                title: {
                    visible: true,
                    spacing: 12,
                },
            },
            yAxis: {
                visible: true,
                autoRotateTitle: true,
                grid: {
                    visible: false,
                },
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                label: {
                    visible: true,
                    autoRotate: true,
                    autoHide: true,
                },
                title: {
                    visible: false,
                    spacing: 12,
                },
            },
            legend: {
                visible: true,
                position: 'top-left',
                offsetY: 0,
            },
        });
    };
    StackedBarLayer.prototype.getColorScale = function () {
        var stackField = this.options.stackField;
        return this.view.getScaleByField(stackField);
    };
    StackedBarLayer.prototype.adjustBar = function (bar) {
        bar.adjust = [
            {
                type: 'stack',
            },
        ];
    };
    StackedBarLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, xField = _a.xField;
        var scale = scales[xField];
        if (label === null || label === void 0 ? void 0 : label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'interval');
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'stacked-bar', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
        }
    };
    StackedBarLayer.prototype.geometryTooltip = function () {
        this.bar.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.bar.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.bar.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.bar.tooltip.fields = [this.options.xField, this.options.yField, this.options.stackField];
            }
        }
    };
    return StackedBarLayer;
}(layer_1.default));
exports.default = StackedBarLayer;
global_1.registerPlotType('stackedBar', StackedBarLayer);

},{"../../base/global":392,"../../util/view":715,"../bar/layer":464,"./component/label":616,"./component/label-auto":615,"./theme":619,"@antv/util":803,"tslib":894}],619:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var theme_2 = require("../bar/theme");
theme_1.registerTheme('stackedBar', theme_2.DEFAULT_BAR_THEME);

},{"../../theme":669,"../bar/theme":465}],620:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../components/label/base");
var label_auto_1 = tslib_1.__importDefault(require("../../column/component/label-auto"));
/** 自动模式的 StackedColumn 数据标签，会根据图形和数据标签自动优化数据标签布局和样式等 */
var StackedColumnAutoLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumnAutoLabel, _super);
    function StackedColumnAutoLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /** 堆积柱形图全部内置 */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    StackedColumnAutoLabel.prototype.shouldInShapeLabels = function (labels) {
        return true;
    };
    return StackedColumnAutoLabel;
}(label_auto_1.default));
exports.default = StackedColumnAutoLabel;
base_1.registerLabelComponent('stacked-column-auto', StackedColumnAutoLabel);

},{"../../../components/label/base":414,"../../column/component/label-auto":486,"tslib":894}],621:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("../../../components/label/base");
var label_1 = tslib_1.__importDefault(require("../../column/component/label"));
var StackedColumnLabel = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumnLabel, _super);
    function StackedColumnLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedColumnLabel.prototype.adjustLabel = function (label, element) {
        var adjustPosition = this.options.adjustPosition;
        if (adjustPosition) {
            var labelRange = label.getBBox();
            var shapeRange = this.getElementShapeBBox(element);
            if (shapeRange.height < labelRange.height || shapeRange.width < labelRange.width) {
                // 如果文本的高度超出图形的高度或者文本的宽度超出图形的宽度就不显示
                label.hide();
            }
        }
    };
    return StackedColumnLabel;
}(label_1.default));
exports.default = StackedColumnLabel;
base_1.registerLabelComponent('stacked-column', StackedColumnLabel);

},{"../../../components/label/base":414,"../../column/component/label":487,"tslib":894}],622:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var StackedColumn = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumn, _super);
    function StackedColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedColumn';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StackedColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackedColumn;
}(plot_1.default));
exports.default = StackedColumn;

},{"../../base/plot":394,"./layer":623,"@antv/util":803,"tslib":894}],623:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var connected_area_1 = tslib_1.__importDefault(require("../../components/connected-area"));
var layer_1 = tslib_1.__importDefault(require("../column/layer"));
require("./theme");
require("./component/label");
require("./component/label-auto");
var view_1 = require("../../util/view");
var StackedColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StackedColumnLayer, _super);
    function StackedColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'stackedColumn';
        _this.baseType = 'column';
        return _this;
    }
    StackedColumnLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            legend: {
                visible: true,
                position: 'right-top',
            },
            label: {
                visible: false,
                position: 'middle',
                offset: 0,
                adjustColor: true,
            },
            connectedArea: {
                visible: false,
                triggerOn: 'mouseenter',
            },
        });
    };
    StackedColumnLayer.prototype.init = function () {
        if (this.options.connectedArea.visible) {
            this.options.tooltip.crosshairs = null;
        }
        _super.prototype.init.call(this);
    };
    StackedColumnLayer.prototype.afterRender = function () {
        var props = this.options;
        // 绘制区域连接组件
        if (props.connectedArea.visible) {
            this.connectedArea = new connected_area_1.default(tslib_1.__assign({ view: this.view, field: props.stackField, animation: props.animation === false ? false : true }, props.connectedArea));
        }
        _super.prototype.afterRender.call(this);
    };
    StackedColumnLayer.prototype.getColorScale = function () {
        var stackField = this.options.stackField;
        return this.view.getScaleByField(stackField);
    };
    StackedColumnLayer.prototype.adjustColumn = function (column) {
        column.adjust = [
            {
                type: 'stack',
            },
        ];
    };
    StackedColumnLayer.prototype.renderLabel = function () {
        var scales = this.config.scales;
        var _a = this.options, label = _a.label, yField = _a.yField;
        var scale = scales[yField];
        if (label && label.visible) {
            var geometry = view_1.getGeometryByType(this.view, 'interval');
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'stacked-column', formatter: scale.formatter && (function (value) { return scale.formatter(value); }) }, this.options.label));
        }
    };
    StackedColumnLayer.prototype.geometryTooltip = function () {
        this.column.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.column.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.column.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.column.tooltip.fields = [this.options.xField, this.options.yField, this.options.stackField];
            }
        }
    };
    return StackedColumnLayer;
}(layer_1.default));
exports.default = StackedColumnLayer;
global_1.registerPlotType('stackedColumn', StackedColumnLayer);

},{"../../base/global":392,"../../components/connected-area":409,"../../util/view":715,"../column/layer":490,"./component/label":621,"./component/label-auto":620,"./theme":624,"@antv/util":803,"tslib":894}],624:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var theme_1 = require("../../theme");
var theme_2 = require("../column/theme");
theme_1.registerTheme('stackedColumn', theme_2.DEFAULT_COLUMN_THEME);

},{"../../theme":669,"../column/theme":491}],625:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var StackedRose = /** @class */ (function (_super) {
    tslib_1.__extends(StackedRose, _super);
    function StackedRose() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StackedRose.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'stackedRose';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StackedRose.prototype.getRadiusScale = function () {
        var layer = this.layers[0];
        return layer.getRadiusScale();
    };
    StackedRose.prototype.getAngleScale = function () {
        var layer = this.layers[0];
        return layer.getAngleScale();
    };
    StackedRose.getDefaultOptions = layer_1.default.getDefaultOptions;
    return StackedRose;
}(plot_1.default));
exports.default = StackedRose;

},{"../../base/plot":394,"./layer":626,"@antv/util":803,"tslib":894}],626:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var layer_1 = tslib_1.__importDefault(require("../rose/layer"));
var StackedRoseLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StackedRoseLayer, _super);
    function StackedRoseLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'stackedRose';
        _this.baseType = 'rose';
        return _this;
    }
    StackedRoseLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            xAxis: {
                visible: true,
                line: {
                    visible: false,
                },
                tickLine: {
                    visible: false,
                },
                grid: {
                    visible: true,
                    alignTick: false,
                    style: {
                        lineWidth: 0.5,
                    },
                },
                label: {
                    offset: 5,
                    autoRotate: true,
                },
            },
            yAxis: {
                visible: false,
            },
        });
    };
    StackedRoseLayer.prototype.getColorScale = function () {
        var stackField = this.options.stackField;
        return this.view.getScaleByField(stackField);
    };
    StackedRoseLayer.prototype.adjustRoseAdjust = function () {
        return [
            {
                type: 'stack',
            },
        ];
    };
    StackedRoseLayer.prototype.geometryTooltip = function () {
        this.rose.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.rose.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.rose.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.rose.tooltip.fields = [this.options.radiusField, this.options.categoryField, this.options.stackField];
            }
        }
    };
    return StackedRoseLayer;
}(layer_1.default));
exports.default = StackedRoseLayer;
global_1.registerPlotType('stackedRose', StackedRoseLayer);

},{"../../base/global":392,"../rose/layer":600,"@antv/util":803,"tslib":894}],627:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var layer_1 = require("./layer");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var StepLine = /** @class */ (function (_super) {
    tslib_1.__extends(StepLine, _super);
    function StepLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * 复写父类方法
     * @param props
     */
    StepLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'step-line';
        _super.prototype.createLayers.call(this, layerProps);
    };
    StepLine.getDefaultOptions = layer_1.StepLineLayer.getDefaultOptions;
    return StepLine;
}(plot_1.default));
exports.default = StepLine;

},{"../../base/plot":394,"./layer":628,"@antv/util":803,"tslib":894}],628:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepLineLayer = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var layer_1 = tslib_1.__importDefault(require("../line/layer"));
var global_1 = require("../../base/global");
var StepLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(StepLineLayer, _super);
    function StepLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'step-line'; // 覆写父类的 type
        return _this;
    }
    StepLineLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            step: 'hv',
        });
    };
    return StepLineLayer;
}(layer_1.default));
exports.StepLineLayer = StepLineLayer;
global_1.registerPlotType('step-line', StepLineLayer);

},{"../../base/global":392,"../line/layer":558,"@antv/util":803,"tslib":894}],629:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var common_1 = require("../../../util/common");
var LEAF_LABEL_OFFSET = 4;
var MIN_FONTSIZE = 8;
function isLeaf(data, maxLevel) {
    return !data.children || data.depth >= maxLevel;
}
function textWrapper(label, width, container) {
    var fontSize = label.attr('fontSize');
    var textContent = label.attr('text');
    var tShape = container.addShape('text', {
        attrs: {
            text: '',
            x: 0,
            y: 0,
            fontSize: fontSize,
        },
    });
    var textArr = textContent.split('\n');
    var wrappedTextArr = textArr.map(function (wrappedText) {
        var text = '';
        var chars = wrappedText.split('');
        var breakIndex = [];
        for (var i = 0; i < chars.length; i++) {
            var item = chars[i];
            tShape.attr('text', (text += item));
            var currentWidth = tShape.getBBox().width - 1;
            if (currentWidth > width) {
                // 如果是第一个字符就大于宽度不做任何换行处理
                if (i === 0) {
                    break;
                }
                breakIndex.push(i);
                text = '';
            }
        }
        return common_1.breakText(chars, breakIndex);
    });
    tShape.remove();
    return wrappedTextArr.join('\n');
}
function textAbbreviate(text, fontSize, width, container) {
    var tailShape = container.addShape('text', {
        attrs: {
            text: '...',
            x: 0,
            y: 0,
            fontSize: fontSize,
        },
    });
    var tailWidth = tailShape.getBBox().width;
    var tShape = container.addShape('text', {
        attrs: {
            text: '',
            x: 0,
            y: 0,
            fontSize: fontSize,
        },
    });
    var t = '';
    var abbreviateWidth = width - tailWidth;
    for (var i = 0; i < text.length; i++) {
        var item = text[i];
        tShape.attr('text', (t += item));
        var currentWidth = tShape.getBBox().width;
        if (currentWidth >= abbreviateWidth) {
            var string = t.substr(0, t.length - 1);
            if (string.length > 0) {
                return string + '...';
            }
        }
    }
    tShape.remove();
    tailShape.remove();
    return t;
}
var TreemapLabel = /** @class */ (function () {
    function TreemapLabel(cfg) {
        this.destroyed = false;
        this.view = cfg.view;
        this.plot = cfg.plot;
        var defaultOptions = this.getDefaultOptions();
        this.options = util_1.deepMix(defaultOptions, cfg, {});
        this.init();
    }
    TreemapLabel.prototype.init = function () {
        var _this = this;
        this.container = this.getGeometry().labelsContainer;
        this.view.on('beforerender', function () {
            _this.clear();
            _this.plot.canvas.draw();
        });
    };
    TreemapLabel.prototype.render = function () {
        var _this = this;
        var elements = this.getGeometry().elements;
        util_1.each(elements, function (ele) {
            var shape = ele.shape;
            var data = shape.get('origin').data;
            var isLeafNode = isLeaf(data, _this.plot.options.maxLevel);
            if (data.showLabel) {
                var style = util_1.clone(_this.options.style);
                var position = _this.getPosition(shape, isLeafNode);
                var formatter = _this.options.formatter;
                var content = formatter ? formatter(data.name) : data.name;
                var textBaseline = _this.getTextBaseLine(isLeafNode);
                var label = _this.container.addShape('text', {
                    attrs: util_1.deepMix({}, style, {
                        x: position.x,
                        y: position.y,
                        text: content,
                        fill: 'black',
                        textAlign: 'center',
                        textBaseline: textBaseline,
                        fontWeight: isLeafNode ? 300 : 600,
                    }),
                    name: 'label',
                });
                _this.adjustLabel(label, shape, isLeafNode);
            }
        });
    };
    TreemapLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    TreemapLabel.prototype.hide = function () {
        this.container.set('visible', false);
        this.plot.canvas.draw();
    };
    TreemapLabel.prototype.show = function () {
        this.container.set('visible', true);
        this.plot.canvas.draw();
    };
    TreemapLabel.prototype.destroy = function () {
        if (this.container) {
            this.container.remove();
        }
        this.destroyed = true;
    };
    TreemapLabel.prototype.getBBox = function () {
        return this.container.getBBox();
    };
    TreemapLabel.prototype.getPosition = function (shape, isLeafNode) {
        var shapeBbox = shape.getBBox();
        var x = 0;
        var y = 0;
        if (!isLeafNode) {
            x = shapeBbox.x + shapeBbox.width / 2;
            y = shapeBbox.y + 4;
        }
        else {
            x = shapeBbox.minX + shapeBbox.width / 2;
            y = shapeBbox.minY + shapeBbox.height / 2;
        }
        return { x: x, y: y };
    };
    TreemapLabel.prototype.getTextBaseLine = function (isLeafNode) {
        return isLeafNode ? 'middle' : 'top';
    };
    TreemapLabel.prototype.adjustLabel = function (label, shape, isLeafNode) {
        if (isLeafNode) {
            this.adjustLeafLabel(label, shape);
        }
        else {
            this.adjustParentLabel(label, shape);
        }
    };
    TreemapLabel.prototype.adjustLeafLabel = function (label, shape) {
        var bbox = shape.getBBox();
        var labelBBox = label.getBBox();
        var labelText = util_1.clone(label.attr('text'));
        var sizeOffset = 2;
        var fontSize = Math.max(label.attr('fontSize') - sizeOffset, MIN_FONTSIZE);
        var centerX = bbox.x + bbox.width / 2;
        var centerY = bbox.y + bbox.height / 2;
        label.attr({
            x: centerX,
            y: centerY,
            textAlign: 'center',
            textBaseline: 'middle',
            lineHeight: fontSize,
            fontSize: fontSize,
        });
        var wrapperWidth = bbox.width - LEAF_LABEL_OFFSET * 2;
        if (labelBBox.width > bbox.width && labelBBox.height > bbox.height) {
            label.attr('text', '');
            return;
        }
        else if (wrapperWidth < fontSize) {
            label.attr('text', '');
            return;
        }
        if (labelBBox.width > bbox.width) {
            var wrappedText = textWrapper(label, wrapperWidth, this.container);
            label.attr({
                lineHeight: label.attr('fontSize'),
                text: wrappedText,
            });
            var tem_bbox = label.getBBox();
            if (tem_bbox.height > bbox.height) {
                var text = textAbbreviate(labelText, fontSize, wrapperWidth, this.container);
                label.attr('text', text);
            }
        }
    };
    TreemapLabel.prototype.adjustParentLabel = function (label, shape) {
        var shapeBbox = shape.getBBox();
        var wrapperWidth = shapeBbox.width - LEAF_LABEL_OFFSET * 2;
        if (label.getBBox().width > wrapperWidth) {
            var text = textAbbreviate(label.attr('text'), label.attr('fontSize'), wrapperWidth, this.container);
            label.attr('text', text);
        }
    };
    TreemapLabel.prototype.getDefaultOptions = function () {
        var theme = this.plot.theme;
        var labelStyle = theme.label.style;
        return {
            offsetX: 0,
            offsetY: 0,
            style: util_1.clone(labelStyle),
        };
    };
    TreemapLabel.prototype.getGeometry = function () {
        return util_1.find(this.view.geometries, function (geom) { return geom.type === 'polygon'; });
    };
    return TreemapLabel;
}());
exports.default = TreemapLabel;

},{"../../../util/common":674,"@antv/util":803}],630:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    rect: 'polygon',
    breadcrumb: 'breadcrumb',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],631:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Treemap = /** @class */ (function (_super) {
    tslib_1.__extends(Treemap, _super);
    function Treemap() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Treemap.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'treemap';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Treemap.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Treemap;
}(plot_1.default));
exports.default = Treemap;

},{"../../base/plot":394,"./layer":635,"@antv/util":803,"tslib":894}],632:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rollingUp = exports.drillingDown = void 0;
var util_1 = require("@antv/util");
var g_util_1 = require("../../../util/g-util");
var ulMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
var duration = 400;
var easing = 'easeQuadInOut';
function drillingDown(target, view, callback) {
    var rect = getRect(target);
    var range = getRange(view);
    var xRatio = range.width / rect.width;
    var yRatio = range.height / rect.height;
    var offsetX = (range.minX - rect.minX) * xRatio;
    var offsetY = (range.minY - rect.minY) * yRatio;
    var transformMatrix = g_util_1.transform([
        ['s', xRatio, yRatio],
        ['t', offsetX, offsetY],
    ]);
    var geometry = view.geometries[0];
    hideLabel(geometry);
    var tem_container = view.backgroundGroup.addGroup();
    tem_container.set('zIndex', -100);
    tem_container.setClip({
        type: 'rect',
        attrs: {
            x: range.minX,
            y: range.minY,
            width: range.width,
            height: range.height,
        },
    });
    var tem_shapes = getTemShapes(geometry, tem_container);
    geometry.container.set('visible', false);
    view.canvas.draw();
    callback();
    window.setTimeout(function () {
        util_1.each(tem_shapes, function (shape, index) {
            if (index === 0) {
                shape.animate({ matrix: transformMatrix }, duration, easing, function () {
                    tem_container.remove();
                    view.canvas.draw();
                });
            }
            else {
                shape.animate(g_util_1.transform, duration);
            }
        });
        geometry = view.geometries[0];
        hideLabel(geometry);
        var shapes = geometry.getShapes();
        util_1.each(shapes, function (shape) {
            shape.attr('opacity', 0);
            shape.animate({
                opacity: 1,
            }, duration, easing);
        });
        var container = geometry.container;
        container.stopAnimate();
        container.set('visible', true);
        container.attr('matrix', util_1.clone(ulMatrix));
        g_util_1.groupTransform(container, [
            ['s', rect.width / range.width, rect.height / range.height],
            ['t', rect.minX, rect.minY],
        ]);
        var matrix = util_1.clone(ulMatrix);
        geometry.container.animate({
            matrix: matrix,
        }, duration, easing, function () {
            showLabel(geometry);
        });
        view.canvas.draw();
    }, 16);
}
exports.drillingDown = drillingDown;
function getTemShapes(geometry, container) {
    var shapes = geometry.getShapes();
    var tem_shapes = [];
    util_1.each(shapes, function (shape) {
        var s = container.addShape('path', {
            attrs: util_1.deepMix({}, shape.attrs, { capture: false }),
        });
        tem_shapes.push(s);
    });
    return tem_shapes;
}
function rollingUp(name, view, callback) {
    var geometry = view.geometries[0];
    hideLabel(geometry);
    var container = geometry.container;
    container.attr('matrix', util_1.clone(ulMatrix));
    var tem_container = view.backgroundGroup.addGroup();
    tem_container.set('zIndex', -100);
    var tem_shapes = getTemShapes(geometry, tem_container);
    container.set('visible', false);
    view.canvas.draw();
    callback();
    geometry = view.geometries[0];
    hideLabel(geometry);
    container = geometry.container;
    var shape = findShapeByName(geometry.getShapes(), name); //根据name获得上一级shape
    var rect = getRect(shape);
    var range = getRange(view);
    var containerParent = container.get('parent');
    if (!containerParent.get('clipShape')) {
        container.setClip({
            type: 'rect',
            attrs: {
                x: range.minX,
                y: range.minY,
                width: range.width,
                height: range.height,
            },
        });
    }
    shrinkTemp(tem_container, tem_shapes, rect, range);
    var xRatio = range.width / rect.width;
    var yRatio = range.height / rect.height;
    var offsetX = (range.minX - rect.minX) * xRatio;
    var offsetY = (range.minY - rect.minY) * yRatio;
    var transformMatrix = g_util_1.transform([
        ['s', xRatio, yRatio],
        ['t', offsetX, offsetY],
    ]);
    container.setMatrix(transformMatrix);
    container.set('visible', true);
    container.animate({
        matrix: ulMatrix,
    }, duration, easing, function () {
        showLabel(geometry);
    });
}
exports.rollingUp = rollingUp;
function findShapeByName(shapes, n) {
    var shape;
    util_1.each(shapes, function (s) {
        var name = s.get('origin').data.name;
        if (name === n) {
            shape = s;
        }
    });
    return shape;
}
function getRange(view) {
    var viewRange = view.coordinateBBox;
    var range = {
        minX: viewRange.minX,
        minY: viewRange.minY,
        centerX: (viewRange.maxX - viewRange.minX) / 2,
        centerY: (viewRange.maxY - viewRange.minY) / 2,
        width: viewRange.width,
        height: viewRange.height,
    };
    return range;
}
function getRect(shape) {
    var path = shape.attr('path');
    var x0 = path[0][1];
    var y1 = path[0][2];
    var x1 = path[1][1];
    var y0 = path[2][2];
    var rect = {
        minX: x0,
        minY: y0,
        centerX: (x1 - x0) / 2,
        centerY: (y1 - y0) / 2,
        width: Math.abs(x1 - x0),
        height: Math.abs(y1 - y0),
    };
    return rect;
}
function shrinkTemp(container, shapes, rect, range) {
    var xRatio = rect.width / range.width;
    var yRatio = rect.height / range.height;
    var transformMatrix = g_util_1.transform([
        ['s', xRatio, yRatio],
        ['t', rect.minX, rect.minY],
    ]);
    container.animate({ matrix: transformMatrix }, duration, easing, function () {
        container.remove();
    });
    util_1.each(shapes, function (shape) {
        shape.animate({
            opacity: 0,
        }, duration, easing);
    });
}
function hideLabel(geometry) {
    var labelContainer = geometry.labelsContainer;
    labelContainer.set('visible', false);
}
function showLabel(geometry) {
    var labelContainer = geometry.labelsContainer;
    labelContainer.set('visible', true);
}

},{"../../../util/g-util":679,"@antv/util":803}],633:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var breadcrumb_1 = tslib_1.__importDefault(require("../../../components/breadcrumb"));
var base_1 = tslib_1.__importDefault(require("../../../interaction/base"));
var bbox_1 = tslib_1.__importDefault(require("../../../util/bbox"));
var util_1 = require("@antv/util");
var animation_1 = require("./animation");
var DEFAULT_ITEM_WIDTH = 100;
var DEFAULT_ITEM_HEIGHT = 30;
var PADDING_TOP = 10;
var getValidBreadcrumbConfig = function (cfg) {
    if (cfg === void 0) { cfg = {}; }
    var _cfg = tslib_1.__assign({ x: 0, y: 0, startNode: { name: 'root' }, itemWidth: DEFAULT_ITEM_WIDTH, itemHeight: DEFAULT_ITEM_HEIGHT, padding: [0, 0, 0, 0] }, cfg);
    return _cfg;
};
var DrillDownInteraction = /** @class */ (function (_super) {
    tslib_1.__extends(DrillDownInteraction, _super);
    function DrillDownInteraction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DrillDownInteraction.getInteractionRange = function (layerRange, interaction) {
        var config = getValidBreadcrumbConfig(interaction);
        var _a = config.padding, paddingTop = _a[0], paddingBottom = _a[1];
        if (layerRange) {
            return new bbox_1.default(layerRange.minX, layerRange.maxY - config.itemHeight - paddingTop - paddingBottom, layerRange.width, config.itemHeight + paddingTop + paddingBottom);
        }
    };
    DrillDownInteraction.prototype.start = function (ev) {
        var _this = this;
        var data = ev.data.data;
        if (data.children) {
            this.parentNode = {
                color: ev.target.attr('fill'),
                shape: ev.target,
                data: {
                    name: util_1.clone(this.currentNode.name),
                    value: util_1.clone(this.currentNode.value),
                },
                depth: util_1.clone(this.currentDepth),
            };
            this.currentDepth++;
            animation_1.drillingDown(ev.target, this.view, function () {
                _this.update(data);
            });
        }
    };
    DrillDownInteraction.prototype.update = function (data) {
        if (!util_1.hasKey(this.cache, data.name)) {
            this.cache[data.name] = data;
        }
        var tempoData = this.plot.getTreemapData(data, data.depth);
        this.view.changeData(tempoData);
        this.adjustScale(this.currentDepth);
        this.currentNode = data;
        this.render();
    };
    DrillDownInteraction.prototype.render = function () {
        if (this.breadcrumb) {
            var items = this.getItems();
            this.breadcrumb.update({
                items: items,
            });
            this.breadcrumb.render();
            this.layout();
        }
        else {
            this.initGeometry();
            this.cache = {};
            this.saveOriginMapping();
            this.container = this.plot.canvas.addGroup();
            if (!this.startNode) {
                this.startNode = {
                    name: 'root',
                };
            }
            if (this.startNode.name === 'root') {
                this.startNodeName = util_1.hasKey(this.plot.options.data, 'name') ? this.plot.options.data.name : 'root';
                this.currentNode = this.plot.options.data;
                this.currentDepth = 1;
            }
            else {
                this.startNodeName = this.startNode.name;
                this.currentNode = this.startNode;
            }
            this.y = this.view.coordinateBBox.maxY + PADDING_TOP;
            this.breadcrumb = new breadcrumb_1.default({
                container: this.container,
                x: 0,
                y: this.y,
                items: this.getItems(),
            });
            this.breadcrumb.init();
            this.breadcrumb.render();
            this.plot.canvas.draw();
            this.layout();
        }
        this.onInteraction();
    };
    DrillDownInteraction.prototype.clear = function () {
        return;
    };
    DrillDownInteraction.prototype.layout = function () {
        var currentWidth = this.container.getBBox().width;
        var x = (this.plot.width - currentWidth) / 2;
        this.breadcrumb.update({
            x: x,
            y: this.y,
        });
        this.breadcrumb.render();
    };
    DrillDownInteraction.prototype.getItems = function () {
        var items = [];
        if (this.currentNode.name && this.currentNode.name === this.startNodeName) {
            var rootItem = this.getRootItem();
            items.push(rootItem);
        }
        else {
            items = [];
            var parents = [];
            this.findParent(this.currentNode, parents);
            items.push(this.getRootItem());
            util_1.each(parents, function (p, index) {
                items.push({ key: String(index + 2), text: p.name, data: p });
            });
            items.push({ key: String(parents.length + 2), text: this.currentNode.name, data: this.currentNode });
        }
        return items;
    };
    DrillDownInteraction.prototype.findParent = function (data, parents) {
        if (data.parent) {
            if (util_1.hasKey(this.cache, data.parent.name)) {
                parents.push(this.cache[data.parent.name]);
            }
            else {
                parents.push(data.parent);
            }
            this.findParent(data.parent, parents);
        }
        else {
            return;
        }
    };
    DrillDownInteraction.prototype.onInteraction = function () {
        var _this = this;
        this.container.on('click', function (ev) {
            var targetParent = ev.target.get('parent');
            if (targetParent && targetParent.get('class') === 'item-group') {
                var data_1 = targetParent.get('data');
                if (data_1.data) {
                    if (data_1.text === _this.startNodeName) {
                        var targetDepth = 1;
                        //只有前后depth相邻才执行上卷动画，否则直接更新
                        if (_this.currentDepth - 1 === targetDepth) {
                            animation_1.rollingUp(_this.currentNode.name, _this.view, function () {
                                _this.updateRoot(data_1);
                            });
                        }
                        else {
                            _this.updateRoot(data_1);
                        }
                        _this.currentDepth = 1;
                    }
                    else if (_this.currentNode === data_1.data) {
                        return;
                    }
                    else {
                        var previousDepth = util_1.clone(_this.currentDepth);
                        _this.currentDepth = parseInt(data_1.key);
                        if (previousDepth - 1 === _this.currentDepth) {
                            animation_1.rollingUp(_this.currentNode.name, _this.view, function () {
                                _this.update(data_1.data);
                            });
                        }
                        else {
                            _this.update(data_1.data);
                        }
                    }
                }
            }
        });
    };
    DrillDownInteraction.prototype.getRootItem = function () {
        var rootData = this.plot.options.data;
        var rootName = util_1.hasKey(rootData, 'name') ? rootData.name : 'root';
        return { key: '1', text: rootName, data: this.plot.rootData };
    };
    DrillDownInteraction.prototype.saveOriginMapping = function () {
        var _a = this.plot.options, colorField = _a.colorField, colors = _a.colors;
        var mappingInfo = { field: colorField, values: colors };
        this.originMapping = mappingInfo;
    };
    DrillDownInteraction.prototype.adjustScale = function (index) {
        var view = this.view;
        // 根据当前层级确定mapping配置项
        if (this.mapping && util_1.hasKey(this.mapping, String(index))) {
            var mappingCfg = util_1.clone(this.mapping[index]);
            if (mappingCfg.values && util_1.isFunction(mappingCfg.values)) {
                var values = mappingCfg.values(this.parentNode, this.currentNode);
                mappingCfg.values = values;
            }
            this.view.geometries[0].color(mappingCfg.field, mappingCfg.values);
        }
        else {
            var mappingCfg = util_1.clone(this.originMapping);
            this.view.geometries[0].color(mappingCfg.field, mappingCfg.values);
        }
        view.render();
    };
    DrillDownInteraction.prototype.initGeometry = function () {
        this.geometry = this.view.geometries[0];
        var viewRange = this.view.viewBBox;
        var container = this.geometry.container;
        container.setClip({
            type: 'rect',
            attrs: {
                x: viewRange.minX,
                y: viewRange.minY,
                width: viewRange.width,
                height: viewRange.height,
            },
        });
    };
    DrillDownInteraction.prototype.updateRoot = function (data) {
        this.view.changeData(data.data);
        this.adjustScale(1);
        this.currentNode = this.plot.options.data;
        this.render();
    };
    return DrillDownInteraction;
}(base_1.default));
exports.default = DrillDownInteraction;
base_1.default.registerInteraction('drilldown', DrillDownInteraction);

},{"../../../components/breadcrumb":408,"../../../interaction/base":441,"../../../util/bbox":672,"./animation":632,"@antv/util":803,"tslib":894}],634:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INTERACTION_MAP = void 0;
var tslib_1 = require("tslib");
var drillDown_1 = tslib_1.__importDefault(require("./drillDown"));
exports.INTERACTION_MAP = {
    drilldown: drillDown_1.default,
};

},{"./drillDown":633,"tslib":894}],635:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var squarify_1 = tslib_1.__importDefault(require("./layout/squarify"));
var interaction_1 = require("./interaction");
var EventParser = tslib_1.__importStar(require("./event"));
var label_1 = tslib_1.__importDefault(require("./components/label"));
var PARENT_NODE_OFFSET = 4;
var BLOCK_MARGIN = 4;
var TreemapLayer = /** @class */ (function (_super) {
    tslib_1.__extends(TreemapLayer, _super);
    function TreemapLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'treemap';
        return _this;
    }
    TreemapLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            maxLevel: 2,
            padding: [0, 0, 0, 0],
            tooltip: {
                visible: false,
                showTitle: false,
                showCrosshairs: false,
                showMarkers: false,
                shared: false,
            },
            legend: {
                visible: false,
            },
            xAxis: {
                visible: false,
            },
            yAxis: {
                visible: false,
            },
            xField: 'x',
            yField: 'y',
            label: {
                visible: true,
                adjustPosition: true,
                style: {
                    stroke: 'rgba(0,0,0,0)',
                    lineWidth: 0,
                    fontSize: 12,
                },
            },
            meta: {
                x: {
                    nice: false,
                },
                y: {
                    nice: false,
                },
            },
            interactions: [{ type: 'tooltip' }],
        });
    };
    TreemapLayer.prototype.beforeInit = function () {
        var _this = this;
        _super.prototype.beforeInit.call(this);
        var interactions = this.options.interactions;
        if (interactions) {
            util_1.each(interactions, function (interaction) {
                if (interaction.type === 'drilldown') {
                    _this.isDrilldown = true;
                    _this.options.maxLevel = 1;
                }
            });
        }
        var data = this.options.data;
        var treemapData = this.getTreemapData(data);
        this.rootData = treemapData;
    };
    TreemapLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        if (this.options.label && this.options.label.visible) {
            var label = new label_1.default(tslib_1.__assign({ view: this.view, plot: this }, this.options.label));
            label.render();
        }
    };
    TreemapLayer.prototype.geometryParser = function () {
        return 'polygon';
    };
    TreemapLayer.prototype.getTreemapData = function (data, level) {
        var viewRange = this.getViewRange();
        var root = squarify_1.default(data, viewRange.x, viewRange.y, viewRange.width, viewRange.height);
        this.recursive(root, 1);
        var treemapData = [];
        this.getAllNodes(root, treemapData, level);
        treemapData.sort(function (a, b) {
            return a.depth - b.depth;
        });
        this.options.xField = 'x';
        this.options.yField = 'y';
        return treemapData;
    };
    TreemapLayer.prototype.processData = function () {
        return this.rootData;
    };
    TreemapLayer.prototype.coord = function () {
        return;
    };
    TreemapLayer.prototype.addGeometry = function () {
        var _this = this;
        var _a = this.options, data = _a.data, colorField = _a.colorField, color = _a.color;
        var treemapData = this.getTreemapData(data);
        this.rootData = treemapData;
        var isNested = this.isNested(treemapData);
        this.rect = {
            type: 'polygon',
            position: {
                fields: ['x', 'y'],
            },
            color: {
                fields: [colorField],
                values: color,
            },
            style: {
                fields: ['depth'],
                callback: function (d) {
                    var defaultStyle = _this.adjustStyleByDepth(d, isNested);
                    return util_1.deepMix({}, defaultStyle, _this.options.rectStyle);
                },
            },
            tooltip: {
                fields: ['name', 'value'],
            },
        };
        if (this.options.tooltip && this.options.tooltip.formatter) {
            this.rect.tooltip.callback = this.options.tooltip.formatter;
        }
        this.setConfig('geometry', this.rect);
    };
    TreemapLayer.prototype.applyInteractions = function () {
        var _this = this;
        var interactionCfg = this.options.interactions;
        var interactions = this.view.interactions;
        util_1.each(interactionCfg, function (inter) {
            var Ctr = interaction_1.INTERACTION_MAP[inter.type];
            if (Ctr) {
                var interaction = new Ctr(util_1.deepMix({}, {
                    view: _this.view,
                    plot: _this,
                    startEvent: 'polygon:click',
                }, inter.cfg, Ctr.getInteractionRange(_this.layerBBox, inter.cfg)));
                interactions[inter.type] = interaction;
            }
        });
    };
    TreemapLayer.prototype.animation = function () {
        _super.prototype.animation.call(this);
        if (this.isDrilldown) {
            this.rect.animate = false;
        }
    };
    TreemapLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    TreemapLayer.prototype.recursive = function (rows, depth) {
        var _this = this;
        var colorField = this.options.colorField;
        util_1.each(rows, function (r) {
            util_1.each(r.children, function (c) {
                c.depth = depth;
                if (depth > 1)
                    c.parent = r;
                if (!util_1.hasKey(c, colorField)) {
                    c[colorField] = r[colorField];
                }
                c.showLabel = true;
                var leaf = _this.isLeaf(c);
                if (!leaf) {
                    var cliperHeight = Math.abs(c.y1 - c.y0);
                    var labelHeight = _this.getLabelHeight();
                    var parentLabelOffset = cliperHeight / 2 > labelHeight ? labelHeight : BLOCK_MARGIN;
                    c.showLabel = parentLabelOffset === BLOCK_MARGIN ? false : true;
                    var c_rows = squarify_1.default(c, c.x0 + BLOCK_MARGIN, c.y0 + parentLabelOffset, c.x1 - BLOCK_MARGIN, c.y1 - BLOCK_MARGIN);
                    _this.fillColorField(c_rows, colorField, c[colorField]);
                    _this.recursive(c_rows, c.depth + 1);
                }
            });
        });
    };
    TreemapLayer.prototype.getAllNodes = function (data, nodes, level) {
        var _this = this;
        var max = level ? level : this.options.maxLevel;
        var viewRange = this.getViewRange();
        util_1.each(data, function (d) {
            if (util_1.hasKey(d, 'x0') && d.depth <= max) {
                nodes.push(tslib_1.__assign(tslib_1.__assign({}, d), { x: [d.x0, d.x1, d.x1, d.x0], y: [viewRange.height - d.y1, viewRange.height - d.y1, viewRange.height - d.y0, viewRange.height - d.y0] }));
            }
            if (util_1.hasKey(d, 'children')) {
                _this.getAllNodes(d.children, nodes);
            }
        });
    };
    TreemapLayer.prototype.fillColorField = function (rows, fieldName, value) {
        util_1.each(rows, function (r) {
            if (!util_1.hasKey(r, fieldName)) {
                r[fieldName] = value;
            }
        });
    };
    TreemapLayer.prototype.getLabelHeight = function () {
        var label = this.options.label;
        var fontSize = this.getPlotTheme().label.style.fontSize;
        var size = 0;
        if (label && label.visible) {
            var labelStyle = label.style;
            size = labelStyle && labelStyle.fontSize ? labelStyle.fontSize : fontSize;
        }
        return size + PARENT_NODE_OFFSET * 2;
    };
    TreemapLayer.prototype.isLeaf = function (data) {
        return !data.children || data.children.length === 0;
    };
    TreemapLayer.prototype.isNested = function (data) {
        var maxLevel = this.options.maxLevel;
        if (maxLevel === 1) {
            return false;
        }
        var nested = false;
        for (var i = 0; i < data.length; i++) {
            if (data[i].children) {
                nested = true;
                break;
            }
        }
        return nested;
    };
    TreemapLayer.prototype.adjustStyleByDepth = function (depth, isNested) {
        var maxLevel = this.options.maxLevel;
        if (!isNested) {
            return {
                lineWidth: 1,
                stroke: 'rgba(0,0,0,0.9)',
                opacity: 0.9,
            };
        }
        else if (depth === 1) {
            return {
                lineWidth: 1,
                stroke: 'black',
                opacity: depth / maxLevel,
            };
        }
        else {
            return {
                lineWidth: 1,
                stroke: 'rgba(0,0,0,0.3)',
                opacity: depth / maxLevel,
            };
        }
    };
    return TreemapLayer;
}(view_layer_1.default));
exports.default = TreemapLayer;
global_1.registerPlotType('treemap', TreemapLayer);

},{"../../base/global":392,"../../base/view-layer":395,"./components/label":629,"./event":630,"./interaction":634,"./layout/squarify":638,"@antv/util":803,"tslib":894}],636:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dice = void 0;
var util_1 = require("@antv/util");
function dice(root, x0, y0, x1, y1) {
    var width = x1 - x0;
    var children = root.children, value = root.value;
    children.sort(function (a, b) {
        return b.value - a.value;
    });
    var k = width / value;
    var node_x = x0;
    util_1.each(children, function (c) {
        c.y0 = y0;
        c.y1 = y1;
        c.x0 = node_x;
        node_x += c.value * k;
        c.x1 = c.x0 + c.value * k;
    });
}
exports.dice = dice;

},{"@antv/util":803}],637:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.slice = void 0;
var util_1 = require("@antv/util");
function slice(root, x0, y0, x1, y1) {
    var height = y1 - y0;
    var children = root.children, value = root.value;
    children.sort(function (a, b) {
        return b.value - a.value;
    });
    var k = height / value;
    var node_y = y0;
    util_1.each(children, function (c) {
        c.x0 = x0;
        c.x1 = x1;
        c.y0 = node_y;
        node_y += c.value * k;
        c.y1 = c.y0 + c.value * k;
    });
}
exports.slice = slice;

},{"@antv/util":803}],638:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dice_1 = require("./dice");
var slice_1 = require("./slice");
//reference: https://github.com/d3/d3-hierarchy/blob/master/src/treemap/squarify.js
// 黄金分割
var ratio = (1 + Math.sqrt(5)) / 2;
function squarify(root, x0, y0, x1, y1) {
    var children = root.children;
    var value = root.value;
    children.sort(function (a, b) {
        return b.value - a.value;
    });
    var rows = [];
    var sumValue, maxValue, minValue;
    var alpha, beta;
    var newRatio, minRatio;
    var nodeValue;
    var i = 0, j = 0;
    // todo: 剔除empty node
    while (i < children.length) {
        var width = x1 - x0;
        var height = y1 - y0;
        sumValue = children[j++].value;
        maxValue = sumValue;
        minValue = sumValue;
        alpha = Math.max(height / width, width / height) / (value * ratio);
        beta = sumValue * sumValue * alpha;
        minRatio = Math.max(maxValue / beta, beta / minValue);
        for (; j < children.length; j++) {
            nodeValue = children[j].value;
            sumValue += nodeValue;
            if (nodeValue < minValue)
                minValue = nodeValue;
            if (nodeValue > maxValue)
                maxValue = nodeValue;
            beta = sumValue * sumValue * alpha;
            newRatio = Math.max(maxValue / beta, beta / minValue);
            if (newRatio > minRatio) {
                sumValue -= nodeValue;
                break;
            }
            minRatio = newRatio;
        }
        var row = { value: sumValue, dice: width < height, children: children.slice(i, j) };
        rows.push(row);
        if (row.dice) {
            var h = value ? (height * sumValue) / value : height;
            dice_1.dice(row, x0, y0, x1, y0 + h);
            if (value) {
                y0 += h;
            }
        }
        else {
            var w = value ? (width * sumValue) / value : width;
            slice_1.slice(row, x0, y0, x0 + w, y1);
            if (value) {
                x0 += w;
            }
        }
        value -= sumValue;
        i = j;
    }
    return rows;
}
exports.default = squarify;

},{"./dice":636,"./slice":637}],639:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
var util_1 = require("@antv/util");
var layer_1 = require("../../layer");
var dependents_1 = require("../../../../dependents");
function getDefaultCfg() {
    return {
        fill: '#fff',
        fontSize: 12,
        lineHeight: 12,
        stroke: 'rgba(0, 0, 0, 0.45)',
    };
}
var DiffLabel = /** @class */ (function () {
    function DiffLabel(cfg) {
        this.textAttrs = {};
        this.view = cfg.view;
        this.fields = cfg.fields;
        this.formatter = cfg.formatter;
        this.textAttrs = util_1.mix(getDefaultCfg(), cfg.style);
        this._init();
    }
    /** 绘制辅助labels */
    DiffLabel.prototype.draw = function () {
        var _this = this;
        if (!this.view || this.view.destroyed) {
            return;
        }
        var data = util_1.clone(this.view.getData());
        this.container = this.view.foregroundGroup.addGroup();
        var shapes = this.view.geometries[0].elements.map(function (value) { return value.shape; });
        util_1.each(shapes, function (shape, idx) {
            if (!shape.cfg.origin)
                return;
            var _origin = shape.cfg.origin.data;
            var shapeBox = shape.getBBox();
            var values = _origin[layer_1.VALUE_FIELD];
            var diff = values;
            if (util_1.isArray(values)) {
                diff = values[1] - values[0];
            }
            diff = diff > 0 ? "+" + diff : diff;
            /** is total, total do not need `+` sign */
            if (_origin[layer_1.IS_TOTAL]) {
                diff = values[0] - values[1];
            }
            var formattedText = diff;
            if (_this.formatter) {
                var color = shapes[idx].attr('fill');
                formattedText = _this.formatter("" + diff, { _origin: data[idx], color: color }, idx);
            }
            var text = _this.container.addShape('text', {
                attrs: tslib_1.__assign({ text: formattedText, textBaseline: 'middle', textAlign: 'center', x: (shapeBox.minX + shapeBox.maxX) / 2, y: (shapeBox.minY + shapeBox.maxY) / 2 }, _this.textAttrs),
                name: 'dill-label',
            });
            if (text.getBBox().height > shapeBox.height) {
                text.set('visible', false);
            }
        });
        this.view.getCanvas().draw();
    };
    DiffLabel.prototype.clear = function () {
        if (this.container) {
            this.container.clear();
        }
    };
    DiffLabel.prototype._init = function () {
        var _this = this;
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.BEFORE_RENDER, function () {
            _this.clear();
        });
        this.view.on(dependents_1.VIEW_LIFE_CIRCLE.AFTER_RENDER, function () {
            _this.draw();
        });
    };
    return DiffLabel;
}());
exports.default = DiffLabel;

},{"../../../../dependents":425,"../../layer":644,"@antv/util":803,"tslib":894}],640:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
var util_1 = require("@antv/util");
var label_1 = tslib_1.__importDefault(require("../../../column/component/label"));
var layer_1 = require("../../layer");
var base_1 = require("../../../../components/label/base");
var dependents_1 = require("../../../../dependents");
var MARGIN = 2;
var WaterfallLabel = /** @class */ (function (_super) {
    tslib_1.__extends(WaterfallLabel, _super);
    function WaterfallLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    WaterfallLabel.prototype.adjustLabel = function (label, element) {
        var _a;
        var _b;
        var shape = element.shape;
        var shapeBox = shape.getBBox();
        var data = element.getData();
        var values = data[layer_1.VALUE_FIELD];
        var diff = data[this.layer.options.yField];
        var value = util_1.isArray(values) ? values[1] : values;
        var formatter = this.options.formatter;
        var mappingData = [].concat(element.getModel().mappingData);
        var elementIndex = formatter ? mappingData[0] && mappingData[0]['_origin'][layer_1.INDEX_FIELD] : 0;
        var formatterValue = formatter
            ? formatter(value, (_a = {},
                _a[dependents_1._ORIGIN] = (_b = mappingData[0]) === null || _b === void 0 ? void 0 : _b._origin,
                _a.mappingDatum = mappingData[0],
                _a.mappingDatumIndex = 0,
                _a.element = element,
                _a.elementIndex = elementIndex,
                _a), elementIndex)
            : value;
        var yPos = (shapeBox.minY + shapeBox.maxY) / 2;
        var textBaseline = 'bottom';
        if (diff < 0) {
            yPos = shapeBox.maxY + MARGIN;
            textBaseline = 'top';
        }
        else {
            yPos = shapeBox.minY - MARGIN;
        }
        label.attr('y', yPos);
        label.attr('text', formatterValue);
        label.attr('textBaseline', textBaseline);
    };
    return WaterfallLabel;
}(label_1.default));
exports.default = WaterfallLabel;
base_1.registerLabelComponent('waterfall', WaterfallLabel);

},{"../../../../components/label/base":414,"../../../../dependents":425,"../../../column/component/label":487,"../../layer":644,"@antv/util":803,"tslib":894}],641:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
/**
 * @file events of waterfall chart is equal to column chart
 */
var event_1 = require("../column/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });

},{"../column/event":488}],642:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
var util_1 = require("@antv/util");
var dependents_1 = require("../../../../dependents");
function getStyle(cfg, isStroke, isFill) {
    var style = cfg.style, defaultStyle = cfg.defaultStyle, color = cfg.color;
    var attrs = tslib_1.__assign(tslib_1.__assign({}, defaultStyle), style);
    if (color) {
        if (isStroke) {
            attrs.stroke = color;
        }
        if (isFill) {
            attrs.fill = color;
        }
    }
    return attrs;
}
function getRectPath(points) {
    var path = [];
    var firstPoint = points[0];
    path.push(['M', firstPoint.x, firstPoint.y]);
    for (var i = 1, len = points.length; i < len; i++) {
        path.push(['L', points[i].x, points[i].y]);
    }
    path.push(['L', firstPoint.x, firstPoint.y]); // 需要闭合
    path.push(['z']);
    return path;
}
// @ts-ignore
dependents_1.registerShape('interval', 'waterfall', {
    // @ts-ignore
    draw: function (cfg, container) {
        var style = getStyle(cfg, false, true);
        var path = this.parsePath(getRectPath(cfg.points));
        var shape = container.addShape('path', {
            attrs: tslib_1.__assign(tslib_1.__assign({}, style), { path: path }),
            name: 'interval',
        });
        var leaderLine = util_1.get(cfg.style, 'leaderLine');
        if (leaderLine && leaderLine.visible) {
            var lineStyle = leaderLine.style || {};
            // 2. 虚线连线
            if (cfg.nextPoints) {
                var linkPath = [
                    // @ts-ignore
                    ['M', cfg.points[2].x, cfg.points[2].y],
                    // @ts-ignore
                    ['L', cfg.nextPoints[0].x, cfg.nextPoints[0].y],
                ];
                linkPath = this.parsePath(linkPath);
                container.addShape('path', {
                    attrs: tslib_1.__assign({ path: linkPath, stroke: '#d3d3d3', lineDash: [4, 2], lineWidth: 1 }, lineStyle),
                    name: 'leader-line',
                });
            }
        }
        return shape;
    },
});

},{"../../../../dependents":425,"@antv/util":803,"tslib":894}],643:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Waterfall = /** @class */ (function (_super) {
    tslib_1.__extends(Waterfall, _super);
    function Waterfall() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Waterfall.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'waterfall';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Waterfall.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Waterfall;
}(plot_1.default));
exports.default = Waterfall;

},{"../../base/plot":394,"./layer":644,"@antv/util":803,"tslib":894}],644:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INDEX_FIELD = exports.IS_TOTAL = exports.VALUE_FIELD = void 0;
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-18
 */
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
require("./geometry/shape/waterfall");
var view_layer_1 = tslib_1.__importDefault(require("../../base/view-layer"));
var scale_1 = require("../../util/scale");
var factory_1 = require("../../components/factory");
var EventParser = tslib_1.__importStar(require("./event"));
require("./component/label/waterfall-label");
var diff_label_1 = tslib_1.__importDefault(require("./component/label/diff-label"));
var view_1 = require("../../util/view");
var G2_GEOM_MAP = {
    waterfall: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'waterfall',
};
exports.VALUE_FIELD = '$$value$$';
exports.IS_TOTAL = '$$total$$';
exports.INDEX_FIELD = '$$index$$';
var WaterfallLayer = /** @class */ (function (_super) {
    tslib_1.__extends(WaterfallLayer, _super);
    function WaterfallLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'watarfall';
        return _this;
    }
    WaterfallLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            legend: {
                visible: false,
                position: 'bottom',
            },
            label: {
                visible: true,
                adjustPosition: true,
            },
            /** 差值 label */
            diffLabel: {
                visible: true,
            },
            /** 迁移线 */
            leaderLine: {
                visible: true,
            },
            /** 显示总计 */
            showTotal: {
                visible: true,
                label: '总计值',
            },
            waterfallStyle: {
                /** 默认无描边 */
                lineWidth: 0,
            },
            tooltip: {
                visible: true,
                shared: true,
                showCrosshairs: false,
                showMarkers: false,
            },
        });
    };
    WaterfallLayer.prototype.getOptions = function (props) {
        var options = _super.prototype.getOptions.call(this, props);
        this.adjustLegendOptions(options);
        this.adjustMeta(options);
        return options;
    };
    WaterfallLayer.prototype.afterInit = function () {
        _super.prototype.afterInit.call(this);
        var options = this.options;
        if (options.diffLabel && options.diffLabel.visible) {
            this.diffLabel = new diff_label_1.default({
                view: this.view,
                fields: [options.xField, options.yField, exports.VALUE_FIELD],
                formatter: options.diffLabel.formatter,
                style: options.diffLabel.style,
            });
        }
        else if (this.diffLabel) {
            this.diffLabel.clear();
            this.diffLabel = null;
        }
    };
    WaterfallLayer.prototype.afterRender = function () {
        _super.prototype.afterRender.call(this);
        var options = this.options;
        this.view.on('tooltip:change', function (e) {
            var items = e.items;
            for (var i = 0; i < items.length; i++) {
                var item = items[i];
                var data = util_1.get(item, 'data', {});
                // 改变 tooltip 显示的name和value
                item.name = data[options.xField];
                item.value = data[options.yField];
                if (!item.value && data[exports.IS_TOTAL]) {
                    var values = data[exports.VALUE_FIELD];
                    item.value = values[0] - values[1];
                }
                e.items[i] = item;
            }
        });
        this.renderLabel();
    };
    WaterfallLayer.prototype.renderLabel = function () {
        var geometry = view_1.getGeometryByType(this.view, 'interval');
        if (this.options.label && this.options.label.visible) {
            this.doRenderLabel(geometry, tslib_1.__assign({ type: 'waterfall' }, this.options.label));
        }
    };
    WaterfallLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    WaterfallLayer.prototype.interaction = function () {
        this.setConfig('interactions', [{ type: 'tooltip' }, { type: 'active-region' }]);
    };
    WaterfallLayer.prototype.addGeometry = function () {
        var options = this.options;
        var waterfall = {
            type: 'interval',
            position: {
                fields: [options.xField, exports.VALUE_FIELD],
            },
            shape: {
                values: ['waterfall'],
            },
        };
        waterfall.style = this._parseStyle();
        waterfall.color = this._parseColor();
        this.waterfall = waterfall;
        if (this.options.tooltip && (this.options.tooltip.fields || this.options.tooltip.formatter)) {
            this.geometryTooltip();
        }
        this.setConfig('geometry', waterfall);
    };
    WaterfallLayer.prototype.processData = function (originData) {
        var _a;
        var plotData = [];
        var xField = this.options.xField;
        var yField = this.options.yField;
        util_1.map(originData, function (dataItem, idx) {
            var _a;
            var value = dataItem[yField];
            if (idx > 0) {
                var prevValue = plotData[idx - 1][exports.VALUE_FIELD];
                if (util_1.isArray(prevValue)) {
                    value = [prevValue[1], dataItem[yField] + prevValue[1]];
                }
                else {
                    value = [prevValue, dataItem[yField] + prevValue];
                }
            }
            plotData.push(tslib_1.__assign(tslib_1.__assign({}, dataItem), (_a = {}, _a[exports.VALUE_FIELD] = value, _a[exports.INDEX_FIELD] = idx, _a)));
        });
        if (this.options.showTotal && this.options.showTotal.visible) {
            var values = util_1.map(originData, function (o) { return o[yField]; });
            var totalValue = util_1.reduce(values, function (p, n) { return p + n; }, 0);
            plotData.push((_a = {},
                _a[xField] = this.options.showTotal.label,
                _a[yField] = null,
                _a[exports.VALUE_FIELD] = [totalValue, 0],
                _a[exports.INDEX_FIELD] = plotData.length,
                _a[exports.IS_TOTAL] = true,
                _a));
        }
        return plotData;
    };
    WaterfallLayer.prototype.scale = function () {
        var options = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[options.xField] = { type: 'cat' };
        if (util_1.has(options, 'xAxis')) {
            scale_1.extractScale(scales[options.xField], options.xAxis);
        }
        /** 配置y-scale */
        scales[exports.VALUE_FIELD] = {};
        if (util_1.has(options, 'yAxis')) {
            scale_1.extractScale(scales[exports.VALUE_FIELD], options.yAxis);
        }
        this.setConfig('scales', scales);
    };
    /** @override */
    WaterfallLayer.prototype.axis = function () {
        var xAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'x',
        });
        var yAxis_parser = factory_1.getComponent('axis', {
            plot: this,
            dim: 'y',
        });
        var axesConfig = {};
        axesConfig[this.options.xField] = xAxis_parser;
        axesConfig[exports.VALUE_FIELD] = yAxis_parser;
        /** 存储坐标轴配置项到config */
        this.setConfig('axes', axesConfig);
    };
    WaterfallLayer.prototype.coord = function () {
        return;
    };
    WaterfallLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    WaterfallLayer.prototype.geometryTooltip = function () {
        this.waterfall.tooltip = {};
        var tooltipOptions = this.options.tooltip;
        if (tooltipOptions.fields) {
            this.waterfall.tooltip.fields = tooltipOptions.fields;
        }
        if (tooltipOptions.formatter) {
            this.waterfall.tooltip.callback = tooltipOptions.formatter;
            if (!tooltipOptions.fields) {
                this.waterfall.tooltip.fields = [this.options.xField, exports.VALUE_FIELD];
            }
        }
    };
    /** 牵引线的样式注入到style中 */
    WaterfallLayer.prototype._parseStyle = function () {
        var style = this.options.waterfallStyle;
        var leaderLine = this.options.leaderLine;
        var config = {};
        if (util_1.isFunction(style)) {
            config.callback = function () {
                var args = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    args[_i] = arguments[_i];
                }
                return Object.assign({}, style.apply(void 0, args), { leaderLine: leaderLine });
            };
        }
        else {
            config.cfg = tslib_1.__assign(tslib_1.__assign({}, style), { leaderLine: leaderLine });
        }
        return config;
    };
    WaterfallLayer.prototype._parseColor = function () {
        var _this = this;
        var options = this.options;
        var _a = this.options, xField = _a.xField, yField = _a.yField;
        var config = {
            fields: [xField, yField, exports.VALUE_FIELD, exports.INDEX_FIELD],
        };
        if (util_1.isFunction(options.color)) {
            config.callback = options.color;
        }
        else {
            var risingColor_1 = '#f4664a';
            var fallingColor_1 = '#30bf78';
            var totalColor_1 = 'rgba(0, 0, 0, 0.25)';
            if (util_1.isString(options.color)) {
                risingColor_1 = fallingColor_1 = totalColor_1 = options.color;
            }
            else if (util_1.isObject(options.color)) {
                var _b = options.color, rising = _b.rising, falling = _b.falling, total = _b.total;
                risingColor_1 = rising;
                fallingColor_1 = falling;
                totalColor_1 = total;
            }
            config.callback = function (type, value, values, index) {
                if (index === _this.options.data.length) {
                    return totalColor_1 || (values[0] >= 0 ? risingColor_1 : fallingColor_1);
                }
                return (util_1.isArray(values) ? values[1] - values[0] : values) >= 0 ? risingColor_1 : fallingColor_1;
            };
        }
        return config;
    };
    /** 复写 legend 配置, 瀑布图默认无legend */
    WaterfallLayer.prototype.adjustLegendOptions = function (options) {
        var legendOptions = options.legend;
        if (legendOptions) {
            legendOptions.visible = false;
        }
    };
    /** 复写 meta 配置 */
    WaterfallLayer.prototype.adjustMeta = function (options) {
        var metaOptions = options.meta;
        if (metaOptions) {
            var valueFieldMeta = metaOptions ? metaOptions[options.yField] : {};
            valueFieldMeta.alias = valueFieldMeta.alias || options.yField;
            options.meta[exports.VALUE_FIELD] = valueFieldMeta;
        }
    };
    return WaterfallLayer;
}(view_layer_1.default));
exports.default = WaterfallLayer;
global_1.registerPlotType('waterfall', WaterfallLayer);

},{"../../base/global":392,"../../base/view-layer":395,"../../components/factory":412,"../../util/scale":712,"../../util/view":715,"./component/label/diff-label":639,"./component/label/waterfall-label":640,"./event":641,"./geometry/shape/waterfall":642,"@antv/util":803,"tslib":894}],645:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var global_1 = require("../../base/global");
var WordCloud = /** @class */ (function (_super) {
    tslib_1.__extends(WordCloud, _super);
    function WordCloud(container, props) {
        var _this = this;
        // only canvas works for now
        props.renderer = 'canvas';
        _this = _super.call(this, container, props) || this;
        return _this;
    }
    WordCloud.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'wordCloud';
        layerProps.container = this.containerDOM;
        _super.prototype.createLayers.call(this, layerProps);
    };
    return WordCloud;
}(plot_1.default));
exports.default = WordCloud;
global_1.registerPlotType('wordCloud', layer_1.default);

},{"../../base/global":392,"../../base/plot":394,"./layer":646,"@antv/util":803,"tslib":894}],646:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var layer_1 = tslib_1.__importDefault(require("../../base/layer"));
var word_cloud_tooltips_1 = tslib_1.__importDefault(require("./word-cloud-tooltips"));
var wordcloud2_1 = tslib_1.__importDefault(require("./wordcloud2"));
var WordCloudLayer = /** @class */ (function (_super) {
    tslib_1.__extends(WordCloudLayer, _super);
    function WordCloudLayer(props) {
        var _this = _super.call(this, props) || this;
        _this._toolTipsAction = function (item, dimension, evt, start) {
            if (dimension) {
                _this._toolTips.update({
                    items: [
                        {
                            color: item.color || 'red',
                            name: item.word,
                            value: item.weight,
                        },
                    ],
                    x: evt.offsetX,
                    y: evt.offsetY,
                });
                _this._toolTips.show();
            }
            else {
                _this._toolTips.hide();
            }
            _this._toolTips.render();
            _this._configHoverAction && _this._configHoverAction(item, dimension, evt, start);
        };
        _this._configHoverAction = props.onWordCloudHover;
        _this._enableToolTips = util_1.get(props, 'tooltip.visible', true);
        _this.options = util_1.deepMix({}, {
            width: 400,
            height: 400,
            enableToolTips: true,
        }, props, 
        // replace use config's hover action if needed, and trigger later
        {
            onWordCloudHover: _this._enableToolTips ? _this._toolTipsAction : _this._configHoverAction,
        });
        return _this;
    }
    WordCloudLayer.prototype.init = function () {
        _super.prototype.init.call(this);
        this._initToolTips();
    };
    WordCloudLayer.prototype.render = function () {
        _super.prototype.render.call(this);
        this._render();
    };
    WordCloudLayer.prototype._initToolTips = function () {
        this._toolTips = new word_cloud_tooltips_1.default({
            showTitle: false,
            visible: false,
            parent: this.options.container,
            follow: true,
            inPanel: false,
            items: [],
        });
        this._toolTips.init();
    };
    WordCloudLayer.prototype._render = function () {
        this._targetCanvas = this.canvas.get('el');
        if (this.options.maskImage) {
            this._handleMaskImage();
        }
        else {
            // mask image not exist
            this._start();
        }
    };
    WordCloudLayer.prototype._handleMaskImage = function () {
        var _this = this;
        var image = new Image();
        image.src = this.options.maskImage + '?' + new Date().getTime();
        image.crossOrigin = 'Anonymous';
        image.onload = function () {
            if (image.naturalHeight + image.naturalWidth === 0 || image.width + image.height === 0) {
                _this._start();
            }
            else {
                // handle no-zero image silhouette
                _this._startWithMaskImage(image);
            }
        };
        image.onerror = function () {
            console.error('image %s load failed !!!', _this.options.maskImage);
            // load image error, ignore this mask
            _this._start();
        };
    };
    WordCloudLayer.prototype._start = function () {
        this._handleG2PlotConfig();
        var targetCtx = this._targetCanvas.getContext('2d');
        // it's a trick, because 「g」 use context to scale canvas by pixelRatio,
        // but here i need scale it back
        var pixelRatio = this.canvas.get('width') / this.canvas.get('el').width;
        targetCtx.scale(pixelRatio, pixelRatio);
        wordcloud2_1.default(this._targetCanvas, this.options);
    };
    WordCloudLayer.prototype._handleG2PlotConfig = function () {
        var fontSize = this.options.wordStyle.fontSize || [10, 60];
        var rotation = this.options.wordStyle.rotation || [-Math.PI / 2, Math.PI / 2];
        var active, shadowColor, shadowBlur;
        if (this.options.wordStyle.active) {
            active = true;
            shadowColor = this.options.wordStyle.active.shadowColor || '#333';
            shadowBlur = this.options.wordStyle.active.shadowBlur || 10;
        }
        else {
            active = false;
        }
        this.options = util_1.deepMix({}, this.options, {
            minFontSize: fontSize[0],
            maxFontSize: fontSize[1],
            minRotation: rotation[0],
            maxRotation: rotation[1],
            active: active,
            shadowColor: shadowColor,
            shadowBlur: shadowBlur,
        });
    };
    WordCloudLayer.prototype._startWithMaskImage = function (image) {
        var _a = this._scaleMaskImageCanvas(this._transformWhite2BlackPixels(image)), maskImageCanvas = _a.maskImageCanvas, maskImageContext = _a.maskImageContext;
        /* Determine bgPixel by creating
         another canvas and fill the specified background color. */
        var bctx = document.createElement('canvas').getContext('2d');
        bctx.fillStyle = this.options.backgroundColor || '#fff';
        bctx.fillRect(0, 0, 1, 1);
        var bgPixel = bctx.getImageData(0, 0, 1, 1).data;
        var imageData = maskImageContext.getImageData(0, 0, maskImageCanvas.width, maskImageCanvas.height);
        var newImageData = maskImageContext.createImageData(imageData);
        for (var i = 0; i < imageData.data.length; i += 4) {
            if (imageData.data[i + 3] > 128) {
                // keep this area's data the same as pixel color
                newImageData.data[i] = bgPixel[0];
                newImageData.data[i + 1] = bgPixel[1];
                newImageData.data[i + 2] = bgPixel[2];
                newImageData.data[i + 3] = bgPixel[3];
            }
            else {
                // This color must not be the same as the bgPixel.
                // check wordcloud2.js#1192 's condition
                newImageData.data[i] = bgPixel[0];
                newImageData.data[i + 1] = bgPixel[1];
                newImageData.data[i + 2] = bgPixel[2];
                newImageData.data[i + 3] = 254; // just for not same as the bg color
            }
        }
        maskImageContext.putImageData(newImageData, 0, 0);
        var targetCtx = this._targetCanvas.getContext('2d');
        targetCtx.drawImage(maskImageCanvas, 0, 0);
        this.options = util_1.deepMix({}, this.options, { clearCanvas: false });
        this._start();
    };
    WordCloudLayer.prototype._scaleMaskImageCanvas = function (maskImageCanvas) {
        var maskCanvasScaled = document.createElement('canvas');
        // get real canvas determined by pixelRatio
        maskCanvasScaled.width = this.canvas.get('width');
        maskCanvasScaled.height = this.canvas.get('height');
        var ctx = maskCanvasScaled.getContext('2d');
        // keep scale smooth
        ctx.imageSmoothingEnabled = true;
        // ctx.mozImageSmoothingEnabled = true;
        // ctx.webkitImageSmoothingEnabled = true;
        // ctx.msImageSmoothingEnabled = true;
        ctx.drawImage(maskImageCanvas, 0, 0, maskImageCanvas.width, maskImageCanvas.height, 0, 0, maskCanvasScaled.width, maskCanvasScaled.height);
        return {
            maskImageCanvas: maskCanvasScaled,
            maskImageContext: ctx,
        };
    };
    WordCloudLayer.prototype._transformWhite2BlackPixels = function (image) {
        var maskImageCanvas = document.createElement('canvas');
        maskImageCanvas.width = image.width;
        maskImageCanvas.height = image.height;
        var ctx = maskImageCanvas.getContext('2d');
        ctx.drawImage(image, 0, 0, image.width, image.height);
        var imageData = ctx.getImageData(0, 0, maskImageCanvas.width, maskImageCanvas.height);
        var SINGLE_COMPONENT_SIZE = 4;
        var BLACK_PIXEL = 0;
        var FULL_PIXEL = 255;
        // R - G - B - A
        for (var i = 0; i < imageData.data.length; i += SINGLE_COMPONENT_SIZE) {
            var rgb = imageData.data[i] + imageData.data[i + 1] + imageData.data[i + 2];
            var alpha = imageData.data[i + 3];
            if (alpha < 128 || rgb > 250 * 3) {
                // white area(not to draw)
                imageData.data[i] = FULL_PIXEL;
                imageData.data[i + 1] = FULL_PIXEL;
                imageData.data[i + 2] = FULL_PIXEL;
                imageData.data[i + 3] = BLACK_PIXEL;
            }
            else {
                // black area wait to draw(image black silhouette)
                imageData.data[i] = BLACK_PIXEL;
                imageData.data[i + 1] = BLACK_PIXEL;
                imageData.data[i + 2] = BLACK_PIXEL;
                imageData.data[i + 3] = FULL_PIXEL;
            }
        }
        ctx.putImageData(imageData, 0, 0);
        return maskImageCanvas;
    };
    return WordCloudLayer;
}(layer_1.default));
exports.default = WordCloudLayer;

},{"../../base/layer":393,"./word-cloud-tooltips":647,"./wordcloud2":648,"@antv/util":803,"tslib":894}],647:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
var util_1 = require("@antv/util");
var dependents_1 = require("../../dependents");
var WordCloudTooltips = /** @class */ (function (_super) {
    tslib_1.__extends(WordCloudTooltips, _super);
    function WordCloudTooltips(cfg) {
        var _this = this;
        var newCfg = util_1.deepMix({}, cfg, {
            itemTpl: "<div data-index={index}>\n        <span style=\"background-color:{color};\" class=\"g2-tooltip-marker\"></span>\n        {name}<span class=\"g2-tooltip-value\">{value}</span></div>",
        }, cfg);
        _this = _super.call(this, newCfg) || this;
        return _this;
    }
    return WordCloudTooltips;
}(dependents_1.HtmlTooltip));
exports.default = WordCloudTooltips;

},{"../../dependents":425,"@antv/util":803,"tslib":894}],648:[function(require,module,exports){
/**
 * Create By Bruce Too
 * On 2020-02-14
 */
/* eslint-disable unicorn/no-abusive-eslint-disable */
/* eslint-disable */
// @ts-nocheck
// TODO rewrite with typescript @brucetoo
/*!
 * wordcloud2.js
 * http://timdream.org/wordcloud2.js/
 *
 * Copyright 2011 - 2013 Tim Chien
 * Released under the MIT license
 */
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
// setImmediate
if (!window.setImmediate) {
    window.setImmediate = (function setupSetImmediate() {
        return (window.msSetImmediate ||
            window.webkitSetImmediate ||
            window.mozSetImmediate ||
            window.oSetImmediate ||
            (function setupSetZeroTimeout() {
                if (!window.postMessage || !window.addEventListener) {
                    return null;
                }
                var callbacks = [undefined];
                var message = 'zero-timeout-message';
                // Like setTimeout, but only takes a function argument.  There's
                // no time argument (always zero) and no arguments (you have to
                // use a closure).
                var setZeroTimeout = function setZeroTimeout(callback) {
                    var id = callbacks.length;
                    callbacks.push(callback);
                    window.postMessage(message + id.toString(36), '*');
                    return id;
                };
                window.addEventListener('message', function setZeroTimeoutMessage(evt) {
                    // Skipping checking event source, retarded IE confused this window
                    // object with another in the presence of iframe
                    if (typeof evt.data !== 'string' ||
                        evt.data.substr(0, message.length) !== message /* ||
                  evt.source !== window */) {
                        return;
                    }
                    evt.stopImmediatePropagation();
                    var id = parseInt(evt.data.substr(message.length), 36);
                    if (!callbacks[id]) {
                        return;
                    }
                    callbacks[id]();
                    callbacks[id] = undefined;
                }, true);
                /* specify clearImmediate() here since we need the scope */
                window.clearImmediate = function clearZeroTimeout(id) {
                    if (!callbacks[id]) {
                        return;
                    }
                    callbacks[id] = undefined;
                };
                return setZeroTimeout;
            })() ||
            // fallback
            function setImmediateFallback(fn) {
                window.setTimeout(fn, 0);
            });
    })();
}
if (!window.clearImmediate) {
    window.clearImmediate = (function setupClearImmediate() {
        return (window.msClearImmediate ||
            window.webkitClearImmediate ||
            window.mozClearImmediate ||
            window.oClearImmediate ||
            // "clearZeroTimeout" is implement on the previous block ||
            // fallback
            function clearImmediateFallback(timer) {
                window.clearTimeout(timer);
            });
    })();
}
// Check if WordCloud can run on this browser
var isSupported = (function isSupported() {
    var canvas = document.createElement('canvas');
    if (!canvas || !canvas.getContext) {
        return false;
    }
    var ctx = canvas.getContext('2d');
    if (!ctx.getImageData) {
        return false;
    }
    if (!ctx.fillText) {
        return false;
    }
    if (!Array.prototype.some) {
        return false;
    }
    if (!Array.prototype.push) {
        return false;
    }
    return true;
})();
// Find out if the browser impose minium font size by
// drawing small texts on a canvas and measure it's width.
var minFontSize = (function getMinFontSize() {
    if (!isSupported) {
        return;
    }
    var ctx = document.createElement('canvas').getContext('2d');
    // start from 20
    var size = 20;
    // two sizes to measure
    var hanWidth, mWidth;
    while (size) {
        ctx.font = size.toString(10) + 'px sans-serif';
        if (ctx.measureText('\uFF37').width === hanWidth && ctx.measureText('m').width === mWidth) {
            return size + 1;
        }
        hanWidth = ctx.measureText('\uFF37').width;
        mWidth = ctx.measureText('m').width;
        size--;
    }
    return 0;
})();
// Based on http://jsfromhell.com/array/shuffle
var shuffleArray = function shuffleArray(arr) {
    for (var j, x, i = arr.length; i; j = Math.floor(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x) { }
    return arr;
};
var WordCloud = function WordCloud(elements, options) {
    if (!isSupported) {
        return;
    }
    if (!Array.isArray(elements)) {
        elements = [elements];
    }
    elements.forEach(function (el, i) {
        if (typeof el === 'string') {
            elements[i] = document.getElementById(el);
            if (!elements[i]) {
                throw 'The element id specified is not found.';
            }
        }
        else if (!el.tagName && !el.appendChild) {
            throw 'You must pass valid HTML elements, or ID of the element.';
        }
    });
    /* Default values to be overwritten by options object */
    var settings = {
        data: [],
        fontFamily: '"Trebuchet MS", "Heiti TC", "微軟正黑體", ' + '"Arial Unicode MS", "Droid Fallback Sans", sans-serif',
        fontWeight: 'normal',
        color: 'random-dark',
        minFontSize: minFontSize,
        maxFontSize: 60,
        clearCanvas: true,
        backgroundColor: '#fff',
        gridSize: 8,
        drawOutOfBound: false,
        origin: null,
        drawMask: false,
        maskColor: 'rgba(255,0,0,0.3)',
        maskGapWidth: 0.3,
        wait: 0,
        abortThreshold: 0,
        abort: function noop() { },
        minRotation: -Math.PI / 2,
        maxRotation: Math.PI / 2,
        rotateRatio: 0.5,
        rotationSteps: 1,
        shuffle: true,
        shape: 'circle',
        ellipticity: 1,
        active: true,
        animatable: true,
        selected: -1,
        shadowColor: '#333',
        shadowBlur: 10,
        fontScale: 1.2,
        classes: null,
        onWordCloudHover: null,
        onWordCloudClick: null,
    };
    var interactionItems = [];
    if (options) {
        for (var key in options) {
            if (key === 'wordStyle') {
                for (var fontKey in options[key]) {
                    if (fontKey in settings) {
                        settings[fontKey] = options[key][fontKey];
                    }
                }
            }
            else {
                if (key in settings) {
                    settings[key] = options[key];
                }
            }
        }
    }
    if (settings.minFontSize < minFontSize) {
        // can't less than browse's min font size
        settings.minFontSize = minFontSize;
    }
    if (settings.minFontSize > settings.maxFontSize) {
        console.error('minSize cant bigger than maxSize');
        return;
    }
    var maxWeight = 0;
    for (var i = 0; i < settings.data.length; i++) {
        if (maxWeight < settings.data[i].weight) {
            maxWeight = settings.data[i].weight;
        }
    }
    var getRealFontSize = function getRealFontSize(weight) {
        var fontSize = Math.min(Math.max(settings.minFontSize, (settings.maxFontSize * weight) / maxWeight), settings.maxFontSize);
        if (twiceRender) {
            return fontSize * settings.fontScale;
        }
        return fontSize;
    };
    var isCardioid = false;
    /* Convert shape into a function */
    if (typeof settings.shape !== 'function') {
        switch (settings.shape) {
            case 'circle':
            /* falls through */
            default:
                // 'circle' is the default and a shortcut in the code loop.
                settings.shape = 'circle';
                break;
            case 'cardioid':
                // https://baike.baidu.com/item/%E5%BF%83%E8%84%8F%E7%BA%BF/10323843?fromtitle=%E5%BF%83%E5%BD%A2%E7%BA%BF&fromid=10018818
                settings.shape = function shapeCardioid(theta) {
                    return 1 - Math.sin(theta);
                };
                isCardioid = true;
                break;
            /*
            To work out an X-gon, one has to calculate "m",
            where 1/(cos(2*PI/X)+m*sin(2*PI/X)) = 1/(cos(0)+m*sin(0))
            http://www.wolframalpha.com/input/?i=1%2F%28cos%282*PI%2FX%29%2Bm*sin%28
            2*PI%2FX%29%29+%3D+1%2F%28cos%280%29%2Bm*sin%280%29%29
            Copy the solution into polar equation r = 1/(cos(t') + m*sin(t'))
            where t' equals to mod(t, 2PI/X);
            */
            case 'diamond':
                settings.shape = function shapeSquare(theta) {
                    var thetaPrime = theta % ((2 * Math.PI) / 4);
                    return 1 / (Math.cos(thetaPrime) + Math.sin(thetaPrime));
                };
                break;
            case 'square':
                // http://www.wolframalpha.com/input/?i=plot+r+%3D+1%2F%28cos%28mod+
                // %28t%2C+PI%2F2%29%29%2Bsin%28mod+%28t%2C+PI%2F2%29%29%29%2C+t+%3D
                // +0+..+2*PI
                settings.shape = function shapeSquare(theta) {
                    var thetaPrime = (theta + Math.PI / 4) % ((2 * Math.PI) / 4);
                    return 1 / (Math.cos(thetaPrime) + Math.sin(thetaPrime));
                };
                break;
            case 'triangle-forward':
                // http://www.wolframalpha.com/input/?i=plot+r+%3D+1%2F%28cos%28mod+
                // %28t%2C+2*PI%2F3%29%29%2Bsqrt%283%29sin%28mod+%28t%2C+2*PI%2F3%29
                // %29%29%2C+t+%3D+0+..+2*PI
                settings.shape = function shapeTriangle(theta) {
                    var thetaPrime = theta % ((2 * Math.PI) / 3);
                    return 1 / (Math.cos(thetaPrime) + Math.sqrt(3) * Math.sin(thetaPrime));
                };
                break;
            case 'triangle-backward':
                settings.shape = function shapeTriangle(theta) {
                    var thetaPrime = (theta + Math.PI) % ((2 * Math.PI) / 3);
                    return 1 / (Math.cos(thetaPrime) + Math.sqrt(3) * Math.sin(thetaPrime));
                };
                break;
            case 'triangle':
            case 'triangle-up':
                settings.shape = function shapeTriangle(theta) {
                    var thetaPrime = (theta + (Math.PI * 3) / 2) % ((2 * Math.PI) / 3);
                    return 1 / (Math.cos(thetaPrime) + Math.sqrt(3) * Math.sin(thetaPrime));
                };
                break;
            case 'triangle-down':
                settings.shape = function shapeTriangle(theta) {
                    var thetaPrime = (theta + (Math.PI * 5) / 2) % ((2 * Math.PI) / 3);
                    return 1 / (Math.cos(thetaPrime) + Math.sqrt(3) * Math.sin(thetaPrime));
                };
                break;
            case 'pentagon':
                settings.shape = function shapePentagon(theta) {
                    var thetaPrime = (theta + 0.955) % ((2 * Math.PI) / 5);
                    return 1 / (Math.cos(thetaPrime) + 0.726543 * Math.sin(thetaPrime));
                };
                break;
            case 'star':
                settings.shape = function shapeStar(theta) {
                    var thetaPrime = (theta + 0.955) % ((2 * Math.PI) / 10);
                    if (((theta + 0.955) % ((2 * Math.PI) / 5)) - (2 * Math.PI) / 10 >= 0) {
                        return (1 / (Math.cos((2 * Math.PI) / 10 - thetaPrime) + 3.07768 * Math.sin((2 * Math.PI) / 10 - thetaPrime)));
                    }
                    else {
                        return 1 / (Math.cos(thetaPrime) + 3.07768 * Math.sin(thetaPrime));
                    }
                };
                break;
        }
    }
    /* Make sure gridSize is a whole number and is not smaller than 4px */
    settings.gridSize = Math.max(Math.floor(settings.gridSize), 4);
    /* shorthand */
    var g = settings.gridSize;
    var maskRectWidth = g - settings.maskGapWidth;
    /* normalize rotation settings */
    var rotationRange = Math.abs(settings.maxRotation - settings.minRotation);
    var minRotation = Math.min(settings.maxRotation, settings.minRotation);
    var rotationSteps = settings.rotationSteps;
    /* information/object available to all functions, set when start() */
    var grid, // 2d array containing filling information
    ngx, ngy, // width and height of the grid
    center, // position of the center of the cloud
    maxRadius;
    /* timestamp for measuring each putWord() action */
    var escapeTime;
    /* function for getting the color of the text */
    var getTextColor;
    function random_hsl_color(min, max) {
        return ('hsl(' +
            (Math.random() * 360).toFixed() +
            ',' +
            (Math.random() * 30 + 70).toFixed() +
            '%,' +
            (Math.random() * (max - min) + min).toFixed() +
            '%)');
    }
    switch (settings.color) {
        case 'random-dark':
            getTextColor = function getRandomDarkColor() {
                return random_hsl_color(10, 50);
            };
            break;
        case 'random-light':
            getTextColor = function getRandomLightColor() {
                return random_hsl_color(50, 90);
            };
            break;
        default:
            if (typeof settings.color === 'function') {
                getTextColor = settings.color;
            }
            break;
    }
    /* function for getting the classes of the text */
    var getTextClasses = null;
    if (typeof settings.classes === 'function') {
        getTextClasses = settings.classes;
    }
    /* Interactive */
    var interactive = false;
    var infoGrid = [];
    var hovered;
    var getInfoGridFromMouseTouchEvent = function getInfoGridFromMouseTouchEvent(evt) {
        var canvas = evt.currentTarget;
        var rect = canvas.getBoundingClientRect();
        var clientX;
        var clientY;
        /** Detect if touches are available */
        if (evt.touches) {
            clientX = evt.touches[0].clientX;
            clientY = evt.touches[0].clientY;
        }
        else {
            clientX = evt.clientX;
            clientY = evt.clientY;
        }
        var eventX = clientX - rect.left;
        var eventY = clientY - rect.top;
        var x = Math.floor((eventX * (canvas.width / rect.width || 1)) / g);
        var y = Math.floor((eventY * (canvas.height / rect.height || 1)) / g);
        return infoGrid && infoGrid[x] && infoGrid[x][y];
    };
    var defaultHoverAction = function defaultHoverAction(item, dimension, evt, start) {
        if (item) {
            start(item.id);
        }
        else {
            start(-1);
        }
    };
    var wordcloudhover = function wordcloudhover(evt) {
        var info = getInfoGridFromMouseTouchEvent(evt);
        if (hovered === info) {
            return;
        }
        if (twiceRender && info && info.item && !util_1.get(info, ['item', 'twiceRender'])) {
            return;
        }
        if (!info) {
            settings.onWordCloudHover(undefined, undefined, evt, start);
            if (settings.active) {
                defaultHoverAction(undefined, undefined, evt, start);
            }
            return;
        }
        settings.onWordCloudHover(info.item, info.dimension, evt, start);
        if (settings.active) {
            defaultHoverAction(info.item, info.dimension, evt, start);
        }
        hovered = info;
    };
    var wordcloudclick = function wordcloudclick(evt) {
        var info = getInfoGridFromMouseTouchEvent(evt);
        if (!info) {
            return;
        }
        settings.onWordCloudClick(info.item, info.dimension, evt);
        evt.preventDefault();
    };
    /* Get points on the grid for a given radius away from the center */
    var pointsAtRadius = [];
    var getPointsAtRadius = function getPointsAtRadius(radius) {
        if (pointsAtRadius[radius]) {
            return pointsAtRadius[radius];
        }
        // Look for these number of points on each radius
        var T = radius * 8;
        // Getting all the points at this radius
        var t = T;
        var points = [];
        if (radius === 0) {
            points.push([center[0], center[1], 0]);
        }
        while (t--) {
            // distort the radius to put the cloud in shape
            var rx = 1;
            if (settings.shape !== 'circle') {
                rx = settings.shape((t / T) * 2 * Math.PI); // 0 to 1
            }
            // Push [x, y, t]; t is used solely for getTextColor()
            points.push([
                center[0] + radius * rx * Math.cos((-t / T) * 2 * Math.PI),
                center[1] + radius * rx * Math.sin((-t / T) * 2 * Math.PI) * settings.ellipticity,
                (t / T) * 2 * Math.PI,
            ]);
        }
        pointsAtRadius[radius] = points;
        return points;
    };
    /* Return true if we had spent too much time */
    var exceedTime = function exceedTime() {
        return settings.abortThreshold > 0 && new Date().getTime() - escapeTime > settings.abortThreshold;
    };
    /* Get the deg of rotation according to settings, and luck. */
    var getRotateDeg = function getRotateDeg() {
        if (settings.rotateRatio === 0) {
            return 0;
        }
        if (Math.random() > settings.rotateRatio) {
            return 0;
        }
        if (rotationRange === 0) {
            return minRotation;
        }
        // return minRotation + Math.round(Math.random() * rotationRange / rotationSteps) * rotationSteps;
        if (rotationSteps > 0) {
            // Min rotation + zero or more steps * span of one step
            return minRotation + (Math.floor(Math.random() * rotationSteps) * rotationRange) / rotationSteps;
        }
        else {
            return minRotation + Math.random() * rotationRange;
        }
    };
    var getTextInfo = function getTextInfo(word, weight, rotateDeg) {
        // calculate the acutal font size
        // fontSize === 0 means wants the text skipped,
        // and size < minSize means we cannot draw the text
        var debug = false;
        var fontSize = getRealFontSize(weight);
        if (fontSize <= 0) {
            return false;
        }
        // Scale factor here is to make sure fillText is not limited by
        // the minium font size set by browser.
        // It will always be 1 or 2n.
        var mu = 1;
        if (fontSize < minFontSize) {
            mu = (function calculateScaleFactor() {
                var mu = 2;
                while (mu * fontSize < minFontSize) {
                    mu += 2;
                }
                return mu;
            })();
        }
        var fcanvas = document.createElement('canvas');
        var fctx = fcanvas.getContext('2d', { willReadFrequently: true });
        fctx.font = settings.fontWeight + ' ' + (fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
        // Estimate the dimension of the text with measureText().
        var fw = fctx.measureText(word).width / mu;
        var fh = Math.max(fontSize * mu, fctx.measureText('m').width, fctx.measureText('\uFF37').width) / mu;
        // Create a boundary box that is larger than our estimates,
        // so text don't get cut of (it sill might)
        var boxWidth = fw + fh * 2;
        var boxHeight = fh * 3;
        var fgw = Math.ceil(boxWidth / g);
        var fgh = Math.ceil(boxHeight / g);
        boxWidth = fgw * g;
        boxHeight = fgh * g;
        // Calculate the proper offsets to make the text centered at
        // the preferred position.
        // This is simply half of the width.
        var fillTextOffsetX = -fw / 2;
        // Instead of moving the box to the exact middle of the preferred
        // position, for Y-offset we move 0.4 instead, so Latin alphabets look
        // vertical centered.
        var fillTextOffsetY = -fh * 0.4;
        // Calculate the actual dimension of the canvas, considering the rotation.
        var cgh = Math.ceil((boxWidth * Math.abs(Math.sin(rotateDeg)) + boxHeight * Math.abs(Math.cos(rotateDeg))) / g);
        var cgw = Math.ceil((boxWidth * Math.abs(Math.cos(rotateDeg)) + boxHeight * Math.abs(Math.sin(rotateDeg))) / g);
        var width = cgw * g;
        var height = cgh * g;
        fcanvas.setAttribute('width', width);
        fcanvas.setAttribute('height', height);
        if (debug) {
            // Attach fcanvas to the DOM
            document.body.appendChild(fcanvas);
            // Save it's state so that we could restore and draw the grid correctly.
            fctx.save();
        }
        // Scale the canvas with |mu|.
        fctx.scale(1 / mu, 1 / mu);
        fctx.translate((width * mu) / 2, (height * mu) / 2);
        fctx.rotate(-rotateDeg);
        // Once the width/height is set, ctx info will be reset.
        // Set it again here.
        fctx.font = settings.fontWeight + ' ' + (fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
        // Fill the text into the fcanvas.
        // XXX: We cannot because textBaseline = 'top' here because
        // Firefox and Chrome uses different default line-height for canvas.
        // Please read https://bugzil.la/737852#c6.
        // Here, we use textBaseline = 'middle' and draw the text at exactly
        // 0.5 * fontSize lower.
        fctx.fillStyle = '#000';
        fctx.textBaseline = 'middle';
        fctx.fillText(word, fillTextOffsetX * mu, (fillTextOffsetY + fontSize * 0.5) * mu);
        // Get the pixels of the text
        var imageData;
        try {
            imageData = fctx.getImageData(0, 0, width, height).data;
        }
        catch (e) {
            // data not long type
            return false;
        }
        if (exceedTime()) {
            return false;
        }
        if (debug) {
            // Draw the box of the original estimation
            fctx.strokeRect(fillTextOffsetX * mu, fillTextOffsetY, fw * mu, fh * mu);
            fctx.restore();
        }
        // Read the pixels and save the information to the occupied array
        var occupied = [];
        var gx = cgw, gy, x, y;
        var bounds = [cgh / 2, cgw / 2, cgh / 2, cgw / 2];
        while (gx--) {
            gy = cgh;
            while (gy--) {
                y = g;
                singleGridLoop: {
                    while (y--) {
                        x = g;
                        while (x--) {
                            if (imageData[((gy * g + y) * width + (gx * g + x)) * 4 + 3]) {
                                occupied.push([gx, gy]);
                                if (gx < bounds[3]) {
                                    bounds[3] = gx;
                                }
                                if (gx > bounds[1]) {
                                    bounds[1] = gx;
                                }
                                if (gy < bounds[0]) {
                                    bounds[0] = gy;
                                }
                                if (gy > bounds[2]) {
                                    bounds[2] = gy;
                                }
                                if (debug) {
                                    fctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
                                    fctx.fillRect(gx * g, gy * g, g - 0.5, g - 0.5);
                                }
                                break singleGridLoop;
                            }
                        }
                    }
                    if (debug) {
                        fctx.fillStyle = 'rgba(0, 0, 255, 0.5)';
                        fctx.fillRect(gx * g, gy * g, g - 0.5, g - 0.5);
                    }
                }
            }
        }
        if (debug) {
            // real bounds
            fctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
            fctx.fillRect(bounds[3] * g, bounds[0] * g, (bounds[1] - bounds[3] + 1) * g, (bounds[2] - bounds[0] + 1) * g);
        }
        // Return information needed to create the text on the real canvas
        return {
            mu: mu,
            occupied: occupied,
            bounds: bounds,
            gw: cgw,
            gh: cgh,
            fillTextOffsetX: fillTextOffsetX,
            fillTextOffsetY: fillTextOffsetY,
            fillTextWidth: fw,
            fillTextHeight: fh,
            fontSize: fontSize,
        };
    };
    /* Determine if there is room available in the given dimension */
    var canFitText = function canFitText(gx, gy, gw, gh, occupied) {
        // Go through the occupied points,
        // return false if the space is not available.
        var i = occupied.length;
        while (i--) {
            var px = gx + occupied[i][0];
            var py = gy + occupied[i][1];
            if (px >= ngx || py >= ngy || px < 0 || py < 0) {
                if (!settings.drawOutOfBound) {
                    return false;
                }
                continue;
            }
            if (!grid[px][py]) {
                return false;
            }
        }
        return true;
    };
    /* Actually draw the text on the grid */
    var drawText = function drawText(gx, gy, info, word, weight, distance, theta, rotateDeg, attributes, id, refresh) {
        var fontSize = info.fontSize;
        var color = settings.color;
        var classes = settings.classes;
        if (!refresh) {
            if (getTextColor) {
                color = getTextColor(word, weight, fontSize, distance, theta);
            }
            else {
                color = settings.color;
            }
            if (getTextClasses) {
                classes = getTextClasses(word, weight, fontSize, distance, theta);
            }
            else {
                classes = settings.classes;
            }
        }
        else {
            var find = getInteractionItemById(id);
            color = find ? find.color : settings.color;
        }
        var dimension;
        var bounds = info.bounds;
        dimension = {
            x: (gx + bounds[3]) * g,
            y: (gy + bounds[0]) * g,
            w: (bounds[1] - bounds[3] + 1) * g,
            h: (bounds[2] - bounds[0] + 1) * g,
        };
        elements.forEach(function (el) {
            if (el.getContext) {
                var ctx = el.getContext('2d');
                var mu = info.mu;
                // Save the current state before messing it
                ctx.save();
                var font = settings.fontWeight + ' ' + (fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
                ctx.scale(1 / mu, 1 / mu);
                ctx.font = font;
                ctx.fillStyle = color;
                // Translate the canvas position to the origin coordinate of where
                // the text should be put.
                var transX = (gx + info.gw / 2) * g * mu;
                var transY = (gy + info.gh / 2) * g * mu;
                ctx.translate(transX, transY);
                if (rotateDeg !== 0) {
                    ctx.rotate(-rotateDeg);
                }
                // Finally, fill the text.
                // XXX: We cannot because textBaseline = 'top' here because
                // Firefox and Chrome uses different default line-height for canvas.
                // Please read https://bugzil.la/737852#c6.
                // Here, we use textBaseline = 'middle' and draw the text at exactly
                // 0.5 * fontSize lower.
                ctx.textBaseline = 'middle';
                if (settings.selected === id) {
                    ctx.shadowColor = settings.shadowColor;
                    ctx.shadowBlur = settings.shadowBlur;
                }
                ctx.fillText(word, info.fillTextOffsetX * mu, (info.fillTextOffsetY + fontSize * 0.5) * mu);
                // The below box is always matches how <span>s are positioned
                // ctx.strokeRect(info.fillTextOffsetX, info.fillTextOffsetY,
                //   info.fillTextWidth, info.fillTextHeight);
                if (!refresh) {
                    interactionItems.push({
                        gx: gx,
                        gy: gy,
                        info: info,
                        word: word,
                        weight: weight,
                        distance: distance,
                        theta: theta,
                        rotateDeg: rotateDeg,
                        attributes: attributes,
                        id: id,
                        color: color,
                    });
                }
                // Restore the state.
                ctx.restore();
            }
            else {
                // drawText on DIV element
                var span = document.createElement('span');
                var transformRule = '';
                transformRule = 'rotate(' + (-rotateDeg / Math.PI) * 180 + 'deg) ';
                if (info.mu !== 1) {
                    transformRule += 'translateX(-' + info.fillTextWidth / 4 + 'px) ' + 'scale(' + 1 / info.mu + ')';
                }
                var styleRules = {
                    position: 'absolute',
                    display: 'block',
                    font: settings.fontWeight + ' ' + fontSize * info.mu + 'px ' + settings.fontFamily,
                    left: (gx + info.gw / 2) * g + info.fillTextOffsetX + 'px',
                    top: (gy + info.gh / 2) * g + info.fillTextOffsetY + 'px',
                    width: info.fillTextWidth + 'px',
                    height: info.fillTextHeight + 'px',
                    lineHeight: fontSize + 'px',
                    whiteSpace: 'nowrap',
                    transform: transformRule,
                    webkitTransform: transformRule,
                    msTransform: transformRule,
                    transformOrigin: '50% 40%',
                    webkitTransformOrigin: '50% 40%',
                    msTransformOrigin: '50% 40%',
                };
                if (color) {
                    styleRules.color = color;
                }
                span.textContent = word;
                for (var cssProp in styleRules) {
                    span.style[cssProp] = styleRules[cssProp];
                }
                if (attributes) {
                    for (var attribute in attributes) {
                        span.setAttribute(attribute, attributes[attribute]);
                    }
                }
                if (classes) {
                    span.className += classes;
                }
                el.appendChild(span);
            }
        });
    };
    /* Help function to updateGrid */
    var fillGridAt = function fillGridAt(x, y, drawMask, dimension, item) {
        if (x >= ngx || y >= ngy || x < 0 || y < 0) {
            return;
        }
        grid[x][y] = false;
        if (drawMask) {
            var ctx = elements[0].getContext('2d');
            ctx.fillRect(x * g, y * g, maskRectWidth, maskRectWidth);
        }
        if (interactive) {
            infoGrid[x][y] = { item: item, dimension: dimension };
        }
    };
    /* Update the filling information of the given space with occupied points.
       Draw the mask on the canvas if necessary. */
    var updateGrid = function updateGrid(gx, gy, gw, gh, info) {
        var occupied = info.occupied;
        var drawMask = settings.drawMask;
        var ctx;
        if (drawMask) {
            ctx = elements[0].getContext('2d');
            ctx.save();
            ctx.fillStyle = settings.maskColor;
        }
        var dimension;
        if (interactive) {
            var bounds = info.bounds;
            dimension = {
                x: (gx + bounds[3]) * g,
                y: (gy + bounds[0]) * g,
                w: (bounds[1] - bounds[3] + 1) * g,
                h: (bounds[2] - bounds[0] + 1) * g,
            };
        }
        var i = occupied.length;
        while (i--) {
            var px = gx + occupied[i][0];
            var py = gy + occupied[i][1];
            if (px >= ngx || py >= ngy || px < 0 || py < 0) {
                continue;
            }
            // save item's color from info
            var find = getInteractionItemById(info.item.id);
            if (find) {
                info.item.color = find.color;
            }
            fillGridAt(px, py, drawMask, dimension, info.item);
        }
        if (drawMask) {
            ctx.restore();
        }
    };
    var tryToPutWordAtPoint = function tryToPutWordAtPoint(gxy, info, word, weight, distance, rotateDeg, attributes, id) {
        var gx = Math.floor(gxy[0] - info.gw / 2);
        var gy = Math.floor(gxy[1] - info.gh / 2);
        var gw = info.gw;
        var gh = info.gh;
        // If we cannot fit the text at this position, return false
        // and go to the next position.
        if (!canFitText(gx, gy, gw, gh, info.occupied)) {
            return false;
        }
        // Actually put the text on the canvas
        drawText(gx, gy, info, word, weight, distance, gxy[2], rotateDeg, attributes, id, false);
        // Mark the spaces on the grid as filled
        updateGrid(gx, gy, gw, gh, info);
        return {
            gx: gx,
            gy: gy,
            rot: rotateDeg,
            info: info,
        };
    };
    /* putWord() processes each item on the list,
       calculate it's size and determine it's position, and actually
       put it on the canvas. */
    var putWord = function putWord(item) {
        var word, weight, attributes, id;
        if (Array.isArray(item)) {
            word = item[0];
            weight = item[1];
        }
        else {
            word = item.word;
            weight = item.weight;
            attributes = item.attributes;
            id = item.id;
        }
        var rotateDeg = util_1.isNil(item.rotateDeg) ? getRotateDeg() : item.rotateDeg;
        // get info needed to put the text onto the canvas
        var info = getTextInfo(word, weight, rotateDeg);
        if (info) {
            info['item'] = item;
        }
        // not getting the info means we shouldn't be drawing this one.
        if (!info) {
            return false;
        }
        if (exceedTime()) {
            return false;
        }
        // If drawOutOfBound is set to false,
        // skip the loop if we have already know the bounding box of
        // word is larger than the canvas.
        if (!settings.drawOutOfBound) {
            var bounds = info.bounds;
            if (bounds[1] - bounds[3] + 1 > ngx || bounds[2] - bounds[0] + 1 > ngy) {
                return false;
            }
        }
        // Determine the position to put the text by
        // start looking for the nearest points
        var r = maxRadius + 1;
        while (r--) {
            var points = getPointsAtRadius(maxRadius - r);
            if (settings.shuffle) {
                points = [].concat(points);
                shuffleArray(points);
            }
            // Try to fit the words by looking at each point.
            // array.some() will stop and return true
            // when putWordAtPoint() returns true.
            for (var i = 0; i < points.length; i++) {
                var res = tryToPutWordAtPoint(points[i], info, word, weight, maxRadius - r, rotateDeg, attributes, id);
                if (res) {
                    return res;
                }
            }
            // var drawn = points.some(tryToPutWordAtPoint);
            // if (drawn) {
            //   // leave putWord() and return true
            //   return true;
            // }
        }
        // we tried all distances but text won't fit, return null
        return null;
    };
    /* Send DOM event to all elements. Will stop sending event and return
       if the previous one is canceled (for cancelable events). */
    var sendEvent = function sendEvent(type, cancelable, detail) {
        if (cancelable) {
            return !elements.some(function (el) {
                var evt = document.createEvent('CustomEvent');
                evt.initCustomEvent(type, true, cancelable, detail || {});
                return !el.dispatchEvent(evt);
            }, this);
        }
        else {
            elements.forEach(function (el) {
                var evt = document.createEvent('CustomEvent');
                evt.initCustomEvent(type, true, cancelable, detail || {});
                el.dispatchEvent(evt);
            }, this);
        }
    };
    var getInteractionItemById = function getInteractionItemById(id) {
        for (var i = 0; i < interactionItems.length; i++) {
            var find = interactionItems[i];
            if (interactionItems[i].id === id) {
                return find;
            }
        }
        return undefined;
    };
    var twiceRender;
    /* Start drawing on a canvas */
    var start = function start(selected) {
        if (selected !== undefined) {
            // re-refresh canvas with selected
            // work in canvas only for now
            if (settings.selected !== selected && elements[0].getContext) {
                settings.selected = selected;
                var ctx = elements[0].getContext('2d');
                // draw background
                ctx.fillStyle = settings.backgroundColor;
                ctx.clearRect(0, 0, elements[0].width, elements[0].height);
                ctx.fillRect(0, 0, elements[0].width, elements[0].height);
                // draw text
                for (var i_1 = 0; i_1 < interactionItems.length; i_1++) {
                    var find = interactionItems[i_1];
                    if (!twiceRender || (twiceRender && util_1.get(find, ['info', 'item', 'twiceRender']))) {
                        /**
                         * 词云图词量较少的时候，重新渲染一次词汇，放大词云图效果
                         * 这里先临时解决，后续还是需要优化词云图算法来解决
                         */
                        drawText(find.gx, find.gy, find.info, find.word, find.weight, find.distance, find.theta, find.rotateDeg, find.attributes, find.id, true);
                    }
                }
            }
            return;
        }
        // For dimensions, clearCanvas etc.,
        // we only care about the first element.
        var canvas = elements[0];
        if (canvas.getContext) {
            ngx = Math.ceil(canvas.width / g);
            ngy = Math.ceil(canvas.height / g);
        }
        else {
            var rect = canvas.getBoundingClientRect();
            ngx = Math.ceil(rect.width / g);
            ngy = Math.ceil(rect.height / g);
        }
        // Sending a wordcloudstart event which cause the previous loop to stop.
        // Do nothing if the event is canceled.
        if (!sendEvent('wordcloudstart', true)) {
            return;
        }
        // Determine the center of the word cloud
        center = settings.origin ? [settings.origin[0] / g, settings.origin[1] / g] : [ngx / 2, ngy / (isCardioid ? 4 : 2)];
        // Maxium radius to look for space
        maxRadius = Math.floor(Math.sqrt(ngx * ngx + ngy * ngy));
        /* Clear the canvas only if the clearCanvas is set,
           if not, update the grid to the current canvas state */
        grid = [];
        var gx, gy, i;
        if (!canvas.getContext || settings.clearCanvas) {
            elements.forEach(function (el) {
                if (el.getContext) {
                    var ctx = el.getContext('2d');
                    ctx.fillStyle = settings.backgroundColor;
                    ctx.clearRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                    ctx.fillRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                }
                else {
                    el.textContent = '';
                    el.style.backgroundColor = settings.backgroundColor;
                    el.style.position = 'relative';
                }
            });
            /* fill the grid with empty state */
            gx = ngx;
            while (gx--) {
                grid[gx] = [];
                gy = ngy;
                while (gy--) {
                    grid[gx][gy] = true;
                }
            }
        }
        else {
            /* Determine bgPixel by creating
               another canvas and fill the specified background color. */
            var bctx = document.createElement('canvas').getContext('2d');
            bctx.fillStyle = settings.backgroundColor;
            bctx.fillRect(0, 0, 1, 1);
            var bgPixel = bctx.getImageData(0, 0, 1, 1).data;
            /* Read back the pixels of the canvas we got to tell which part of the
               canvas is empty.
               (no clearCanvas only works with a canvas, not divs) */
            var imageData = canvas.getContext('2d').getImageData(0, 0, ngx * g, ngy * g).data;
            gx = ngx;
            var x, y;
            while (gx--) {
                grid[gx] = [];
                gy = ngy;
                while (gy--) {
                    y = g;
                    singleGridLoop: while (y--) {
                        x = g;
                        while (x--) {
                            i = 4;
                            while (i--) {
                                if (imageData[((gy * g + y) * ngx * g + (gx * g + x)) * 4 + i] !== bgPixel[i]) {
                                    grid[gx][gy] = false;
                                    break singleGridLoop;
                                }
                            }
                        }
                    }
                    if (grid[gx][gy] !== false) {
                        grid[gx][gy] = true;
                    }
                }
            }
            imageData = bctx = bgPixel = undefined;
        }
        // fill the infoGrid with empty state if we need it
        if (settings.onWordCloudHover || settings.onWordCloudClick) {
            interactive = true;
            /* fill the grid with empty state */
            gx = ngx + 1;
            while (gx--) {
                infoGrid[gx] = [];
            }
            if (settings.onWordCloudHover) {
                canvas.addEventListener('mousemove', wordcloudhover);
            }
            if (settings.onWordCloudClick) {
                canvas.addEventListener('click', wordcloudclick);
                canvas.addEventListener('touchstart', wordcloudclick);
                canvas.addEventListener('touchend', function (e) {
                    e.preventDefault();
                });
                canvas.style.webkitTapHighlightColor = 'rgba(0, 0, 0, 0)';
            }
            canvas.addEventListener('wordcloudstart', function stopInteraction() {
                canvas.removeEventListener('wordcloudstart', stopInteraction);
                canvas.removeEventListener('mousemove', wordcloudhover);
                canvas.removeEventListener('click', wordcloudclick);
                hovered = undefined;
            });
        }
        if (!settings.animatable) {
            if (options.maskImage) {
                /** 修复颜色透明，还留有 maskImage 的情况 */
                elements.forEach(function (el) {
                    if (el.getContext) {
                        var ctx = el.getContext('2d');
                        ctx.fillStyle = settings.backgroundColor;
                        ctx.clearRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                        ctx.fillRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                    }
                });
            }
            var renderedWords = [];
            for (var i_2 = 0; i_2 < settings.data.length; i_2++) {
                var response = putWord(settings.data[i_2]);
                if (response) {
                    renderedWords.push(response);
                }
            }
            if (renderedWords.length === settings.data.length) {
                if (!twiceRender) {
                    elements.forEach(function (el) {
                        if (el.getContext) {
                            var ctx = el.getContext('2d');
                            ctx.fillStyle = settings.backgroundColor;
                            ctx.clearRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                            ctx.fillRect(0, 0, ngx * (g + 1), ngy * (g + 1));
                        }
                    });
                    /* fill the grid with empty state */
                    gx = ngx;
                    while (gx--) {
                        grid[gx] = [];
                        gy = ngy;
                        while (gy--) {
                            grid[gx][gy] = true;
                        }
                    }
                    twiceRender = true;
                    for (var i_3 = 0; i_3 < settings.data.length; i_3++) {
                        putWord(tslib_1.__assign(tslib_1.__assign({}, settings.data[i_3]), { twiceRender: twiceRender }));
                    }
                }
            }
        }
        else {
            i = 0;
            var loopingFunction, stoppingFunction;
            if (settings.wait !== 0) {
                loopingFunction = window.setTimeout;
                stoppingFunction = window.clearTimeout;
            }
            else {
                loopingFunction = window.setImmediate;
                stoppingFunction = window.clearImmediate;
            }
            var addEventListener = function addEventListener(type, listener) {
                elements.forEach(function (el) {
                    el.addEventListener(type, listener);
                }, this);
            };
            var removeEventListener = function removeEventListener(type, listener) {
                elements.forEach(function (el) {
                    el.removeEventListener(type, listener);
                }, this);
            };
            var anotherWordCloudStart = function anotherWordCloudStart() {
                removeEventListener('wordcloudstart', anotherWordCloudStart);
                stoppingFunction(timer);
            };
            addEventListener('wordcloudstart', anotherWordCloudStart);
            var timer = loopingFunction(function loop() {
                if (i >= settings.data.length) {
                    stoppingFunction(timer);
                    sendEvent('wordcloudstop', false);
                    removeEventListener('wordcloudstart', anotherWordCloudStart);
                    return;
                }
                escapeTime = new Date().getTime();
                var drawn = putWord(settings.data[i]);
                var canceled = !sendEvent('wordclouddrawn', true, {
                    item: settings.data[i],
                    drawn: drawn,
                });
                if (exceedTime() || canceled) {
                    stoppingFunction(timer);
                    settings.abort();
                    sendEvent('wordcloudabort', false);
                    sendEvent('wordcloudstop', false);
                    removeEventListener('wordcloudstart', anotherWordCloudStart);
                    return;
                }
                i++;
                timer = loopingFunction(loop, settings.wait);
            }, settings.wait);
        }
    };
    // All set, start the drawing
    start();
};
WordCloud.isSupported = isSupported;
WordCloud.minFontSize = minFontSize;
exports.default = WordCloud;

},{"@antv/util":803,"tslib":894}],649:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var Marker = /** @class */ (function () {
    function Marker(cfg) {
        util_1.assign(this, cfg);
        this.init();
    }
    Marker.prototype.destroy = function () {
        if (this.shape) {
            this.shape.destroy();
        }
    };
    Marker.prototype.update = function (cfg, duration, easing) {
        var updateCfg = {};
        util_1.assign(this, cfg);
        this.coord = this.view.geometries[0].coordinate;
        if (cfg.value) {
            var x = this.coord.convert({ x: 0, y: this.value }).x;
            var matrix = [1, 0, 0, 0, 1, 0, x, 0, 1];
            updateCfg.matrix = matrix;
        }
        if (cfg.style) {
            var shape = this.shape;
            var origin_attr = shape.attrs;
            var attrs = util_1.deepMix({}, origin_attr, cfg.style);
            updateCfg = util_1.deepMix({}, attrs, updateCfg);
        }
        this.shape.stopAnimate();
        this.shape.animate(updateCfg, duration, easing);
    };
    Marker.prototype.init = function () {
        this.coord = this.view.geometries[0].coordinate;
        this.container = this.view.foregroundGroup.addGroup();
        var x = this.coord.convert({ x: 0, y: this.value }).x; // progress坐标系是转置坐标系
        var y0 = this.coord.center.y - this.progressSize / 2 - 2;
        var y1 = this.coord.center.y + this.progressSize / 2 + 2;
        var style = util_1.deepMix({}, { stroke: 'grey', lineWidth: 1 }, this.style);
        this.shape = this.container.addShape('path', {
            attrs: tslib_1.__assign({ path: [
                    ['M', 0, y0],
                    ['L', 0, y1],
                ] }, style),
            name: 'progress-marker',
        });
        this.shape.move(x, 0);
        this.canvas.draw();
    };
    return Marker;
}());
exports.default = Marker;

},{"@antv/util":803,"tslib":894}],650:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    progress: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],651:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var Progress = /** @class */ (function (_super) {
    tslib_1.__extends(Progress, _super);
    function Progress() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Progress.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'progress';
        _super.prototype.createLayers.call(this, layerProps);
    };
    Progress.prototype.update = function (value, style) {
        var layer = this.layers[0];
        layer.update(value, style);
    };
    Progress.getDefaultOptions = layer_1.default.getDefaultOptions;
    return Progress;
}(plot_1.default));
exports.default = Progress;

},{"../../base/plot":394,"./layer":652,"@antv/util":803,"tslib":894}],652:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var factory_1 = require("../../geoms/factory");
var tiny_layer_1 = tslib_1.__importDefault(require("../tiny-layer"));
var marker_1 = tslib_1.__importDefault(require("./component/marker"));
var EventParser = tslib_1.__importStar(require("./event"));
var G2_GEOM_MAP = {
    progress: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'progress',
};
var DEFAULT_COLOR = ['#55A6F3', '#E8EDF3'];
var ProgressLayer = /** @class */ (function (_super) {
    tslib_1.__extends(ProgressLayer, _super);
    function ProgressLayer() {
        /**
         * 将进度条配置项转为堆叠条形图配置项
         */
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'progress';
        _this.isEntered = false;
        return _this;
    }
    ProgressLayer.prototype.processProps = function () {
        var props = this.options;
        props.data = this.processData();
        var cfg = {
            padding: [0, 0, 0, 0],
            xField: 'value',
            yField: '1',
            stackField: 'type',
            barSize: props.size ? props.size : this.getSize(),
            barStyle: props.progressStyle,
            color: this.parseColorProps(props) || DEFAULT_COLOR,
        };
        props = util_1.mix(props, cfg);
    };
    ProgressLayer.prototype.init = function () {
        this.processProps();
        _super.prototype.init.call(this);
    };
    ProgressLayer.prototype.beforeInit = function () {
        var percent = this.options.percent;
        if (!util_1.isNumber(percent)) {
            throw new Error('Percent value is required, and the type of percent must be Number.');
        }
    };
    ProgressLayer.prototype.update = function (cfg) {
        var props = this.options;
        if (util_1.hasKey(cfg, 'percent')) {
            props.percent = cfg.percent;
            this.changeData(this.processData());
        }
        if (cfg.style) {
            this.styleUpdateAnimation(cfg.style);
            this.updateColorConfigByStyle(cfg.style);
        }
        if (cfg.color) {
            var style = void 0;
            if (util_1.isArray(cfg.color)) {
                this.options.color = cfg.color;
                style = [{ fill: cfg.color[0] }, { fill: cfg.color[1] }];
            }
            else {
                this.options.color[0] = cfg.color;
                style = { fill: cfg.color };
            }
            this.styleUpdateAnimation(style);
        }
        if (cfg.marker) {
            this.updateMarkers(cfg.marker);
            this.options.marker = cfg.marker;
        }
    };
    ProgressLayer.prototype.destroy = function () {
        if (this.markers && this.markers.length > 0) {
            util_1.each(this.markers, function (marker) {
                marker.destroy();
            });
            this.markers = [];
        }
        _super.prototype.destroy.call(this);
    };
    ProgressLayer.prototype.afterRender = function () {
        var _this = this;
        if (this.options.marker && !this.markers) {
            this.markers = [];
            util_1.each(this.options.marker, function (cfg) {
                var markerCfg = util_1.mix({
                    canvas: _this.canvas,
                    view: _this.view,
                    progressSize: _this.options.barSize,
                }, cfg);
                var marker = new marker_1.default(markerCfg);
                _this.markers.push(marker);
            });
        }
        var progressContainer = this.view.geometries[0].container;
        var bbox = progressContainer.getBBox();
        var rect = progressContainer.addShape('rect', {
            attrs: {
                width: bbox.width,
                height: bbox.height,
                x: bbox.minX,
                y: bbox.minY,
                fill: 'rgba(0,0,0,0)',
            },
        });
        this.canvas.draw();
        rect.on('mouseenter', function (ev) {
            _this.isEntered = true;
            _this.view.emit('progress:mouseenter', ev);
        });
        rect.on('mouseleave', function (ev) {
            _this.isEntered = false;
            _this.view.emit('progress:mouseleave', ev);
        });
        var canvasDom = this.canvas.get('container');
        canvasDom.addEventListener('mouseleave', function (ev) {
            if (_this.isEntered) {
                _this.view.emit('progress:mouseleave', ev);
                _this.isEntered = false;
            }
        });
    };
    ProgressLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    ProgressLayer.prototype.coord = function () {
        this.setConfig('coordinate', {
            actions: [['transpose']],
        });
    };
    ProgressLayer.prototype.addGeometry = function () {
        var props = this.options;
        var bar = factory_1.getGeom('interval', 'main', {
            positionFields: [props.yField, props.xField],
            plot: this,
        });
        bar.adjust = [
            {
                type: 'stack',
            },
        ];
        if (util_1.has(props, 'animation')) {
            bar.animate = props.animation;
        }
        this.setConfig('geometry', bar);
    };
    ProgressLayer.prototype.parseEvents = function (eventParser) {
        if (eventParser) {
            _super.prototype.parseEvents.call(this, eventParser);
        }
        else {
            _super.prototype.parseEvents.call(this, EventParser);
        }
    };
    ProgressLayer.prototype.parseColorProps = function (props) {
        var colorOption;
        if (props.color) {
            if (util_1.isFunction(props.color)) {
                colorOption = props.color(props.percent);
            }
            else {
                colorOption = props.color;
            }
            if (util_1.isString(colorOption)) {
                var color = util_1.clone(DEFAULT_COLOR);
                color[0] = colorOption;
                return color;
            }
            else {
                return colorOption;
            }
        }
        return props.color;
    };
    ProgressLayer.prototype.processData = function () {
        var props = this.options;
        var data = [
            { type: 'current', value: props.percent },
            { type: 'rest', value: 1.0 - props.percent },
        ];
        return data;
    };
    ProgressLayer.prototype.updateMarkers = function (markerCfg) {
        var markerLength = markerCfg.length;
        var animationOptions = this.getUpdateAnimationOptions();
        // marker diff
        util_1.each(this.markers, function (marker, index) {
            if (index > markerLength - 1) {
                marker.destroy();
            }
            else {
                marker.update(markerCfg[index], animationOptions.duration, animationOptions.easing);
            }
        });
        // add new markers
        if (this.markers.length < markerLength) {
            var startIndex = this.markers.length;
            for (var i = startIndex; i < markerLength; i++) {
                var cfg = util_1.deepMix({}, {
                    canvas: this.canvas,
                    view: this.view,
                    progressSize: this.options.barSize,
                }, markerCfg[i]);
                var marker = new marker_1.default(cfg);
                this.markers.push(marker);
            }
        }
    };
    ProgressLayer.prototype.getSize = function () {
        var height = this.height;
        if (height >= 50) {
            return 10;
        }
        return 4;
    };
    ProgressLayer.prototype.styleUpdateAnimation = function (style) {
        // style更新动画接受用户animation配置的透传
        var _a = this.getUpdateAnimationOptions(), duration = _a.duration, easing = _a.easing;
        // get geometry shapes
        var progressShapes = [];
        var view = this.view;
        var geometry = view.geometries;
        util_1.each(geometry, function (geom) {
            if (geom.type === 'interval') {
                var elements = geom.elements;
                util_1.each(elements, function (ele) {
                    progressShapes.push.apply(progressShapes, ele.shape);
                });
            }
        });
        if (util_1.isArray(style)) {
            util_1.each(style, function (s, index) {
                progressShapes[index].animate(s, duration, easing);
            });
        }
        else {
            progressShapes[0].animate(style, duration, easing);
        }
    };
    ProgressLayer.prototype.getUpdateAnimationOptions = function () {
        var duration = 450;
        var easing = 'easeQuadInOut';
        var animationOptions = this.options.animation;
        if (animationOptions && animationOptions.update) {
            if (animationOptions.update.duration) {
                duration = animationOptions.update.duration;
            }
            if (animationOptions.update.easing) {
                easing = animationOptions.update.easing;
            }
        }
        return { duration: duration, easing: easing };
    };
    ProgressLayer.prototype.updateColorConfigByStyle = function (style) {
        var _this = this;
        if (util_1.isArray(style)) {
            util_1.each(style, function (s, index) {
                if (s.fill) {
                    _this.options.color[index] = s.fill;
                }
            });
        }
        else if (style.fill) {
            this.options.color[0] = style.fill;
        }
    };
    return ProgressLayer;
}(tiny_layer_1.default));
exports.default = ProgressLayer;
global_1.registerPlotType('progress', ProgressLayer);

},{"../../base/global":392,"../../geoms/factory":430,"../tiny-layer":662,"./component/marker":649,"./event":650,"@antv/util":803,"tslib":894}],653:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var componentMap = {
    ringProgress: 'interval',
};
var SHAPE_EVENT_MAP = event_1.getEventMap(componentMap);
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],654:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var RingProgress = /** @class */ (function (_super) {
    tslib_1.__extends(RingProgress, _super);
    function RingProgress() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RingProgress.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'ringProgress';
        _super.prototype.createLayers.call(this, layerProps);
    };
    RingProgress.prototype.update = function (value) {
        var layer = this.layers[0];
        layer.update(value);
    };
    RingProgress.getDefaultOptions = layer_1.default.getDefaultOptions;
    return RingProgress;
}(plot_1.default));
exports.default = RingProgress;

},{"../../base/plot":394,"./layer":655,"@antv/util":803,"tslib":894}],655:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var factory_1 = require("../../geoms/factory");
var layer_1 = tslib_1.__importDefault(require("../progress/layer"));
var EventParser = tslib_1.__importStar(require("./event"));
var DEFAULT_COLOR = ['#55A6F3', '#E8EDF3'];
var RingProgressLayer = /** @class */ (function (_super) {
    tslib_1.__extends(RingProgressLayer, _super);
    function RingProgressLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'ringProgrsss';
        return _this;
    }
    RingProgressLayer.prototype.processProps = function () {
        var props = this.options;
        props.data = this.processData();
        var cfg = {
            padding: [0, 0, 0, 0],
            xField: 'value',
            yField: '1',
            stackField: 'type',
            barStyle: props.progressStyle,
            color: this.parseColorProps(props) || DEFAULT_COLOR,
        };
        props = util_1.mix(props, cfg);
    };
    RingProgressLayer.prototype.coord = function () {
        var coordConfig = {
            type: 'theta',
            cfg: {
                radius: 1.0,
                innerRadius: this.getThickness(this.options.size),
            },
        };
        this.setConfig('coordinate', coordConfig);
    };
    RingProgressLayer.prototype.annotation = function () {
        return;
    };
    RingProgressLayer.prototype.addGeometry = function () {
        var props = this.options;
        this.ring = factory_1.getGeom('interval', 'main', {
            positionFields: [props.yField, props.xField],
            plot: this,
        });
        this.ring.adjust = [
            {
                type: 'stack',
            },
        ];
        this.setConfig('geometry', this.ring);
    };
    RingProgressLayer.prototype.animation = function () {
        this.ring.animate = {
            appear: {
                duration: 1000,
            },
        };
    };
    RingProgressLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    RingProgressLayer.prototype.getThickness = function (value) {
        var width = this.width;
        var height = this.height;
        var size = Math.min(width, height);
        if (value) {
            return 1.0 - value / size;
        }
        if (size >= 60) {
            return 1.0 - 20 / size;
        }
        return 1.0 - 10 / size;
    };
    return RingProgressLayer;
}(layer_1.default));
exports.default = RingProgressLayer;
global_1.registerPlotType('ringProgress', RingProgressLayer);

},{"../../base/global":392,"../../geoms/factory":430,"../progress/layer":652,"./event":653,"@antv/util":803,"tslib":894}],656:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var SHAPE_EVENT_MAP = {
    onAreaClick: 'area:click',
    onAreaDblclick: 'area:dblclick',
    onAreaMousemove: 'area:mousemove',
    onAreaMousedown: 'area:mousedown',
    onAreaMouseup: 'area:mouseup',
    onAreaMouseenter: 'area:mouseenter',
    onAreaMouseleave: 'area:mouseleave',
    onAreaContextmenu: 'area:contextmenu',
    onLineClick: 'line:click',
    onLineDblclick: 'line:dblclick',
    onLineMousemove: 'line:mousemove',
    onLineMousedown: 'line:mousedown',
    onLineMouseup: 'line:mouseup',
    onLineMouseenter: 'line:mouseenter',
    onLineMouseleave: 'line:mouseleave',
    onLineContextmenu: 'line:contextmenu',
};
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],657:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var TinyArea = /** @class */ (function (_super) {
    tslib_1.__extends(TinyArea, _super);
    function TinyArea() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TinyArea.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'tinyArea';
        _super.prototype.createLayers.call(this, layerProps);
    };
    TinyArea.getDefaultOptions = layer_1.default.getDefaultOptions;
    return TinyArea;
}(plot_1.default));
exports.default = TinyArea;

},{"../../base/plot":394,"./layer":658,"@antv/util":803,"tslib":894}],658:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var global_1 = require("../../base/global");
var factory_1 = require("../../geoms/factory");
var tiny_layer_1 = tslib_1.__importDefault(require("../tiny-layer"));
var EventParser = tslib_1.__importStar(require("./event"));
var GEOM_MAP = {
    area: 'area',
    line: 'line',
};
var TinyAreaLayer = /** @class */ (function (_super) {
    tslib_1.__extends(TinyAreaLayer, _super);
    function TinyAreaLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'tinyArea';
        return _this;
    }
    TinyAreaLayer.prototype.geometryParser = function (dim, type) {
        return GEOM_MAP[type];
    };
    TinyAreaLayer.prototype.addGeometry = function () {
        this.area = factory_1.getGeom('area', 'mini', {
            plot: this,
        });
        this.setConfig('geometry', this.area);
        this.line = factory_1.getGeom('line', 'mini', {
            plot: this,
        });
        this.setConfig('geometry', this.line);
    };
    TinyAreaLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return TinyAreaLayer;
}(tiny_layer_1.default));
exports.default = TinyAreaLayer;
global_1.registerPlotType('tinyArea', TinyAreaLayer);

},{"../../base/global":392,"../../geoms/factory":430,"../tiny-layer":662,"./event":656,"tslib":894}],659:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var SHAPE_EVENT_MAP = {
    onColumnClick: 'interval:click',
    onColumnDblclick: 'interval:dblclick',
    onColumnMousemove: 'interval:mousemove',
    onColumnMousedown: 'interval:mousedown',
    onColumnMouseup: 'interval:mouseup',
    onColumnMouseenter: 'interval:mouseenter',
    onColumnMouseleave: 'interval:mouseleave',
    onColumnContextmenu: 'interval:contextmenu',
};
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],660:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var TinyColumn = /** @class */ (function (_super) {
    tslib_1.__extends(TinyColumn, _super);
    function TinyColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TinyColumn.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'tinyColumn';
        _super.prototype.createLayers.call(this, layerProps);
    };
    TinyColumn.getDefaultOptions = layer_1.default.getDefaultOptions;
    return TinyColumn;
}(plot_1.default));
exports.default = TinyColumn;

},{"../../base/plot":394,"./layer":661,"@antv/util":803,"tslib":894}],661:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var global_1 = require("../../base/global");
var factory_1 = require("../../geoms/factory");
var tiny_layer_1 = tslib_1.__importDefault(require("../tiny-layer"));
var EventParser = tslib_1.__importStar(require("./event"));
var WIDTH_RATIO = 0.6;
var G2_GEOM_MAP = {
    column: 'interval',
};
var PLOT_GEOM_MAP = {
    interval: 'column',
};
var TinyColumnLayer = /** @class */ (function (_super) {
    tslib_1.__extends(TinyColumnLayer, _super);
    function TinyColumnLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'tinyColumn';
        return _this;
    }
    TinyColumnLayer.prototype.init = function () {
        this.processProps();
        _super.prototype.init.call(this);
    };
    TinyColumnLayer.prototype.geometryParser = function (dim, type) {
        if (dim === 'g2') {
            return G2_GEOM_MAP[type];
        }
        return PLOT_GEOM_MAP[type];
    };
    TinyColumnLayer.prototype.scale = function () {
        var options = this.options;
        var scales = {};
        /** 配置x-scale */
        scales[options.xField] = { type: 'cat' };
        this.setConfig('scales', scales);
    };
    TinyColumnLayer.prototype.addGeometry = function () {
        var props = this.options;
        var column = factory_1.getGeom('interval', 'main', {
            positionFields: [props.xField, props.yField],
            plot: this,
        });
        this.setConfig('geometry', column);
    };
    TinyColumnLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    TinyColumnLayer.prototype.processProps = function () {
        var cfg = {
            padding: [0, 0, 0, 0],
            columnSize: this.getSize(),
        };
        this.options = util_1.mix(this.options, cfg);
    };
    TinyColumnLayer.prototype.getSize = function () {
        var props = this.options;
        var columnNumber = this.getColumnNum(props.data, props.xField);
        var width = this.width;
        return (width / columnNumber) * WIDTH_RATIO;
    };
    TinyColumnLayer.prototype.getColumnNum = function (data, field) {
        var values = [];
        util_1.each(data, function (d) {
            var v = d[field];
            if (values.indexOf(v) < 0) {
                values.push(v);
            }
        });
        return values.length;
    };
    return TinyColumnLayer;
}(tiny_layer_1.default));
exports.default = TinyColumnLayer;
global_1.registerPlotType('tinyColumn', TinyColumnLayer);

},{"../../base/global":392,"../../geoms/factory":430,"../tiny-layer":662,"./event":659,"@antv/util":803,"tslib":894}],662:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var view_layer_1 = tslib_1.__importDefault(require("../base/view-layer"));
var factory_1 = require("../components/factory");
require("../geoms/line/mini");
var TinyLayer = /** @class */ (function (_super) {
    tslib_1.__extends(TinyLayer, _super);
    function TinyLayer() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TinyLayer.getDefaultOptions = function () {
        return util_1.deepMix({}, _super.getDefaultOptions.call(this), {
            title: {
                visible: false,
            },
            description: {
                visible: false,
            },
            padding: [0, 0, 0, 0],
            legend: {
                visible: false,
            },
            xAxis: {
                visible: false,
            },
            yAxis: {
                visible: false,
            },
            tooltip: {
                visible: false,
            },
        });
    };
    TinyLayer.prototype.coord = function () {
        return;
    };
    TinyLayer.prototype.addGeometry = function () {
        return;
    };
    TinyLayer.prototype.annotation = function () {
        var _this = this;
        var props = this.options;
        var config = [];
        var defaultGuidelineCfg = {
            line: {
                style: {
                    lineWidth: 1,
                    stroke: '#66d6a8',
                },
            },
        };
        util_1.each(props.guideLine, function (line) {
            var guideLine = factory_1.getComponent('guideLine', {
                plot: _this,
                cfg: util_1.deepMix({}, defaultGuidelineCfg, line),
            });
            config.push(guideLine);
        });
        this.setConfig('annotations', config);
    };
    return TinyLayer;
}(view_layer_1.default));
exports.default = TinyLayer;

},{"../base/view-layer":395,"../components/factory":412,"../geoms/line/mini":437,"@antv/util":803,"tslib":894}],663:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.EVENT_MAP = void 0;
var util_1 = require("@antv/util");
var event_1 = require("../../util/event");
Object.defineProperty(exports, "EVENT_MAP", { enumerable: true, get: function () { return event_1.EVENT_MAP; } });
Object.defineProperty(exports, "onEvent", { enumerable: true, get: function () { return event_1.onEvent; } });
var SHAPE_EVENT_MAP = {
    onLineClick: 'line:click',
    onLineDblclick: 'line:dblclick',
    onLineMousemove: 'line:mousemove',
    onLineMousedown: 'line:mousedown',
    onLineMouseup: 'line:mouseup',
    onLineMouseenter: 'line:mouseenter',
    onLineMouseleave: 'line:mouseleave',
    onLineContextmenu: 'line:contextmenu',
};
util_1.assign(event_1.EVENT_MAP, SHAPE_EVENT_MAP);

},{"../../util/event":677,"@antv/util":803}],664:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var plot_1 = tslib_1.__importDefault(require("../../base/plot"));
var layer_1 = tslib_1.__importDefault(require("./layer"));
var TinyLine = /** @class */ (function (_super) {
    tslib_1.__extends(TinyLine, _super);
    function TinyLine() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TinyLine.prototype.createLayers = function (props) {
        var layerProps = util_1.deepMix({}, props);
        layerProps.type = 'tinyLine';
        _super.prototype.createLayers.call(this, layerProps);
    };
    TinyLine.getDefaultOptions = layer_1.default.getDefaultOptions;
    return TinyLine;
}(plot_1.default));
exports.default = TinyLine;

},{"../../base/plot":394,"./layer":665,"@antv/util":803,"tslib":894}],665:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var global_1 = require("../../base/global");
var factory_1 = require("../../geoms/factory");
var tiny_layer_1 = tslib_1.__importDefault(require("../tiny-layer"));
var EventParser = tslib_1.__importStar(require("./event"));
var GEOM_MAP = {
    line: 'line',
};
var TinyLineLayer = /** @class */ (function (_super) {
    tslib_1.__extends(TinyLineLayer, _super);
    function TinyLineLayer() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'tinyLine';
        return _this;
    }
    TinyLineLayer.prototype.geometryParser = function (dim, type) {
        return GEOM_MAP[type];
    };
    TinyLineLayer.prototype.addGeometry = function () {
        this.line = factory_1.getGeom('line', 'mini', {
            plot: this,
        });
        this.setConfig('geometry', this.line);
    };
    TinyLineLayer.prototype.parseEvents = function () {
        _super.prototype.parseEvents.call(this, EventParser);
    };
    return TinyLineLayer;
}(tiny_layer_1.default));
exports.default = TinyLineLayer;
global_1.registerPlotType('tinyLine', TinyLineLayer);

},{"../../base/global":392,"../../geoms/factory":430,"../tiny-layer":662,"./event":663,"tslib":894}],666:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_DARK_THEME = void 0;
var default_1 = require("./default");
exports.DEFAULT_DARK_THEME = {
    backgroundStyle: {
        fill: '#262626',
    },
    defaultColor: '#5B8FF9',
    width: 400,
    height: 400,
    bleeding: [default_1.TOP_BLEEDING, 24, default_1.BOTTOM_BLEEDING, 24],
    padding: 'auto',
    title: {
        padding: [24, 24, 24, 24],
        fontFamily: 'PingFang SC',
        fontSize: 18,
        fontWeight: 'bold',
        fill: 'rgba(255,255,255,0.65)',
        stroke: 'rgba(0,0,0,0.95)',
        textAlign: 'left',
        textBaseline: 'top',
        lineHeight: 20,
        alignWithAxis: false,
    },
    description: {
        padding: [10, 24, default_1.DESCRIPTION_BOTTOM_MARGIN, 24],
        fontFamily: 'PingFang SC',
        fontSize: 12,
        fill: 'rgba(255, 255, 255, 0.65)',
        stroke: 'rgba(0,0,0,0.95)',
        textAlign: 'left',
        textBaseline: 'top',
        lineHeight: 16,
        alignWithAxis: false,
    },
    axis: {
        y: {
            visible: true,
            position: 'left',
            autoRotateTitle: true,
            grid: {
                visible: true,
                line: {
                    style: {
                        stroke: 'rgba(255, 255, 255, 0.15)',
                        lineWidth: 1,
                        lineDash: null,
                    },
                },
            },
            line: {
                visible: false,
                style: {
                    stroke: 'rgba(255, 255, 255, 0.45)',
                    lineWidth: 1,
                },
            },
            tickLine: {
                visible: false,
                style: {
                    stroke: 'rgba(255, 255, 255, 0.45)',
                    lineWidth: 0.5,
                    length: 4,
                },
            },
            label: {
                visible: true,
                offset: 8,
                autoRotate: false,
                autoHide: true,
                textStyle: {
                    fill: 'rgba(255, 255, 255, 0.45)',
                    fontSize: 12,
                },
            },
            title: {
                visible: false,
                spacing: 12,
                style: {
                    fill: 'rgba(255, 255, 255, 0.65)',
                    fontSize: 12,
                    textBaseline: 'bottom',
                },
            },
        },
        x: {
            visible: true,
            position: 'bottom',
            autoRotateTitle: false,
            grid: {
                visible: false,
                line: {
                    style: {
                        stroke: 'rgba(255, 255, 255, 0.15)',
                        lineWidth: 1,
                        lineDash: null,
                    },
                },
            },
            line: {
                visible: false,
                style: {
                    stroke: 'rgba(255, 255, 255, 0.45)',
                },
            },
            tickLine: {
                visible: true,
                style: {
                    length: 4,
                    stroke: 'rgba(255, 255, 255, 0.45)',
                    lineWidth: 0.5,
                },
            },
            label: {
                visible: true,
                textStyle: {
                    fill: 'rgba(255, 255, 255, 0.65)',
                    fontSize: 12,
                },
                offset: 16,
                autoHide: true,
                autoRotate: true,
            },
            title: {
                visible: false,
                spacing: 12,
                style: {
                    fill: 'rgba(255, 255, 255, 0.65)',
                    fontSize: 12,
                },
            },
        },
        circle: {
            autoRotateTitle: true,
            // gridType: 'line',
            grid: {
                style: {
                    lineDash: null,
                    lineWidth: 1,
                    stroke: '#E3E8EC',
                },
            },
            line: {
                style: {
                    lineWidth: 1,
                    stroke: '#BFBFBF',
                },
            },
            tickLine: {
                style: {
                    lineWidth: 1,
                    stroke: '#bdc8d3',
                    length: 4,
                    alignWithLabel: true,
                },
            },
            label: {
                offset: 16,
                textStyle: {
                    fill: '#a0a4aa',
                    fontSize: 12,
                },
                autoRotate: true,
                autoHide: true,
            },
            title: {
                offset: 12,
                style: { fill: '#767b84', fontSize: 12 },
            },
        },
        radius: {
            label: {
                offset: 12,
                textStyle: {
                    fill: '#a0a4aa',
                    fontSize: 12,
                },
            },
        },
    },
    legend: {
        flipPage: false,
        position: 'bottom',
        // 距离panelRange的距离
        innerPadding: [16, 16, 16, 16],
        title: {
            visible: false,
            style: {
                fill: '#bdc8d3',
            },
        },
        text: {
            style: {
                fill: '#bdc8d3',
            },
        },
    },
    label: {
        offset: 12,
        textStyle: {
            fill: 'rgba(255, 255, 255, 0.65)',
        },
        style: {
            fill: 'rgba(255, 255, 255, 0.65)',
            lineWidth: 1,
        },
    },
    components: {
        tooltip: {
            domStyles: {
                'g2-tooltip': {
                    backgroundColor: 'rgba(33,33,33, 0.95)',
                    boxShadow: '0px 0px 8px rgba(0,0,0,0.65)',
                    color: 'rgba(255, 255, 255, 0.65)',
                },
            },
        },
    },
};

},{"./default":667}],667:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_GLOBAL_THEME = exports.BOTTOM_BLEEDING = exports.TOP_BLEEDING = exports.DESCRIPTION_BOTTOM_MARGIN = exports.COLOR_PLATE_20 = exports.COLOR_PLATE_10 = void 0;
var COLOR = '#5B8FF9';
exports.COLOR_PLATE_10 = [
    '#5B8FF9',
    '#5AD8A6',
    '#5D7092',
    '#F6BD16',
    '#E8684A',
    '#6DC8EC',
    '#9270CA',
    '#FF9D4D',
    '#269A99',
    '#FF99C3',
];
exports.COLOR_PLATE_20 = [
    '#5B8FF9',
    '#BDD2FD',
    '#5AD8A6',
    '#BDEFDB',
    '#5D7092',
    '#C2C8D5',
    '#F6BD16',
    '#FBE5A2',
    '#E8684A',
    '#F6C3B7',
    '#6DC8EC',
    '#B6E3F5',
    '#9270CA',
    '#D3C6EA',
    '#FF9D4D',
    '#FFD8B8',
    '#269A99',
    '#AAD8D8',
    '#FF99C3',
    '#FFD6E7',
];
var util_1 = require("@antv/util");
exports.DESCRIPTION_BOTTOM_MARGIN = function (legendPosition) {
    if (legendPosition && legendPosition.split('-')[0] === 'top') {
        return 12;
    }
    return 24;
};
exports.TOP_BLEEDING = function (props) {
    var titleVisible = props.title && props.title.visible;
    var descriptionVisible = props.description && props.description.visible;
    if (titleVisible || descriptionVisible) {
        // 由 title/description 的 bottom-padding 负责
        return 12;
    }
    return 24;
};
exports.BOTTOM_BLEEDING = function (props) {
    if (util_1.some(props.interactions || [], function (interaction) {
        return (interaction.type === 'slider' || interaction.type === 'scrollbar') &&
            (interaction.cfg && interaction.cfg.type) !== 'vertical';
    })) {
        return 8;
    }
    return 24;
};
exports.DEFAULT_GLOBAL_THEME = {
    width: 400,
    height: 400,
    bleeding: [exports.TOP_BLEEDING, 24, exports.BOTTOM_BLEEDING, 24],
    padding: 'auto',
    defaultColor: COLOR,
    colors: exports.COLOR_PLATE_10,
    colors_20: exports.COLOR_PLATE_20,
    title: {
        padding: [24, 24, 24, 24],
        fontFamily: 'PingFang SC',
        fontSize: 18,
        fill: 'black',
        textAlign: 'left',
        textBaseline: 'top',
        lineHeight: 20,
        alignWithAxis: false,
    },
    description: {
        padding: [10, 24, exports.DESCRIPTION_BOTTOM_MARGIN, 24],
        fontFamily: 'PingFang SC',
        fontSize: 12,
        fill: 'grey',
        textAlign: 'left',
        textBaseline: 'top',
        lineHeight: 16,
        alignWithAxis: false,
    },
    axis: {
        y: {
            visible: true,
            position: 'left',
            autoRotateTitle: true,
            grid: {
                visible: true,
                line: {
                    style: {
                        stroke: 'rgba(0, 0, 0, 0.15)',
                        lineWidth: 1,
                        lineDash: [0, 0],
                    },
                },
            },
            line: {
                visible: false,
                style: {
                    stroke: 'rgba(0, 0, 0, 0.45)',
                    lineWidth: 1,
                },
            },
            tickLine: {
                visible: false,
                style: {
                    stroke: 'rgba(0,0,0,0.45)',
                    lineWidth: 0.5,
                    length: 4,
                },
            },
            label: {
                visible: true,
                offset: 8,
                textStyle: {
                    fill: 'rgba(0,0,0,0.45)',
                    fontSize: 12,
                },
                autoRotate: false,
                autoHide: true,
            },
            title: {
                visible: false,
                spacing: 12,
                style: {
                    fill: 'rgba(0, 0, 0, 0.65)',
                    fontSize: 12,
                    textBaseline: 'bottom',
                },
            },
        },
        x: {
            visible: true,
            position: 'bottom',
            autoRotateTitle: false,
            grid: {
                visible: false,
                line: {
                    style: {
                        stroke: 'rgba(0, 0, 0, 0.15)',
                        lineWidth: 1,
                        lineDash: [0, 0],
                    },
                },
            },
            line: {
                visible: false,
                style: {
                    stroke: 'rgba(0, 0, 0, 0.45)',
                    lineWidth: 1,
                },
            },
            tickLine: {
                visible: true,
                style: {
                    length: 4,
                    stroke: 'rgba(0, 0, 0, 0.45)',
                    lineWidth: 0.5,
                },
            },
            label: {
                visible: true,
                textStyle: {
                    fill: 'rgba(0,0,0,0.45)',
                    fontSize: 12,
                },
                offset: 16,
                autoRotate: true,
                autoHide: true,
            },
            title: {
                visible: false,
                spacing: 12,
                style: { fill: 'rgba(0, 0, 0, 0.65)', fontSize: 12 },
            },
        },
        circle: {
            autoHideLabel: false,
            // gridType: 'line',
            grid: {
                line: {
                    style: {
                        lineDash: null,
                        lineWidth: 1,
                        stroke: 'rgba(0, 0, 0, 0.15)',
                    },
                },
            },
            line: {
                style: {
                    lineWidth: 1,
                    stroke: 'rgba(0, 0, 0, 0.45)',
                },
            },
            tickLine: {
                style: {
                    lineWidth: 1,
                    stroke: 'rgba(0, 0, 0, 0.45)',
                    length: 4,
                    alignWithLabel: true,
                },
            },
            label: {
                offset: 16,
                textStyle: {
                    fill: 'rgba(0,0,0,0.45)',
                    fontSize: 12,
                },
                autoRotate: true,
                autoHide: true,
            },
            title: {
                offset: 12,
                style: { fill: 'rgba(0, 0, 0, 0.65)', fontSize: 12 },
            },
        },
        radius: {
            label: {
                textStyle: {
                    fill: 'rgba(0,0,0,0.45)',
                    fontSize: 12,
                },
            },
        },
    },
    legend: {
        flipPage: false,
        position: 'bottom',
        // 距离panelRange的距离
        innerPadding: [16, 16, 16, 16],
        margin: [0, 24, 24, 24],
    },
    label: {
        offset: 12,
        textStyle: {
            fill: '#595959',
        },
        style: {
            fill: '#595959',
            stroke: '#ffffff',
            lineWidth: 2,
        },
    },
    tooltip: {
        'g2-tooltip': {
            boxShadow: '0px 0px 8px rgba(0,0,0,0.15)',
        },
        offset: 10,
    },
    // G2Plot 组件主题配置
    components: {
        legend: {
            margin: [0, 24, 24, 24],
        },
        tooltipIndicator: {
            title: {
                style: {
                    fontSize: 14,
                    fill: '#262626',
                },
            },
            line: {
                style: {
                    opacity: 1,
                },
                inactiveStyle: {
                    opacity: 0.3,
                },
            },
            itemTitle: {
                style: {
                    fontSize: 12,
                    fill: '#8C8C8C',
                    opacity: 1,
                },
                inactiveStyle: {
                    opacity: 0.3,
                },
            },
            itemName: {
                style: {
                    fontSize: 12,
                    fill: '#8C8C8C',
                    opacity: 1,
                },
                inactiveStyle: {
                    opacity: 0.3,
                },
            },
            itemValue: {
                style: {
                    fontSize: 14,
                    fontWeight: 'bold',
                    fill: '#595959',
                    opacity: 1,
                },
                inactiveStyle: {
                    opacity: 0.3,
                },
            },
        },
    },
};

},{"@antv/util":803}],668:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGlobalTheme = exports.registerGlobalTheme = void 0;
var util_1 = require("@antv/util");
var default_1 = require("./default");
var dark_1 = require("./dark");
/** 所有的全局主题 */
var GLOBAL_THEME_MAP = {
    default: default_1.DEFAULT_GLOBAL_THEME,
    dark: dark_1.DEFAULT_DARK_THEME,
};
/**
 * 注册全局主题
 * @param name
 * @param theme
 */
function registerGlobalTheme(name, theme) {
    var defaultTheme = getGlobalTheme();
    GLOBAL_THEME_MAP[name.toLowerCase()] = util_1.deepMix({}, defaultTheme, theme);
}
exports.registerGlobalTheme = registerGlobalTheme;
/**
 * 获取默认主题
 * @param name 如果 name 为空，则返回默认的主题，否则返回指定 name 的主题
 */
function getGlobalTheme(name) {
    if (name === void 0) { name = 'default'; }
    var theme = GLOBAL_THEME_MAP[name.toLowerCase()];
    if (theme) {
        return theme;
    }
    // 如没有找到，则使用当前全局主题替代
    console.warn("error in theme: Can't find the theme named %s. Please register theme first.", name);
    return default_1.DEFAULT_GLOBAL_THEME;
}
exports.getGlobalTheme = getGlobalTheme;

},{"./dark":666,"./default":667,"@antv/util":803}],669:[function(require,module,exports){
"use strict";
// // defaultTheme 必须首先注册
// import defaultTheme from './default';
//
// import Theme from './theme';
//
// export { Theme as default, defaultTheme };
Object.defineProperty(exports, "__esModule", { value: true });
// 全局主题的方法
var global_1 = require("./global");
Object.defineProperty(exports, "getGlobalTheme", { enumerable: true, get: function () { return global_1.getGlobalTheme; } });
Object.defineProperty(exports, "registerGlobalTheme", { enumerable: true, get: function () { return global_1.registerGlobalTheme; } });
// 图表主题的方法
var theme_1 = require("./theme");
Object.defineProperty(exports, "getTheme", { enumerable: true, get: function () { return theme_1.getTheme; } });
Object.defineProperty(exports, "registerTheme", { enumerable: true, get: function () { return theme_1.registerTheme; } });
// 工具函数
var utils_1 = require("./utils");
Object.defineProperty(exports, "convertToG2Theme", { enumerable: true, get: function () { return utils_1.convertToG2Theme; } });

},{"./global":668,"./theme":670,"./utils":671}],670:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTheme = exports.registerTheme = exports.convertThemeToG2Theme = void 0;
var util_1 = require("@antv/util");
/**
 * 所有的 plot theme object，每个图类型只会存在一个 theme
 */
var PLOT_THEME_MAP = {};
/**
 * 将 主题 转换为 G2 主题配置
 * @param type plotType
 */
function convertThemeToG2Theme(type /** plot style */, theme) {
    var styleMapShape = {
        lineStyle: 'line.line',
        columnStyle: 'interval.rect',
        pointStyle: 'point.circle',
    };
    var g2Theme = {};
    if (type === 'area') {
        styleMapShape = {
            areaStyle: 'area.area',
            lineStyle: 'area.line',
            pointStyle: 'point.circle',
        };
    }
    var geometryTheme = {};
    util_1.each(theme, function (style, styleKey) {
        var _a;
        if (util_1.has(styleMapShape, styleKey)) {
            var shapePath_1 = styleMapShape[styleKey];
            util_1.each(style, function (v, k) {
                util_1.set(geometryTheme, shapePath_1 + "." + [k === 'normal' ? 'default' : k === 'disable' ? 'inactive' : k] + ".style", v);
            });
        }
        else {
            /** styleMap 找不到，直接放入 G2 theme */
            g2Theme = util_1.deepMix({}, g2Theme, (_a = {}, _a[styleKey] = style, _a));
        }
    });
    if (!util_1.isEmpty(geometryTheme)) {
        g2Theme = util_1.deepMix({}, g2Theme, { geometries: geometryTheme });
    }
    return g2Theme;
}
exports.convertThemeToG2Theme = convertThemeToG2Theme;
/**
 * 注册新的图表主题
 * @param type
 * @param theme
 */
function registerTheme(type, theme) {
    PLOT_THEME_MAP[type.toLowerCase()] = convertThemeToG2Theme(type, theme);
}
exports.registerTheme = registerTheme;
/**
 * 根据类型获取主题
 * @param type plotType, such as line, column, bar, pie, bullet, radar and so on
 */
function getTheme(type) {
    return PLOT_THEME_MAP[type.toLowerCase()] || {};
}
exports.getTheme = getTheme;

},{"@antv/util":803}],671:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertToG2Theme = void 0;
var util_1 = require("@antv/util");
/**
 * mutable 的方式修改 axis 配置
 * @param axis
 */
// function convertToG2Axis(axis: any): void {
//   if (axis.line && axis.line.style) {
//     const lineStyle = axis.line.style;
//     delete axis.line.style;
//     mix(axis.line, lineStyle);
//   }
//   if (axis.tickLine) {
//     const tickLineStyle = axis.tickLine.style;
//     delete axis.tickLine.style;
//     mix(axis.tickLine, tickLineStyle);
//   }
//   if (axis.grid) {
//     const gridStyle = axis.grid.style;
//     delete axis.grid.style;
//     mix(axis.grid, gridStyle);
//   }
//   if (axis.label) {
//     if (axis.label.style) {
//       axis.label.textStyle = axis.label.style;
//       delete axis.label.style;
//     }
//   }
//   if (axis.title) {
//     if (axis.title.style) {
//       axis.title.textStyle = axis.title.style;
//       delete axis.title.style;
//     }
//   }
// }
/**
 * 将图形主题转换成 g2 theme 格式
 * @param plotTheme
 */
function convertToG2Theme(plotTheme) {
    var g2Theme = util_1.clone(plotTheme);
    /** tempo: legend margin设置为0 */
    if (!g2Theme.legend) {
        g2Theme.legend = {};
    }
    return g2Theme;
}
exports.convertToG2Theme = convertToG2Theme;

},{"@antv/util":803}],672:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var bbox_1 = require("@antv/g2/lib/util/bbox");
var constant_1 = require("@antv/g2/lib/constant");
Object.defineProperty(exports, "DIRECTION", { enumerable: true, get: function () { return constant_1.DIRECTION; } });
var BBox = /** @class */ (function (_super) {
    tslib_1.__extends(BBox, _super);
    function BBox() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BBox.fromBBoxObject = function (bbox) {
        return new BBox(bbox.x, bbox.y, bbox.width, bbox.height);
    };
    return BBox;
}(bbox_1.BBox));
exports.default = BBox;

},{"@antv/g2/lib/constant":237,"@antv/g2/lib/util/bbox":370,"tslib":894}],673:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isContrastColorWhite = exports.mappingColor = exports.arr2rgb = exports.toHex = exports.rgb2arr = void 0;
var util_1 = require("@antv/util");
function rgb2arr(str) {
    var colorStr = str.indexOf('#') === 0 ? str.substr(1) : str;
    var arr = [];
    arr.push(parseInt(colorStr.substr(0, 2), 16));
    arr.push(parseInt(colorStr.substr(2, 2), 16));
    arr.push(parseInt(colorStr.substr(4, 2), 16));
    return arr;
}
exports.rgb2arr = rgb2arr;
function toHex(value) {
    var v;
    v = Math.round(value);
    v = v.toString(16);
    if (v.length === 1) {
        v = "0" + value;
    }
    return v;
}
exports.toHex = toHex;
function arr2rgb(arr) {
    return "#" + (toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]));
}
exports.arr2rgb = arr2rgb;
function mappingColor(band, gray) {
    var reflect;
    util_1.each(band, function (b) {
        var map = b;
        if (gray >= map.from && gray < map.to) {
            reflect = map.color;
        }
    });
    return reflect;
}
exports.mappingColor = mappingColor;
// 根据YIQ亮度判断指定颜色取反色是不是白色
// http://24ways.org/2010/calculating-color-contrast
exports.isContrastColorWhite = function (rgb) {
    var _a = rgb2arr(rgb), r = _a[0], g = _a[1], b = _a[2];
    var isDark = (r * 299 + g * 587 + b * 114) / 1000 < 128;
    return isDark;
};

},{"@antv/util":803}],674:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMobile = exports.isBBoxIntersect = exports.sortedLastIndex = exports.getLegendShapes = exports.getAxisShapes = exports.getLegendComponents = exports.getAxisComponents = exports.breakText = exports.isTextUsable = void 0;
var tslib_1 = require("tslib");
var dependents_1 = require("../dependents");
/**
 * 判断text是否可用, title description
 *
 * @param source
 */
function isTextUsable(source) {
    if (!source)
        return false;
    if (source.visible === true && typeof source.text === 'string' && source.text.trim())
        return true;
    return false;
}
exports.isTextUsable = isTextUsable;
/**
 * 为字符串添加换行符
 * @param source - 字符串数组 ['a', 'b', 'c']
 * @param breaks - 要添加换行的index
 *
 * @example
 * ```js
 * breakText(['a','b','c'], [1])
 *
 * // a\nbc
 * ```
 */
function breakText(source, breaks) {
    var result = tslib_1.__spreadArrays(source);
    breaks.forEach(function (pos, index) {
        result.splice(pos + index, 0, '\n');
    });
    return result.join('');
}
exports.breakText = breakText;
/**
 * 获取 View 中所有的 Axis 组件
 */
function getAxisComponents(view) {
    return view
        .getComponents()
        .filter(function (co) { return co.type === dependents_1.COMPONENT_TYPE.AXIS; })
        .map(function (co) { return co.component; });
}
exports.getAxisComponents = getAxisComponents;
function getLegendComponents(view) {
    return view
        .getComponents()
        .filter(function (co) { return co.type === dependents_1.COMPONENT_TYPE.LEGEND; })
        .map(function (co) { return co.component; });
}
exports.getLegendComponents = getLegendComponents;
function getAxisShapes(view) {
    var axisShape = view.backgroundGroup.findAll(function (el) {
        if (el.get('name')) {
            var name_1 = el.get('name').split('-');
            return name_1[0] === 'axis';
        }
    });
    return axisShape;
}
exports.getAxisShapes = getAxisShapes;
function getLegendShapes(view) {
    var axisShape = view.foregroundGroup.findAll(function (el) {
        if (el.get('name')) {
            return el.get('name') === 'legend-item-group';
        }
    });
    return axisShape;
}
exports.getLegendShapes = getLegendShapes;
function sortedLastIndex(arr, val) {
    var i = arr.length;
    while (i > 0) {
        if (val >= arr[i - 1]) {
            break;
        }
        i -= 1;
    }
    return i;
}
exports.sortedLastIndex = sortedLastIndex;
/* 检测两个label包围盒是否重叠 */
function isBBoxIntersect(bboxA, bboxB) {
    if (bboxA.maxY < bboxB.minY || bboxB.maxY < bboxA.minY) {
        return false;
    }
    if (bboxA.maxX < bboxB.minX || bboxB.maxX < bboxA.minX) {
        return false;
    }
    return true;
}
exports.isBBoxIntersect = isBBoxIntersect;
/**
 * 判断是否移动端环境
 */
function isMobile() {
    return !!navigator.userAgent.match(/(Mobile)|(Android)|(WebOS)|(iPhone)|(iPad)/);
}
exports.isMobile = isMobile;

},{"../dependents":425,"tslib":894}],675:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformDataPercentage = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
exports.transformDataPercentage = function (data, groupField, measures) {
    // 按照groupBy字段计算各个group的总和
    var chain = util_1.groupBy(data, groupField);
    chain = util_1.mapValues(chain, function (items) { return util_1.map(items, function (item) { return util_1.map(measures, function (field) { return item[field]; }); }); });
    chain = util_1.mapValues(chain, util_1.flatten);
    chain = util_1.mapValues(chain, function (vals) {
        return util_1.map(vals, function (val) {
            // @ts-ignore
            var v = Number.parseFloat(val);
            if (!util_1.isNumber(v) || isNaN(v)) {
                return 0;
            }
            return v;
        });
    });
    // @ts-ignore
    var groupTotals = util_1.mapValues(chain, function (vals) { return util_1.reduce(vals, function (sum, val) { return sum + val; }, 0); });
    // 覆盖measures字段的值为对于的百分比
    var newData = util_1.map(data, function (item) {
        // @ts-ignore
        var rst = tslib_1.__assign(tslib_1.__assign({}, item), { _origin: item, total: groupTotals[item[groupField]] });
        util_1.each(measures, function (field) {
            // @ts-ignore
            rst[field] = item[field] / (groupTotals[item[groupField]] || 1);
        });
        return rst;
    });
    // 检查精度，确保总和为1
    util_1.each(util_1.groupBy(newData, groupField), function (items) {
        var sum = 0;
        util_1.each(items, function (item, itemIdx) {
            util_1.each(measures, function (field, fieldIdx) {
                // @ts-ignore
                if (sum + item[field] >= 1 || (itemIdx === items.length - 1 && fieldIdx === measures.length - 1 && sum > 0)) {
                    item[field] = 1 - sum;
                }
                // @ts-ignore
                sum += item[field];
            });
        });
    });
    // @ts-ignore
    return newData;
};

},{"@antv/util":803,"tslib":894}],676:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.advanceBy = exports.getDay = exports.getWeek = exports.isLastDayOfMonth = exports.isLastWeekOfMonth = exports.getYearRange = exports.getDateRange = exports.DAY_MS = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var fecha_1 = tslib_1.__importDefault(require("fecha"));
var constant_1 = require("../plots/calendar/constant");
/**
 * 一天多少 ms
 */
exports.DAY_MS = 86400000;
/**
 * 获取最大最小日期范围
 * @param dates
 */
function getDateRange(dates) {
    var ds = tslib_1.__spreadArrays(dates).sort(function (a, b) { return a.getTime() - b.getTime(); });
    return [fecha_1.default.format(util_1.head(ds), constant_1.FORMATTER), fecha_1.default.format(util_1.last(ds), constant_1.FORMATTER)];
}
exports.getDateRange = getDateRange;
/**
 * 日期对应年的范围
 * @param date
 */
function getYearRange(date) {
    var curr = date ? date : new Date();
    return [
        fecha_1.default.format(new Date(curr.getFullYear(), 0, 1), constant_1.FORMATTER),
        fecha_1.default.format(new Date(curr.getFullYear(), 11, 30), constant_1.FORMATTER),
    ];
}
exports.getYearRange = getYearRange;
/**
 * 是否当前月的最后一周
 */
function isLastWeekOfMonth(date) {
    // 偏移 7 天之后，月份是否一样
    return date.getMonth() !== advanceBy(new Date(date), 7 * exports.DAY_MS).getMonth();
}
exports.isLastWeekOfMonth = isLastWeekOfMonth;
/**
 * 是否是当月的最后一天
 */
function isLastDayOfMonth(date) {
    // 偏移 1 天之后，月份是否一样
    return date.getMonth() !== advanceBy(new Date(date), exports.DAY_MS).getMonth();
}
exports.isLastDayOfMonth = isLastDayOfMonth;
/**
 * 获取 date 对应的周索引（国际标准：一年的第一个周四为第一周）
 * @param date
 */
function getWeek(date) {
    // 当年的第一天
    var oneJan = new Date(date.getFullYear(), 0, 1);
    return Math.ceil(((date.getTime() - oneJan.getTime()) / exports.DAY_MS + oneJan.getDay() + 1) / 7);
}
exports.getWeek = getWeek;
/**
 * 获得一周的第几天（周日第 0 天）
 * @param date
 */
function getDay(date) {
    return date.getDay();
}
exports.getDay = getDay;
/**
 * 将 Date 前进 ms 时间
 * @param d
 * @param ms
 */
function advanceBy(d, ms) {
    d.setMilliseconds(d.getMilliseconds() + ms);
    return d;
}
exports.advanceBy = advanceBy;

},{"../plots/calendar/constant":476,"@antv/util":803,"fecha":881,"tslib":894}],677:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onEvent = exports.LAYER_EVENT_MAP = exports.CANVAS_EVENT_MAP = exports.EVENT_MAP = exports.getMobileEventMap = exports.getRegionEventMap = exports.getEventMap = void 0;
var util_1 = require("@antv/util");
var eventNames = [
    'click',
    'dblclick',
    'mousemove',
    'mouseenter',
    'mouseleave',
    'mousedown',
    'mouseup',
    'contextmenu',
];
var mobileEventNames = [
/*'touchstart',
'touchmove',
'touchend',
'pressstart',
'press',
'pressend',
'swipestart',
'swipe',
'swipeend',
'pinchstart',
'pinch',
'pinchend',
'panstart',
'pan',
'panend',*/
];
var viewComponentMap = {
    axis: 'axis-label',
    label: 'label',
    legend: 'legend-item',
};
var canvasComponentMap = {
    title: 'title',
    description: 'description',
    breadcrumb: 'breadcrumb',
};
var CANVAS_EVENT_MAP = util_1.deepMix(getEventMap(canvasComponentMap), getRegionEventMap('Plot', eventNames));
exports.CANVAS_EVENT_MAP = CANVAS_EVENT_MAP;
var LAYER_EVENT_MAP = getRegionEventMap('Layer', eventNames);
exports.LAYER_EVENT_MAP = LAYER_EVENT_MAP;
//移动端事件暂时只支持view级
var EVENT_MAP = util_1.deepMix({}, getEventMap(viewComponentMap), getRegionEventMap('View', eventNames), getMobileEventMap());
exports.EVENT_MAP = EVENT_MAP;
function onEvent(layer, eventName, handler) {
    layer.view.on(eventName, function (ev) {
        var eventData = {
            x: ev === null || ev === void 0 ? void 0 : ev.x,
            y: ev === null || ev === void 0 ? void 0 : ev.y,
            clientX: ev === null || ev === void 0 ? void 0 : ev.clientX,
            clientY: ev === null || ev === void 0 ? void 0 : ev.clientY,
            target: ev === null || ev === void 0 ? void 0 : ev.target,
            data: (ev === null || ev === void 0 ? void 0 : ev.data) ? ev.data.data : null,
            plot: layer,
            canvas: layer.canvas,
            gEvent: ev === null || ev === void 0 ? void 0 : ev.gEvent,
        };
        handler(eventData);
    });
}
exports.onEvent = onEvent;
function getEventMap(map) {
    var eventMap = {};
    util_1.each(map, function (item, key) {
        var componentName = util_1.upperFirst(key);
        var namePrefix = "on" + componentName;
        var eventPrefix = item + ":";
        util_1.each(eventNames, function (name) {
            var eventName = util_1.upperFirst(name);
            var eventKey = "" + namePrefix + eventName;
            var event = "" + eventPrefix + name;
            eventMap[eventKey] = event;
        });
    });
    return eventMap;
}
exports.getEventMap = getEventMap;
function getRegionEventMap(prefix, eventList) {
    var eventMap = {};
    var namePrefix = "on";
    util_1.each(eventList, function (name) {
        var eventName = util_1.upperFirst(name);
        var eventKey = "" + namePrefix + prefix + eventName;
        eventMap[eventKey] = name;
    });
    return eventMap;
}
exports.getRegionEventMap = getRegionEventMap;
function getMobileEventMap() {
    var eventMap = {};
    var namePrefix = "on";
    util_1.each(mobileEventNames, function (name) {
        var eventName = util_1.upperFirst(name);
        var eventKey = "" + namePrefix + eventName;
        eventMap[eventKey] = name;
    });
    return eventMap;
}
exports.getMobileEventMap = getMobileEventMap;

},{"@antv/util":803}],678:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSuffixFormatter = exports.getPrecisionFormatter = exports.getNoopFormatter = exports.combineFormatter = void 0;
var util_1 = require("@antv/util");
exports.combineFormatter = function () {
    var formatters = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        formatters[_i] = arguments[_i];
    }
    return function (text, item, idx) {
        return formatters.reduce(function (curText, formatter) { return formatter(curText, item, idx); }, text);
    };
};
exports.getNoopFormatter = function () { return function (text) { return text; }; };
exports.getPrecisionFormatter = function (precision) { return function (text) {
    var num = Number(text);
    return isNaN(num) || util_1.isNil(precision) ? text : num.toFixed(precision);
}; };
exports.getSuffixFormatter = function (suffix) { return function (text) {
    return util_1.isNil(suffix) ? text : text + " " + suffix;
}; };

},{"@antv/util":803}],679:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rotate = exports.translate = exports.move = exports.transform = exports.groupTransform = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
var dependents_1 = require("../dependents");
function groupTransform(group, actions) {
    var ulMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    var matrix = matrix_util_1.ext.transform(ulMatrix, actions);
    group.setMatrix(matrix);
}
exports.groupTransform = groupTransform;
function transform(actions, matrix) {
    var ulMatrix = matrix ? util_1.clone(matrix) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
    return matrix_util_1.ext.transform(ulMatrix, actions);
}
exports.transform = transform;
function move(element, x, y, matrix) {
    var ulMatrix = matrix ? util_1.clone(matrix) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
    ulMatrix[6] = x;
    ulMatrix[7] = y;
    element.setMatrix(ulMatrix);
}
exports.move = move;
function translate(element, x, y) {
    dependents_1.Util.translate(element, x, y);
}
exports.translate = translate;
function rotate(element, radian) {
    dependents_1.Util.rotate(element, radian);
}
exports.rotate = rotate;

},{"../dependents":425,"@antv/matrix-util":717,"@antv/util":803}],680:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStrokePoints = exports.dist2 = exports.sturges = exports.getMean = exports.getMedian = exports.lineSimplification = exports.angleTo = exports.sub2D = exports.crossProduct3D = exports.crossProduct2D = exports.dotProduct2D = exports.bboxOnRotate = exports.minDistBetweenConvexPolygon = exports.isPolygonIntersection = exports.distBetweenPointLine = exports.distBetweenPoints = exports.isPointInPolygon = exports.getLineIntersect = exports.isBetween = exports.applyMatrix = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
function magnitude(v) {
    var sum = 0;
    util_1.each(v, function (value) {
        sum += value * value;
    });
    return Math.sqrt(sum);
}
function dotProduct2D(va, vb) {
    return va.x * vb.y + va.y * vb.x;
}
exports.dotProduct2D = dotProduct2D;
function angleTo(va, vb) {
    var magA = magnitude(va);
    var magB = magnitude(vb);
    var dot = dotProduct2D(va, vb);
    var angle = Math.acos(dot / magA / magB);
    return angle;
}
exports.angleTo = angleTo;
function crossProduct2D(va, vb) {
    var magA = magnitude(va);
    var magB = magnitude(vb);
    var dot = dotProduct2D(va, vb);
    var angle = Math.acos(dot / magA / magB);
    return magA * magB * Math.sin(angle);
}
exports.crossProduct2D = crossProduct2D;
function crossProduct3D(va, vb) {
    var ax = va.x, ay = va.y, az = va.z;
    var bx = vb.x, by = vb.y, bz = vb.z;
    var x = ay * bz - az * by;
    var y = az * bx - ax * bz;
    var z = ax * by - ay * bx;
    return { x: x, y: y, z: z };
}
exports.crossProduct3D = crossProduct3D;
function sub2D(va, vb) {
    return { x: va.x - vb.x, y: va.y - vb.y };
}
exports.sub2D = sub2D;
function applyMatrix(point, matrix, tag) {
    if (tag === void 0) { tag = 1; }
    var vector = [point.x, point.y, tag];
    matrix_util_1.vec3.transformMat3(vector, vector, matrix);
    return {
        x: vector[0],
        y: vector[1],
    };
}
exports.applyMatrix = applyMatrix;
function isBetween(value, min, max) {
    return value >= min && value <= max;
}
exports.isBetween = isBetween;
var tolerance = 0.001;
function getLineIntersect(p0, p1, p2, p3) {
    var E = {
        x: p2.x - p0.x,
        y: p2.y - p0.y,
    };
    var D0 = {
        x: p1.x - p0.x,
        y: p1.y - p0.y,
    };
    var D1 = {
        x: p3.x - p2.x,
        y: p3.y - p2.y,
    };
    var kross = D0.x * D1.y - D0.y * D1.x;
    var sqrKross = kross * kross;
    var sqrLen0 = D0.x * D0.x + D0.y * D0.y;
    var sqrLen1 = D1.x * D1.x + D1.y * D1.y;
    var point = null;
    if (sqrKross > tolerance * sqrLen0 * sqrLen1) {
        var s = (E.x * D1.y - E.y * D1.x) / kross;
        var t = (E.x * D0.y - E.y * D0.x) / kross;
        if (isBetween(s, 0, 1) && isBetween(t, 0, 1)) {
            point = {
                x: p0.x + s * D0.x,
                y: p0.y + s * D0.y,
            };
        }
    }
    return point;
}
exports.getLineIntersect = getLineIntersect;
function isPointInPolygon(p, polygon) {
    /** 射线法 */
    var inside = false;
    for (var i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
        var xi = polygon[i].x;
        var yi = polygon[i].y;
        var xj = polygon[j].x;
        var yj = polygon[j].y;
        var intersect = yi > p.y !== yj > p.y && p.x <= ((xj - xi) * (p.y - yi)) / (yj - yi) + xi;
        if (intersect) {
            inside = !inside;
        }
    }
    return inside;
}
exports.isPointInPolygon = isPointInPolygon;
function sqr(v) {
    return v * v;
}
function dist2(a, b) {
    return Math.sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}
exports.dist2 = dist2;
function distBetweenPoints(a, b) {
    return Math.sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}
exports.distBetweenPoints = distBetweenPoints;
function distBetweenPointLine(p, p1, p2) {
    var l2 = dist2(p1, p2);
    if (l2 === 0) {
        return dist2(p, p1);
    }
    var t = ((p.x - p1.x) * (p2.x - p1.x) + (p.y - p1.y) * (p2.y - p1.y)) / l2;
    t = Math.max(0, Math.min(1, t));
    var distSquare = dist2(p, { x: p1.x + t * (p2.x - p1.x), y: p1.y + t * (p2.y - p1.y) });
    return Math.sqrt(distSquare);
}
exports.distBetweenPointLine = distBetweenPointLine;
// todo：待优化 https://blog.csdn.net/WilliamSun0122/article/details/77994526
function minDistBetweenPointPolygon(p, polygon) {
    var min = Infinity;
    /** vertice to vertice */
    util_1.each(polygon, function (v) {
        var dist = Math.sqrt(dist2(v, p));
        if (min > dist) {
            min = dist;
        }
    });
    /** vertice to edge */
    for (var i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
        var xi = polygon[i].x;
        var yi = polygon[i].y;
        var xj = polygon[j].x;
        var yj = polygon[j].y;
        var dist = distBetweenPointLine(p, { x: xi, y: yi }, { x: xj, y: yj });
        if (min > dist) {
            min = dist;
        }
    }
    return min;
}
function isPolygonIntersection(polyA, polyB) {
    for (var _i = 0, polyA_1 = polyA; _i < polyA_1.length; _i++) {
        var p = polyA_1[_i];
        var inside = isPointInPolygon(p, polyB);
        if (inside) {
            return true;
        }
    }
    return false;
}
exports.isPolygonIntersection = isPolygonIntersection;
function minDistBetweenConvexPolygon(polyA, polyB) {
    if (isPolygonIntersection(polyA, polyB)) {
        return 0;
    }
    var minA = Infinity;
    var minB = Infinity;
    util_1.each(polyA, function (v) {
        var localMin = minDistBetweenPointPolygon(v, polyB);
        if (minA > localMin) {
            minA = localMin;
        }
    });
    util_1.each(polyB, function (v) {
        var localMin = minDistBetweenPointPolygon(v, polyA);
        if (minB > localMin) {
            minB = localMin;
        }
    });
    return Math.min(minA, minB);
}
exports.minDistBetweenConvexPolygon = minDistBetweenConvexPolygon;
function bboxOnRotate(shape) {
    var bbox = shape.getBBox();
    var x = bbox.minX;
    var y = bbox.minY;
    /*
     * step1: 获得旋转后的shape包围盒
     * 将包围盒对齐到原点，apply旋转矩阵
     * 移回原来的位置
     */
    var bboxWidth = bbox.maxX - bbox.minX;
    var bboxHeight = bbox.maxY - bbox.minY;
    // const matrix = shape.getTotalMatrix();
    var matrix = shape.attr('matrix');
    var ulMatrix;
    if (matrix) {
        ulMatrix = [matrix[0], matrix[1], 0, matrix[3], matrix[4], 0, 0, 0, 1];
    }
    else {
        ulMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    }
    var top_left = applyMatrix({ x: 0, y: 0 }, ulMatrix);
    top_left.x += x;
    top_left.y += y;
    var top_right = applyMatrix({ x: bboxWidth, y: 0 }, ulMatrix);
    top_right.x += x;
    top_right.y += y;
    var bottom_left = applyMatrix({ x: 0, y: bboxHeight }, ulMatrix);
    bottom_left.x += x;
    bottom_left.y += y;
    var bottom_right = applyMatrix({ x: bboxWidth, y: bboxHeight }, ulMatrix);
    bottom_right.x += x;
    bottom_right.y += y;
    /** step2：根据旋转后的画布位置重新计算包围盒，以免图形进行旋转后上下颠倒 */
    var points = [top_left, top_right, bottom_left, bottom_right];
    points.sort(function (a, b) {
        return a.y - b.y;
    });
    var minY = points[0].y;
    var maxY = points[points.length - 1].y;
    var tops = [points[0], points[1]];
    var bottoms = [points[2], points[3]];
    var topLeft = tops[0].x < tops[1].x ? tops[0] : tops[1];
    var topRight = tops[0].x < tops[1].x ? tops[1] : tops[0];
    var bottomLeft = bottoms[0].x < bottoms[1].x ? bottoms[0] : bottoms[1];
    var bottomRight = bottoms[0].x < bottoms[1].x ? bottoms[1] : bottoms[0];
    points.sort(function (a, b) {
        return a.x - b.x;
    });
    var minX = points[0].x;
    var maxX = points[points.length - 1].x;
    var node = {
        width: maxX - minX,
        height: maxY - minY,
        left: minX,
        right: maxX,
        top: minY,
        bottom: maxY,
        topLeft: topLeft,
        topRight: topRight,
        bottomLeft: bottomLeft,
        bottomRight: bottomRight,
        centerX: minX + (maxX - minX) / 2,
        centerY: minY + (maxY - minY) / 2,
    };
    return node;
}
exports.bboxOnRotate = bboxOnRotate;
/**
 * 线简化算法
 */
var THRESHOLD = 2;
function lineSimplification(points) {
    if (points.length < 5) {
        return points;
    }
    return DouglasPeucker(points, THRESHOLD);
}
exports.lineSimplification = lineSimplification;
// https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
function DouglasPeucker(points, threshold) {
    var result;
    var max = -Infinity;
    var index = 0;
    var endIndex = points.length - 1;
    for (var i = 1; i < endIndex; i++) {
        var point = points[i];
        var line = { start: points[0], end: points[endIndex] };
        var dist = distBetweenPointLine(point, line.start, line.end);
        if (dist > max) {
            max = dist;
            index = i;
        }
    }
    if (max > threshold) {
        var list1 = DouglasPeucker(points.slice(0, index + 1), threshold);
        var list2 = DouglasPeucker(points.slice(index, points.length), threshold);
        result = list1.concat(list2);
    }
    else {
        result = [points[0], points[points.length - 1]];
    }
    return result;
}
/** 统计的以后迁出去，暂时先放这里 */
function getMedian(array) {
    var list = util_1.clone(array);
    list.sort(function (a, b) {
        return a - b;
    });
    var half = Math.floor(list.length / 2);
    if (list.length % 2) {
        return list[half];
    }
    return (list[half - 1] + list[half]) / 2.0;
}
exports.getMedian = getMedian;
function getMean(array) {
    var sum = 0;
    util_1.each(array, function (num) {
        sum += num;
    });
    return sum / array.length;
}
exports.getMean = getMean;
function sturges(values) {
    return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
}
exports.sturges = sturges;
/**
 * 获取 x/y/width/height指定的BBox边界上的所有点，由step抽样
 * @param x
 * @param y
 * @param width
 * @param height
 * @param step
 */
function getStrokePoints(x, y, width, height, step) {
    if (step === void 0) { step = 2; }
    var points = [];
    // top
    for (var curX = x; curX <= x + width; curX += step) {
        points.push([curX, y]);
    }
    // right
    for (var curY = y; curY <= y + height; curY += step) {
        points.push([x + width, curY]);
    }
    // bottom
    for (var curX = x + width; curX >= x; curX -= step) {
        points.push([curX, y + height]);
    }
    // left
    for (var curY = y + height; curY >= y; curY -= step) {
        points.push([x, curY]);
    }
    return points;
}
exports.getStrokePoints = getStrokePoints;

},{"@antv/matrix-util":717,"@antv/util":803}],681:[function(require,module,exports){
"use strict";
/**
 * @description path 计算、转换的辅助工具
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPolarPath = exports.convertNormalPath = exports.getPointAngle = exports.getPointRadius = exports.getSplinePath = exports.getLinePath = exports.catmullRom2bezier = exports.smoothBezier = void 0;
var matrix_util_1 = require("@antv/matrix-util");
var util_1 = require("@antv/util");
function _points2path(points, isInCircle) {
    var path = [];
    if (points.length) {
        for (var i = 0, length_1 = points.length; i < length_1; i += 1) {
            var item = points[i];
            var command = i === 0 ? 'M' : 'L';
            path.push([command, item.x, item.y]);
        }
        if (isInCircle) {
            path.push(['Z']);
        }
    }
    return path;
}
function _getPointRadius(coord, point) {
    var center = coord.getCenter();
    var r = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2));
    return r;
}
function _convertArr(arr, coord) {
    var tmp = [arr[0]];
    for (var i = 1, len = arr.length; i < len; i = i + 2) {
        var point = coord.convertPoint({
            x: arr[i],
            y: arr[i + 1],
        });
        tmp.push(point.x, point.y);
    }
    return tmp;
}
function _convertPolarPath(pre, cur, coord) {
    var isTransposed = coord.isTransposed, startAngle = coord.startAngle, endAngle = coord.endAngle;
    var prePoint = {
        x: pre[1],
        y: pre[2],
    };
    var curPoint = {
        x: cur[1],
        y: cur[2],
    };
    var rst = [];
    var xDim = isTransposed ? 'y' : 'x';
    var angleRange = Math.abs(curPoint[xDim] - prePoint[xDim]) * (endAngle - startAngle);
    var direction = curPoint[xDim] >= prePoint[xDim] ? 1 : 0; // 圆弧的方向
    var flag = angleRange > Math.PI ? 1 : 0; // 大弧还是小弧标志位
    var convertPoint = coord.convertPoint(curPoint);
    var r = _getPointRadius(coord, convertPoint);
    if (r >= 0.5) {
        // 小于1像素的圆在图像上无法识别
        if (angleRange === Math.PI * 2) {
            var middlePoint = {
                x: (curPoint.x + prePoint.x) / 2,
                y: (curPoint.y + prePoint.y) / 2,
            };
            var middleConvertPoint = coord.convertPoint(middlePoint);
            rst.push(['A', r, r, 0, flag, direction, middleConvertPoint.x, middleConvertPoint.y]);
            rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
        }
        else {
            rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
        }
    }
    return rst;
}
// 当存在整体的圆时，去除圆前面和后面的线，防止出现直线穿过整个圆的情形
function _filterFullCirleLine(path) {
    util_1.each(path, function (subPath, index) {
        var cur = subPath;
        if (cur[0].toLowerCase() === 'a') {
            var pre = path[index - 1];
            var next = path[index + 1];
            if (next && next[0].toLowerCase() === 'a') {
                if (pre && pre[0].toLowerCase() === 'l') {
                    pre[0] = 'M';
                }
            }
            else if (pre && pre[0].toLowerCase() === 'a') {
                if (next && next[0].toLowerCase() === 'l') {
                    next[0] = 'M';
                }
            }
        }
    });
}
exports.smoothBezier = function (points, smooth, isLoop, constraint) {
    var cps = [];
    var prevPoint;
    var nextPoint;
    var hasConstraint = !!constraint;
    var min;
    var max;
    if (hasConstraint) {
        min = [Infinity, Infinity];
        max = [-Infinity, -Infinity];
        for (var i = 0, l = points.length; i < l; i++) {
            var point = points[i];
            min = matrix_util_1.vec2.min([0, 0], min, point);
            max = matrix_util_1.vec2.max([0, 0], max, point);
        }
        min = matrix_util_1.vec2.min([0, 0], min, constraint[0]);
        max = matrix_util_1.vec2.max([0, 0], max, constraint[1]);
    }
    for (var i = 0, len = points.length; i < len; i++) {
        var point = points[i];
        if (isLoop) {
            prevPoint = points[i ? i - 1 : len - 1];
            nextPoint = points[(i + 1) % len];
        }
        else {
            if (i === 0 || i === len - 1) {
                cps.push(point);
                continue;
            }
            else {
                prevPoint = points[i - 1];
                nextPoint = points[i + 1];
            }
        }
        var v = [0, 0];
        v = matrix_util_1.vec2.sub(v, nextPoint, prevPoint);
        v = matrix_util_1.vec2.scale(v, v, smooth);
        var d0 = matrix_util_1.vec2.distance(point, prevPoint);
        var d1 = matrix_util_1.vec2.distance(point, nextPoint);
        var sum = d0 + d1;
        if (sum !== 0) {
            d0 /= sum;
            d1 /= sum;
        }
        var v1 = matrix_util_1.vec2.scale([0, 0], v, -d0);
        var v2 = matrix_util_1.vec2.scale([0, 0], v, d1);
        var cp0 = matrix_util_1.vec2.add([0, 0], point, v1);
        var cp1 = matrix_util_1.vec2.add([0, 0], point, v2);
        if (hasConstraint) {
            cp0 = matrix_util_1.vec2.max([0, 0], cp0, min);
            cp0 = matrix_util_1.vec2.min([0, 0], cp0, max);
            cp1 = matrix_util_1.vec2.max([0, 0], cp1, min);
            cp1 = matrix_util_1.vec2.min([0, 0], cp1, max);
        }
        cps.push(cp0);
        cps.push(cp1);
    }
    if (isLoop) {
        cps.push(cps.shift());
    }
    return cps;
};
// 贝塞尔曲线
function catmullRom2bezier(crp, z, constraint) {
    var isLoop = !!z;
    var pointList = [];
    for (var i = 0, l = crp.length; i < l; i += 2) {
        pointList.push([crp[i], crp[i + 1]]);
    }
    var controlPointList = exports.smoothBezier(pointList, 0.4, isLoop, constraint);
    var len = pointList.length;
    var d1 = [];
    var cp1;
    var cp2;
    var p;
    for (var i = 0; i < len - 1; i++) {
        cp1 = controlPointList[i * 2];
        cp2 = controlPointList[i * 2 + 1];
        p = pointList[i + 1];
        d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
    }
    if (isLoop) {
        cp1 = controlPointList[len];
        cp2 = controlPointList[len + 1];
        p = pointList[0];
        d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
    }
    return d1;
}
exports.catmullRom2bezier = catmullRom2bezier;
// 将点连接成路径 path
function getLinePath(points, isInCircle) {
    return _points2path(points, isInCircle);
}
exports.getLinePath = getLinePath;
// get spline： 限定了范围的平滑线
function getSplinePath(points, isInCircle, constaint) {
    var data = [];
    var first = points[0];
    var prePoint = null;
    if (points.length <= 2) {
        // 两点以内直接绘制成路径
        return getLinePath(points, isInCircle);
    }
    util_1.each(points, function (point) {
        if (!prePoint || !(prePoint.x === point.x && prePoint.y === point.y)) {
            data.push(point.x);
            data.push(point.y);
            prePoint = point;
        }
    });
    var constraint = constaint || [
        // 范围
        [0, 0],
        [1, 1],
    ];
    var splinePath = catmullRom2bezier(data, isInCircle, constraint);
    splinePath.unshift(['M', first.x, first.y]);
    return splinePath;
}
exports.getSplinePath = getSplinePath;
// 获取点到圆心的距离
function getPointRadius(coord, point) {
    return _getPointRadius(coord, point);
}
exports.getPointRadius = getPointRadius;
// 获取点到圆心的夹角
function getPointAngle(coord, point) {
    var center = coord.getCenter();
    return Math.atan2(point.y - center.y, point.x - center.x);
}
exports.getPointAngle = getPointAngle;
function convertNormalPath(coord, path) {
    var tmp = [];
    util_1.each(path, function (subPath) {
        var action = subPath[0];
        switch (action.toLowerCase()) {
            case 'm':
            case 'l':
            case 'c':
                tmp.push(_convertArr(subPath, coord));
                break;
            case 'z':
            default:
                tmp.push(subPath);
                break;
        }
    });
    return tmp;
}
exports.convertNormalPath = convertNormalPath;
function convertPolarPath(coord, path) {
    var tmp = [];
    var pre;
    var cur;
    var transposed;
    var equals;
    util_1.each(path, function (subPath, index) {
        var action = subPath[0];
        switch (action.toLowerCase()) {
            case 'm':
            case 'c':
            case 'q':
                tmp.push(_convertArr(subPath, coord));
                break;
            case 'l':
                pre = path[index - 1];
                cur = subPath;
                transposed = coord.isTransposed;
                // 是否半径相同，转换成圆弧
                equals = transposed ? pre[pre.length - 2] === cur[1] : pre[pre.length - 1] === cur[2];
                if (equals) {
                    tmp = tmp.concat(_convertPolarPath(pre, cur, coord));
                }
                else {
                    // y 不相等，所以直接转换
                    tmp.push(_convertArr(subPath, coord));
                }
                break;
            case 'z':
            default:
                tmp.push(subPath);
                break;
        }
    });
    _filterFullCirleLine(tmp); // 过滤多余的直线
    return tmp;
}
exports.convertPolarPath = convertPolarPath;

},{"@antv/matrix-util":717,"@antv/util":803}],682:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var shape_nodes_1 = tslib_1.__importDefault(require("../node/shape-nodes"));
var responsive_1 = tslib_1.__importDefault(require("../responsive"));
var base_1 = tslib_1.__importDefault(require("./base"));
var SCALE_MAPPER = {
    cat: 'category',
    timeCat: 'category',
    time: 'dateTime',
    linear: 'linear',
};
var ApplyResponsiveAxis = /** @class */ (function (_super) {
    tslib_1.__extends(ApplyResponsiveAxis, _super);
    function ApplyResponsiveAxis() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ApplyResponsiveAxis.prototype.init = function () {
        this.axisInstance = this.getAxisInstance();
        _super.prototype.init.call(this);
    };
    ApplyResponsiveAxis.prototype.shouldApply = function () {
        var options = this.plot.options;
        if (!this.responsiveTheme.axis) {
            return false;
        }
        if (this.responsiveTheme.axis[this.dim] &&
            options[this.dim + "Axis"].visible &&
            options[this.dim + "Axis"].label &&
            options[this.dim + "Axis"].label.visible) {
            return true;
        }
        return false;
    };
    ApplyResponsiveAxis.prototype.apply = function () {
        var _this = this;
        var rawLabels = this.plot.view.backgroundGroup.findAll(function (el) {
            var name = el.get('name');
            if (name === 'axis-label') {
                var field = el.get('delegateObject').axis.get('field');
                if (field === _this.plot.options[_this.dim + "Field"]) {
                    return el;
                }
            }
        });
        var shapes = [];
        for (var i = 0; i < rawLabels.length; i++) {
            shapes.push(rawLabels[i]);
        }
        var shapeNodes = new shape_nodes_1.default({
            shapes: shapes,
        });
        var _a = this.responsiveTheme.axis.x[this.type], constraints = _a.constraints, rules = _a.rules;
        new responsive_1.default({
            nodes: shapeNodes,
            constraints: constraints,
            region: this.plot.getViewRange(),
            rules: rules,
            plot: this.plot,
            onEnd: function (nodes) {
                _this.updateTicks(nodes.origion_nodes);
            },
        });
    };
    ApplyResponsiveAxis.prototype.getType = function () {
        var props = this.plot.options;
        var axis = this.dim + "Axis";
        var field = this.dim + "Field";
        if (props[axis] && props[axis].type && props[axis].type === 'dateTime') {
            return 'dateTime';
        }
        var scaleType = this.plot.view.getScaleByField([props[field]]).type;
        return SCALE_MAPPER[scaleType];
    };
    ApplyResponsiveAxis.prototype.getAxisInstance = function () {
        var _a, _b;
        var axisIndex = this.dim === 'x' ? 0 : 1;
        var components = (_a = this.plot.view.getController('axis')) === null || _a === void 0 ? void 0 : _a.getComponents();
        if (components) {
            return (_b = components[axisIndex]) === null || _b === void 0 ? void 0 : _b.component;
        }
    };
    ApplyResponsiveAxis.prototype.updateTicks = function (nodes) {
        var _this = this;
        var tickLineContainer = this.plot.view.backgroundGroup.findAll(function (el) {
            var name = el.get('name');
            if (name === 'axis-tickline-group') {
                var field = el.get('delegateObject').axis.get('field');
                if (field === _this.plot.options[_this.dim + "Field"]) {
                    return el;
                }
            }
        })[0];
        if (tickLineContainer) {
            var tickShapes_1 = tickLineContainer.get('children');
            util_1.each(nodes, function (n, index) {
                if (n.shape.attr('text') === '') {
                    tickShapes_1[index].attr('opacity', 0);
                }
            });
        }
        this.plot.canvas.draw();
    };
    return ApplyResponsiveAxis;
}(base_1.default));
exports.default = ApplyResponsiveAxis;

},{"../node/shape-nodes":694,"../responsive":695,"./base":683,"@antv/util":803,"tslib":894}],683:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var ApplyResponsive = /** @class */ (function () {
    function ApplyResponsive(cfg) {
        util_1.assign(this, cfg);
        this.init();
    }
    ApplyResponsive.prototype.init = function () {
        this.type = this.getType();
        if (this.shouldApply()) {
            this.apply();
        }
    };
    return ApplyResponsive;
}());
exports.default = ApplyResponsive;

},{"@antv/util":803}],684:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var shape_nodes_1 = tslib_1.__importDefault(require("../node/shape-nodes"));
var responsive_1 = tslib_1.__importDefault(require("../responsive"));
var base_1 = tslib_1.__importDefault(require("./base"));
var util_1 = require("@antv/util");
var ApplyResponsiveLabel = /** @class */ (function (_super) {
    tslib_1.__extends(ApplyResponsiveLabel, _super);
    function ApplyResponsiveLabel() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ApplyResponsiveLabel.prototype.shouldApply = function () {
        if (!this.responsiveTheme.label || !this.responsiveTheme.label[this.type]) {
            return false;
        }
        return true;
    };
    ApplyResponsiveLabel.prototype.apply = function () {
        var labelShapesContainer = this.plot.view.geometries[0].labelsContainer.get('children');
        var labelShapes = [];
        util_1.each(labelShapesContainer, function (c) {
            labelShapes = labelShapes.concat(c.findAllByName('label'));
        });
        var nodes = new shape_nodes_1.default({
            shapes: labelShapes,
        });
        var _a = this.responsiveTheme.label[this.type], constraints = _a.constraints, rules = _a.rules;
        new responsive_1.default({
            nodes: nodes,
            constraints: constraints,
            rules: rules,
            plot: this.plot,
            region: this.plot.view.coordinateBBox,
        });
    };
    ApplyResponsiveLabel.prototype.getType = function () {
        return null;
    };
    return ApplyResponsiveLabel;
}(base_1.default));
exports.default = ApplyResponsiveLabel;

},{"../node/shape-nodes":694,"../responsive":695,"./base":683,"@antv/util":803,"tslib":894}],685:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function columnWidth(node, region, cfg) {
    if (cfg === void 0) { cfg = { ratio: 0.6 }; }
    return region.width * cfg.ratio;
}
exports.default = {
    type: 'padding',
    usage: 'assign',
    expression: columnWidth,
};

},{}],686:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var MathUtil = tslib_1.__importStar(require("../../math"));
function elementCollision(a, b) {
    var polygonA = [a.topLeft, a.topRight, a.bottomRight, a.bottomLeft]; // 顶点顺时针
    var polygonB = [b.topLeft, b.topRight, b.bottomRight, b.bottomLeft];
    var dist = MathUtil.minDistBetweenConvexPolygon(polygonA, polygonB);
    return Math.round(dist) >= 2;
}
exports.default = {
    type: 'group',
    usage: 'compare',
    expression: elementCollision,
};

},{"../../math":680,"tslib":894}],687:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function elementDistVertical(a, b, cfg) {
    if (cfg === void 0) { cfg = { value: 5 }; }
    var dist = Math.abs(a.bottom - b.top);
    return Math.round(dist) >= cfg.value;
}
exports.default = {
    type: 'chain',
    usage: 'compare',
    expression: elementDistVertical,
};

},{}],688:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var MathUtil = tslib_1.__importStar(require("../../math"));
function elementDist(a, b, cfg) {
    if (cfg === void 0) { cfg = { value: 4 }; }
    var polygonA = [a.topLeft, a.topRight, a.bottomRight, a.bottomLeft]; // 顶点顺时针
    var polygonB = [b.topLeft, b.topRight, b.bottomRight, b.bottomLeft];
    var dist = MathUtil.minDistBetweenConvexPolygon(polygonA, polygonB);
    return Math.round(dist) >= cfg.value;
}
exports.default = {
    type: 'chain',
    usage: 'compare',
    expression: elementDist,
};

},{"../../math":680,"tslib":894}],689:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function elementWidth(node, region, cfg) {
    if (cfg === void 0) { cfg = { ratio: 0.15 }; }
    return node.width < region.width * cfg.ratio;
}
exports.default = {
    type: 'padding',
    usage: 'compare',
    expression: elementWidth,
};

},{}],690:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerResponsiveConstraint = exports.constraintsLib = void 0;
var tslib_1 = require("tslib");
var column_width_1 = tslib_1.__importDefault(require("./column-width"));
var element_collision_1 = tslib_1.__importDefault(require("./element-collision"));
var element_dist_1 = tslib_1.__importDefault(require("./element-dist"));
var element_dist_vertical_1 = tslib_1.__importDefault(require("./element-dist-vertical"));
var element_width_1 = tslib_1.__importDefault(require("./element-width"));
var min_ring_thickness_1 = tslib_1.__importDefault(require("./min-ring-thickness"));
var ring_thickness_1 = tslib_1.__importDefault(require("./ring-thickness"));
exports.constraintsLib = {
    elementDist: element_dist_1.default,
    elementDistVertical: element_dist_vertical_1.default,
    elementCollision: element_collision_1.default,
    elementWidth: element_width_1.default,
    columnWidth: column_width_1.default,
    ringThickness: ring_thickness_1.default,
    minRingThickness: min_ring_thickness_1.default,
};
function registerResponsiveConstraint(name, constraint) {
    // todo: 防止覆盖
    exports.constraintsLib[name] = constraint;
}
exports.registerResponsiveConstraint = registerResponsiveConstraint;

},{"./column-width":685,"./element-collision":686,"./element-dist":688,"./element-dist-vertical":687,"./element-width":689,"./min-ring-thickness":691,"./ring-thickness":692,"tslib":894}],691:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function minRingThickness(node, region) {
    var minThicknessPixel = 2;
    var minThickness = region.coord.radius / minThicknessPixel;
    return Math.min(minThickness, node.value);
}
exports.default = {
    type: 'padding',
    usage: 'assign',
    expression: minRingThickness,
};

},{}],692:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function ringThickness(node, region, cfg) {
    if (cfg === void 0) { cfg = { ratio: 0.8 }; }
    return region.radius * cfg.ratio;
}
exports.default = {
    type: 'padding',
    usage: 'assign',
    expression: ringThickness,
};

},{}],693:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_RESPONSIVE_THEME = void 0;
// 存储一些共用部分
exports.DEFAULT_RESPONSIVE_THEME = {
    axis: {
        x: {
            category: {
                constraints: [{ name: 'elementDist' }],
                rules: {
                    elementDist: [
                        {
                            name: 'textWrapper',
                            option: {
                                lineNumber: 2,
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 45,
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 90,
                            },
                        },
                        {
                            name: 'textAbbreviate',
                            option: {
                                abbreviateBy: 'end',
                            },
                        },
                        {
                            name: 'textHide',
                        },
                    ],
                },
            },
            linear: {
                constraints: [{ name: 'elementDist' }],
                rules: {
                    elementDist: [
                        {
                            name: 'nodesResampling',
                            option: {
                                keep: ['end'],
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 45,
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 90,
                            },
                        },
                        {
                            name: 'robustAbbrevaite',
                            option: {
                                unit: 'thousand',
                                decimal: 1,
                                abbreviateBy: 'end',
                            },
                        },
                        {
                            name: 'textHide',
                        },
                    ],
                },
            },
            dateTime: {
                constraints: [{ name: 'elementDist' }],
                rules: {
                    elementDist: [
                        {
                            name: 'datetimeStringAbbrevaite',
                        },
                        {
                            name: 'nodesResamplingByAbbrevate',
                            option: {
                                keep: ['end'],
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 45,
                            },
                        },
                        {
                            name: 'textRotation',
                            option: {
                                degree: 90,
                            },
                        },
                        {
                            name: 'nodesResampling',
                        },
                        {
                            name: 'nodesResampling',
                        },
                        {
                            name: 'textHide',
                        },
                    ],
                },
            },
        },
        y: {
            linear: {
                constraints: [{ name: 'elementDistVertical' }, { name: 'elementWidth' }],
                rules: {
                    elementDistVertical: [{ name: 'nodesResampling' }, { name: 'textHide' }],
                    elementWidth: [{ name: 'digitsAbbreviate' }, { name: 'textHide' }],
                },
            },
            category: {
                constraints: [{ name: 'elementDistVertical' }, { name: 'elementWidth' }],
                rules: {
                    elementDistVertical: [{ name: 'nodesResampling' }, { name: 'textHide' }],
                    elementWidth: [
                        {
                            name: 'textAbbreviate',
                            option: {
                                abbreviateBy: 'end',
                            },
                        },
                        { name: 'textHide' },
                    ],
                },
            },
        },
    },
};

},{}],694:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var MathUtil = tslib_1.__importStar(require("../../math"));
var ShapeNodes = /** @class */ (function () {
    function ShapeNodes(cfg) {
        this.type = 'shape';
        this.shapes = cfg.shapes;
        this.nodes = [];
        this._parserNodes();
        this.origion_nodes = util_1.deepMix([], this.nodes);
    }
    ShapeNodes.prototype.measure = function (shape) {
        var node = util_1.deepMix({}, MathUtil.bboxOnRotate(shape), { shape: shape });
        return node;
    };
    ShapeNodes.prototype.measureNodes = function () {
        var _this = this;
        var nodes = [];
        var shapes = [];
        util_1.each(this.shapes, function (shape, index) {
            var node = util_1.deepMix({}, _this.nodes[index], _this.measure(shape));
            if (node.width !== 0 && node.height !== 0) {
                nodes.push(node);
                shapes.push(shape);
            }
            // this.nodes[index] = node;
        });
        this.nodes = nodes;
        this.shapes = shapes;
    };
    ShapeNodes.prototype._parserNodes = function () {
        var _this = this;
        util_1.each(this.shapes, function (shape) {
            var node = _this.measure(shape);
            _this.nodes.push(node);
        });
    };
    return ShapeNodes;
}());
exports.default = ShapeNodes;

},{"../../math":680,"@antv/util":803,"tslib":894}],695:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var index_1 = require("./constraints/index");
var index_2 = require("./rules/index");
var Responsive = /** @class */ (function () {
    function Responsive(cfg) {
        this.iterationTime = 10;
        this.iterationIndex = 0;
        this.rulesLocker = [];
        this.constraintIndex = 0;
        util_1.assign(this, cfg);
        this.currentConstraint = this.constraints[0];
        if (this.rules) {
            this.iterationTime = this.rules[this.currentConstraint.name].length;
        }
        this._start();
        this._run();
        this._end();
    }
    Responsive.prototype._start = function () {
        if (this.onStart) {
            this.onStart(this.nodes);
        }
    };
    Responsive.prototype._iteration = function () {
        var nodes;
        if (this.nodes.type === 'shape') {
            nodes = this.nodes;
        }
        else {
            nodes = this.nodes;
        }
        if (nodes.type === 'shape') {
            nodes.measureNodes();
        }
        if (this.rules) {
            this._applyRules();
        }
        if (nodes.type === 'shape') {
            nodes.measureNodes();
        }
        if (this.onIteration) {
            this.onIteration(this.nodes);
        }
    };
    Responsive.prototype._end = function () {
        if (this.onEnd) {
            this.onEnd(this.nodes);
        }
    };
    Responsive.prototype._run = function () {
        var constraintPassed = this._constraintsTest();
        while (!constraintPassed) {
            if (this.iterationIndex > this.iterationTime - 1) {
                break;
            }
            this._iteration();
            constraintPassed = this._constraintsTest();
            this.iterationIndex++;
        }
        if (this.constraintIndex < this.constraints.length - 1) {
            this.constraintIndex++;
            this.currentConstraint = this.constraints[this.constraintIndex];
            this.iterationTime = this.rules ? this.rules[this.currentConstraint.name].length : 1;
            this.iterationIndex = 0;
            this._run();
        }
    };
    Responsive.prototype._constraintsTest = function () {
        var constraint = index_1.constraintsLib[this.currentConstraint.name];
        var constraintOption = this.currentConstraint.option;
        if (constraint.usage === 'compare') {
            return this._constraintCompare(constraint, constraintOption);
        }
        return this._constraintAssignment(constraint, constraintOption);
    };
    Responsive.prototype._constraintCompare = function (constraint, option) {
        var type = constraint.type, expression = constraint.expression;
        var nodes = this.nodes.nodes;
        if (type === 'chain') {
            return this._chainConstraintCompare(expression, nodes, option);
        }
        if (type === 'padding') {
            return this._paddingConstraintCompare(expression, this.region, nodes, option);
        }
        if (type === 'group') {
            return this._groupConstraintCompare(expression, nodes, option);
        }
    };
    Responsive.prototype._chainConstraintCompare = function (expression, nodes, option) {
        for (var i = 0; i < nodes.length - 1; i++) {
            var a = nodes[i];
            var b = nodes[i + 1];
            if (expression(a, b, option) === false) {
                return false;
            }
        }
        return true;
    };
    Responsive.prototype._paddingConstraintCompare = function (expression, region, nodes, option) {
        if (region) {
            for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
                var node = nodes_1[_i];
                if (expression(node, region, option) === false) {
                    return false;
                }
            }
        }
        return true;
    };
    Responsive.prototype._groupConstraintCompare = function (expression, nodes, option) {
        for (var i = 0; i < nodes.length; i++) {
            var a = nodes[i];
            for (var j = 0; j < nodes.length; j++) {
                if (j !== i) {
                    var b = nodes[j];
                    if (expression(a, b, option) === false) {
                        return false;
                    }
                }
            }
        }
        return true;
    };
    Responsive.prototype._constraintAssignment = function (constraint, option) {
        var type = constraint.type, expression = constraint.expression;
        var nodes = this.nodes.nodes;
        if (type === 'chain') {
            return this._chainConstraintAssign();
        }
        if (type === 'padding') {
            return this._paddingConstraintAssign(expression, this.region, nodes, option);
        }
    };
    Responsive.prototype._chainConstraintAssign = function () {
        return true;
    };
    Responsive.prototype._paddingConstraintAssign = function (expression, region, nodes, option) {
        if (region) {
            for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
                var node = nodes_2[_i];
                var value = expression(node, region, option);
                node.value = value;
            }
        }
        return true;
    };
    Responsive.prototype._applyRules = function () {
        var ruleCfg = this.rules[this.currentConstraint.name][this.iterationIndex];
        // if (this.rulesLocker.indexOf(ruleCfg) < 0) {
        var rule = index_2.rulesLib[ruleCfg.name];
        var option = ruleCfg.option ? ruleCfg.option : {};
        var nodes = this.nodes.nodes;
        for (var i = 0; i < nodes.length; i++) {
            var node = nodes[i];
            /** apply rule上下文 */
            this._applyRule(node.shape, rule, option, i);
        }
        // this.rulesLocker.push(ruleCfg);
        // }
    };
    Responsive.prototype._applyRule = function (shape, rule, option, index) {
        var cfg = {
            nodes: this.nodes,
            region: this.region,
            plot: this.plot,
        };
        // rule(shape, option, index, this);
        rule(shape, option, index, cfg);
    };
    return Responsive;
}());
exports.default = Responsive;

},{"./constraints/index":690,"./rules/index":699,"@antv/util":803}],696:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNodeOverlap = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
function clearOverlapping(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    var current = nodes[index];
    var overlapped = [];
    /** 找到所有与当前点overlap的node */
    if (!current.shape.get('blank')) {
        for (var i = 0; i < nodes.length; i++) {
            var node = nodes[i];
            var _shape = node.shape;
            if (i !== index && !_shape.get('blank')) {
                var isOverlap = isNodeOverlap(current, node);
                if (isOverlap) {
                    overlapped.push(node);
                }
            }
        }
    }
    /** overlap处理逻辑 */
    if (overlapped.length > 0) {
        overlapped.push(current);
        overlapped.sort(function (a, b) {
            return b.top - a.top;
        });
        /** 隐藏除最高点以外的node */
        util_1.each(overlapped, function (node, idx) {
            if (idx > 0) {
                var _shape = node.shape;
                text_hide_1.default(_shape);
                _shape.set('blank', true);
            }
        });
    }
}
exports.default = clearOverlapping;
function isNodeOverlap(nodeA, nodeB) {
    if (nodeA.bottom < nodeB.top || nodeB.bottom < nodeA.top) {
        return false;
    }
    if (nodeA.right < nodeB.left || nodeB.right < nodeA.left) {
        return false;
    }
    return true;
}
exports.isNodeOverlap = isNodeOverlap;

},{"./text-hide":708,"@antv/util":803,"tslib":894}],697:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTime = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var fecha_1 = tslib_1.__importDefault(require("fecha"));
var SECOND = 1000;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var MONTH = 31 * DAY;
var YEAR = 365 * DAY;
function datetimeStringAbbrevaite(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    var campareText;
    if (index === nodes.length - 1) {
        campareText = nodes[index - 1].shape.get('delegateObject').item.name;
    }
    else {
        campareText = nodes[index + 1].shape.get('delegateObject').item.name;
    }
    var compare = new Date(campareText);
    /** 获取时间周期和时间间隔 */
    var text = shape.get('delegateObject').item.name;
    var current = new Date(text);
    var startText = nodes[0].shape.get('delegateObject').item.name;
    var start = new Date(startText);
    var endText = nodes[nodes.length - 1].shape.get('delegateObject').item.name;
    var end = new Date(endText);
    var timeDuration = getDateTimeMode(start, end);
    var timeCycle = getDateTimeMode(current, compare); // time frequency
    // 如果duration和frequency在同一区间
    if (timeDuration === timeCycle) {
        if (index !== 0 && index !== nodes.length - 1) {
            var formatter = sameSectionFormatter(timeDuration);
            shape.attr('text', fecha_1.default.format(current, formatter));
        }
        return;
    }
    if (index !== 0) {
        var previousText = nodes[index - 1].shape.get('delegateObject').item.name;
        var previous = new Date(previousText);
        var isAbbreviate = needAbbrevaite(timeDuration, current, previous);
        if (isAbbreviate) {
            var formatter = getAbbrevaiteFormatter(timeDuration, timeCycle);
            shape.attr('text', fecha_1.default.format(current, formatter));
            return;
        }
    }
}
exports.default = datetimeStringAbbrevaite;
function needAbbrevaite(mode, current, previous) {
    var currentStamp = getTime(current, mode);
    var previousStamp = getTime(previous, mode);
    if (currentStamp !== previousStamp) {
        return false;
    }
    return true;
}
function getDateTimeMode(a, b) {
    var mode;
    var dist = Math.abs(a - b);
    var mapper = {
        minute: [MINUTE, HOUR],
        hour: [HOUR, DAY],
        day: [DAY, MONTH],
        month: [MONTH, YEAR],
        year: [YEAR, Infinity],
    };
    util_1.each(mapper, function (range, key) {
        if (dist >= range[0] && dist < range[1]) {
            mode = key;
        }
    });
    return mode;
}
function getAbbrevaiteFormatter(duration, cycle) {
    var times = ['year', 'month', 'day', 'hour', 'minute'];
    var formatters = ['YYYY', 'MM', 'DD', 'HH', 'MM'];
    var startIndex = times.indexOf(duration) + 1;
    var endIndex = times.indexOf(cycle);
    var formatter = '';
    for (var i = startIndex; i <= endIndex; i++) {
        formatter += formatters[i];
        if (i < endIndex) {
            formatter += '-';
        }
    }
    return formatter;
}
function sameSectionFormatter(mode) {
    var times = ['year', 'month', 'day', 'hour', 'minute'];
    var formatters = ['YYYY', 'MM', 'DD', 'HH', 'MM'];
    var index = times.indexOf(mode);
    var formatter = formatters[index];
    return formatter;
}
function getTime(date, mode) {
    if (mode === 'year') {
        return date.getFullYear();
    }
    if (mode === 'month') {
        return date.getMonth() + 1;
    }
    if (mode === 'day') {
        return date.getDay() + 1;
    }
    if (mode === 'hour') {
        return date.getHours() + 1;
    }
    if (mode === 'minute') {
        return date.getMinutes() + 1;
    }
}
/*tslint:disable*/
function isTime(string) {
    var hourminExp = /^(?:(?:[0-2][0-3])|(?:[01]\d)):[0-5]\d$/;
    var hourminSecExp = /^(?:(?:[0-2][0-3])|(?:[01]\d))(?::[0-5]\d){2}$/;
    return hourminExp.test(string) || hourminSecExp.test(string);
}
exports.isTime = isTime;

},{"@antv/util":803,"fecha":881,"tslib":894}],698:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var math_1 = require("../../math");
var unitMapper = {
    k: { number: 1e3, index: 0 },
    m: { number: 1e6, index: 1 },
    b: { number: 1e9, index: 2 },
    t: { number: 1e12, index: 3 },
};
// https://gist.github.com/MartinMuzatko/1060fe584d17c7b9ca6e
// https://jburrows.wordpress.com/2014/11/18/abbreviating-numbers/
/*tslint:disable*/
function digitsAbbreviate(shape, option, index, cfg) {
    if (!util_1.has(cfg, 'node') || !util_1.has(cfg.node, 'node')) {
        return;
    }
    var nodes = cfg.nodes.nodes;
    var number = parseFloat(shape.get('origin').text);
    if (number === 0) {
        return;
    }
    if (option.formatter) {
        shape.attr('text', option.formatter(number));
        return;
    }
    if (option.unit) {
        var _a = abbravateDigitsByUnit(option, number), num = _a.num, unitname = _a.unitname;
        shape.attr('text', num + unitname);
    }
    else {
        // 自动换算逻辑
        // 根据中位数得到换算单位
        var numbers = extractNumbers(nodes);
        var median = math_1.getMedian(numbers);
        var unitname = getUnitByNumber(median);
        //根据数值的interval计算换算后保留的浮点数
        var unitNumber = unitMapper[unitname].number;
        var interval = getLinearNodesInterval(nodes);
        var decimal = getDigitsDecimal(interval, unitNumber);
        var num = abbravateDigitsByUnit({ unit: unitname, decimal: decimal }, number).num;
        shape.attr('text', num + unitname);
    }
}
exports.default = digitsAbbreviate;
function abbravateDigitsByUnit(option, number) {
    var units = ['k', 'm', 'b', 't'];
    var num;
    var unitname;
    if (option.unit === 'auto') {
        /** auto formatt k-m-b-t */
        var order = Math.floor(Math.log(number) / Math.log(1000));
        unitname = units[order - 1];
        num = (number / Math.pow(1000, order)).toFixed(option.decimal);
    }
    else if (option.unit) {
        var unit = unitMapper[option.unit];
        unitname = option.unit;
        num = (number / unit.number).toFixed(option.decimal);
    }
    return { num: num, unitname: unitname };
}
function getUnitByNumber(number) {
    var units = ['k', 'm', 'b', 't'];
    var order = Math.floor(Math.log(number) / Math.log(1000));
    return units[order - 1];
}
function extractNumbers(nodes) {
    var numbers = [];
    util_1.each(nodes, function (node) {
        var n = node;
        var number = parseFloat(n.shape.get('origin').text);
        numbers.push(number);
    });
    return numbers;
}
function getLinearNodesInterval(nodes) {
    if (nodes.length >= 2) {
        var a = parseFloat(nodes[0].shape.get('origin').text);
        var b = parseFloat(nodes[1].shape.get('origin').text);
        return Math.abs(a - b);
    }
    return 0;
}
function getDigitsDecimal(interval, unitNumber) {
    var unitBit = Math.floor(Math.log10(unitNumber));
    if (interval >= unitNumber) {
        var remainder = interval % unitNumber;
        if (remainder > 0) {
            var remainderBit = Math.floor(Math.log10(remainder));
            return Math.abs(remainderBit - unitBit);
        }
    }
    else {
        var intervalBit = Math.floor(Math.log10(interval));
        return Math.abs(intervalBit - unitBit);
    }
    return 0;
}

},{"../../math":680,"@antv/util":803}],699:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerResponsiveRule = exports.rulesLib = void 0;
var tslib_1 = require("tslib");
var clear_overlapping_1 = tslib_1.__importDefault(require("./clear-overlapping"));
var datetime_string_abbrevaite_1 = tslib_1.__importDefault(require("./datetime-string-abbrevaite"));
var digits_abbreviate_1 = tslib_1.__importDefault(require("./digits-abbreviate"));
var node_jitter_1 = tslib_1.__importDefault(require("./node-jitter"));
var node_jitter_upward_1 = tslib_1.__importDefault(require("./node-jitter-upward"));
var nodes_resampling_1 = tslib_1.__importDefault(require("./nodes-resampling"));
var nodes_resampling_by_abbrevate_1 = tslib_1.__importDefault(require("./nodes-resampling-by-abbrevate"));
var nodes_resampling_by_change_1 = tslib_1.__importDefault(require("./nodes-resampling-by-change"));
var nodes_resampling_by_state_1 = tslib_1.__importDefault(require("./nodes-resampling-by-state"));
var robust_abbrevaite_1 = tslib_1.__importDefault(require("./robust-abbrevaite"));
var text_abbreviate_1 = tslib_1.__importDefault(require("./text-abbreviate"));
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
var text_rotation_1 = tslib_1.__importDefault(require("./text-rotation"));
var text_wrapper_1 = tslib_1.__importDefault(require("./text-wrapper"));
exports.rulesLib = {
    textWrapper: text_wrapper_1.default,
    textRotation: text_rotation_1.default,
    textAbbreviate: text_abbreviate_1.default,
    textHide: text_hide_1.default,
    digitsAbbreviate: digits_abbreviate_1.default,
    datetimeStringAbbrevaite: datetime_string_abbrevaite_1.default,
    robustAbbrevaite: robust_abbrevaite_1.default,
    nodesResampling: nodes_resampling_1.default,
    nodesResamplingByAbbrevate: nodes_resampling_by_abbrevate_1.default,
    nodesResamplingByChange: nodes_resampling_by_change_1.default,
    nodesResamplingByState: nodes_resampling_by_state_1.default,
    nodeJitter: node_jitter_1.default,
    nodeJitterUpward: node_jitter_upward_1.default,
    clearOverlapping: clear_overlapping_1.default,
};
function registerResponsiveRule(name, method) {
    // todo: 防止覆盖
    exports.rulesLib[name] = method;
}
exports.registerResponsiveRule = registerResponsiveRule;

},{"./clear-overlapping":696,"./datetime-string-abbrevaite":697,"./digits-abbreviate":698,"./node-jitter":701,"./node-jitter-upward":700,"./nodes-resampling":705,"./nodes-resampling-by-abbrevate":702,"./nodes-resampling-by-change":703,"./nodes-resampling-by-state":704,"./robust-abbrevaite":706,"./text-abbreviate":707,"./text-hide":708,"./text-rotation":709,"./text-wrapper":710,"tslib":894}],700:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var clear_overlapping_1 = require("./clear-overlapping");
/** 图形向上抖开并拉线 */
// todo 允许设置offset和拉线样式
function nodeJitterUpward(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    if (index === 0) {
        return;
    }
    var current = nodes[index];
    var previous = nodes[index - 1];
    if (clear_overlapping_1.isNodeOverlap(current, previous)) {
        var element = cfg.plot.view.geometries[0].elements[0];
        var y = previous.top - current.height / 2;
        var offset = 10;
        if (y - offset > cfg.region.top) {
            // 取到label对应的element-shape
            var origin_1 = current.shape.get('origin');
            var shapeId = element.getShapeId(origin_1);
            var shapes = element.getShapes();
            var shapeBbox = getShapeById(shapeId, shapes).get('box');
            var originX = shapeBbox.left + shapeBbox.width / 2;
            var originY = shapeBbox.top;
            // 拉线
            var container = element.get('labelController').labelsContainer;
            var labelLine = container.addShape('path', {
                attrs: {
                    path: [
                        ['M', originX, originY],
                        ['L', current.shape.attr('x'), y],
                    ],
                    stroke: '#ccc',
                    lineWidth: 1,
                },
            });
            /** 保存labelLine和label初始位置信息 */
            var origin_position = { x: shape.attr('x'), y: shape.attr('y') };
            // 更新标签位置，同步更新node
            current.shape.attr('y', y - offset);
            nodes[index] = cfg.nodes.measure(current.shape);
            nodes[index].line = labelLine;
            nodes[index].origin_position = origin_position;
        }
    }
}
exports.default = nodeJitterUpward;
function getShapeById(shapeId, shapes) {
    var target;
    util_1.each(shapes, function (shape) {
        var s = shape;
        var id = s.get('id');
        if (id === shapeId) {
            target = s;
        }
    });
    return target;
}

},{"./clear-overlapping":696,"@antv/util":803}],701:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var math_1 = require("../../math");
/** 图形在水平或垂直方向抖开 */
function nodeJitter(shape, index, cfg) {
    var nodes = cfg.nodes.nodes;
    if (index === nodes.length - 1) {
        return;
    }
    var current = nodes[index];
    var next = nodes[index + 1];
    var dir = alignDirection(current, next).dir;
    var startPoint = shape.get('startPoint');
    if (dir === 'x') {
        shape.attr('y', startPoint.y + 20);
    }
}
exports.default = nodeJitter;
function alignDirection(nodeA, nodeB) {
    var dir;
    /** 计算两个node 中心点向量的角度 */
    var vector = { x: nodeB.centerX - nodeA.centerX, y: nodeB.centerY - nodeA.centerY };
    var mag = Math.sqrt(vector.x * vector.x + vector.y * vector.y);
    var vector_horizontal = { x: 10, y: 0 }; // 水平方向向量
    /*tslint:disable*/
    var mag_horizontal = Math.sqrt(vector_horizontal.x * vector_horizontal.x + vector_horizontal.y * vector_horizontal.y);
    var dot = math_1.dotProduct2D(vector, vector_horizontal);
    var angle = ((dot / (mag * mag_horizontal)) * 180) / Math.PI;
    if (angle < 0)
        angle = 360 - angle;
    angle = adjustAngle(angle); // 将角度从0-360转换到0-90
    /** 计算两个node在x、y两个方向上的距离 */
    var distX = Math.abs(nodeA.centerX - nodeB.centerX);
    var distY = Math.abs(nodeA.centerY - nodeB.centerY);
    if (angle > 45) {
        dir = 'x';
    }
    else if (angle < 45) {
        dir = 'y';
    }
    return { dir: dir, distX: distX, distY: distY };
}
function adjustAngle(angle) {
    if (angle > 90 && angle <= 180) {
        return 180 - angle;
    }
    if (angle > 180 && angle < 270) {
        return angle - 180;
    }
    return 360 - angle;
}

},{"../../math":680}],702:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var nodes_resampling_1 = require("./nodes-resampling");
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
function nodesResamplingByAbbrevate(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    if (nodes_resampling_1.isKeep(option.keep, index, nodes)) {
        return;
    }
    {
        var currentText = shape.attr('text');
        var originText = shape.get('delegateObject').item.name;
        if (currentText !== originText) {
            text_hide_1.default(shape);
        }
    }
}
exports.default = nodesResamplingByAbbrevate;

},{"./nodes-resampling":705,"./text-hide":708,"tslib":894}],703:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
/** 根据变化进行抽样，保留变化较大的点，类似于点简化算法 */
function nodesResamplingByChange(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    var tolerance = getGlobalTolerance(nodes);
    if (index <= 1) {
        return;
    }
    var current = nodes[index];
    // const previous = nodes[index-1];
    var previous = findPrevious(index, nodes);
    var distX = previous.centerX - current.centerX;
    var distY = previous.centerY - current.centerY;
    var dist = Math.sqrt(distX * distX + distY * distY);
    if (dist < tolerance) {
        text_hide_1.default(shape);
        shape.set('blank', true);
    }
}
exports.default = nodesResamplingByChange;
function findPrevious(index, nodes) {
    for (var i = index - 1; i > 0; i--) {
        var node = nodes[i];
        if (!node.shape.get('blank')) {
            return node;
        }
    }
}
function getGlobalTolerance(nodes) {
    var nodesClone = util_1.deepMix([], nodes);
    nodesClone.sort(function (a, b) {
        return b.width - a.width;
    });
    return Math.round(nodesClone[0].width);
}

},{"./text-hide":708,"@antv/util":803,"tslib":894}],704:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
function nodesResamplingByState(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    var current = nodes[index];
    if (current.line) {
        current.line.remove();
    }
    var data = cfg.plot.initialOptions.data;
    var plotCfg = cfg.plot[cfg.plot.type] || cfg.plot[cfg.plot.baseType];
    var field = util_1.get(plotCfg, ['label', 'fields', 0], util_1.get(plotCfg, ['position', 'fields', 1]));
    var stateNodes = getStateNodes(data, field, nodes);
    var isState = false;
    util_1.each(stateNodes, function (node) {
        // @ts-ignore
        if (node.shape.get('origin') === current.shape.get('origin')) {
            isState = true;
        }
    });
    if (isState) {
        if (current.origin_position) {
            var _a = current.origin_position, x = _a.x, y = _a.y;
            shape.attr('x', x);
            shape.attr('y', y);
        }
    }
    else {
        text_hide_1.default(shape);
    }
}
exports.default = nodesResamplingByState;
function getStateNodes(data, field, nodes) {
    var extract_data = [];
    util_1.each(data, function (d) {
        extract_data.push(d[field]);
    });
    extract_data.sort(function (a, b) {
        return a - b;
    });
    var min = extract_data[0];
    var min_node = getNodeByNumber(nodes, field, min);
    var max = extract_data[extract_data.length - 1];
    var max_node = getNodeByNumber(nodes, field, max);
    var median = getMedian(extract_data);
    var median_node = getNodeByNumber(nodes, field, median);
    return { min: min_node, max: max_node, median: median_node };
}
function getMedian(array) {
    var list = util_1.clone(array);
    list.sort(function (a, b) {
        return a - b;
    });
    var half = Math.floor(list.length / 2);
    if (list.length % 2) {
        return list[half];
    }
    return list[half];
}
function getNodeByNumber(nodes, field, num) {
    for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
        var node = nodes_1[_i];
        var d = node.shape.get('origin')['_origin'];
        if (d[field] === num) {
            return node;
        }
    }
}

},{"./text-hide":708,"@antv/util":803,"tslib":894}],705:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isKeep = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var text_hide_1 = tslib_1.__importDefault(require("./text-hide"));
function nodesResampling(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    /** nodeLength为偶数，则奇数index的shape保留，反之则偶数index的shape保留 */
    var oddKeep = nodes.length % 2 === 0 ? false : true;
    if (isKeep(option.keep, index, nodes)) {
        return;
    }
    {
        var isOdd = index % 2 === 0 ? true : false;
        if ((!oddKeep && isOdd) || (oddKeep && !isOdd)) {
            text_hide_1.default(shape);
        }
    }
}
exports.default = nodesResampling;
function isKeep(keepCfg, index, nodes) {
    /** 允许设置start end 或任意index */
    var conditions = [];
    util_1.each(keepCfg, function (cfg) {
        if (cfg === 'start') {
            conditions.push(index === 0);
        }
        else if (cfg === 'end') {
            conditions.push(index === nodes.length - 1);
        }
        else if (util_1.isNumber(cfg)) {
            conditions.push(index === cfg);
        }
    });
    for (var _i = 0, conditions_1 = conditions; _i < conditions_1.length; _i++) {
        var condition = conditions_1[_i];
        if (condition === true) {
            return true;
        }
    }
    return false;
}
exports.isKeep = isKeep;

},{"./text-hide":708,"@antv/util":803,"tslib":894}],706:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var datetime_string_abbrevaite_1 = tslib_1.__importStar(require("./datetime-string-abbrevaite"));
var digits_abbreviate_1 = tslib_1.__importDefault(require("./digits-abbreviate"));
var text_abbreviate_1 = tslib_1.__importDefault(require("./text-abbreviate"));
function robustAbbrevaite(shape, option, index, cfg) {
    var nodes = cfg.nodes.nodes;
    var text = shape.attr('text');
    /** 判断text类型： 数字、时间、文本 */
    var isnum = /^\d+$/.test(text);
    if (isnum) {
        digits_abbreviate_1.default(shape, option, index, nodes);
    }
    else if (datetime_string_abbrevaite_1.isTime(text)) {
        datetime_string_abbrevaite_1.default(shape, option, index, nodes);
    }
    else {
        text_abbreviate_1.default(shape, option);
    }
}
exports.default = robustAbbrevaite;

},{"./datetime-string-abbrevaite":697,"./digits-abbreviate":698,"./text-abbreviate":707,"tslib":894}],707:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textAbbreviate(shape, option) {
    var abbreviateBy = option.abbreviateBy ? option.abbreviateBy : 'end';
    var text = shape.attr('text');
    var abbravateText;
    if (abbreviateBy === 'end') {
        abbravateText = text[0] + "...";
    }
    if (abbreviateBy === 'start') {
        abbravateText = "..." + text[text.length - 1];
    }
    if (abbreviateBy === 'middle') {
        abbravateText = text[0] + "..." + text[text.length - 1];
    }
    shape.resetMatrix();
    shape.attr({
        text: abbravateText,
        textAlign: 'center',
        textBaseline: 'top',
    });
}
exports.default = textAbbreviate;

},{}],708:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textHide(shape) {
    shape.attr('text', '');
}
exports.default = textHide;

},{}],709:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textRotation(shape, option) {
    shape.resetMatrix();
    shape.attr({
        rotate: 360 - option.degree,
        textAlign: 'right',
        textBaseline: 'middle',
    });
}
exports.default = textRotation;

},{}],710:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textWrapper(shape, option) {
    var text = shape.attr('text');
    var step = Math.ceil(text.length / option.lineNumber);
    var wrapperText = '';
    for (var i = 1; i < option.lineNumber; i++) {
        var index = step * i;
        wrapperText = text.slice(0, index) + "\n" + text.slice(index);
    }
    var fontSize = shape.attr('fontSize');
    shape.attr({
        text: wrapperText,
        lineHeight: fontSize,
        textAlign: 'center',
        textBaseline: 'top',
    });
}
exports.default = textWrapper;

},{}],711:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResponsiveTheme = exports.registerResponsiveTheme = void 0;
var util_1 = require("@antv/util");
var default_1 = require("./default");
/**
 * 所有的响应式主题配置
 */
var RESPONSIVE_THEME_MAP = {
    default: default_1.DEFAULT_RESPONSIVE_THEME,
};
/**
 * 添加一个响应式主题配置
 * @param name
 * @param theme
 */
function registerResponsiveTheme(name, theme) {
    RESPONSIVE_THEME_MAP[name.toLowerCase()] = util_1.deepMix({}, default_1.DEFAULT_RESPONSIVE_THEME, theme);
}
exports.registerResponsiveTheme = registerResponsiveTheme;
/**
 * 获取一个响应式主题配置，如果找不到则返回默认
 * @param name
 */
function getResponsiveTheme(name) {
    var theme = RESPONSIVE_THEME_MAP[name.toLowerCase()];
    return theme ? theme : default_1.DEFAULT_RESPONSIVE_THEME;
}
exports.getResponsiveTheme = getResponsiveTheme;

},{"./default":693,"@antv/util":803}],712:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trySetScaleMinToZero = exports.extractScale = void 0;
var util_1 = require("@antv/util");
var config_1 = require("../interface/config");
function adjustTimeTickInterval(interval) {
    var intervals = config_1.timeIntervals;
    var intervalArr = interval.split(' ');
    var basicInterval = intervals[intervalArr[1]];
    var intervalCount = parseInt(intervalArr[0], 10);
    return [basicInterval.format, intervalCount * basicInterval.value];
}
function extractScale(desScale, axisConfig) {
    if (!axisConfig) {
        return desScale;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'tickCount')) {
        desScale.tickCount = axisConfig.tickCount;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'type')) {
        // fixme: dateTime plot层处理
        if (axisConfig.type !== 'dateTime') {
            desScale.type = axisConfig.type;
        }
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'tickInterval')) {
        if (axisConfig.type === 'time') {
            desScale.tickInterval = adjustTimeTickInterval(axisConfig.tickInterval);
        }
        else {
            desScale.tickInterval = axisConfig.tickInterval;
        }
    }
    if (axisConfig.type === 'time' && axisConfig.mask) {
        desScale.mask = axisConfig.mask;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'min')) {
        desScale.min = axisConfig.min;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'max')) {
        desScale.max = axisConfig.max;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'minLimit')) {
        desScale.minLimit = axisConfig.minLimit;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'maxLimit')) {
        desScale.maxLimit = axisConfig.maxLimit;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'nice')) {
        desScale.nice = axisConfig.nice;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'formatter')) {
        desScale.formatter = axisConfig.formatter;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'exponent')) {
        desScale.exponent = axisConfig.exponent;
    }
    if (Object.prototype.hasOwnProperty.call(axisConfig, 'base')) {
        desScale.base = axisConfig.base;
    }
    if (axisConfig.tickMethod) {
        desScale.tickMethod = axisConfig.tickMethod;
    }
}
exports.extractScale = extractScale;
function trySetScaleMinToZero(desScale, data) {
    var validData = util_1.filter(data, function (v) { return util_1.isNumber(v); });
    var min = Math.min.apply(Math, validData);
    var max = Math.max.apply(Math, validData);
    if (min > 0) {
        if (util_1.isNil(desScale.min)) {
            desScale.min = 0;
        }
    }
    else if (max < 0) {
        if (util_1.isNil(desScale.max)) {
            desScale.max = 0;
        }
    }
}
exports.trySetScaleMinToZero = trySetScaleMinToZero;

},{"../interface/config":449,"@antv/util":803}],713:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/**
 * 可插拔的状态量管理机
 */
// todo: 后续还需要加入交互互斥的维护机制
var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
var util_1 = require("@antv/util");
var StateManager = /** @class */ (function (_super) {
    tslib_1.__extends(StateManager, _super);
    function StateManager() {
        var _this = _super.call(this) || this;
        _this._states = {};
        _this._stateStack = {};
        return _this;
    }
    StateManager.prototype.setState = function (name, exp) {
        this._stateStack[name] = exp;
        this._onUpdate();
    };
    StateManager.prototype.getState = function (name) {
        return this._states[name];
    };
    StateManager.prototype.getAllStates = function () {
        return this._states;
    };
    StateManager.prototype.clear = function () {
        this._states = {};
        this._stateStack = {};
        if (this._changeTimer) {
            clearTimeout(this._changeTimer);
            this._changeTimer = null;
        }
    };
    StateManager.prototype._onUpdate = function () {
        var _this = this;
        var stateStack = this._stateStack;
        if (this._changeTimer) {
            clearTimeout(this._changeTimer);
            this._changeTimer = null;
        }
        this._changeTimer = setTimeout(function () {
            // for (const name in stateStack) {
            util_1.each(stateStack, function (exp, name) {
                var state = stateStack[name];
                if (!_this._states[name] || _this._states[name] !== exp) {
                    // update states
                    _this._states[name] = exp;
                    // dispatch state event
                    _this._triggerEvent(name, state);
                }
            });
            // }
            // clear stack
            _this._stateStack = {};
        }, 16);
    };
    StateManager.prototype._triggerEvent = function (name, exp) {
        this.emit(name + ":change", {
            name: name,
            exp: exp,
        });
    };
    return StateManager;
}(event_emitter_1.default));
exports.default = StateManager;

},{"@antv/event-emitter":94,"@antv/util":803,"tslib":894}],714:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEllipsisText = exports.measureTextWidth = void 0;
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
/**
 * 计算文本在画布中的宽度
 */
exports.measureTextWidth = util_1.memoize(function (text, font) {
    if (font === void 0) { font = {}; }
    var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
    ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
    return ctx.measureText(util_1.isString(text) ? text : '').width;
}, function (text, font) { return (font ? tslib_1.__spreadArrays([text], util_1.values(font)).join('') : text); });
/**
 * 获取文本的 ... 文本。
 * 算法（减少每次 measureText 的长度，measureText 的性能跟字符串时间相关）：
 * 1. 先通过 STEP 逐步计算，找到最后一个小于 maxWidth 的字符串
 * 2. 然后对最后这个字符串二分计算
 * @param text 需要计算的文本, 由于历史原因 除了支持string，还支持空值,number和数组等
 * @param maxWidth
 * @param font
 * TODO 后续更新省略算法
 */
exports.getEllipsisText = function (text, maxWidth, font) {
    var STEP = 16; // 每次 16，调参工程师
    var DOT_WIDTH = exports.measureTextWidth('...', font);
    var leftText;
    if (!util_1.isString(text)) {
        leftText = util_1.toString(text);
    }
    else {
        leftText = text;
    }
    var leftWidth = maxWidth;
    var r = []; // 最终的分段字符串
    var currentText;
    var currentWidth;
    if (exports.measureTextWidth(text, font) <= maxWidth) {
        return text;
    }
    // 首先通过 step 计算，找出最大的未超出长度的
    // eslint-disable-next-line no-constant-condition
    while (true) {
        // 更新字符串
        currentText = leftText.substr(0, STEP);
        // 计算宽度
        currentWidth = exports.measureTextWidth(currentText, font);
        // 超出剩余宽度，则停止
        if (currentWidth + DOT_WIDTH > leftWidth) {
            if (currentWidth > leftWidth) {
                break;
            }
        }
        r.push(currentText);
        // 没有超出，则计算剩余宽度
        leftWidth -= currentWidth;
        leftText = leftText.substr(STEP);
        // 字符串整体没有超出
        if (!leftText) {
            return r.join('');
        }
    }
    // 最下的最后一个 STEP，使用 1 递增（用二分效果更高）
    //eslint-disable-next-line no-constant-condition
    while (true) {
        // 更新字符串
        currentText = leftText.substr(0, 1);
        // 计算宽度
        currentWidth = exports.measureTextWidth(currentText, font);
        // 超出剩余宽度，则停止
        if (currentWidth + DOT_WIDTH > leftWidth) {
            break;
        }
        r.push(currentText);
        // 没有超出，则计算剩余宽度
        leftWidth -= currentWidth;
        leftText = leftText.substr(1);
        if (!leftText) {
            return r.join('');
        }
    }
    return r.join('') + "...";
};

},{"@antv/util":803,"tslib":894}],715:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkShapeOverlap = exports.getOverlapArea = exports.moveInPanel = exports.checkOriginEqual = exports.forEachElement = exports.forEachGeometry = exports.getGeometryShapes = exports.getGeometryByType = exports.getAllGeometryByType = void 0;
var util_1 = require("@antv/util");
var dependents_1 = require("../dependents");
function getAllGeometryByType(view, type) {
    return util_1.filter(view.geometries, function (geometry) { return geometry.type === type; });
}
exports.getAllGeometryByType = getAllGeometryByType;
function getGeometryByType(view, type) {
    return util_1.head(getAllGeometryByType(view, type));
}
exports.getGeometryByType = getGeometryByType;
function getGeometryShapes(geometry) {
    return util_1.map(geometry.elements, function (element) { return element.shape; });
}
exports.getGeometryShapes = getGeometryShapes;
function forEachGeometry(view, callback) {
    view.geometries.forEach(callback);
}
exports.forEachGeometry = forEachGeometry;
function forEachElement(view, callback) {
    view.geometries.forEach(function (geometry) {
        geometry.elements.forEach(function (element) {
            callback(element);
        });
    });
}
exports.forEachElement = forEachElement;
/** 检测是否有和已存在的Shape数据`相等`的情况 */
function checkOriginEqual(cur, dones, compare) {
    return util_1.some(dones, function (done) {
        return compare(done.get(dependents_1.ORIGIN), cur.get(dependents_1.ORIGIN));
    });
}
exports.checkOriginEqual = checkOriginEqual;
/** 将label调整到panel内 */
function moveInPanel(shape, panel) {
    var box = shape.getBBox();
    var deltaX = 0;
    var deltaY = 0;
    if (box.minX < panel.minX) {
        deltaX = box.minX - panel.minX;
    }
    else if (box.maxX > panel.maxX) {
        deltaX = box.maxX - panel.maxX;
    }
    if (deltaX) {
        shape.attr('x', shape.attr('x') - deltaX);
    }
    if (box.minY < panel.minY) {
        deltaY = box.minY - panel.minY;
    }
    else if (box.maxY > panel.maxY) {
        deltaY = box.maxY - panel.maxY;
    }
    if (deltaY) {
        shape.attr('y', shape.attr('y') - deltaY);
    }
}
exports.moveInPanel = moveInPanel;
/**
 * 计算两个矩形之间的堆叠区域面积
 */
function getOverlapArea(a, b, margin) {
    if (margin === void 0) { margin = 0; }
    var xOverlap = Math.max(0, Math.min(a.x + a.width + margin, b.x + b.width + margin) - Math.max(a.x - margin, b.x - margin));
    var yOverlap = Math.max(0, Math.min(a.y + a.height + margin, b.y + b.height + margin) - Math.max(a.y - margin, b.y - margin));
    return xOverlap * yOverlap;
}
exports.getOverlapArea = getOverlapArea;
/** 检测是否和已布局的堆叠 */
function checkShapeOverlap(cur, dones) {
    var box = cur.getBBox();
    return util_1.some(dones, function (done) {
        var target = done.getBBox();
        return getOverlapArea(box, target, 2) > 0;
    });
}
exports.checkShapeOverlap = checkShapeOverlap;

},{"../dependents":425,"@antv/util":803}],716:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @description 扩展方法，提供 gl-matrix 为提供的方法
 * */
var gl_matrix_1 = require("gl-matrix");
function leftTranslate(out, a, v) {
    var transMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
    gl_matrix_1.mat3.fromTranslation(transMat, v);
    return gl_matrix_1.mat3.multiply(out, transMat, a);
}
exports.leftTranslate = leftTranslate;
function leftRotate(out, a, rad) {
    var rotateMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
    gl_matrix_1.mat3.fromRotation(rotateMat, rad);
    return gl_matrix_1.mat3.multiply(out, rotateMat, a);
}
exports.leftRotate = leftRotate;
function leftScale(out, a, v) {
    var scaleMat = [0, 0, 0, 0, 0, 0, 0, 0, 0];
    gl_matrix_1.mat3.fromScaling(scaleMat, v);
    return gl_matrix_1.mat3.multiply(out, scaleMat, a);
}
exports.leftScale = leftScale;
function leftMultiply(out, a, a1) {
    return gl_matrix_1.mat3.multiply(out, a1, a);
}
/**
 * 根据 actions 来做 transform
 * @param m
 * @param actions
 */
function transform(m, actions) {
    var matrix = m ? [].concat(m) : [1, 0, 0, 0, 1, 0, 0, 0, 1];
    for (var i = 0, len = actions.length; i < len; i++) {
        var action = actions[i];
        switch (action[0]) {
            case 't':
                leftTranslate(matrix, matrix, [action[1], action[2]]);
                break;
            case 's':
                leftScale(matrix, matrix, [action[1], action[2]]);
                break;
            case 'r':
                leftRotate(matrix, matrix, action[1]);
                break;
            case 'm':
                leftMultiply(matrix, matrix, action[1]);
                break;
            default:
                break;
        }
    }
    return matrix;
}
exports.transform = transform;
/**
 * 向量 v1 到 向量 v2 夹角的方向
 * @param  {Array} v1 向量
 * @param  {Array} v2 向量
 * @return {Boolean} >= 0 顺时针 < 0 逆时针
 */
function direction(v1, v2) {
    return v1[0] * v2[1] - v2[0] * v1[1];
}
exports.direction = direction;
/**
 * 二维向量 v1 到 v2 的夹角
 * @param v1
 * @param v2
 * @param direct
 */
function angleTo(v1, v2, direct) {
    var ang = gl_matrix_1.vec2.angle(v1, v2);
    var angleLargeThanPI = direction(v1, v2) >= 0;
    if (direct) {
        if (angleLargeThanPI) {
            return Math.PI * 2 - ang;
        }
        return ang;
    }
    if (angleLargeThanPI) {
        return ang;
    }
    return Math.PI * 2 - ang;
}
exports.angleTo = angleTo;
/**
 * 计算二维向量的垂直向量
 * @param out
 * @param v
 * @param flag
 */
function vertical(out, v, flag) {
    if (flag) {
        out[0] = v[1];
        out[1] = -1 * v[0];
    }
    else {
        out[0] = -1 * v[1];
        out[1] = v[0];
    }
    return out;
}
exports.vertical = vertical;

},{"gl-matrix":883}],717:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var gl_matrix_1 = require("gl-matrix");
exports.mat3 = gl_matrix_1.mat3;
exports.vec2 = gl_matrix_1.vec2;
exports.vec3 = gl_matrix_1.vec3;
var ext = require("./ext");
exports.ext = ext;

},{"./ext":716,"gl-matrix":883}],718:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// http://schepers.cc/getting-to-the-point
function catmullRom2Bezier(crp, z) {
    var d = [];
    // @ts-ignore
    for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
        var p = [{
                x: +crp[i - 2],
                y: +crp[i - 1],
            }, {
                x: +crp[i],
                y: +crp[i + 1],
            }, {
                x: +crp[i + 2],
                y: +crp[i + 3],
            }, {
                x: +crp[i + 4],
                y: +crp[i + 5],
            }];
        if (z) {
            if (!i) {
                p[0] = {
                    x: +crp[iLen - 2],
                    y: +crp[iLen - 1],
                };
            }
            else if (iLen - 4 === i) {
                p[3] = {
                    x: +crp[0],
                    y: +crp[1],
                };
            }
            else if (iLen - 2 === i) {
                p[2] = {
                    x: +crp[0],
                    y: +crp[1],
                };
                p[3] = {
                    x: +crp[2],
                    y: +crp[3],
                };
            }
        }
        else {
            if (iLen - 4 === i) {
                p[3] = p[2];
            }
            else if (!i) {
                p[0] = {
                    x: +crp[i],
                    y: +crp[i + 1],
                };
            }
        }
        d.push(['C',
            (-p[0].x + 6 * p[1].x + p[2].x) / 6,
            (-p[0].y + 6 * p[1].y + p[2].y) / 6,
            (p[1].x + 6 * p[2].x - p[3].x) / 6,
            (p[1].y + 6 * p[2].y - p[3].y) / 6,
            p[2].x,
            p[2].y,
        ]);
    }
    return d;
}
exports.default = catmullRom2Bezier;

},{}],719:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_equal_1 = require("@antv/util/lib/is-equal");
function getMinDiff(del, add, modify) {
    var type = null;
    var min = modify;
    if (add < min) {
        min = add;
        type = 'add';
    }
    if (del < min) {
        min = del;
        type = 'del';
    }
    return {
        type: type,
        min: min,
    };
}
/*
 * https://en.wikipedia.org/wiki/Levenshtein_distance
 * 计算两条path的编辑距离
 */
var levenshteinDistance = function (source, target) {
    var sourceLen = source.length;
    var targetLen = target.length;
    var sourceSegment, targetSegment;
    var temp = 0;
    if (sourceLen === 0 || targetLen === 0) {
        return null;
    }
    var dist = [];
    for (var i = 0; i <= sourceLen; i++) {
        dist[i] = [];
        dist[i][0] = { min: i };
    }
    for (var j = 0; j <= targetLen; j++) {
        dist[0][j] = { min: j };
    }
    for (var i = 1; i <= sourceLen; i++) {
        sourceSegment = source[i - 1];
        for (var j = 1; j <= targetLen; j++) {
            targetSegment = target[j - 1];
            if (is_equal_1.default(sourceSegment, targetSegment)) {
                temp = 0;
            }
            else {
                temp = 1;
            }
            var del = dist[i - 1][j].min + 1;
            var add = dist[i][j - 1].min + 1;
            var modify = dist[i - 1][j - 1].min + temp;
            dist[i][j] = getMinDiff(del, add, modify);
        }
    }
    return dist;
};
function fillPathByDiff(source, target) {
    var diffMatrix = levenshteinDistance(source, target);
    var sourceLen = source.length;
    var targetLen = target.length;
    var changes = [];
    var index = 1;
    var minPos = 1;
    // 如果source和target不是完全不相等
    // @ts-ignore
    if (diffMatrix[sourceLen][targetLen] !== sourceLen) {
        // 获取从source到target所需改动
        for (var i = 1; i <= sourceLen; i++) {
            var min = diffMatrix[i][i].min;
            minPos = i;
            for (var j = index; j <= targetLen; j++) {
                if (diffMatrix[i][j].min < min) {
                    min = diffMatrix[i][j].min;
                    minPos = j;
                }
            }
            index = minPos;
            if (diffMatrix[i][index].type) {
                changes.push({ index: i - 1, type: diffMatrix[i][index].type });
            }
        }
        // 对source进行增删path
        for (var i = changes.length - 1; i >= 0; i--) {
            index = changes[i].index;
            if (changes[i].type === 'add') {
                // @ts-ignore
                source.splice(index, 0, [].concat(source[index]));
            }
            else {
                // @ts-ignore
                source.splice(index, 1);
            }
        }
    }
    // source尾部补齐
    sourceLen = source.length;
    if (sourceLen < targetLen) {
        for (var i = 0; i < (targetLen - sourceLen); i++) {
            if (source[sourceLen - 1][0] === 'z' || source[sourceLen - 1][0] === 'Z') {
                // @ts-ignore
                source.splice(sourceLen - 2, 0, source[sourceLen - 2]);
            }
            else {
                // @ts-ignore
                source.push(source[sourceLen - 1]);
            }
        }
    }
    return source;
}
exports.default = fillPathByDiff;

},{"@antv/util/lib/is-equal":813}],720:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function decasteljau(points, t) {
    var left = [];
    var right = [];
    function recurse(points, t) {
        if (points.length === 1) {
            left.push(points[0]);
            right.push(points[0]);
        }
        else {
            var middlePoints = [];
            for (var i = 0; i < points.length - 1; i++) {
                if (i === 0) {
                    left.push(points[0]);
                }
                if (i === points.length - 2) {
                    right.push(points[i + 1]);
                }
                middlePoints[i] = [(1 - t) * points[i][0] + t * points[i + 1][0], (1 - t) * points[i][1] + t * points[i + 1][1]];
            }
            recurse(middlePoints, t);
        }
    }
    if (points.length) {
        recurse(points, t);
    }
    return { left: left, right: right.reverse() };
}
function splitCurve(start, end, count) {
    var points = [[start[1], start[2]]];
    count = count || 2;
    var segments = [];
    if (end[0] === 'A') {
        points.push(end[6]);
        points.push(end[7]);
    }
    else if (end[0] === 'C') {
        points.push([end[1], end[2]]);
        points.push([end[3], end[4]]);
        points.push([end[5], end[6]]);
    }
    else if (end[0] === 'S' || end[0] === 'Q') {
        points.push([end[1], end[2]]);
        points.push([end[3], end[4]]);
    }
    else {
        points.push([end[1], end[2]]);
    }
    var leftSegments = points;
    var t = 1 / count;
    for (var i = 0; i < count - 1; i++) {
        var rt = t / (1 - t * i);
        var split = decasteljau(leftSegments, rt);
        segments.push(split.left);
        leftSegments = split.right;
    }
    segments.push(leftSegments);
    var result = segments.map(function (segment) {
        var cmd = [];
        if (segment.length === 4) {
            cmd.push('C');
            cmd = cmd.concat(segment[2]);
        }
        if (segment.length >= 3) {
            if (segment.length === 3) {
                cmd.push('Q');
            }
            cmd = cmd.concat(segment[1]);
        }
        if (segment.length === 2) {
            cmd.push('L');
        }
        cmd = cmd.concat(segment[segment.length - 1]);
        return cmd;
    });
    return result;
}
function splitSegment(start, end, count) {
    if (count === 1) {
        return [[].concat(start)];
    }
    var segments = [];
    if (end[0] === 'L' || end[0] === 'C' || end[0] === 'Q') {
        segments = segments.concat(splitCurve(start, end, count));
    }
    else {
        var temp = [].concat(start);
        if (temp[0] === 'M') {
            temp[0] = 'L';
        }
        for (var i = 0; i <= count - 1; i++) {
            segments.push(temp);
        }
    }
    return segments;
}
function fillPath(source, target) {
    if (source.length === 1) {
        return source;
    }
    var sourceLen = source.length - 1;
    var targetLen = target.length - 1;
    var ratio = sourceLen / targetLen;
    var segmentsToFill = [];
    if (source.length === 1 && source[0][0] === 'M') {
        for (var i = 0; i < targetLen - sourceLen; i++) {
            source.push(source[0]);
        }
        return source;
    }
    for (var i = 0; i < targetLen; i++) {
        var index = Math.floor(ratio * i);
        segmentsToFill[index] = (segmentsToFill[index] || 0) + 1;
    }
    var filled = segmentsToFill.reduce(function (filled, count, i) {
        if (i === sourceLen) {
            return filled.concat(source[sourceLen]);
        }
        return filled.concat(splitSegment(source[i], source[i + 1], count));
    }, []);
    filled.unshift(source[0]);
    if (target[targetLen] === 'Z' || target[targetLen] === 'z') {
        filled.push('Z');
    }
    return filled;
}
exports.default = fillPath;

},{}],721:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
 * 抽取pathSegment中的关键点
 * M,L,A,Q,H,V一个端点
 * Q, S抽取一个端点，一个控制点
 * C抽取一个端点，两个控制点
 */
function _getSegmentPoints(segment) {
    var points = [];
    switch (segment[0]) {
        case 'M':
            points.push([segment[1], segment[2]]);
            break;
        case 'L':
            points.push([segment[1], segment[2]]);
            break;
        case 'A':
            points.push([segment[6], segment[7]]);
            break;
        case 'Q':
            points.push([segment[3], segment[4]]);
            points.push([segment[1], segment[2]]);
            break;
        case 'T':
            points.push([segment[1], segment[2]]);
            break;
        case 'C':
            points.push([segment[5], segment[6]]);
            points.push([segment[1], segment[2]]);
            points.push([segment[3], segment[4]]);
            break;
        case 'S':
            points.push([segment[3], segment[4]]);
            points.push([segment[1], segment[2]]);
            break;
        case 'H':
            points.push([segment[1], segment[1]]);
            break;
        case 'V':
            points.push([segment[1], segment[1]]);
            break;
        default:
    }
    return points;
}
// 将两个点均分成count个点
function _splitPoints(points, former, count) {
    var result = [].concat(points);
    var index;
    var t = 1 / (count + 1);
    var formerEnd = _getSegmentPoints(former)[0];
    for (var i = 1; i <= count; i++) {
        t *= i;
        index = Math.floor(points.length * t);
        if (index === 0) {
            result.unshift([formerEnd[0] * t + points[index][0] * (1 - t), formerEnd[1] * t + points[index][1] * (1 - t)]);
        }
        else {
            result.splice(index, 0, [formerEnd[0] * t + points[index][0] * (1 - t), formerEnd[1] * t + points[index][1] * (1 - t)]);
        }
    }
    return result;
}
function formatPath(fromPath, toPath) {
    if (fromPath.length <= 1) {
        return fromPath;
    }
    var points;
    for (var i = 0; i < toPath.length; i++) {
        if (fromPath[i][0] !== toPath[i][0]) {
            // 获取fromPath的pathSegment的端点，根据toPath的指令对其改造
            points = _getSegmentPoints(fromPath[i]);
            switch (toPath[i][0]) {
                case 'M':
                    fromPath[i] = ['M'].concat(points[0]);
                    break;
                case 'L':
                    fromPath[i] = ['L'].concat(points[0]);
                    break;
                case 'A':
                    fromPath[i] = [].concat(toPath[i]);
                    fromPath[i][6] = points[0][0];
                    fromPath[i][7] = points[0][1];
                    break;
                case 'Q':
                    if (points.length < 2) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 1);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['Q'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, []));
                    break;
                case 'T':
                    fromPath[i] = ['T'].concat(points[0]);
                    break;
                case 'C':
                    if (points.length < 3) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 2);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['C'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, []));
                    break;
                case 'S':
                    if (points.length < 2) {
                        if (i > 0) {
                            points = _splitPoints(points, fromPath[i - 1], 1);
                        }
                        else {
                            fromPath[i] = toPath[i];
                            break;
                        }
                    }
                    fromPath[i] = ['S'].concat(points.reduce(function (arr, i) { return arr.concat(i); }, []));
                    break;
                default:
                    fromPath[i] = toPath[i];
            }
        }
    }
    return fromPath;
}
exports.default = formatPath;

},{}],722:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mod_1 = require("@antv/util/lib/mod");
var to_radian_1 = require("@antv/util/lib/to-radian");
// 向量长度
function vMag(v) {
    return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
}
// u.v/|u||v|，计算夹角的余弦值
function vRatio(u, v) {
    // 当存在一个向量的长度为 0 时，夹角也为 0，即夹角的余弦值为 1
    return vMag(u) * vMag(v) ? (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v)) : 1;
}
// 向量角度
function vAngle(u, v) {
    return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
}
/**
 * 判断两个点是否重合，点坐标的格式为 [x, y]
 * @param {Array} point1 第一个点
 * @param {Array} point2 第二个点
 */
function isSamePoint(point1, point2) {
    return point1[0] === point2[0] && point1[1] === point2[1];
}
exports.isSamePoint = isSamePoint;
// A 0:rx 1:ry 2:x-axis-rotation 3:large-arc-flag 4:sweep-flag 5: x 6: y
function getArcParams(startPoint, params) {
    var rx = params[1];
    var ry = params[2];
    var xRotation = mod_1.default(to_radian_1.default(params[3]), Math.PI * 2);
    var arcFlag = params[4];
    var sweepFlag = params[5];
    // 弧形起点坐标
    var x1 = startPoint[0];
    var y1 = startPoint[1];
    // 弧形终点坐标
    var x2 = params[6];
    var y2 = params[7];
    var xp = (Math.cos(xRotation) * (x1 - x2)) / 2.0 + (Math.sin(xRotation) * (y1 - y2)) / 2.0;
    var yp = (-1 * Math.sin(xRotation) * (x1 - x2)) / 2.0 + (Math.cos(xRotation) * (y1 - y2)) / 2.0;
    var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
    if (lambda > 1) {
        rx *= Math.sqrt(lambda);
        ry *= Math.sqrt(lambda);
    }
    var diff = rx * rx * (yp * yp) + ry * ry * (xp * xp);
    var f = diff ? Math.sqrt((rx * rx * (ry * ry) - diff) / diff) : 1;
    if (arcFlag === sweepFlag) {
        f *= -1;
    }
    if (isNaN(f)) {
        f = 0;
    }
    // 旋转前的起点坐标，且当长半轴和短半轴的长度为 0 时，坐标按 (0, 0) 处理
    var cxp = ry ? (f * rx * yp) / ry : 0;
    var cyp = rx ? (f * -ry * xp) / rx : 0;
    // 椭圆圆心坐标
    var cx = (x1 + x2) / 2.0 + Math.cos(xRotation) * cxp - Math.sin(xRotation) * cyp;
    var cy = (y1 + y2) / 2.0 + Math.sin(xRotation) * cxp + Math.cos(xRotation) * cyp;
    // 起始点的单位向量
    var u = [(xp - cxp) / rx, (yp - cyp) / ry];
    // 终止点的单位向量
    var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
    // 计算起始点和圆心的连线，与 x 轴正方向的夹角
    var theta = vAngle([1, 0], u);
    // 计算圆弧起始点和终止点与椭圆圆心连线的夹角
    var dTheta = vAngle(u, v);
    if (vRatio(u, v) <= -1) {
        dTheta = Math.PI;
    }
    if (vRatio(u, v) >= 1) {
        dTheta = 0;
    }
    if (sweepFlag === 0 && dTheta > 0) {
        dTheta = dTheta - 2 * Math.PI;
    }
    if (sweepFlag === 1 && dTheta < 0) {
        dTheta = dTheta + 2 * Math.PI;
    }
    return {
        cx: cx,
        cy: cy,
        // 弧形的起点和终点相同时，长轴和短轴的长度按 0 处理
        rx: isSamePoint(startPoint, [x2, y2]) ? 0 : rx,
        ry: isSamePoint(startPoint, [x2, y2]) ? 0 : ry,
        startAngle: theta,
        endAngle: theta + dTheta,
        xRotation: xRotation,
        arcFlag: arcFlag,
        sweepFlag: sweepFlag,
    };
}
exports.default = getArcParams;

},{"@antv/util/lib/mod":845,"@antv/util/lib/to-radian":865}],723:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isBetween = function (value, min, max) { return value >= min && value <= max; };
function getLineIntersect(p0, p1, p2, p3) {
    var tolerance = 0.001;
    var E = {
        x: p2.x - p0.x,
        y: p2.y - p0.y,
    };
    var D0 = {
        x: p1.x - p0.x,
        y: p1.y - p0.y,
    };
    var D1 = {
        x: p3.x - p2.x,
        y: p3.y - p2.y,
    };
    var kross = D0.x * D1.y - D0.y * D1.x;
    var sqrKross = kross * kross;
    var sqrLen0 = D0.x * D0.x + D0.y * D0.y;
    var sqrLen1 = D1.x * D1.x + D1.y * D1.y;
    var point = null;
    if (sqrKross > tolerance * sqrLen0 * sqrLen1) {
        var s = (E.x * D1.y - E.y * D1.x) / kross;
        var t = (E.x * D0.y - E.y * D0.x) / kross;
        if (isBetween(s, 0, 1) && isBetween(t, 0, 1)) {
            point = {
                x: p0.x + s * D0.x,
                y: p0.y + s * D0.y,
            };
        }
    }
    return point;
}
exports.default = getLineIntersect;
;

},{}],724:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var parse_path_1 = require("./parse-path");
exports.parsePath = parse_path_1.default;
var catmull_rom_2_bezier_1 = require("./catmull-rom-2-bezier");
exports.catmullRom2Bezier = catmull_rom_2_bezier_1.default;
var fill_path_1 = require("./fill-path");
exports.fillPath = fill_path_1.default;
var fill_path_by_diff_1 = require("./fill-path-by-diff");
exports.fillPathByDiff = fill_path_by_diff_1.default;
var format_path_1 = require("./format-path");
exports.formatPath = format_path_1.default;
var path_intersection_1 = require("./path-intersection");
exports.pathIntersection = path_intersection_1.default;
var parse_path_array_1 = require("./parse-path-array");
exports.parsePathArray = parse_path_array_1.default;
var parse_path_string_1 = require("./parse-path-string");
exports.parsePathString = parse_path_string_1.default;
var path_2_curve_1 = require("./path-2-curve");
exports.path2Curve = path_2_curve_1.default;
var path_2_absolute_1 = require("./path-2-absolute");
exports.path2Absolute = path_2_absolute_1.default;
var rect_path_1 = require("./rect-path");
exports.reactPath = rect_path_1.default;
var get_arc_params_1 = require("./get-arc-params");
exports.getArcParams = get_arc_params_1.default;
var path_2_segments_1 = require("./path-2-segments");
exports.path2Segments = path_2_segments_1.default;
var get_line_intersect_1 = require("./get-line-intersect");
exports.getLineIntersect = get_line_intersect_1.default;
var is_polygons_intersect_1 = require("./is-polygons-intersect");
exports.isPolygonsIntersect = is_polygons_intersect_1.default;
var point_in_polygon_1 = require("./point-in-polygon");
exports.isPointInPolygon = point_in_polygon_1.default;

},{"./catmull-rom-2-bezier":718,"./fill-path":720,"./fill-path-by-diff":719,"./format-path":721,"./get-arc-params":722,"./get-line-intersect":723,"./is-polygons-intersect":725,"./parse-path":728,"./parse-path-array":726,"./parse-path-string":727,"./path-2-absolute":729,"./path-2-curve":730,"./path-2-segments":731,"./path-intersection":732,"./point-in-polygon":733,"./rect-path":734}],725:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var point_in_polygon_1 = require("./point-in-polygon");
var get_line_intersect_1 = require("./get-line-intersect");
var util_1 = require("@antv/util");
function parseToLines(points) {
    var lines = [];
    var count = points.length;
    for (var i = 0; i < count - 1; i++) {
        var point = points[i];
        var next = points[i + 1];
        lines.push({
            from: {
                x: point[0],
                y: point[1]
            },
            to: {
                x: next[0],
                y: next[1]
            }
        });
    }
    if (lines.length > 1) {
        var first = points[0];
        var last = points[count - 1];
        lines.push({
            from: {
                x: last[0],
                y: last[1]
            },
            to: {
                x: first[0],
                y: first[1]
            }
        });
    }
    return lines;
}
function lineIntersectPolygon(lines, line) {
    var isIntersect = false;
    util_1.each(lines, function (l) {
        if (get_line_intersect_1.default(l.from, l.to, line.from, line.to)) {
            isIntersect = true;
            return false;
        }
    });
    return isIntersect;
}
function getBBox(points) {
    var xArr = points.map(function (p) { return p[0]; });
    var yArr = points.map(function (p) { return p[1]; });
    return {
        minX: Math.min.apply(null, xArr),
        maxX: Math.max.apply(null, xArr),
        minY: Math.min.apply(null, yArr),
        maxY: Math.max.apply(null, yArr)
    };
}
function intersectBBox(box1, box2) {
    return !(box2.minX > box1.maxX || box2.maxX < box1.minX || box2.minY > box1.maxY || box2.maxY < box1.minY);
}
function isPolygonsIntersect(points1, points2) {
    // 空数组，或者一个点返回 false
    if (points1.length < 2 || points2.length < 2) {
        return false;
    }
    var bbox1 = getBBox(points1);
    var bbox2 = getBBox(points2);
    // 判定包围盒是否相交，比判定点是否在多边形内要快的多，可以筛选掉大多数情况
    if (!intersectBBox(bbox1, bbox2)) {
        return false;
    }
    var isIn = false;
    // 判定点是否在多边形内部，一旦有一个点在另一个多边形内，则返回
    util_1.each(points2, function (point) {
        if (point_in_polygon_1.default(points1, point[0], point[1])) {
            isIn = true;
            return false;
        }
    });
    if (isIn) {
        return true;
    }
    // 两个多边形都需要判定
    util_1.each(points1, function (point) {
        if (point_in_polygon_1.default(points2, point[0], point[1])) {
            isIn = true;
            return false;
        }
    });
    if (isIn) {
        return true;
    }
    var lines1 = parseToLines(points1);
    var lines2 = parseToLines(points2);
    var isIntersect = false;
    util_1.each(lines2, function (line) {
        if (lineIntersectPolygon(lines1, line)) {
            isIntersect = true;
            return false;
        }
    });
    return isIntersect;
}
exports.default = isPolygonsIntersect;

},{"./get-line-intersect":723,"./point-in-polygon":733,"@antv/util":803}],726:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var p2s = /,?([a-z]),?/gi;
function parsePathArray(path) {
    return path.join(',').replace(p2s, '$1');
}
exports.default = parsePathArray;

},{}],727:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("@antv/util/lib/is-array");
var SPACES = '\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029';
var PATH_COMMAND = new RegExp('([a-z])[' + SPACES + ',]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[' + SPACES + ']*,?[' + SPACES + ']*)+)', 'ig');
var PATH_VALUES = new RegExp('(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[' + SPACES + ']*,?[' + SPACES + ']*', 'ig');
// Parses given path string into an array of arrays of path segments
function parsePathString(pathString) {
    if (!pathString) {
        return null;
    }
    if (is_array_1.default(pathString)) {
        return pathString;
    }
    var paramCounts = {
        a: 7,
        c: 6,
        o: 2,
        h: 1,
        l: 2,
        m: 2,
        r: 4,
        q: 4,
        s: 4,
        t: 2,
        v: 1,
        u: 3,
        z: 0,
    };
    var data = [];
    String(pathString).replace(PATH_COMMAND, function (a, b, c) {
        var params = [];
        var name = b.toLowerCase();
        c.replace(PATH_VALUES, function (a, b) {
            b && params.push(+b);
        });
        if (name === 'm' && params.length > 2) {
            data.push([b].concat(params.splice(0, 2)));
            name = 'l';
            b = b === 'm' ? 'l' : 'L';
        }
        if (name === 'o' && params.length === 1) {
            data.push([b, params[0]]);
        }
        if (name === 'r') {
            data.push([b].concat(params));
        }
        else {
            while (params.length >= paramCounts[name]) {
                data.push([b].concat(params.splice(0, paramCounts[name])));
                if (!paramCounts[name]) {
                    break;
                }
            }
        }
        return '';
    });
    return data;
}
exports.default = parsePathString;

},{"@antv/util/lib/is-array":806}],728:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("@antv/util/lib/each");
var is_array_1 = require("@antv/util/lib/is-array");
var is_string_1 = require("@antv/util/lib/is-string");
var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig;
var regexDot = /[^\s\,]+/ig;
function parsePath(p) {
    var path = p || [];
    if (is_array_1.default(path)) {
        return path;
    }
    if (is_string_1.default(path)) {
        path = path.match(regexTags);
        each_1.default(path, function (item, index) {
            // @ts-ignore
            item = item.match(regexDot);
            if (item[0].length > 1) {
                var tag = item[0].charAt(0);
                // @ts-ignore
                item.splice(1, 0, item[0].substr(1));
                // @ts-ignore
                item[0] = tag;
            }
            // @ts-ignore
            each_1.default(item, function (sub, i) {
                if (!isNaN(sub)) {
                    // @ts-ignore
                    item[i] = +sub;
                }
            });
            // @ts-ignore
            path[index] = item;
        });
        return path;
    }
}
exports.default = parsePath;

},{"@antv/util/lib/each":778,"@antv/util/lib/is-array":806,"@antv/util/lib/is-string":832}],729:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var parse_path_string_1 = require("./parse-path-string");
var REGEX_MD = /[a-z]/;
function toSymmetry(p, c) {
    return [
        c[0] + (c[0] - p[0]),
        c[1] + (c[1] - p[1]),
    ];
}
function pathToAbsolute(pathString) {
    var pathArray = parse_path_string_1.default(pathString);
    if (!pathArray || !pathArray.length) {
        return [
            ['M', 0, 0],
        ];
    }
    var needProcess = false; // 如果存在小写的命令或者 V,H,T,S 则需要处理
    for (var i = 0; i < pathArray.length; i++) {
        var cmd = pathArray[i][0];
        // 如果存在相对位置的命令，则中断返回
        if (REGEX_MD.test(cmd) || ['V', 'H', 'T', 'S'].indexOf(cmd) >= 0) {
            needProcess = true;
            break;
        }
    }
    // 如果不存在相对命令，则直接返回
    // 如果在业务上都写绝对路径，这种方式最快，仅做了一次检测
    if (!needProcess) {
        return pathArray;
    }
    var res = [];
    var x = 0;
    var y = 0;
    var mx = 0;
    var my = 0;
    var start = 0;
    var pa0;
    var dots;
    var first = pathArray[0];
    if (first[0] === 'M' || first[0] === 'm') {
        x = +first[1];
        y = +first[2];
        mx = x;
        my = y;
        start++;
        res[0] = ['M', x, y];
    }
    for (var i = start, ii = pathArray.length; i < ii; i++) {
        var pa = pathArray[i];
        var preParams = res[i - 1]; // 取前一个已经处理后的节点，否则会出现问题
        var r = [];
        var cmd = pa[0];
        var upCmd = cmd.toUpperCase();
        if (cmd !== upCmd) {
            r[0] = upCmd;
            switch (upCmd) {
                case 'A':
                    r[1] = pa[1];
                    r[2] = pa[2];
                    r[3] = pa[3];
                    r[4] = pa[4];
                    r[5] = pa[5];
                    r[6] = +pa[6] + x;
                    r[7] = +pa[7] + y;
                    break;
                case 'V':
                    r[1] = +pa[1] + y;
                    break;
                case 'H':
                    r[1] = +pa[1] + x;
                    break;
                case 'M':
                    mx = +pa[1] + x;
                    my = +pa[2] + y;
                    break; // for lint
                default:
                    for (var j = 1, jj = pa.length; j < jj; j++) {
                        r[j] = +pa[j] + ((j % 2) ? x : y);
                    }
            }
        }
        else { // 如果本来已经大写，则不处理
            r = pathArray[i];
        }
        // 需要在外面统一做，同时处理 V,H,S,T 等特殊指令
        switch (upCmd) {
            case 'Z':
                x = +mx;
                y = +my;
                break;
            case 'H':
                x = r[1];
                r = ['L', x, y];
                break;
            case 'V':
                y = r[1];
                r = ['L', x, y];
                break;
            case 'T':
                x = r[1];
                y = r[2];
                // 以 x, y 为中心的，上一个控制点的对称点
                // 需要假设上一个节点的命令为 Q
                var symetricT = toSymmetry([preParams[1], preParams[2]], [preParams[3], preParams[4]]);
                r = ['Q', symetricT[0], symetricT[1], x, y];
                break;
            case 'S':
                x = r[r.length - 2];
                y = r[r.length - 1];
                // 以 x,y 为中心，取上一个控制点，
                // 需要假设上一个线段为 C 或者 S
                var length_1 = preParams.length;
                var symetricS = toSymmetry([preParams[length_1 - 4], preParams[length_1 - 3]], [preParams[length_1 - 2], preParams[length_1 - 1]]);
                r = ['C', symetricS[0], symetricS[1], r[1], r[2], x, y];
                break;
            case 'M':
                mx = r[r.length - 2];
                my = r[r.length - 1];
                break; // for lint
            default:
                x = r[r.length - 2];
                y = r[r.length - 1];
        }
        res.push(r);
    }
    return res;
}
exports.default = pathToAbsolute;

},{"./parse-path-string":727}],730:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path_2_absolute_1 = require("./path-2-absolute");
var a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
    // for more information of where this math came from visit:
    // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
    if (rx === ry) {
        rx += 1;
    }
    var _120 = (Math.PI * 120) / 180;
    var rad = (Math.PI / 180) * (+angle || 0);
    var res = [];
    var xy;
    var f1;
    var f2;
    var cx;
    var cy;
    var rotate = function (x, y, rad) {
        var X = x * Math.cos(rad) - y * Math.sin(rad);
        var Y = x * Math.sin(rad) + y * Math.cos(rad);
        return {
            x: X,
            y: Y,
        };
    };
    if (!recursive) {
        xy = rotate(x1, y1, -rad);
        x1 = xy.x;
        y1 = xy.y;
        xy = rotate(x2, y2, -rad);
        x2 = xy.x;
        y2 = xy.y;
        if (x1 === x2 && y1 === y2) {
            // 若弧的起始点和终点重叠则错开一点
            x2 += 1;
            y2 += 1;
        }
        // const cos = Math.cos(Math.PI / 180 * angle);
        // const sin = Math.sin(Math.PI / 180 * angle);
        var x = (x1 - x2) / 2;
        var y = (y1 - y2) / 2;
        var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
        if (h > 1) {
            h = Math.sqrt(h);
            rx = h * rx;
            ry = h * ry;
        }
        var rx2 = rx * rx;
        var ry2 = ry * ry;
        var k = (large_arc_flag === sweep_flag ? -1 : 1) *
            Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
        cx = (k * rx * y) / ry + (x1 + x2) / 2;
        cy = (k * -ry * x) / rx + (y1 + y2) / 2;
        f1 = Math.asin(Number(((y1 - cy) / ry).toFixed(9)));
        f2 = Math.asin(Number(((y2 - cy) / ry).toFixed(9)));
        f1 = x1 < cx ? Math.PI - f1 : f1;
        f2 = x2 < cx ? Math.PI - f2 : f2;
        f1 < 0 && (f1 = Math.PI * 2 + f1);
        f2 < 0 && (f2 = Math.PI * 2 + f2);
        if (sweep_flag && f1 > f2) {
            f1 = f1 - Math.PI * 2;
        }
        if (!sweep_flag && f2 > f1) {
            f2 = f2 - Math.PI * 2;
        }
    }
    else {
        f1 = recursive[0];
        f2 = recursive[1];
        cx = recursive[2];
        cy = recursive[3];
    }
    var df = f2 - f1;
    if (Math.abs(df) > _120) {
        var f2old = f2;
        var x2old = x2;
        var y2old = y2;
        f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
        x2 = cx + rx * Math.cos(f2);
        y2 = cy + ry * Math.sin(f2);
        res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
    }
    df = f2 - f1;
    var c1 = Math.cos(f1);
    var s1 = Math.sin(f1);
    var c2 = Math.cos(f2);
    var s2 = Math.sin(f2);
    var t = Math.tan(df / 4);
    var hx = (4 / 3) * rx * t;
    var hy = (4 / 3) * ry * t;
    var m1 = [x1, y1];
    var m2 = [x1 + hx * s1, y1 - hy * c1];
    var m3 = [x2 + hx * s2, y2 - hy * c2];
    var m4 = [x2, y2];
    m2[0] = 2 * m1[0] - m2[0];
    m2[1] = 2 * m1[1] - m2[1];
    if (recursive) {
        return [m2, m3, m4].concat(res);
    }
    res = [m2, m3, m4]
        .concat(res)
        .join()
        .split(',');
    var newres = [];
    for (var i = 0, ii = res.length; i < ii; i++) {
        newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
    }
    return newres;
};
var l2c = function (x1, y1, x2, y2) {
    return [x1, y1, x2, y2, x2, y2];
};
var q2c = function (x1, y1, ax, ay, x2, y2) {
    var _13 = 1 / 3;
    var _23 = 2 / 3;
    return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2];
};
function pathTocurve(path, path2) {
    var p = path_2_absolute_1.default(path);
    var p2 = path2 && path_2_absolute_1.default(path2);
    var attrs = {
        x: 0,
        y: 0,
        bx: 0,
        by: 0,
        X: 0,
        Y: 0,
        qx: null,
        qy: null,
    };
    var attrs2 = {
        x: 0,
        y: 0,
        bx: 0,
        by: 0,
        X: 0,
        Y: 0,
        qx: null,
        qy: null,
    };
    var pcoms1 = []; // path commands of original path p
    var pcoms2 = []; // path commands of original path p2
    var pfirst = ''; // temporary holder for original path command
    var pcom = ''; // holder for previous path command of original path
    var ii;
    var processPath = function (path, d, pcom) {
        var nx, ny;
        if (!path) {
            return ['C', d.x, d.y, d.x, d.y, d.x, d.y];
        }
        !(path[0] in
            {
                T: 1,
                Q: 1,
            }) && (d.qx = d.qy = null);
        switch (path[0]) {
            case 'M':
                d.X = path[1];
                d.Y = path[2];
                break;
            case 'A':
                path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
                break;
            case 'S':
                if (pcom === 'C' || pcom === 'S') {
                    // In "S" case we have to take into account, if the previous command is C/S.
                    nx = d.x * 2 - d.bx; // And reflect the previous
                    ny = d.y * 2 - d.by; // command's control point relative to the current point.
                }
                else {
                    // or some else or nothing
                    nx = d.x;
                    ny = d.y;
                }
                path = ['C', nx, ny].concat(path.slice(1));
                break;
            case 'T':
                if (pcom === 'Q' || pcom === 'T') {
                    // In "T" case we have to take into account, if the previous command is Q/T.
                    d.qx = d.x * 2 - d.qx; // And make a reflection similar
                    d.qy = d.y * 2 - d.qy; // to case "S".
                }
                else {
                    // or something else or nothing
                    d.qx = d.x;
                    d.qy = d.y;
                }
                path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
                break;
            case 'Q':
                d.qx = path[1];
                d.qy = path[2];
                path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
                break;
            case 'L':
                path = ['C'].concat(l2c(d.x, d.y, path[1], path[2]));
                break;
            case 'H':
                path = ['C'].concat(l2c(d.x, d.y, path[1], d.y));
                break;
            case 'V':
                path = ['C'].concat(l2c(d.x, d.y, d.x, path[1]));
                break;
            case 'Z':
                path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y));
                break;
            default:
                break;
        }
        return path;
    };
    var fixArc = function (pp, i) {
        if (pp[i].length > 7) {
            pp[i].shift();
            var pi = pp[i];
            while (pi.length) {
                pcoms1[i] = 'A'; // if created multiple C:s, their original seg is saved
                p2 && (pcoms2[i] = 'A'); // the same as above
                pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6)));
            }
            pp.splice(i, 1);
            ii = Math.max(p.length, (p2 && p2.length) || 0);
        }
    };
    var fixM = function (path1, path2, a1, a2, i) {
        if (path1 && path2 && path1[i][0] === 'M' && path2[i][0] !== 'M') {
            path2.splice(i, 0, ['M', a2.x, a2.y]);
            a1.bx = 0;
            a1.by = 0;
            a1.x = path1[i][1];
            a1.y = path1[i][2];
            ii = Math.max(p.length, (p2 && p2.length) || 0);
        }
    };
    ii = Math.max(p.length, (p2 && p2.length) || 0);
    for (var i = 0; i < ii; i++) {
        p[i] && (pfirst = p[i][0]); // save current path command
        if (pfirst !== 'C') {
            // C is not saved yet, because it may be result of conversion
            pcoms1[i] = pfirst; // Save current path command
            i && (pcom = pcoms1[i - 1]); // Get previous path command pcom
        }
        p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath
        if (pcoms1[i] !== 'A' && pfirst === 'C')
            pcoms1[i] = 'C'; // A is the only command
        // which may produce multiple C:s
        // so we have to make sure that C is also C in original path
        fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1
        if (p2) {
            // the same procedures is done to p2
            p2[i] && (pfirst = p2[i][0]);
            if (pfirst !== 'C') {
                pcoms2[i] = pfirst;
                i && (pcom = pcoms2[i - 1]);
            }
            p2[i] = processPath(p2[i], attrs2, pcom);
            if (pcoms2[i] !== 'A' && pfirst === 'C') {
                pcoms2[i] = 'C';
            }
            fixArc(p2, i);
        }
        fixM(p, p2, attrs, attrs2, i);
        fixM(p2, p, attrs2, attrs, i);
        var seg = p[i];
        var seg2 = p2 && p2[i];
        var seglen = seg.length;
        var seg2len = p2 && seg2.length;
        attrs.x = seg[seglen - 2];
        attrs.y = seg[seglen - 1];
        attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
        attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
        attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x);
        attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y);
        attrs2.x = p2 && seg2[seg2len - 2];
        attrs2.y = p2 && seg2[seg2len - 1];
    }
    return p2 ? [p, p2] : p;
}
exports.default = pathTocurve;

},{"./path-2-absolute":729}],731:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_arc_params_1 = require("./get-arc-params");
var get_arc_params_2 = require("./get-arc-params");
var parse_path_1 = require("./parse-path");
// 点对称
function toSymmetry(point, center) {
    return [center[0] + (center[0] - point[0]), center[1] + (center[1] - point[1])];
}
function getSegments(path) {
    path = parse_path_1.default(path);
    var segments = [];
    var currentPoint = null; // 当前图形
    var nextParams = null; // 下一节点的 path 参数
    var startMovePoint = null; // 开始 M 的点，可能会有多个
    var lastStartMovePointIndex = 0; // 最近一个开始点 M 的索引
    var count = path.length;
    for (var i = 0; i < count; i++) {
        var params = path[i];
        nextParams = path[i + 1];
        var command = params[0];
        // 数学定义上的参数，便于后面的计算
        var segment = {
            command: command,
            prePoint: currentPoint,
            params: params,
            startTangent: null,
            endTangent: null,
        };
        switch (command) {
            case 'M':
                startMovePoint = [params[1], params[2]];
                lastStartMovePointIndex = i;
                break;
            case 'A':
                var arcParams = get_arc_params_1.default(currentPoint, params);
                segment['arcParams'] = arcParams;
                break;
            default:
                break;
        }
        if (command === 'Z') {
            // 有了 Z 后，当前节点从开始 M 的点开始
            currentPoint = startMovePoint;
            // 如果当前点的命令为 Z，相当于当前点为最近一个 M 点，则下一个点直接指向最近一个 M 点的下一个点
            nextParams = path[lastStartMovePointIndex + 1];
        }
        else {
            var len = params.length;
            currentPoint = [params[len - 2], params[len - 1]];
        }
        if (nextParams && nextParams[0] === 'Z') {
            // 如果下一个点的命令为 Z，则下一个点直接指向最近一个 M 点
            nextParams = path[lastStartMovePointIndex];
            if (segments[lastStartMovePointIndex]) {
                // 如果下一个点的命令为 Z，则最近一个 M 点的前一个点为当前点
                segments[lastStartMovePointIndex].prePoint = currentPoint;
            }
        }
        segment['currentPoint'] = currentPoint;
        // 如果当前点与最近一个 M 点相同，则最近一个 M 点的前一个点为当前点的前一个点
        if (segments[lastStartMovePointIndex] &&
            get_arc_params_2.isSamePoint(currentPoint, segments[lastStartMovePointIndex].currentPoint)) {
            segments[lastStartMovePointIndex].prePoint = segment.prePoint;
        }
        var nextPoint = nextParams ? [nextParams[nextParams.length - 2], nextParams[nextParams.length - 1]] : null;
        segment['nextPoint'] = nextPoint;
        // Add startTangent and endTangent
        var prePoint = segment.prePoint;
        if (['L', 'H', 'V'].includes(command)) {
            segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]];
            segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]];
        }
        else if (command === 'Q') {
            // 二次贝塞尔曲线只有一个控制点
            var cp = [params[1], params[2]];
            // 二次贝塞尔曲线的终点为 currentPoint
            segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]];
            segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]];
        }
        else if (command === 'T') {
            var preSegment = segments[i - 1];
            var cp = toSymmetry(preSegment.currentPoint, prePoint);
            if (preSegment.command === 'Q') {
                segment.command = 'Q';
                segment.startTangent = [prePoint[0] - cp[0], prePoint[1] - cp[1]];
                segment.endTangent = [currentPoint[0] - cp[0], currentPoint[1] - cp[1]];
            }
            else {
                segment.command = 'TL';
                segment.startTangent = [prePoint[0] - currentPoint[0], prePoint[1] - currentPoint[1]];
                segment.endTangent = [currentPoint[0] - prePoint[0], currentPoint[1] - prePoint[1]];
            }
        }
        else if (command === 'C') {
            // 三次贝塞尔曲线有两个控制点
            var cp1 = [params[1], params[2]];
            var cp2 = [params[3], params[4]];
            segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]];
            segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
        }
        else if (command === 'S') {
            var preSegment = segments[i - 1];
            var cp1 = toSymmetry(preSegment.currentPoint, prePoint);
            var cp2 = [params[1], params[2]];
            if (preSegment.command === 'C') {
                segment.command = 'C'; // 将 S 命令变换为 C 命令
                segment.startTangent = [prePoint[0] - cp1[0], prePoint[1] - cp1[1]];
                segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
            }
            else {
                segment.command = 'SQ'; // 将 S 命令变换为 SQ 命令
                segment.startTangent = [prePoint[0] - cp2[0], prePoint[1] - cp2[1]];
                segment.endTangent = [currentPoint[0] - cp2[0], currentPoint[1] - cp2[1]];
            }
        }
        else if (command === 'A') {
            var d = 0.001;
            var _a = segment['arcParams'] || {}, _b = _a.cx, cx = _b === void 0 ? 0 : _b, _c = _a.cy, cy = _c === void 0 ? 0 : _c, _d = _a.rx, rx = _d === void 0 ? 0 : _d, _e = _a.ry, ry = _e === void 0 ? 0 : _e, _f = _a.sweepFlag, sweepFlag = _f === void 0 ? 0 : _f, _g = _a.startAngle, startAngle = _g === void 0 ? 0 : _g, _h = _a.endAngle, endAngle = _h === void 0 ? 0 : _h;
            if (sweepFlag === 0) {
                d *= -1;
            }
            var dx1 = rx * Math.cos(startAngle - d) + cx;
            var dy1 = ry * Math.sin(startAngle - d) + cy;
            segment.startTangent = [dx1 - startMovePoint[0], dy1 - startMovePoint[1]];
            var dx2 = rx * Math.cos(startAngle + endAngle + d) + cx;
            var dy2 = ry * Math.sin(startAngle + endAngle - d) + cy;
            segment.endTangent = [prePoint[0] - dx2, prePoint[1] - dy2];
        }
        segments.push(segment);
    }
    return segments;
}
exports.default = getSegments;

},{"./get-arc-params":722,"./parse-path":728}],732:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var rect_path_1 = require("./rect-path");
var path_2_curve_1 = require("./path-2-curve");
var base3 = function (t, p1, p2, p3, p4) {
    var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
    var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
    return t * t2 - 3 * p1 + 3 * p2;
};
var bezlen = function (x1, y1, x2, y2, x3, y3, x4, y4, z) {
    if (z === null) {
        z = 1;
    }
    z = z > 1 ? 1 : z < 0 ? 0 : z;
    var z2 = z / 2;
    var n = 12;
    var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816];
    var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
    var sum = 0;
    for (var i = 0; i < n; i++) {
        var ct = z2 * Tvalues[i] + z2;
        var xbase = base3(ct, x1, x2, x3, x4);
        var ybase = base3(ct, y1, y2, y3, y4);
        var comb = xbase * xbase + ybase * ybase;
        sum += Cvalues[i] * Math.sqrt(comb);
    }
    return z2 * sum;
};
var curveDim = function (x0, y0, x1, y1, x2, y2, x3, y3) {
    var tvalues = [];
    var bounds = [
        [],
        [],
    ];
    var a;
    var b;
    var c;
    var t;
    for (var i = 0; i < 2; ++i) {
        if (i === 0) {
            b = 6 * x0 - 12 * x1 + 6 * x2;
            a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
            c = 3 * x1 - 3 * x0;
        }
        else {
            b = 6 * y0 - 12 * y1 + 6 * y2;
            a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
            c = 3 * y1 - 3 * y0;
        }
        if (Math.abs(a) < 1e-12) {
            if (Math.abs(b) < 1e-12) {
                continue;
            }
            t = -c / b;
            if (t > 0 && t < 1) {
                tvalues.push(t);
            }
            continue;
        }
        var b2ac = b * b - 4 * c * a;
        var sqrtb2ac = Math.sqrt(b2ac);
        if (b2ac < 0) {
            continue;
        }
        var t1 = (-b + sqrtb2ac) / (2 * a);
        if (t1 > 0 && t1 < 1) {
            tvalues.push(t1);
        }
        var t2 = (-b - sqrtb2ac) / (2 * a);
        if (t2 > 0 && t2 < 1) {
            tvalues.push(t2);
        }
    }
    var j = tvalues.length;
    var jlen = j;
    var mt;
    while (j--) {
        t = tvalues[j];
        mt = 1 - t;
        bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);
        bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);
    }
    bounds[0][jlen] = x0;
    bounds[1][jlen] = y0;
    bounds[0][jlen + 1] = x3;
    bounds[1][jlen + 1] = y3;
    bounds[0].length = bounds[1].length = jlen + 2;
    return {
        min: {
            x: Math.min.apply(0, bounds[0]),
            y: Math.min.apply(0, bounds[1]),
        },
        max: {
            x: Math.max.apply(0, bounds[0]),
            y: Math.max.apply(0, bounds[1]),
        },
    };
};
var intersect = function (x1, y1, x2, y2, x3, y3, x4, y4) {
    if (Math.max(x1, x2) < Math.min(x3, x4) ||
        Math.min(x1, x2) > Math.max(x3, x4) ||
        Math.max(y1, y2) < Math.min(y3, y4) ||
        Math.min(y1, y2) > Math.max(y3, y4)) {
        return;
    }
    var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4);
    var ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4);
    var denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
    if (!denominator) {
        return;
    }
    var px = nx / denominator;
    var py = ny / denominator;
    var px2 = +px.toFixed(2);
    var py2 = +py.toFixed(2);
    if (px2 < +Math.min(x1, x2).toFixed(2) ||
        px2 > +Math.max(x1, x2).toFixed(2) ||
        px2 < +Math.min(x3, x4).toFixed(2) ||
        px2 > +Math.max(x3, x4).toFixed(2) ||
        py2 < +Math.min(y1, y2).toFixed(2) ||
        py2 > +Math.max(y1, y2).toFixed(2) ||
        py2 < +Math.min(y3, y4).toFixed(2) ||
        py2 > +Math.max(y3, y4).toFixed(2)) {
        return;
    }
    return {
        x: px,
        y: py,
    };
};
var isPointInsideBBox = function (bbox, x, y) {
    return x >= bbox.x &&
        x <= bbox.x + bbox.width &&
        y >= bbox.y &&
        y <= bbox.y + bbox.height;
};
var box = function (x, y, width, height) {
    if (x === null) {
        x = y = width = height = 0;
    }
    if (y === null) {
        y = x.y;
        width = x.width;
        height = x.height;
        x = x.x;
    }
    return {
        x: x,
        y: y,
        width: width,
        w: width,
        height: height,
        h: height,
        x2: x + width,
        y2: y + height,
        cx: x + width / 2,
        cy: y + height / 2,
        r1: Math.min(width, height) / 2,
        r2: Math.max(width, height) / 2,
        r0: Math.sqrt(width * width + height * height) / 2,
        path: rect_path_1.default(x, y, width, height),
        vb: [x, y, width, height].join(' '),
    };
};
var isBBoxIntersect = function (bbox1, bbox2) {
    // @ts-ignore
    bbox1 = box(bbox1);
    // @ts-ignore
    bbox2 = box(bbox2);
    return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
};
var bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
    if (!util_1.isArray(p1x)) {
        p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
    }
    var bbox = curveDim.apply(null, p1x);
    return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y);
};
var findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
    var t1 = 1 - t;
    var t13 = Math.pow(t1, 3);
    var t12 = Math.pow(t1, 2);
    var t2 = t * t;
    var t3 = t2 * t;
    var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;
    var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;
    var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);
    var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);
    var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);
    var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);
    var ax = t1 * p1x + t * c1x;
    var ay = t1 * p1y + t * c1y;
    var cx = t1 * c2x + t * p2x;
    var cy = t1 * c2y + t * p2y;
    var alpha = (90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI);
    // (mx > nx || my < ny) && (alpha += 180);
    return {
        x: x,
        y: y,
        m: {
            x: mx,
            y: my,
        },
        n: {
            x: nx,
            y: ny,
        },
        start: {
            x: ax,
            y: ay,
        },
        end: {
            x: cx,
            y: cy,
        },
        alpha: alpha,
    };
};
var interHelper = function (bez1, bez2, justCount) {
    // @ts-ignore
    var bbox1 = bezierBBox(bez1);
    // @ts-ignore
    var bbox2 = bezierBBox(bez2);
    if (!isBBoxIntersect(bbox1, bbox2)) {
        return justCount ? 0 : [];
    }
    var l1 = bezlen.apply(0, bez1);
    var l2 = bezlen.apply(0, bez2);
    var n1 = ~~(l1 / 8);
    var n2 = ~~(l2 / 8);
    var dots1 = [];
    var dots2 = [];
    var xy = {};
    var res = justCount ? 0 : [];
    for (var i = 0; i < n1 + 1; i++) {
        var d = findDotsAtSegment.apply(0, bez1.concat(i / n1));
        dots1.push({
            x: d.x,
            y: d.y,
            t: i / n1,
        });
    }
    for (var i = 0; i < n2 + 1; i++) {
        var d = findDotsAtSegment.apply(0, bez2.concat(i / n2));
        dots2.push({
            x: d.x,
            y: d.y,
            t: i / n2,
        });
    }
    for (var i = 0; i < n1; i++) {
        for (var j = 0; j < n2; j++) {
            var di = dots1[i];
            var di1 = dots1[i + 1];
            var dj = dots2[j];
            var dj1 = dots2[j + 1];
            var ci = Math.abs(di1.x - di.x) < 0.001 ? 'y' : 'x';
            var cj = Math.abs(dj1.x - dj.x) < 0.001 ? 'y' : 'x';
            var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
            if (is) {
                if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) {
                    continue;
                }
                xy[is.x.toFixed(4)] = is.y.toFixed(4);
                var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t);
                var t2 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
                if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
                    if (justCount) {
                        // @ts-ignore
                        res++;
                    }
                    else {
                        // @ts-ignore
                        res.push({
                            x: is.x,
                            y: is.y,
                            t1: t1,
                            t2: t2,
                        });
                    }
                }
            }
        }
    }
    return res;
};
var interPathHelper = function (path1, path2, justCount) {
    // @ts-ignore
    path1 = path_2_curve_1.default(path1);
    // @ts-ignore
    path2 = path_2_curve_1.default(path2);
    var x1;
    var y1;
    var x2;
    var y2;
    var x1m;
    var y1m;
    var x2m;
    var y2m;
    var bez1;
    var bez2;
    var res = justCount ? 0 : [];
    for (var i = 0, ii = path1.length; i < ii; i++) {
        var pi = path1[i];
        if (pi[0] === 'M') {
            x1 = x1m = pi[1];
            y1 = y1m = pi[2];
        }
        else {
            if (pi[0] === 'C') {
                bez1 = [x1, y1].concat(pi.slice(1));
                x1 = bez1[6];
                y1 = bez1[7];
            }
            else {
                bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
                x1 = x1m;
                y1 = y1m;
            }
            for (var j = 0, jj = path2.length; j < jj; j++) {
                var pj = path2[j];
                if (pj[0] === 'M') {
                    x2 = x2m = pj[1];
                    y2 = y2m = pj[2];
                }
                else {
                    if (pj[0] === 'C') {
                        bez2 = [x2, y2].concat(pj.slice(1));
                        x2 = bez2[6];
                        y2 = bez2[7];
                    }
                    else {
                        bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
                        x2 = x2m;
                        y2 = y2m;
                    }
                    var intr = interHelper(bez1, bez2, justCount);
                    if (justCount) {
                        // @ts-ignore
                        res += intr;
                    }
                    else {
                        // @ts-ignore
                        for (var k = 0, kk = intr.length; k < kk; k++) {
                            intr[k].segment1 = i;
                            intr[k].segment2 = j;
                            intr[k].bez1 = bez1;
                            intr[k].bez2 = bez2;
                        }
                        // @ts-ignore
                        res = res.concat(intr);
                    }
                }
            }
        }
    }
    return res;
};
function pathIntersection(path1, path2) {
    // @ts-ignore
    return interPathHelper(path1, path2);
}
exports.default = pathIntersection;

},{"./path-2-curve":730,"./rect-path":734,"@antv/util":803}],733:[function(require,module,exports){
"use strict";
/**
 * @fileoverview 判断点是否在多边形内
 * @author dxq613@gmail.com
 */
Object.defineProperty(exports, "__esModule", { value: true });
// 多边形的射线检测，参考：https://blog.csdn.net/WilliamSun0122/article/details/77994526
var tolerance = 1e-6;
// 三态函数，判断两个double在eps精度下的大小关系
function dcmp(x) {
    if (Math.abs(x) < tolerance) {
        return 0;
    }
    return x < 0 ? -1 : 1;
}
// 判断点Q是否在p1和p2的线段上
function onSegment(p1, p2, q) {
    if ((q[0] - p1[0]) * (p2[1] - p1[1]) === (p2[0] - p1[0]) * (q[1] - p1[1]) &&
        Math.min(p1[0], p2[0]) <= q[0] &&
        q[0] <= Math.max(p1[0], p2[0]) &&
        Math.min(p1[1], p2[1]) <= q[1] &&
        q[1] <= Math.max(p1[1], p2[1])) {
        return true;
    }
    return false;
}
// 判断点P在多边形内-射线法
function isInPolygon(points, x, y) {
    var isHit = false;
    var n = points.length;
    if (n <= 2) {
        // svg 中点小于 3 个时，不显示，也无法被拾取
        return false;
    }
    for (var i = 0; i < n; i++) {
        var p1 = points[i];
        var p2 = points[(i + 1) % n];
        if (onSegment(p1, p2, [x, y])) {
            // 点在多边形一条边上
            return true;
        }
        // 前一个判断min(p1[1],p2[1])<P.y<=max(p1[1],p2[1])
        // 后一个判断被测点 在 射线与边交点 的左边
        if (dcmp(p1[1] - y) > 0 !== dcmp(p2[1] - y) > 0 &&
            dcmp(x - ((y - p1[1]) * (p1[0] - p2[0])) / (p1[1] - p2[1]) - p1[0]) < 0) {
            isHit = !isHit;
        }
    }
    return isHit;
}
exports.default = isInPolygon;

},{}],734:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function rectPath(x, y, w, h, r) {
    if (r) {
        return [
            ['M', +x + (+r), y],
            ['l', w - r * 2, 0],
            ['a', r, r, 0, 0, 1, r, r],
            ['l', 0, h - r * 2],
            ['a', r, r, 0, 0, 1, -r, r],
            ['l', r * 2 - w, 0],
            ['a', r, r, 0, 0, 1, -r, -r],
            ['l', 0, r * 2 - h],
            ['a', r, r, 0, 0, 1, r, -r],
            ['z'],
        ];
    }
    return [
        ['M', x, y],
        ['l', w, 0],
        ['l', 0, h],
        ['l', -w, 0],
        ['z'],
    ];
    // res.parsePathArray = parsePathArray;
}
exports.default = rectPath;

},{}],735:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var register_1 = require("./tick-method/register");
var Scale = /** @class */ (function () {
    function Scale(cfg) {
        /**
         * 度量的类型
         */
        this.type = 'base';
        /**
         * 是否分类类型的度量
         */
        this.isCategory = false;
        /**
         * 是否线性度量，有linear, time 度量
         */
        this.isLinear = false;
        /**
         * 是否连续类型的度量，linear,time,log, pow, quantile, quantize 都支持
         */
        this.isContinuous = false;
        /**
         * 是否是常量的度量，传入和传出一致
         */
        this.isIdentity = false;
        this.values = [];
        this.range = [0, 1];
        this.ticks = [];
        this.__cfg__ = cfg;
        this.initCfg();
        this.init();
    }
    // 对于原始值的必要转换，如分类、时间字段需转换成数值，用transform/map命名可能更好
    Scale.prototype.translate = function (v) {
        return v;
    };
    /** 重新初始化 */
    Scale.prototype.change = function (cfg) {
        // 覆盖配置项，而不替代
        util_1.assign(this.__cfg__, cfg);
        this.init();
    };
    Scale.prototype.clone = function () {
        return this.constructor(this.__cfg__);
    };
    /** 获取坐标轴需要的ticks */
    Scale.prototype.getTicks = function () {
        var _this = this;
        return util_1.map(this.ticks, function (tick, idx) {
            if (util_1.isObject(tick)) {
                // 仅当符合Tick类型时才有意义
                return tick;
            }
            return {
                text: _this.getText(tick, idx),
                tickValue: tick,
                value: _this.scale(tick),
            };
        });
    };
    /** 获取Tick的格式化结果 */
    Scale.prototype.getText = function (value, key) {
        var formatter = this.formatter;
        var res = formatter ? formatter(value, key) : value;
        if (util_1.isNil(res) || !util_1.isFunction(res.toString)) {
            return '';
        }
        return res.toString();
    };
    // 获取配置项中的值，当前 scale 上的值可能会被修改
    Scale.prototype.getConfig = function (key) {
        return this.__cfg__[key];
    };
    // scale初始化
    Scale.prototype.init = function () {
        util_1.assign(this, this.__cfg__);
        this.setDomain();
        if (util_1.isEmpty(this.getConfig('ticks'))) {
            this.ticks = this.calculateTicks();
        }
    };
    // 子类上覆盖某些属性，不能直接在类上声明，否则会被覆盖
    Scale.prototype.initCfg = function () { };
    Scale.prototype.setDomain = function () { };
    Scale.prototype.calculateTicks = function () {
        var tickMethod = this.tickMethod;
        var ticks = [];
        if (util_1.isString(tickMethod)) {
            var method = register_1.getTickMethod(tickMethod);
            if (!method) {
                throw new Error('There is no method to to calculate ticks!');
            }
            ticks = method(this);
        }
        else if (util_1.isFunction(tickMethod)) {
            ticks = tickMethod(this);
        }
        return ticks;
    };
    // range 的最小值
    Scale.prototype.rangeMin = function () {
        return util_1.head(this.range);
    };
    // range 的最大值
    Scale.prototype.rangeMax = function () {
        return util_1.last(this.range);
    };
    /** 定义域转 0~1 */
    Scale.prototype.calcPercent = function (value, min, max) {
        if (util_1.isNumber(value)) {
            return (value - min) / (max - min);
        }
        return NaN;
    };
    /** 0~1转定义域 */
    Scale.prototype.calcValue = function (percent, min, max) {
        return min + percent * (max - min);
    };
    return Scale;
}());
exports.default = Scale;

},{"./tick-method/register":756,"@antv/util":803}],736:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
/**
 * 分类度量
 * @class
 */
var Category = /** @class */ (function (_super) {
    tslib_1.__extends(Category, _super);
    function Category() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'cat';
        _this.isCategory = true;
        return _this;
    }
    Category.prototype.translate = function (value) {
        var index = util_1.indexOf(this.values, value);
        if (index === -1) {
            return util_1.isNumber(value) ? value : NaN;
        }
        return index;
    };
    Category.prototype.scale = function (value) {
        var order = this.translate(value);
        // 分类数据允许 0.5 范围内调整
        // if (order < this.min - 0.5 || order > this.max + 0.5) {
        //   return NaN;
        // }
        var percent = this.calcPercent(order, this.min, this.max);
        return this.calcValue(percent, this.rangeMin(), this.rangeMax());
    };
    Category.prototype.invert = function (scaledValue) {
        var domainRange = this.max - this.min;
        var percent = this.calcPercent(scaledValue, this.rangeMin(), this.rangeMax());
        var idx = Math.round(domainRange * percent) + this.min;
        if (idx < this.min || idx > this.max) {
            return NaN;
        }
        return this.values[idx];
    };
    Category.prototype.getText = function (value) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        var v = value;
        // value为index
        if (util_1.isNumber(value) && !this.values.includes(value)) {
            v = this.values[v];
        }
        return _super.prototype.getText.apply(this, tslib_1.__spreadArrays([v], args));
    };
    // 复写属性
    Category.prototype.initCfg = function () {
        this.tickMethod = 'cat';
    };
    // 设置 min, max
    Category.prototype.setDomain = function () {
        // 用户有可能设置 min
        if (util_1.isNil(this.getConfig('min'))) {
            this.min = 0;
        }
        if (util_1.isNil(this.getConfig('max'))) {
            var size = this.values.length;
            this.max = size > 1 ? size - 1 : size;
        }
    };
    return Category;
}(base_1.default));
exports.default = Category;

},{"../base":735,"@antv/util":803,"tslib":768}],737:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var time_1 = require("../util/time");
var base_1 = require("./base");
/**
 * 时间分类度量
 * @class
 */
var TimeCat = /** @class */ (function (_super) {
    tslib_1.__extends(TimeCat, _super);
    function TimeCat() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'timeCat';
        return _this;
    }
    /**
     * @override
     */
    TimeCat.prototype.translate = function (value) {
        value = time_1.toTimeStamp(value);
        var index = this.values.indexOf(value);
        if (index === -1) {
            if (util_1.isNumber(value) && value < this.values.length) {
                index = value;
            }
            else {
                index = NaN;
            }
        }
        return index;
    };
    /**
     * 由于时间类型数据需要转换一下，所以复写 getText
     * @override
     */
    TimeCat.prototype.getText = function (value, tickIndex) {
        var index = this.translate(value);
        if (index > -1) {
            var result = this.values[index];
            var formatter = this.formatter;
            result = formatter ? formatter(result, tickIndex) : time_1.timeFormat(result, this.mask);
            return result;
        }
        return value;
    };
    TimeCat.prototype.initCfg = function () {
        this.tickMethod = 'time-cat';
        this.mask = 'YYYY-MM-DD';
        this.tickCount = 7; // 一般时间数据会显示 7， 14， 30 天的数字
    };
    TimeCat.prototype.setDomain = function () {
        var values = this.values;
        // 针对时间分类类型，会将时间统一转换为时间戳
        util_1.each(values, function (v, i) {
            values[i] = time_1.toTimeStamp(v);
        });
        values.sort(function (v1, v2) {
            return v1 - v2;
        });
        _super.prototype.setDomain.call(this);
    };
    return TimeCat;
}(base_1.default));
exports.default = TimeCat;

},{"../util/time":767,"./base":736,"@antv/util":803,"tslib":768}],738:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
/**
 * 连续度量的基类
 * @class
 */
var Continuous = /** @class */ (function (_super) {
    tslib_1.__extends(Continuous, _super);
    function Continuous() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.isContinuous = true;
        return _this;
    }
    Continuous.prototype.scale = function (value) {
        if (util_1.isNil(value)) {
            return NaN;
        }
        var rangeMin = this.rangeMin();
        var rangeMax = this.rangeMax();
        var max = this.max;
        var min = this.min;
        if (max === min) {
            return rangeMin;
        }
        var percent = this.getScalePercent(value);
        return rangeMin + percent * (rangeMax - rangeMin);
    };
    Continuous.prototype.init = function () {
        _super.prototype.init.call(this);
        // init 完成后保证 min, max 包含 ticks 的范围
        var ticks = this.ticks;
        var firstTick = util_1.head(ticks);
        var lastTick = util_1.last(ticks);
        if (firstTick < this.min) {
            this.min = firstTick;
        }
        if (lastTick > this.max) {
            this.max = lastTick;
        }
        // strict-limit 方式
        if (!util_1.isNil(this.minLimit)) {
            this.min = firstTick;
        }
        if (!util_1.isNil(this.maxLimit)) {
            this.max = lastTick;
        }
    };
    Continuous.prototype.setDomain = function () {
        var _a = util_1.getRange(this.values), min = _a.min, max = _a.max;
        if (util_1.isNil(this.min)) {
            this.min = min;
        }
        if (util_1.isNil(this.max)) {
            this.max = max;
        }
        if (this.min > this.max) {
            this.min = min;
            this.max = max;
        }
    };
    Continuous.prototype.calculateTicks = function () {
        var _this = this;
        var ticks = _super.prototype.calculateTicks.call(this);
        if (!this.nice) {
            ticks = util_1.filter(ticks, function (tick) {
                return tick >= _this.min && tick <= _this.max;
            });
        }
        return ticks;
    };
    // 计算原始值值占的百分比
    Continuous.prototype.getScalePercent = function (value) {
        var max = this.max;
        var min = this.min;
        return (value - min) / (max - min);
    };
    Continuous.prototype.getInvertPercent = function (value) {
        return (value - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
    };
    return Continuous;
}(base_1.default));
exports.default = Continuous;

},{"../base":735,"@antv/util":803,"tslib":768}],739:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
/**
 * 线性度量
 * @class
 */
var Linear = /** @class */ (function (_super) {
    tslib_1.__extends(Linear, _super);
    function Linear() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'linear';
        _this.isLinear = true;
        return _this;
    }
    Linear.prototype.invert = function (value) {
        var percent = this.getInvertPercent(value);
        return this.min + percent * (this.max - this.min);
    };
    Linear.prototype.initCfg = function () {
        this.tickMethod = 'wilkinson-extended';
        this.nice = false;
    };
    return Linear;
}(base_1.default));
exports.default = Linear;

},{"./base":738,"tslib":768}],740:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var math_1 = require("../util/math");
var base_1 = require("./base");
/**
 * Log 度量，处理非均匀分布
 */
var Log = /** @class */ (function (_super) {
    tslib_1.__extends(Log, _super);
    function Log() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'log';
        return _this;
    }
    /**
     * @override
     */
    Log.prototype.invert = function (value) {
        var base = this.base;
        var max = math_1.log(base, this.max);
        var rangeMin = this.rangeMin();
        var range = this.rangeMax() - rangeMin;
        var min;
        var positiveMin = this.positiveMin;
        if (positiveMin) {
            if (value === 0) {
                return 0;
            }
            min = math_1.log(base, positiveMin / base);
            var appendPercent = (1 / (max - min)) * range; // 0 到 positiveMin的占比
            if (value < appendPercent) {
                // 落到 0 - positiveMin 之间
                return (value / appendPercent) * positiveMin;
            }
        }
        else {
            min = math_1.log(base, this.min);
        }
        var percent = (value - rangeMin) / range;
        var tmp = percent * (max - min) + min;
        return Math.pow(base, tmp);
    };
    Log.prototype.initCfg = function () {
        this.tickMethod = 'log';
        this.base = 10;
        this.tickCount = 6;
        this.nice = true;
    };
    // 设置
    Log.prototype.setDomain = function () {
        _super.prototype.setDomain.call(this);
        var min = this.min;
        if (min < 0) {
            throw new Error('When you use log scale, the minimum value must be greater than zero!');
        }
        if (min === 0) {
            this.positiveMin = math_1.getLogPositiveMin(this.values, this.base, this.max);
        }
    };
    // 根据当前值获取占比
    Log.prototype.getScalePercent = function (value) {
        var max = this.max;
        var min = this.min;
        if (max === min) {
            return 0;
        }
        // 如果值小于等于0，则按照0处理
        if (value <= 0) {
            return 0;
        }
        var base = this.base;
        var positiveMin = this.positiveMin;
        // 如果min == 0, 则根据比0大的最小值，计算比例关系。这个最小值作为坐标轴上的第二个tick，第一个是0但是不显示
        if (positiveMin) {
            min = (positiveMin * 1) / base;
        }
        var percent;
        // 如果数值小于次小值，那么就计算 value / 次小值 占整体的比例
        if (value < positiveMin) {
            percent = value / positiveMin / (math_1.log(base, max) - math_1.log(base, min));
        }
        else {
            percent = (math_1.log(base, value) - math_1.log(base, min)) / (math_1.log(base, max) - math_1.log(base, min));
        }
        return percent;
    };
    return Log;
}(base_1.default));
exports.default = Log;

},{"../util/math":764,"./base":738,"tslib":768}],741:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var math_1 = require("../util/math");
var base_1 = require("./base");
/**
 * Pow 度量，处理非均匀分布
 */
var Pow = /** @class */ (function (_super) {
    tslib_1.__extends(Pow, _super);
    function Pow() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'pow';
        return _this;
    }
    /**
     * @override
     */
    Pow.prototype.invert = function (value) {
        var percent = this.getInvertPercent(value);
        var exponent = this.exponent;
        var max = math_1.calBase(exponent, this.max);
        var min = math_1.calBase(exponent, this.min);
        var tmp = percent * (max - min) + min;
        var factor = tmp >= 0 ? 1 : -1;
        return Math.pow(tmp, exponent) * factor;
    };
    Pow.prototype.initCfg = function () {
        this.tickMethod = 'pow';
        this.exponent = 2;
        this.tickCount = 5;
        this.nice = true;
    };
    // 获取度量计算时，value占的定义域百分比
    Pow.prototype.getScalePercent = function (value) {
        var max = this.max;
        var min = this.min;
        if (max === min) {
            return 0;
        }
        var exponent = this.exponent;
        var percent = (math_1.calBase(exponent, value) - math_1.calBase(exponent, min)) / (math_1.calBase(exponent, max) - math_1.calBase(exponent, min));
        return percent;
    };
    return Pow;
}(base_1.default));
exports.default = Pow;

},{"../util/math":764,"./base":738,"tslib":768}],742:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var quantize_1 = require("./quantize");
var Quantile = /** @class */ (function (_super) {
    tslib_1.__extends(Quantile, _super);
    function Quantile() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'quantile';
        return _this;
    }
    Quantile.prototype.initCfg = function () {
        this.tickMethod = 'quantile';
        this.tickCount = 5;
        this.nice = true;
    };
    return Quantile;
}(quantize_1.default));
exports.default = Quantile;

},{"./quantize":743,"tslib":768}],743:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("./base");
/**
 * 分段度量
 */
var Quantize = /** @class */ (function (_super) {
    tslib_1.__extends(Quantize, _super);
    function Quantize() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'quantize';
        return _this;
    }
    Quantize.prototype.invert = function (value) {
        var ticks = this.ticks;
        var length = ticks.length;
        var percent = this.getInvertPercent(value);
        var minIndex = Math.floor(percent * (length - 1));
        // 最后一个
        if (minIndex >= length - 1) {
            return util_1.last(ticks);
        }
        // 超出左边界， 则取第一个
        if (minIndex < 0) {
            return util_1.head(ticks);
        }
        var minTick = ticks[minIndex];
        var nextTick = ticks[minIndex + 1];
        // 比当前值小的 tick 在度量上的占比
        var minIndexPercent = minIndex / (length - 1);
        var maxIndexPercent = (minIndex + 1) / (length - 1);
        return minTick + (percent - minIndexPercent) / (maxIndexPercent - minIndexPercent) * (nextTick - minTick);
    };
    Quantize.prototype.initCfg = function () {
        this.tickMethod = 'r-pretty';
        this.tickCount = 5;
        this.nice = true;
    };
    Quantize.prototype.calculateTicks = function () {
        var ticks = _super.prototype.calculateTicks.call(this);
        if (!this.nice) { // 如果 nice = false ,补充 min, max
            if (util_1.last(ticks) !== this.max) {
                ticks.push(this.max);
            }
            if (util_1.head(ticks) !== this.min) {
                ticks.unshift(this.min);
            }
        }
        return ticks;
    };
    // 计算当前值在刻度中的占比
    Quantize.prototype.getScalePercent = function (value) {
        var ticks = this.ticks;
        // 超出左边界
        if (value < util_1.head(ticks)) {
            return 0;
        }
        // 超出右边界
        if (value > util_1.last(ticks)) {
            return 1;
        }
        var minIndex = 0;
        util_1.each(ticks, function (tick, index) {
            if (value >= tick) {
                minIndex = index;
            }
            else {
                return false;
            }
        });
        return minIndex / (ticks.length - 1);
    };
    return Quantize;
}(base_1.default));
exports.default = Quantize;

},{"./base":738,"@antv/util":803,"tslib":768}],744:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var time_1 = require("../util/time");
var linear_1 = require("./linear");
/**
 * 时间度量
 * @class
 */
var Time = /** @class */ (function (_super) {
    tslib_1.__extends(Time, _super);
    function Time() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'time';
        return _this;
    }
    /**
     * @override
     */
    Time.prototype.getText = function (value, index) {
        var numberValue = this.translate(value);
        var formatter = this.formatter;
        return formatter ? formatter(numberValue, index) : time_1.timeFormat(numberValue, this.mask);
    };
    /**
     * @override
     */
    Time.prototype.scale = function (value) {
        var v = value;
        if (util_1.isString(v) || util_1.isDate(v)) {
            v = this.translate(v);
        }
        return _super.prototype.scale.call(this, v);
    };
    /**
     * 将时间转换成数字
     * @override
     */
    Time.prototype.translate = function (v) {
        return time_1.toTimeStamp(v);
    };
    Time.prototype.initCfg = function () {
        this.tickMethod = 'time-pretty';
        this.mask = 'YYYY-MM-DD';
        this.tickCount = 7;
        this.nice = false;
    };
    Time.prototype.setDomain = function () {
        var values = this.values;
        // 是否设置了 min, max，而不是直接取 this.min, this.max
        var minConfig = this.getConfig('min');
        var maxConfig = this.getConfig('max');
        // 如果设置了 min,max 则转换成时间戳
        if (!util_1.isNil(minConfig) || !util_1.isNumber(minConfig)) {
            this.min = this.translate(this.min);
        }
        if (!util_1.isNil(maxConfig) || !util_1.isNumber(maxConfig)) {
            this.max = this.translate(this.max);
        }
        // 没有设置 min, max 时
        if (values && values.length) {
            // 重新计算最大最小值
            var timeStamps_1 = [];
            var min_1 = Infinity; // 最小值
            var secondMin_1 = min_1; // 次小值
            var max_1 = 0;
            // 使用一个循环，计算min,max,secondMin
            util_1.each(values, function (v) {
                var timeStamp = time_1.toTimeStamp(v);
                if (isNaN(timeStamp)) {
                    throw new TypeError("Invalid Time: " + v + " in time scale!");
                }
                if (min_1 > timeStamp) {
                    secondMin_1 = min_1;
                    min_1 = timeStamp;
                }
                else if (secondMin_1 > timeStamp) {
                    secondMin_1 = timeStamp;
                }
                if (max_1 < timeStamp) {
                    max_1 = timeStamp;
                }
                timeStamps_1.push(timeStamp);
            });
            // 存在多个值时，设置最小间距
            if (values.length > 1) {
                this.minTickInterval = secondMin_1 - min_1;
            }
            if (util_1.isNil(minConfig)) {
                this.min = min_1;
            }
            if (util_1.isNil(maxConfig)) {
                this.max = max_1;
            }
        }
    };
    return Time;
}(linear_1.default));
exports.default = Time;

},{"../util/time":767,"./linear":739,"@antv/util":803,"tslib":768}],745:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerScale = exports.getScale = exports.Scale = void 0;
var base_1 = require("./base");
exports.Scale = base_1.default;
var map = {};
function getClass(key) {
    return map[key];
}
exports.getScale = getClass;
function registerClass(key, cls) {
    if (getClass(key)) {
        throw new Error("type '" + key + "' existed.");
    }
    map[key] = cls;
}
exports.registerScale = registerClass;

},{"./base":735}],746:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("@antv/util");
var base_1 = require("../base");
/**
 * identity scale原则上是定义域和值域一致，scale/invert方法也是一致的
 * 参考R的实现：https://github.com/r-lib/scales/blob/master/R/pal-identity.r
 * 参考d3的实现（做了下转型）：https://github.com/d3/d3-scale/blob/master/src/identity.js
 */
var Identity = /** @class */ (function (_super) {
    tslib_1.__extends(Identity, _super);
    function Identity() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = 'identity';
        _this.isIdentity = true;
        return _this;
    }
    Identity.prototype.calculateTicks = function () {
        return this.values;
    };
    Identity.prototype.scale = function (value) {
        // 如果传入的值不等于 identity 的值，则直接返回，用于一维图时的 dodge
        if (this.values[0] !== value && util_1.isNumber(value)) {
            return value;
        }
        return this.range[0];
    };
    Identity.prototype.invert = function (value) {
        var range = this.range;
        if (value < range[0] || value > range[1]) {
            return NaN;
        }
        return this.values[0];
    };
    return Identity;
}(base_1.default));
exports.default = Identity;

},{"../base":735,"@antv/util":803,"tslib":768}],747:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerTickMethod = exports.getTickMethod = exports.registerScale = exports.getScale = exports.Scale = exports.Quantize = exports.Quantile = exports.TimeCat = exports.Time = exports.Pow = exports.Log = exports.Linear = exports.Identity = exports.Category = void 0;
var base_1 = require("./base");
exports.Scale = base_1.default;
var base_2 = require("./category/base");
exports.Category = base_2.default;
var time_1 = require("./category/time");
exports.TimeCat = time_1.default;
var linear_1 = require("./continuous/linear");
exports.Linear = linear_1.default;
var log_1 = require("./continuous/log");
exports.Log = log_1.default;
var pow_1 = require("./continuous/pow");
exports.Pow = pow_1.default;
var time_2 = require("./continuous/time");
exports.Time = time_2.default;
var quantize_1 = require("./continuous/quantize");
exports.Quantize = quantize_1.default;
var quantile_1 = require("./continuous/quantile");
exports.Quantile = quantile_1.default;
var factory_1 = require("./factory");
Object.defineProperty(exports, "getScale", { enumerable: true, get: function () { return factory_1.getScale; } });
Object.defineProperty(exports, "registerScale", { enumerable: true, get: function () { return factory_1.registerScale; } });
var index_1 = require("./identity/index");
exports.Identity = index_1.default;
var index_2 = require("./tick-method/index");
Object.defineProperty(exports, "getTickMethod", { enumerable: true, get: function () { return index_2.getTickMethod; } });
Object.defineProperty(exports, "registerTickMethod", { enumerable: true, get: function () { return index_2.registerTickMethod; } });
factory_1.registerScale('cat', base_2.default);
factory_1.registerScale('category', base_2.default);
factory_1.registerScale('identity', index_1.default);
factory_1.registerScale('linear', linear_1.default);
factory_1.registerScale('log', log_1.default);
factory_1.registerScale('pow', pow_1.default);
factory_1.registerScale('time', time_2.default);
factory_1.registerScale('timeCat', time_1.default);
factory_1.registerScale('quantize', quantize_1.default);
factory_1.registerScale('quantile', quantile_1.default);

},{"./base":735,"./category/base":736,"./category/time":737,"./continuous/linear":739,"./continuous/log":740,"./continuous/pow":741,"./continuous/quantile":742,"./continuous/quantize":743,"./continuous/time":744,"./factory":745,"./identity/index":746,"./tick-method/index":750}],748:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var extended_1 = require("../util/extended");
/**
 * 计算分类 ticks
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function calculateCatTicks(cfg) {
    var values = cfg.values, tickInterval = cfg.tickInterval, tickCount = cfg.tickCount;
    var ticks = values;
    if (util_1.isNumber(tickInterval)) {
        return util_1.filter(ticks, function (__, i) { return i % tickInterval === 0; });
    }
    var min = cfg.min, max = cfg.max;
    if (util_1.isNil(min)) {
        min = 0;
    }
    if (util_1.isNil(max)) {
        max = values.length - 1;
    }
    if (util_1.isNumber(tickCount) && tickCount < max - min) {
        // 简单过滤，部分情况下小数的倍数也可以是整数
        // tslint:disable-next-line: no-shadowed-variable
        var ticks_1 = extended_1.default(min, max, tickCount, false, [1, 2, 5, 3, 4, 7, 6, 8, 9]).ticks;
        var valid = util_1.filter(ticks_1, function (tick) { return tick >= min && tick <= max; });
        return valid.map(function (index) { return values[index]; });
    }
    return values.slice(min, max + 1);
}
exports.default = calculateCatTicks;

},{"../util/extended":762,"@antv/util":803}],749:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var d3_linear_1 = require("../util/d3-linear");
var interval_1 = require("../util/interval");
var strict_limit_1 = require("../util/strict-limit");
function d3LinearTickMethod(cfg) {
    var min = cfg.min, max = cfg.max, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
    var ticks = d3_linear_1.default(cfg);
    if (!util_1.isNil(minLimit) || !util_1.isNil(maxLimit)) {
        return strict_limit_1.default(cfg, util_1.head(ticks), util_1.last(ticks));
    }
    if (tickInterval) {
        return interval_1.default(min, max, tickInterval).ticks;
    }
    return ticks;
}
exports.default = d3LinearTickMethod;

},{"../util/d3-linear":761,"../util/interval":763,"../util/strict-limit":766,"@antv/util":803}],750:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerTickMethod = exports.getTickMethod = void 0;
var cat_1 = require("./cat");
var d3_linear_1 = require("./d3-linear");
var linear_1 = require("./linear");
var log_1 = require("./log");
var pow_1 = require("./pow");
var quantile_1 = require("./quantile");
var r_prettry_1 = require("./r-prettry");
var register_1 = require("./register");
Object.defineProperty(exports, "getTickMethod", { enumerable: true, get: function () { return register_1.getTickMethod; } });
Object.defineProperty(exports, "registerTickMethod", { enumerable: true, get: function () { return register_1.registerTickMethod; } });
var time_1 = require("./time");
var time_cat_1 = require("./time-cat");
var time_pretty_1 = require("./time-pretty");
register_1.registerTickMethod('cat', cat_1.default);
register_1.registerTickMethod('time-cat', time_cat_1.default);
register_1.registerTickMethod('wilkinson-extended', linear_1.default);
register_1.registerTickMethod('r-pretty', r_prettry_1.default);
register_1.registerTickMethod('time', time_1.default);
register_1.registerTickMethod('time-pretty', time_pretty_1.default);
register_1.registerTickMethod('log', log_1.default);
register_1.registerTickMethod('pow', pow_1.default);
register_1.registerTickMethod('quantile', quantile_1.default);
register_1.registerTickMethod('d3-linear', d3_linear_1.default);

},{"./cat":748,"./d3-linear":749,"./linear":751,"./log":752,"./pow":753,"./quantile":754,"./r-prettry":755,"./register":756,"./time":759,"./time-cat":757,"./time-pretty":758}],751:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var extended_1 = require("../util/extended");
var interval_1 = require("../util/interval");
var strict_limit_1 = require("../util/strict-limit");
/**
 * 计算线性的 ticks，使用 wilkinson extended 方法
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function linear(cfg) {
    var min = cfg.min, max = cfg.max, tickCount = cfg.tickCount, nice = cfg.nice, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
    var ticks = extended_1.default(min, max, tickCount, nice).ticks;
    if (!util_1.isNil(minLimit) || !util_1.isNil(maxLimit)) {
        return strict_limit_1.default(cfg, util_1.head(ticks), util_1.last(ticks));
    }
    if (tickInterval) {
        return interval_1.default(min, max, tickInterval).ticks;
    }
    return ticks;
}
exports.default = linear;

},{"../util/extended":762,"../util/interval":763,"../util/strict-limit":766,"@antv/util":803}],752:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var math_1 = require("../util/math");
/**
 * 计算 log 的 ticks，考虑 min = 0 的场景
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function calculateLogTicks(cfg) {
    var base = cfg.base, tickCount = cfg.tickCount, min = cfg.min, max = cfg.max, values = cfg.values;
    var minTick;
    var maxTick = math_1.log(base, max);
    if (min > 0) {
        minTick = Math.floor(math_1.log(base, min));
    }
    else {
        var positiveMin = math_1.getLogPositiveMin(values, base, max);
        minTick = Math.floor(math_1.log(base, positiveMin));
    }
    var count = maxTick - minTick;
    var avg = Math.ceil(count / tickCount);
    var ticks = [];
    for (var i = minTick; i < maxTick + avg; i = i + avg) {
        ticks.push(Math.pow(base, i));
    }
    if (min <= 0) {
        // 最小值 <= 0 时显示 0
        ticks.unshift(0);
    }
    return ticks;
}
exports.default = calculateLogTicks;

},{"../util/math":764}],753:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var math_1 = require("../util/math");
var pretty_1 = require("../util/pretty");
/**
 * 计算 Pow 的 ticks
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function calculatePowTicks(cfg) {
    var exponent = cfg.exponent, tickCount = cfg.tickCount;
    var max = Math.ceil(math_1.calBase(exponent, cfg.max));
    var min = Math.floor(math_1.calBase(exponent, cfg.min));
    var ticks = pretty_1.default(min, max, tickCount).ticks;
    return ticks.map(function (tick) {
        var factor = tick >= 0 ? 1 : -1;
        return Math.pow(tick, exponent) * factor;
    });
}
exports.default = calculatePowTicks;

},{"../util/math":764,"../util/pretty":765}],754:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 计算几分位 https://github.com/simple-statistics/simple-statistics/blob/master/src/quantile_sorted.js
 * @param x  数组
 * @param p  百分比
 */
function quantileSorted(x, p) {
    var idx = x.length * p;
    /*if (x.length === 0) { // 当前场景这些条件不可能命中
      throw new Error('quantile requires at least one value.');
    } else if (p < 0 || p > 1) {
      throw new Error('quantiles must be between 0 and 1');
    } else */
    if (p === 1) {
        // If p is 1, directly return the last element
        return x[x.length - 1];
    }
    else if (p === 0) {
        // If p is 0, directly return the first element
        return x[0];
    }
    else if (idx % 1 !== 0) {
        // If p is not integer, return the next element in array
        return x[Math.ceil(idx) - 1];
    }
    else if (x.length % 2 === 0) {
        // If the list has even-length, we'll take the average of this number
        // and the next value, if there is one
        return (x[idx - 1] + x[idx]) / 2;
    }
    else {
        // Finally, in the simple case of an integer value
        // with an odd-length list, return the x value at the index.
        return x[idx];
    }
}
function calculateTicks(cfg) {
    var tickCount = cfg.tickCount, values = cfg.values;
    if (!values || !values.length) {
        return [];
    }
    var sorted = values.slice().sort(function (a, b) {
        return a - b;
    });
    var ticks = [];
    for (var i = 0; i < tickCount; i++) {
        var p = i / (tickCount - 1);
        ticks.push(quantileSorted(sorted, p));
    }
    return ticks;
}
exports.default = calculateTicks;

},{}],755:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var interval_1 = require("../util/interval");
var pretty_1 = require("../util/pretty");
var strict_limit_1 = require("../util/strict-limit");
/**
 * 计算线性的 ticks，使用 R's pretty 方法
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function linearPretty(cfg) {
    var min = cfg.min, max = cfg.max, tickCount = cfg.tickCount, tickInterval = cfg.tickInterval, minLimit = cfg.minLimit, maxLimit = cfg.maxLimit;
    var ticks = pretty_1.default(min, max, tickCount).ticks;
    if (!util_1.isNil(minLimit) || !util_1.isNil(maxLimit)) {
        return strict_limit_1.default(cfg, util_1.head(ticks), util_1.last(ticks));
    }
    if (tickInterval) {
        return interval_1.default(min, max, tickInterval).ticks;
    }
    return ticks;
}
exports.default = linearPretty;

},{"../util/interval":763,"../util/pretty":765,"../util/strict-limit":766,"@antv/util":803}],756:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerTickMethod = exports.getTickMethod = void 0;
var methodCache = {};
/**
 * 获取计算 ticks 的方法
 * @param key 键值
 * @returns 计算 ticks 的方法
 */
function getTickMethod(key) {
    return methodCache[key];
}
exports.getTickMethod = getTickMethod;
/**
 * 注册计算 ticks 的方法
 * @param key 键值
 * @param method 方法
 */
function registerTickMethod(key, method) {
    methodCache[key] = method;
}
exports.registerTickMethod = registerTickMethod;

},{}],757:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var cat_1 = require("./cat");
/**
 * 计算时间分类的 ticks, 保头，保尾
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function calculateTimeCatTicks(cfg) {
    var ticks = cat_1.default(cfg);
    var lastValue = util_1.last(cfg.values);
    if (lastValue !== util_1.last(ticks)) {
        ticks.push(lastValue);
    }
    return ticks;
}
exports.default = calculateTimeCatTicks;

},{"./cat":748,"@antv/util":803}],758:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var time_1 = require("../util/time");
function getYear(date) {
    return new Date(date).getFullYear();
}
function createYear(year) {
    return new Date(year, 0, 1).getTime();
}
function getMonth(date) {
    return new Date(date).getMonth();
}
function diffMonth(min, max) {
    var minYear = getYear(min);
    var maxYear = getYear(max);
    var minMonth = getMonth(min);
    var maxMonth = getMonth(max);
    return (maxYear - minYear) * 12 + ((maxMonth - minMonth) % 12);
}
function creatMonth(year, month) {
    return new Date(year, month, 1).getTime();
}
function diffDay(min, max) {
    return Math.ceil((max - min) / time_1.DAY);
}
function diffHour(min, max) {
    return Math.ceil((max - min) / time_1.HOUR);
}
function diffMinus(min, max) {
    return Math.ceil((max - min) / (60 * 1000));
}
/**
 * 计算 time 的 ticks，对 month, year 进行 pretty 处理
 * @param cfg 度量的配置项
 * @returns 计算后的 ticks
 */
function timePretty(cfg) {
    var min = cfg.min, max = cfg.max, minTickInterval = cfg.minTickInterval;
    var tickInterval = cfg.tickInterval;
    var tickCount = cfg.tickCount;
    var ticks = [];
    // 指定 tickInterval 后 tickCount 不生效，需要重新计算
    if (!tickInterval) {
        tickInterval = (max - min) / tickCount;
        // 如果设置了最小间距，则使用最小间距
        if (minTickInterval && tickInterval < minTickInterval) {
            tickInterval = minTickInterval;
        }
    }
    var minYear = getYear(min);
    // 如果间距大于 1 年，则将开始日期从整年开始
    if (tickInterval > time_1.YEAR) {
        var maxYear = getYear(max);
        var yearInterval = Math.ceil(tickInterval / time_1.YEAR);
        for (var i = minYear; i <= maxYear + yearInterval; i = i + yearInterval) {
            ticks.push(createYear(i));
        }
    }
    else if (tickInterval > time_1.MONTH) {
        // 大于月时
        var monthInterval = Math.ceil(tickInterval / time_1.MONTH);
        var mmMoth = getMonth(min);
        var dMonths = diffMonth(min, max);
        for (var i = 0; i <= dMonths + monthInterval; i = i + monthInterval) {
            ticks.push(creatMonth(minYear, i + mmMoth));
        }
    }
    else if (tickInterval > time_1.DAY) {
        // 大于天
        var date = new Date(min);
        var year = date.getFullYear();
        var month = date.getMonth();
        var mday = date.getDate();
        var day = Math.ceil(tickInterval / time_1.DAY);
        var ddays = diffDay(min, max);
        for (var i = 0; i < ddays + day; i = i + day) {
            ticks.push(new Date(year, month, mday + i).getTime());
        }
    }
    else if (tickInterval > time_1.HOUR) {
        // 大于小时
        var date = new Date(min);
        var year = date.getFullYear();
        var month = date.getMonth();
        var day = date.getDate();
        var hour = date.getHours();
        var hours = Math.ceil(tickInterval / time_1.HOUR);
        var dHours = diffHour(min, max);
        for (var i = 0; i <= dHours + hours; i = i + hours) {
            ticks.push(new Date(year, month, day, hour + i).getTime());
        }
    }
    else if (tickInterval > time_1.MINUTE) {
        // 大于分钟
        var dMinus = diffMinus(min, max);
        var minutes = Math.ceil(tickInterval / time_1.MINUTE);
        for (var i = 0; i <= dMinus + minutes; i = i + minutes) {
            ticks.push(min + i * time_1.MINUTE);
        }
    }
    else {
        // 小于分钟
        var interval = tickInterval;
        if (interval < time_1.SECOND) {
            interval = time_1.SECOND;
        }
        var minSecond = Math.floor(min / time_1.SECOND) * time_1.SECOND;
        var dSeconds = Math.ceil((max - min) / time_1.SECOND);
        var seconds = Math.ceil(interval / time_1.SECOND);
        for (var i = 0; i < dSeconds + seconds; i = i + seconds) {
            ticks.push(minSecond + i * time_1.SECOND);
        }
    }
    return ticks;
}
exports.default = timePretty;

},{"../util/time":767}],759:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var time_1 = require("../util/time");
function calculateTimeTicks(cfg) {
    var min = cfg.min, max = cfg.max, minTickInterval = cfg.minTickInterval;
    var tickInterval = cfg.tickInterval;
    var tickCount = cfg.tickCount;
    // 指定 tickInterval 后 tickCount 不生效，需要重新计算
    if (tickInterval) {
        tickCount = Math.ceil((max - min) / tickInterval);
    }
    else {
        tickInterval = time_1.getTickInterval(min, max, tickCount)[1];
        var count = (max - min) / tickInterval;
        var ratio = count / tickCount;
        if (ratio > 1) {
            tickInterval = tickInterval * Math.ceil(ratio);
        }
        // 如果设置了最小间距，则使用最小间距
        if (minTickInterval && tickInterval < minTickInterval) {
            tickInterval = minTickInterval;
        }
    }
    var ticks = [];
    for (var i = min; i < max + tickInterval; i += tickInterval) {
        ticks.push(i);
    }
    return ticks;
}
exports.default = calculateTimeTicks;

},{"../util/time":767}],760:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
/**
 * 二分右侧查找
 * https://github.com/d3/d3-array/blob/master/src/bisector.js
 */
function default_1(getter) {
    /**
     * x: 目标值
     * lo: 起始位置
     * hi: 结束位置
     */
    return function (a, x, _lo, _hi) {
        var lo = util_1.isNil(_lo) ? 0 : _lo;
        var hi = util_1.isNil(_hi) ? a.length : _hi;
        while (lo < hi) {
            var mid = (lo + hi) >>> 1;
            if (getter(a[mid]) > x) {
                hi = mid;
            }
            else {
                lo = mid + 1;
            }
        }
        return lo;
    };
}
exports.default = default_1;

},{"@antv/util":803}],761:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.D3Linear = void 0;
function d3Linear(cfg) {
    var min = cfg.min, max = cfg.max, nice = cfg.nice, tickCount = cfg.tickCount;
    var linear = new D3Linear();
    linear.domain([min, max]);
    if (nice) {
        linear.nice(tickCount);
    }
    return linear.ticks(tickCount);
}
exports.default = d3Linear;
var DEFAULT_COUNT = 5;
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
// https://github.com/d3/d3-scale
var D3Linear = /** @class */ (function () {
    function D3Linear() {
        this._domain = [0, 1];
    }
    D3Linear.prototype.domain = function (domain) {
        if (domain) {
            this._domain = Array.from(domain, Number);
            return this;
        }
        return this._domain.slice();
    };
    D3Linear.prototype.nice = function (count) {
        var _a, _b;
        if (count === void 0) { count = DEFAULT_COUNT; }
        var d = this._domain.slice();
        var i0 = 0;
        var i1 = this._domain.length - 1;
        var start = this._domain[i0];
        var stop = this._domain[i1];
        var step;
        if (stop < start) {
            _a = [stop, start], start = _a[0], stop = _a[1];
            _b = [i1, i0], i0 = _b[0], i1 = _b[1];
        }
        step = tickIncrement(start, stop, count);
        if (step > 0) {
            start = Math.floor(start / step) * step;
            stop = Math.ceil(stop / step) * step;
            step = tickIncrement(start, stop, count);
        }
        else if (step < 0) {
            start = Math.ceil(start * step) / step;
            stop = Math.floor(stop * step) / step;
            step = tickIncrement(start, stop, count);
        }
        if (step > 0) {
            d[i0] = Math.floor(start / step) * step;
            d[i1] = Math.ceil(stop / step) * step;
            this.domain(d);
        }
        else if (step < 0) {
            d[i0] = Math.ceil(start * step) / step;
            d[i1] = Math.floor(stop * step) / step;
            this.domain(d);
        }
        return this;
    };
    D3Linear.prototype.ticks = function (count) {
        if (count === void 0) { count = DEFAULT_COUNT; }
        return d3ArrayTicks(this._domain[0], this._domain[this._domain.length - 1], count || DEFAULT_COUNT);
    };
    return D3Linear;
}());
exports.D3Linear = D3Linear;
function d3ArrayTicks(start, stop, count) {
    var reverse;
    var i = -1;
    var n;
    var ticks;
    var step;
    (stop = +stop), (start = +start), (count = +count);
    if (start === stop && count > 0) {
        return [start];
    }
    // tslint:disable-next-line
    if ((reverse = stop < start)) {
        (n = start), (start = stop), (stop = n);
    }
    // tslint:disable-next-line
    if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) {
        return [];
    }
    if (step > 0) {
        start = Math.ceil(start / step);
        stop = Math.floor(stop / step);
        ticks = new Array((n = Math.ceil(stop - start + 1)));
        while (++i < n) {
            ticks[i] = (start + i) * step;
        }
    }
    else {
        start = Math.floor(start * step);
        stop = Math.ceil(stop * step);
        ticks = new Array((n = Math.ceil(start - stop + 1)));
        while (++i < n) {
            ticks[i] = (start - i) / step;
        }
    }
    if (reverse) {
        ticks.reverse();
    }
    return ticks;
}
function tickIncrement(start, stop, count) {
    var step = (stop - start) / Math.max(0, count);
    var power = Math.floor(Math.log(step) / Math.LN10);
    var error = step / Math.pow(10, power);
    return power >= 0
        ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
        : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
}

},{}],762:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ALL_Q = exports.DEFAULT_Q = void 0;
var util_1 = require("@antv/util");
exports.DEFAULT_Q = [1, 5, 2, 2.5, 4, 3];
exports.ALL_Q = [1, 5, 2, 2.5, 4, 3, 1.5, 7, 6, 8, 9];
var eps = Number.EPSILON * 100;
// https://stackoverflow.com/questions/4467539/javascript-modulo-gives-a-negative-result-for-negative-numbers
function mod(n, m) {
    return ((n % m) + m) % m;
}
function simplicity(q, Q, j, lmin, lmax, lstep) {
    var n = util_1.size(Q);
    var i = util_1.indexOf(Q, q);
    var v = 0;
    var m = mod(lmin, lstep);
    if ((m < eps || lstep - m < eps) && lmin <= 0 && lmax >= 0) {
        v = 1;
    }
    return 1 - i / (n - 1) - j + v;
}
function simplicityMax(q, Q, j) {
    var n = util_1.size(Q);
    var i = util_1.indexOf(Q, q);
    var v = 1;
    return 1 - i / (n - 1) - j + v;
}
function density(k, m, dmin, dmax, lmin, lmax) {
    var r = (k - 1) / (lmax - lmin);
    var rt = (m - 1) / (Math.max(lmax, dmax) - Math.min(dmin, lmin));
    return 2 - Math.max(r / rt, rt / r);
}
function densityMax(k, m) {
    if (k >= m) {
        return 2 - (k - 1) / (m - 1);
    }
    return 1;
}
function coverage(dmin, dmax, lmin, lmax) {
    var range = dmax - dmin;
    return 1 - (0.5 * (Math.pow(dmax - lmax, 2) + Math.pow(dmin - lmin, 2))) / Math.pow(0.1 * range, 2);
}
function coverageMax(dmin, dmax, span) {
    var range = dmax - dmin;
    if (span > range) {
        var half = (span - range) / 2;
        return 1 - Math.pow(half, 2) / Math.pow(0.1 * range, 2);
    }
    return 1;
}
function legibility() {
    return 1;
}
/**
 * An Extension of Wilkinson's Algorithm for Position Tick Labels on Axes
 * https://www.yuque.com/preview/yuque/0/2019/pdf/185317/1546999150858-45c3b9c2-4e86-4223-bf1a-8a732e8195ed.pdf
 * @param dmin 最小值
 * @param dmax 最大值
 * @param m tick个数
 * @param onlyLoose 是否允许扩展min、max，不绝对强制，例如[3, 97]
 * @param Q nice numbers集合
 * @param w 四个优化组件的权重
 */
function extended(dmin, dmax, m, onlyLoose, Q, w) {
    if (m === void 0) { m = 5; }
    if (onlyLoose === void 0) { onlyLoose = true; }
    if (Q === void 0) { Q = exports.DEFAULT_Q; }
    if (w === void 0) { w = [0.25, 0.2, 0.5, 0.05]; }
    if (dmin === dmax || m === 1) {
        return {
            min: dmin,
            max: dmax,
            ticks: [dmin],
        };
    }
    var best = {
        score: -2,
        lmin: 0,
        lmax: 0,
        lstep: 0,
    };
    var j = 1;
    while (j < Infinity) {
        for (var _i = 0, Q_1 = Q; _i < Q_1.length; _i++) {
            var q = Q_1[_i];
            var sm = simplicityMax(q, Q, j);
            if (Number.isNaN(sm)) {
                throw new Error('NaN');
            }
            if (w[0] * sm + w[1] + w[2] + w[3] < best.score) {
                j = Infinity;
                break;
            }
            var k = 2;
            while (k < Infinity) {
                var dm = densityMax(k, m);
                if (w[0] * sm + w[1] + w[2] * dm + w[3] < best.score) {
                    break;
                }
                var delta = (dmax - dmin) / (k + 1) / j / q;
                var z = Math.ceil(Math.log10(delta));
                while (z < Infinity) {
                    var step = j * q * Math.pow(10, z);
                    var cm = coverageMax(dmin, dmax, step * (k - 1));
                    if (w[0] * sm + w[1] * cm + w[2] * dm + w[3] < best.score) {
                        break;
                    }
                    var minStart = Math.floor(dmax / step) * j - (k - 1) * j;
                    var maxStart = Math.ceil(dmin / step) * j;
                    if (minStart > maxStart) {
                        z = z + 1;
                        continue;
                    }
                    for (var start = minStart; start <= maxStart; start = start + 1) {
                        var lmin = start * (step / j);
                        var lmax = lmin + step * (k - 1);
                        var lstep = step;
                        var s = simplicity(q, Q, j, lmin, lmax, lstep);
                        var c = coverage(dmin, dmax, lmin, lmax);
                        var g = density(k, m, dmin, dmax, lmin, lmax);
                        var l = legibility();
                        var score = w[0] * s + w[1] * c + w[2] * g + w[3] * l;
                        if (score > best.score && (!onlyLoose || (lmin <= dmin && lmax >= dmax))) {
                            best.lmin = lmin;
                            best.lmax = lmax;
                            best.lstep = lstep;
                            best.score = score;
                        }
                    }
                    z = z + 1;
                }
                k = k + 1;
            }
        }
        j = j + 1;
    }
    // 步长为浮点数时处理精度
    var toFixed = Number.isInteger(best.lstep) ? 0 : Math.ceil(Math.abs(Math.log10(best.lstep)));
    var range = [];
    for (var tick = best.lmin; tick <= best.lmax; tick += best.lstep) {
        range.push(tick);
    }
    var ticks = toFixed ? util_1.map(range, function (x) { return Number.parseFloat(x.toFixed(toFixed)); }) : range;
    return {
        min: Math.min(dmin, util_1.head(ticks)),
        max: Math.max(dmax, util_1.last(ticks)),
        ticks: ticks,
    };
}
exports.default = extended;

},{"@antv/util":803}],763:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
function snapMultiple(v, base, snapType) {
    var div;
    if (snapType === 'ceil') {
        div = Math.ceil(v / base);
    }
    else if (snapType === 'floor') {
        div = Math.floor(v / base);
    }
    else {
        div = Math.round(v / base);
    }
    return div * base;
}
function intervalTicks(min, max, interval) {
    // 变成 interval 的倍数
    var minTick = snapMultiple(min, interval, 'floor');
    var maxTick = snapMultiple(max, interval, 'ceil');
    // 统一小数位数
    minTick = util_1.fixedBase(minTick, interval);
    maxTick = util_1.fixedBase(maxTick, interval);
    var ticks = [];
    for (var i = minTick; i <= maxTick; i = i + interval) {
        var tickValue = util_1.fixedBase(i, interval); // 防止浮点数加法出现问题
        ticks.push(tickValue);
    }
    return {
        min: minTick,
        max: maxTick,
        ticks: ticks
    };
}
exports.default = intervalTicks;

},{"@antv/util":803}],764:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLogPositiveMin = exports.log = exports.calBase = void 0;
var util_1 = require("@antv/util");
// 求以a为次幂，结果为b的基数，如 x^^a = b;求x
// 虽然数学上 b 不支持负数，但是这里需要支持 负数
function calBase(a, b) {
    var e = Math.E;
    var value;
    if (b >= 0) {
        value = Math.pow(e, Math.log(b) / a); // 使用换底公式求底
    }
    else {
        value = Math.pow(e, Math.log(-b) / a) * -1; // 使用换底公式求底
    }
    return value;
}
exports.calBase = calBase;
function log(a, b) {
    if (a === 1) {
        return 1;
    }
    return Math.log(b) / Math.log(a);
}
exports.log = log;
function getLogPositiveMin(values, base, max) {
    if (util_1.isNil(max)) {
        max = Math.max.apply(null, values);
    }
    var positiveMin = max;
    util_1.each(values, function (value) {
        if (value > 0 && value < positiveMin) {
            positiveMin = value;
        }
    });
    if (positiveMin === max) {
        positiveMin = max / base;
    }
    if (positiveMin > 1) {
        positiveMin = 1;
    }
    return positiveMin;
}
exports.getLogPositiveMin = getLogPositiveMin;

},{"@antv/util":803}],765:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function pretty(min, max, n) {
    if (n === void 0) { n = 5; }
    var res = {
        max: 0,
        min: 0,
        ticks: [],
    };
    /*
      R pretty:
      https://svn.r-project.org/R/trunk/src/appl/pretty.c
      https://www.rdocumentation.org/packages/base/versions/3.5.2/topics/pretty
      */
    var h = 1.5; // high.u.bias
    var h5 = 0.5 + 1.5 * h; // u5.bias
    // 反正我也不会调参，跳过所有判断步骤
    var d = max - min;
    var c = d / n;
    // 当d非常小的时候触发，但似乎没什么用
    // const min_n = Math.floor(n / 3);
    // const shrink_sml = Math.pow(2, 5);
    // if (Math.log10(d) < -2) {
    //   c = (_.max([ Math.abs(max), Math.abs(min) ]) * shrink_sml) / min_n;
    // }
    var base = Math.pow(10, Math.floor(Math.log10(c)));
    var toFixed = base < 1 ? Math.ceil(Math.abs(Math.log10(base))) : 0;
    var unit = base;
    if (2 * base - c < h * (c - unit)) {
        unit = 2 * base;
        if (5 * base - c < h5 * (c - unit)) {
            unit = 5 * base;
            if (10 * base - c < h * (c - unit)) {
                unit = 10 * base;
            }
        }
    }
    var nu = Math.ceil(max / unit);
    var ns = Math.floor(min / unit);
    res.max = Math.max(nu * unit, max);
    res.min = Math.min(ns * unit, min);
    var x = Number.parseFloat((ns * unit).toFixed(toFixed));
    while (x < max) {
        res.ticks.push(x);
        x += unit;
        if (toFixed) {
            x = Number.parseFloat(x.toFixed(toFixed));
        }
    }
    res.ticks.push(x);
    return res;
}
exports.default = pretty;

},{}],766:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
/**
 * 按照给定的 minLimit/maxLimit/tickCount 均匀计算出刻度 ticks
 *
 * @param cfg Scale 配置项
 * @return ticks
 */
function strictLimit(cfg, defaultMin, defaultMax) {
    var _a;
    var minLimit = cfg.minLimit, maxLimit = cfg.maxLimit, min = cfg.min, max = cfg.max, _b = cfg.tickCount, tickCount = _b === void 0 ? 5 : _b;
    var tickMin = util_1.isNil(minLimit) ? (util_1.isNil(defaultMin) ? min : defaultMin) : minLimit;
    var tickMax = util_1.isNil(maxLimit) ? (util_1.isNil(defaultMax) ? max : defaultMax) : maxLimit;
    if (tickMin > tickMax) {
        _a = [tickMin, tickMax], tickMax = _a[0], tickMin = _a[1];
    }
    if (tickCount <= 2) {
        return [tickMin, tickMax];
    }
    var step = (tickMax - tickMin) / (tickCount - 1);
    var ticks = [];
    for (var i = 0; i < tickCount; i++) {
        ticks.push(tickMin + step * i);
    }
    return ticks;
}
exports.default = strictLimit;

},{"@antv/util":803}],767:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTickInterval = exports.YEAR = exports.MONTH = exports.DAY = exports.HOUR = exports.MINUTE = exports.SECOND = exports.toTimeStamp = exports.timeFormat = void 0;
var util_1 = require("@antv/util");
var fecha_1 = require("fecha");
var fecha1 = require("fecha");
var bisector_1 = require("./bisector");
var FORMAT_METHOD = 'format';
function timeFormat(time, mask) {
    var method = fecha1[FORMAT_METHOD] || fecha_1.default[FORMAT_METHOD];
    return method(time, mask);
}
exports.timeFormat = timeFormat;
/**
 * 转换成时间戳
 * @param value 时间值
 */
function toTimeStamp(value) {
    if (util_1.isString(value)) {
        if (value.indexOf('T') > 0) {
            value = new Date(value).getTime();
        }
        else {
            // new Date('2010/01/10') 和 new Date('2010-01-10') 的差别在于:
            // 如果仅有年月日时，前者是带有时区的: Fri Jan 10 2020 02:40:13 GMT+0800 (中国标准时间)
            // 后者会格式化成 Sun Jan 10 2010 08:00:00 GMT+0800 (中国标准时间)
            value = new Date(value.replace(/-/gi, '/')).getTime();
        }
    }
    if (util_1.isDate(value)) {
        value = value.getTime();
    }
    return value;
}
exports.toTimeStamp = toTimeStamp;
var SECOND = 1000;
exports.SECOND = SECOND;
var MINUTE = 60 * SECOND;
exports.MINUTE = MINUTE;
var HOUR = 60 * MINUTE;
exports.HOUR = HOUR;
var DAY = 24 * HOUR;
exports.DAY = DAY;
var MONTH = DAY * 31;
exports.MONTH = MONTH;
var YEAR = DAY * 365;
exports.YEAR = YEAR;
var intervals = [
    ['HH:mm:ss', SECOND],
    ['HH:mm:ss', SECOND * 10],
    ['HH:mm:ss', SECOND * 30],
    ['HH:mm', MINUTE],
    ['HH:mm', MINUTE * 10],
    ['HH:mm', MINUTE * 30],
    ['HH', HOUR],
    ['HH', HOUR * 6],
    ['HH', HOUR * 12],
    ['YYYY-MM-DD', DAY],
    ['YYYY-MM-DD', DAY * 4],
    ['YYYY-WW', DAY * 7],
    ['YYYY-MM', MONTH],
    ['YYYY-MM', MONTH * 4],
    ['YYYY-MM', MONTH * 6],
    ['YYYY', DAY * 380],
];
function getTickInterval(min, max, tickCount) {
    var target = (max - min) / tickCount;
    var idx = bisector_1.default(function (o) { return o[1]; })(intervals, target) - 1;
    var interval = intervals[idx];
    if (idx < 0) {
        interval = intervals[0];
    }
    else if (idx >= intervals.length) {
        interval = util_1.last(intervals);
    }
    return interval;
}
exports.getTickInterval = getTickInterval;

},{"./bisector":760,"@antv/util":803,"fecha":881}],768:[function(require,module,exports){
(function (global){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __createBinding;
(function (factory) {
    var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
    if (typeof define === "function" && define.amd) {
        define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
    }
    else if (typeof module === "object" && typeof module.exports === "object") {
        factory(createExporter(root, createExporter(module.exports)));
    }
    else {
        factory(createExporter(root));
    }
    function createExporter(exports, previous) {
        if (exports !== root) {
            if (typeof Object.create === "function") {
                Object.defineProperty(exports, "__esModule", { value: true });
            }
            else {
                exports.__esModule = true;
            }
        }
        return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
    }
})
(function (exporter) {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };

    __extends = function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };

    __assign = Object.assign || function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };

    __rest = function (s, e) {
        var t = {};
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                    t[p[i]] = s[p[i]];
            }
        return t;
    };

    __decorate = function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };

    __param = function (paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    };

    __metadata = function (metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
    };

    __awaiter = function (thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    };

    __generator = function (thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    };

    __exportStar = function(m, o) {
        for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
    };

    __createBinding = Object.create ? (function(o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
    }) : (function(o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        o[k2] = m[k];
    });

    __values = function (o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m) return m.call(o);
        if (o && typeof o.length === "number") return {
            next: function () {
                if (o && i >= o.length) o = void 0;
                return { value: o && o[i++], done: !o };
            }
        };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };

    __read = function (o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    };

    __spread = function () {
        for (var ar = [], i = 0; i < arguments.length; i++)
            ar = ar.concat(__read(arguments[i]));
        return ar;
    };

    __spreadArrays = function () {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
                r[k] = a[j];
        return r;
    };

    __await = function (v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    };

    __asyncGenerator = function (thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
        function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
        function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);  }
        function fulfill(value) { resume("next", value); }
        function reject(value) { resume("throw", value); }
        function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
    };

    __asyncDelegator = function (o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
    };

    __asyncValues = function (o) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
    };

    __makeTemplateObject = function (cooked, raw) {
        if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
        return cooked;
    };

    var __setModuleDefault = Object.create ? (function(o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
        o["default"] = v;
    };

    __importStar = function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
        __setModuleDefault(result, mod);
        return result;
    };

    __importDefault = function (mod) {
        return (mod && mod.__esModule) ? mod : { "default": mod };
    };

    __classPrivateFieldGet = function (receiver, privateMap) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to get private field on non-instance");
        }
        return privateMap.get(receiver);
    };

    __classPrivateFieldSet = function (receiver, privateMap, value) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to set private field on non-instance");
        }
        privateMap.set(receiver, value);
        return value;
    };

    exporter("__extends", __extends);
    exporter("__assign", __assign);
    exporter("__rest", __rest);
    exporter("__decorate", __decorate);
    exporter("__param", __param);
    exporter("__metadata", __metadata);
    exporter("__awaiter", __awaiter);
    exporter("__generator", __generator);
    exporter("__exportStar", __exportStar);
    exporter("__createBinding", __createBinding);
    exporter("__values", __values);
    exporter("__read", __read);
    exporter("__spread", __spread);
    exporter("__spreadArrays", __spreadArrays);
    exporter("__await", __await);
    exporter("__asyncGenerator", __asyncGenerator);
    exporter("__asyncDelegator", __asyncDelegator);
    exporter("__asyncValues", __asyncValues);
    exporter("__makeTemplateObject", __makeTemplateObject);
    exporter("__importStar", __importStar);
    exporter("__importDefault", __importDefault);
    exporter("__classPrivateFieldGet", __classPrivateFieldGet);
    exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

},{}],769:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mix_1 = require("./mix");
var is_function_1 = require("./is-function");
var augment = function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    var c = args[0];
    for (var i = 1; i < args.length; i++) {
        var obj = args[i];
        if (is_function_1.default(obj)) {
            obj = obj.prototype;
        }
        mix_1.default(c.prototype, obj);
    }
};
exports.default = augment;

},{"./is-function":817,"./mix":844}],770:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * k-v 存储
 */
var default_1 = /** @class */ (function () {
    function default_1() {
        this.map = {};
    }
    default_1.prototype.has = function (key) {
        return this.map[key] !== undefined;
    };
    default_1.prototype.get = function (key, def) {
        var v = this.map[key];
        return v === undefined ? def : v;
    };
    default_1.prototype.set = function (key, value) {
        this.map[key] = value;
    };
    default_1.prototype.clear = function () {
        this.map = {};
    };
    default_1.prototype.delete = function (key) {
        delete this.map[key];
    };
    default_1.prototype.size = function () {
        return Object.keys(this.map).length;
    };
    return default_1;
}());
exports.default = default_1;

},{}],771:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var clamp = function (a, min, max) {
    if (a < min) {
        return min;
    }
    else if (a > max) {
        return max;
    }
    return a;
};
exports.default = clamp;

},{}],772:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function cancelAnimationFrame(handler) {
    var method = window.cancelAnimationFrame ||
        window.webkitCancelAnimationFrame ||
        // @ts-ignore
        window.mozCancelAnimationFrame ||
        // @ts-ignore
        window.msCancelAnimationFrame ||
        clearTimeout;
    method(handler);
}
exports.default = cancelAnimationFrame;
;

},{}],773:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var clone = function (obj) {
    if (typeof obj !== 'object' || obj === null) {
        return obj;
    }
    var rst;
    if (is_array_1.default(obj)) {
        rst = [];
        for (var i = 0, l = obj.length; i < l; i++) {
            if (typeof obj[i] === 'object' && obj[i] != null) {
                rst[i] = clone(obj[i]);
            }
            else {
                rst[i] = obj[i];
            }
        }
    }
    else {
        rst = {};
        for (var k in obj) {
            if (typeof obj[k] === 'object' && obj[k] != null) {
                rst[k] = clone(obj[k]);
            }
            else {
                rst[k] = obj[k];
            }
        }
    }
    return rst;
};
exports.default = clone;

},{"./is-array":806}],774:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var contains = function (arr, value) {
    if (!is_array_like_1.default(arr)) {
        return false;
    }
    return arr.indexOf(value) > -1;
};
exports.default = contains;

},{"./is-array-like":805}],775:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function debounce(func, wait, immediate) {
    var timeout;
    return function () {
        var context = this, args = arguments;
        var later = function () {
            timeout = null;
            if (!immediate) {
                func.apply(context, args);
            }
        };
        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) {
            func.apply(context, args);
        }
    };
}
exports.default = debounce;

},{}],776:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_plain_object_1 = require("./is-plain-object");
var MAX_MIX_LEVEL = 5;
function _deepMix(dist, src, level, maxLevel) {
    level = level || 0;
    maxLevel = maxLevel || MAX_MIX_LEVEL;
    for (var key in src) {
        if (src.hasOwnProperty(key)) {
            var value = src[key];
            if (value !== null && is_plain_object_1.default(value)) {
                if (!is_plain_object_1.default(dist[key])) {
                    dist[key] = {};
                }
                if (level < maxLevel) {
                    _deepMix(dist[key], value, level + 1, maxLevel);
                }
                else {
                    dist[key] = src[key];
                }
            }
            else if (is_array_1.default(value)) {
                dist[key] = [];
                dist[key] = dist[key].concat(value);
            }
            else if (value !== undefined) {
                dist[key] = value;
            }
        }
    }
}
// todo 重写
var deepMix = function (rst) {
    var args = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        args[_i - 1] = arguments[_i];
    }
    for (var i = 0; i < args.length; i += 1) {
        _deepMix(rst, args[i]);
    }
    return rst;
};
exports.default = deepMix;

},{"./is-array":806,"./is-plain-object":828}],777:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var filter_1 = require("./filter");
var contains_1 = require("./contains");
/**
 * Flattens `array` a single level deep.
 *
 * @param {Array} arr The array to inspect.
 * @param {Array} values The values to exclude.
 * @return {Array} Returns the new array of filtered values.
 * @example
 * difference([2, 1], [2, 3]);  // => [1]
 */
var difference = function (arr, values) {
    if (values === void 0) { values = []; }
    return filter_1.default(arr, function (value) { return !contains_1.default(values, value); });
};
exports.default = difference;

},{"./contains":774,"./filter":782}],778:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_object_1 = require("./is-object");
function each(elements, func) {
    if (!elements) {
        return;
    }
    var rst;
    if (is_array_1.default(elements)) {
        for (var i = 0, len = elements.length; i < len; i++) {
            rst = func(elements[i], i);
            if (rst === false) {
                break;
            }
        }
    }
    else if (is_object_1.default(elements)) {
        for (var k in elements) {
            if (elements.hasOwnProperty(k)) {
                rst = func(elements[k], k);
                if (rst === false) {
                    break;
                }
            }
        }
    }
}
exports.default = each;

},{"./is-array":806,"./is-object":826}],779:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_string_1 = require("./is-string");
function endsWith(arr, e) {
    return (is_array_1.default(arr) || is_string_1.default(arr)) ? arr[arr.length - 1] === e : false;
}
exports.default = endsWith;

},{"./is-array":806,"./is-string":832}],780:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 只要有一个不满足条件就返回 false
 * @param arr
 * @param func
 */
var every = function (arr, func) {
    for (var i = 0; i < arr.length; i++) {
        if (!func(arr[i], i))
            return false;
    }
    return true;
};
exports.default = every;

},{}],781:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mix_1 = require("./mix");
var is_function_1 = require("./is-function");
var extend = function (subclass, superclass, overrides, staticOverrides) {
    // 如果只提供父类构造函数，则自动生成子类构造函数
    if (!is_function_1.default(superclass)) {
        overrides = superclass;
        superclass = subclass;
        subclass = function () { };
    }
    var create = Object.create ?
        function (proto, c) {
            return Object.create(proto, {
                constructor: {
                    value: c
                }
            });
        } :
        function (proto, c) {
            function Tmp() { }
            Tmp.prototype = proto;
            var o = new Tmp();
            o.constructor = c;
            return o;
        };
    var superObj = create(superclass.prototype, subclass); // new superclass(),//实例化父类作为子类的prototype
    subclass.prototype = mix_1.default(superObj, subclass.prototype); // 指定子类的prototype
    subclass.superclass = create(superclass.prototype, superclass);
    mix_1.default(superObj, overrides);
    mix_1.default(subclass, staticOverrides);
    return subclass;
};
exports.default = extend;

},{"./is-function":817,"./mix":844}],782:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var filter = function (arr, func) {
    if (!is_array_like_1.default(arr)) {
        return arr;
    }
    var result = [];
    for (var index = 0; index < arr.length; index++) {
        var value = arr[index];
        if (func(value, index)) {
            result.push(value);
        }
    }
    return result;
};
exports.default = filter;

},{"./is-array-like":805}],783:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function findIndex(arr, predicate, fromIndex) {
    if (fromIndex === void 0) { fromIndex = 0; }
    for (var i = fromIndex; i < arr.length; i++) {
        if (predicate(arr[i], i)) {
            // 找到终止循环
            return i;
        }
    }
    return -1;
}
exports.default = findIndex;

},{}],784:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_function_1 = require("./is-function");
var is_match_1 = require("./is-match");
var is_array_1 = require("./is-array");
var is_plain_object_1 = require("./is-plain-object");
function find(arr, predicate) {
    if (!is_array_1.default(arr))
        return null;
    var _predicate;
    if (is_function_1.default(predicate)) {
        _predicate = predicate;
    }
    if (is_plain_object_1.default(predicate)) {
        _predicate = function (a) { return is_match_1.default(a, predicate); };
    }
    if (_predicate) {
        for (var i = 0; i < arr.length; i += 1) {
            if (_predicate(arr[i])) {
                return arr[i];
            }
        }
    }
    return null;
}
exports.default = find;

},{"./is-array":806,"./is-function":817,"./is-match":819,"./is-plain-object":828}],785:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
var is_array_1 = require("./is-array");
var firstValue = function (data, name) {
    var rst = null;
    for (var i = 0; i < data.length; i++) {
        var obj = data[i];
        var value = obj[name];
        if (!is_nil_1.default(value)) {
            if (is_array_1.default(value)) {
                rst = value[0]; // todo 这里是否应该使用递归，调用 firstValue @绝云
            }
            else {
                rst = value;
            }
            break;
        }
    }
    return rst;
};
exports.default = firstValue;

},{"./is-array":806,"./is-nil":821}],786:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fixedBase = function (v, base) {
    var str = base.toString();
    var index = str.indexOf('.');
    if (index === -1) {
        return Math.round(v);
    }
    var length = str.substr(index + 1).length;
    if (length > 20) {
        length = 20;
    }
    return parseFloat(v.toFixed(length));
};
exports.default = fixedBase;

},{}],787:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
/**
 * Flattens `array` a single level deep.
 *
 * @param {Array} arr The array to flatten.
 * @param {Array} result The array to return.
 * @return {Array} Returns the new flattened array.
 * @example
 *
 * flattenDeep([1, [2, [3, [4]], 5]]);  // => [1, 2, 3, 4, 5]
 */
var flattenDeep = function (arr, result) {
    if (result === void 0) { result = []; }
    if (!is_array_1.default(arr)) {
        result.push(arr);
    }
    else {
        for (var i = 0; i < arr.length; i += 1) {
            flattenDeep(arr[i], result);
        }
    }
    return result;
};
exports.default = flattenDeep;

},{"./is-array":806}],788:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
/**
 * Flattens `array` a single level deep.
 *
 * @param {Array} arr The array to flatten.
 * @return {Array} Returns the new flattened array.
 * @example
 *
 * flatten([1, [2, [3, [4]], 5]]);  // => [1, 2, [3, [4]], 5]
 */
var flatten = function (arr) {
    if (!is_array_1.default(arr)) {
        return [];
    }
    var rst = [];
    for (var i = 0; i < arr.length; i++) {
        rst = rst.concat(arr[i]);
    }
    return rst;
};
exports.default = flatten;

},{"./is-array":806}],789:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
exports.default = each_1.default;

},{"./each":778}],790:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var getRange = function (values) {
    // 存在 NaN 时，min,max 判定会出问题
    var filterValues = values.filter(function (v) { return !isNaN(v); });
    if (!filterValues.length) { // 如果没有数值则直接返回0
        return {
            min: 0,
            max: 0,
        };
    }
    if (is_array_1.default(values[0])) {
        var tmp = [];
        for (var i = 0; i < values.length; i++) {
            tmp = tmp.concat(values[i]);
        }
        filterValues = tmp;
    }
    var max = Math.max.apply(null, filterValues);
    var min = Math.min.apply(null, filterValues);
    return {
        min: min,
        max: max,
    };
};
exports.default = getRange;

},{"./is-array":806}],791:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var toString = {}.toString;
var getType = function (value) {
    return toString.call(value).replace(/^\[object /, '').replace(/]$/, '');
};
exports.default = getType;

},{}],792:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 获取封装的事件
 * @protected
 * @param  {Object} obj   对象
 * @param  {String} action 事件名称
 * @return {Function}        返回事件处理函数
 */
function getWrapBehavior(obj, action) {
    return obj['_wrap_' + action];
}
exports.default = getWrapBehavior;

},{}],793:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_string_1 = require("./is-string");
/**
 * https://github.com/developit/dlv/blob/master/index.js
 * @param obj
 * @param key
 * @param defaultValue
 */
exports.default = (function (obj, key, defaultValue) {
    var p = 0;
    var keyArr = is_string_1.default(key) ? key.split('.') : key;
    while (obj && p < keyArr.length) {
        obj = obj[keyArr[p++]];
    }
    return (obj === undefined || p < keyArr.length) ? defaultValue : obj;
});

},{"./is-string":832}],794:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_function_1 = require("./is-function");
var hasOwnProperty = Object.prototype.hasOwnProperty;
function groupBy(data, condition) {
    if (!condition || !is_array_1.default(data)) {
        return {};
    }
    var result = {};
    // 兼容方法和 字符串的写法
    var predicate = is_function_1.default(condition) ? condition : function (item) { return item[condition]; };
    var key;
    for (var i = 0; i < data.length; i++) {
        var item = data[i];
        key = predicate(item);
        if (hasOwnProperty.call(result, key)) {
            result[key].push(item);
        }
        else {
            result[key] = [item];
        }
    }
    return result;
}
exports.default = groupBy;

},{"./is-array":806,"./is-function":817}],795:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_function_1 = require("./is-function");
var group_by_1 = require("./group-by");
var groupToMap = function (data, condition) {
    if (!condition) {
        return {
            0: data,
        };
    }
    if (!is_function_1.default(condition)) {
        var paramsCondition_1 = is_array_1.default(condition) ? condition : condition.replace(/\s+/g, '').split('*');
        condition = function (row) {
            var unique = '_'; // 避免出现数字作为Key的情况，会进行按照数字的排序
            for (var i = 0, l = paramsCondition_1.length; i < l; i++) {
                unique += row[paramsCondition_1[i]] && row[paramsCondition_1[i]].toString();
            }
            return unique;
        };
    }
    var groups = group_by_1.default(data, condition);
    return groups;
};
exports.default = groupToMap;

},{"./group-by":794,"./is-array":806,"./is-function":817}],796:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var group_to_map_1 = require("./group-to-map");
exports.default = (function (data, condition) {
    if (!condition) {
        // 没有条件，则自身改成数组
        return [data];
    }
    var groups = group_to_map_1.default(data, condition);
    var array = [];
    for (var i in groups) {
        array.push(groups[i]);
    }
    return array;
});

},{"./group-to-map":795}],797:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var has_1 = require("./has");
exports.default = has_1.default;

},{"./has":799}],798:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var contains_1 = require("./contains");
var values_1 = require("./values");
exports.default = (function (obj, value) { return contains_1.default(values_1.default(obj), value); });

},{"./contains":774,"./values":873}],799:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (obj, key) { return obj.hasOwnProperty(key); });

},{}],800:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
function head(o) {
    if (is_array_like_1.default(o)) {
        return o[0];
    }
    return undefined;
}
exports.default = head;

},{"./is-array-like":805}],801:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (v) { return v; });

},{}],802:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var indexOf = function (arr, obj) {
    if (!is_array_like_1.default(arr)) {
        return -1;
    }
    var m = Array.prototype.indexOf;
    if (m) {
        return m.call(arr, obj);
    }
    var index = -1;
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] === obj) {
            index = i;
            break;
        }
    }
    return index;
};
exports.default = indexOf;

},{"./is-array-like":805}],803:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// array
var contains_1 = require("./contains");
exports.contains = contains_1.default;
exports.includes = contains_1.default;
var difference_1 = require("./difference");
exports.difference = difference_1.default;
var find_1 = require("./find");
exports.find = find_1.default;
var find_index_1 = require("./find-index");
exports.findIndex = find_index_1.default;
var first_value_1 = require("./first-value");
exports.firstValue = first_value_1.default;
var flatten_1 = require("./flatten");
exports.flatten = flatten_1.default;
var flatten_deep_1 = require("./flatten-deep");
exports.flattenDeep = flatten_deep_1.default;
var get_range_1 = require("./get-range");
exports.getRange = get_range_1.default;
var pull_1 = require("./pull");
exports.pull = pull_1.default;
var pull_at_1 = require("./pull-at");
exports.pullAt = pull_at_1.default;
var reduce_1 = require("./reduce");
exports.reduce = reduce_1.default;
var remove_1 = require("./remove");
exports.remove = remove_1.default;
var sort_by_1 = require("./sort-by");
exports.sortBy = sort_by_1.default;
var union_1 = require("./union");
exports.union = union_1.default;
var uniq_1 = require("./uniq");
exports.uniq = uniq_1.default;
var values_of_key_1 = require("./values-of-key");
exports.valuesOfKey = values_of_key_1.default;
var head_1 = require("./head");
exports.head = head_1.default;
var last_1 = require("./last");
exports.last = last_1.default;
var starts_with_1 = require("./starts-with");
exports.startsWith = starts_with_1.default;
var ends_with_1 = require("./ends-with");
exports.endsWith = ends_with_1.default;
var filter_1 = require("./filter");
exports.filter = filter_1.default;
var every_1 = require("./every");
exports.every = every_1.default;
var some_1 = require("./some");
exports.some = some_1.default;
var group_1 = require("./group");
exports.group = group_1.default;
var group_by_1 = require("./group-by");
exports.groupBy = group_by_1.default;
var group_to_map_1 = require("./group-to-map");
exports.groupToMap = group_to_map_1.default;
// event
var get_wrap_behavior_1 = require("./get-wrap-behavior");
exports.getWrapBehavior = get_wrap_behavior_1.default;
var wrap_behavior_1 = require("./wrap-behavior");
exports.wrapBehavior = wrap_behavior_1.default;
// format
var number2color_1 = require("./number2color");
exports.number2color = number2color_1.default;
var parse_radius_1 = require("./parse-radius");
exports.parseRadius = parse_radius_1.default;
// math
var clamp_1 = require("./clamp");
exports.clamp = clamp_1.default;
var fixed_base_1 = require("./fixed-base");
exports.fixedBase = fixed_base_1.default;
var is_decimal_1 = require("./is-decimal");
exports.isDecimal = is_decimal_1.default;
var is_even_1 = require("./is-even");
exports.isEven = is_even_1.default;
var is_integer_1 = require("./is-integer");
exports.isInteger = is_integer_1.default;
var is_negative_1 = require("./is-negative");
exports.isNegative = is_negative_1.default;
var is_number_equal_1 = require("./is-number-equal");
exports.isNumberEqual = is_number_equal_1.default;
var is_odd_1 = require("./is-odd");
exports.isOdd = is_odd_1.default;
var is_positive_1 = require("./is-positive");
exports.isPositive = is_positive_1.default;
var max_by_1 = require("./max-by");
exports.maxBy = max_by_1.default;
var min_by_1 = require("./min-by");
exports.minBy = min_by_1.default;
var mod_1 = require("./mod");
exports.mod = mod_1.default;
var to_degree_1 = require("./to-degree");
exports.toDegree = to_degree_1.default;
var to_integer_1 = require("./to-integer");
exports.toInteger = to_integer_1.default;
var to_radian_1 = require("./to-radian");
exports.toRadian = to_radian_1.default;
// object
var for_in_1 = require("./for-in");
exports.forIn = for_in_1.default;
var has_1 = require("./has");
exports.has = has_1.default;
var has_key_1 = require("./has-key");
exports.hasKey = has_key_1.default;
var has_value_1 = require("./has-value");
exports.hasValue = has_value_1.default;
var keys_1 = require("./keys");
exports.keys = keys_1.default;
var is_match_1 = require("./is-match");
exports.isMatch = is_match_1.default;
var values_1 = require("./values");
exports.values = values_1.default;
// string
var lower_case_1 = require("./lower-case");
exports.lowerCase = lower_case_1.default;
var lower_first_1 = require("./lower-first");
exports.lowerFirst = lower_first_1.default;
var substitute_1 = require("./substitute");
exports.substitute = substitute_1.default;
var upper_case_1 = require("./upper-case");
exports.upperCase = upper_case_1.default;
var upper_first_1 = require("./upper-first");
exports.upperFirst = upper_first_1.default;
// type
var get_type_1 = require("./get-type");
exports.getType = get_type_1.default;
var is_arguments_1 = require("./is-arguments");
exports.isArguments = is_arguments_1.default;
var is_array_1 = require("./is-array");
exports.isArray = is_array_1.default;
var is_array_like_1 = require("./is-array-like");
exports.isArrayLike = is_array_like_1.default;
var is_boolean_1 = require("./is-boolean");
exports.isBoolean = is_boolean_1.default;
var is_date_1 = require("./is-date");
exports.isDate = is_date_1.default;
var is_error_1 = require("./is-error");
exports.isError = is_error_1.default;
var is_function_1 = require("./is-function");
exports.isFunction = is_function_1.default;
var is_finite_1 = require("./is-finite");
exports.isFinite = is_finite_1.default;
var is_nil_1 = require("./is-nil");
exports.isNil = is_nil_1.default;
var is_null_1 = require("./is-null");
exports.isNull = is_null_1.default;
var is_number_1 = require("./is-number");
exports.isNumber = is_number_1.default;
var is_object_1 = require("./is-object");
exports.isObject = is_object_1.default;
var is_object_like_1 = require("./is-object-like");
exports.isObjectLike = is_object_like_1.default;
var is_plain_object_1 = require("./is-plain-object");
exports.isPlainObject = is_plain_object_1.default;
var is_prototype_1 = require("./is-prototype");
exports.isPrototype = is_prototype_1.default;
var is_reg_exp_1 = require("./is-reg-exp");
exports.isRegExp = is_reg_exp_1.default;
var is_string_1 = require("./is-string");
exports.isString = is_string_1.default;
var is_type_1 = require("./is-type");
exports.isType = is_type_1.default;
var is_undefined_1 = require("./is-undefined");
exports.isUndefined = is_undefined_1.default;
var is_element_1 = require("./is-element");
exports.isElement = is_element_1.default;
var request_animation_frame_1 = require("./request-animation-frame");
exports.requestAnimationFrame = request_animation_frame_1.default;
var clear_animation_frame_1 = require("./clear-animation-frame");
exports.clearAnimationFrame = clear_animation_frame_1.default;
// other
var augment_1 = require("./augment");
exports.augment = augment_1.default;
var clone_1 = require("./clone");
exports.clone = clone_1.default;
var debounce_1 = require("./debounce");
exports.debounce = debounce_1.default;
var memoize_1 = require("./memoize");
exports.memoize = memoize_1.default;
var deep_mix_1 = require("./deep-mix");
exports.deepMix = deep_mix_1.default;
var each_1 = require("./each");
exports.each = each_1.default;
var extend_1 = require("./extend");
exports.extend = extend_1.default;
var index_of_1 = require("./index-of");
exports.indexOf = index_of_1.default;
var is_empty_1 = require("./is-empty");
exports.isEmpty = is_empty_1.default;
var is_equal_1 = require("./is-equal");
exports.isEqual = is_equal_1.default;
var is_equal_with_1 = require("./is-equal-with");
exports.isEqualWith = is_equal_with_1.default;
var map_1 = require("./map");
exports.map = map_1.default;
var map_values_1 = require("./map-values");
exports.mapValues = map_values_1.default;
var mix_1 = require("./mix");
exports.mix = mix_1.default;
exports.assign = mix_1.default;
var get_1 = require("./get");
exports.get = get_1.default;
var set_1 = require("./set");
exports.set = set_1.default;
var pick_1 = require("./pick");
exports.pick = pick_1.default;
var throttle_1 = require("./throttle");
exports.throttle = throttle_1.default;
var to_array_1 = require("./to-array");
exports.toArray = to_array_1.default;
var to_string_1 = require("./to-string");
exports.toString = to_string_1.default;
var unique_id_1 = require("./unique-id");
exports.uniqueId = unique_id_1.default;
var noop_1 = require("./noop");
exports.noop = noop_1.default;
var identity_1 = require("./identity");
exports.identity = identity_1.default;
var size_1 = require("./size");
exports.size = size_1.default;
// 不知道为什么，需要把这个 export，不然 ts 会报类型错误
var cache_1 = require("./cache");
exports.Cache = cache_1.default;

},{"./augment":769,"./cache":770,"./clamp":771,"./clear-animation-frame":772,"./clone":773,"./contains":774,"./debounce":775,"./deep-mix":776,"./difference":777,"./each":778,"./ends-with":779,"./every":780,"./extend":781,"./filter":782,"./find":784,"./find-index":783,"./first-value":785,"./fixed-base":786,"./flatten":788,"./flatten-deep":787,"./for-in":789,"./get":793,"./get-range":790,"./get-type":791,"./get-wrap-behavior":792,"./group":796,"./group-by":794,"./group-to-map":795,"./has":799,"./has-key":797,"./has-value":798,"./head":800,"./identity":801,"./index-of":802,"./is-arguments":804,"./is-array":806,"./is-array-like":805,"./is-boolean":807,"./is-date":808,"./is-decimal":809,"./is-element":810,"./is-empty":811,"./is-equal":813,"./is-equal-with":812,"./is-error":814,"./is-even":815,"./is-finite":816,"./is-function":817,"./is-integer":818,"./is-match":819,"./is-negative":820,"./is-nil":821,"./is-null":822,"./is-number":824,"./is-number-equal":823,"./is-object":826,"./is-object-like":825,"./is-odd":827,"./is-plain-object":828,"./is-positive":829,"./is-prototype":830,"./is-reg-exp":831,"./is-string":832,"./is-type":833,"./is-undefined":834,"./keys":835,"./last":836,"./lower-case":837,"./lower-first":838,"./map":840,"./map-values":839,"./max-by":841,"./memoize":842,"./min-by":843,"./mix":844,"./mod":845,"./noop":846,"./number2color":847,"./parse-radius":848,"./pick":849,"./pull":851,"./pull-at":850,"./reduce":852,"./remove":853,"./request-animation-frame":854,"./set":855,"./size":856,"./some":857,"./sort-by":858,"./starts-with":859,"./substitute":860,"./throttle":861,"./to-array":862,"./to-degree":863,"./to-integer":864,"./to-radian":865,"./to-string":866,"./union":867,"./uniq":868,"./unique-id":869,"./upper-case":870,"./upper-first":871,"./values":873,"./values-of-key":872,"./wrap-behavior":874}],804:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 是否是参数类型
 *
 * @param {Object} value 测试的值
 * @return {Boolean}
 */
var is_type_1 = require("./is-type");
var isArguments = function (value) {
    return is_type_1.default(value, 'Arguments');
};
exports.default = isArguments;

},{"./is-type":833}],805:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isArrayLike = function (value) {
    /**
     * isArrayLike([1, 2, 3]) => true
     * isArrayLike(document.body.children) => true
     * isArrayLike('abc') => true
     * isArrayLike(Function) => false
     */
    return value !== null && typeof value !== 'function' && isFinite(value.length);
};
exports.default = isArrayLike;

},{}],806:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_type_1 = require("./is-type");
exports.default = (function (value) {
    return Array.isArray ?
        Array.isArray(value) :
        is_type_1.default(value, 'Array');
});

},{"./is-type":833}],807:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 是否是布尔类型
 *
 * @param {Object} value 测试的值
 * @return {Boolean}
 */
var is_type_1 = require("./is-type");
var isBoolean = function (value) {
    return is_type_1.default(value, 'Boolean');
};
exports.default = isBoolean;

},{"./is-type":833}],808:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_type_1 = require("./is-type");
var isDate = function (value) {
    return is_type_1.default(value, 'Date');
};
exports.default = isDate;

},{"./is-type":833}],809:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isDecimal = function (num) {
    return is_number_1.default(num) && num % 1 !== 0;
};
exports.default = isDecimal;

},{"./is-number":824}],810:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 判断是否HTML元素
 * @return {Boolean} 是否HTML元素
 */
var isElement = function (o) {
    return o instanceof Element || o instanceof HTMLDocument;
};
exports.default = isElement;

},{}],811:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
var is_array_like_1 = require("./is-array-like");
var get_type_1 = require("./get-type");
var is_prototype_1 = require("./is-prototype");
var hasOwnProperty = Object.prototype.hasOwnProperty;
function isEmpty(value) {
    /**
     * isEmpty(null) => true
     * isEmpty() => true
     * isEmpty(true) => true
     * isEmpty(1) => true
     * isEmpty([1, 2, 3]) => false
     * isEmpty('abc') => false
     * isEmpty({ a: 1 }) => false
     */
    if (is_nil_1.default(value)) {
        return true;
    }
    if (is_array_like_1.default(value)) {
        return !value.length;
    }
    var type = get_type_1.default(value);
    if (type === 'Map' || type === 'Set') {
        return !value.size;
    }
    if (is_prototype_1.default(value)) {
        return !Object.keys(value).length;
    }
    for (var key in value) {
        if (hasOwnProperty.call(value, key)) {
            return false;
        }
    }
    return true;
}
exports.default = isEmpty;

},{"./get-type":791,"./is-array-like":805,"./is-nil":821,"./is-prototype":830}],812:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_function_1 = require("./is-function");
var is_equal_1 = require("./is-equal");
/**
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @param {Function} [fn] The function to customize comparisons.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * function isGreeting(value) {
 *   return /^h(?:i|ello)$/.test(value);
 * }
 *
 * function customizer(objValue, othValue) {
 *   if (isGreeting(objValue) && isGreeting(othValue)) {
 *     return true;
 *   }
 * }
 *
 * var array = ['hello', 'goodbye'];
 * var other = ['hi', 'goodbye'];
 *
 * isEqualWith(array, other, customizer);  // => true
 */
exports.default = (function (value, other, fn) {
    if (!is_function_1.default(fn)) {
        return is_equal_1.default(value, other);
    }
    return !!fn(value, other);
});

},{"./is-equal":813,"./is-function":817}],813:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_object_like_1 = require("./is-object-like");
var is_array_like_1 = require("./is-array-like");
var is_string_1 = require("./is-string");
var isEqual = function (value, other) {
    if (value === other) {
        return true;
    }
    if (!value || !other) {
        return false;
    }
    if (is_string_1.default(value) || is_string_1.default(other)) {
        return false;
    }
    if (is_array_like_1.default(value) || is_array_like_1.default(other)) {
        if (value.length !== other.length) {
            return false;
        }
        var rst = true;
        for (var i = 0; i < value.length; i++) {
            rst = isEqual(value[i], other[i]);
            if (!rst) {
                break;
            }
        }
        return rst;
    }
    if (is_object_like_1.default(value) || is_object_like_1.default(other)) {
        var valueKeys = Object.keys(value);
        var otherKeys = Object.keys(other);
        if (valueKeys.length !== otherKeys.length) {
            return false;
        }
        var rst = true;
        for (var i = 0; i < valueKeys.length; i++) {
            rst = isEqual(value[valueKeys[i]], other[valueKeys[i]]);
            if (!rst) {
                break;
            }
        }
        return rst;
    }
    return false;
};
exports.default = isEqual;

},{"./is-array-like":805,"./is-object-like":825,"./is-string":832}],814:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 是否是参数类型
 *
 * @param {Object} value 测试的值
 * @return {Boolean}
 */
var is_type_1 = require("./is-type");
var isError = function (value) {
    return is_type_1.default(value, 'Error');
};
exports.default = isError;

},{"./is-type":833}],815:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isEven = function (num) {
    return is_number_1.default(num) && num % 2 === 0;
};
exports.default = isEven;

},{"./is-number":824}],816:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 判断是否为有限数
 * @return {Boolean}
 */
var is_number_1 = require("./is-number");
function default_1(value) {
    return is_number_1.default(value) && isFinite(value);
}
exports.default = default_1;

},{"./is-number":824}],817:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 是否为函数
 * @param  {*} fn 对象
 * @return {Boolean}  是否函数
 */
var is_type_1 = require("./is-type");
exports.default = (function (value) {
    return is_type_1.default(value, 'Function');
});

},{"./is-type":833}],818:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isInteger = Number.isInteger ? Number.isInteger : function (num) {
    return is_number_1.default(num) && num % 1 === 0;
};
exports.default = isInteger;

},{"./is-number":824}],819:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
var keys_1 = require("./keys");
function isMatch(obj, attrs) {
    var _keys = keys_1.default(attrs);
    var length = _keys.length;
    if (is_nil_1.default(obj))
        return !length;
    for (var i = 0; i < length; i += 1) {
        var key = _keys[i];
        if (attrs[key] !== obj[key] || !(key in obj)) {
            return false;
        }
    }
    return true;
}
exports.default = isMatch;

},{"./is-nil":821,"./keys":835}],820:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isNegative = function (num) {
    return is_number_1.default(num) && num < 0;
};
exports.default = isNegative;

},{"./is-number":824}],821:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// isFinite,
var isNil = function (value) {
    /**
     * isNil(null) => true
     * isNil() => true
     */
    return value === null || value === undefined;
};
exports.default = isNil;

},{}],822:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isNull = function (value) {
    return value === null;
};
exports.default = isNull;

},{}],823:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PRECISION = 0.00001; // numbers less than this is considered as 0
function isNumberEqual(a, b, precision) {
    if (precision === void 0) { precision = PRECISION; }
    return Math.abs((a - b)) < precision;
}
exports.default = isNumberEqual;
;

},{}],824:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 判断是否数字
 * @return {Boolean} 是否数字
 */
var is_type_1 = require("./is-type");
var isNumber = function (value) {
    return is_type_1.default(value, 'Number');
};
exports.default = isNumber;

},{"./is-type":833}],825:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isObjectLike = function (value) {
    /**
     * isObjectLike({}) => true
     * isObjectLike([1, 2, 3]) => true
     * isObjectLike(Function) => false
     * isObjectLike(null) => false
     */
    return typeof value === 'object' && value !== null;
};
exports.default = isObjectLike;

},{}],826:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (value) {
    /**
     * isObject({}) => true
     * isObject([1, 2, 3]) => true
     * isObject(Function) => true
     * isObject(null) => false
     */
    var type = typeof value;
    return value !== null && type === 'object' || type === 'function';
});

},{}],827:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isOdd = function (num) {
    return is_number_1.default(num) && num % 2 !== 0;
};
exports.default = isOdd;

},{"./is-number":824}],828:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_object_like_1 = require("./is-object-like");
var is_type_1 = require("./is-type");
var isPlainObject = function (value) {
    /**
     * isObjectLike(new Foo) => false
     * isObjectLike([1, 2, 3]) => false
     * isObjectLike({ x: 0, y: 0 }) => true
     * isObjectLike(Object.create(null)) => true
     */
    if (!is_object_like_1.default(value) || !is_type_1.default(value, 'Object')) {
        return false;
    }
    if (Object.getPrototypeOf(value) === null) {
        return true;
    }
    var proto = value;
    while (Object.getPrototypeOf(proto) !== null) {
        proto = Object.getPrototypeOf(proto);
    }
    return Object.getPrototypeOf(value) === proto;
};
exports.default = isPlainObject;

},{"./is-object-like":825,"./is-type":833}],829:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_number_1 = require("./is-number");
var isPositive = function (num) {
    return is_number_1.default(num) && num > 0;
};
exports.default = isPositive;

},{"./is-number":824}],830:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var objectProto = Object.prototype;
var isPrototype = function (value) {
    var Ctor = value && value.constructor;
    var proto = (typeof Ctor === 'function' && Ctor.prototype) || objectProto;
    return value === proto;
};
exports.default = isPrototype;

},{}],831:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_type_1 = require("./is-type");
var isRegExp = function (str) {
    return is_type_1.default(str, 'RegExp');
};
exports.default = isRegExp;

},{"./is-type":833}],832:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_type_1 = require("./is-type");
exports.default = (function (str) {
    return is_type_1.default(str, 'String');
});

},{"./is-type":833}],833:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var toString = {}.toString;
var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
exports.default = isType;

},{}],834:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isUndefined = function (value) {
    return value === undefined;
};
exports.default = isUndefined;

},{}],835:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_function_1 = require("./is-function");
var keys = Object.keys ? function (obj) { return Object.keys(obj); } : function (obj) {
    var result = [];
    each_1.default(obj, function (value, key) {
        if (!(is_function_1.default(obj) && key === 'prototype')) {
            result.push(key);
        }
    });
    return result;
};
exports.default = keys;

},{"./each":778,"./is-function":817}],836:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
function last(o) {
    if (is_array_like_1.default(o)) {
        var arr = o;
        return arr[arr.length - 1];
    }
    return undefined;
}
exports.default = last;

},{"./is-array-like":805}],837:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var to_string_1 = require("./to-string");
var lowerCase = function (str) {
    return to_string_1.default(str).toLowerCase();
};
exports.default = lowerCase;

},{"./to-string":866}],838:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var to_string_1 = require("./to-string");
var lowerFirst = function (value) {
    var str = to_string_1.default(value);
    return str.charAt(0).toLowerCase() + str.substring(1);
};
exports.default = lowerFirst;

},{"./to-string":866}],839:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
var is_object_1 = require("./is-object");
var identity = function (v) { return v; };
exports.default = (function (object, func) {
    if (func === void 0) { func = identity; }
    var r = {};
    if (is_object_1.default(object) && !is_nil_1.default(object)) {
        Object.keys(object).forEach(function (key) {
            // @ts-ignore
            r[key] = func(object[key], key);
        });
    }
    return r;
});

},{"./is-nil":821,"./is-object":826}],840:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var map = function (arr, func) {
    if (!is_array_like_1.default(arr)) {
        // @ts-ignore
        return arr;
    }
    var result = [];
    for (var index = 0; index < arr.length; index++) {
        var value = arr[index];
        result.push(func(value, index));
    }
    return result;
};
exports.default = map;

},{"./is-array-like":805}],841:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_array_1 = require("./is-array");
var is_function_1 = require("./is-function");
/**
 * @param {Array} arr The array to iterate over.
 * @param {Function} [fn] The iteratee invoked per element.
 * @return {*} Returns the maximum value.
 * @example
 *
 * var objects = [{ 'n': 1 }, { 'n': 2 }];
 *
 * maxBy(objects, function(o) { return o.n; });
 * // => { 'n': 2 }
 *
 * maxBy(objects, 'n');
 * // => { 'n': 2 }
 */
exports.default = (function (arr, fn) {
    if (!is_array_1.default(arr)) {
        return undefined;
    }
    var max = arr[0];
    var maxData;
    if (is_function_1.default(fn)) {
        maxData = fn(arr[0]);
    }
    else {
        maxData = arr[0][fn];
    }
    var data;
    each_1.default(arr, function (val) {
        if (is_function_1.default(fn)) {
            data = fn(val);
        }
        else {
            data = val[fn];
        }
        if (data > maxData) {
            max = val;
            maxData = data;
        }
    });
    return max;
});

},{"./each":778,"./is-array":806,"./is-function":817}],842:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_function_1 = require("./is-function");
/**
 * _.memoize(calColor);
 * _.memoize(calColor, (...args) => args[0]);
 * @param f
 * @param resolver
 */
exports.default = (function (f, resolver) {
    if (!is_function_1.default(f)) {
        throw new TypeError('Expected a function');
    }
    var memoized = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        // 使用方法构造 key，如果不存在 resolver，则直接取第一个参数作为 key
        var key = resolver ? resolver.apply(this, args) : args[0];
        var cache = memoized.cache;
        if (cache.has(key)) {
            return cache.get(key);
        }
        var result = f.apply(this, args);
        // 缓存起来
        cache.set(key, result);
        return result;
    };
    memoized.cache = new Map();
    return memoized;
});

},{"./is-function":817}],843:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_array_1 = require("./is-array");
var is_function_1 = require("./is-function");
/**
 * @param {Array} arr The array to iterate over.
 * @param {Function} [fn] The iteratee invoked per element.
 * @return {*} Returns the minimum value.
 * @example
 *
 * var objects = [{ 'n': 1 }, { 'n': 2 }];
 *
 * minBy(objects, function(o) { return o.n; });
 * // => { 'n': 1 }
 *
 * minBy(objects, 'n');
 * // => { 'n': 1 }
 */
exports.default = (function (arr, fn) {
    if (!is_array_1.default(arr)) {
        return undefined;
    }
    var min = arr[0];
    var minData;
    if (is_function_1.default(fn)) {
        minData = fn(arr[0]);
    }
    else {
        minData = arr[0][fn];
    }
    var data;
    each_1.default(arr, function (val) {
        if (is_function_1.default(fn)) {
            data = fn(val);
        }
        else {
            data = val[fn];
        }
        if (data < minData) {
            min = val;
            minData = data;
        }
    });
    return min;
});

},{"./each":778,"./is-array":806,"./is-function":817}],844:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// FIXME: Mutable param should be forbidden in static lang.
function _mix(dist, obj) {
    for (var key in obj) {
        if (obj.hasOwnProperty(key) && key !== 'constructor' && obj[key] !== undefined) {
            dist[key] = obj[key];
        }
    }
}
function mix(dist, src1, src2, src3) {
    if (src1)
        _mix(dist, src1);
    if (src2)
        _mix(dist, src2);
    if (src3)
        _mix(dist, src3);
    return dist;
}
exports.default = mix;

},{}],845:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mod = function (n, m) {
    return ((n % m) + m) % m;
};
exports.default = mod;

},{}],846:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function () { });

},{}],847:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var numColorCache = {};
function numberToColor(num) {
    // 增加缓存
    var color = numColorCache[num];
    if (!color) {
        var str = num.toString(16);
        for (var i = str.length; i < 6; i++) {
            str = '0' + str;
        }
        color = '#' + str;
        numColorCache[num] = color;
    }
    return color;
}
exports.default = numberToColor;

},{}],848:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
function parseRadius(radius) {
    var r1 = 0, r2 = 0, r3 = 0, r4 = 0;
    if (is_array_1.default(radius)) {
        if (radius.length === 1) {
            r1 = r2 = r3 = r4 = radius[0];
        }
        else if (radius.length === 2) {
            r1 = r3 = radius[0];
            r2 = r4 = radius[1];
        }
        else if (radius.length === 3) {
            r1 = radius[0];
            r2 = r4 = radius[1];
            r3 = radius[2];
        }
        else {
            r1 = radius[0];
            r2 = radius[1];
            r3 = radius[2];
            r4 = radius[3];
        }
    }
    else {
        r1 = r2 = r3 = r4 = radius;
    }
    return {
        r1: r1,
        r2: r2,
        r3: r3,
        r4: r4
    };
}
exports.default = parseRadius;

},{"./is-array":806}],849:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_plain_object_1 = require("./is-plain-object");
var hasOwnProperty = Object.prototype.hasOwnProperty;
exports.default = (function (object, keys) {
    if (object === null || !is_plain_object_1.default(object)) {
        return {};
    }
    var result = {};
    each_1.default(keys, function (key) {
        if (hasOwnProperty.call(object, key)) {
            result[key] = object[key];
        }
    });
    return result;
});

},{"./each":778,"./is-plain-object":828}],850:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var splice = Array.prototype.splice;
var pullAt = function pullAt(arr, indexes) {
    if (!is_array_like_1.default(arr)) {
        return [];
    }
    var length = arr ? indexes.length : 0;
    var last = length - 1;
    while (length--) {
        var previous = void 0;
        var index = indexes[length];
        if (length === last || index !== previous) {
            previous = index;
            splice.call(arr, index, 1);
        }
    }
    return arr;
};
exports.default = pullAt;

},{"./is-array-like":805}],851:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var arrPrototype = Array.prototype;
var splice = arrPrototype.splice;
var indexOf = arrPrototype.indexOf;
var pull = function (arr) {
    var values = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        values[_i - 1] = arguments[_i];
    }
    for (var i = 0; i < values.length; i++) {
        var value = values[i];
        var fromIndex = -1;
        while ((fromIndex = indexOf.call(arr, value)) > -1) {
            splice.call(arr, fromIndex, 1);
        }
    }
    return arr;
};
exports.default = pull;

},{}],852:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_array_1 = require("./is-array");
var is_plain_object_1 = require("./is-plain-object");
var reduce = function (arr, fn, init) {
    if (!is_array_1.default(arr) && !is_plain_object_1.default(arr)) {
        return arr;
    }
    var result = init;
    each_1.default(arr, function (data, i) {
        result = fn(result, data, i);
    });
    return result;
};
exports.default = reduce;

},{"./each":778,"./is-array":806,"./is-plain-object":828}],853:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
var pull_at_1 = require("./pull-at");
var remove = function (arr, predicate) {
    /**
     * const arr = [1, 2, 3, 4]
     * const evens = remove(arr, n => n % 2 == 0)
     * console.log(arr) // => [1, 3]
     * console.log(evens) // => [2, 4]
     */
    var result = [];
    if (!is_array_like_1.default(arr)) {
        return result;
    }
    var i = -1;
    var indexes = [];
    var length = arr.length;
    while (++i < length) {
        var value = arr[i];
        if (predicate(value, i, arr)) {
            result.push(value);
            indexes.push(i);
        }
    }
    pull_at_1.default(arr, indexes);
    return result;
};
exports.default = remove;

},{"./is-array-like":805,"./pull-at":850}],854:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function requestAnimationFrame(fn) {
    var method = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        // @ts-ignore
        window.mozRequestAnimationFrame ||
        // @ts-ignore
        window.msRequestAnimationFrame ||
        function (f) {
            return setTimeout(f, 16);
        };
    return method(fn);
}
exports.default = requestAnimationFrame;
;

},{}],855:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_object_1 = require("./is-object");
var is_string_1 = require("./is-string");
var is_number_1 = require("./is-number");
/**
 * https://github.com/developit/dlv/blob/master/index.js
 * @param obj
 * @param path
 * @param value
 */
exports.default = (function (obj, path, value) {
    var o = obj;
    var keyArr = is_string_1.default(path) ? path.split('.') : path;
    keyArr.forEach(function (key, idx) {
        // 不是最后一个
        if (idx < keyArr.length - 1) {
            if (!is_object_1.default(o[key])) {
                o[key] = is_number_1.default(keyArr[idx + 1]) ? [] : {};
            }
            o = o[key];
        }
        else {
            o[key] = value;
        }
    });
    return obj;
});

},{"./is-number":824,"./is-object":826,"./is-string":832}],856:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
var is_array_like_1 = require("./is-array-like");
function size(o) {
    if (is_nil_1.default(o)) {
        return 0;
    }
    if (is_array_like_1.default(o)) {
        return o.length;
    }
    return Object.keys(o).length;
}
exports.default = size;

},{"./is-array-like":805,"./is-nil":821}],857:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 只要有一个满足条件就返回 true
 * @param arr
 * @param func
 */
var some = function (arr, func) {
    for (var i = 0; i < arr.length; i++) {
        if (func(arr[i], i))
            return true;
    }
    return false;
};
exports.default = some;

},{}],858:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_string_1 = require("./is-string");
var is_function_1 = require("./is-function");
function sortBy(arr, key) {
    var comparer;
    if (is_function_1.default(key)) {
        comparer = function (a, b) { return key(a) - key(b); };
    }
    else {
        var keys_1 = [];
        if (is_string_1.default(key)) {
            keys_1.push(key);
        }
        else if (is_array_1.default(key)) {
            keys_1 = key;
        }
        comparer = function (a, b) {
            for (var i = 0; i < keys_1.length; i += 1) {
                var prop = keys_1[i];
                if (a[prop] > b[prop]) {
                    return 1;
                }
                if (a[prop] < b[prop]) {
                    return -1;
                }
            }
            return 0;
        };
    }
    arr.sort(comparer);
    return arr;
}
exports.default = sortBy;

},{"./is-array":806,"./is-function":817,"./is-string":832}],859:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_string_1 = require("./is-string");
function startsWith(arr, e) {
    return (is_array_1.default(arr) || is_string_1.default(arr)) ? arr[0] === e : false;
}
exports.default = startsWith;

},{"./is-array":806,"./is-string":832}],860:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function substitute(str, o) {
    if (!str || !o) {
        return str;
    }
    return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) {
        if (match.charAt(0) === '\\') {
            return match.slice(1);
        }
        return (o[name] === undefined) ? '' : o[name];
    });
}
exports.default = substitute;

},{}],861:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (func, wait, options) {
    var timeout, context, args, result;
    var previous = 0;
    if (!options)
        options = {};
    var later = function () {
        previous = options.leading === false ? 0 : Date.now();
        timeout = null;
        result = func.apply(context, args);
        if (!timeout)
            context = args = null;
    };
    var throttled = function () {
        var now = Date.now();
        if (!previous && options.leading === false)
            previous = now;
        var remaining = wait - (now - previous);
        context = this;
        args = arguments;
        if (remaining <= 0 || remaining > wait) {
            if (timeout) {
                clearTimeout(timeout);
                timeout = null;
            }
            previous = now;
            result = func.apply(context, args);
            if (!timeout)
                context = args = null;
        }
        else if (!timeout && options.trailing !== false) {
            timeout = setTimeout(later, remaining);
        }
        return result;
    };
    throttled.cancel = function () {
        clearTimeout(timeout);
        previous = 0;
        timeout = context = args = null;
    };
    return throttled;
});

},{}],862:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_like_1 = require("./is-array-like");
exports.default = (function (value) {
    return is_array_like_1.default(value) ? Array.prototype.slice.call(value) : [];
});

},{"./is-array-like":805}],863:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DEGREE = 180 / Math.PI;
var toDegree = function (radian) {
    return DEGREE * radian;
};
exports.default = toDegree;

},{}],864:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = parseInt;

},{}],865:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RADIAN = Math.PI / 180;
var toRadian = function (degree) {
    return RADIAN * degree;
};
exports.default = toRadian;

},{}],866:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_nil_1 = require("./is-nil");
exports.default = (function (value) {
    if (is_nil_1.default(value))
        return '';
    return value.toString();
});

},{"./is-nil":821}],867:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var uniq_1 = require("./uniq");
var union = function () {
    var sources = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        sources[_i] = arguments[_i];
    }
    return uniq_1.default([].concat.apply([], sources));
};
exports.default = union;

},{"./uniq":868}],868:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var contains_1 = require("./contains");
var each_1 = require("./each");
var uniq = function (arr) {
    var resultArr = [];
    each_1.default(arr, function (item) {
        if (!contains_1.default(resultArr, item)) {
            resultArr.push(item);
        }
    });
    return resultArr;
};
exports.default = uniq;

},{"./contains":774,"./each":778}],869:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var map = {};
exports.default = (function (prefix) {
    prefix = prefix || 'g';
    if (!map[prefix]) {
        map[prefix] = 1;
    }
    else {
        map[prefix] += 1;
    }
    return prefix + map[prefix];
});

},{}],870:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var to_string_1 = require("./to-string");
var upperCase = function (str) {
    return to_string_1.default(str).toUpperCase();
};
exports.default = upperCase;

},{"./to-string":866}],871:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var to_string_1 = require("./to-string");
var upperFirst = function (value) {
    var str = to_string_1.default(value);
    return str.charAt(0).toUpperCase() + str.substring(1);
};
exports.default = upperFirst;

},{"./to-string":866}],872:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_array_1 = require("./is-array");
var is_nil_1 = require("./is-nil");
exports.default = (function (data, name) {
    var rst = [];
    var tmpMap = {};
    for (var i = 0; i < data.length; i++) {
        var obj = data[i];
        var value = obj[name];
        if (!is_nil_1.default(value)) {
            // flatten
            if (!is_array_1.default(value)) {
                value = [value];
            }
            for (var j = 0; j < value.length; j++) {
                var val = value[j];
                // unique
                if (!tmpMap[val]) {
                    rst.push(val);
                    tmpMap[val] = true;
                }
            }
        }
    }
    return rst;
});

},{"./is-array":806,"./is-nil":821}],873:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var each_1 = require("./each");
var is_function_1 = require("./is-function");
// @ts-ignore
var values = Object.values ? function (obj) { return Object.values(obj); } : function (obj) {
    var result = [];
    each_1.default(obj, function (value, key) {
        if (!(is_function_1.default(obj) && key === 'prototype')) {
            result.push(value);
        }
    });
    return result;
};
exports.default = values;

},{"./each":778,"./is-function":817}],874:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 封装事件，便于使用上下文this,和便于解除事件时使用
 * @protected
 * @param  {Object} obj   对象
 * @param  {String} action 事件名称
 * @return {Function}        返回事件处理函数
 */
function wrapBehavior(obj, action) {
    if (obj['_wrap_' + action]) {
        return obj['_wrap_' + action];
    }
    var method = function (e) {
        obj[action](e);
    };
    obj['_wrap_' + action] = method;
    return method;
}
exports.default = wrapBehavior;

},{}],875:[function(require,module,exports){
// https://d3js.org/d3-color/ v1.4.1 Copyright 2020 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';

function define(constructor, factory, prototype) {
  constructor.prototype = factory.prototype = prototype;
  prototype.constructor = constructor;
}

function extend(parent, definition) {
  var prototype = Object.create(parent.prototype);
  for (var key in definition) prototype[key] = definition[key];
  return prototype;
}

function Color() {}

var darker = 0.7;
var brighter = 1 / darker;

var reI = "\\s*([+-]?\\d+)\\s*",
    reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
    reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
    reHex = /^#([0-9a-f]{3,8})$/,
    reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
    reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
    reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
    reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
    reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
    reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");

var named = {
  aliceblue: 0xf0f8ff,
  antiquewhite: 0xfaebd7,
  aqua: 0x00ffff,
  aquamarine: 0x7fffd4,
  azure: 0xf0ffff,
  beige: 0xf5f5dc,
  bisque: 0xffe4c4,
  black: 0x000000,
  blanchedalmond: 0xffebcd,
  blue: 0x0000ff,
  blueviolet: 0x8a2be2,
  brown: 0xa52a2a,
  burlywood: 0xdeb887,
  cadetblue: 0x5f9ea0,
  chartreuse: 0x7fff00,
  chocolate: 0xd2691e,
  coral: 0xff7f50,
  cornflowerblue: 0x6495ed,
  cornsilk: 0xfff8dc,
  crimson: 0xdc143c,
  cyan: 0x00ffff,
  darkblue: 0x00008b,
  darkcyan: 0x008b8b,
  darkgoldenrod: 0xb8860b,
  darkgray: 0xa9a9a9,
  darkgreen: 0x006400,
  darkgrey: 0xa9a9a9,
  darkkhaki: 0xbdb76b,
  darkmagenta: 0x8b008b,
  darkolivegreen: 0x556b2f,
  darkorange: 0xff8c00,
  darkorchid: 0x9932cc,
  darkred: 0x8b0000,
  darksalmon: 0xe9967a,
  darkseagreen: 0x8fbc8f,
  darkslateblue: 0x483d8b,
  darkslategray: 0x2f4f4f,
  darkslategrey: 0x2f4f4f,
  darkturquoise: 0x00ced1,
  darkviolet: 0x9400d3,
  deeppink: 0xff1493,
  deepskyblue: 0x00bfff,
  dimgray: 0x696969,
  dimgrey: 0x696969,
  dodgerblue: 0x1e90ff,
  firebrick: 0xb22222,
  floralwhite: 0xfffaf0,
  forestgreen: 0x228b22,
  fuchsia: 0xff00ff,
  gainsboro: 0xdcdcdc,
  ghostwhite: 0xf8f8ff,
  gold: 0xffd700,
  goldenrod: 0xdaa520,
  gray: 0x808080,
  green: 0x008000,
  greenyellow: 0xadff2f,
  grey: 0x808080,
  honeydew: 0xf0fff0,
  hotpink: 0xff69b4,
  indianred: 0xcd5c5c,
  indigo: 0x4b0082,
  ivory: 0xfffff0,
  khaki: 0xf0e68c,
  lavender: 0xe6e6fa,
  lavenderblush: 0xfff0f5,
  lawngreen: 0x7cfc00,
  lemonchiffon: 0xfffacd,
  lightblue: 0xadd8e6,
  lightcoral: 0xf08080,
  lightcyan: 0xe0ffff,
  lightgoldenrodyellow: 0xfafad2,
  lightgray: 0xd3d3d3,
  lightgreen: 0x90ee90,
  lightgrey: 0xd3d3d3,
  lightpink: 0xffb6c1,
  lightsalmon: 0xffa07a,
  lightseagreen: 0x20b2aa,
  lightskyblue: 0x87cefa,
  lightslategray: 0x778899,
  lightslategrey: 0x778899,
  lightsteelblue: 0xb0c4de,
  lightyellow: 0xffffe0,
  lime: 0x00ff00,
  limegreen: 0x32cd32,
  linen: 0xfaf0e6,
  magenta: 0xff00ff,
  maroon: 0x800000,
  mediumaquamarine: 0x66cdaa,
  mediumblue: 0x0000cd,
  mediumorchid: 0xba55d3,
  mediumpurple: 0x9370db,
  mediumseagreen: 0x3cb371,
  mediumslateblue: 0x7b68ee,
  mediumspringgreen: 0x00fa9a,
  mediumturquoise: 0x48d1cc,
  mediumvioletred: 0xc71585,
  midnightblue: 0x191970,
  mintcream: 0xf5fffa,
  mistyrose: 0xffe4e1,
  moccasin: 0xffe4b5,
  navajowhite: 0xffdead,
  navy: 0x000080,
  oldlace: 0xfdf5e6,
  olive: 0x808000,
  olivedrab: 0x6b8e23,
  orange: 0xffa500,
  orangered: 0xff4500,
  orchid: 0xda70d6,
  palegoldenrod: 0xeee8aa,
  palegreen: 0x98fb98,
  paleturquoise: 0xafeeee,
  palevioletred: 0xdb7093,
  papayawhip: 0xffefd5,
  peachpuff: 0xffdab9,
  peru: 0xcd853f,
  pink: 0xffc0cb,
  plum: 0xdda0dd,
  powderblue: 0xb0e0e6,
  purple: 0x800080,
  rebeccapurple: 0x663399,
  red: 0xff0000,
  rosybrown: 0xbc8f8f,
  royalblue: 0x4169e1,
  saddlebrown: 0x8b4513,
  salmon: 0xfa8072,
  sandybrown: 0xf4a460,
  seagreen: 0x2e8b57,
  seashell: 0xfff5ee,
  sienna: 0xa0522d,
  silver: 0xc0c0c0,
  skyblue: 0x87ceeb,
  slateblue: 0x6a5acd,
  slategray: 0x708090,
  slategrey: 0x708090,
  snow: 0xfffafa,
  springgreen: 0x00ff7f,
  steelblue: 0x4682b4,
  tan: 0xd2b48c,
  teal: 0x008080,
  thistle: 0xd8bfd8,
  tomato: 0xff6347,
  turquoise: 0x40e0d0,
  violet: 0xee82ee,
  wheat: 0xf5deb3,
  white: 0xffffff,
  whitesmoke: 0xf5f5f5,
  yellow: 0xffff00,
  yellowgreen: 0x9acd32
};

define(Color, color, {
  copy: function(channels) {
    return Object.assign(new this.constructor, this, channels);
  },
  displayable: function() {
    return this.rgb().displayable();
  },
  hex: color_formatHex, // Deprecated! Use color.formatHex.
  formatHex: color_formatHex,
  formatHsl: color_formatHsl,
  formatRgb: color_formatRgb,
  toString: color_formatRgb
});

function color_formatHex() {
  return this.rgb().formatHex();
}

function color_formatHsl() {
  return hslConvert(this).formatHsl();
}

function color_formatRgb() {
  return this.rgb().formatRgb();
}

function color(format) {
  var m, l;
  format = (format + "").trim().toLowerCase();
  return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
      : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
      : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
      : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
      : null) // invalid hex
      : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
      : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
      : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
      : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
      : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
      : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
      : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
      : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
      : null;
}

function rgbn(n) {
  return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}

function rgba(r, g, b, a) {
  if (a <= 0) r = g = b = NaN;
  return new Rgb(r, g, b, a);
}

function rgbConvert(o) {
  if (!(o instanceof Color)) o = color(o);
  if (!o) return new Rgb;
  o = o.rgb();
  return new Rgb(o.r, o.g, o.b, o.opacity);
}

function rgb(r, g, b, opacity) {
  return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}

function Rgb(r, g, b, opacity) {
  this.r = +r;
  this.g = +g;
  this.b = +b;
  this.opacity = +opacity;
}

define(Rgb, rgb, extend(Color, {
  brighter: function(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? darker : Math.pow(darker, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  rgb: function() {
    return this;
  },
  displayable: function() {
    return (-0.5 <= this.r && this.r < 255.5)
        && (-0.5 <= this.g && this.g < 255.5)
        && (-0.5 <= this.b && this.b < 255.5)
        && (0 <= this.opacity && this.opacity <= 1);
  },
  hex: rgb_formatHex, // Deprecated! Use color.formatHex.
  formatHex: rgb_formatHex,
  formatRgb: rgb_formatRgb,
  toString: rgb_formatRgb
}));

function rgb_formatHex() {
  return "#" + hex(this.r) + hex(this.g) + hex(this.b);
}

function rgb_formatRgb() {
  var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
  return (a === 1 ? "rgb(" : "rgba(")
      + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
      + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
      + Math.max(0, Math.min(255, Math.round(this.b) || 0))
      + (a === 1 ? ")" : ", " + a + ")");
}

function hex(value) {
  value = Math.max(0, Math.min(255, Math.round(value) || 0));
  return (value < 16 ? "0" : "") + value.toString(16);
}

function hsla(h, s, l, a) {
  if (a <= 0) h = s = l = NaN;
  else if (l <= 0 || l >= 1) h = s = NaN;
  else if (s <= 0) h = NaN;
  return new Hsl(h, s, l, a);
}

function hslConvert(o) {
  if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof Color)) o = color(o);
  if (!o) return new Hsl;
  if (o instanceof Hsl) return o;
  o = o.rgb();
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      min = Math.min(r, g, b),
      max = Math.max(r, g, b),
      h = NaN,
      s = max - min,
      l = (max + min) / 2;
  if (s) {
    if (r === max) h = (g - b) / s + (g < b) * 6;
    else if (g === max) h = (b - r) / s + 2;
    else h = (r - g) / s + 4;
    s /= l < 0.5 ? max + min : 2 - max - min;
    h *= 60;
  } else {
    s = l > 0 && l < 1 ? 0 : h;
  }
  return new Hsl(h, s, l, o.opacity);
}

function hsl(h, s, l, opacity) {
  return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}

function Hsl(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}

define(Hsl, hsl, extend(Color, {
  brighter: function(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? darker : Math.pow(darker, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function() {
    var h = this.h % 360 + (this.h < 0) * 360,
        s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
        l = this.l,
        m2 = l + (l < 0.5 ? l : 1 - l) * s,
        m1 = 2 * l - m2;
    return new Rgb(
      hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
      hsl2rgb(h, m1, m2),
      hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
      this.opacity
    );
  },
  displayable: function() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s))
        && (0 <= this.l && this.l <= 1)
        && (0 <= this.opacity && this.opacity <= 1);
  },
  formatHsl: function() {
    var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
    return (a === 1 ? "hsl(" : "hsla(")
        + (this.h || 0) + ", "
        + (this.s || 0) * 100 + "%, "
        + (this.l || 0) * 100 + "%"
        + (a === 1 ? ")" : ", " + a + ")");
  }
}));

/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
  return (h < 60 ? m1 + (m2 - m1) * h / 60
      : h < 180 ? m2
      : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
      : m1) * 255;
}

var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;

// https://observablehq.com/@mbostock/lab-and-rgb
var K = 18,
    Xn = 0.96422,
    Yn = 1,
    Zn = 0.82521,
    t0 = 4 / 29,
    t1 = 6 / 29,
    t2 = 3 * t1 * t1,
    t3 = t1 * t1 * t1;

function labConvert(o) {
  if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
  if (o instanceof Hcl) return hcl2lab(o);
  if (!(o instanceof Rgb)) o = rgbConvert(o);
  var r = rgb2lrgb(o.r),
      g = rgb2lrgb(o.g),
      b = rgb2lrgb(o.b),
      y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
  if (r === g && g === b) x = z = y; else {
    x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
    z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
  }
  return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}

function gray(l, opacity) {
  return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
}

function lab(l, a, b, opacity) {
  return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}

function Lab(l, a, b, opacity) {
  this.l = +l;
  this.a = +a;
  this.b = +b;
  this.opacity = +opacity;
}

define(Lab, lab, extend(Color, {
  brighter: function(k) {
    return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  darker: function(k) {
    return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  rgb: function() {
    var y = (this.l + 16) / 116,
        x = isNaN(this.a) ? y : y + this.a / 500,
        z = isNaN(this.b) ? y : y - this.b / 200;
    x = Xn * lab2xyz(x);
    y = Yn * lab2xyz(y);
    z = Zn * lab2xyz(z);
    return new Rgb(
      lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
      lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
      lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
      this.opacity
    );
  }
}));

function xyz2lab(t) {
  return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
}

function lab2xyz(t) {
  return t > t1 ? t * t * t : t2 * (t - t0);
}

function lrgb2rgb(x) {
  return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}

function rgb2lrgb(x) {
  return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}

function hclConvert(o) {
  if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
  if (!(o instanceof Lab)) o = labConvert(o);
  if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  var h = Math.atan2(o.b, o.a) * rad2deg;
  return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}

function lch(l, c, h, opacity) {
  return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}

function hcl(h, c, l, opacity) {
  return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}

function Hcl(h, c, l, opacity) {
  this.h = +h;
  this.c = +c;
  this.l = +l;
  this.opacity = +opacity;
}

function hcl2lab(o) {
  if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
  var h = o.h * deg2rad;
  return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

define(Hcl, hcl, extend(Color, {
  brighter: function(k) {
    return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
  },
  darker: function(k) {
    return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
  },
  rgb: function() {
    return hcl2lab(this).rgb();
  }
}));

var A = -0.14861,
    B = +1.78277,
    C = -0.29227,
    D = -0.90649,
    E = +1.97294,
    ED = E * D,
    EB = E * B,
    BC_DA = B * C - D * A;

function cubehelixConvert(o) {
  if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
  if (!(o instanceof Rgb)) o = rgbConvert(o);
  var r = o.r / 255,
      g = o.g / 255,
      b = o.b / 255,
      l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
      bl = b - l,
      k = (E * (g - l) - C * bl) / D,
      s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
      h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
  return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function cubehelix(h, s, l, opacity) {
  return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}

function Cubehelix(h, s, l, opacity) {
  this.h = +h;
  this.s = +s;
  this.l = +l;
  this.opacity = +opacity;
}

define(Cubehelix, cubehelix, extend(Color, {
  brighter: function(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  darker: function(k) {
    k = k == null ? darker : Math.pow(darker, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  rgb: function() {
    var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
        l = +this.l,
        a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
        cosh = Math.cos(h),
        sinh = Math.sin(h);
    return new Rgb(
      255 * (l + a * (A * cosh + B * sinh)),
      255 * (l + a * (C * cosh + D * sinh)),
      255 * (l + a * (E * cosh)),
      this.opacity
    );
  }
}));

exports.color = color;
exports.cubehelix = cubehelix;
exports.gray = gray;
exports.hcl = hcl;
exports.hsl = hsl;
exports.lab = lab;
exports.lch = lch;
exports.rgb = rgb;

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

}));

},{}],876:[function(require,module,exports){
// https://d3js.org/d3-ease/ v1.0.7 Copyright 2020 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';

function linear(t) {
  return +t;
}

function quadIn(t) {
  return t * t;
}

function quadOut(t) {
  return t * (2 - t);
}

function quadInOut(t) {
  return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
}

function cubicIn(t) {
  return t * t * t;
}

function cubicOut(t) {
  return --t * t * t + 1;
}

function cubicInOut(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}

var exponent = 3;

var polyIn = (function custom(e) {
  e = +e;

  function polyIn(t) {
    return Math.pow(t, e);
  }

  polyIn.exponent = custom;

  return polyIn;
})(exponent);

var polyOut = (function custom(e) {
  e = +e;

  function polyOut(t) {
    return 1 - Math.pow(1 - t, e);
  }

  polyOut.exponent = custom;

  return polyOut;
})(exponent);

var polyInOut = (function custom(e) {
  e = +e;

  function polyInOut(t) {
    return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
  }

  polyInOut.exponent = custom;

  return polyInOut;
})(exponent);

var pi = Math.PI,
    halfPi = pi / 2;

function sinIn(t) {
  return (+t === 1) ? 1 : 1 - Math.cos(t * halfPi);
}

function sinOut(t) {
  return Math.sin(t * halfPi);
}

function sinInOut(t) {
  return (1 - Math.cos(pi * t)) / 2;
}

// tpmt is two power minus ten times t scaled to [0,1]
function tpmt(x) {
  return (Math.pow(2, -10 * x) - 0.0009765625) * 1.0009775171065494;
}

function expIn(t) {
  return tpmt(1 - +t);
}

function expOut(t) {
  return 1 - tpmt(t);
}

function expInOut(t) {
  return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2;
}

function circleIn(t) {
  return 1 - Math.sqrt(1 - t * t);
}

function circleOut(t) {
  return Math.sqrt(1 - --t * t);
}

function circleInOut(t) {
  return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
}

var b1 = 4 / 11,
    b2 = 6 / 11,
    b3 = 8 / 11,
    b4 = 3 / 4,
    b5 = 9 / 11,
    b6 = 10 / 11,
    b7 = 15 / 16,
    b8 = 21 / 22,
    b9 = 63 / 64,
    b0 = 1 / b1 / b1;

function bounceIn(t) {
  return 1 - bounceOut(1 - t);
}

function bounceOut(t) {
  return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
}

function bounceInOut(t) {
  return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
}

var overshoot = 1.70158;

var backIn = (function custom(s) {
  s = +s;

  function backIn(t) {
    return (t = +t) * t * (s * (t - 1) + t);
  }

  backIn.overshoot = custom;

  return backIn;
})(overshoot);

var backOut = (function custom(s) {
  s = +s;

  function backOut(t) {
    return --t * t * ((t + 1) * s + t) + 1;
  }

  backOut.overshoot = custom;

  return backOut;
})(overshoot);

var backInOut = (function custom(s) {
  s = +s;

  function backInOut(t) {
    return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
  }

  backInOut.overshoot = custom;

  return backInOut;
})(overshoot);

var tau = 2 * Math.PI,
    amplitude = 1,
    period = 0.3;

var elasticIn = (function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticIn(t) {
    return a * tpmt(-(--t)) * Math.sin((s - t) / p);
  }

  elasticIn.amplitude = function(a) { return custom(a, p * tau); };
  elasticIn.period = function(p) { return custom(a, p); };

  return elasticIn;
})(amplitude, period);

var elasticOut = (function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticOut(t) {
    return 1 - a * tpmt(t = +t) * Math.sin((t + s) / p);
  }

  elasticOut.amplitude = function(a) { return custom(a, p * tau); };
  elasticOut.period = function(p) { return custom(a, p); };

  return elasticOut;
})(amplitude, period);

var elasticInOut = (function custom(a, p) {
  var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);

  function elasticInOut(t) {
    return ((t = t * 2 - 1) < 0
        ? a * tpmt(-t) * Math.sin((s - t) / p)
        : 2 - a * tpmt(t) * Math.sin((s + t) / p)) / 2;
  }

  elasticInOut.amplitude = function(a) { return custom(a, p * tau); };
  elasticInOut.period = function(p) { return custom(a, p); };

  return elasticInOut;
})(amplitude, period);

exports.easeBack = backInOut;
exports.easeBackIn = backIn;
exports.easeBackInOut = backInOut;
exports.easeBackOut = backOut;
exports.easeBounce = bounceOut;
exports.easeBounceIn = bounceIn;
exports.easeBounceInOut = bounceInOut;
exports.easeBounceOut = bounceOut;
exports.easeCircle = circleInOut;
exports.easeCircleIn = circleIn;
exports.easeCircleInOut = circleInOut;
exports.easeCircleOut = circleOut;
exports.easeCubic = cubicInOut;
exports.easeCubicIn = cubicIn;
exports.easeCubicInOut = cubicInOut;
exports.easeCubicOut = cubicOut;
exports.easeElastic = elasticOut;
exports.easeElasticIn = elasticIn;
exports.easeElasticInOut = elasticInOut;
exports.easeElasticOut = elasticOut;
exports.easeExp = expInOut;
exports.easeExpIn = expIn;
exports.easeExpInOut = expInOut;
exports.easeExpOut = expOut;
exports.easeLinear = linear;
exports.easePoly = polyInOut;
exports.easePolyIn = polyIn;
exports.easePolyInOut = polyInOut;
exports.easePolyOut = polyOut;
exports.easeQuad = quadInOut;
exports.easeQuadIn = quadIn;
exports.easeQuadInOut = quadInOut;
exports.easeQuadOut = quadOut;
exports.easeSin = sinInOut;
exports.easeSinIn = sinIn;
exports.easeSinInOut = sinInOut;
exports.easeSinOut = sinOut;

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

}));

},{}],877:[function(require,module,exports){
// https://d3js.org/d3-interpolate/ v1.4.0 Copyright 2019 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-color')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}, global.d3));
}(this, function (exports, d3Color) { 'use strict';

function basis(t1, v0, v1, v2, v3) {
  var t2 = t1 * t1, t3 = t2 * t1;
  return ((1 - 3 * t1 + 3 * t2 - t3) * v0
      + (4 - 6 * t2 + 3 * t3) * v1
      + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
      + t3 * v3) / 6;
}

function basis$1(values) {
  var n = values.length - 1;
  return function(t) {
    var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
        v1 = values[i],
        v2 = values[i + 1],
        v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
        v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
    return basis((t - i / n) * n, v0, v1, v2, v3);
  };
}

function basisClosed(values) {
  var n = values.length;
  return function(t) {
    var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
        v0 = values[(i + n - 1) % n],
        v1 = values[i % n],
        v2 = values[(i + 1) % n],
        v3 = values[(i + 2) % n];
    return basis((t - i / n) * n, v0, v1, v2, v3);
  };
}

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

function linear(a, d) {
  return function(t) {
    return a + t * d;
  };
}

function exponential(a, b, y) {
  return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
    return Math.pow(a + t * b, y);
  };
}

function hue(a, b) {
  var d = b - a;
  return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
}

function gamma(y) {
  return (y = +y) === 1 ? nogamma : function(a, b) {
    return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
  };
}

function nogamma(a, b) {
  var d = b - a;
  return d ? linear(a, d) : constant(isNaN(a) ? b : a);
}

var rgb = (function rgbGamma(y) {
  var color = gamma(y);

  function rgb(start, end) {
    var r = color((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r),
        g = color(start.g, end.g),
        b = color(start.b, end.b),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.r = r(t);
      start.g = g(t);
      start.b = b(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }

  rgb.gamma = rgbGamma;

  return rgb;
})(1);

function rgbSpline(spline) {
  return function(colors) {
    var n = colors.length,
        r = new Array(n),
        g = new Array(n),
        b = new Array(n),
        i, color;
    for (i = 0; i < n; ++i) {
      color = d3Color.rgb(colors[i]);
      r[i] = color.r || 0;
      g[i] = color.g || 0;
      b[i] = color.b || 0;
    }
    r = spline(r);
    g = spline(g);
    b = spline(b);
    color.opacity = 1;
    return function(t) {
      color.r = r(t);
      color.g = g(t);
      color.b = b(t);
      return color + "";
    };
  };
}

var rgbBasis = rgbSpline(basis$1);
var rgbBasisClosed = rgbSpline(basisClosed);

function numberArray(a, b) {
  if (!b) b = [];
  var n = a ? Math.min(b.length, a.length) : 0,
      c = b.slice(),
      i;
  return function(t) {
    for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
    return c;
  };
}

function isNumberArray(x) {
  return ArrayBuffer.isView(x) && !(x instanceof DataView);
}

function array(a, b) {
  return (isNumberArray(b) ? numberArray : genericArray)(a, b);
}

function genericArray(a, b) {
  var nb = b ? b.length : 0,
      na = a ? Math.min(nb, a.length) : 0,
      x = new Array(na),
      c = new Array(nb),
      i;

  for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);
  for (; i < nb; ++i) c[i] = b[i];

  return function(t) {
    for (i = 0; i < na; ++i) c[i] = x[i](t);
    return c;
  };
}

function date(a, b) {
  var d = new Date;
  return a = +a, b = +b, function(t) {
    return d.setTime(a * (1 - t) + b * t), d;
  };
}

function number(a, b) {
  return a = +a, b = +b, function(t) {
    return a * (1 - t) + b * t;
  };
}

function object(a, b) {
  var i = {},
      c = {},
      k;

  if (a === null || typeof a !== "object") a = {};
  if (b === null || typeof b !== "object") b = {};

  for (k in b) {
    if (k in a) {
      i[k] = value(a[k], b[k]);
    } else {
      c[k] = b[k];
    }
  }

  return function(t) {
    for (k in i) c[k] = i[k](t);
    return c;
  };
}

var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
    reB = new RegExp(reA.source, "g");

function zero(b) {
  return function() {
    return b;
  };
}

function one(b) {
  return function(t) {
    return b(t) + "";
  };
}

function string(a, b) {
  var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
      am, // current match in a
      bm, // current match in b
      bs, // string preceding current number in b, if any
      i = -1, // index in s
      s = [], // string constants and placeholders
      q = []; // number interpolators

  // Coerce inputs to strings.
  a = a + "", b = b + "";

  // Interpolate pairs of numbers in a & b.
  while ((am = reA.exec(a))
      && (bm = reB.exec(b))) {
    if ((bs = bm.index) > bi) { // a string precedes the next number in b
      bs = b.slice(bi, bs);
      if (s[i]) s[i] += bs; // coalesce with previous string
      else s[++i] = bs;
    }
    if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
      if (s[i]) s[i] += bm; // coalesce with previous string
      else s[++i] = bm;
    } else { // interpolate non-matching numbers
      s[++i] = null;
      q.push({i: i, x: number(am, bm)});
    }
    bi = reB.lastIndex;
  }

  // Add remains of b.
  if (bi < b.length) {
    bs = b.slice(bi);
    if (s[i]) s[i] += bs; // coalesce with previous string
    else s[++i] = bs;
  }

  // Special optimization for only a single match.
  // Otherwise, interpolate each of the numbers and rejoin the string.
  return s.length < 2 ? (q[0]
      ? one(q[0].x)
      : zero(b))
      : (b = q.length, function(t) {
          for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
          return s.join("");
        });
}

function value(a, b) {
  var t = typeof b, c;
  return b == null || t === "boolean" ? constant(b)
      : (t === "number" ? number
      : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string)
      : b instanceof d3Color.color ? rgb
      : b instanceof Date ? date
      : isNumberArray(b) ? numberArray
      : Array.isArray(b) ? genericArray
      : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
      : number)(a, b);
}

function discrete(range) {
  var n = range.length;
  return function(t) {
    return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
  };
}

function hue$1(a, b) {
  var i = hue(+a, +b);
  return function(t) {
    var x = i(t);
    return x - 360 * Math.floor(x / 360);
  };
}

function round(a, b) {
  return a = +a, b = +b, function(t) {
    return Math.round(a * (1 - t) + b * t);
  };
}

var degrees = 180 / Math.PI;

var identity = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};

function decompose(a, b, c, d, e, f) {
  var scaleX, scaleY, skewX;
  if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
  if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
  if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
  if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
  return {
    translateX: e,
    translateY: f,
    rotate: Math.atan2(b, a) * degrees,
    skewX: Math.atan(skewX) * degrees,
    scaleX: scaleX,
    scaleY: scaleY
  };
}

var cssNode,
    cssRoot,
    cssView,
    svgNode;

function parseCss(value) {
  if (value === "none") return identity;
  if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
  cssNode.style.transform = value;
  value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
  cssRoot.removeChild(cssNode);
  value = value.slice(7, -1).split(",");
  return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
}

function parseSvg(value) {
  if (value == null) return identity;
  if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
  svgNode.setAttribute("transform", value);
  if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
  value = value.matrix;
  return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}

function interpolateTransform(parse, pxComma, pxParen, degParen) {

  function pop(s) {
    return s.length ? s.pop() + " " : "";
  }

  function translate(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push("translate(", null, pxComma, null, pxParen);
      q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
    } else if (xb || yb) {
      s.push("translate(" + xb + pxComma + yb + pxParen);
    }
  }

  function rotate(a, b, s, q) {
    if (a !== b) {
      if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
      q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
    } else if (b) {
      s.push(pop(s) + "rotate(" + b + degParen);
    }
  }

  function skewX(a, b, s, q) {
    if (a !== b) {
      q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
    } else if (b) {
      s.push(pop(s) + "skewX(" + b + degParen);
    }
  }

  function scale(xa, ya, xb, yb, s, q) {
    if (xa !== xb || ya !== yb) {
      var i = s.push(pop(s) + "scale(", null, ",", null, ")");
      q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
    } else if (xb !== 1 || yb !== 1) {
      s.push(pop(s) + "scale(" + xb + "," + yb + ")");
    }
  }

  return function(a, b) {
    var s = [], // string constants and placeholders
        q = []; // number interpolators
    a = parse(a), b = parse(b);
    translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
    rotate(a.rotate, b.rotate, s, q);
    skewX(a.skewX, b.skewX, s, q);
    scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
    a = b = null; // gc
    return function(t) {
      var i = -1, n = q.length, o;
      while (++i < n) s[(o = q[i]).i] = o.x(t);
      return s.join("");
    };
  };
}

var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");

var rho = Math.SQRT2,
    rho2 = 2,
    rho4 = 4,
    epsilon2 = 1e-12;

function cosh(x) {
  return ((x = Math.exp(x)) + 1 / x) / 2;
}

function sinh(x) {
  return ((x = Math.exp(x)) - 1 / x) / 2;
}

function tanh(x) {
  return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}

// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function zoom(p0, p1) {
  var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
      ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
      dx = ux1 - ux0,
      dy = uy1 - uy0,
      d2 = dx * dx + dy * dy,
      i,
      S;

  // Special case for u0 ≅ u1.
  if (d2 < epsilon2) {
    S = Math.log(w1 / w0) / rho;
    i = function(t) {
      return [
        ux0 + t * dx,
        uy0 + t * dy,
        w0 * Math.exp(rho * t * S)
      ];
    };
  }

  // General case.
  else {
    var d1 = Math.sqrt(d2),
        b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
        b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
        r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
        r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
    S = (r1 - r0) / rho;
    i = function(t) {
      var s = t * S,
          coshr0 = cosh(r0),
          u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
      return [
        ux0 + u * dx,
        uy0 + u * dy,
        w0 * coshr0 / cosh(rho * s + r0)
      ];
    };
  }

  i.duration = S * 1000;

  return i;
}

function hsl(hue) {
  return function(start, end) {
    var h = hue((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
        s = nogamma(start.s, end.s),
        l = nogamma(start.l, end.l),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.h = h(t);
      start.s = s(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

var hsl$1 = hsl(hue);
var hslLong = hsl(nogamma);

function lab(start, end) {
  var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l),
      a = nogamma(start.a, end.a),
      b = nogamma(start.b, end.b),
      opacity = nogamma(start.opacity, end.opacity);
  return function(t) {
    start.l = l(t);
    start.a = a(t);
    start.b = b(t);
    start.opacity = opacity(t);
    return start + "";
  };
}

function hcl(hue) {
  return function(start, end) {
    var h = hue((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
        c = nogamma(start.c, end.c),
        l = nogamma(start.l, end.l),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.h = h(t);
      start.c = c(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

var hcl$1 = hcl(hue);
var hclLong = hcl(nogamma);

function cubehelix(hue) {
  return (function cubehelixGamma(y) {
    y = +y;

    function cubehelix(start, end) {
      var h = hue((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
          s = nogamma(start.s, end.s),
          l = nogamma(start.l, end.l),
          opacity = nogamma(start.opacity, end.opacity);
      return function(t) {
        start.h = h(t);
        start.s = s(t);
        start.l = l(Math.pow(t, y));
        start.opacity = opacity(t);
        return start + "";
      };
    }

    cubehelix.gamma = cubehelixGamma;

    return cubehelix;
  })(1);
}

var cubehelix$1 = cubehelix(hue);
var cubehelixLong = cubehelix(nogamma);

function piecewise(interpolate, values) {
  var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
  while (i < n) I[i] = interpolate(v, v = values[++i]);
  return function(t) {
    var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
    return I[i](t - i);
  };
}

function quantize(interpolator, n) {
  var samples = new Array(n);
  for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
  return samples;
}

exports.interpolate = value;
exports.interpolateArray = array;
exports.interpolateBasis = basis$1;
exports.interpolateBasisClosed = basisClosed;
exports.interpolateCubehelix = cubehelix$1;
exports.interpolateCubehelixLong = cubehelixLong;
exports.interpolateDate = date;
exports.interpolateDiscrete = discrete;
exports.interpolateHcl = hcl$1;
exports.interpolateHclLong = hclLong;
exports.interpolateHsl = hsl$1;
exports.interpolateHslLong = hslLong;
exports.interpolateHue = hue$1;
exports.interpolateLab = lab;
exports.interpolateNumber = number;
exports.interpolateNumberArray = numberArray;
exports.interpolateObject = object;
exports.interpolateRgb = rgb;
exports.interpolateRgbBasis = rgbBasis;
exports.interpolateRgbBasisClosed = rgbBasisClosed;
exports.interpolateRound = round;
exports.interpolateString = string;
exports.interpolateTransformCss = interpolateTransformCss;
exports.interpolateTransformSvg = interpolateTransformSvg;
exports.interpolateZoom = zoom;
exports.piecewise = piecewise;
exports.quantize = quantize;

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

}));

},{"d3-color":875}],878:[function(require,module,exports){
// https://github.com/HarryStevens/d3-regression#readme Version 1.3.5. Copyright 2020 Harry Stevens.
(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
  (global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';

  function _slicedToArray(arr, i) {
    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
  }

  function _arrayWithHoles(arr) {
    if (Array.isArray(arr)) return arr;
  }

  function _iterableToArrayLimit(arr, i) {
    var _arr = [];
    var _n = true;
    var _d = false;
    var _e = undefined;

    try {
      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);

        if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;
      _e = err;
    } finally {
      try {
        if (!_n && _i["return"] != null) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }

    return _arr;
  }

  function _nonIterableRest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance");
  }

  // Adapted from vega-statistics by Jeffrey Heer
  // License: https://github.com/vega/vega/blob/f058b099decad9db78301405dd0d2e9d8ba3d51a/LICENSE
  // Source: https://github.com/vega/vega/blob/f058b099decad9db78301405dd0d2e9d8ba3d51a/packages/vega-statistics/src/regression/points.js
  function points(data, x, y, sort) {
    data = data.filter(function (d) {
      var u = x(d),
          v = y(d);
      return u != null && isFinite(u) && v != null && isFinite(v);
    });

    if (sort) {
      data.sort(function (a, b) {
        return x(a) - x(b);
      });
    }

    var n = data.length,
        X = new Float64Array(n),
        Y = new Float64Array(n); // extract values, calculate means

    var ux = 0,
        uy = 0,
        xv,
        yv,
        d;

    for (var i = 0; i < n;) {
      d = data[i];
      X[i] = xv = +x(d);
      Y[i] = yv = +y(d);
      ++i;
      ux += (xv - ux) / i;
      uy += (yv - uy) / i;
    } // mean center the data


    for (var _i = 0; _i < n; ++_i) {
      X[_i] -= ux;
      Y[_i] -= uy;
    }

    return [X, Y, ux, uy];
  }
  function visitPoints(data, x, y, cb) {
    var iterations = 0;

    for (var i = 0, n = data.length; i < n; i++) {
      var d = data[i],
          dx = +x(d),
          dy = +y(d);

      if (dx != null && isFinite(dx) && dy != null && isFinite(dy)) {
        cb(dx, dy, iterations++);
      }
    }
  }

  // return the coefficient of determination, or R squared.

  function determination(data, x, y, uY, predict) {
    var SSE = 0,
        SST = 0;
    visitPoints(data, x, y, function (dx, dy) {
      var sse = dy - predict(dx),
          sst = dy - uY;
      SSE += sse * sse;
      SST += sst * sst;
    });
    return 1 - SSE / SST;
  }

  // Returns the angle of a line in degrees.
  function angle(line) {
    return Math.atan2(line[1][1] - line[0][1], line[1][0] - line[0][0]) * 180 / Math.PI;
  } // Returns the midpoint of a line.

  function midpoint(line) {
    return [(line[0][0] + line[1][0]) / 2, (line[0][1] + line[1][1]) / 2];
  }

  // returns a smooth line.

  function interpose(xmin, xmax, predict) {
    var l = Math.log(xmax - xmin) * Math.LOG10E + 1 | 0;
    var precision = 1 * Math.pow(10, -l / 2 - 1),
        maxIter = 1e4;
    var points = [px(xmin), px(xmax)],
        iter = 0;

    while (find(points) && iter < maxIter) {
    }

    return points;

    function px(x) {
      return [x, predict(x)];
    }

    function find(points) {
      iter++;
      var n = points.length;
      var found = false;

      for (var i = 0; i < n - 1; i++) {
        var p0 = points[i],
            p1 = points[i + 1],
            m = midpoint([p0, p1]),
            mp = px(m[0]),
            a0 = angle([p0, m]),
            a1 = angle([p0, mp]),
            a = Math.abs(a0 - a1);

        if (a > precision) {
          points.splice(i + 1, 0, mp);
          found = true;
        }
      }

      return found;
    }
  }

  // Ordinary Least Squares from vega-statistics by Jeffrey Heer
  // License: https://github.com/vega/vega/blob/f058b099decad9db78301405dd0d2e9d8ba3d51a/LICENSE
  // Source: https://github.com/vega/vega/blob/f058b099decad9db78301405dd0d2e9d8ba3d51a/packages/vega-statistics/src/regression/ols.js
  function ols(uX, uY, uXY, uX2) {
    var delta = uX2 - uX * uX,
        slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta,
        intercept = uY - slope * uX;
    return [intercept, slope];
  }

  function exponential () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        domain;

    function exponential(data) {
      var n = 0,
          Y = 0,
          YL = 0,
          XY = 0,
          XYL = 0,
          X2Y = 0,
          xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        var ly = Math.log(dy),
            xy = dx * dy;
        ++n;
        Y += (dy - Y) / n;
        XY += (xy - XY) / n;
        X2Y += (dx * xy - X2Y) / n;
        YL += (dy * ly - YL) / n;
        XYL += (xy * ly - XYL) / n;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });

      var _ols = ols(XY / Y, YL / Y, XYL / Y, X2Y / Y),
          _ols2 = _slicedToArray(_ols, 2),
          a = _ols2[0],
          b = _ols2[1];

      a = Math.exp(a);

      var fn = function fn(x) {
        return a * Math.exp(b * x);
      },
          out = interpose(xmin, xmax, fn);

      out.a = a;
      out.b = b;
      out.predict = fn;
      out.rSquared = determination(data, x, y, Y, fn);
      return out;
    }

    exponential.domain = function (arr) {
      return arguments.length ? (domain = arr, exponential) : domain;
    };

    exponential.x = function (fn) {
      return arguments.length ? (x = fn, exponential) : x;
    };

    exponential.y = function (fn) {
      return arguments.length ? (y = fn, exponential) : y;
    };

    return exponential;
  }

  function linear () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        domain;

    function linear(data) {
      var n = 0,
          X = 0,
          // sum of x
      Y = 0,
          // sum of y
      XY = 0,
          // sum of x * y
      X2 = 0,
          // sum of x * x
      xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        ++n;
        X += (dx - X) / n;
        Y += (dy - Y) / n;
        XY += (dx * dy - XY) / n;
        X2 += (dx * dx - X2) / n;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });

      var _ols = ols(X, Y, XY, X2),
          _ols2 = _slicedToArray(_ols, 2),
          intercept = _ols2[0],
          slope = _ols2[1],
          fn = function fn(x) {
        return slope * x + intercept;
      },
          out = [[xmin, fn(xmin)], [xmax, fn(xmax)]];

      out.a = slope;
      out.b = intercept;
      out.predict = fn;
      out.rSquared = determination(data, x, y, Y, fn);
      return out;
    }

    linear.domain = function (arr) {
      return arguments.length ? (domain = arr, linear) : domain;
    };

    linear.x = function (fn) {
      return arguments.length ? (x = fn, linear) : x;
    };

    linear.y = function (fn) {
      return arguments.length ? (y = fn, linear) : y;
    };

    return linear;
  }

  // Returns the medium value of an array of numbers.
  function median(arr) {
    arr.sort(function (a, b) {
      return a - b;
    });
    var i = arr.length / 2;
    return i % 1 === 0 ? (arr[i - 1] + arr[i]) / 2 : arr[Math.floor(i)];
  }

  var maxiters = 2,
      epsilon = 1e-12;
  function loess () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        bandwidth = .3;

    function loess(data) {
      var _points = points(data, x, y, true),
          _points2 = _slicedToArray(_points, 4),
          xv = _points2[0],
          yv = _points2[1],
          ux = _points2[2],
          uy = _points2[3],
          n = xv.length,
          bw = Math.max(2, ~~(bandwidth * n)),
          yhat = new Float64Array(n),
          residuals = new Float64Array(n),
          robustWeights = new Float64Array(n).fill(1);

      for (var iter = -1; ++iter <= maxiters;) {
        var interval = [0, bw - 1];

        for (var i = 0; i < n; ++i) {
          var dx = xv[i],
              i0 = interval[0],
              i1 = interval[1],
              edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1;
          var W = 0,
              X = 0,
              Y = 0,
              XY = 0,
              X2 = 0,
              denom = 1 / Math.abs(xv[edge] - dx || 1); // Avoid singularity

          for (var k = i0; k <= i1; ++k) {
            var xk = xv[k],
                yk = yv[k],
                w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k],
                xkw = xk * w;
            W += w;
            X += xkw;
            Y += yk * w;
            XY += yk * xkw;
            X2 += xk * xkw;
          } // Linear regression fit


          var _ols = ols(X / W, Y / W, XY / W, X2 / W),
              _ols2 = _slicedToArray(_ols, 2),
              a = _ols2[0],
              b = _ols2[1];

          yhat[i] = a + b * dx;
          residuals[i] = Math.abs(yv[i] - yhat[i]);
          updateInterval(xv, i + 1, interval);
        }

        if (iter === maxiters) {
          break;
        }

        var medianResidual = median(residuals);
        if (Math.abs(medianResidual) < epsilon) break;

        for (var _i = 0, arg, _w; _i < n; ++_i) {
          arg = residuals[_i] / (6 * medianResidual); // Default to epsilon (rather than zero) for large deviations
          // Keeping weights tiny but non-zero prevents singularites

          robustWeights[_i] = arg >= 1 ? epsilon : (_w = 1 - arg * arg) * _w;
        }
      }

      return output(xv, yhat, ux, uy);
    }

    loess.bandwidth = function (bw) {
      return arguments.length ? (bandwidth = bw, loess) : bandwidth;
    };

    loess.x = function (fn) {
      return arguments.length ? (x = fn, loess) : x;
    };

    loess.y = function (fn) {
      return arguments.length ? (y = fn, loess) : y;
    };

    return loess;
  } // Weighting kernel for local regression

  function tricube(x) {
    return (x = 1 - x * x * x) * x * x;
  } // Advance sliding window interval of nearest neighbors


  function updateInterval(xv, i, interval) {
    var val = xv[i],
        left = interval[0],
        right = interval[1] + 1;
    if (right >= xv.length) return; // Step right if distance to new right edge is <= distance to old left edge
    // Step when distance is equal to ensure movement over duplicate x values

    while (i > left && xv[right] - val <= val - xv[left]) {
      interval[0] = ++left;
      interval[1] = right;
      ++right;
    }
  } // Generate smoothed output points
  // Average points with repeated x values


  function output(xv, yhat, ux, uy) {
    var n = xv.length,
        out = [];
    var i = 0,
        cnt = 0,
        prev = [],
        v;

    for (; i < n; ++i) {
      v = xv[i] + ux;

      if (prev[0] === v) {
        // Average output values via online update
        prev[1] += (yhat[i] - prev[1]) / ++cnt;
      } else {
        // Add new output point
        cnt = 0;
        prev[1] += uy;
        prev = [v, yhat[i]];
        out.push(prev);
      }
    }

    prev[1] += uy;
    return out;
  }

  function logarithmic () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        domain;

    function logarithmic(data) {
      var n = 0,
          X = 0,
          Y = 0,
          XY = 0,
          X2 = 0,
          xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        var lx = Math.log(dx);
        ++n;
        X += (lx - X) / n;
        Y += (dy - Y) / n;
        XY += (lx * dy - XY) / n;
        X2 += (lx * lx - X2) / n;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });

      var _ols = ols(X, Y, XY, X2),
          _ols2 = _slicedToArray(_ols, 2),
          intercept = _ols2[0],
          slope = _ols2[1],
          fn = function fn(x) {
        return slope * Math.log(x) + intercept;
      },
          out = interpose(xmin, xmax, fn);

      out.a = slope;
      out.b = intercept;
      out.predict = fn;
      out.rSquared = determination(data, x, y, Y, fn);
      return out;
    }

    logarithmic.domain = function (arr) {
      return arguments.length ? (domain = arr, logarithmic) : domain;
    };

    logarithmic.x = function (fn) {
      return arguments.length ? (x = fn, logarithmic) : x;
    };

    logarithmic.y = function (fn) {
      return arguments.length ? (y = fn, logarithmic) : y;
    };

    return logarithmic;
  }

  function quad () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        domain;

    function quadratic(data) {
      var _points = points(data, x, y),
          _points2 = _slicedToArray(_points, 4),
          xv = _points2[0],
          yv = _points2[1],
          ux = _points2[2],
          uy = _points2[3],
          n = xv.length;

      var X2 = 0,
          X3 = 0,
          X4 = 0,
          XY = 0,
          X2Y = 0,
          i,
          dx,
          dy,
          x2;

      for (i = 0; i < n;) {
        dx = xv[i];
        dy = yv[i++];
        x2 = dx * dx;
        X2 += (x2 - X2) / i;
        X3 += (x2 * dx - X3) / i;
        X4 += (x2 * x2 - X4) / i;
        XY += (dx * dy - XY) / i;
        X2Y += (x2 * dy - X2Y) / i;
      }

      var Y = 0,
          n0 = 0,
          xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        n0++;
        Y += (dy - Y) / n0;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });

      var X2X2 = X4 - X2 * X2,
          d = X2 * X2X2 - X3 * X3,
          a = (X2Y * X2 - XY * X3) / d,
          b = (XY * X2X2 - X2Y * X3) / d,
          c = -a * X2,
          fn = function fn(x) {
        x = x - ux;
        return a * x * x + b * x + c + uy;
      };

      var out = interpose(xmin, xmax, fn);
      out.a = a;
      out.b = b - 2 * a * ux;
      out.c = c - b * ux + a * ux * ux + uy;
      out.predict = fn;
      out.rSquared = determination(data, x, y, Y, fn);
      return out;
    }

    quadratic.domain = function (arr) {
      return arguments.length ? (domain = arr, quadratic) : domain;
    };

    quadratic.x = function (fn) {
      return arguments.length ? (x = fn, quadratic) : x;
    };

    quadratic.y = function (fn) {
      return arguments.length ? (y = fn, quadratic) : y;
    };

    return quadratic;
  }

  // Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246
  // License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE
  // ...with ideas from vega-statistics by Jeffrey Heer
  // Source: https://github.com/vega/vega/blob/f21cb8792b4e0cbe2b1a3fd44b0f5db370dbaadb/packages/vega-statistics/src/regression/poly.js
  // License: https://github.com/vega/vega/blob/f058b099decad9db78301405dd0d2e9d8ba3d51a/LICENSE

  function polynomial () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        order = 3,
        domain;

    function polynomial(data) {
      // Use more efficient methods for lower orders
      if (order === 1) {
        var o = linear().x(x).y(y).domain(domain)(data);
        o.coefficients = [o.b, o.a];
        delete o.a;
        delete o.b;
        return o;
      }

      if (order === 2) {
        var _o = quad().x(x).y(y).domain(domain)(data);

        _o.coefficients = [_o.c, _o.b, _o.a];
        delete _o.a;
        delete _o.b;
        delete _o.c;
        return _o;
      }

      var _points = points(data, x, y),
          _points2 = _slicedToArray(_points, 4),
          xv = _points2[0],
          yv = _points2[1],
          ux = _points2[2],
          uy = _points2[3],
          n = xv.length,
          lhs = [],
          rhs = [],
          k = order + 1;

      var Y = 0,
          n0 = 0,
          xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        ++n0;
        Y += (dy - Y) / n0;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });
      var i, j, l, v, c;

      for (i = 0; i < k; ++i) {
        for (l = 0, v = 0; l < n; ++l) {
          v += Math.pow(xv[l], i) * yv[l];
        }

        lhs.push(v);
        c = new Float64Array(k);

        for (j = 0; j < k; ++j) {
          for (l = 0, v = 0; l < n; ++l) {
            v += Math.pow(xv[l], i + j);
          }

          c[j] = v;
        }

        rhs.push(c);
      }

      rhs.push(lhs);

      var coef = gaussianElimination(rhs),
          fn = function fn(x) {
        x -= ux;
        var y = uy + coef[0] + coef[1] * x + coef[2] * x * x;

        for (i = 3; i < k; ++i) {
          y += coef[i] * Math.pow(x, i);
        }

        return y;
      },
          out = interpose(xmin, xmax, fn);

      out.coefficients = uncenter(k, coef, -ux, uy);
      out.predict = fn;
      out.rSquared = determination(data, x, y, Y, fn);
      return out;
    }

    polynomial.domain = function (arr) {
      return arguments.length ? (domain = arr, polynomial) : domain;
    };

    polynomial.x = function (fn) {
      return arguments.length ? (x = fn, polynomial) : x;
    };

    polynomial.y = function (fn) {
      return arguments.length ? (y = fn, polynomial) : y;
    };

    polynomial.order = function (n) {
      return arguments.length ? (order = n, polynomial) : order;
    };

    return polynomial;
  }

  function uncenter(k, a, x, y) {
    var z = Array(k);
    var i, j, v, c; // initialize to zero

    for (i = 0; i < k; ++i) {
      z[i] = 0;
    } // polynomial expansion


    for (i = k - 1; i >= 0; --i) {
      v = a[i];
      c = 1;
      z[i] += v;

      for (j = 1; j <= i; ++j) {
        c *= (i + 1 - j) / j; // binomial coefficent

        z[i - j] += v * Math.pow(x, j) * c;
      }
    } // bias term


    z[0] += y;
    return z;
  } // Given an array for a two-dimensional matrix and the polynomial order,
  // solve A * x = b using Gaussian elimination.


  function gaussianElimination(matrix) {
    var n = matrix.length - 1,
        coef = [];
    var i, j, k, r, t;

    for (i = 0; i < n; ++i) {
      r = i; // max row

      for (j = i + 1; j < n; ++j) {
        if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {
          r = j;
        }
      }

      for (k = i; k < n + 1; ++k) {
        t = matrix[k][i];
        matrix[k][i] = matrix[k][r];
        matrix[k][r] = t;
      }

      for (j = i + 1; j < n; ++j) {
        for (k = n; k >= i; k--) {
          matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];
        }
      }
    }

    for (j = n - 1; j >= 0; --j) {
      t = 0;

      for (k = j + 1; k < n; ++k) {
        t += matrix[k][j] * coef[k];
      }

      coef[j] = (matrix[n][j] - t) / matrix[j][j];
    }

    return coef;
  }

  function power () {
    var x = function x(d) {
      return d[0];
    },
        y = function y(d) {
      return d[1];
    },
        domain;

    function power(data) {
      var n = 0,
          X = 0,
          Y = 0,
          XY = 0,
          X2 = 0,
          YS = 0,
          xmin = domain ? +domain[0] : Infinity,
          xmax = domain ? +domain[1] : -Infinity;
      visitPoints(data, x, y, function (dx, dy) {
        var lx = Math.log(dx),
            ly = Math.log(dy);
        ++n;
        X += (lx - X) / n;
        Y += (ly - Y) / n;
        XY += (lx * ly - XY) / n;
        X2 += (lx * lx - X2) / n;
        YS += (dy - YS) / n;

        if (!domain) {
          if (dx < xmin) xmin = dx;
          if (dx > xmax) xmax = dx;
        }
      });

      var _ols = ols(X, Y, XY, X2),
          _ols2 = _slicedToArray(_ols, 2),
          a = _ols2[0],
          b = _ols2[1];

      a = Math.exp(a);

      var fn = function fn(x) {
        return a * Math.pow(x, b);
      },
          out = interpose(xmin, xmax, fn);

      out.a = a;
      out.b = b;
      out.predict = fn;
      out.rSquared = determination(data, x, y, YS, fn);
      return out;
    }

    power.domain = function (arr) {
      return arguments.length ? (domain = arr, power) : domain;
    };

    power.x = function (fn) {
      return arguments.length ? (x = fn, power) : x;
    };

    power.y = function (fn) {
      return arguments.length ? (y = fn, power) : y;
    };

    return power;
  }

  exports.regressionExp = exponential;
  exports.regressionLinear = linear;
  exports.regressionLoess = loess;
  exports.regressionLog = logarithmic;
  exports.regressionPoly = polynomial;
  exports.regressionPow = power;
  exports.regressionQuad = quad;

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

}));

},{}],879:[function(require,module,exports){
// https://d3js.org/d3-timer/ v1.0.10 Copyright 2019 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';

var frame = 0, // is an animation frame pending?
    timeout = 0, // is a timeout pending?
    interval = 0, // are any timers active?
    pokeDelay = 1000, // how frequently we check for clock skew
    taskHead,
    taskTail,
    clockLast = 0,
    clockNow = 0,
    clockSkew = 0,
    clock = typeof performance === "object" && performance.now ? performance : Date,
    setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };

function now() {
  return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}

function clearNow() {
  clockNow = 0;
}

function Timer() {
  this._call =
  this._time =
  this._next = null;
}

Timer.prototype = timer.prototype = {
  constructor: Timer,
  restart: function(callback, delay, time) {
    if (typeof callback !== "function") throw new TypeError("callback is not a function");
    time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
    if (!this._next && taskTail !== this) {
      if (taskTail) taskTail._next = this;
      else taskHead = this;
      taskTail = this;
    }
    this._call = callback;
    this._time = time;
    sleep();
  },
  stop: function() {
    if (this._call) {
      this._call = null;
      this._time = Infinity;
      sleep();
    }
  }
};

function timer(callback, delay, time) {
  var t = new Timer;
  t.restart(callback, delay, time);
  return t;
}

function timerFlush() {
  now(); // Get the current time, if not already set.
  ++frame; // Pretend we’ve set an alarm, if we haven’t already.
  var t = taskHead, e;
  while (t) {
    if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
    t = t._next;
  }
  --frame;
}

function wake() {
  clockNow = (clockLast = clock.now()) + clockSkew;
  frame = timeout = 0;
  try {
    timerFlush();
  } finally {
    frame = 0;
    nap();
    clockNow = 0;
  }
}

function poke() {
  var now = clock.now(), delay = now - clockLast;
  if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
}

function nap() {
  var t0, t1 = taskHead, t2, time = Infinity;
  while (t1) {
    if (t1._call) {
      if (time > t1._time) time = t1._time;
      t0 = t1, t1 = t1._next;
    } else {
      t2 = t1._next, t1._next = null;
      t1 = t0 ? t0._next = t2 : taskHead = t2;
    }
  }
  taskTail = t0;
  sleep(time);
}

function sleep(time) {
  if (frame) return; // Soonest alarm already set, or will be.
  if (timeout) timeout = clearTimeout(timeout);
  var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
  if (delay > 24) {
    if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
    if (interval) interval = clearInterval(interval);
  } else {
    if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
    frame = 1, setFrame(wake);
  }
}

function timeout$1(callback, delay, time) {
  var t = new Timer;
  delay = delay == null ? 0 : +delay;
  t.restart(function(elapsed) {
    t.stop();
    callback(elapsed + delay);
  }, delay, time);
  return t;
}

function interval$1(callback, delay, time) {
  var t = new Timer, total = delay;
  if (delay == null) return t.restart(callback, delay, time), t;
  delay = +delay, time = time == null ? now() : +time;
  t.restart(function tick(elapsed) {
    elapsed += total;
    t.restart(tick, total += delay, time);
    callback(elapsed);
  }, delay, time);
  return t;
}

exports.interval = interval$1;
exports.now = now;
exports.timeout = timeout$1;
exports.timer = timer;
exports.timerFlush = timerFlush;

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

}));

},{}],880:[function(require,module,exports){
(function (process){
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var BrowserInfo = /** @class */ (function () {
    function BrowserInfo(name, version, os) {
        this.name = name;
        this.version = version;
        this.os = os;
        this.type = 'browser';
    }
    return BrowserInfo;
}());
exports.BrowserInfo = BrowserInfo;
var NodeInfo = /** @class */ (function () {
    function NodeInfo(version) {
        this.version = version;
        this.type = 'node';
        this.name = 'node';
        this.os = process.platform;
    }
    return NodeInfo;
}());
exports.NodeInfo = NodeInfo;
var SearchBotDeviceInfo = /** @class */ (function () {
    function SearchBotDeviceInfo(name, version, os, bot) {
        this.name = name;
        this.version = version;
        this.os = os;
        this.bot = bot;
        this.type = 'bot-device';
    }
    return SearchBotDeviceInfo;
}());
exports.SearchBotDeviceInfo = SearchBotDeviceInfo;
var BotInfo = /** @class */ (function () {
    function BotInfo() {
        this.type = 'bot';
        this.bot = true; // NOTE: deprecated test name instead
        this.name = 'bot';
        this.version = null;
        this.os = null;
    }
    return BotInfo;
}());
exports.BotInfo = BotInfo;
var ReactNativeInfo = /** @class */ (function () {
    function ReactNativeInfo() {
        this.type = 'react-native';
        this.name = 'react-native';
        this.version = null;
        this.os = null;
    }
    return ReactNativeInfo;
}());
exports.ReactNativeInfo = ReactNativeInfo;
// tslint:disable-next-line:max-line-length
var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;
var SEARCHBOT_OS_REGEX = /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/;
var REQUIRED_VERSION_PARTS = 3;
var userAgentRules = [
    ['aol', /AOLShield\/([0-9\._]+)/],
    ['edge', /Edge\/([0-9\._]+)/],
    ['edge-ios', /EdgiOS\/([0-9\._]+)/],
    ['yandexbrowser', /YaBrowser\/([0-9\._]+)/],
    ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/],
    ['samsung', /SamsungBrowser\/([0-9\.]+)/],
    ['silk', /\bSilk\/([0-9._-]+)\b/],
    ['miui', /MiuiBrowser\/([0-9\.]+)$/],
    ['beaker', /BeakerBrowser\/([0-9\.]+)/],
    ['edge-chromium', /Edg\/([0-9\.]+)/],
    [
        'chromium-webview',
        /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/,
    ],
    ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
    ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/],
    ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/],
    ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/],
    ['fxios', /FxiOS\/([0-9\.]+)/],
    ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/],
    ['opera', /Opera\/([0-9\.]+)(?:\s|$)/],
    ['opera', /OPR\/([0-9\.]+)(:?\s|$)/],
    ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
    ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
    ['ie', /MSIE\s(7\.0)/],
    ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/],
    ['android', /Android\s([0-9\.]+)/],
    ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/],
    ['safari', /Version\/([0-9\._]+).*Safari/],
    ['facebook', /FBAV\/([0-9\.]+)/],
    ['instagram', /Instagram\s([0-9\.]+)/],
    ['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/],
    ['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
    ['searchbot', SEARCHBOX_UA_REGEX],
];
var operatingSystemRules = [
    ['iOS', /iP(hone|od|ad)/],
    ['Android OS', /Android/],
    ['BlackBerry OS', /BlackBerry|BB10/],
    ['Windows Mobile', /IEMobile/],
    ['Amazon OS', /Kindle/],
    ['Windows 3.11', /Win16/],
    ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],
    ['Windows 98', /(Windows 98)|(Win98)/],
    ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],
    ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],
    ['Windows Server 2003', /(Windows NT 5.2)/],
    ['Windows Vista', /(Windows NT 6.0)/],
    ['Windows 7', /(Windows NT 6.1)/],
    ['Windows 8', /(Windows NT 6.2)/],
    ['Windows 8.1', /(Windows NT 6.3)/],
    ['Windows 10', /(Windows NT 10.0)/],
    ['Windows ME', /Windows ME/],
    ['Open BSD', /OpenBSD/],
    ['Sun OS', /SunOS/],
    ['Chrome OS', /CrOS/],
    ['Linux', /(Linux)|(X11)/],
    ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],
    ['QNX', /QNX/],
    ['BeOS', /BeOS/],
    ['OS/2', /OS\/2/],
];
function detect(userAgent) {
    if (!!userAgent) {
        return parseUserAgent(userAgent);
    }
    if (typeof document === 'undefined' &&
        typeof navigator !== 'undefined' &&
        navigator.product === 'ReactNative') {
        return new ReactNativeInfo();
    }
    if (typeof navigator !== 'undefined') {
        return parseUserAgent(navigator.userAgent);
    }
    return getNodeVersion();
}
exports.detect = detect;
function matchUserAgent(ua) {
    // opted for using reduce here rather than Array#first with a regex.test call
    // this is primarily because using the reduce we only perform the regex
    // execution once rather than once for the test and for the exec again below
    // probably something that needs to be benchmarked though
    return (ua !== '' &&
        userAgentRules.reduce(function (matched, _a) {
            var browser = _a[0], regex = _a[1];
            if (matched) {
                return matched;
            }
            var uaMatch = regex.exec(ua);
            return !!uaMatch && [browser, uaMatch];
        }, false));
}
function browserName(ua) {
    var data = matchUserAgent(ua);
    return data ? data[0] : null;
}
exports.browserName = browserName;
function parseUserAgent(ua) {
    var matchedRule = matchUserAgent(ua);
    if (!matchedRule) {
        return null;
    }
    var name = matchedRule[0], match = matchedRule[1];
    if (name === 'searchbot') {
        return new BotInfo();
    }
    var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);
    if (versionParts) {
        if (versionParts.length < REQUIRED_VERSION_PARTS) {
            versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length));
        }
    }
    else {
        versionParts = [];
    }
    var version = versionParts.join('.');
    var os = detectOS(ua);
    var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);
    if (searchBotMatch && searchBotMatch[1]) {
        return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);
    }
    return new BrowserInfo(name, version, os);
}
exports.parseUserAgent = parseUserAgent;
function detectOS(ua) {
    for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {
        var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];
        var match = regex.exec(ua);
        if (match) {
            return os;
        }
    }
    return null;
}
exports.detectOS = detectOS;
function getNodeVersion() {
    var isNode = typeof process !== 'undefined' && process.version;
    return isNode ? new NodeInfo(process.version.slice(1)) : null;
}
exports.getNodeVersion = getNodeVersion;
function createVersionParts(count) {
    var output = [];
    for (var ii = 0; ii < count; ii++) {
        output.push('0');
    }
    return output;
}

}).call(this,require('_process'))

},{"_process":1}],881:[function(require,module,exports){
(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
  (factory((global.fecha = {})));
}(this, (function (exports) { 'use strict';

  var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
  var twoDigitsOptional = "[1-9]\\d?";
  var twoDigits = "\\d\\d";
  var threeDigits = "\\d{3}";
  var fourDigits = "\\d{4}";
  var word = "[^\\s]+";
  var literal = /\[([^]*?)\]/gm;
  function shorten(arr, sLen) {
      var newArr = [];
      for (var i = 0, len = arr.length; i < len; i++) {
          newArr.push(arr[i].substr(0, sLen));
      }
      return newArr;
  }
  var monthUpdate = function (arrName) { return function (v, i18n) {
      var lowerCaseArr = i18n[arrName].map(function (v) { return v.toLowerCase(); });
      var index = lowerCaseArr.indexOf(v.toLowerCase());
      if (index > -1) {
          return index;
      }
      return null;
  }; };
  function assign(origObj) {
      var args = [];
      for (var _i = 1; _i < arguments.length; _i++) {
          args[_i - 1] = arguments[_i];
      }
      for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
          var obj = args_1[_a];
          for (var key in obj) {
              // @ts-ignore ex
              origObj[key] = obj[key];
          }
      }
      return origObj;
  }
  var dayNames = [
      "Sunday",
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday",
      "Saturday"
  ];
  var monthNames = [
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
  ];
  var monthNamesShort = shorten(monthNames, 3);
  var dayNamesShort = shorten(dayNames, 3);
  var defaultI18n = {
      dayNamesShort: dayNamesShort,
      dayNames: dayNames,
      monthNamesShort: monthNamesShort,
      monthNames: monthNames,
      amPm: ["am", "pm"],
      DoFn: function (dayOfMonth) {
          return (dayOfMonth +
              ["th", "st", "nd", "rd"][dayOfMonth % 10 > 3
                  ? 0
                  : ((dayOfMonth - (dayOfMonth % 10) !== 10 ? 1 : 0) * dayOfMonth) % 10]);
      }
  };
  var globalI18n = assign({}, defaultI18n);
  var setGlobalDateI18n = function (i18n) {
      return (globalI18n = assign(globalI18n, i18n));
  };
  var regexEscape = function (str) {
      return str.replace(/[|\\{()[^$+*?.-]/g, "\\$&");
  };
  var pad = function (val, len) {
      if (len === void 0) { len = 2; }
      val = String(val);
      while (val.length < len) {
          val = "0" + val;
      }
      return val;
  };
  var formatFlags = {
      D: function (dateObj) { return String(dateObj.getDate()); },
      DD: function (dateObj) { return pad(dateObj.getDate()); },
      Do: function (dateObj, i18n) {
          return i18n.DoFn(dateObj.getDate());
      },
      d: function (dateObj) { return String(dateObj.getDay()); },
      dd: function (dateObj) { return pad(dateObj.getDay()); },
      ddd: function (dateObj, i18n) {
          return i18n.dayNamesShort[dateObj.getDay()];
      },
      dddd: function (dateObj, i18n) {
          return i18n.dayNames[dateObj.getDay()];
      },
      M: function (dateObj) { return String(dateObj.getMonth() + 1); },
      MM: function (dateObj) { return pad(dateObj.getMonth() + 1); },
      MMM: function (dateObj, i18n) {
          return i18n.monthNamesShort[dateObj.getMonth()];
      },
      MMMM: function (dateObj, i18n) {
          return i18n.monthNames[dateObj.getMonth()];
      },
      YY: function (dateObj) {
          return pad(String(dateObj.getFullYear()), 4).substr(2);
      },
      YYYY: function (dateObj) { return pad(dateObj.getFullYear(), 4); },
      h: function (dateObj) { return String(dateObj.getHours() % 12 || 12); },
      hh: function (dateObj) { return pad(dateObj.getHours() % 12 || 12); },
      H: function (dateObj) { return String(dateObj.getHours()); },
      HH: function (dateObj) { return pad(dateObj.getHours()); },
      m: function (dateObj) { return String(dateObj.getMinutes()); },
      mm: function (dateObj) { return pad(dateObj.getMinutes()); },
      s: function (dateObj) { return String(dateObj.getSeconds()); },
      ss: function (dateObj) { return pad(dateObj.getSeconds()); },
      S: function (dateObj) {
          return String(Math.round(dateObj.getMilliseconds() / 100));
      },
      SS: function (dateObj) {
          return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
      },
      SSS: function (dateObj) { return pad(dateObj.getMilliseconds(), 3); },
      a: function (dateObj, i18n) {
          return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
      },
      A: function (dateObj, i18n) {
          return dateObj.getHours() < 12
              ? i18n.amPm[0].toUpperCase()
              : i18n.amPm[1].toUpperCase();
      },
      ZZ: function (dateObj) {
          var offset = dateObj.getTimezoneOffset();
          return ((offset > 0 ? "-" : "+") +
              pad(Math.floor(Math.abs(offset) / 60) * 100 + (Math.abs(offset) % 60), 4));
      },
      Z: function (dateObj) {
          var offset = dateObj.getTimezoneOffset();
          return ((offset > 0 ? "-" : "+") +
              pad(Math.floor(Math.abs(offset) / 60), 2) +
              ":" +
              pad(Math.abs(offset) % 60, 2));
      }
  };
  var monthParse = function (v) { return +v - 1; };
  var emptyDigits = [null, twoDigitsOptional];
  var emptyWord = [null, word];
  var amPm = [
      "isPm",
      word,
      function (v, i18n) {
          var val = v.toLowerCase();
          if (val === i18n.amPm[0]) {
              return 0;
          }
          else if (val === i18n.amPm[1]) {
              return 1;
          }
          return null;
      }
  ];
  var timezoneOffset = [
      "timezoneOffset",
      "[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",
      function (v) {
          var parts = (v + "").match(/([+-]|\d\d)/gi);
          if (parts) {
              var minutes = +parts[1] * 60 + parseInt(parts[2], 10);
              return parts[0] === "+" ? minutes : -minutes;
          }
          return 0;
      }
  ];
  var parseFlags = {
      D: ["day", twoDigitsOptional],
      DD: ["day", twoDigits],
      Do: ["day", twoDigitsOptional + word, function (v) { return parseInt(v, 10); }],
      M: ["month", twoDigitsOptional, monthParse],
      MM: ["month", twoDigits, monthParse],
      YY: [
          "year",
          twoDigits,
          function (v) {
              var now = new Date();
              var cent = +("" + now.getFullYear()).substr(0, 2);
              return +("" + (+v > 68 ? cent - 1 : cent) + v);
          }
      ],
      h: ["hour", twoDigitsOptional, undefined, "isPm"],
      hh: ["hour", twoDigits, undefined, "isPm"],
      H: ["hour", twoDigitsOptional],
      HH: ["hour", twoDigits],
      m: ["minute", twoDigitsOptional],
      mm: ["minute", twoDigits],
      s: ["second", twoDigitsOptional],
      ss: ["second", twoDigits],
      YYYY: ["year", fourDigits],
      S: ["millisecond", "\\d", function (v) { return +v * 100; }],
      SS: ["millisecond", twoDigits, function (v) { return +v * 10; }],
      SSS: ["millisecond", threeDigits],
      d: emptyDigits,
      dd: emptyDigits,
      ddd: emptyWord,
      dddd: emptyWord,
      MMM: ["month", word, monthUpdate("monthNamesShort")],
      MMMM: ["month", word, monthUpdate("monthNames")],
      a: amPm,
      A: amPm,
      ZZ: timezoneOffset,
      Z: timezoneOffset
  };
  // Some common format strings
  var globalMasks = {
      default: "ddd MMM DD YYYY HH:mm:ss",
      shortDate: "M/D/YY",
      mediumDate: "MMM D, YYYY",
      longDate: "MMMM D, YYYY",
      fullDate: "dddd, MMMM D, YYYY",
      isoDate: "YYYY-MM-DD",
      isoDateTime: "YYYY-MM-DDTHH:mm:ssZ",
      shortTime: "HH:mm",
      mediumTime: "HH:mm:ss",
      longTime: "HH:mm:ss.SSS"
  };
  var setGlobalDateMasks = function (masks) { return assign(globalMasks, masks); };
  /***
   * Format a date
   * @method format
   * @param {Date|number} dateObj
   * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
   * @returns {string} Formatted date string
   */
  var format = function (dateObj, mask, i18n) {
      if (mask === void 0) { mask = globalMasks["default"]; }
      if (i18n === void 0) { i18n = {}; }
      if (typeof dateObj === "number") {
          dateObj = new Date(dateObj);
      }
      if (Object.prototype.toString.call(dateObj) !== "[object Date]" ||
          isNaN(dateObj.getTime())) {
          throw new Error("Invalid Date pass to format");
      }
      mask = globalMasks[mask] || mask;
      var literals = [];
      // Make literals inactive by replacing them with @@@
      mask = mask.replace(literal, function ($0, $1) {
          literals.push($1);
          return "@@@";
      });
      var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
      // Apply formatting rules
      mask = mask.replace(token, function ($0) {
          return formatFlags[$0](dateObj, combinedI18nSettings);
      });
      // Inline literal values back into the formatted value
      return mask.replace(/@@@/g, function () { return literals.shift(); });
  };
  /**
   * Parse a date string into a Javascript Date object /
   * @method parse
   * @param {string} dateStr Date string
   * @param {string} format Date parse format
   * @param {i18n} I18nSettingsOptional Full or subset of I18N settings
   * @returns {Date|null} Returns Date object. Returns null what date string is invalid or doesn't match format
   */
  function parse(dateStr, format, i18n) {
      if (i18n === void 0) { i18n = {}; }
      if (typeof format !== "string") {
          throw new Error("Invalid format in fecha parse");
      }
      // Check to see if the format is actually a mask
      format = globalMasks[format] || format;
      // Avoid regular expression denial of service, fail early for really long strings
      // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
      if (dateStr.length > 1000) {
          return null;
      }
      // Default to the beginning of the year.
      var today = new Date();
      var dateInfo = {
          year: today.getFullYear(),
          month: 0,
          day: 1,
          hour: 0,
          minute: 0,
          second: 0,
          millisecond: 0,
          isPm: null,
          timezoneOffset: null
      };
      var parseInfo = [];
      var literals = [];
      // Replace all the literals with @@@. Hopefully a string that won't exist in the format
      var newFormat = format.replace(literal, function ($0, $1) {
          literals.push(regexEscape($1));
          return "@@@";
      });
      var specifiedFields = {};
      var requiredFields = {};
      // Change every token that we find into the correct regex
      newFormat = regexEscape(newFormat).replace(token, function ($0) {
          var info = parseFlags[$0];
          var field = info[0], regex = info[1], requiredField = info[3];
          // Check if the person has specified the same field twice. This will lead to confusing results.
          if (specifiedFields[field]) {
              throw new Error("Invalid format. " + field + " specified twice in format");
          }
          specifiedFields[field] = true;
          // Check if there are any required fields. For instance, 12 hour time requires AM/PM specified
          if (requiredField) {
              requiredFields[requiredField] = true;
          }
          parseInfo.push(info);
          return "(" + regex + ")";
      });
      // Check all the required fields are present
      Object.keys(requiredFields).forEach(function (field) {
          if (!specifiedFields[field]) {
              throw new Error("Invalid format. " + field + " is required in specified format");
          }
      });
      // Add back all the literals after
      newFormat = newFormat.replace(/@@@/g, function () { return literals.shift(); });
      // Check if the date string matches the format. If it doesn't return null
      var matches = dateStr.match(new RegExp(newFormat, "i"));
      if (!matches) {
          return null;
      }
      var combinedI18nSettings = assign(assign({}, globalI18n), i18n);
      // For each match, call the parser function for that date part
      for (var i = 1; i < matches.length; i++) {
          var _a = parseInfo[i - 1], field = _a[0], parser = _a[2];
          var value = parser
              ? parser(matches[i], combinedI18nSettings)
              : +matches[i];
          // If the parser can't make sense of the value, return null
          if (value == null) {
              return null;
          }
          dateInfo[field] = value;
      }
      if (dateInfo.isPm === 1 && dateInfo.hour != null && +dateInfo.hour !== 12) {
          dateInfo.hour = +dateInfo.hour + 12;
      }
      else if (dateInfo.isPm === 0 && +dateInfo.hour === 12) {
          dateInfo.hour = 0;
      }
      var dateWithoutTZ = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond);
      var validateFields = [
          ["month", "getMonth"],
          ["day", "getDate"],
          ["hour", "getHours"],
          ["minute", "getMinutes"],
          ["second", "getSeconds"]
      ];
      for (var i = 0, len = validateFields.length; i < len; i++) {
          // Check to make sure the date field is within the allowed range. Javascript dates allows values
          // outside the allowed range. If the values don't match the value was invalid
          if (specifiedFields[validateFields[i][0]] &&
              dateInfo[validateFields[i][0]] !== dateWithoutTZ[validateFields[i][1]]()) {
              return null;
          }
      }
      if (dateInfo.timezoneOffset == null) {
          return dateWithoutTZ;
      }
      return new Date(Date.UTC(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute - dateInfo.timezoneOffset, dateInfo.second, dateInfo.millisecond));
  }
  var fecha = {
      format: format,
      parse: parse,
      defaultI18n: defaultI18n,
      setGlobalDateI18n: setGlobalDateI18n,
      setGlobalDateMasks: setGlobalDateMasks
  };

  exports.assign = assign;
  exports.default = fecha;
  exports.format = format;
  exports.parse = parse;
  exports.defaultI18n = defaultI18n;
  exports.setGlobalDateI18n = setGlobalDateI18n;
  exports.setGlobalDateMasks = setGlobalDateMasks;

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

})));


},{}],882:[function(require,module,exports){
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setMatrixArrayType = setMatrixArrayType;
exports.toRadian = toRadian;
exports.equals = equals;
exports.RANDOM = exports.ARRAY_TYPE = exports.EPSILON = void 0;

/**
 * Common utilities
 * @module glMatrix
 */
// Configuration Constants
var EPSILON = 0.000001;
exports.EPSILON = EPSILON;
var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
exports.ARRAY_TYPE = ARRAY_TYPE;
var RANDOM = Math.random;
/**
 * Sets the type of array used when creating new vectors and matrices
 *
 * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array
 */

exports.RANDOM = RANDOM;

function setMatrixArrayType(type) {
  exports.ARRAY_TYPE = ARRAY_TYPE = type;
}

var degree = Math.PI / 180;
/**
 * Convert Degree To Radian
 *
 * @param {Number} a Angle in Degrees
 */

function toRadian(a) {
  return a * degree;
}
/**
 * Tests whether or not the arguments have approximately the same value, within an absolute
 * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
 * than or equal to 1.0, and a relative tolerance is used for larger values)
 *
 * @param {Number} a The first number to test.
 * @param {Number} b The second number to test.
 * @returns {Boolean} True if the numbers are approximately equal, false otherwise.
 */


function equals(a, b) {
  return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
}

if (!Math.hypot) Math.hypot = function () {
  var y = 0,
      i = arguments.length;

  while (i--) {
    y += arguments[i] * arguments[i];
  }

  return Math.sqrt(y);
};
},{}],883:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.vec4 = exports.vec3 = exports.vec2 = exports.quat2 = exports.quat = exports.mat4 = exports.mat3 = exports.mat2d = exports.mat2 = exports.glMatrix = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

exports.glMatrix = glMatrix;

var mat2 = _interopRequireWildcard(require("./mat2.js"));

exports.mat2 = mat2;

var mat2d = _interopRequireWildcard(require("./mat2d.js"));

exports.mat2d = mat2d;

var mat3 = _interopRequireWildcard(require("./mat3.js"));

exports.mat3 = mat3;

var mat4 = _interopRequireWildcard(require("./mat4.js"));

exports.mat4 = mat4;

var quat = _interopRequireWildcard(require("./quat.js"));

exports.quat = quat;

var quat2 = _interopRequireWildcard(require("./quat2.js"));

exports.quat2 = quat2;

var vec2 = _interopRequireWildcard(require("./vec2.js"));

exports.vec2 = vec2;

var vec3 = _interopRequireWildcard(require("./vec3.js"));

exports.vec3 = vec3;

var vec4 = _interopRequireWildcard(require("./vec4.js"));

exports.vec4 = vec4;

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
},{"./common.js":882,"./mat2.js":884,"./mat2d.js":885,"./mat3.js":886,"./mat4.js":887,"./quat.js":888,"./quat2.js":889,"./vec2.js":890,"./vec3.js":891,"./vec4.js":892}],884:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.copy = copy;
exports.identity = identity;
exports.fromValues = fromValues;
exports.set = set;
exports.transpose = transpose;
exports.invert = invert;
exports.adjoint = adjoint;
exports.determinant = determinant;
exports.multiply = multiply;
exports.rotate = rotate;
exports.scale = scale;
exports.fromRotation = fromRotation;
exports.fromScaling = fromScaling;
exports.str = str;
exports.frob = frob;
exports.LDU = LDU;
exports.add = add;
exports.subtract = subtract;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 2x2 Matrix
 * @module mat2
 */

/**
 * Creates a new identity mat2
 *
 * @returns {mat2} a new 2x2 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(4);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
  }

  out[0] = 1;
  out[3] = 1;
  return out;
}
/**
 * Creates a new mat2 initialized with values from an existing matrix
 *
 * @param {ReadonlyMat2} a matrix to clone
 * @returns {mat2} a new 2x2 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Copy the values from one mat2 to another
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the source matrix
 * @returns {mat2} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Set a mat2 to the identity matrix
 *
 * @param {mat2} out the receiving matrix
 * @returns {mat2} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  return out;
}
/**
 * Create a new mat2 with the given values
 *
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m10 Component in column 1, row 0 position (index 2)
 * @param {Number} m11 Component in column 1, row 1 position (index 3)
 * @returns {mat2} out A new 2x2 matrix
 */


function fromValues(m00, m01, m10, m11) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = m00;
  out[1] = m01;
  out[2] = m10;
  out[3] = m11;
  return out;
}
/**
 * Set the components of a mat2 to the given values
 *
 * @param {mat2} out the receiving matrix
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m10 Component in column 1, row 0 position (index 2)
 * @param {Number} m11 Component in column 1, row 1 position (index 3)
 * @returns {mat2} out
 */


function set(out, m00, m01, m10, m11) {
  out[0] = m00;
  out[1] = m01;
  out[2] = m10;
  out[3] = m11;
  return out;
}
/**
 * Transpose the values of a mat2
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the source matrix
 * @returns {mat2} out
 */


function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache
  // some values
  if (out === a) {
    var a1 = a[1];
    out[1] = a[2];
    out[2] = a1;
  } else {
    out[0] = a[0];
    out[1] = a[2];
    out[2] = a[1];
    out[3] = a[3];
  }

  return out;
}
/**
 * Inverts a mat2
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the source matrix
 * @returns {mat2} out
 */


function invert(out, a) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3]; // Calculate the determinant

  var det = a0 * a3 - a2 * a1;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = a3 * det;
  out[1] = -a1 * det;
  out[2] = -a2 * det;
  out[3] = a0 * det;
  return out;
}
/**
 * Calculates the adjugate of a mat2
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the source matrix
 * @returns {mat2} out
 */


function adjoint(out, a) {
  // Caching this value is nessecary if out == a
  var a0 = a[0];
  out[0] = a[3];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = a0;
  return out;
}
/**
 * Calculates the determinant of a mat2
 *
 * @param {ReadonlyMat2} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  return a[0] * a[3] - a[2] * a[1];
}
/**
 * Multiplies two mat2's
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the first operand
 * @param {ReadonlyMat2} b the second operand
 * @returns {mat2} out
 */


function multiply(out, a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  out[0] = a0 * b0 + a2 * b1;
  out[1] = a1 * b0 + a3 * b1;
  out[2] = a0 * b2 + a2 * b3;
  out[3] = a1 * b2 + a3 * b3;
  return out;
}
/**
 * Rotates a mat2 by the given angle
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat2} out
 */


function rotate(out, a, rad) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  out[0] = a0 * c + a2 * s;
  out[1] = a1 * c + a3 * s;
  out[2] = a0 * -s + a2 * c;
  out[3] = a1 * -s + a3 * c;
  return out;
}
/**
 * Scales the mat2 by the dimensions in the given vec2
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the matrix to rotate
 * @param {ReadonlyVec2} v the vec2 to scale the matrix by
 * @returns {mat2} out
 **/


function scale(out, a, v) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var v0 = v[0],
      v1 = v[1];
  out[0] = a0 * v0;
  out[1] = a1 * v0;
  out[2] = a2 * v1;
  out[3] = a3 * v1;
  return out;
}
/**
 * Creates a matrix from a given angle
 * This is equivalent to (but much faster than):
 *
 *     mat2.identity(dest);
 *     mat2.rotate(dest, dest, rad);
 *
 * @param {mat2} out mat2 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat2} out
 */


function fromRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  out[0] = c;
  out[1] = s;
  out[2] = -s;
  out[3] = c;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat2.identity(dest);
 *     mat2.scale(dest, dest, vec);
 *
 * @param {mat2} out mat2 receiving operation result
 * @param {ReadonlyVec2} v Scaling vector
 * @returns {mat2} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = v[1];
  return out;
}
/**
 * Returns a string representation of a mat2
 *
 * @param {ReadonlyMat2} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */


function str(a) {
  return "mat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")";
}
/**
 * Returns Frobenius norm of a mat2
 *
 * @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[2], a[3]);
}
/**
 * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
 * @param {ReadonlyMat2} L the lower triangular matrix
 * @param {ReadonlyMat2} D the diagonal matrix
 * @param {ReadonlyMat2} U the upper triangular matrix
 * @param {ReadonlyMat2} a the input matrix to factorize
 */


function LDU(L, D, U, a) {
  L[2] = a[2] / a[0];
  U[0] = a[0];
  U[1] = a[1];
  U[3] = a[3] - L[2] * U[1];
  return [L, D, U];
}
/**
 * Adds two mat2's
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the first operand
 * @param {ReadonlyMat2} b the second operand
 * @returns {mat2} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the first operand
 * @param {ReadonlyMat2} b the second operand
 * @returns {mat2} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyMat2} a The first matrix.
 * @param {ReadonlyMat2} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {ReadonlyMat2} a The first matrix.
 * @param {ReadonlyMat2} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat2} out the receiving matrix
 * @param {ReadonlyMat2} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat2} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  return out;
}
/**
 * Adds two mat2's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat2} out the receiving vector
 * @param {ReadonlyMat2} a the first operand
 * @param {ReadonlyMat2} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat2} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  return out;
}
/**
 * Alias for {@link mat2.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat2.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":882}],885:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.copy = copy;
exports.identity = identity;
exports.fromValues = fromValues;
exports.set = set;
exports.invert = invert;
exports.determinant = determinant;
exports.multiply = multiply;
exports.rotate = rotate;
exports.scale = scale;
exports.translate = translate;
exports.fromRotation = fromRotation;
exports.fromScaling = fromScaling;
exports.fromTranslation = fromTranslation;
exports.str = str;
exports.frob = frob;
exports.add = add;
exports.subtract = subtract;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 2x3 Matrix
 * @module mat2d
 * @description
 * A mat2d contains six elements defined as:
 * <pre>
 * [a, b,
 *  c, d,
 *  tx, ty]
 * </pre>
 * This is a short form for the 3x3 matrix:
 * <pre>
 * [a, b, 0,
 *  c, d, 0,
 *  tx, ty, 1]
 * </pre>
 * The last column is ignored so the array is shorter and operations are faster.
 */

/**
 * Creates a new identity mat2d
 *
 * @returns {mat2d} a new 2x3 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(6);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[4] = 0;
    out[5] = 0;
  }

  out[0] = 1;
  out[3] = 1;
  return out;
}
/**
 * Creates a new mat2d initialized with values from an existing matrix
 *
 * @param {ReadonlyMat2d} a matrix to clone
 * @returns {mat2d} a new 2x3 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(6);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  return out;
}
/**
 * Copy the values from one mat2d to another
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the source matrix
 * @returns {mat2d} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  return out;
}
/**
 * Set a mat2d to the identity matrix
 *
 * @param {mat2d} out the receiving matrix
 * @returns {mat2d} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = 0;
  out[5] = 0;
  return out;
}
/**
 * Create a new mat2d with the given values
 *
 * @param {Number} a Component A (index 0)
 * @param {Number} b Component B (index 1)
 * @param {Number} c Component C (index 2)
 * @param {Number} d Component D (index 3)
 * @param {Number} tx Component TX (index 4)
 * @param {Number} ty Component TY (index 5)
 * @returns {mat2d} A new mat2d
 */


function fromValues(a, b, c, d, tx, ty) {
  var out = new glMatrix.ARRAY_TYPE(6);
  out[0] = a;
  out[1] = b;
  out[2] = c;
  out[3] = d;
  out[4] = tx;
  out[5] = ty;
  return out;
}
/**
 * Set the components of a mat2d to the given values
 *
 * @param {mat2d} out the receiving matrix
 * @param {Number} a Component A (index 0)
 * @param {Number} b Component B (index 1)
 * @param {Number} c Component C (index 2)
 * @param {Number} d Component D (index 3)
 * @param {Number} tx Component TX (index 4)
 * @param {Number} ty Component TY (index 5)
 * @returns {mat2d} out
 */


function set(out, a, b, c, d, tx, ty) {
  out[0] = a;
  out[1] = b;
  out[2] = c;
  out[3] = d;
  out[4] = tx;
  out[5] = ty;
  return out;
}
/**
 * Inverts a mat2d
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the source matrix
 * @returns {mat2d} out
 */


function invert(out, a) {
  var aa = a[0],
      ab = a[1],
      ac = a[2],
      ad = a[3];
  var atx = a[4],
      aty = a[5];
  var det = aa * ad - ab * ac;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = ad * det;
  out[1] = -ab * det;
  out[2] = -ac * det;
  out[3] = aa * det;
  out[4] = (ac * aty - ad * atx) * det;
  out[5] = (ab * atx - aa * aty) * det;
  return out;
}
/**
 * Calculates the determinant of a mat2d
 *
 * @param {ReadonlyMat2d} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  return a[0] * a[3] - a[1] * a[2];
}
/**
 * Multiplies two mat2d's
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the first operand
 * @param {ReadonlyMat2d} b the second operand
 * @returns {mat2d} out
 */


function multiply(out, a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3],
      b4 = b[4],
      b5 = b[5];
  out[0] = a0 * b0 + a2 * b1;
  out[1] = a1 * b0 + a3 * b1;
  out[2] = a0 * b2 + a2 * b3;
  out[3] = a1 * b2 + a3 * b3;
  out[4] = a0 * b4 + a2 * b5 + a4;
  out[5] = a1 * b4 + a3 * b5 + a5;
  return out;
}
/**
 * Rotates a mat2d by the given angle
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat2d} out
 */


function rotate(out, a, rad) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5];
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  out[0] = a0 * c + a2 * s;
  out[1] = a1 * c + a3 * s;
  out[2] = a0 * -s + a2 * c;
  out[3] = a1 * -s + a3 * c;
  out[4] = a4;
  out[5] = a5;
  return out;
}
/**
 * Scales the mat2d by the dimensions in the given vec2
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the matrix to translate
 * @param {ReadonlyVec2} v the vec2 to scale the matrix by
 * @returns {mat2d} out
 **/


function scale(out, a, v) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5];
  var v0 = v[0],
      v1 = v[1];
  out[0] = a0 * v0;
  out[1] = a1 * v0;
  out[2] = a2 * v1;
  out[3] = a3 * v1;
  out[4] = a4;
  out[5] = a5;
  return out;
}
/**
 * Translates the mat2d by the dimensions in the given vec2
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the matrix to translate
 * @param {ReadonlyVec2} v the vec2 to translate the matrix by
 * @returns {mat2d} out
 **/


function translate(out, a, v) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5];
  var v0 = v[0],
      v1 = v[1];
  out[0] = a0;
  out[1] = a1;
  out[2] = a2;
  out[3] = a3;
  out[4] = a0 * v0 + a2 * v1 + a4;
  out[5] = a1 * v0 + a3 * v1 + a5;
  return out;
}
/**
 * Creates a matrix from a given angle
 * This is equivalent to (but much faster than):
 *
 *     mat2d.identity(dest);
 *     mat2d.rotate(dest, dest, rad);
 *
 * @param {mat2d} out mat2d receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat2d} out
 */


function fromRotation(out, rad) {
  var s = Math.sin(rad),
      c = Math.cos(rad);
  out[0] = c;
  out[1] = s;
  out[2] = -s;
  out[3] = c;
  out[4] = 0;
  out[5] = 0;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat2d.identity(dest);
 *     mat2d.scale(dest, dest, vec);
 *
 * @param {mat2d} out mat2d receiving operation result
 * @param {ReadonlyVec2} v Scaling vector
 * @returns {mat2d} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = v[1];
  out[4] = 0;
  out[5] = 0;
  return out;
}
/**
 * Creates a matrix from a vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat2d.identity(dest);
 *     mat2d.translate(dest, dest, vec);
 *
 * @param {mat2d} out mat2d receiving operation result
 * @param {ReadonlyVec2} v Translation vector
 * @returns {mat2d} out
 */


function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = v[0];
  out[5] = v[1];
  return out;
}
/**
 * Returns a string representation of a mat2d
 *
 * @param {ReadonlyMat2d} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */


function str(a) {
  return "mat2d(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")";
}
/**
 * Returns Frobenius norm of a mat2d
 *
 * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], 1);
}
/**
 * Adds two mat2d's
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the first operand
 * @param {ReadonlyMat2d} b the second operand
 * @returns {mat2d} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the first operand
 * @param {ReadonlyMat2d} b the second operand
 * @returns {mat2d} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  return out;
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat2d} out the receiving matrix
 * @param {ReadonlyMat2d} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat2d} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  return out;
}
/**
 * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat2d} out the receiving vector
 * @param {ReadonlyMat2d} a the first operand
 * @param {ReadonlyMat2d} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat2d} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  out[4] = a[4] + b[4] * scale;
  out[5] = a[5] + b[5] * scale;
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyMat2d} a The first matrix.
 * @param {ReadonlyMat2d} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {ReadonlyMat2d} a The first matrix.
 * @param {ReadonlyMat2d} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3],
      b4 = b[4],
      b5 = b[5];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5));
}
/**
 * Alias for {@link mat2d.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat2d.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":882}],886:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.fromMat4 = fromMat4;
exports.clone = clone;
exports.copy = copy;
exports.fromValues = fromValues;
exports.set = set;
exports.identity = identity;
exports.transpose = transpose;
exports.invert = invert;
exports.adjoint = adjoint;
exports.determinant = determinant;
exports.multiply = multiply;
exports.translate = translate;
exports.rotate = rotate;
exports.scale = scale;
exports.fromTranslation = fromTranslation;
exports.fromRotation = fromRotation;
exports.fromScaling = fromScaling;
exports.fromMat2d = fromMat2d;
exports.fromQuat = fromQuat;
exports.normalFromMat4 = normalFromMat4;
exports.projection = projection;
exports.str = str;
exports.frob = frob;
exports.add = add;
exports.subtract = subtract;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 3x3 Matrix
 * @module mat3
 */

/**
 * Creates a new identity mat3
 *
 * @returns {mat3} a new 3x3 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(9);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[5] = 0;
    out[6] = 0;
    out[7] = 0;
  }

  out[0] = 1;
  out[4] = 1;
  out[8] = 1;
  return out;
}
/**
 * Copies the upper-left 3x3 values into the given mat3.
 *
 * @param {mat3} out the receiving 3x3 matrix
 * @param {ReadonlyMat4} a   the source 4x4 matrix
 * @returns {mat3} out
 */


function fromMat4(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[4];
  out[4] = a[5];
  out[5] = a[6];
  out[6] = a[8];
  out[7] = a[9];
  out[8] = a[10];
  return out;
}
/**
 * Creates a new mat3 initialized with values from an existing matrix
 *
 * @param {ReadonlyMat3} a matrix to clone
 * @returns {mat3} a new 3x3 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(9);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Copy the values from one mat3 to another
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the source matrix
 * @returns {mat3} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Create a new mat3 with the given values
 *
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m10 Component in column 1, row 0 position (index 3)
 * @param {Number} m11 Component in column 1, row 1 position (index 4)
 * @param {Number} m12 Component in column 1, row 2 position (index 5)
 * @param {Number} m20 Component in column 2, row 0 position (index 6)
 * @param {Number} m21 Component in column 2, row 1 position (index 7)
 * @param {Number} m22 Component in column 2, row 2 position (index 8)
 * @returns {mat3} A new mat3
 */


function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
  var out = new glMatrix.ARRAY_TYPE(9);
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m10;
  out[4] = m11;
  out[5] = m12;
  out[6] = m20;
  out[7] = m21;
  out[8] = m22;
  return out;
}
/**
 * Set the components of a mat3 to the given values
 *
 * @param {mat3} out the receiving matrix
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m10 Component in column 1, row 0 position (index 3)
 * @param {Number} m11 Component in column 1, row 1 position (index 4)
 * @param {Number} m12 Component in column 1, row 2 position (index 5)
 * @param {Number} m20 Component in column 2, row 0 position (index 6)
 * @param {Number} m21 Component in column 2, row 1 position (index 7)
 * @param {Number} m22 Component in column 2, row 2 position (index 8)
 * @returns {mat3} out
 */


function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m10;
  out[4] = m11;
  out[5] = m12;
  out[6] = m20;
  out[7] = m21;
  out[8] = m22;
  return out;
}
/**
 * Set a mat3 to the identity matrix
 *
 * @param {mat3} out the receiving matrix
 * @returns {mat3} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 1;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Transpose the values of a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the source matrix
 * @returns {mat3} out
 */


function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache some values
  if (out === a) {
    var a01 = a[1],
        a02 = a[2],
        a12 = a[5];
    out[1] = a[3];
    out[2] = a[6];
    out[3] = a01;
    out[5] = a[7];
    out[6] = a02;
    out[7] = a12;
  } else {
    out[0] = a[0];
    out[1] = a[3];
    out[2] = a[6];
    out[3] = a[1];
    out[4] = a[4];
    out[5] = a[7];
    out[6] = a[2];
    out[7] = a[5];
    out[8] = a[8];
  }

  return out;
}
/**
 * Inverts a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the source matrix
 * @returns {mat3} out
 */


function invert(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  var b01 = a22 * a11 - a12 * a21;
  var b11 = -a22 * a10 + a12 * a20;
  var b21 = a21 * a10 - a11 * a20; // Calculate the determinant

  var det = a00 * b01 + a01 * b11 + a02 * b21;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = b01 * det;
  out[1] = (-a22 * a01 + a02 * a21) * det;
  out[2] = (a12 * a01 - a02 * a11) * det;
  out[3] = b11 * det;
  out[4] = (a22 * a00 - a02 * a20) * det;
  out[5] = (-a12 * a00 + a02 * a10) * det;
  out[6] = b21 * det;
  out[7] = (-a21 * a00 + a01 * a20) * det;
  out[8] = (a11 * a00 - a01 * a10) * det;
  return out;
}
/**
 * Calculates the adjugate of a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the source matrix
 * @returns {mat3} out
 */


function adjoint(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  out[0] = a11 * a22 - a12 * a21;
  out[1] = a02 * a21 - a01 * a22;
  out[2] = a01 * a12 - a02 * a11;
  out[3] = a12 * a20 - a10 * a22;
  out[4] = a00 * a22 - a02 * a20;
  out[5] = a02 * a10 - a00 * a12;
  out[6] = a10 * a21 - a11 * a20;
  out[7] = a01 * a20 - a00 * a21;
  out[8] = a00 * a11 - a01 * a10;
  return out;
}
/**
 * Calculates the determinant of a mat3
 *
 * @param {ReadonlyMat3} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
}
/**
 * Multiplies two mat3's
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the first operand
 * @param {ReadonlyMat3} b the second operand
 * @returns {mat3} out
 */


function multiply(out, a, b) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2];
  var a10 = a[3],
      a11 = a[4],
      a12 = a[5];
  var a20 = a[6],
      a21 = a[7],
      a22 = a[8];
  var b00 = b[0],
      b01 = b[1],
      b02 = b[2];
  var b10 = b[3],
      b11 = b[4],
      b12 = b[5];
  var b20 = b[6],
      b21 = b[7],
      b22 = b[8];
  out[0] = b00 * a00 + b01 * a10 + b02 * a20;
  out[1] = b00 * a01 + b01 * a11 + b02 * a21;
  out[2] = b00 * a02 + b01 * a12 + b02 * a22;
  out[3] = b10 * a00 + b11 * a10 + b12 * a20;
  out[4] = b10 * a01 + b11 * a11 + b12 * a21;
  out[5] = b10 * a02 + b11 * a12 + b12 * a22;
  out[6] = b20 * a00 + b21 * a10 + b22 * a20;
  out[7] = b20 * a01 + b21 * a11 + b22 * a21;
  out[8] = b20 * a02 + b21 * a12 + b22 * a22;
  return out;
}
/**
 * Translate a mat3 by the given vector
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the matrix to translate
 * @param {ReadonlyVec2} v vector to translate by
 * @returns {mat3} out
 */


function translate(out, a, v) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a10 = a[3],
      a11 = a[4],
      a12 = a[5],
      a20 = a[6],
      a21 = a[7],
      a22 = a[8],
      x = v[0],
      y = v[1];
  out[0] = a00;
  out[1] = a01;
  out[2] = a02;
  out[3] = a10;
  out[4] = a11;
  out[5] = a12;
  out[6] = x * a00 + y * a10 + a20;
  out[7] = x * a01 + y * a11 + a21;
  out[8] = x * a02 + y * a12 + a22;
  return out;
}
/**
 * Rotates a mat3 by the given angle
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat3} out
 */


function rotate(out, a, rad) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a10 = a[3],
      a11 = a[4],
      a12 = a[5],
      a20 = a[6],
      a21 = a[7],
      a22 = a[8],
      s = Math.sin(rad),
      c = Math.cos(rad);
  out[0] = c * a00 + s * a10;
  out[1] = c * a01 + s * a11;
  out[2] = c * a02 + s * a12;
  out[3] = c * a10 - s * a00;
  out[4] = c * a11 - s * a01;
  out[5] = c * a12 - s * a02;
  out[6] = a20;
  out[7] = a21;
  out[8] = a22;
  return out;
}
/**
 * Scales the mat3 by the dimensions in the given vec2
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the matrix to rotate
 * @param {ReadonlyVec2} v the vec2 to scale the matrix by
 * @returns {mat3} out
 **/


function scale(out, a, v) {
  var x = v[0],
      y = v[1];
  out[0] = x * a[0];
  out[1] = x * a[1];
  out[2] = x * a[2];
  out[3] = y * a[3];
  out[4] = y * a[4];
  out[5] = y * a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  return out;
}
/**
 * Creates a matrix from a vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.translate(dest, dest, vec);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {ReadonlyVec2} v Translation vector
 * @returns {mat3} out
 */


function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 1;
  out[5] = 0;
  out[6] = v[0];
  out[7] = v[1];
  out[8] = 1;
  return out;
}
/**
 * Creates a matrix from a given angle
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.rotate(dest, dest, rad);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat3} out
 */


function fromRotation(out, rad) {
  var s = Math.sin(rad),
      c = Math.cos(rad);
  out[0] = c;
  out[1] = s;
  out[2] = 0;
  out[3] = -s;
  out[4] = c;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat3.identity(dest);
 *     mat3.scale(dest, dest, vec);
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {ReadonlyVec2} v Scaling vector
 * @returns {mat3} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = v[1];
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  out[8] = 1;
  return out;
}
/**
 * Copies the values from a mat2d into a mat3
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat2d} a the matrix to copy
 * @returns {mat3} out
 **/


function fromMat2d(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = 0;
  out[3] = a[2];
  out[4] = a[3];
  out[5] = 0;
  out[6] = a[4];
  out[7] = a[5];
  out[8] = 1;
  return out;
}
/**
 * Calculates a 3x3 matrix from the given quaternion
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {ReadonlyQuat} q Quaternion to create matrix from
 *
 * @returns {mat3} out
 */


function fromQuat(out, q) {
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var yx = y * x2;
  var yy = y * y2;
  var zx = z * x2;
  var zy = z * y2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - yy - zz;
  out[3] = yx - wz;
  out[6] = zx + wy;
  out[1] = yx + wz;
  out[4] = 1 - xx - zz;
  out[7] = zy - wx;
  out[2] = zx - wy;
  out[5] = zy + wx;
  out[8] = 1 - xx - yy;
  return out;
}
/**
 * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
 *
 * @param {mat3} out mat3 receiving operation result
 * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from
 *
 * @returns {mat3} out
 */


function normalFromMat4(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
  out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
  out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
  out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
  out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
  out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
  out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
  out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
  out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
  return out;
}
/**
 * Generates a 2D projection matrix with the given bounds
 *
 * @param {mat3} out mat3 frustum matrix will be written into
 * @param {number} width Width of your gl context
 * @param {number} height Height of gl context
 * @returns {mat3} out
 */


function projection(out, width, height) {
  out[0] = 2 / width;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = -2 / height;
  out[5] = 0;
  out[6] = -1;
  out[7] = 1;
  out[8] = 1;
  return out;
}
/**
 * Returns a string representation of a mat3
 *
 * @param {ReadonlyMat3} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */


function str(a) {
  return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")";
}
/**
 * Returns Frobenius norm of a mat3
 *
 * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
}
/**
 * Adds two mat3's
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the first operand
 * @param {ReadonlyMat3} b the second operand
 * @returns {mat3} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  out[6] = a[6] + b[6];
  out[7] = a[7] + b[7];
  out[8] = a[8] + b[8];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the first operand
 * @param {ReadonlyMat3} b the second operand
 * @returns {mat3} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  out[6] = a[6] - b[6];
  out[7] = a[7] - b[7];
  out[8] = a[8] - b[8];
  return out;
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat3} out the receiving matrix
 * @param {ReadonlyMat3} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat3} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  out[6] = a[6] * b;
  out[7] = a[7] * b;
  out[8] = a[8] * b;
  return out;
}
/**
 * Adds two mat3's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat3} out the receiving vector
 * @param {ReadonlyMat3} a the first operand
 * @param {ReadonlyMat3} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat3} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  out[4] = a[4] + b[4] * scale;
  out[5] = a[5] + b[5] * scale;
  out[6] = a[6] + b[6] * scale;
  out[7] = a[7] + b[7] * scale;
  out[8] = a[8] + b[8] * scale;
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyMat3} a The first matrix.
 * @param {ReadonlyMat3} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {ReadonlyMat3} a The first matrix.
 * @param {ReadonlyMat3} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5],
      a6 = a[6],
      a7 = a[7],
      a8 = a[8];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3],
      b4 = b[4],
      b5 = b[5],
      b6 = b[6],
      b7 = b[7],
      b8 = b[8];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));
}
/**
 * Alias for {@link mat3.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat3.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":882}],887:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.copy = copy;
exports.fromValues = fromValues;
exports.set = set;
exports.identity = identity;
exports.transpose = transpose;
exports.invert = invert;
exports.adjoint = adjoint;
exports.determinant = determinant;
exports.multiply = multiply;
exports.translate = translate;
exports.scale = scale;
exports.rotate = rotate;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.fromTranslation = fromTranslation;
exports.fromScaling = fromScaling;
exports.fromRotation = fromRotation;
exports.fromXRotation = fromXRotation;
exports.fromYRotation = fromYRotation;
exports.fromZRotation = fromZRotation;
exports.fromRotationTranslation = fromRotationTranslation;
exports.fromQuat2 = fromQuat2;
exports.getTranslation = getTranslation;
exports.getScaling = getScaling;
exports.getRotation = getRotation;
exports.fromRotationTranslationScale = fromRotationTranslationScale;
exports.fromRotationTranslationScaleOrigin = fromRotationTranslationScaleOrigin;
exports.fromQuat = fromQuat;
exports.frustum = frustum;
exports.perspective = perspective;
exports.perspectiveFromFieldOfView = perspectiveFromFieldOfView;
exports.ortho = ortho;
exports.lookAt = lookAt;
exports.targetTo = targetTo;
exports.str = str;
exports.frob = frob;
exports.add = add;
exports.subtract = subtract;
exports.multiplyScalar = multiplyScalar;
exports.multiplyScalarAndAdd = multiplyScalarAndAdd;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sub = exports.mul = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
 * @module mat4
 */

/**
 * Creates a new identity mat4
 *
 * @returns {mat4} a new 4x4 matrix
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(16);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
    out[4] = 0;
    out[6] = 0;
    out[7] = 0;
    out[8] = 0;
    out[9] = 0;
    out[11] = 0;
    out[12] = 0;
    out[13] = 0;
    out[14] = 0;
  }

  out[0] = 1;
  out[5] = 1;
  out[10] = 1;
  out[15] = 1;
  return out;
}
/**
 * Creates a new mat4 initialized with values from an existing matrix
 *
 * @param {ReadonlyMat4} a matrix to clone
 * @returns {mat4} a new 4x4 matrix
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(16);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  out[9] = a[9];
  out[10] = a[10];
  out[11] = a[11];
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Copy the values from one mat4 to another
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the source matrix
 * @returns {mat4} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  out[8] = a[8];
  out[9] = a[9];
  out[10] = a[10];
  out[11] = a[11];
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Create a new mat4 with the given values
 *
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m03 Component in column 0, row 3 position (index 3)
 * @param {Number} m10 Component in column 1, row 0 position (index 4)
 * @param {Number} m11 Component in column 1, row 1 position (index 5)
 * @param {Number} m12 Component in column 1, row 2 position (index 6)
 * @param {Number} m13 Component in column 1, row 3 position (index 7)
 * @param {Number} m20 Component in column 2, row 0 position (index 8)
 * @param {Number} m21 Component in column 2, row 1 position (index 9)
 * @param {Number} m22 Component in column 2, row 2 position (index 10)
 * @param {Number} m23 Component in column 2, row 3 position (index 11)
 * @param {Number} m30 Component in column 3, row 0 position (index 12)
 * @param {Number} m31 Component in column 3, row 1 position (index 13)
 * @param {Number} m32 Component in column 3, row 2 position (index 14)
 * @param {Number} m33 Component in column 3, row 3 position (index 15)
 * @returns {mat4} A new mat4
 */


function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
  var out = new glMatrix.ARRAY_TYPE(16);
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m03;
  out[4] = m10;
  out[5] = m11;
  out[6] = m12;
  out[7] = m13;
  out[8] = m20;
  out[9] = m21;
  out[10] = m22;
  out[11] = m23;
  out[12] = m30;
  out[13] = m31;
  out[14] = m32;
  out[15] = m33;
  return out;
}
/**
 * Set the components of a mat4 to the given values
 *
 * @param {mat4} out the receiving matrix
 * @param {Number} m00 Component in column 0, row 0 position (index 0)
 * @param {Number} m01 Component in column 0, row 1 position (index 1)
 * @param {Number} m02 Component in column 0, row 2 position (index 2)
 * @param {Number} m03 Component in column 0, row 3 position (index 3)
 * @param {Number} m10 Component in column 1, row 0 position (index 4)
 * @param {Number} m11 Component in column 1, row 1 position (index 5)
 * @param {Number} m12 Component in column 1, row 2 position (index 6)
 * @param {Number} m13 Component in column 1, row 3 position (index 7)
 * @param {Number} m20 Component in column 2, row 0 position (index 8)
 * @param {Number} m21 Component in column 2, row 1 position (index 9)
 * @param {Number} m22 Component in column 2, row 2 position (index 10)
 * @param {Number} m23 Component in column 2, row 3 position (index 11)
 * @param {Number} m30 Component in column 3, row 0 position (index 12)
 * @param {Number} m31 Component in column 3, row 1 position (index 13)
 * @param {Number} m32 Component in column 3, row 2 position (index 14)
 * @param {Number} m33 Component in column 3, row 3 position (index 15)
 * @returns {mat4} out
 */


function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
  out[0] = m00;
  out[1] = m01;
  out[2] = m02;
  out[3] = m03;
  out[4] = m10;
  out[5] = m11;
  out[6] = m12;
  out[7] = m13;
  out[8] = m20;
  out[9] = m21;
  out[10] = m22;
  out[11] = m23;
  out[12] = m30;
  out[13] = m31;
  out[14] = m32;
  out[15] = m33;
  return out;
}
/**
 * Set a mat4 to the identity matrix
 *
 * @param {mat4} out the receiving matrix
 * @returns {mat4} out
 */


function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Transpose the values of a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the source matrix
 * @returns {mat4} out
 */


function transpose(out, a) {
  // If we are transposing ourselves we can skip a few steps but have to cache some values
  if (out === a) {
    var a01 = a[1],
        a02 = a[2],
        a03 = a[3];
    var a12 = a[6],
        a13 = a[7];
    var a23 = a[11];
    out[1] = a[4];
    out[2] = a[8];
    out[3] = a[12];
    out[4] = a01;
    out[6] = a[9];
    out[7] = a[13];
    out[8] = a02;
    out[9] = a12;
    out[11] = a[14];
    out[12] = a03;
    out[13] = a13;
    out[14] = a23;
  } else {
    out[0] = a[0];
    out[1] = a[4];
    out[2] = a[8];
    out[3] = a[12];
    out[4] = a[1];
    out[5] = a[5];
    out[6] = a[9];
    out[7] = a[13];
    out[8] = a[2];
    out[9] = a[6];
    out[10] = a[10];
    out[11] = a[14];
    out[12] = a[3];
    out[13] = a[7];
    out[14] = a[11];
    out[15] = a[15];
  }

  return out;
}
/**
 * Inverts a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the source matrix
 * @returns {mat4} out
 */


function invert(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;

  if (!det) {
    return null;
  }

  det = 1.0 / det;
  out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
  out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
  out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
  out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
  out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
  out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
  out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
  out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
  out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
  out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
  out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
  out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
  out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
  out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
  out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
  out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
  return out;
}
/**
 * Calculates the adjugate of a mat4
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the source matrix
 * @returns {mat4} out
 */


function adjoint(out, a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);
  out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
  out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);
  out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
  out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
  out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);
  out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
  out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);
  out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);
  out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
  out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);
  out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
  out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
  out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);
  out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
  out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);
  return out;
}
/**
 * Calculates the determinant of a mat4
 *
 * @param {ReadonlyMat4} a the source matrix
 * @returns {Number} determinant of a
 */


function determinant(a) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15];
  var b00 = a00 * a11 - a01 * a10;
  var b01 = a00 * a12 - a02 * a10;
  var b02 = a00 * a13 - a03 * a10;
  var b03 = a01 * a12 - a02 * a11;
  var b04 = a01 * a13 - a03 * a11;
  var b05 = a02 * a13 - a03 * a12;
  var b06 = a20 * a31 - a21 * a30;
  var b07 = a20 * a32 - a22 * a30;
  var b08 = a20 * a33 - a23 * a30;
  var b09 = a21 * a32 - a22 * a31;
  var b10 = a21 * a33 - a23 * a31;
  var b11 = a22 * a33 - a23 * a32; // Calculate the determinant

  return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
}
/**
 * Multiplies two mat4s
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the first operand
 * @param {ReadonlyMat4} b the second operand
 * @returns {mat4} out
 */


function multiply(out, a, b) {
  var a00 = a[0],
      a01 = a[1],
      a02 = a[2],
      a03 = a[3];
  var a10 = a[4],
      a11 = a[5],
      a12 = a[6],
      a13 = a[7];
  var a20 = a[8],
      a21 = a[9],
      a22 = a[10],
      a23 = a[11];
  var a30 = a[12],
      a31 = a[13],
      a32 = a[14],
      a33 = a[15]; // Cache only the current line of the second matrix

  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[4];
  b1 = b[5];
  b2 = b[6];
  b3 = b[7];
  out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[8];
  b1 = b[9];
  b2 = b[10];
  b3 = b[11];
  out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  b0 = b[12];
  b1 = b[13];
  b2 = b[14];
  b3 = b[15];
  out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
  out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
  out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
  return out;
}
/**
 * Translate a mat4 by the given vector
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to translate
 * @param {ReadonlyVec3} v vector to translate by
 * @returns {mat4} out
 */


function translate(out, a, v) {
  var x = v[0],
      y = v[1],
      z = v[2];
  var a00, a01, a02, a03;
  var a10, a11, a12, a13;
  var a20, a21, a22, a23;

  if (a === out) {
    out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
    out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
    out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
    out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
  } else {
    a00 = a[0];
    a01 = a[1];
    a02 = a[2];
    a03 = a[3];
    a10 = a[4];
    a11 = a[5];
    a12 = a[6];
    a13 = a[7];
    a20 = a[8];
    a21 = a[9];
    a22 = a[10];
    a23 = a[11];
    out[0] = a00;
    out[1] = a01;
    out[2] = a02;
    out[3] = a03;
    out[4] = a10;
    out[5] = a11;
    out[6] = a12;
    out[7] = a13;
    out[8] = a20;
    out[9] = a21;
    out[10] = a22;
    out[11] = a23;
    out[12] = a00 * x + a10 * y + a20 * z + a[12];
    out[13] = a01 * x + a11 * y + a21 * z + a[13];
    out[14] = a02 * x + a12 * y + a22 * z + a[14];
    out[15] = a03 * x + a13 * y + a23 * z + a[15];
  }

  return out;
}
/**
 * Scales the mat4 by the dimensions in the given vec3 not using vectorization
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to scale
 * @param {ReadonlyVec3} v the vec3 to scale the matrix by
 * @returns {mat4} out
 **/


function scale(out, a, v) {
  var x = v[0],
      y = v[1],
      z = v[2];
  out[0] = a[0] * x;
  out[1] = a[1] * x;
  out[2] = a[2] * x;
  out[3] = a[3] * x;
  out[4] = a[4] * y;
  out[5] = a[5] * y;
  out[6] = a[6] * y;
  out[7] = a[7] * y;
  out[8] = a[8] * z;
  out[9] = a[9] * z;
  out[10] = a[10] * z;
  out[11] = a[11] * z;
  out[12] = a[12];
  out[13] = a[13];
  out[14] = a[14];
  out[15] = a[15];
  return out;
}
/**
 * Rotates a mat4 by the given angle around the given axis
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @param {ReadonlyVec3} axis the axis to rotate around
 * @returns {mat4} out
 */


function rotate(out, a, rad, axis) {
  var x = axis[0],
      y = axis[1],
      z = axis[2];
  var len = Math.hypot(x, y, z);
  var s, c, t;
  var a00, a01, a02, a03;
  var a10, a11, a12, a13;
  var a20, a21, a22, a23;
  var b00, b01, b02;
  var b10, b11, b12;
  var b20, b21, b22;

  if (len < glMatrix.EPSILON) {
    return null;
  }

  len = 1 / len;
  x *= len;
  y *= len;
  z *= len;
  s = Math.sin(rad);
  c = Math.cos(rad);
  t = 1 - c;
  a00 = a[0];
  a01 = a[1];
  a02 = a[2];
  a03 = a[3];
  a10 = a[4];
  a11 = a[5];
  a12 = a[6];
  a13 = a[7];
  a20 = a[8];
  a21 = a[9];
  a22 = a[10];
  a23 = a[11]; // Construct the elements of the rotation matrix

  b00 = x * x * t + c;
  b01 = y * x * t + z * s;
  b02 = z * x * t - y * s;
  b10 = x * y * t - z * s;
  b11 = y * y * t + c;
  b12 = z * y * t + x * s;
  b20 = x * z * t + y * s;
  b21 = y * z * t - x * s;
  b22 = z * z * t + c; // Perform rotation-specific matrix multiplication

  out[0] = a00 * b00 + a10 * b01 + a20 * b02;
  out[1] = a01 * b00 + a11 * b01 + a21 * b02;
  out[2] = a02 * b00 + a12 * b01 + a22 * b02;
  out[3] = a03 * b00 + a13 * b01 + a23 * b02;
  out[4] = a00 * b10 + a10 * b11 + a20 * b12;
  out[5] = a01 * b10 + a11 * b11 + a21 * b12;
  out[6] = a02 * b10 + a12 * b11 + a22 * b12;
  out[7] = a03 * b10 + a13 * b11 + a23 * b12;
  out[8] = a00 * b20 + a10 * b21 + a20 * b22;
  out[9] = a01 * b20 + a11 * b21 + a21 * b22;
  out[10] = a02 * b20 + a12 * b21 + a22 * b22;
  out[11] = a03 * b20 + a13 * b21 + a23 * b22;

  if (a !== out) {
    // If the source and destination differ, copy the unchanged last row
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  }

  return out;
}
/**
 * Rotates a matrix by the given angle around the X axis
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateX(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a10 = a[4];
  var a11 = a[5];
  var a12 = a[6];
  var a13 = a[7];
  var a20 = a[8];
  var a21 = a[9];
  var a22 = a[10];
  var a23 = a[11];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged rows
    out[0] = a[0];
    out[1] = a[1];
    out[2] = a[2];
    out[3] = a[3];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[4] = a10 * c + a20 * s;
  out[5] = a11 * c + a21 * s;
  out[6] = a12 * c + a22 * s;
  out[7] = a13 * c + a23 * s;
  out[8] = a20 * c - a10 * s;
  out[9] = a21 * c - a11 * s;
  out[10] = a22 * c - a12 * s;
  out[11] = a23 * c - a13 * s;
  return out;
}
/**
 * Rotates a matrix by the given angle around the Y axis
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateY(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a00 = a[0];
  var a01 = a[1];
  var a02 = a[2];
  var a03 = a[3];
  var a20 = a[8];
  var a21 = a[9];
  var a22 = a[10];
  var a23 = a[11];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged rows
    out[4] = a[4];
    out[5] = a[5];
    out[6] = a[6];
    out[7] = a[7];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[0] = a00 * c - a20 * s;
  out[1] = a01 * c - a21 * s;
  out[2] = a02 * c - a22 * s;
  out[3] = a03 * c - a23 * s;
  out[8] = a00 * s + a20 * c;
  out[9] = a01 * s + a21 * c;
  out[10] = a02 * s + a22 * c;
  out[11] = a03 * s + a23 * c;
  return out;
}
/**
 * Rotates a matrix by the given angle around the Z axis
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to rotate
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function rotateZ(out, a, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad);
  var a00 = a[0];
  var a01 = a[1];
  var a02 = a[2];
  var a03 = a[3];
  var a10 = a[4];
  var a11 = a[5];
  var a12 = a[6];
  var a13 = a[7];

  if (a !== out) {
    // If the source and destination differ, copy the unchanged last row
    out[8] = a[8];
    out[9] = a[9];
    out[10] = a[10];
    out[11] = a[11];
    out[12] = a[12];
    out[13] = a[13];
    out[14] = a[14];
    out[15] = a[15];
  } // Perform axis-specific matrix multiplication


  out[0] = a00 * c + a10 * s;
  out[1] = a01 * c + a11 * s;
  out[2] = a02 * c + a12 * s;
  out[3] = a03 * c + a13 * s;
  out[4] = a10 * c - a00 * s;
  out[5] = a11 * c - a01 * s;
  out[6] = a12 * c - a02 * s;
  out[7] = a13 * c - a03 * s;
  return out;
}
/**
 * Creates a matrix from a vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, dest, vec);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {ReadonlyVec3} v Translation vector
 * @returns {mat4} out
 */


function fromTranslation(out, v) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a vector scaling
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.scale(dest, dest, vec);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {ReadonlyVec3} v Scaling vector
 * @returns {mat4} out
 */


function fromScaling(out, v) {
  out[0] = v[0];
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = v[1];
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = v[2];
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a given angle around a given axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotate(dest, dest, rad, axis);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @param {ReadonlyVec3} axis the axis to rotate around
 * @returns {mat4} out
 */


function fromRotation(out, rad, axis) {
  var x = axis[0],
      y = axis[1],
      z = axis[2];
  var len = Math.hypot(x, y, z);
  var s, c, t;

  if (len < glMatrix.EPSILON) {
    return null;
  }

  len = 1 / len;
  x *= len;
  y *= len;
  z *= len;
  s = Math.sin(rad);
  c = Math.cos(rad);
  t = 1 - c; // Perform rotation-specific matrix multiplication

  out[0] = x * x * t + c;
  out[1] = y * x * t + z * s;
  out[2] = z * x * t - y * s;
  out[3] = 0;
  out[4] = x * y * t - z * s;
  out[5] = y * y * t + c;
  out[6] = z * y * t + x * s;
  out[7] = 0;
  out[8] = x * z * t + y * s;
  out[9] = y * z * t - x * s;
  out[10] = z * z * t + c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the X axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateX(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromXRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = c;
  out[6] = s;
  out[7] = 0;
  out[8] = 0;
  out[9] = -s;
  out[10] = c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the Y axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateY(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromYRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = c;
  out[1] = 0;
  out[2] = -s;
  out[3] = 0;
  out[4] = 0;
  out[5] = 1;
  out[6] = 0;
  out[7] = 0;
  out[8] = s;
  out[9] = 0;
  out[10] = c;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from the given angle around the Z axis
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.rotateZ(dest, dest, rad);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {Number} rad the angle to rotate the matrix by
 * @returns {mat4} out
 */


function fromZRotation(out, rad) {
  var s = Math.sin(rad);
  var c = Math.cos(rad); // Perform axis-specific matrix multiplication

  out[0] = c;
  out[1] = s;
  out[2] = 0;
  out[3] = 0;
  out[4] = -s;
  out[5] = c;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 1;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a quaternion rotation and vector translation
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {ReadonlyVec3} v Translation vector
 * @returns {mat4} out
 */


function fromRotationTranslation(out, q, v) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - (yy + zz);
  out[1] = xy + wz;
  out[2] = xz - wy;
  out[3] = 0;
  out[4] = xy - wz;
  out[5] = 1 - (xx + zz);
  out[6] = yz + wx;
  out[7] = 0;
  out[8] = xz + wy;
  out[9] = yz - wx;
  out[10] = 1 - (xx + yy);
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a new mat4 from a dual quat.
 *
 * @param {mat4} out Matrix
 * @param {ReadonlyQuat2} a Dual Quaternion
 * @returns {mat4} mat4 receiving operation result
 */


function fromQuat2(out, a) {
  var translation = new glMatrix.ARRAY_TYPE(3);
  var bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3],
      ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7];
  var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense

  if (magnitude > 0) {
    translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;
    translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;
    translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;
  } else {
    translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
    translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
    translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
  }

  fromRotationTranslation(out, a, translation);
  return out;
}
/**
 * Returns the translation vector component of a transformation
 *  matrix. If a matrix is built with fromRotationTranslation,
 *  the returned vector will be the same as the translation vector
 *  originally supplied.
 * @param  {vec3} out Vector to receive translation component
 * @param  {ReadonlyMat4} mat Matrix to be decomposed (input)
 * @return {vec3} out
 */


function getTranslation(out, mat) {
  out[0] = mat[12];
  out[1] = mat[13];
  out[2] = mat[14];
  return out;
}
/**
 * Returns the scaling factor component of a transformation
 *  matrix. If a matrix is built with fromRotationTranslationScale
 *  with a normalized Quaternion paramter, the returned vector will be
 *  the same as the scaling vector
 *  originally supplied.
 * @param  {vec3} out Vector to receive scaling factor component
 * @param  {ReadonlyMat4} mat Matrix to be decomposed (input)
 * @return {vec3} out
 */


function getScaling(out, mat) {
  var m11 = mat[0];
  var m12 = mat[1];
  var m13 = mat[2];
  var m21 = mat[4];
  var m22 = mat[5];
  var m23 = mat[6];
  var m31 = mat[8];
  var m32 = mat[9];
  var m33 = mat[10];
  out[0] = Math.hypot(m11, m12, m13);
  out[1] = Math.hypot(m21, m22, m23);
  out[2] = Math.hypot(m31, m32, m33);
  return out;
}
/**
 * Returns a quaternion representing the rotational component
 *  of a transformation matrix. If a matrix is built with
 *  fromRotationTranslation, the returned quaternion will be the
 *  same as the quaternion originally supplied.
 * @param {quat} out Quaternion to receive the rotation component
 * @param {ReadonlyMat4} mat Matrix to be decomposed (input)
 * @return {quat} out
 */


function getRotation(out, mat) {
  var scaling = new glMatrix.ARRAY_TYPE(3);
  getScaling(scaling, mat);
  var is1 = 1 / scaling[0];
  var is2 = 1 / scaling[1];
  var is3 = 1 / scaling[2];
  var sm11 = mat[0] * is1;
  var sm12 = mat[1] * is2;
  var sm13 = mat[2] * is3;
  var sm21 = mat[4] * is1;
  var sm22 = mat[5] * is2;
  var sm23 = mat[6] * is3;
  var sm31 = mat[8] * is1;
  var sm32 = mat[9] * is2;
  var sm33 = mat[10] * is3;
  var trace = sm11 + sm22 + sm33;
  var S = 0;

  if (trace > 0) {
    S = Math.sqrt(trace + 1.0) * 2;
    out[3] = 0.25 * S;
    out[0] = (sm23 - sm32) / S;
    out[1] = (sm31 - sm13) / S;
    out[2] = (sm12 - sm21) / S;
  } else if (sm11 > sm22 && sm11 > sm33) {
    S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;
    out[3] = (sm23 - sm32) / S;
    out[0] = 0.25 * S;
    out[1] = (sm12 + sm21) / S;
    out[2] = (sm31 + sm13) / S;
  } else if (sm22 > sm33) {
    S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;
    out[3] = (sm31 - sm13) / S;
    out[0] = (sm12 + sm21) / S;
    out[1] = 0.25 * S;
    out[2] = (sm23 + sm32) / S;
  } else {
    S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;
    out[3] = (sm12 - sm21) / S;
    out[0] = (sm31 + sm13) / S;
    out[1] = (sm23 + sm32) / S;
    out[2] = 0.25 * S;
  }

  return out;
}
/**
 * Creates a matrix from a quaternion rotation, vector translation and vector scale
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *     mat4.scale(dest, scale)
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {ReadonlyVec3} v Translation vector
 * @param {ReadonlyVec3} s Scaling vector
 * @returns {mat4} out
 */


function fromRotationTranslationScale(out, q, v, s) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  var sx = s[0];
  var sy = s[1];
  var sz = s[2];
  out[0] = (1 - (yy + zz)) * sx;
  out[1] = (xy + wz) * sx;
  out[2] = (xz - wy) * sx;
  out[3] = 0;
  out[4] = (xy - wz) * sy;
  out[5] = (1 - (xx + zz)) * sy;
  out[6] = (yz + wx) * sy;
  out[7] = 0;
  out[8] = (xz + wy) * sz;
  out[9] = (yz - wx) * sz;
  out[10] = (1 - (xx + yy)) * sz;
  out[11] = 0;
  out[12] = v[0];
  out[13] = v[1];
  out[14] = v[2];
  out[15] = 1;
  return out;
}
/**
 * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
 * This is equivalent to (but much faster than):
 *
 *     mat4.identity(dest);
 *     mat4.translate(dest, vec);
 *     mat4.translate(dest, origin);
 *     let quatMat = mat4.create();
 *     quat4.toMat4(quat, quatMat);
 *     mat4.multiply(dest, quatMat);
 *     mat4.scale(dest, scale)
 *     mat4.translate(dest, negativeOrigin);
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {quat4} q Rotation quaternion
 * @param {ReadonlyVec3} v Translation vector
 * @param {ReadonlyVec3} s Scaling vector
 * @param {ReadonlyVec3} o The origin vector around which to scale and rotate
 * @returns {mat4} out
 */


function fromRotationTranslationScaleOrigin(out, q, v, s, o) {
  // Quaternion math
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var xy = x * y2;
  var xz = x * z2;
  var yy = y * y2;
  var yz = y * z2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  var sx = s[0];
  var sy = s[1];
  var sz = s[2];
  var ox = o[0];
  var oy = o[1];
  var oz = o[2];
  var out0 = (1 - (yy + zz)) * sx;
  var out1 = (xy + wz) * sx;
  var out2 = (xz - wy) * sx;
  var out4 = (xy - wz) * sy;
  var out5 = (1 - (xx + zz)) * sy;
  var out6 = (yz + wx) * sy;
  var out8 = (xz + wy) * sz;
  var out9 = (yz - wx) * sz;
  var out10 = (1 - (xx + yy)) * sz;
  out[0] = out0;
  out[1] = out1;
  out[2] = out2;
  out[3] = 0;
  out[4] = out4;
  out[5] = out5;
  out[6] = out6;
  out[7] = 0;
  out[8] = out8;
  out[9] = out9;
  out[10] = out10;
  out[11] = 0;
  out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);
  out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);
  out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);
  out[15] = 1;
  return out;
}
/**
 * Calculates a 4x4 matrix from the given quaternion
 *
 * @param {mat4} out mat4 receiving operation result
 * @param {ReadonlyQuat} q Quaternion to create matrix from
 *
 * @returns {mat4} out
 */


function fromQuat(out, q) {
  var x = q[0],
      y = q[1],
      z = q[2],
      w = q[3];
  var x2 = x + x;
  var y2 = y + y;
  var z2 = z + z;
  var xx = x * x2;
  var yx = y * x2;
  var yy = y * y2;
  var zx = z * x2;
  var zy = z * y2;
  var zz = z * z2;
  var wx = w * x2;
  var wy = w * y2;
  var wz = w * z2;
  out[0] = 1 - yy - zz;
  out[1] = yx + wz;
  out[2] = zx - wy;
  out[3] = 0;
  out[4] = yx - wz;
  out[5] = 1 - xx - zz;
  out[6] = zy + wx;
  out[7] = 0;
  out[8] = zx + wy;
  out[9] = zy - wx;
  out[10] = 1 - xx - yy;
  out[11] = 0;
  out[12] = 0;
  out[13] = 0;
  out[14] = 0;
  out[15] = 1;
  return out;
}
/**
 * Generates a frustum matrix with the given bounds
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {Number} left Left bound of the frustum
 * @param {Number} right Right bound of the frustum
 * @param {Number} bottom Bottom bound of the frustum
 * @param {Number} top Top bound of the frustum
 * @param {Number} near Near bound of the frustum
 * @param {Number} far Far bound of the frustum
 * @returns {mat4} out
 */


function frustum(out, left, right, bottom, top, near, far) {
  var rl = 1 / (right - left);
  var tb = 1 / (top - bottom);
  var nf = 1 / (near - far);
  out[0] = near * 2 * rl;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = near * 2 * tb;
  out[6] = 0;
  out[7] = 0;
  out[8] = (right + left) * rl;
  out[9] = (top + bottom) * tb;
  out[10] = (far + near) * nf;
  out[11] = -1;
  out[12] = 0;
  out[13] = 0;
  out[14] = far * near * 2 * nf;
  out[15] = 0;
  return out;
}
/**
 * Generates a perspective projection matrix with the given bounds.
 * Passing null/undefined/no value for far will generate infinite projection matrix.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {number} fovy Vertical field of view in radians
 * @param {number} aspect Aspect ratio. typically viewport width/height
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum, can be null or Infinity
 * @returns {mat4} out
 */


function perspective(out, fovy, aspect, near, far) {
  var f = 1.0 / Math.tan(fovy / 2),
      nf;
  out[0] = f / aspect;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = f;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[11] = -1;
  out[12] = 0;
  out[13] = 0;
  out[15] = 0;

  if (far != null && far !== Infinity) {
    nf = 1 / (near - far);
    out[10] = (far + near) * nf;
    out[14] = 2 * far * near * nf;
  } else {
    out[10] = -1;
    out[14] = -2 * near;
  }

  return out;
}
/**
 * Generates a perspective projection matrix with the given field of view.
 * This is primarily useful for generating projection matrices to be used
 * with the still experiemental WebVR API.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum
 * @returns {mat4} out
 */


function perspectiveFromFieldOfView(out, fov, near, far) {
  var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);
  var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);
  var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);
  var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);
  var xScale = 2.0 / (leftTan + rightTan);
  var yScale = 2.0 / (upTan + downTan);
  out[0] = xScale;
  out[1] = 0.0;
  out[2] = 0.0;
  out[3] = 0.0;
  out[4] = 0.0;
  out[5] = yScale;
  out[6] = 0.0;
  out[7] = 0.0;
  out[8] = -((leftTan - rightTan) * xScale * 0.5);
  out[9] = (upTan - downTan) * yScale * 0.5;
  out[10] = far / (near - far);
  out[11] = -1.0;
  out[12] = 0.0;
  out[13] = 0.0;
  out[14] = far * near / (near - far);
  out[15] = 0.0;
  return out;
}
/**
 * Generates a orthogonal projection matrix with the given bounds
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {number} left Left bound of the frustum
 * @param {number} right Right bound of the frustum
 * @param {number} bottom Bottom bound of the frustum
 * @param {number} top Top bound of the frustum
 * @param {number} near Near bound of the frustum
 * @param {number} far Far bound of the frustum
 * @returns {mat4} out
 */


function ortho(out, left, right, bottom, top, near, far) {
  var lr = 1 / (left - right);
  var bt = 1 / (bottom - top);
  var nf = 1 / (near - far);
  out[0] = -2 * lr;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = -2 * bt;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 2 * nf;
  out[11] = 0;
  out[12] = (left + right) * lr;
  out[13] = (top + bottom) * bt;
  out[14] = (far + near) * nf;
  out[15] = 1;
  return out;
}
/**
 * Generates a look-at matrix with the given eye position, focal point, and up axis.
 * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {ReadonlyVec3} eye Position of the viewer
 * @param {ReadonlyVec3} center Point the viewer is looking at
 * @param {ReadonlyVec3} up vec3 pointing up
 * @returns {mat4} out
 */


function lookAt(out, eye, center, up) {
  var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
  var eyex = eye[0];
  var eyey = eye[1];
  var eyez = eye[2];
  var upx = up[0];
  var upy = up[1];
  var upz = up[2];
  var centerx = center[0];
  var centery = center[1];
  var centerz = center[2];

  if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {
    return identity(out);
  }

  z0 = eyex - centerx;
  z1 = eyey - centery;
  z2 = eyez - centerz;
  len = 1 / Math.hypot(z0, z1, z2);
  z0 *= len;
  z1 *= len;
  z2 *= len;
  x0 = upy * z2 - upz * z1;
  x1 = upz * z0 - upx * z2;
  x2 = upx * z1 - upy * z0;
  len = Math.hypot(x0, x1, x2);

  if (!len) {
    x0 = 0;
    x1 = 0;
    x2 = 0;
  } else {
    len = 1 / len;
    x0 *= len;
    x1 *= len;
    x2 *= len;
  }

  y0 = z1 * x2 - z2 * x1;
  y1 = z2 * x0 - z0 * x2;
  y2 = z0 * x1 - z1 * x0;
  len = Math.hypot(y0, y1, y2);

  if (!len) {
    y0 = 0;
    y1 = 0;
    y2 = 0;
  } else {
    len = 1 / len;
    y0 *= len;
    y1 *= len;
    y2 *= len;
  }

  out[0] = x0;
  out[1] = y0;
  out[2] = z0;
  out[3] = 0;
  out[4] = x1;
  out[5] = y1;
  out[6] = z1;
  out[7] = 0;
  out[8] = x2;
  out[9] = y2;
  out[10] = z2;
  out[11] = 0;
  out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
  out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
  out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
  out[15] = 1;
  return out;
}
/**
 * Generates a matrix that makes something look at something else.
 *
 * @param {mat4} out mat4 frustum matrix will be written into
 * @param {ReadonlyVec3} eye Position of the viewer
 * @param {ReadonlyVec3} center Point the viewer is looking at
 * @param {ReadonlyVec3} up vec3 pointing up
 * @returns {mat4} out
 */


function targetTo(out, eye, target, up) {
  var eyex = eye[0],
      eyey = eye[1],
      eyez = eye[2],
      upx = up[0],
      upy = up[1],
      upz = up[2];
  var z0 = eyex - target[0],
      z1 = eyey - target[1],
      z2 = eyez - target[2];
  var len = z0 * z0 + z1 * z1 + z2 * z2;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
    z0 *= len;
    z1 *= len;
    z2 *= len;
  }

  var x0 = upy * z2 - upz * z1,
      x1 = upz * z0 - upx * z2,
      x2 = upx * z1 - upy * z0;
  len = x0 * x0 + x1 * x1 + x2 * x2;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
    x0 *= len;
    x1 *= len;
    x2 *= len;
  }

  out[0] = x0;
  out[1] = x1;
  out[2] = x2;
  out[3] = 0;
  out[4] = z1 * x2 - z2 * x1;
  out[5] = z2 * x0 - z0 * x2;
  out[6] = z0 * x1 - z1 * x0;
  out[7] = 0;
  out[8] = z0;
  out[9] = z1;
  out[10] = z2;
  out[11] = 0;
  out[12] = eyex;
  out[13] = eyey;
  out[14] = eyez;
  out[15] = 1;
  return out;
}
/**
 * Returns a string representation of a mat4
 *
 * @param {ReadonlyMat4} a matrix to represent as a string
 * @returns {String} string representation of the matrix
 */


function str(a) {
  return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")";
}
/**
 * Returns Frobenius norm of a mat4
 *
 * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of
 * @returns {Number} Frobenius norm
 */


function frob(a) {
  return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);
}
/**
 * Adds two mat4's
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the first operand
 * @param {ReadonlyMat4} b the second operand
 * @returns {mat4} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  out[6] = a[6] + b[6];
  out[7] = a[7] + b[7];
  out[8] = a[8] + b[8];
  out[9] = a[9] + b[9];
  out[10] = a[10] + b[10];
  out[11] = a[11] + b[11];
  out[12] = a[12] + b[12];
  out[13] = a[13] + b[13];
  out[14] = a[14] + b[14];
  out[15] = a[15] + b[15];
  return out;
}
/**
 * Subtracts matrix b from matrix a
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the first operand
 * @param {ReadonlyMat4} b the second operand
 * @returns {mat4} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  out[4] = a[4] - b[4];
  out[5] = a[5] - b[5];
  out[6] = a[6] - b[6];
  out[7] = a[7] - b[7];
  out[8] = a[8] - b[8];
  out[9] = a[9] - b[9];
  out[10] = a[10] - b[10];
  out[11] = a[11] - b[11];
  out[12] = a[12] - b[12];
  out[13] = a[13] - b[13];
  out[14] = a[14] - b[14];
  out[15] = a[15] - b[15];
  return out;
}
/**
 * Multiply each element of the matrix by a scalar.
 *
 * @param {mat4} out the receiving matrix
 * @param {ReadonlyMat4} a the matrix to scale
 * @param {Number} b amount to scale the matrix's elements by
 * @returns {mat4} out
 */


function multiplyScalar(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  out[6] = a[6] * b;
  out[7] = a[7] * b;
  out[8] = a[8] * b;
  out[9] = a[9] * b;
  out[10] = a[10] * b;
  out[11] = a[11] * b;
  out[12] = a[12] * b;
  out[13] = a[13] * b;
  out[14] = a[14] * b;
  out[15] = a[15] * b;
  return out;
}
/**
 * Adds two mat4's after multiplying each element of the second operand by a scalar value.
 *
 * @param {mat4} out the receiving vector
 * @param {ReadonlyMat4} a the first operand
 * @param {ReadonlyMat4} b the second operand
 * @param {Number} scale the amount to scale b's elements by before adding
 * @returns {mat4} out
 */


function multiplyScalarAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  out[4] = a[4] + b[4] * scale;
  out[5] = a[5] + b[5] * scale;
  out[6] = a[6] + b[6] * scale;
  out[7] = a[7] + b[7] * scale;
  out[8] = a[8] + b[8] * scale;
  out[9] = a[9] + b[9] * scale;
  out[10] = a[10] + b[10] * scale;
  out[11] = a[11] + b[11] * scale;
  out[12] = a[12] + b[12] * scale;
  out[13] = a[13] + b[13] * scale;
  out[14] = a[14] + b[14] * scale;
  out[15] = a[15] + b[15] * scale;
  return out;
}
/**
 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyMat4} a The first matrix.
 * @param {ReadonlyMat4} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];
}
/**
 * Returns whether or not the matrices have approximately the same elements in the same position.
 *
 * @param {ReadonlyMat4} a The first matrix.
 * @param {ReadonlyMat4} b The second matrix.
 * @returns {Boolean} True if the matrices are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var a4 = a[4],
      a5 = a[5],
      a6 = a[6],
      a7 = a[7];
  var a8 = a[8],
      a9 = a[9],
      a10 = a[10],
      a11 = a[11];
  var a12 = a[12],
      a13 = a[13],
      a14 = a[14],
      a15 = a[15];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  var b4 = b[4],
      b5 = b[5],
      b6 = b[6],
      b7 = b[7];
  var b8 = b[8],
      b9 = b[9],
      b10 = b[10],
      b11 = b[11];
  var b12 = b[12],
      b13 = b[13],
      b14 = b[14],
      b15 = b[15];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));
}
/**
 * Alias for {@link mat4.multiply}
 * @function
 */


var mul = multiply;
/**
 * Alias for {@link mat4.subtract}
 * @function
 */

exports.mul = mul;
var sub = subtract;
exports.sub = sub;
},{"./common.js":882}],888:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.identity = identity;
exports.setAxisAngle = setAxisAngle;
exports.getAxisAngle = getAxisAngle;
exports.getAngle = getAngle;
exports.multiply = multiply;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.calculateW = calculateW;
exports.exp = exp;
exports.ln = ln;
exports.pow = pow;
exports.slerp = slerp;
exports.random = random;
exports.invert = invert;
exports.conjugate = conjugate;
exports.fromMat3 = fromMat3;
exports.fromEuler = fromEuler;
exports.str = str;
exports.setAxes = exports.sqlerp = exports.rotationTo = exports.equals = exports.exactEquals = exports.normalize = exports.sqrLen = exports.squaredLength = exports.len = exports.length = exports.lerp = exports.dot = exports.scale = exports.mul = exports.add = exports.set = exports.copy = exports.fromValues = exports.clone = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

var mat3 = _interopRequireWildcard(require("./mat3.js"));

var vec3 = _interopRequireWildcard(require("./vec3.js"));

var vec4 = _interopRequireWildcard(require("./vec4.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Quaternion
 * @module quat
 */

/**
 * Creates a new identity quat
 *
 * @returns {quat} a new quaternion
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(4);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
  }

  out[3] = 1;
  return out;
}
/**
 * Set a quat to the identity quaternion
 *
 * @param {quat} out the receiving quaternion
 * @returns {quat} out
 */


function identity(out) {
  out[0] = 0;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  return out;
}
/**
 * Sets a quat from the given angle and rotation axis,
 * then returns it.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyVec3} axis the axis around which to rotate
 * @param {Number} rad the angle in radians
 * @returns {quat} out
 **/


function setAxisAngle(out, axis, rad) {
  rad = rad * 0.5;
  var s = Math.sin(rad);
  out[0] = s * axis[0];
  out[1] = s * axis[1];
  out[2] = s * axis[2];
  out[3] = Math.cos(rad);
  return out;
}
/**
 * Gets the rotation axis and angle for a given
 *  quaternion. If a quaternion is created with
 *  setAxisAngle, this method will return the same
 *  values as providied in the original parameter list
 *  OR functionally equivalent values.
 * Example: The quaternion formed by axis [0, 0, 1] and
 *  angle -90 is the same as the quaternion formed by
 *  [0, 0, 1] and 270. This method favors the latter.
 * @param  {vec3} out_axis  Vector receiving the axis of rotation
 * @param  {ReadonlyQuat} q     Quaternion to be decomposed
 * @return {Number}     Angle, in radians, of the rotation
 */


function getAxisAngle(out_axis, q) {
  var rad = Math.acos(q[3]) * 2.0;
  var s = Math.sin(rad / 2.0);

  if (s > glMatrix.EPSILON) {
    out_axis[0] = q[0] / s;
    out_axis[1] = q[1] / s;
    out_axis[2] = q[2] / s;
  } else {
    // If s is zero, return any axis (no rotation - axis does not matter)
    out_axis[0] = 1;
    out_axis[1] = 0;
    out_axis[2] = 0;
  }

  return rad;
}
/**
 * Gets the angular distance between two unit quaternions
 *
 * @param  {ReadonlyQuat} a     Origin unit quaternion
 * @param  {ReadonlyQuat} b     Destination unit quaternion
 * @return {Number}     Angle, in radians, between the two quaternions
 */


function getAngle(a, b) {
  var dotproduct = dot(a, b);
  return Math.acos(2 * dotproduct * dotproduct - 1);
}
/**
 * Multiplies two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @returns {quat} out
 */


function multiply(out, a, b) {
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = b[0],
      by = b[1],
      bz = b[2],
      bw = b[3];
  out[0] = ax * bw + aw * bx + ay * bz - az * by;
  out[1] = ay * bw + aw * by + az * bx - ax * bz;
  out[2] = az * bw + aw * bz + ax * by - ay * bx;
  out[3] = aw * bw - ax * bx - ay * by - az * bz;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the X axis
 *
 * @param {quat} out quat receiving operation result
 * @param {ReadonlyQuat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateX(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw + aw * bx;
  out[1] = ay * bw + az * bx;
  out[2] = az * bw - ay * bx;
  out[3] = aw * bw - ax * bx;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the Y axis
 *
 * @param {quat} out quat receiving operation result
 * @param {ReadonlyQuat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateY(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var by = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw - az * by;
  out[1] = ay * bw + aw * by;
  out[2] = az * bw + ax * by;
  out[3] = aw * bw - ay * by;
  return out;
}
/**
 * Rotates a quaternion by the given angle about the Z axis
 *
 * @param {quat} out quat receiving operation result
 * @param {ReadonlyQuat} a quat to rotate
 * @param {number} rad angle (in radians) to rotate
 * @returns {quat} out
 */


function rotateZ(out, a, rad) {
  rad *= 0.5;
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bz = Math.sin(rad),
      bw = Math.cos(rad);
  out[0] = ax * bw + ay * bz;
  out[1] = ay * bw - ax * bz;
  out[2] = az * bw + aw * bz;
  out[3] = aw * bw - az * bz;
  return out;
}
/**
 * Calculates the W component of a quat from the X, Y, and Z components.
 * Assumes that quaternion is 1 unit in length.
 * Any existing W component will be ignored.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate W component of
 * @returns {quat} out
 */


function calculateW(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2];
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
  return out;
}
/**
 * Calculate the exponential of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate the exponential of
 * @returns {quat} out
 */


function exp(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  var r = Math.sqrt(x * x + y * y + z * z);
  var et = Math.exp(w);
  var s = r > 0 ? et * Math.sin(r) / r : 0;
  out[0] = x * s;
  out[1] = y * s;
  out[2] = z * s;
  out[3] = et * Math.cos(r);
  return out;
}
/**
 * Calculate the natural logarithm of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate the exponential of
 * @returns {quat} out
 */


function ln(out, a) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  var r = Math.sqrt(x * x + y * y + z * z);
  var t = r > 0 ? Math.atan2(r, w) / r : 0;
  out[0] = x * t;
  out[1] = y * t;
  out[2] = z * t;
  out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);
  return out;
}
/**
 * Calculate the scalar power of a unit quaternion.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate the exponential of
 * @param {Number} b amount to scale the quaternion by
 * @returns {quat} out
 */


function pow(out, a, b) {
  ln(out, a);
  scale(out, out, b);
  exp(out, out);
  return out;
}
/**
 * Performs a spherical linear interpolation between two quat
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 */


function slerp(out, a, b, t) {
  // benchmarks:
  //    http://jsperf.com/quaternion-slerp-implementations
  var ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  var bx = b[0],
      by = b[1],
      bz = b[2],
      bw = b[3];
  var omega, cosom, sinom, scale0, scale1; // calc cosine

  cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)

  if (cosom < 0.0) {
    cosom = -cosom;
    bx = -bx;
    by = -by;
    bz = -bz;
    bw = -bw;
  } // calculate coefficients


  if (1.0 - cosom > glMatrix.EPSILON) {
    // standard case (slerp)
    omega = Math.acos(cosom);
    sinom = Math.sin(omega);
    scale0 = Math.sin((1.0 - t) * omega) / sinom;
    scale1 = Math.sin(t * omega) / sinom;
  } else {
    // "from" and "to" quaternions are very close
    //  ... so we can do a linear interpolation
    scale0 = 1.0 - t;
    scale1 = t;
  } // calculate final values


  out[0] = scale0 * ax + scale1 * bx;
  out[1] = scale0 * ay + scale1 * by;
  out[2] = scale0 * az + scale1 * bz;
  out[3] = scale0 * aw + scale1 * bw;
  return out;
}
/**
 * Generates a random unit quaternion
 *
 * @param {quat} out the receiving quaternion
 * @returns {quat} out
 */


function random(out) {
  // Implementation of http://planning.cs.uiuc.edu/node198.html
  // TODO: Calling random 3 times is probably not the fastest solution
  var u1 = glMatrix.RANDOM();
  var u2 = glMatrix.RANDOM();
  var u3 = glMatrix.RANDOM();
  var sqrt1MinusU1 = Math.sqrt(1 - u1);
  var sqrtU1 = Math.sqrt(u1);
  out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);
  out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);
  out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);
  out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);
  return out;
}
/**
 * Calculates the inverse of a quat
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate inverse of
 * @returns {quat} out
 */


function invert(out, a) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;
  var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0

  out[0] = -a0 * invDot;
  out[1] = -a1 * invDot;
  out[2] = -a2 * invDot;
  out[3] = a3 * invDot;
  return out;
}
/**
 * Calculates the conjugate of a quat
 * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quat to calculate conjugate of
 * @returns {quat} out
 */


function conjugate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = a[3];
  return out;
}
/**
 * Creates a quaternion from the given 3x3 rotation matrix.
 *
 * NOTE: The resultant quaternion is not normalized, so you should be sure
 * to renormalize the quaternion yourself where necessary.
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyMat3} m rotation matrix
 * @returns {quat} out
 * @function
 */


function fromMat3(out, m) {
  // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
  // article "Quaternion Calculus and Fast Animation".
  var fTrace = m[0] + m[4] + m[8];
  var fRoot;

  if (fTrace > 0.0) {
    // |w| > 1/2, may as well choose w > 1/2
    fRoot = Math.sqrt(fTrace + 1.0); // 2w

    out[3] = 0.5 * fRoot;
    fRoot = 0.5 / fRoot; // 1/(4w)

    out[0] = (m[5] - m[7]) * fRoot;
    out[1] = (m[6] - m[2]) * fRoot;
    out[2] = (m[1] - m[3]) * fRoot;
  } else {
    // |w| <= 1/2
    var i = 0;
    if (m[4] > m[0]) i = 1;
    if (m[8] > m[i * 3 + i]) i = 2;
    var j = (i + 1) % 3;
    var k = (i + 2) % 3;
    fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);
    out[i] = 0.5 * fRoot;
    fRoot = 0.5 / fRoot;
    out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;
    out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;
    out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;
  }

  return out;
}
/**
 * Creates a quaternion from the given euler angle x, y, z.
 *
 * @param {quat} out the receiving quaternion
 * @param {x} Angle to rotate around X axis in degrees.
 * @param {y} Angle to rotate around Y axis in degrees.
 * @param {z} Angle to rotate around Z axis in degrees.
 * @returns {quat} out
 * @function
 */


function fromEuler(out, x, y, z) {
  var halfToRad = 0.5 * Math.PI / 180.0;
  x *= halfToRad;
  y *= halfToRad;
  z *= halfToRad;
  var sx = Math.sin(x);
  var cx = Math.cos(x);
  var sy = Math.sin(y);
  var cy = Math.cos(y);
  var sz = Math.sin(z);
  var cz = Math.cos(z);
  out[0] = sx * cy * cz - cx * sy * sz;
  out[1] = cx * sy * cz + sx * cy * sz;
  out[2] = cx * cy * sz - sx * sy * cz;
  out[3] = cx * cy * cz + sx * sy * sz;
  return out;
}
/**
 * Returns a string representation of a quatenion
 *
 * @param {ReadonlyQuat} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")";
}
/**
 * Creates a new quat initialized with values from an existing quaternion
 *
 * @param {ReadonlyQuat} a quaternion to clone
 * @returns {quat} a new quaternion
 * @function
 */


var clone = vec4.clone;
/**
 * Creates a new quat initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {quat} a new quaternion
 * @function
 */

exports.clone = clone;
var fromValues = vec4.fromValues;
/**
 * Copy the values from one quat to another
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the source quaternion
 * @returns {quat} out
 * @function
 */

exports.fromValues = fromValues;
var copy = vec4.copy;
/**
 * Set the components of a quat to the given values
 *
 * @param {quat} out the receiving quaternion
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {quat} out
 * @function
 */

exports.copy = copy;
var set = vec4.set;
/**
 * Adds two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @returns {quat} out
 * @function
 */

exports.set = set;
var add = vec4.add;
/**
 * Alias for {@link quat.multiply}
 * @function
 */

exports.add = add;
var mul = multiply;
/**
 * Scales a quat by a scalar number
 *
 * @param {quat} out the receiving vector
 * @param {ReadonlyQuat} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {quat} out
 * @function
 */

exports.mul = mul;
var scale = vec4.scale;
/**
 * Calculates the dot product of two quat's
 *
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @returns {Number} dot product of a and b
 * @function
 */

exports.scale = scale;
var dot = vec4.dot;
/**
 * Performs a linear interpolation between two quat's
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 * @function
 */

exports.dot = dot;
var lerp = vec4.lerp;
/**
 * Calculates the length of a quat
 *
 * @param {ReadonlyQuat} a vector to calculate length of
 * @returns {Number} length of a
 */

exports.lerp = lerp;
var length = vec4.length;
/**
 * Alias for {@link quat.length}
 * @function
 */

exports.length = length;
var len = length;
/**
 * Calculates the squared length of a quat
 *
 * @param {ReadonlyQuat} a vector to calculate squared length of
 * @returns {Number} squared length of a
 * @function
 */

exports.len = len;
var squaredLength = vec4.squaredLength;
/**
 * Alias for {@link quat.squaredLength}
 * @function
 */

exports.squaredLength = squaredLength;
var sqrLen = squaredLength;
/**
 * Normalize a quat
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a quaternion to normalize
 * @returns {quat} out
 * @function
 */

exports.sqrLen = sqrLen;
var normalize = vec4.normalize;
/**
 * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyQuat} a The first quaternion.
 * @param {ReadonlyQuat} b The second quaternion.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */

exports.normalize = normalize;
var exactEquals = vec4.exactEquals;
/**
 * Returns whether or not the quaternions have approximately the same elements in the same position.
 *
 * @param {ReadonlyQuat} a The first vector.
 * @param {ReadonlyQuat} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */

exports.exactEquals = exactEquals;
var equals = vec4.equals;
/**
 * Sets a quaternion to represent the shortest rotation from one
 * vector to another.
 *
 * Both vectors are assumed to be unit length.
 *
 * @param {quat} out the receiving quaternion.
 * @param {ReadonlyVec3} a the initial vector
 * @param {ReadonlyVec3} b the destination vector
 * @returns {quat} out
 */

exports.equals = equals;

var rotationTo = function () {
  var tmpvec3 = vec3.create();
  var xUnitVec3 = vec3.fromValues(1, 0, 0);
  var yUnitVec3 = vec3.fromValues(0, 1, 0);
  return function (out, a, b) {
    var dot = vec3.dot(a, b);

    if (dot < -0.999999) {
      vec3.cross(tmpvec3, xUnitVec3, a);
      if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);
      vec3.normalize(tmpvec3, tmpvec3);
      setAxisAngle(out, tmpvec3, Math.PI);
      return out;
    } else if (dot > 0.999999) {
      out[0] = 0;
      out[1] = 0;
      out[2] = 0;
      out[3] = 1;
      return out;
    } else {
      vec3.cross(tmpvec3, a, b);
      out[0] = tmpvec3[0];
      out[1] = tmpvec3[1];
      out[2] = tmpvec3[2];
      out[3] = 1 + dot;
      return normalize(out, out);
    }
  };
}();
/**
 * Performs a spherical linear interpolation with two control points
 *
 * @param {quat} out the receiving quaternion
 * @param {ReadonlyQuat} a the first operand
 * @param {ReadonlyQuat} b the second operand
 * @param {ReadonlyQuat} c the third operand
 * @param {ReadonlyQuat} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat} out
 */


exports.rotationTo = rotationTo;

var sqlerp = function () {
  var temp1 = create();
  var temp2 = create();
  return function (out, a, b, c, d, t) {
    slerp(temp1, a, d, t);
    slerp(temp2, b, c, t);
    slerp(out, temp1, temp2, 2 * t * (1 - t));
    return out;
  };
}();
/**
 * Sets the specified quaternion with values corresponding to the given
 * axes. Each axis is a vec3 and is expected to be unit length and
 * perpendicular to all other specified axes.
 *
 * @param {ReadonlyVec3} view  the vector representing the viewing direction
 * @param {ReadonlyVec3} right the vector representing the local "right" direction
 * @param {ReadonlyVec3} up    the vector representing the local "up" direction
 * @returns {quat} out
 */


exports.sqlerp = sqlerp;

var setAxes = function () {
  var matr = mat3.create();
  return function (out, view, right, up) {
    matr[0] = right[0];
    matr[3] = right[1];
    matr[6] = right[2];
    matr[1] = up[0];
    matr[4] = up[1];
    matr[7] = up[2];
    matr[2] = -view[0];
    matr[5] = -view[1];
    matr[8] = -view[2];
    return normalize(out, fromMat3(out, matr));
  };
}();

exports.setAxes = setAxes;
},{"./common.js":882,"./mat3.js":886,"./vec3.js":891,"./vec4.js":892}],889:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.fromValues = fromValues;
exports.fromRotationTranslationValues = fromRotationTranslationValues;
exports.fromRotationTranslation = fromRotationTranslation;
exports.fromTranslation = fromTranslation;
exports.fromRotation = fromRotation;
exports.fromMat4 = fromMat4;
exports.copy = copy;
exports.identity = identity;
exports.set = set;
exports.getDual = getDual;
exports.setDual = setDual;
exports.getTranslation = getTranslation;
exports.translate = translate;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.rotateByQuatAppend = rotateByQuatAppend;
exports.rotateByQuatPrepend = rotateByQuatPrepend;
exports.rotateAroundAxis = rotateAroundAxis;
exports.add = add;
exports.multiply = multiply;
exports.scale = scale;
exports.lerp = lerp;
exports.invert = invert;
exports.conjugate = conjugate;
exports.normalize = normalize;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.sqrLen = exports.squaredLength = exports.len = exports.length = exports.dot = exports.mul = exports.setReal = exports.getReal = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

var quat = _interopRequireWildcard(require("./quat.js"));

var mat4 = _interopRequireWildcard(require("./mat4.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * Dual Quaternion<br>
 * Format: [real, dual]<br>
 * Quaternion format: XYZW<br>
 * Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.<br>
 * @module quat2
 */

/**
 * Creates a new identity dual quat
 *
 * @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation]
 */
function create() {
  var dq = new glMatrix.ARRAY_TYPE(8);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    dq[0] = 0;
    dq[1] = 0;
    dq[2] = 0;
    dq[4] = 0;
    dq[5] = 0;
    dq[6] = 0;
    dq[7] = 0;
  }

  dq[3] = 1;
  return dq;
}
/**
 * Creates a new quat initialized with values from an existing quaternion
 *
 * @param {ReadonlyQuat2} a dual quaternion to clone
 * @returns {quat2} new dual quaternion
 * @function
 */


function clone(a) {
  var dq = new glMatrix.ARRAY_TYPE(8);
  dq[0] = a[0];
  dq[1] = a[1];
  dq[2] = a[2];
  dq[3] = a[3];
  dq[4] = a[4];
  dq[5] = a[5];
  dq[6] = a[6];
  dq[7] = a[7];
  return dq;
}
/**
 * Creates a new dual quat initialized with the given values
 *
 * @param {Number} x1 X component
 * @param {Number} y1 Y component
 * @param {Number} z1 Z component
 * @param {Number} w1 W component
 * @param {Number} x2 X component
 * @param {Number} y2 Y component
 * @param {Number} z2 Z component
 * @param {Number} w2 W component
 * @returns {quat2} new dual quaternion
 * @function
 */


function fromValues(x1, y1, z1, w1, x2, y2, z2, w2) {
  var dq = new glMatrix.ARRAY_TYPE(8);
  dq[0] = x1;
  dq[1] = y1;
  dq[2] = z1;
  dq[3] = w1;
  dq[4] = x2;
  dq[5] = y2;
  dq[6] = z2;
  dq[7] = w2;
  return dq;
}
/**
 * Creates a new dual quat from the given values (quat and translation)
 *
 * @param {Number} x1 X component
 * @param {Number} y1 Y component
 * @param {Number} z1 Z component
 * @param {Number} w1 W component
 * @param {Number} x2 X component (translation)
 * @param {Number} y2 Y component (translation)
 * @param {Number} z2 Z component (translation)
 * @returns {quat2} new dual quaternion
 * @function
 */


function fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {
  var dq = new glMatrix.ARRAY_TYPE(8);
  dq[0] = x1;
  dq[1] = y1;
  dq[2] = z1;
  dq[3] = w1;
  var ax = x2 * 0.5,
      ay = y2 * 0.5,
      az = z2 * 0.5;
  dq[4] = ax * w1 + ay * z1 - az * y1;
  dq[5] = ay * w1 + az * x1 - ax * z1;
  dq[6] = az * w1 + ax * y1 - ay * x1;
  dq[7] = -ax * x1 - ay * y1 - az * z1;
  return dq;
}
/**
 * Creates a dual quat from a quaternion and a translation
 *
 * @param {ReadonlyQuat2} dual quaternion receiving operation result
 * @param {ReadonlyQuat} q a normalized quaternion
 * @param {ReadonlyVec3} t tranlation vector
 * @returns {quat2} dual quaternion receiving operation result
 * @function
 */


function fromRotationTranslation(out, q, t) {
  var ax = t[0] * 0.5,
      ay = t[1] * 0.5,
      az = t[2] * 0.5,
      bx = q[0],
      by = q[1],
      bz = q[2],
      bw = q[3];
  out[0] = bx;
  out[1] = by;
  out[2] = bz;
  out[3] = bw;
  out[4] = ax * bw + ay * bz - az * by;
  out[5] = ay * bw + az * bx - ax * bz;
  out[6] = az * bw + ax * by - ay * bx;
  out[7] = -ax * bx - ay * by - az * bz;
  return out;
}
/**
 * Creates a dual quat from a translation
 *
 * @param {ReadonlyQuat2} dual quaternion receiving operation result
 * @param {ReadonlyVec3} t translation vector
 * @returns {quat2} dual quaternion receiving operation result
 * @function
 */


function fromTranslation(out, t) {
  out[0] = 0;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = t[0] * 0.5;
  out[5] = t[1] * 0.5;
  out[6] = t[2] * 0.5;
  out[7] = 0;
  return out;
}
/**
 * Creates a dual quat from a quaternion
 *
 * @param {ReadonlyQuat2} dual quaternion receiving operation result
 * @param {ReadonlyQuat} q the quaternion
 * @returns {quat2} dual quaternion receiving operation result
 * @function
 */


function fromRotation(out, q) {
  out[0] = q[0];
  out[1] = q[1];
  out[2] = q[2];
  out[3] = q[3];
  out[4] = 0;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  return out;
}
/**
 * Creates a new dual quat from a matrix (4x4)
 *
 * @param {quat2} out the dual quaternion
 * @param {ReadonlyMat4} a the matrix
 * @returns {quat2} dual quat receiving operation result
 * @function
 */


function fromMat4(out, a) {
  //TODO Optimize this
  var outer = quat.create();
  mat4.getRotation(outer, a);
  var t = new glMatrix.ARRAY_TYPE(3);
  mat4.getTranslation(t, a);
  fromRotationTranslation(out, outer, t);
  return out;
}
/**
 * Copy the values from one dual quat to another
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the source dual quaternion
 * @returns {quat2} out
 * @function
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4];
  out[5] = a[5];
  out[6] = a[6];
  out[7] = a[7];
  return out;
}
/**
 * Set a dual quat to the identity dual quaternion
 *
 * @param {quat2} out the receiving quaternion
 * @returns {quat2} out
 */


function identity(out) {
  out[0] = 0;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = 0;
  out[5] = 0;
  out[6] = 0;
  out[7] = 0;
  return out;
}
/**
 * Set the components of a dual quat to the given values
 *
 * @param {quat2} out the receiving quaternion
 * @param {Number} x1 X component
 * @param {Number} y1 Y component
 * @param {Number} z1 Z component
 * @param {Number} w1 W component
 * @param {Number} x2 X component
 * @param {Number} y2 Y component
 * @param {Number} z2 Z component
 * @param {Number} w2 W component
 * @returns {quat2} out
 * @function
 */


function set(out, x1, y1, z1, w1, x2, y2, z2, w2) {
  out[0] = x1;
  out[1] = y1;
  out[2] = z1;
  out[3] = w1;
  out[4] = x2;
  out[5] = y2;
  out[6] = z2;
  out[7] = w2;
  return out;
}
/**
 * Gets the real part of a dual quat
 * @param  {quat} out real part
 * @param  {ReadonlyQuat2} a Dual Quaternion
 * @return {quat} real part
 */


var getReal = quat.copy;
/**
 * Gets the dual part of a dual quat
 * @param  {quat} out dual part
 * @param  {ReadonlyQuat2} a Dual Quaternion
 * @return {quat} dual part
 */

exports.getReal = getReal;

function getDual(out, a) {
  out[0] = a[4];
  out[1] = a[5];
  out[2] = a[6];
  out[3] = a[7];
  return out;
}
/**
 * Set the real component of a dual quat to the given quaternion
 *
 * @param {quat2} out the receiving quaternion
 * @param {ReadonlyQuat} q a quaternion representing the real part
 * @returns {quat2} out
 * @function
 */


var setReal = quat.copy;
/**
 * Set the dual component of a dual quat to the given quaternion
 *
 * @param {quat2} out the receiving quaternion
 * @param {ReadonlyQuat} q a quaternion representing the dual part
 * @returns {quat2} out
 * @function
 */

exports.setReal = setReal;

function setDual(out, q) {
  out[4] = q[0];
  out[5] = q[1];
  out[6] = q[2];
  out[7] = q[3];
  return out;
}
/**
 * Gets the translation of a normalized dual quat
 * @param  {vec3} out translation
 * @param  {ReadonlyQuat2} a Dual Quaternion to be decomposed
 * @return {vec3} translation
 */


function getTranslation(out, a) {
  var ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7],
      bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3];
  out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
  out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
  out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
  return out;
}
/**
 * Translates a dual quat by the given vector
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to translate
 * @param {ReadonlyVec3} v vector to translate by
 * @returns {quat2} out
 */


function translate(out, a, v) {
  var ax1 = a[0],
      ay1 = a[1],
      az1 = a[2],
      aw1 = a[3],
      bx1 = v[0] * 0.5,
      by1 = v[1] * 0.5,
      bz1 = v[2] * 0.5,
      ax2 = a[4],
      ay2 = a[5],
      az2 = a[6],
      aw2 = a[7];
  out[0] = ax1;
  out[1] = ay1;
  out[2] = az1;
  out[3] = aw1;
  out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;
  out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;
  out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;
  out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;
  return out;
}
/**
 * Rotates a dual quat around the X axis
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @param {number} rad how far should the rotation be
 * @returns {quat2} out
 */


function rotateX(out, a, rad) {
  var bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3],
      ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7],
      ax1 = ax * bw + aw * bx + ay * bz - az * by,
      ay1 = ay * bw + aw * by + az * bx - ax * bz,
      az1 = az * bw + aw * bz + ax * by - ay * bx,
      aw1 = aw * bw - ax * bx - ay * by - az * bz;
  quat.rotateX(out, a, rad);
  bx = out[0];
  by = out[1];
  bz = out[2];
  bw = out[3];
  out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
  out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
  out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
  out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
  return out;
}
/**
 * Rotates a dual quat around the Y axis
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @param {number} rad how far should the rotation be
 * @returns {quat2} out
 */


function rotateY(out, a, rad) {
  var bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3],
      ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7],
      ax1 = ax * bw + aw * bx + ay * bz - az * by,
      ay1 = ay * bw + aw * by + az * bx - ax * bz,
      az1 = az * bw + aw * bz + ax * by - ay * bx,
      aw1 = aw * bw - ax * bx - ay * by - az * bz;
  quat.rotateY(out, a, rad);
  bx = out[0];
  by = out[1];
  bz = out[2];
  bw = out[3];
  out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
  out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
  out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
  out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
  return out;
}
/**
 * Rotates a dual quat around the Z axis
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @param {number} rad how far should the rotation be
 * @returns {quat2} out
 */


function rotateZ(out, a, rad) {
  var bx = -a[0],
      by = -a[1],
      bz = -a[2],
      bw = a[3],
      ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7],
      ax1 = ax * bw + aw * bx + ay * bz - az * by,
      ay1 = ay * bw + aw * by + az * bx - ax * bz,
      az1 = az * bw + aw * bz + ax * by - ay * bx,
      aw1 = aw * bw - ax * bx - ay * by - az * bz;
  quat.rotateZ(out, a, rad);
  bx = out[0];
  by = out[1];
  bz = out[2];
  bw = out[3];
  out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
  out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
  out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
  out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
  return out;
}
/**
 * Rotates a dual quat by a given quaternion (a * q)
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @param {ReadonlyQuat} q quaternion to rotate by
 * @returns {quat2} out
 */


function rotateByQuatAppend(out, a, q) {
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3],
      ax = a[0],
      ay = a[1],
      az = a[2],
      aw = a[3];
  out[0] = ax * qw + aw * qx + ay * qz - az * qy;
  out[1] = ay * qw + aw * qy + az * qx - ax * qz;
  out[2] = az * qw + aw * qz + ax * qy - ay * qx;
  out[3] = aw * qw - ax * qx - ay * qy - az * qz;
  ax = a[4];
  ay = a[5];
  az = a[6];
  aw = a[7];
  out[4] = ax * qw + aw * qx + ay * qz - az * qy;
  out[5] = ay * qw + aw * qy + az * qx - ax * qz;
  out[6] = az * qw + aw * qz + ax * qy - ay * qx;
  out[7] = aw * qw - ax * qx - ay * qy - az * qz;
  return out;
}
/**
 * Rotates a dual quat by a given quaternion (q * a)
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat} q quaternion to rotate by
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @returns {quat2} out
 */


function rotateByQuatPrepend(out, q, a) {
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3],
      bx = a[0],
      by = a[1],
      bz = a[2],
      bw = a[3];
  out[0] = qx * bw + qw * bx + qy * bz - qz * by;
  out[1] = qy * bw + qw * by + qz * bx - qx * bz;
  out[2] = qz * bw + qw * bz + qx * by - qy * bx;
  out[3] = qw * bw - qx * bx - qy * by - qz * bz;
  bx = a[4];
  by = a[5];
  bz = a[6];
  bw = a[7];
  out[4] = qx * bw + qw * bx + qy * bz - qz * by;
  out[5] = qy * bw + qw * by + qz * bx - qx * bz;
  out[6] = qz * bw + qw * bz + qx * by - qy * bx;
  out[7] = qw * bw - qx * bx - qy * by - qz * bz;
  return out;
}
/**
 * Rotates a dual quat around a given axis. Does the normalisation automatically
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the dual quaternion to rotate
 * @param {ReadonlyVec3} axis the axis to rotate around
 * @param {Number} rad how far the rotation should be
 * @returns {quat2} out
 */


function rotateAroundAxis(out, a, axis, rad) {
  //Special case for rad = 0
  if (Math.abs(rad) < glMatrix.EPSILON) {
    return copy(out, a);
  }

  var axisLength = Math.hypot(axis[0], axis[1], axis[2]);
  rad = rad * 0.5;
  var s = Math.sin(rad);
  var bx = s * axis[0] / axisLength;
  var by = s * axis[1] / axisLength;
  var bz = s * axis[2] / axisLength;
  var bw = Math.cos(rad);
  var ax1 = a[0],
      ay1 = a[1],
      az1 = a[2],
      aw1 = a[3];
  out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
  out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
  out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
  out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
  var ax = a[4],
      ay = a[5],
      az = a[6],
      aw = a[7];
  out[4] = ax * bw + aw * bx + ay * bz - az * by;
  out[5] = ay * bw + aw * by + az * bx - ax * bz;
  out[6] = az * bw + aw * bz + ax * by - ay * bx;
  out[7] = aw * bw - ax * bx - ay * by - az * bz;
  return out;
}
/**
 * Adds two dual quat's
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the first operand
 * @param {ReadonlyQuat2} b the second operand
 * @returns {quat2} out
 * @function
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  out[4] = a[4] + b[4];
  out[5] = a[5] + b[5];
  out[6] = a[6] + b[6];
  out[7] = a[7] + b[7];
  return out;
}
/**
 * Multiplies two dual quat's
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a the first operand
 * @param {ReadonlyQuat2} b the second operand
 * @returns {quat2} out
 */


function multiply(out, a, b) {
  var ax0 = a[0],
      ay0 = a[1],
      az0 = a[2],
      aw0 = a[3],
      bx1 = b[4],
      by1 = b[5],
      bz1 = b[6],
      bw1 = b[7],
      ax1 = a[4],
      ay1 = a[5],
      az1 = a[6],
      aw1 = a[7],
      bx0 = b[0],
      by0 = b[1],
      bz0 = b[2],
      bw0 = b[3];
  out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;
  out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;
  out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;
  out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;
  out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;
  out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;
  out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;
  out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;
  return out;
}
/**
 * Alias for {@link quat2.multiply}
 * @function
 */


var mul = multiply;
/**
 * Scales a dual quat by a scalar number
 *
 * @param {quat2} out the receiving dual quat
 * @param {ReadonlyQuat2} a the dual quat to scale
 * @param {Number} b amount to scale the dual quat by
 * @returns {quat2} out
 * @function
 */

exports.mul = mul;

function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  out[4] = a[4] * b;
  out[5] = a[5] * b;
  out[6] = a[6] * b;
  out[7] = a[7] * b;
  return out;
}
/**
 * Calculates the dot product of two dual quat's (The dot product of the real parts)
 *
 * @param {ReadonlyQuat2} a the first operand
 * @param {ReadonlyQuat2} b the second operand
 * @returns {Number} dot product of a and b
 * @function
 */


var dot = quat.dot;
/**
 * Performs a linear interpolation between two dual quats's
 * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)
 *
 * @param {quat2} out the receiving dual quat
 * @param {ReadonlyQuat2} a the first operand
 * @param {ReadonlyQuat2} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {quat2} out
 */

exports.dot = dot;

function lerp(out, a, b, t) {
  var mt = 1 - t;
  if (dot(a, b) < 0) t = -t;
  out[0] = a[0] * mt + b[0] * t;
  out[1] = a[1] * mt + b[1] * t;
  out[2] = a[2] * mt + b[2] * t;
  out[3] = a[3] * mt + b[3] * t;
  out[4] = a[4] * mt + b[4] * t;
  out[5] = a[5] * mt + b[5] * t;
  out[6] = a[6] * mt + b[6] * t;
  out[7] = a[7] * mt + b[7] * t;
  return out;
}
/**
 * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a dual quat to calculate inverse of
 * @returns {quat2} out
 */


function invert(out, a) {
  var sqlen = squaredLength(a);
  out[0] = -a[0] / sqlen;
  out[1] = -a[1] / sqlen;
  out[2] = -a[2] / sqlen;
  out[3] = a[3] / sqlen;
  out[4] = -a[4] / sqlen;
  out[5] = -a[5] / sqlen;
  out[6] = -a[6] / sqlen;
  out[7] = a[7] / sqlen;
  return out;
}
/**
 * Calculates the conjugate of a dual quat
 * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.
 *
 * @param {quat2} out the receiving quaternion
 * @param {ReadonlyQuat2} a quat to calculate conjugate of
 * @returns {quat2} out
 */


function conjugate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = a[3];
  out[4] = -a[4];
  out[5] = -a[5];
  out[6] = -a[6];
  out[7] = a[7];
  return out;
}
/**
 * Calculates the length of a dual quat
 *
 * @param {ReadonlyQuat2} a dual quat to calculate length of
 * @returns {Number} length of a
 * @function
 */


var length = quat.length;
/**
 * Alias for {@link quat2.length}
 * @function
 */

exports.length = length;
var len = length;
/**
 * Calculates the squared length of a dual quat
 *
 * @param {ReadonlyQuat2} a dual quat to calculate squared length of
 * @returns {Number} squared length of a
 * @function
 */

exports.len = len;
var squaredLength = quat.squaredLength;
/**
 * Alias for {@link quat2.squaredLength}
 * @function
 */

exports.squaredLength = squaredLength;
var sqrLen = squaredLength;
/**
 * Normalize a dual quat
 *
 * @param {quat2} out the receiving dual quaternion
 * @param {ReadonlyQuat2} a dual quaternion to normalize
 * @returns {quat2} out
 * @function
 */

exports.sqrLen = sqrLen;

function normalize(out, a) {
  var magnitude = squaredLength(a);

  if (magnitude > 0) {
    magnitude = Math.sqrt(magnitude);
    var a0 = a[0] / magnitude;
    var a1 = a[1] / magnitude;
    var a2 = a[2] / magnitude;
    var a3 = a[3] / magnitude;
    var b0 = a[4];
    var b1 = a[5];
    var b2 = a[6];
    var b3 = a[7];
    var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;
    out[0] = a0;
    out[1] = a1;
    out[2] = a2;
    out[3] = a3;
    out[4] = (b0 - a0 * a_dot_b) / magnitude;
    out[5] = (b1 - a1 * a_dot_b) / magnitude;
    out[6] = (b2 - a2 * a_dot_b) / magnitude;
    out[7] = (b3 - a3 * a_dot_b) / magnitude;
  }

  return out;
}
/**
 * Returns a string representation of a dual quatenion
 *
 * @param {ReadonlyQuat2} a dual quaternion to represent as a string
 * @returns {String} string representation of the dual quat
 */


function str(a) {
  return "quat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ")";
}
/**
 * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyQuat2} a the first dual quaternion.
 * @param {ReadonlyQuat2} b the second dual quaternion.
 * @returns {Boolean} true if the dual quaternions are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];
}
/**
 * Returns whether or not the dual quaternions have approximately the same elements in the same position.
 *
 * @param {ReadonlyQuat2} a the first dual quat.
 * @param {ReadonlyQuat2} b the second dual quat.
 * @returns {Boolean} true if the dual quats are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3],
      a4 = a[4],
      a5 = a[5],
      a6 = a[6],
      a7 = a[7];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3],
      b4 = b[4],
      b5 = b[5],
      b6 = b[6],
      b7 = b[7];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7));
}
},{"./common.js":882,"./mat4.js":887,"./quat.js":888}],890:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.length = length;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.random = random;
exports.transformMat2 = transformMat2;
exports.transformMat2d = transformMat2d;
exports.transformMat3 = transformMat3;
exports.transformMat4 = transformMat4;
exports.rotate = rotate;
exports.angle = angle;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = exports.len = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 2 Dimensional Vector
 * @module vec2
 */

/**
 * Creates a new, empty vec2
 *
 * @returns {vec2} a new 2D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(2);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
  }

  return out;
}
/**
 * Creates a new vec2 initialized with values from an existing vector
 *
 * @param {ReadonlyVec2} a vector to clone
 * @returns {vec2} a new 2D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(2);
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
/**
 * Creates a new vec2 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @returns {vec2} a new 2D vector
 */


function fromValues(x, y) {
  var out = new glMatrix.ARRAY_TYPE(2);
  out[0] = x;
  out[1] = y;
  return out;
}
/**
 * Copy the values from one vec2 to another
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the source vector
 * @returns {vec2} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  return out;
}
/**
 * Set the components of a vec2 to the given values
 *
 * @param {vec2} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @returns {vec2} out
 */


function set(out, x, y) {
  out[0] = x;
  out[1] = y;
  return out;
}
/**
 * Adds two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  return out;
}
/**
 * Multiplies two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  return out;
}
/**
 * Divides two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  return out;
}
/**
 * Math.ceil the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to ceil
 * @returns {vec2} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  return out;
}
/**
 * Math.floor the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to floor
 * @returns {vec2} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  return out;
}
/**
 * Returns the minimum of two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  return out;
}
/**
 * Returns the maximum of two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec2} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  return out;
}
/**
 * Math.round the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to round
 * @returns {vec2} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  return out;
}
/**
 * Scales a vec2 by a scalar number
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec2} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  return out;
}
/**
 * Adds two vec2's after scaling the second operand by a scalar value
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec2} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec2's
 *
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0],
      y = b[1] - a[1];
  return Math.hypot(x, y);
}
/**
 * Calculates the squared euclidian distance between two vec2's
 *
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0],
      y = b[1] - a[1];
  return x * x + y * y;
}
/**
 * Calculates the length of a vec2
 *
 * @param {ReadonlyVec2} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0],
      y = a[1];
  return Math.hypot(x, y);
}
/**
 * Calculates the squared length of a vec2
 *
 * @param {ReadonlyVec2} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0],
      y = a[1];
  return x * x + y * y;
}
/**
 * Negates the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to negate
 * @returns {vec2} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  return out;
}
/**
 * Returns the inverse of the components of a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to invert
 * @returns {vec2} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  return out;
}
/**
 * Normalize a vec2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a vector to normalize
 * @returns {vec2} out
 */


function normalize(out, a) {
  var x = a[0],
      y = a[1];
  var len = x * x + y * y;

  if (len > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len = 1 / Math.sqrt(len);
  }

  out[0] = a[0] * len;
  out[1] = a[1] * len;
  return out;
}
/**
 * Calculates the dot product of two vec2's
 *
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1];
}
/**
 * Computes the cross product of two vec2's
 * Note that the cross product must by definition produce a 3D vector
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @returns {vec3} out
 */


function cross(out, a, b) {
  var z = a[0] * b[1] - a[1] * b[0];
  out[0] = out[1] = 0;
  out[2] = z;
  return out;
}
/**
 * Performs a linear interpolation between two vec2's
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the first operand
 * @param {ReadonlyVec2} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec2} out
 */


function lerp(out, a, b, t) {
  var ax = a[0],
      ay = a[1];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec2} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec2} out
 */


function random(out, scale) {
  scale = scale || 1.0;
  var r = glMatrix.RANDOM() * 2.0 * Math.PI;
  out[0] = Math.cos(r) * scale;
  out[1] = Math.sin(r) * scale;
  return out;
}
/**
 * Transforms the vec2 with a mat2
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the vector to transform
 * @param {ReadonlyMat2} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat2(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[2] * y;
  out[1] = m[1] * x + m[3] * y;
  return out;
}
/**
 * Transforms the vec2 with a mat2d
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the vector to transform
 * @param {ReadonlyMat2d} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat2d(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[2] * y + m[4];
  out[1] = m[1] * x + m[3] * y + m[5];
  return out;
}
/**
 * Transforms the vec2 with a mat3
 * 3rd vector component is implicitly '1'
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the vector to transform
 * @param {ReadonlyMat3} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat3(out, a, m) {
  var x = a[0],
      y = a[1];
  out[0] = m[0] * x + m[3] * y + m[6];
  out[1] = m[1] * x + m[4] * y + m[7];
  return out;
}
/**
 * Transforms the vec2 with a mat4
 * 3rd vector component is implicitly '0'
 * 4th vector component is implicitly '1'
 *
 * @param {vec2} out the receiving vector
 * @param {ReadonlyVec2} a the vector to transform
 * @param {ReadonlyMat4} m matrix to transform with
 * @returns {vec2} out
 */


function transformMat4(out, a, m) {
  var x = a[0];
  var y = a[1];
  out[0] = m[0] * x + m[4] * y + m[12];
  out[1] = m[1] * x + m[5] * y + m[13];
  return out;
}
/**
 * Rotate a 2D vector
 * @param {vec2} out The receiving vec2
 * @param {ReadonlyVec2} a The vec2 point to rotate
 * @param {ReadonlyVec2} b The origin of the rotation
 * @param {Number} rad The angle of rotation in radians
 * @returns {vec2} out
 */


function rotate(out, a, b, rad) {
  //Translate point to the origin
  var p0 = a[0] - b[0],
      p1 = a[1] - b[1],
      sinC = Math.sin(rad),
      cosC = Math.cos(rad); //perform rotation and translate to correct position

  out[0] = p0 * cosC - p1 * sinC + b[0];
  out[1] = p0 * sinC + p1 * cosC + b[1];
  return out;
}
/**
 * Get the angle between two 2D vectors
 * @param {ReadonlyVec2} a The first operand
 * @param {ReadonlyVec2} b The second operand
 * @returns {Number} The angle in radians
 */


function angle(a, b) {
  var x1 = a[0],
      y1 = a[1],
      x2 = b[0],
      y2 = b[1],
      // mag is the product of the magnitudes of a and b
  mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2),
      // mag &&.. short circuits if mag == 0
  cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1

  return Math.acos(Math.min(Math.max(cosine, -1), 1));
}
/**
 * Set the components of a vec2 to zero
 *
 * @param {vec2} out the receiving vector
 * @returns {vec2} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {ReadonlyVec2} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return "vec2(" + a[0] + ", " + a[1] + ")";
}
/**
 * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyVec2} a The first vector.
 * @param {ReadonlyVec2} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {ReadonlyVec2} a The first vector.
 * @param {ReadonlyVec2} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1];
  var b0 = b[0],
      b1 = b[1];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));
}
/**
 * Alias for {@link vec2.length}
 * @function
 */


var len = length;
/**
 * Alias for {@link vec2.subtract}
 * @function
 */

exports.len = len;
var sub = subtract;
/**
 * Alias for {@link vec2.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec2.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec2.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec2.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec2.squaredLength}
 * @function
 */

exports.sqrDist = sqrDist;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec2s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 2;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":882}],891:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.length = length;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.hermite = hermite;
exports.bezier = bezier;
exports.random = random;
exports.transformMat4 = transformMat4;
exports.transformMat3 = transformMat3;
exports.transformQuat = transformQuat;
exports.rotateX = rotateX;
exports.rotateY = rotateY;
exports.rotateZ = rotateZ;
exports.angle = angle;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.len = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 3 Dimensional Vector
 * @module vec3
 */

/**
 * Creates a new, empty vec3
 *
 * @returns {vec3} a new 3D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(3);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
  }

  return out;
}
/**
 * Creates a new vec3 initialized with values from an existing vector
 *
 * @param {ReadonlyVec3} a vector to clone
 * @returns {vec3} a new 3D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(3);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  return out;
}
/**
 * Calculates the length of a vec3
 *
 * @param {ReadonlyVec3} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  return Math.hypot(x, y, z);
}
/**
 * Creates a new vec3 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @returns {vec3} a new 3D vector
 */


function fromValues(x, y, z) {
  var out = new glMatrix.ARRAY_TYPE(3);
  out[0] = x;
  out[1] = y;
  out[2] = z;
  return out;
}
/**
 * Copy the values from one vec3 to another
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the source vector
 * @returns {vec3} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  return out;
}
/**
 * Set the components of a vec3 to the given values
 *
 * @param {vec3} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @returns {vec3} out
 */


function set(out, x, y, z) {
  out[0] = x;
  out[1] = y;
  out[2] = z;
  return out;
}
/**
 * Adds two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  return out;
}
/**
 * Multiplies two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  out[2] = a[2] * b[2];
  return out;
}
/**
 * Divides two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  out[2] = a[2] / b[2];
  return out;
}
/**
 * Math.ceil the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to ceil
 * @returns {vec3} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  out[2] = Math.ceil(a[2]);
  return out;
}
/**
 * Math.floor the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to floor
 * @returns {vec3} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  out[2] = Math.floor(a[2]);
  return out;
}
/**
 * Returns the minimum of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  out[2] = Math.min(a[2], b[2]);
  return out;
}
/**
 * Returns the maximum of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  out[2] = Math.max(a[2], b[2]);
  return out;
}
/**
 * Math.round the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to round
 * @returns {vec3} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  out[2] = Math.round(a[2]);
  return out;
}
/**
 * Scales a vec3 by a scalar number
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec3} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  return out;
}
/**
 * Adds two vec3's after scaling the second operand by a scalar value
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec3} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec3's
 *
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  return Math.hypot(x, y, z);
}
/**
 * Calculates the squared euclidian distance between two vec3's
 *
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  return x * x + y * y + z * z;
}
/**
 * Calculates the squared length of a vec3
 *
 * @param {ReadonlyVec3} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  return x * x + y * y + z * z;
}
/**
 * Negates the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to negate
 * @returns {vec3} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  return out;
}
/**
 * Returns the inverse of the components of a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to invert
 * @returns {vec3} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  out[2] = 1.0 / a[2];
  return out;
}
/**
 * Normalize a vec3
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a vector to normalize
 * @returns {vec3} out
 */


function normalize(out, a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var len = x * x + y * y + z * z;

  if (len > 0) {
    //TODO: evaluate use of glm_invsqrt here?
    len = 1 / Math.sqrt(len);
  }

  out[0] = a[0] * len;
  out[1] = a[1] * len;
  out[2] = a[2] * len;
  return out;
}
/**
 * Calculates the dot product of two vec3's
 *
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
/**
 * Computes the cross product of two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @returns {vec3} out
 */


function cross(out, a, b) {
  var ax = a[0],
      ay = a[1],
      az = a[2];
  var bx = b[0],
      by = b[1],
      bz = b[2];
  out[0] = ay * bz - az * by;
  out[1] = az * bx - ax * bz;
  out[2] = ax * by - ay * bx;
  return out;
}
/**
 * Performs a linear interpolation between two vec3's
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function lerp(out, a, b, t) {
  var ax = a[0];
  var ay = a[1];
  var az = a[2];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  out[2] = az + t * (b[2] - az);
  return out;
}
/**
 * Performs a hermite interpolation with two control points
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @param {ReadonlyVec3} c the third operand
 * @param {ReadonlyVec3} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function hermite(out, a, b, c, d, t) {
  var factorTimes2 = t * t;
  var factor1 = factorTimes2 * (2 * t - 3) + 1;
  var factor2 = factorTimes2 * (t - 2) + t;
  var factor3 = factorTimes2 * (t - 1);
  var factor4 = factorTimes2 * (3 - 2 * t);
  out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
  out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
  out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
  return out;
}
/**
 * Performs a bezier interpolation with two control points
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the first operand
 * @param {ReadonlyVec3} b the second operand
 * @param {ReadonlyVec3} c the third operand
 * @param {ReadonlyVec3} d the fourth operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec3} out
 */


function bezier(out, a, b, c, d, t) {
  var inverseFactor = 1 - t;
  var inverseFactorTimesTwo = inverseFactor * inverseFactor;
  var factorTimes2 = t * t;
  var factor1 = inverseFactorTimesTwo * inverseFactor;
  var factor2 = 3 * t * inverseFactorTimesTwo;
  var factor3 = 3 * factorTimes2 * inverseFactor;
  var factor4 = factorTimes2 * t;
  out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
  out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
  out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec3} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec3} out
 */


function random(out, scale) {
  scale = scale || 1.0;
  var r = glMatrix.RANDOM() * 2.0 * Math.PI;
  var z = glMatrix.RANDOM() * 2.0 - 1.0;
  var zScale = Math.sqrt(1.0 - z * z) * scale;
  out[0] = Math.cos(r) * zScale;
  out[1] = Math.sin(r) * zScale;
  out[2] = z * scale;
  return out;
}
/**
 * Transforms the vec3 with a mat4.
 * 4th vector component is implicitly '1'
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the vector to transform
 * @param {ReadonlyMat4} m matrix to transform with
 * @returns {vec3} out
 */


function transformMat4(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2];
  var w = m[3] * x + m[7] * y + m[11] * z + m[15];
  w = w || 1.0;
  out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
  out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
  out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
  return out;
}
/**
 * Transforms the vec3 with a mat3.
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the vector to transform
 * @param {ReadonlyMat3} m the 3x3 matrix to transform with
 * @returns {vec3} out
 */


function transformMat3(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2];
  out[0] = x * m[0] + y * m[3] + z * m[6];
  out[1] = x * m[1] + y * m[4] + z * m[7];
  out[2] = x * m[2] + y * m[5] + z * m[8];
  return out;
}
/**
 * Transforms the vec3 with a quat
 * Can also be used for dual quaternions. (Multiply it with the real part)
 *
 * @param {vec3} out the receiving vector
 * @param {ReadonlyVec3} a the vector to transform
 * @param {ReadonlyQuat} q quaternion to transform with
 * @returns {vec3} out
 */


function transformQuat(out, a, q) {
  // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3];
  var x = a[0],
      y = a[1],
      z = a[2]; // var qvec = [qx, qy, qz];
  // var uv = vec3.cross([], qvec, a);

  var uvx = qy * z - qz * y,
      uvy = qz * x - qx * z,
      uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);

  var uuvx = qy * uvz - qz * uvy,
      uuvy = qz * uvx - qx * uvz,
      uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);

  var w2 = qw * 2;
  uvx *= w2;
  uvy *= w2;
  uvz *= w2; // vec3.scale(uuv, uuv, 2);

  uuvx *= 2;
  uuvy *= 2;
  uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));

  out[0] = x + uvx + uuvx;
  out[1] = y + uvy + uuvy;
  out[2] = z + uvz + uuvz;
  return out;
}
/**
 * Rotate a 3D vector around the x-axis
 * @param {vec3} out The receiving vec3
 * @param {ReadonlyVec3} a The vec3 point to rotate
 * @param {ReadonlyVec3} b The origin of the rotation
 * @param {Number} rad The angle of rotation in radians
 * @returns {vec3} out
 */


function rotateX(out, a, b, rad) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[0];
  r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);
  r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Rotate a 3D vector around the y-axis
 * @param {vec3} out The receiving vec3
 * @param {ReadonlyVec3} a The vec3 point to rotate
 * @param {ReadonlyVec3} b The origin of the rotation
 * @param {Number} rad The angle of rotation in radians
 * @returns {vec3} out
 */


function rotateY(out, a, b, rad) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);
  r[1] = p[1];
  r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Rotate a 3D vector around the z-axis
 * @param {vec3} out The receiving vec3
 * @param {ReadonlyVec3} a The vec3 point to rotate
 * @param {ReadonlyVec3} b The origin of the rotation
 * @param {Number} rad The angle of rotation in radians
 * @returns {vec3} out
 */


function rotateZ(out, a, b, rad) {
  var p = [],
      r = []; //Translate point to the origin

  p[0] = a[0] - b[0];
  p[1] = a[1] - b[1];
  p[2] = a[2] - b[2]; //perform rotation

  r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);
  r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);
  r[2] = p[2]; //translate to correct position

  out[0] = r[0] + b[0];
  out[1] = r[1] + b[1];
  out[2] = r[2] + b[2];
  return out;
}
/**
 * Get the angle between two 3D vectors
 * @param {ReadonlyVec3} a The first operand
 * @param {ReadonlyVec3} b The second operand
 * @returns {Number} The angle in radians
 */


function angle(a, b) {
  var ax = a[0],
      ay = a[1],
      az = a[2],
      bx = b[0],
      by = b[1],
      bz = b[2],
      mag1 = Math.sqrt(ax * ax + ay * ay + az * az),
      mag2 = Math.sqrt(bx * bx + by * by + bz * bz),
      mag = mag1 * mag2,
      cosine = mag && dot(a, b) / mag;
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
}
/**
 * Set the components of a vec3 to zero
 *
 * @param {vec3} out the receiving vector
 * @returns {vec3} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  out[2] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {ReadonlyVec3} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
}
/**
 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyVec3} a The first vector.
 * @param {ReadonlyVec3} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {ReadonlyVec3} a The first vector.
 * @param {ReadonlyVec3} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));
}
/**
 * Alias for {@link vec3.subtract}
 * @function
 */


var sub = subtract;
/**
 * Alias for {@link vec3.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec3.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec3.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec3.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec3.length}
 * @function
 */

exports.sqrDist = sqrDist;
var len = length;
/**
 * Alias for {@link vec3.squaredLength}
 * @function
 */

exports.len = len;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec3s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 3;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      vec[2] = a[i + 2];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
      a[i + 2] = vec[2];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":882}],892:[function(require,module,exports){
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.create = create;
exports.clone = clone;
exports.fromValues = fromValues;
exports.copy = copy;
exports.set = set;
exports.add = add;
exports.subtract = subtract;
exports.multiply = multiply;
exports.divide = divide;
exports.ceil = ceil;
exports.floor = floor;
exports.min = min;
exports.max = max;
exports.round = round;
exports.scale = scale;
exports.scaleAndAdd = scaleAndAdd;
exports.distance = distance;
exports.squaredDistance = squaredDistance;
exports.length = length;
exports.squaredLength = squaredLength;
exports.negate = negate;
exports.inverse = inverse;
exports.normalize = normalize;
exports.dot = dot;
exports.cross = cross;
exports.lerp = lerp;
exports.random = random;
exports.transformMat4 = transformMat4;
exports.transformQuat = transformQuat;
exports.zero = zero;
exports.str = str;
exports.exactEquals = exactEquals;
exports.equals = equals;
exports.forEach = exports.sqrLen = exports.len = exports.sqrDist = exports.dist = exports.div = exports.mul = exports.sub = void 0;

var glMatrix = _interopRequireWildcard(require("./common.js"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/**
 * 4 Dimensional Vector
 * @module vec4
 */

/**
 * Creates a new, empty vec4
 *
 * @returns {vec4} a new 4D vector
 */
function create() {
  var out = new glMatrix.ARRAY_TYPE(4);

  if (glMatrix.ARRAY_TYPE != Float32Array) {
    out[0] = 0;
    out[1] = 0;
    out[2] = 0;
    out[3] = 0;
  }

  return out;
}
/**
 * Creates a new vec4 initialized with values from an existing vector
 *
 * @param {ReadonlyVec4} a vector to clone
 * @returns {vec4} a new 4D vector
 */


function clone(a) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Creates a new vec4 initialized with the given values
 *
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {vec4} a new 4D vector
 */


function fromValues(x, y, z, w) {
  var out = new glMatrix.ARRAY_TYPE(4);
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = w;
  return out;
}
/**
 * Copy the values from one vec4 to another
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the source vector
 * @returns {vec4} out
 */


function copy(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
/**
 * Set the components of a vec4 to the given values
 *
 * @param {vec4} out the receiving vector
 * @param {Number} x X component
 * @param {Number} y Y component
 * @param {Number} z Z component
 * @param {Number} w W component
 * @returns {vec4} out
 */


function set(out, x, y, z, w) {
  out[0] = x;
  out[1] = y;
  out[2] = z;
  out[3] = w;
  return out;
}
/**
 * Adds two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function add(out, a, b) {
  out[0] = a[0] + b[0];
  out[1] = a[1] + b[1];
  out[2] = a[2] + b[2];
  out[3] = a[3] + b[3];
  return out;
}
/**
 * Subtracts vector b from vector a
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function subtract(out, a, b) {
  out[0] = a[0] - b[0];
  out[1] = a[1] - b[1];
  out[2] = a[2] - b[2];
  out[3] = a[3] - b[3];
  return out;
}
/**
 * Multiplies two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function multiply(out, a, b) {
  out[0] = a[0] * b[0];
  out[1] = a[1] * b[1];
  out[2] = a[2] * b[2];
  out[3] = a[3] * b[3];
  return out;
}
/**
 * Divides two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function divide(out, a, b) {
  out[0] = a[0] / b[0];
  out[1] = a[1] / b[1];
  out[2] = a[2] / b[2];
  out[3] = a[3] / b[3];
  return out;
}
/**
 * Math.ceil the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to ceil
 * @returns {vec4} out
 */


function ceil(out, a) {
  out[0] = Math.ceil(a[0]);
  out[1] = Math.ceil(a[1]);
  out[2] = Math.ceil(a[2]);
  out[3] = Math.ceil(a[3]);
  return out;
}
/**
 * Math.floor the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to floor
 * @returns {vec4} out
 */


function floor(out, a) {
  out[0] = Math.floor(a[0]);
  out[1] = Math.floor(a[1]);
  out[2] = Math.floor(a[2]);
  out[3] = Math.floor(a[3]);
  return out;
}
/**
 * Returns the minimum of two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function min(out, a, b) {
  out[0] = Math.min(a[0], b[0]);
  out[1] = Math.min(a[1], b[1]);
  out[2] = Math.min(a[2], b[2]);
  out[3] = Math.min(a[3], b[3]);
  return out;
}
/**
 * Returns the maximum of two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {vec4} out
 */


function max(out, a, b) {
  out[0] = Math.max(a[0], b[0]);
  out[1] = Math.max(a[1], b[1]);
  out[2] = Math.max(a[2], b[2]);
  out[3] = Math.max(a[3], b[3]);
  return out;
}
/**
 * Math.round the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to round
 * @returns {vec4} out
 */


function round(out, a) {
  out[0] = Math.round(a[0]);
  out[1] = Math.round(a[1]);
  out[2] = Math.round(a[2]);
  out[3] = Math.round(a[3]);
  return out;
}
/**
 * Scales a vec4 by a scalar number
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the vector to scale
 * @param {Number} b amount to scale the vector by
 * @returns {vec4} out
 */


function scale(out, a, b) {
  out[0] = a[0] * b;
  out[1] = a[1] * b;
  out[2] = a[2] * b;
  out[3] = a[3] * b;
  return out;
}
/**
 * Adds two vec4's after scaling the second operand by a scalar value
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @param {Number} scale the amount to scale b by before adding
 * @returns {vec4} out
 */


function scaleAndAdd(out, a, b, scale) {
  out[0] = a[0] + b[0] * scale;
  out[1] = a[1] + b[1] * scale;
  out[2] = a[2] + b[2] * scale;
  out[3] = a[3] + b[3] * scale;
  return out;
}
/**
 * Calculates the euclidian distance between two vec4's
 *
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {Number} distance between a and b
 */


function distance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  var w = b[3] - a[3];
  return Math.hypot(x, y, z, w);
}
/**
 * Calculates the squared euclidian distance between two vec4's
 *
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {Number} squared distance between a and b
 */


function squaredDistance(a, b) {
  var x = b[0] - a[0];
  var y = b[1] - a[1];
  var z = b[2] - a[2];
  var w = b[3] - a[3];
  return x * x + y * y + z * z + w * w;
}
/**
 * Calculates the length of a vec4
 *
 * @param {ReadonlyVec4} a vector to calculate length of
 * @returns {Number} length of a
 */


function length(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  return Math.hypot(x, y, z, w);
}
/**
 * Calculates the squared length of a vec4
 *
 * @param {ReadonlyVec4} a vector to calculate squared length of
 * @returns {Number} squared length of a
 */


function squaredLength(a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  return x * x + y * y + z * z + w * w;
}
/**
 * Negates the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to negate
 * @returns {vec4} out
 */


function negate(out, a) {
  out[0] = -a[0];
  out[1] = -a[1];
  out[2] = -a[2];
  out[3] = -a[3];
  return out;
}
/**
 * Returns the inverse of the components of a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to invert
 * @returns {vec4} out
 */


function inverse(out, a) {
  out[0] = 1.0 / a[0];
  out[1] = 1.0 / a[1];
  out[2] = 1.0 / a[2];
  out[3] = 1.0 / a[3];
  return out;
}
/**
 * Normalize a vec4
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a vector to normalize
 * @returns {vec4} out
 */


function normalize(out, a) {
  var x = a[0];
  var y = a[1];
  var z = a[2];
  var w = a[3];
  var len = x * x + y * y + z * z + w * w;

  if (len > 0) {
    len = 1 / Math.sqrt(len);
  }

  out[0] = x * len;
  out[1] = y * len;
  out[2] = z * len;
  out[3] = w * len;
  return out;
}
/**
 * Calculates the dot product of two vec4's
 *
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @returns {Number} dot product of a and b
 */


function dot(a, b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
}
/**
 * Returns the cross-product of three vectors in a 4-dimensional space
 *
 * @param {ReadonlyVec4} result the receiving vector
 * @param {ReadonlyVec4} U the first vector
 * @param {ReadonlyVec4} V the second vector
 * @param {ReadonlyVec4} W the third vector
 * @returns {vec4} result
 */


function cross(out, u, v, w) {
  var A = v[0] * w[1] - v[1] * w[0],
      B = v[0] * w[2] - v[2] * w[0],
      C = v[0] * w[3] - v[3] * w[0],
      D = v[1] * w[2] - v[2] * w[1],
      E = v[1] * w[3] - v[3] * w[1],
      F = v[2] * w[3] - v[3] * w[2];
  var G = u[0];
  var H = u[1];
  var I = u[2];
  var J = u[3];
  out[0] = H * F - I * E + J * D;
  out[1] = -(G * F) + I * C - J * B;
  out[2] = G * E - H * C + J * A;
  out[3] = -(G * D) + H * B - I * A;
  return out;
}
/**
 * Performs a linear interpolation between two vec4's
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the first operand
 * @param {ReadonlyVec4} b the second operand
 * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
 * @returns {vec4} out
 */


function lerp(out, a, b, t) {
  var ax = a[0];
  var ay = a[1];
  var az = a[2];
  var aw = a[3];
  out[0] = ax + t * (b[0] - ax);
  out[1] = ay + t * (b[1] - ay);
  out[2] = az + t * (b[2] - az);
  out[3] = aw + t * (b[3] - aw);
  return out;
}
/**
 * Generates a random vector with the given scale
 *
 * @param {vec4} out the receiving vector
 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
 * @returns {vec4} out
 */


function random(out, scale) {
  scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a
  // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.
  // http://projecteuclid.org/euclid.aoms/1177692644;

  var v1, v2, v3, v4;
  var s1, s2;

  do {
    v1 = glMatrix.RANDOM() * 2 - 1;
    v2 = glMatrix.RANDOM() * 2 - 1;
    s1 = v1 * v1 + v2 * v2;
  } while (s1 >= 1);

  do {
    v3 = glMatrix.RANDOM() * 2 - 1;
    v4 = glMatrix.RANDOM() * 2 - 1;
    s2 = v3 * v3 + v4 * v4;
  } while (s2 >= 1);

  var d = Math.sqrt((1 - s1) / s2);
  out[0] = scale * v1;
  out[1] = scale * v2;
  out[2] = scale * v3 * d;
  out[3] = scale * v4 * d;
  return out;
}
/**
 * Transforms the vec4 with a mat4.
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the vector to transform
 * @param {ReadonlyMat4} m matrix to transform with
 * @returns {vec4} out
 */


function transformMat4(out, a, m) {
  var x = a[0],
      y = a[1],
      z = a[2],
      w = a[3];
  out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
  out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
  out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
  out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
  return out;
}
/**
 * Transforms the vec4 with a quat
 *
 * @param {vec4} out the receiving vector
 * @param {ReadonlyVec4} a the vector to transform
 * @param {ReadonlyQuat} q quaternion to transform with
 * @returns {vec4} out
 */


function transformQuat(out, a, q) {
  var x = a[0],
      y = a[1],
      z = a[2];
  var qx = q[0],
      qy = q[1],
      qz = q[2],
      qw = q[3]; // calculate quat * vec

  var ix = qw * x + qy * z - qz * y;
  var iy = qw * y + qz * x - qx * z;
  var iz = qw * z + qx * y - qy * x;
  var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat

  out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
  out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
  out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
  out[3] = a[3];
  return out;
}
/**
 * Set the components of a vec4 to zero
 *
 * @param {vec4} out the receiving vector
 * @returns {vec4} out
 */


function zero(out) {
  out[0] = 0.0;
  out[1] = 0.0;
  out[2] = 0.0;
  out[3] = 0.0;
  return out;
}
/**
 * Returns a string representation of a vector
 *
 * @param {ReadonlyVec4} a vector to represent as a string
 * @returns {String} string representation of the vector
 */


function str(a) {
  return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")";
}
/**
 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
 *
 * @param {ReadonlyVec4} a The first vector.
 * @param {ReadonlyVec4} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function exactEquals(a, b) {
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
}
/**
 * Returns whether or not the vectors have approximately the same elements in the same position.
 *
 * @param {ReadonlyVec4} a The first vector.
 * @param {ReadonlyVec4} b The second vector.
 * @returns {Boolean} True if the vectors are equal, false otherwise.
 */


function equals(a, b) {
  var a0 = a[0],
      a1 = a[1],
      a2 = a[2],
      a3 = a[3];
  var b0 = b[0],
      b1 = b[1],
      b2 = b[2],
      b3 = b[3];
  return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));
}
/**
 * Alias for {@link vec4.subtract}
 * @function
 */


var sub = subtract;
/**
 * Alias for {@link vec4.multiply}
 * @function
 */

exports.sub = sub;
var mul = multiply;
/**
 * Alias for {@link vec4.divide}
 * @function
 */

exports.mul = mul;
var div = divide;
/**
 * Alias for {@link vec4.distance}
 * @function
 */

exports.div = div;
var dist = distance;
/**
 * Alias for {@link vec4.squaredDistance}
 * @function
 */

exports.dist = dist;
var sqrDist = squaredDistance;
/**
 * Alias for {@link vec4.length}
 * @function
 */

exports.sqrDist = sqrDist;
var len = length;
/**
 * Alias for {@link vec4.squaredLength}
 * @function
 */

exports.len = len;
var sqrLen = squaredLength;
/**
 * Perform some operation over an array of vec4s.
 *
 * @param {Array} a the array of vectors to iterate over
 * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
 * @param {Number} offset Number of elements to skip at the beginning of the array
 * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
 * @param {Function} fn Function to call for each vector in the array
 * @param {Object} [arg] additional argument to pass to fn
 * @returns {Array} a
 * @function
 */

exports.sqrLen = sqrLen;

var forEach = function () {
  var vec = create();
  return function (a, stride, offset, count, fn, arg) {
    var i, l;

    if (!stride) {
      stride = 4;
    }

    if (!offset) {
      offset = 0;
    }

    if (count) {
      l = Math.min(count * stride + offset, a.length);
    } else {
      l = a.length;
    }

    for (i = offset; i < l; i += stride) {
      vec[0] = a[i];
      vec[1] = a[i + 1];
      vec[2] = a[i + 2];
      vec[3] = a[i + 3];
      fn(vec, vec, arg);
      a[i] = vec[0];
      a[i + 1] = vec[1];
      a[i + 2] = vec[2];
      a[i + 3] = vec[3];
    }

    return a;
  };
}();

exports.forEach = forEach;
},{"./common.js":882}],893:[function(require,module,exports){
(function (global){
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
    (global.ResizeObserver = factory());
}(this, (function () { 'use strict';

    /**
     * A collection of shims that provide minimal functionality of the ES6 collections.
     *
     * These implementations are not meant to be used outside of the ResizeObserver
     * modules as they cover only a limited range of use cases.
     */
    /* eslint-disable require-jsdoc, valid-jsdoc */
    var MapShim = (function () {
        if (typeof Map !== 'undefined') {
            return Map;
        }
        /**
         * Returns index in provided array that matches the specified key.
         *
         * @param {Array<Array>} arr
         * @param {*} key
         * @returns {number}
         */
        function getIndex(arr, key) {
            var result = -1;
            arr.some(function (entry, index) {
                if (entry[0] === key) {
                    result = index;
                    return true;
                }
                return false;
            });
            return result;
        }
        return /** @class */ (function () {
            function class_1() {
                this.__entries__ = [];
            }
            Object.defineProperty(class_1.prototype, "size", {
                /**
                 * @returns {boolean}
                 */
                get: function () {
                    return this.__entries__.length;
                },
                enumerable: true,
                configurable: true
            });
            /**
             * @param {*} key
             * @returns {*}
             */
            class_1.prototype.get = function (key) {
                var index = getIndex(this.__entries__, key);
                var entry = this.__entries__[index];
                return entry && entry[1];
            };
            /**
             * @param {*} key
             * @param {*} value
             * @returns {void}
             */
            class_1.prototype.set = function (key, value) {
                var index = getIndex(this.__entries__, key);
                if (~index) {
                    this.__entries__[index][1] = value;
                }
                else {
                    this.__entries__.push([key, value]);
                }
            };
            /**
             * @param {*} key
             * @returns {void}
             */
            class_1.prototype.delete = function (key) {
                var entries = this.__entries__;
                var index = getIndex(entries, key);
                if (~index) {
                    entries.splice(index, 1);
                }
            };
            /**
             * @param {*} key
             * @returns {void}
             */
            class_1.prototype.has = function (key) {
                return !!~getIndex(this.__entries__, key);
            };
            /**
             * @returns {void}
             */
            class_1.prototype.clear = function () {
                this.__entries__.splice(0);
            };
            /**
             * @param {Function} callback
             * @param {*} [ctx=null]
             * @returns {void}
             */
            class_1.prototype.forEach = function (callback, ctx) {
                if (ctx === void 0) { ctx = null; }
                for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
                    var entry = _a[_i];
                    callback.call(ctx, entry[1], entry[0]);
                }
            };
            return class_1;
        }());
    })();

    /**
     * Detects whether window and document objects are available in current environment.
     */
    var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;

    // Returns global object of a current environment.
    var global$1 = (function () {
        if (typeof global !== 'undefined' && global.Math === Math) {
            return global;
        }
        if (typeof self !== 'undefined' && self.Math === Math) {
            return self;
        }
        if (typeof window !== 'undefined' && window.Math === Math) {
            return window;
        }
        // eslint-disable-next-line no-new-func
        return Function('return this')();
    })();

    /**
     * A shim for the requestAnimationFrame which falls back to the setTimeout if
     * first one is not supported.
     *
     * @returns {number} Requests' identifier.
     */
    var requestAnimationFrame$1 = (function () {
        if (typeof requestAnimationFrame === 'function') {
            // It's required to use a bounded function because IE sometimes throws
            // an "Invalid calling object" error if rAF is invoked without the global
            // object on the left hand side.
            return requestAnimationFrame.bind(global$1);
        }
        return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
    })();

    // Defines minimum timeout before adding a trailing call.
    var trailingTimeout = 2;
    /**
     * Creates a wrapper function which ensures that provided callback will be
     * invoked only once during the specified delay period.
     *
     * @param {Function} callback - Function to be invoked after the delay period.
     * @param {number} delay - Delay after which to invoke callback.
     * @returns {Function}
     */
    function throttle (callback, delay) {
        var leadingCall = false, trailingCall = false, lastCallTime = 0;
        /**
         * Invokes the original callback function and schedules new invocation if
         * the "proxy" was called during current request.
         *
         * @returns {void}
         */
        function resolvePending() {
            if (leadingCall) {
                leadingCall = false;
                callback();
            }
            if (trailingCall) {
                proxy();
            }
        }
        /**
         * Callback invoked after the specified delay. It will further postpone
         * invocation of the original function delegating it to the
         * requestAnimationFrame.
         *
         * @returns {void}
         */
        function timeoutCallback() {
            requestAnimationFrame$1(resolvePending);
        }
        /**
         * Schedules invocation of the original function.
         *
         * @returns {void}
         */
        function proxy() {
            var timeStamp = Date.now();
            if (leadingCall) {
                // Reject immediately following calls.
                if (timeStamp - lastCallTime < trailingTimeout) {
                    return;
                }
                // Schedule new call to be in invoked when the pending one is resolved.
                // This is important for "transitions" which never actually start
                // immediately so there is a chance that we might miss one if change
                // happens amids the pending invocation.
                trailingCall = true;
            }
            else {
                leadingCall = true;
                trailingCall = false;
                setTimeout(timeoutCallback, delay);
            }
            lastCallTime = timeStamp;
        }
        return proxy;
    }

    // Minimum delay before invoking the update of observers.
    var REFRESH_DELAY = 20;
    // A list of substrings of CSS properties used to find transition events that
    // might affect dimensions of observed elements.
    var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
    // Check if MutationObserver is available.
    var mutationObserverSupported = typeof MutationObserver !== 'undefined';
    /**
     * Singleton controller class which handles updates of ResizeObserver instances.
     */
    var ResizeObserverController = /** @class */ (function () {
        /**
         * Creates a new instance of ResizeObserverController.
         *
         * @private
         */
        function ResizeObserverController() {
            /**
             * Indicates whether DOM listeners have been added.
             *
             * @private {boolean}
             */
            this.connected_ = false;
            /**
             * Tells that controller has subscribed for Mutation Events.
             *
             * @private {boolean}
             */
            this.mutationEventsAdded_ = false;
            /**
             * Keeps reference to the instance of MutationObserver.
             *
             * @private {MutationObserver}
             */
            this.mutationsObserver_ = null;
            /**
             * A list of connected observers.
             *
             * @private {Array<ResizeObserverSPI>}
             */
            this.observers_ = [];
            this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
            this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
        }
        /**
         * Adds observer to observers list.
         *
         * @param {ResizeObserverSPI} observer - Observer to be added.
         * @returns {void}
         */
        ResizeObserverController.prototype.addObserver = function (observer) {
            if (!~this.observers_.indexOf(observer)) {
                this.observers_.push(observer);
            }
            // Add listeners if they haven't been added yet.
            if (!this.connected_) {
                this.connect_();
            }
        };
        /**
         * Removes observer from observers list.
         *
         * @param {ResizeObserverSPI} observer - Observer to be removed.
         * @returns {void}
         */
        ResizeObserverController.prototype.removeObserver = function (observer) {
            var observers = this.observers_;
            var index = observers.indexOf(observer);
            // Remove observer if it's present in registry.
            if (~index) {
                observers.splice(index, 1);
            }
            // Remove listeners if controller has no connected observers.
            if (!observers.length && this.connected_) {
                this.disconnect_();
            }
        };
        /**
         * Invokes the update of observers. It will continue running updates insofar
         * it detects changes.
         *
         * @returns {void}
         */
        ResizeObserverController.prototype.refresh = function () {
            var changesDetected = this.updateObservers_();
            // Continue running updates if changes have been detected as there might
            // be future ones caused by CSS transitions.
            if (changesDetected) {
                this.refresh();
            }
        };
        /**
         * Updates every observer from observers list and notifies them of queued
         * entries.
         *
         * @private
         * @returns {boolean} Returns "true" if any observer has detected changes in
         *      dimensions of it's elements.
         */
        ResizeObserverController.prototype.updateObservers_ = function () {
            // Collect observers that have active observations.
            var activeObservers = this.observers_.filter(function (observer) {
                return observer.gatherActive(), observer.hasActive();
            });
            // Deliver notifications in a separate cycle in order to avoid any
            // collisions between observers, e.g. when multiple instances of
            // ResizeObserver are tracking the same element and the callback of one
            // of them changes content dimensions of the observed target. Sometimes
            // this may result in notifications being blocked for the rest of observers.
            activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
            return activeObservers.length > 0;
        };
        /**
         * Initializes DOM listeners.
         *
         * @private
         * @returns {void}
         */
        ResizeObserverController.prototype.connect_ = function () {
            // Do nothing if running in a non-browser environment or if listeners
            // have been already added.
            if (!isBrowser || this.connected_) {
                return;
            }
            // Subscription to the "Transitionend" event is used as a workaround for
            // delayed transitions. This way it's possible to capture at least the
            // final state of an element.
            document.addEventListener('transitionend', this.onTransitionEnd_);
            window.addEventListener('resize', this.refresh);
            if (mutationObserverSupported) {
                this.mutationsObserver_ = new MutationObserver(this.refresh);
                this.mutationsObserver_.observe(document, {
                    attributes: true,
                    childList: true,
                    characterData: true,
                    subtree: true
                });
            }
            else {
                document.addEventListener('DOMSubtreeModified', this.refresh);
                this.mutationEventsAdded_ = true;
            }
            this.connected_ = true;
        };
        /**
         * Removes DOM listeners.
         *
         * @private
         * @returns {void}
         */
        ResizeObserverController.prototype.disconnect_ = function () {
            // Do nothing if running in a non-browser environment or if listeners
            // have been already removed.
            if (!isBrowser || !this.connected_) {
                return;
            }
            document.removeEventListener('transitionend', this.onTransitionEnd_);
            window.removeEventListener('resize', this.refresh);
            if (this.mutationsObserver_) {
                this.mutationsObserver_.disconnect();
            }
            if (this.mutationEventsAdded_) {
                document.removeEventListener('DOMSubtreeModified', this.refresh);
            }
            this.mutationsObserver_ = null;
            this.mutationEventsAdded_ = false;
            this.connected_ = false;
        };
        /**
         * "Transitionend" event handler.
         *
         * @private
         * @param {TransitionEvent} event
         * @returns {void}
         */
        ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
            var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
            // Detect whether transition may affect dimensions of an element.
            var isReflowProperty = transitionKeys.some(function (key) {
                return !!~propertyName.indexOf(key);
            });
            if (isReflowProperty) {
                this.refresh();
            }
        };
        /**
         * Returns instance of the ResizeObserverController.
         *
         * @returns {ResizeObserverController}
         */
        ResizeObserverController.getInstance = function () {
            if (!this.instance_) {
                this.instance_ = new ResizeObserverController();
            }
            return this.instance_;
        };
        /**
         * Holds reference to the controller's instance.
         *
         * @private {ResizeObserverController}
         */
        ResizeObserverController.instance_ = null;
        return ResizeObserverController;
    }());

    /**
     * Defines non-writable/enumerable properties of the provided target object.
     *
     * @param {Object} target - Object for which to define properties.
     * @param {Object} props - Properties to be defined.
     * @returns {Object} Target object.
     */
    var defineConfigurable = (function (target, props) {
        for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
            var key = _a[_i];
            Object.defineProperty(target, key, {
                value: props[key],
                enumerable: false,
                writable: false,
                configurable: true
            });
        }
        return target;
    });

    /**
     * Returns the global object associated with provided element.
     *
     * @param {Object} target
     * @returns {Object}
     */
    var getWindowOf = (function (target) {
        // Assume that the element is an instance of Node, which means that it
        // has the "ownerDocument" property from which we can retrieve a
        // corresponding global object.
        var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
        // Return the local global object if it's not possible extract one from
        // provided element.
        return ownerGlobal || global$1;
    });

    // Placeholder of an empty content rectangle.
    var emptyRect = createRectInit(0, 0, 0, 0);
    /**
     * Converts provided string to a number.
     *
     * @param {number|string} value
     * @returns {number}
     */
    function toFloat(value) {
        return parseFloat(value) || 0;
    }
    /**
     * Extracts borders size from provided styles.
     *
     * @param {CSSStyleDeclaration} styles
     * @param {...string} positions - Borders positions (top, right, ...)
     * @returns {number}
     */
    function getBordersSize(styles) {
        var positions = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            positions[_i - 1] = arguments[_i];
        }
        return positions.reduce(function (size, position) {
            var value = styles['border-' + position + '-width'];
            return size + toFloat(value);
        }, 0);
    }
    /**
     * Extracts paddings sizes from provided styles.
     *
     * @param {CSSStyleDeclaration} styles
     * @returns {Object} Paddings box.
     */
    function getPaddings(styles) {
        var positions = ['top', 'right', 'bottom', 'left'];
        var paddings = {};
        for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
            var position = positions_1[_i];
            var value = styles['padding-' + position];
            paddings[position] = toFloat(value);
        }
        return paddings;
    }
    /**
     * Calculates content rectangle of provided SVG element.
     *
     * @param {SVGGraphicsElement} target - Element content rectangle of which needs
     *      to be calculated.
     * @returns {DOMRectInit}
     */
    function getSVGContentRect(target) {
        var bbox = target.getBBox();
        return createRectInit(0, 0, bbox.width, bbox.height);
    }
    /**
     * Calculates content rectangle of provided HTMLElement.
     *
     * @param {HTMLElement} target - Element for which to calculate the content rectangle.
     * @returns {DOMRectInit}
     */
    function getHTMLElementContentRect(target) {
        // Client width & height properties can't be
        // used exclusively as they provide rounded values.
        var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
        // By this condition we can catch all non-replaced inline, hidden and
        // detached elements. Though elements with width & height properties less
        // than 0.5 will be discarded as well.
        //
        // Without it we would need to implement separate methods for each of
        // those cases and it's not possible to perform a precise and performance
        // effective test for hidden elements. E.g. even jQuery's ':visible' filter
        // gives wrong results for elements with width & height less than 0.5.
        if (!clientWidth && !clientHeight) {
            return emptyRect;
        }
        var styles = getWindowOf(target).getComputedStyle(target);
        var paddings = getPaddings(styles);
        var horizPad = paddings.left + paddings.right;
        var vertPad = paddings.top + paddings.bottom;
        // Computed styles of width & height are being used because they are the
        // only dimensions available to JS that contain non-rounded values. It could
        // be possible to utilize the getBoundingClientRect if only it's data wasn't
        // affected by CSS transformations let alone paddings, borders and scroll bars.
        var width = toFloat(styles.width), height = toFloat(styles.height);
        // Width & height include paddings and borders when the 'border-box' box
        // model is applied (except for IE).
        if (styles.boxSizing === 'border-box') {
            // Following conditions are required to handle Internet Explorer which
            // doesn't include paddings and borders to computed CSS dimensions.
            //
            // We can say that if CSS dimensions + paddings are equal to the "client"
            // properties then it's either IE, and thus we don't need to subtract
            // anything, or an element merely doesn't have paddings/borders styles.
            if (Math.round(width + horizPad) !== clientWidth) {
                width -= getBordersSize(styles, 'left', 'right') + horizPad;
            }
            if (Math.round(height + vertPad) !== clientHeight) {
                height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
            }
        }
        // Following steps can't be applied to the document's root element as its
        // client[Width/Height] properties represent viewport area of the window.
        // Besides, it's as well not necessary as the <html> itself neither has
        // rendered scroll bars nor it can be clipped.
        if (!isDocumentElement(target)) {
            // In some browsers (only in Firefox, actually) CSS width & height
            // include scroll bars size which can be removed at this step as scroll
            // bars are the only difference between rounded dimensions + paddings
            // and "client" properties, though that is not always true in Chrome.
            var vertScrollbar = Math.round(width + horizPad) - clientWidth;
            var horizScrollbar = Math.round(height + vertPad) - clientHeight;
            // Chrome has a rather weird rounding of "client" properties.
            // E.g. for an element with content width of 314.2px it sometimes gives
            // the client width of 315px and for the width of 314.7px it may give
            // 314px. And it doesn't happen all the time. So just ignore this delta
            // as a non-relevant.
            if (Math.abs(vertScrollbar) !== 1) {
                width -= vertScrollbar;
            }
            if (Math.abs(horizScrollbar) !== 1) {
                height -= horizScrollbar;
            }
        }
        return createRectInit(paddings.left, paddings.top, width, height);
    }
    /**
     * Checks whether provided element is an instance of the SVGGraphicsElement.
     *
     * @param {Element} target - Element to be checked.
     * @returns {boolean}
     */
    var isSVGGraphicsElement = (function () {
        // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
        // interface.
        if (typeof SVGGraphicsElement !== 'undefined') {
            return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
        }
        // If it's so, then check that element is at least an instance of the
        // SVGElement and that it has the "getBBox" method.
        // eslint-disable-next-line no-extra-parens
        return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
            typeof target.getBBox === 'function'); };
    })();
    /**
     * Checks whether provided element is a document element (<html>).
     *
     * @param {Element} target - Element to be checked.
     * @returns {boolean}
     */
    function isDocumentElement(target) {
        return target === getWindowOf(target).document.documentElement;
    }
    /**
     * Calculates an appropriate content rectangle for provided html or svg element.
     *
     * @param {Element} target - Element content rectangle of which needs to be calculated.
     * @returns {DOMRectInit}
     */
    function getContentRect(target) {
        if (!isBrowser) {
            return emptyRect;
        }
        if (isSVGGraphicsElement(target)) {
            return getSVGContentRect(target);
        }
        return getHTMLElementContentRect(target);
    }
    /**
     * Creates rectangle with an interface of the DOMRectReadOnly.
     * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
     *
     * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
     * @returns {DOMRectReadOnly}
     */
    function createReadOnlyRect(_a) {
        var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
        // If DOMRectReadOnly is available use it as a prototype for the rectangle.
        var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
        var rect = Object.create(Constr.prototype);
        // Rectangle's properties are not writable and non-enumerable.
        defineConfigurable(rect, {
            x: x, y: y, width: width, height: height,
            top: y,
            right: x + width,
            bottom: height + y,
            left: x
        });
        return rect;
    }
    /**
     * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
     * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
     *
     * @param {number} x - X coordinate.
     * @param {number} y - Y coordinate.
     * @param {number} width - Rectangle's width.
     * @param {number} height - Rectangle's height.
     * @returns {DOMRectInit}
     */
    function createRectInit(x, y, width, height) {
        return { x: x, y: y, width: width, height: height };
    }

    /**
     * Class that is responsible for computations of the content rectangle of
     * provided DOM element and for keeping track of it's changes.
     */
    var ResizeObservation = /** @class */ (function () {
        /**
         * Creates an instance of ResizeObservation.
         *
         * @param {Element} target - Element to be observed.
         */
        function ResizeObservation(target) {
            /**
             * Broadcasted width of content rectangle.
             *
             * @type {number}
             */
            this.broadcastWidth = 0;
            /**
             * Broadcasted height of content rectangle.
             *
             * @type {number}
             */
            this.broadcastHeight = 0;
            /**
             * Reference to the last observed content rectangle.
             *
             * @private {DOMRectInit}
             */
            this.contentRect_ = createRectInit(0, 0, 0, 0);
            this.target = target;
        }
        /**
         * Updates content rectangle and tells whether it's width or height properties
         * have changed since the last broadcast.
         *
         * @returns {boolean}
         */
        ResizeObservation.prototype.isActive = function () {
            var rect = getContentRect(this.target);
            this.contentRect_ = rect;
            return (rect.width !== this.broadcastWidth ||
                rect.height !== this.broadcastHeight);
        };
        /**
         * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
         * from the corresponding properties of the last observed content rectangle.
         *
         * @returns {DOMRectInit} Last observed content rectangle.
         */
        ResizeObservation.prototype.broadcastRect = function () {
            var rect = this.contentRect_;
            this.broadcastWidth = rect.width;
            this.broadcastHeight = rect.height;
            return rect;
        };
        return ResizeObservation;
    }());

    var ResizeObserverEntry = /** @class */ (function () {
        /**
         * Creates an instance of ResizeObserverEntry.
         *
         * @param {Element} target - Element that is being observed.
         * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
         */
        function ResizeObserverEntry(target, rectInit) {
            var contentRect = createReadOnlyRect(rectInit);
            // According to the specification following properties are not writable
            // and are also not enumerable in the native implementation.
            //
            // Property accessors are not being used as they'd require to define a
            // private WeakMap storage which may cause memory leaks in browsers that
            // don't support this type of collections.
            defineConfigurable(this, { target: target, contentRect: contentRect });
        }
        return ResizeObserverEntry;
    }());

    var ResizeObserverSPI = /** @class */ (function () {
        /**
         * Creates a new instance of ResizeObserver.
         *
         * @param {ResizeObserverCallback} callback - Callback function that is invoked
         *      when one of the observed elements changes it's content dimensions.
         * @param {ResizeObserverController} controller - Controller instance which
         *      is responsible for the updates of observer.
         * @param {ResizeObserver} callbackCtx - Reference to the public
         *      ResizeObserver instance which will be passed to callback function.
         */
        function ResizeObserverSPI(callback, controller, callbackCtx) {
            /**
             * Collection of resize observations that have detected changes in dimensions
             * of elements.
             *
             * @private {Array<ResizeObservation>}
             */
            this.activeObservations_ = [];
            /**
             * Registry of the ResizeObservation instances.
             *
             * @private {Map<Element, ResizeObservation>}
             */
            this.observations_ = new MapShim();
            if (typeof callback !== 'function') {
                throw new TypeError('The callback provided as parameter 1 is not a function.');
            }
            this.callback_ = callback;
            this.controller_ = controller;
            this.callbackCtx_ = callbackCtx;
        }
        /**
         * Starts observing provided element.
         *
         * @param {Element} target - Element to be observed.
         * @returns {void}
         */
        ResizeObserverSPI.prototype.observe = function (target) {
            if (!arguments.length) {
                throw new TypeError('1 argument required, but only 0 present.');
            }
            // Do nothing if current environment doesn't have the Element interface.
            if (typeof Element === 'undefined' || !(Element instanceof Object)) {
                return;
            }
            if (!(target instanceof getWindowOf(target).Element)) {
                throw new TypeError('parameter 1 is not of type "Element".');
            }
            var observations = this.observations_;
            // Do nothing if element is already being observed.
            if (observations.has(target)) {
                return;
            }
            observations.set(target, new ResizeObservation(target));
            this.controller_.addObserver(this);
            // Force the update of observations.
            this.controller_.refresh();
        };
        /**
         * Stops observing provided element.
         *
         * @param {Element} target - Element to stop observing.
         * @returns {void}
         */
        ResizeObserverSPI.prototype.unobserve = function (target) {
            if (!arguments.length) {
                throw new TypeError('1 argument required, but only 0 present.');
            }
            // Do nothing if current environment doesn't have the Element interface.
            if (typeof Element === 'undefined' || !(Element instanceof Object)) {
                return;
            }
            if (!(target instanceof getWindowOf(target).Element)) {
                throw new TypeError('parameter 1 is not of type "Element".');
            }
            var observations = this.observations_;
            // Do nothing if element is not being observed.
            if (!observations.has(target)) {
                return;
            }
            observations.delete(target);
            if (!observations.size) {
                this.controller_.removeObserver(this);
            }
        };
        /**
         * Stops observing all elements.
         *
         * @returns {void}
         */
        ResizeObserverSPI.prototype.disconnect = function () {
            this.clearActive();
            this.observations_.clear();
            this.controller_.removeObserver(this);
        };
        /**
         * Collects observation instances the associated element of which has changed
         * it's content rectangle.
         *
         * @returns {void}
         */
        ResizeObserverSPI.prototype.gatherActive = function () {
            var _this = this;
            this.clearActive();
            this.observations_.forEach(function (observation) {
                if (observation.isActive()) {
                    _this.activeObservations_.push(observation);
                }
            });
        };
        /**
         * Invokes initial callback function with a list of ResizeObserverEntry
         * instances collected from active resize observations.
         *
         * @returns {void}
         */
        ResizeObserverSPI.prototype.broadcastActive = function () {
            // Do nothing if observer doesn't have active observations.
            if (!this.hasActive()) {
                return;
            }
            var ctx = this.callbackCtx_;
            // Create ResizeObserverEntry instance for every active observation.
            var entries = this.activeObservations_.map(function (observation) {
                return new ResizeObserverEntry(observation.target, observation.broadcastRect());
            });
            this.callback_.call(ctx, entries, ctx);
            this.clearActive();
        };
        /**
         * Clears the collection of active observations.
         *
         * @returns {void}
         */
        ResizeObserverSPI.prototype.clearActive = function () {
            this.activeObservations_.splice(0);
        };
        /**
         * Tells whether observer has active observations.
         *
         * @returns {boolean}
         */
        ResizeObserverSPI.prototype.hasActive = function () {
            return this.activeObservations_.length > 0;
        };
        return ResizeObserverSPI;
    }());

    // Registry of internal observers. If WeakMap is not available use current shim
    // for the Map collection as it has all required methods and because WeakMap
    // can't be fully polyfilled anyway.
    var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
    /**
     * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
     * exposing only those methods and properties that are defined in the spec.
     */
    var ResizeObserver = /** @class */ (function () {
        /**
         * Creates a new instance of ResizeObserver.
         *
         * @param {ResizeObserverCallback} callback - Callback that is invoked when
         *      dimensions of the observed elements change.
         */
        function ResizeObserver(callback) {
            if (!(this instanceof ResizeObserver)) {
                throw new TypeError('Cannot call a class as a function.');
            }
            if (!arguments.length) {
                throw new TypeError('1 argument required, but only 0 present.');
            }
            var controller = ResizeObserverController.getInstance();
            var observer = new ResizeObserverSPI(callback, controller, this);
            observers.set(this, observer);
        }
        return ResizeObserver;
    }());
    // Expose public methods of ResizeObserver.
    [
        'observe',
        'unobserve',
        'disconnect'
    ].forEach(function (method) {
        ResizeObserver.prototype[method] = function () {
            var _a;
            return (_a = observers.get(this))[method].apply(_a, arguments);
        };
    });

    var index = (function () {
        // Export existing implementation if available.
        if (typeof global$1.ResizeObserver !== 'undefined') {
            return global$1.ResizeObserver;
        }
        return ResizeObserver;
    })();

    return index;

})));

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

},{}],894:[function(require,module,exports){
(function (global){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __createBinding;
(function (factory) {
    var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
    if (typeof define === "function" && define.amd) {
        define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
    }
    else if (typeof module === "object" && typeof module.exports === "object") {
        factory(createExporter(root, createExporter(module.exports)));
    }
    else {
        factory(createExporter(root));
    }
    function createExporter(exports, previous) {
        if (exports !== root) {
            if (typeof Object.create === "function") {
                Object.defineProperty(exports, "__esModule", { value: true });
            }
            else {
                exports.__esModule = true;
            }
        }
        return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
    }
})
(function (exporter) {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };

    __extends = function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };

    __assign = Object.assign || function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };

    __rest = function (s, e) {
        var t = {};
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                    t[p[i]] = s[p[i]];
            }
        return t;
    };

    __decorate = function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };

    __param = function (paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    };

    __metadata = function (metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
    };

    __awaiter = function (thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    };

    __generator = function (thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    };

    __createBinding = function(o, m, k, k2) {
        if (k2 === undefined) k2 = k;
        o[k2] = m[k];
    };

    __exportStar = function (m, exports) {
        for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
    };

    __values = function (o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m) return m.call(o);
        if (o && typeof o.length === "number") return {
            next: function () {
                if (o && i >= o.length) o = void 0;
                return { value: o && o[i++], done: !o };
            }
        };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };

    __read = function (o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    };

    __spread = function () {
        for (var ar = [], i = 0; i < arguments.length; i++)
            ar = ar.concat(__read(arguments[i]));
        return ar;
    };

    __spreadArrays = function () {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
                r[k] = a[j];
        return r;
    };

    __await = function (v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    };

    __asyncGenerator = function (thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
        function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
        function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);  }
        function fulfill(value) { resume("next", value); }
        function reject(value) { resume("throw", value); }
        function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
    };

    __asyncDelegator = function (o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
    };

    __asyncValues = function (o) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
    };

    __makeTemplateObject = function (cooked, raw) {
        if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
        return cooked;
    };

    __importStar = function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
        result["default"] = mod;
        return result;
    };

    __importDefault = function (mod) {
        return (mod && mod.__esModule) ? mod : { "default": mod };
    };

    __classPrivateFieldGet = function (receiver, privateMap) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to get private field on non-instance");
        }
        return privateMap.get(receiver);
    };

    __classPrivateFieldSet = function (receiver, privateMap, value) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to set private field on non-instance");
        }
        privateMap.set(receiver, value);
        return value;
    };

    exporter("__extends", __extends);
    exporter("__assign", __assign);
    exporter("__rest", __rest);
    exporter("__decorate", __decorate);
    exporter("__param", __param);
    exporter("__metadata", __metadata);
    exporter("__awaiter", __awaiter);
    exporter("__generator", __generator);
    exporter("__exportStar", __exportStar);
    exporter("__createBinding", __createBinding);
    exporter("__values", __values);
    exporter("__read", __read);
    exporter("__spread", __spread);
    exporter("__spreadArrays", __spreadArrays);
    exporter("__await", __await);
    exporter("__asyncGenerator", __asyncGenerator);
    exporter("__asyncDelegator", __asyncDelegator);
    exporter("__asyncValues", __asyncValues);
    exporter("__makeTemplateObject", __makeTemplateObject);
    exporter("__importStar", __importStar);
    exporter("__importDefault", __importDefault);
    exporter("__classPrivateFieldGet", __classPrivateFieldGet);
    exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

},{}],895:[function(require,module,exports){
(function (process){
/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

'use strict';

/**
 * Similar to invariant but only logs a warning if the condition is not met.
 * This can be used to log issues in development environments in critical
 * paths. Removing the logging code for production environments will keep the
 * same logic and follow the same code paths.
 */

var __DEV__ = process.env.NODE_ENV !== 'production';

var warning = function() {};

if (__DEV__) {
  var printWarning = function printWarning(format, args) {
    var len = arguments.length;
    args = new Array(len > 1 ? len - 1 : 0);
    for (var key = 1; key < len; key++) {
      args[key - 1] = arguments[key];
    }
    var argIndex = 0;
    var message = 'Warning: ' +
      format.replace(/%s/g, function() {
        return args[argIndex++];
      });
    if (typeof console !== 'undefined') {
      console.error(message);
    }
    try {
      // --- Welcome to debugging React ---
      // This error was thrown as a convenience so that you can use this stack
      // to find the callsite that caused this warning to fire.
      throw new Error(message);
    } catch (x) {}
  }

  warning = function(condition, format, args) {
    var len = arguments.length;
    args = new Array(len > 2 ? len - 2 : 0);
    for (var key = 2; key < len; key++) {
      args[key - 2] = arguments[key];
    }
    if (format === undefined) {
      throw new Error(
          '`warning(condition, format, ...args)` requires a warning ' +
          'message argument'
      );
    }
    if (!condition) {
      printWarning.apply(null, [format].concat(args));
    }
  };
}

module.exports = warning;

}).call(this,require('_process'))

},{"_process":1}]},{},[])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 5197616 characters]
