module.exports = (function() {
var __MODS__ = {};
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1751263815802, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Chart = exports.stdlib = exports.geolib = exports.graphlib = exports.plotlib = exports.corelib = exports.litelib = void 0;
const lib_1 = require("./lib");
Object.defineProperty(exports, "litelib", { enumerable: true, get: function () { return lib_1.litelib; } });
Object.defineProperty(exports, "corelib", { enumerable: true, get: function () { return lib_1.corelib; } });
Object.defineProperty(exports, "plotlib", { enumerable: true, get: function () { return lib_1.plotlib; } });
Object.defineProperty(exports, "graphlib", { enumerable: true, get: function () { return lib_1.graphlib; } });
Object.defineProperty(exports, "geolib", { enumerable: true, get: function () { return lib_1.geolib; } });
Object.defineProperty(exports, "stdlib", { enumerable: true, get: function () { return lib_1.stdlib; } });
const api_1 = require("./api");
__exportStar(require("./exports"), exports);
/**
 * G2 standard library initial all the libs except 3D and auto.
 */
const library = Object.assign({}, (0, lib_1.stdlib)());
exports.Chart = (0, api_1.extend)(api_1.Runtime, library);
//# sourceMappingURL=index.js.map
}, function(modId) {var map = {"./lib":1751263815803,"./api":1751263816191,"./exports":1751263816203}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815803, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.litelib = exports.stdlib = exports.plotlib = exports.graphlib = exports.geolib = exports.corelib = void 0;
var core_1 = require("./core");
Object.defineProperty(exports, "corelib", { enumerable: true, get: function () { return core_1.corelib; } });
var geo_1 = require("./geo");
Object.defineProperty(exports, "geolib", { enumerable: true, get: function () { return geo_1.geolib; } });
var graph_1 = require("./graph");
Object.defineProperty(exports, "graphlib", { enumerable: true, get: function () { return graph_1.graphlib; } });
var plot_1 = require("./plot");
Object.defineProperty(exports, "plotlib", { enumerable: true, get: function () { return plot_1.plotlib; } });
var std_1 = require("./std");
Object.defineProperty(exports, "stdlib", { enumerable: true, get: function () { return std_1.stdlib; } });
var lite_1 = require("./lite");
Object.defineProperty(exports, "litelib", { enumerable: true, get: function () { return lite_1.litelib; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./core":1751263815804,"./geo":1751263816186,"./graph":1751263816187,"./plot":1751263816188,"./std":1751263816189,"./lite":1751263816190}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815804, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.corelib = void 0;
const coordinate_1 = require("../coordinate");
const encode_1 = require("../encode");
const mark_1 = require("../mark");
const palette_1 = require("../palette");
const scale_1 = require("../scale");
const theme_1 = require("../theme");
const component_1 = require("../component");
const animation_1 = require("../animation");
const interaction_1 = require("../interaction");
const composition_1 = require("../composition");
const transform_1 = require("../transform");
const data_1 = require("../data");
const label_transform_1 = require("../label-transform");
function corelib() {
    return {
        'data.fetch': data_1.Fetch,
        'data.inline': data_1.Inline,
        'data.sortBy': data_1.SortBy,
        'data.sort': data_1.Sort,
        'data.filter': data_1.Filter,
        'data.pick': data_1.Pick,
        'data.rename': data_1.Rename,
        'data.fold': data_1.Fold,
        'data.slice': data_1.Slice,
        'data.custom': data_1.Custom,
        'data.map': data_1.Map,
        'data.join': data_1.Join,
        'data.kde': data_1.KDE,
        'data.log': data_1.Log,
        'data.wordCloud': data_1.WordCloud,
        'data.ema': data_1.EMA,
        'transform.stackY': transform_1.StackY,
        'transform.binX': transform_1.BinX,
        'transform.bin': transform_1.Bin,
        'transform.dodgeX': transform_1.DodgeX,
        'transform.jitter': transform_1.Jitter,
        'transform.jitterX': transform_1.JitterX,
        'transform.jitterY': transform_1.JitterY,
        'transform.symmetryY': transform_1.SymmetryY,
        'transform.diffY': transform_1.DiffY,
        'transform.stackEnter': transform_1.StackEnter,
        'transform.normalizeY': transform_1.NormalizeY,
        'transform.select': transform_1.Select,
        'transform.selectX': transform_1.SelectX,
        'transform.selectY': transform_1.SelectY,
        'transform.groupX': transform_1.GroupX,
        'transform.groupY': transform_1.GroupY,
        'transform.groupColor': transform_1.GroupColor,
        'transform.group': transform_1.Group,
        'transform.sortX': transform_1.SortX,
        'transform.sortY': transform_1.SortY,
        'transform.sortColor': transform_1.SortColor,
        'transform.flexX': transform_1.FlexX,
        'transform.pack': transform_1.Pack,
        'transform.sample': transform_1.Sample,
        'transform.filter': transform_1.Filter,
        'coordinate.cartesian': coordinate_1.Cartesian,
        'coordinate.polar': coordinate_1.Polar,
        'coordinate.transpose': coordinate_1.Transpose,
        'coordinate.theta': coordinate_1.Theta,
        'coordinate.parallel': coordinate_1.Parallel,
        'coordinate.fisheye': coordinate_1.Fisheye,
        'coordinate.radial': coordinate_1.Radial,
        'coordinate.radar': coordinate_1.Radar,
        'coordinate.helix': coordinate_1.Helix,
        'encode.constant': encode_1.Constant,
        'encode.field': encode_1.Field,
        'encode.transform': encode_1.Transform,
        'encode.column': encode_1.Column,
        'mark.interval': mark_1.Interval,
        'mark.rect': mark_1.Rect,
        'mark.line': mark_1.Line,
        'mark.point': mark_1.Point,
        'mark.text': mark_1.Text,
        'mark.cell': mark_1.Cell,
        'mark.area': mark_1.Area,
        'mark.link': mark_1.Link,
        'mark.image': mark_1.Image,
        'mark.polygon': mark_1.Polygon,
        'mark.box': mark_1.Box,
        'mark.vector': mark_1.Vector,
        'mark.lineX': mark_1.LineX,
        'mark.lineY': mark_1.LineY,
        'mark.connector': mark_1.Connector,
        'mark.range': mark_1.Range,
        'mark.rangeX': mark_1.RangeX,
        'mark.rangeY': mark_1.RangeY,
        'mark.path': mark_1.Path,
        'mark.shape': mark_1.Shape,
        'mark.density': mark_1.Density,
        'mark.heatmap': mark_1.Heatmap,
        'mark.wordCloud': mark_1.WordCloud,
        'palette.category10': palette_1.Category10,
        'palette.category20': palette_1.Category20,
        'scale.linear': scale_1.Linear,
        'scale.ordinal': scale_1.Ordinal,
        'scale.band': scale_1.Band,
        'scale.identity': scale_1.Identity,
        'scale.point': scale_1.Point,
        'scale.time': scale_1.Time,
        'scale.log': scale_1.Log,
        'scale.pow': scale_1.Pow,
        'scale.sqrt': scale_1.Sqrt,
        'scale.threshold': scale_1.Threshold,
        'scale.quantile': scale_1.Quantile,
        'scale.quantize': scale_1.Quantize,
        'scale.sequential': scale_1.Sequential,
        'scale.constant': scale_1.Constant,
        'theme.classic': theme_1.Classic,
        'theme.classicDark': theme_1.ClassicDark,
        'theme.academy': theme_1.Academy,
        'theme.light': theme_1.Light,
        'theme.dark': theme_1.Dark,
        'component.axisX': component_1.AxisX,
        'component.axisY': component_1.AxisY,
        'component.legendCategory': component_1.LegendCategory,
        'component.legendContinuous': component_1.LegendContinuous,
        'component.legends': component_1.Legends,
        'component.title': component_1.TitleComponent,
        'component.sliderX': component_1.SliderX,
        'component.sliderY': component_1.SliderY,
        'component.scrollbarX': component_1.ScrollbarX,
        'component.scrollbarY': component_1.ScrollbarY,
        'animation.scaleInX': animation_1.ScaleInX,
        'animation.scaleOutX': animation_1.ScaleOutX,
        'animation.scaleInY': animation_1.ScaleInY,
        'animation.scaleOutY': animation_1.ScaleOutY,
        'animation.waveIn': animation_1.WaveIn,
        'animation.fadeIn': animation_1.FadeIn,
        'animation.fadeOut': animation_1.FadeOut,
        'animation.zoomIn': animation_1.ZoomIn,
        'animation.zoomOut': animation_1.ZoomOut,
        'animation.pathIn': animation_1.PathIn,
        'animation.morphing': animation_1.Morphing,
        'animation.growInX': animation_1.GrowInX,
        'animation.growInY': animation_1.GrowInY,
        'interaction.elementHighlight': interaction_1.ElementHighlight,
        'interaction.elementHighlightByX': interaction_1.ElementHighlightByX,
        'interaction.elementHighlightByColor': interaction_1.ElementHighlightByColor,
        'interaction.elementSelect': interaction_1.ElementSelect,
        'interaction.elementSelectByX': interaction_1.ElementSelectByX,
        'interaction.elementSelectByColor': interaction_1.ElementSelectByColor,
        'interaction.fisheye': interaction_1.Fisheye,
        'interaction.chartIndex': interaction_1.ChartIndex,
        'interaction.tooltip': interaction_1.Tooltip,
        'interaction.legendFilter': interaction_1.LegendFilter,
        'interaction.legendHighlight': interaction_1.LegendHighlight,
        'interaction.brushHighlight': interaction_1.BrushHighlight,
        'interaction.brushXHighlight': interaction_1.BrushXHighlight,
        'interaction.brushYHighlight': interaction_1.BrushYHighlight,
        'interaction.brushAxisHighlight': interaction_1.BrushAxisHighlight,
        'interaction.brushFilter': interaction_1.BrushFilter,
        'interaction.brushXFilter': interaction_1.BrushXFilter,
        'interaction.brushYFilter': interaction_1.BrushYFilter,
        'interaction.sliderFilter': interaction_1.SliderFilter,
        'interaction.scrollbarFilter': interaction_1.ScrollbarFilter,
        'interaction.poptip': interaction_1.Poptip,
        'interaction.treemapDrillDown': interaction_1.TreemapDrillDown,
        'interaction.elementPointMove': interaction_1.ElementPointMove,
        'composition.spaceLayer': composition_1.SpaceLayer,
        'composition.spaceFlex': composition_1.SpaceFlex,
        'composition.facetRect': composition_1.FacetRect,
        'composition.repeatMatrix': composition_1.RepeatMatrix,
        'composition.facetCircle': composition_1.FacetCircle,
        'composition.timingKeyframe': composition_1.TimingKeyframe,
        'labelTransform.overlapHide': label_transform_1.OverlapHide,
        'labelTransform.overlapDodgeY': label_transform_1.OverlapDodgeY,
        'labelTransform.overflowHide': label_transform_1.OverflowHide,
        'labelTransform.contrastReverse': label_transform_1.ContrastReverse,
        'labelTransform.exceedAdjust': label_transform_1.ExceedAdjust,
    };
}
exports.corelib = corelib;
//# sourceMappingURL=core.js.map
}, function(modId) { var map = {"../coordinate":1751263815805,"../encode":1751263815816,"../mark":1751263815821,"../palette":1751263816018,"../scale":1751263816021,"../theme":1751263816036,"../component":1751263816043,"../animation":1751263816063,"../interaction":1751263816078,"../composition":1751263816099,"../transform":1751263815823,"../data":1751263816146,"../label-transform":1751263816178}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815805, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Radar = exports.Fisheye = exports.Parallel = exports.getRadialOptions = exports.Radial = exports.getThetaOptions = exports.Theta = exports.Transpose = exports.Helix = exports.getPolarOptions = exports.Polar = exports.Cartesian = void 0;
var cartesian_1 = require("./cartesian");
Object.defineProperty(exports, "Cartesian", { enumerable: true, get: function () { return cartesian_1.Cartesian; } });
var polar_1 = require("./polar");
Object.defineProperty(exports, "Polar", { enumerable: true, get: function () { return polar_1.Polar; } });
Object.defineProperty(exports, "getPolarOptions", { enumerable: true, get: function () { return polar_1.getPolarOptions; } });
var helix_1 = require("./helix");
Object.defineProperty(exports, "Helix", { enumerable: true, get: function () { return helix_1.Helix; } });
var transpose_1 = require("./transpose");
Object.defineProperty(exports, "Transpose", { enumerable: true, get: function () { return transpose_1.Transpose; } });
var theta_1 = require("./theta");
Object.defineProperty(exports, "Theta", { enumerable: true, get: function () { return theta_1.Theta; } });
Object.defineProperty(exports, "getThetaOptions", { enumerable: true, get: function () { return theta_1.getThetaOptions; } });
var radial_1 = require("./radial");
Object.defineProperty(exports, "Radial", { enumerable: true, get: function () { return radial_1.Radial; } });
Object.defineProperty(exports, "getRadialOptions", { enumerable: true, get: function () { return radial_1.getRadialOptions; } });
var parallel_1 = require("./parallel");
Object.defineProperty(exports, "Parallel", { enumerable: true, get: function () { return parallel_1.Parallel; } });
var fisheye_1 = require("./fisheye");
Object.defineProperty(exports, "Fisheye", { enumerable: true, get: function () { return fisheye_1.Fisheye; } });
var radar_1 = require("./radar");
Object.defineProperty(exports, "Radar", { enumerable: true, get: function () { return radar_1.Radar; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./cartesian":1751263815806,"./polar":1751263815807,"./helix":1751263815809,"./transpose":1751263815810,"./theta":1751263815811,"./radial":1751263815812,"./parallel":1751263815813,"./fisheye":1751263815814,"./radar":1751263815815}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815806, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Cartesian = void 0;
/**
 * Default coordinate transformation for all charts.
 */
const Cartesian = () => [['cartesian']];
exports.Cartesian = Cartesian;
exports.Cartesian.props = {};
//# sourceMappingURL=cartesian.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815807, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Polar = exports.getPolarOptions = void 0;
const angle_1 = require("../utils/angle");
const getPolarOptions = (options = {}) => {
    const defaultOptions = {
        startAngle: -Math.PI / 2,
        endAngle: (Math.PI * 3) / 2,
        innerRadius: 0,
        outerRadius: 1,
    };
    const polarOption = Object.assign(Object.assign({}, defaultOptions), options);
    return Object.assign(Object.assign({}, polarOption), (0, angle_1.convertAngles)(polarOption.startAngle, polarOption.endAngle));
};
exports.getPolarOptions = getPolarOptions;
/**
 * Polar transformation for circular charts using center of canvas as origin.
 * @todo Adjust size of canvas by startAngle and endAngle to make chart as big as possible.
 */
const Polar = (options) => {
    const { startAngle, endAngle, innerRadius, outerRadius } = (0, exports.getPolarOptions)(options);
    return [
        ['translate', 0, 0.5],
        ['reflect.y'],
        ['translate', 0, -0.5],
        ['polar', startAngle, endAngle, innerRadius, outerRadius],
    ];
};
exports.Polar = Polar;
exports.Polar.props = {};
//# sourceMappingURL=polar.js.map
}, function(modId) { var map = {"../utils/angle":1751263815808}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815808, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.convertAngles = exports.toDegree = exports.toRadian = void 0;
function toRadian(degree) {
    return (degree * Math.PI) / 180;
}
exports.toRadian = toRadian;
function toDegree(radian) {
    return (radian * 180) / Math.PI;
}
exports.toDegree = toDegree;
// convert the angle to the range of 0 to 4*Math.PI
function convertAngles(startAngle, endAngle) {
    startAngle = startAngle % (2 * Math.PI);
    endAngle = endAngle % (2 * Math.PI);
    if (startAngle < 0) {
        startAngle = 2 * Math.PI + startAngle;
    }
    if (endAngle < 0) {
        endAngle = 2 * Math.PI + endAngle;
    }
    if (startAngle >= endAngle) {
        endAngle = endAngle + 2 * Math.PI;
    }
    return {
        startAngle,
        endAngle,
    };
}
exports.convertAngles = convertAngles;
//# sourceMappingURL=angle.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815809, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Helix = void 0;
/**
 * Helix
 */
const Helix = ({ startAngle = 0, endAngle = Math.PI * 6, innerRadius = 0, outerRadius = 1, }) => [
    ['translate', 0.5, 0.5],
    ['reflect.y'],
    ['translate', -0.5, -0.5],
    ['helix', startAngle, endAngle, innerRadius, outerRadius],
];
exports.Helix = Helix;
exports.Helix.props = {};
//# sourceMappingURL=helix.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815810, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Transpose = void 0;
/**
 * Transpose transformation for transposing chart according to center of canvas.
 */
const Transpose = () => [
    ['transpose'],
    ['translate', 0.5, 0.5],
    ['reflect.x'],
    ['translate', -0.5, -0.5],
];
exports.Transpose = Transpose;
exports.Transpose.props = { transform: true };
//# sourceMappingURL=transpose.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815811, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Theta = exports.getThetaOptions = void 0;
const polar_1 = require("./polar");
const transpose_1 = require("./transpose");
const getThetaOptions = (options = {}) => {
    const defaultOptions = {
        startAngle: -Math.PI / 2,
        endAngle: (Math.PI * 3) / 2,
        innerRadius: 0,
        outerRadius: 1,
    };
    return Object.assign(Object.assign({}, defaultOptions), options);
};
exports.getThetaOptions = getThetaOptions;
/**
 * Theta = Transpose + Polar.
 */
const Theta = (options) => {
    const { startAngle, endAngle, innerRadius, outerRadius } = (0, exports.getThetaOptions)(options);
    return [
        ...(0, transpose_1.Transpose)(),
        ...(0, polar_1.Polar)({ startAngle, endAngle, innerRadius, outerRadius }),
    ];
};
exports.Theta = Theta;
exports.Theta.props = {};
//# sourceMappingURL=theta.js.map
}, function(modId) { var map = {"./polar":1751263815807,"./transpose":1751263815810}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815812, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Radial = exports.getRadialOptions = void 0;
const polar_1 = require("./polar");
const getRadialOptions = (options = {}) => {
    const defaultOptions = {
        startAngle: -Math.PI / 2,
        endAngle: (Math.PI * 3) / 2,
        innerRadius: 0,
        outerRadius: 1,
    };
    return Object.assign(Object.assign({}, defaultOptions), options);
};
exports.getRadialOptions = getRadialOptions;
/**
 * Radial
 */
const Radial = (options) => {
    const { startAngle, endAngle, innerRadius, outerRadius } = (0, exports.getRadialOptions)(options);
    return [
        ['transpose'],
        ['translate', 0.5, 0.5],
        ['reflect'],
        ['translate', -0.5, -0.5],
        ...(0, polar_1.Polar)({ startAngle, endAngle, innerRadius, outerRadius }),
    ];
};
exports.Radial = Radial;
exports.Radial.props = {};
//# sourceMappingURL=radial.js.map
}, function(modId) { var map = {"./polar":1751263815807}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815813, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Parallel = void 0;
/**
 * Parallel coordinate transformations for parallel coordinate.
 */
const Parallel = () => [['parallel', 0, 1, 0, 1]];
exports.Parallel = Parallel;
exports.Parallel.props = {};
//# sourceMappingURL=parallel.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815814, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Fisheye = void 0;
/**
 * Fisheye
 */
const Fisheye = ({ focusX = 0, focusY = 0, distortionX = 2, distortionY = 2, visual = false, }) => [['fisheye', focusX, focusY, distortionX, distortionY, visual]];
exports.Fisheye = Fisheye;
exports.Fisheye.props = { transform: true };
//# sourceMappingURL=fisheye.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815815, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Radar = void 0;
const polar_1 = require("./polar");
const parallel_1 = require("./parallel");
/**
 *  Radar = Parallel + Polar.
 */
const Radar = (options) => {
    const { startAngle = -Math.PI / 2, endAngle = (Math.PI * 3) / 2, innerRadius = 0, outerRadius = 1, } = options;
    return [
        ...(0, parallel_1.Parallel)(),
        ...(0, polar_1.Polar)({ startAngle, endAngle, innerRadius, outerRadius }),
    ];
};
exports.Radar = Radar;
exports.Radar.props = {};
//# sourceMappingURL=radar.js.map
}, function(modId) { var map = {"./polar":1751263815807,"./parallel":1751263815813}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815816, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Column = exports.Field = exports.Transform = exports.Constant = void 0;
var constant_1 = require("./constant");
Object.defineProperty(exports, "Constant", { enumerable: true, get: function () { return constant_1.Constant; } });
var transform_1 = require("./transform");
Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return transform_1.Transform; } });
var field_1 = require("./field");
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return field_1.Field; } });
var column_1 = require("./column");
Object.defineProperty(exports, "Column", { enumerable: true, get: function () { return column_1.Column; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./constant":1751263815817,"./transform":1751263815818,"./field":1751263815819,"./column":1751263815820}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815817, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Constant = void 0;
/**
 * Extract a column of data filled with the specified constant.
 */
const Constant = ({ value }) => {
    return (data) => data.map(() => value);
};
exports.Constant = Constant;
exports.Constant.props = {};
//# sourceMappingURL=constant.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815818, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Transform = void 0;
/**
 * Extract a column of data with specified map function from data.
 * Each datum in the array is not visual data by default.
 * Specifying identity scale for related channel explicitly will treat them as visual data.
 */
const Transform = ({ value }) => {
    return (data) => data.map(value);
};
exports.Transform = Transform;
exports.Transform.props = {};
//# sourceMappingURL=transform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815819, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Field = void 0;
/**
 * Extract a column of data with specified field.
 */
const Field = ({ value }) => {
    return (data) => data.map((d) => d[value]);
};
exports.Field = Field;
exports.Field.props = {};
//# sourceMappingURL=field.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815820, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Column = void 0;
/**
 * Extract a column of data specified in encoding.
 */
const Column = ({ value }) => {
    return () => value;
};
exports.Column = Column;
exports.Column.props = {};
//# sourceMappingURL=column.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815821, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Liquid = exports.Heatmap = exports.Density = exports.Gauge = exports.WordCloud = exports.Tree = exports.ForceGraph = exports.Shape = exports.Boxplot = exports.Pack = exports.Treemap = exports.Path = exports.Chord = exports.Sankey = exports.RangeY = exports.RangeX = exports.Range = exports.Connector = exports.LineX = exports.LineY = exports.Vector = exports.Box = exports.Polygon = exports.Image = exports.Link = exports.Area = exports.Cell = exports.Text = exports.Point = exports.Line = exports.Rect = exports.Interval = void 0;
var interval_1 = require("./interval");
Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return interval_1.Interval; } });
var rect_1 = require("./rect");
Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.Rect; } });
var line_1 = require("./line");
Object.defineProperty(exports, "Line", { enumerable: true, get: function () { return line_1.Line; } });
var point_1 = require("./point");
Object.defineProperty(exports, "Point", { enumerable: true, get: function () { return point_1.Point; } });
var text_1 = require("./text");
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.Text; } });
var cell_1 = require("./cell");
Object.defineProperty(exports, "Cell", { enumerable: true, get: function () { return cell_1.Cell; } });
var area_1 = require("./area");
Object.defineProperty(exports, "Area", { enumerable: true, get: function () { return area_1.Area; } });
var link_1 = require("./link");
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return link_1.Link; } });
var image_1 = require("./image");
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_1.Image; } });
var polygon_1 = require("./polygon");
Object.defineProperty(exports, "Polygon", { enumerable: true, get: function () { return polygon_1.Polygon; } });
var box_1 = require("./box");
Object.defineProperty(exports, "Box", { enumerable: true, get: function () { return box_1.Box; } });
var vector_1 = require("./vector");
Object.defineProperty(exports, "Vector", { enumerable: true, get: function () { return vector_1.Vector; } });
var lineY_1 = require("./lineY");
Object.defineProperty(exports, "LineY", { enumerable: true, get: function () { return lineY_1.LineY; } });
var lineX_1 = require("./lineX");
Object.defineProperty(exports, "LineX", { enumerable: true, get: function () { return lineX_1.LineX; } });
var connector_1 = require("./connector");
Object.defineProperty(exports, "Connector", { enumerable: true, get: function () { return connector_1.Connector; } });
var range_1 = require("./range");
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return range_1.Range; } });
var rangeX_1 = require("./rangeX");
Object.defineProperty(exports, "RangeX", { enumerable: true, get: function () { return rangeX_1.RangeX; } });
var rangeY_1 = require("./rangeY");
Object.defineProperty(exports, "RangeY", { enumerable: true, get: function () { return rangeY_1.RangeY; } });
var sankey_1 = require("./sankey");
Object.defineProperty(exports, "Sankey", { enumerable: true, get: function () { return sankey_1.Sankey; } });
var chord_1 = require("./chord");
Object.defineProperty(exports, "Chord", { enumerable: true, get: function () { return chord_1.Chord; } });
var path_1 = require("./path");
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return path_1.Path; } });
var treemap_1 = require("./treemap");
Object.defineProperty(exports, "Treemap", { enumerable: true, get: function () { return treemap_1.Treemap; } });
var pack_1 = require("./pack");
Object.defineProperty(exports, "Pack", { enumerable: true, get: function () { return pack_1.Pack; } });
var boxplot_1 = require("./boxplot");
Object.defineProperty(exports, "Boxplot", { enumerable: true, get: function () { return boxplot_1.Boxplot; } });
var shape_1 = require("./shape");
Object.defineProperty(exports, "Shape", { enumerable: true, get: function () { return shape_1.Shape; } });
var forceGraph_1 = require("./forceGraph");
Object.defineProperty(exports, "ForceGraph", { enumerable: true, get: function () { return forceGraph_1.ForceGraph; } });
var tree_1 = require("./tree");
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return tree_1.Tree; } });
var wordCloud_1 = require("./wordCloud");
Object.defineProperty(exports, "WordCloud", { enumerable: true, get: function () { return wordCloud_1.WordCloud; } });
var gauge_1 = require("./gauge");
Object.defineProperty(exports, "Gauge", { enumerable: true, get: function () { return gauge_1.Gauge; } });
var density_1 = require("./density");
Object.defineProperty(exports, "Density", { enumerable: true, get: function () { return density_1.Density; } });
var heatmap_1 = require("./heatmap");
Object.defineProperty(exports, "Heatmap", { enumerable: true, get: function () { return heatmap_1.Heatmap; } });
var liquid_1 = require("./liquid");
Object.defineProperty(exports, "Liquid", { enumerable: true, get: function () { return liquid_1.Liquid; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./interval":1751263815822,"./rect":1751263815974,"./line":1751263815975,"./point":1751263815976,"./text":1751263815977,"./cell":1751263815978,"./area":1751263815979,"./link":1751263815980,"./image":1751263815981,"./polygon":1751263815982,"./box":1751263815983,"./vector":1751263815984,"./lineY":1751263815985,"./lineX":1751263815986,"./connector":1751263815987,"./range":1751263815988,"./rangeX":1751263815989,"./rangeY":1751263815990,"./sankey":1751263815991,"./chord":1751263815998,"./path":1751263816003,"./treemap":1751263816004,"./pack":1751263816006,"./boxplot":1751263816007,"./shape":1751263816008,"./forceGraph":1751263816009,"./tree":1751263816010,"./wordCloud":1751263816013,"./gauge":1751263816014,"./density":1751263816015,"./heatmap":1751263816016,"./liquid":1751263816017}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815822, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Interval = void 0;
const transform_1 = require("../transform");
const shape_1 = require("../shape");
const utils_1 = require("./utils");
function bandWidth(scale, x) {
    return scale.getBandWidth(scale.invert(x));
}
const shape = {
    rect: shape_1.IntervalShape,
    hollow: shape_1.IntervalHollow,
    funnel: shape_1.IntervalFunnel,
    pyramid: shape_1.IntervalPyramid,
};
/**
 * Convert value for each channel to rect shapes.
 * p0        p1
 *    ┌────┐
 *    │    │
 *    │    │
 * p3 └────┘ p2
 */
const Interval = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, y1: Y1, series: S, size: SZ } = value;
        // Calc width for each interval.
        // The scales for x and series channels must be band scale.
        const x = scale.x;
        const series = scale.series;
        const [width] = coordinate.getSize();
        const NSZ = SZ ? SZ.map((d) => +d / width) : null;
        const x1x2 = !SZ
            ? (x, w, i) => [x, x + w]
            : (x, w, i) => {
                const mx = x + w / 2;
                const s = NSZ[i];
                return [mx - s / 2, mx + s / 2];
            };
        // Calc the points of bounding box for the interval.
        // They are start from left-top corner in clock wise order.
        const P = Array.from(index, (i) => {
            const groupWidth = bandWidth(x, X[i]);
            const ratio = series ? bandWidth(series, S === null || S === void 0 ? void 0 : S[i]) : 1;
            const width = groupWidth * ratio;
            const offset = (+(S === null || S === void 0 ? void 0 : S[i]) || 0) * groupWidth;
            const x0 = +X[i] + offset;
            const [x1, x2] = x1x2(x0, width, i);
            const y1 = +Y[i];
            const y2 = +Y1[i];
            const p1 = [x1, y1];
            const p2 = [x2, y1];
            const p3 = [x2, y2];
            const p4 = [x1, y2];
            return [p1, p2, p3, p4].map((d) => coordinate.map(d));
        });
        return [index, P];
    };
};
exports.Interval = Interval;
exports.Interval.props = {
    defaultShape: 'rect',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', scale: 'band', required: true },
        { name: 'y', required: true },
        { name: 'series', scale: 'band' },
        { name: 'size' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeZeroY1 },
        { type: transform_1.MaybeZeroX },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
    interaction: { shareTooltip: true },
};
//# sourceMappingURL=interval.js.map
}, function(modId) { var map = {"../transform":1751263815823,"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815823, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Filter = exports.Sample = exports.Bin = exports.BinX = exports.Pack = exports.FlexX = exports.SortY = exports.SortColor = exports.SortX = exports.GroupColor = exports.Group = exports.GroupY = exports.GroupX = exports.SelectY = exports.SelectX = exports.Select = exports.DiffY = exports.SymmetryY = exports.JitterY = exports.JitterX = exports.Jitter = exports.NormalizeY = exports.StackEnter = exports.DodgeX = exports.StackY = exports.MaybeGradient = exports.MaybeTuple = exports.MaybeFunctionAttribute = exports.MaybeVisualPosition = exports.MaybeZeroPadding = exports.MaybeTooltip = exports.MaybeDefaultY = exports.MaybeDefaultX = exports.MaybeIdentityX = exports.MaybeIdentityY = exports.MaybeTupleX = exports.MaybeTupleY = exports.MaybeSeries = exports.MaybeKey = exports.MaybeSize = exports.MaybeZeroZ = exports.MaybeZeroY = exports.MaybeZeroX = exports.MaybeTitle = exports.MaybeStackY = exports.MaybeZeroY1 = void 0;
var maybeZeroY1_1 = require("./maybeZeroY1");
Object.defineProperty(exports, "MaybeZeroY1", { enumerable: true, get: function () { return maybeZeroY1_1.MaybeZeroY1; } });
var maybeStackY_1 = require("./maybeStackY");
Object.defineProperty(exports, "MaybeStackY", { enumerable: true, get: function () { return maybeStackY_1.MaybeStackY; } });
var maybeTitle_1 = require("./maybeTitle");
Object.defineProperty(exports, "MaybeTitle", { enumerable: true, get: function () { return maybeTitle_1.MaybeTitle; } });
var maybeZeroX_1 = require("./maybeZeroX");
Object.defineProperty(exports, "MaybeZeroX", { enumerable: true, get: function () { return maybeZeroX_1.MaybeZeroX; } });
var maybeZeroY_1 = require("./maybeZeroY");
Object.defineProperty(exports, "MaybeZeroY", { enumerable: true, get: function () { return maybeZeroY_1.MaybeZeroY; } });
var maybeZeroZ_1 = require("./maybeZeroZ");
Object.defineProperty(exports, "MaybeZeroZ", { enumerable: true, get: function () { return maybeZeroZ_1.MaybeZeroZ; } });
var maybeSize_1 = require("./maybeSize");
Object.defineProperty(exports, "MaybeSize", { enumerable: true, get: function () { return maybeSize_1.MaybeSize; } });
var maybeKey_1 = require("./maybeKey");
Object.defineProperty(exports, "MaybeKey", { enumerable: true, get: function () { return maybeKey_1.MaybeKey; } });
var maybeSeries_1 = require("./maybeSeries");
Object.defineProperty(exports, "MaybeSeries", { enumerable: true, get: function () { return maybeSeries_1.MaybeSeries; } });
var maybeTupleY_1 = require("./maybeTupleY");
Object.defineProperty(exports, "MaybeTupleY", { enumerable: true, get: function () { return maybeTupleY_1.MaybeTupleY; } });
var maybeTupleX_1 = require("./maybeTupleX");
Object.defineProperty(exports, "MaybeTupleX", { enumerable: true, get: function () { return maybeTupleX_1.MaybeTupleX; } });
var maybeIdentityY_1 = require("./maybeIdentityY");
Object.defineProperty(exports, "MaybeIdentityY", { enumerable: true, get: function () { return maybeIdentityY_1.MaybeIdentityY; } });
var maybeIdentityX_1 = require("./maybeIdentityX");
Object.defineProperty(exports, "MaybeIdentityX", { enumerable: true, get: function () { return maybeIdentityX_1.MaybeIdentityX; } });
var maybeDefaultX_1 = require("./maybeDefaultX");
Object.defineProperty(exports, "MaybeDefaultX", { enumerable: true, get: function () { return maybeDefaultX_1.MaybeDefaultX; } });
var maybeDefaultY_1 = require("./maybeDefaultY");
Object.defineProperty(exports, "MaybeDefaultY", { enumerable: true, get: function () { return maybeDefaultY_1.MaybeDefaultY; } });
var maybeTooltip_1 = require("./maybeTooltip");
Object.defineProperty(exports, "MaybeTooltip", { enumerable: true, get: function () { return maybeTooltip_1.MaybeTooltip; } });
var maybeZeroPadding_1 = require("./maybeZeroPadding");
Object.defineProperty(exports, "MaybeZeroPadding", { enumerable: true, get: function () { return maybeZeroPadding_1.MaybeZeroPadding; } });
var maybeVisualPosition_1 = require("./maybeVisualPosition");
Object.defineProperty(exports, "MaybeVisualPosition", { enumerable: true, get: function () { return maybeVisualPosition_1.MaybeVisualPosition; } });
var maybeFunctionAttribute_1 = require("./maybeFunctionAttribute");
Object.defineProperty(exports, "MaybeFunctionAttribute", { enumerable: true, get: function () { return maybeFunctionAttribute_1.MaybeFunctionAttribute; } });
var maybeTuple_1 = require("./maybeTuple");
Object.defineProperty(exports, "MaybeTuple", { enumerable: true, get: function () { return maybeTuple_1.MaybeTuple; } });
var maybeGradient_1 = require("./maybeGradient");
Object.defineProperty(exports, "MaybeGradient", { enumerable: true, get: function () { return maybeGradient_1.MaybeGradient; } });
var stackY_1 = require("./stackY");
Object.defineProperty(exports, "StackY", { enumerable: true, get: function () { return stackY_1.StackY; } });
var dodgeX_1 = require("./dodgeX");
Object.defineProperty(exports, "DodgeX", { enumerable: true, get: function () { return dodgeX_1.DodgeX; } });
var stackEnter_1 = require("./stackEnter");
Object.defineProperty(exports, "StackEnter", { enumerable: true, get: function () { return stackEnter_1.StackEnter; } });
var normalizeY_1 = require("./normalizeY");
Object.defineProperty(exports, "NormalizeY", { enumerable: true, get: function () { return normalizeY_1.NormalizeY; } });
var jitter_1 = require("./jitter");
Object.defineProperty(exports, "Jitter", { enumerable: true, get: function () { return jitter_1.Jitter; } });
var jitterX_1 = require("./jitterX");
Object.defineProperty(exports, "JitterX", { enumerable: true, get: function () { return jitterX_1.JitterX; } });
var jitterY_1 = require("./jitterY");
Object.defineProperty(exports, "JitterY", { enumerable: true, get: function () { return jitterY_1.JitterY; } });
var symmetryY_1 = require("./symmetryY");
Object.defineProperty(exports, "SymmetryY", { enumerable: true, get: function () { return symmetryY_1.SymmetryY; } });
var diffY_1 = require("./diffY");
Object.defineProperty(exports, "DiffY", { enumerable: true, get: function () { return diffY_1.DiffY; } });
var select_1 = require("./select");
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return select_1.Select; } });
var selectX_1 = require("./selectX");
Object.defineProperty(exports, "SelectX", { enumerable: true, get: function () { return selectX_1.SelectX; } });
var selectY_1 = require("./selectY");
Object.defineProperty(exports, "SelectY", { enumerable: true, get: function () { return selectY_1.SelectY; } });
var groupX_1 = require("./groupX");
Object.defineProperty(exports, "GroupX", { enumerable: true, get: function () { return groupX_1.GroupX; } });
var groupY_1 = require("./groupY");
Object.defineProperty(exports, "GroupY", { enumerable: true, get: function () { return groupY_1.GroupY; } });
var group_1 = require("./group");
Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return group_1.Group; } });
var groupColor_1 = require("./groupColor");
Object.defineProperty(exports, "GroupColor", { enumerable: true, get: function () { return groupColor_1.GroupColor; } });
var sortX_1 = require("./sortX");
Object.defineProperty(exports, "SortX", { enumerable: true, get: function () { return sortX_1.SortX; } });
var sortColor_1 = require("./sortColor");
Object.defineProperty(exports, "SortColor", { enumerable: true, get: function () { return sortColor_1.SortColor; } });
var sortY_1 = require("./sortY");
Object.defineProperty(exports, "SortY", { enumerable: true, get: function () { return sortY_1.SortY; } });
var flexX_1 = require("./flexX");
Object.defineProperty(exports, "FlexX", { enumerable: true, get: function () { return flexX_1.FlexX; } });
var pack_1 = require("./pack");
Object.defineProperty(exports, "Pack", { enumerable: true, get: function () { return pack_1.Pack; } });
var binX_1 = require("./binX");
Object.defineProperty(exports, "BinX", { enumerable: true, get: function () { return binX_1.BinX; } });
var bin_1 = require("./bin");
Object.defineProperty(exports, "Bin", { enumerable: true, get: function () { return bin_1.Bin; } });
var sample_1 = require("./sample");
Object.defineProperty(exports, "Sample", { enumerable: true, get: function () { return sample_1.Sample; } });
var filter_1 = require("./filter");
Object.defineProperty(exports, "Filter", { enumerable: true, get: function () { return filter_1.Filter; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./maybeZeroY1":1751263815824,"./maybeStackY":1751263815826,"./maybeTitle":1751263815831,"./maybeZeroX":1751263815833,"./maybeZeroY":1751263815834,"./maybeZeroZ":1751263815835,"./maybeSize":1751263815836,"./maybeKey":1751263815837,"./maybeSeries":1751263815838,"./maybeTupleY":1751263815839,"./maybeTupleX":1751263815840,"./maybeIdentityY":1751263815841,"./maybeIdentityX":1751263815842,"./maybeDefaultX":1751263815843,"./maybeDefaultY":1751263815844,"./maybeTooltip":1751263815845,"./maybeZeroPadding":1751263815846,"./maybeVisualPosition":1751263815847,"./maybeFunctionAttribute":1751263815848,"./maybeTuple":1751263815849,"./maybeGradient":1751263815850,"./stackY":1751263815827,"./dodgeX":1751263815851,"./stackEnter":1751263815852,"./normalizeY":1751263815853,"./jitter":1751263815854,"./jitterX":1751263815855,"./jitterY":1751263815856,"./symmetryY":1751263815857,"./diffY":1751263815858,"./select":1751263815859,"./selectX":1751263815860,"./selectY":1751263815861,"./groupX":1751263815862,"./groupY":1751263815865,"./group":1751263815863,"./groupColor":1751263815866,"./sortX":1751263815867,"./sortColor":1751263815869,"./sortY":1751263815870,"./flexX":1751263815871,"./pack":1751263815872,"./binX":1751263815874,"./bin":1751263815875,"./sample":1751263815876,"./filter":1751263815878}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815824, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeZeroY1 = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add zero constant encode for y1 channel.
 */
const MaybeZeroY1 = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { y1 } = encode;
        if (y1 !== undefined)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: { y1: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
            }),
        ];
    };
};
exports.MaybeZeroY1 = MaybeZeroY1;
exports.MaybeZeroY1.props = {};
//# sourceMappingURL=maybeZeroY1.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815825, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.isObject = exports.maybeColumnOf = exports.columnOf = exports.constant = exports.nonConstantColumn = exports.visualColumn = exports.inferredColumn = exports.column = void 0;
function column(value, field) {
    if (value === null)
        return undefined;
    return { type: 'column', value, field };
}
exports.column = column;
function inferredColumn(value, field) {
    const c = column(value, field);
    return Object.assign(Object.assign({}, c), { inferred: true });
}
exports.inferredColumn = inferredColumn;
function visualColumn(value, field) {
    if (value === null)
        return undefined;
    return { type: 'column', value, field, visual: true };
}
exports.visualColumn = visualColumn;
function nonConstantColumn(value, field) {
    const c = column(value, field);
    return Object.assign(Object.assign({}, c), { constant: false });
}
exports.nonConstantColumn = nonConstantColumn;
function constant(I, value) {
    const array = [];
    for (const i of I)
        array[i] = value;
    return array;
}
exports.constant = constant;
function columnOf(encode, key) {
    const channel = encode[key];
    if (!channel)
        return [null, null];
    const { value, field = null } = channel;
    return [value, field];
}
exports.columnOf = columnOf;
function maybeColumnOf(encode, ...K) {
    for (const key of K) {
        if (typeof key === 'string') {
            const [KV, fv] = columnOf(encode, key);
            if (KV !== null)
                return [KV, fv];
        }
        else {
            return [key, null];
        }
    }
    return [null, null];
}
exports.maybeColumnOf = maybeColumnOf;
function isObject(d) {
    if (d instanceof Date)
        return false;
    return typeof d === 'object';
}
exports.isObject = isObject;
//# sourceMappingURL=helper.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815826, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeStackY = void 0;
const stackY_1 = require("./stackY");
// Avoid duplicate stackY.
// In most of case only one of stackY and dodgeX is needed.
// So pass statistic with stackY and dodgeX.
function exclude(transform) {
    const { type } = transform;
    const excludes = ['stackY', 'dodgeX', 'groupX'];
    return typeof type === 'string' && excludes.includes(type);
}
/**
 * Add zero constant encode for x channel.
 * This is useful for interval geometry.
 */
const MaybeStackY = (options) => {
    return (I, mark, context) => {
        // Skip some transform.
        const { encode, transform = [] } = mark;
        if (transform.some(exclude))
            return [I, mark];
        // StackY need both x and y channel values.
        const { x, y } = encode;
        if (x === undefined || y === undefined)
            return [I, mark];
        const { series } = options;
        const groupBy = series ? ['x', 'series'] : 'x';
        return (0, stackY_1.StackY)({ groupBy })(I, mark, context);
    };
};
exports.MaybeStackY = MaybeStackY;
exports.MaybeStackY.props = {};
//# sourceMappingURL=maybeStackY.js.map
}, function(modId) { var map = {"./stackY":1751263815827}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815827, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.StackY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
/**
 * The stack transform group marks into series by color channel,
 * and then produce new y channel for each series by specified order,
 * say to form vertical "stacks" by specified channels.
 */
const StackY = (options = {}) => {
    const { groupBy = 'x', orderBy = null, reverse = false, y: fromY = 'y', y1: fromY1 = 'y1', series = true, } = options;
    return (I, mark) => {
        var _a;
        const { data, encode, style = {} } = mark;
        const [Y, fy] = (0, helper_1.columnOf)(encode, 'y');
        const [Y1, fy1] = (0, helper_1.columnOf)(encode, 'y1');
        const [S] = series
            ? (0, helper_1.maybeColumnOf)(encode, 'series', 'color')
            : (0, helper_1.columnOf)(encode, 'color');
        // Create groups and apply specified order for each group.
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        const createComparator = (_a = (0, order_1.normalizeComparator)(orderBy)) !== null && _a !== void 0 ? _a : (() => null);
        const comparator = createComparator(data, Y, S);
        if (comparator)
            (0, order_1.applyOrder)(groups, comparator);
        // Stack y channels to produce new y and y1 channel.
        const newY = new Array(I.length);
        const newY1 = new Array(I.length);
        const TY = new Array(I.length);
        const F = [];
        const L = [];
        for (const G of groups) {
            if (reverse)
                G.reverse();
            // For range interval with specified y and y1.
            const start = Y1 ? +Y1[G[0]] : 0;
            // Split positive indices of Y and negative Y.
            const PG = [];
            const NG = [];
            for (const i of G) {
                const y = (TY[i] = +Y[i] - start);
                if (y < 0)
                    NG.push(i);
                else if (y >= 0)
                    PG.push(i);
            }
            // Store the first and last layer.
            const FG = PG.length > 0 ? PG : NG;
            const LG = NG.length > 0 ? NG : PG;
            let i = PG.length - 1;
            let j = 0;
            // Find the last non-zero index.
            while (i > 0 && Y[FG[i]] === 0)
                i--;
            // Find the first non-zero index.
            while (j < LG.length - 1 && Y[LG[j]] === 0)
                j++;
            F.push(FG[i]);
            L.push(LG[j]);
            // Stack negative y in reverse order.
            let ny = start;
            for (const i of NG.reverse()) {
                const y = TY[i];
                ny = newY[i] = (newY1[i] = ny) + y;
            }
            // Stack positive y in input order.
            let py = start;
            for (const i of PG) {
                const y = TY[i];
                if (y > 0)
                    py = newY[i] = (newY1[i] = py) + y;
                else
                    newY[i] = newY1[i] = py;
            }
        }
        // Only set top radius for the first layer,
        // and set bottom radius for the last layer.
        const FS = new Set(F);
        const LS = new Set(L);
        // Choose new y or y1 channel as the new y channel.
        const V = fromY === 'y' ? newY : newY1;
        const V1 = fromY1 === 'y' ? newY : newY1;
        let newEncode;
        // mark point will compute the actural Y = (y + y1) / 2 if y1 exists
        if (mark.type === 'point') {
            newEncode = {
                y0: (0, helper_1.inferredColumn)(Y, fy),
                y: (0, helper_1.column)(V, fy),
            };
        }
        else {
            newEncode = {
                y0: (0, helper_1.inferredColumn)(Y, fy),
                y: (0, helper_1.column)(V, fy),
                y1: (0, helper_1.column)(V1, fy1),
            };
        }
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: Object.assign({}, newEncode),
                style: Object.assign({ first: (_, i) => FS.has(i), last: (_, i) => LS.has(i) }, style),
            }),
        ];
    };
};
exports.StackY = StackY;
exports.StackY.props = {};
//# sourceMappingURL=stackY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815828, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.domainOf = exports.applyOrder = exports.normalizeComparator = exports.createGroups = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../../utils/helper");
const array_1 = require("../../utils/array");
const helper_2 = require("./helper");
function createGroups(groupBy, I, mark) {
    const { encode } = mark;
    if (groupBy === null)
        return [I];
    const G = normalizeGroupBy(groupBy)
        .map((k) => { var _a; return [k, (_a = (0, helper_2.columnOf)(encode, k)) === null || _a === void 0 ? void 0 : _a[0]]; })
        .filter(([, column]) => (0, helper_1.defined)(column));
    const key = (i) => G.map(([, V]) => V[i]).join('-');
    return Array.from((0, d3_array_1.group)(I, key).values());
}
exports.createGroups = createGroups;
function normalizeComparator(order) {
    if (Array.isArray(order))
        return createFieldsOrder(order);
    if (typeof order === 'function')
        return createFunctionOrder(order);
    if (order === 'series')
        return createSeriesOrder;
    if (order === 'value')
        return createValueOrder;
    if (order === 'sum')
        return createSumOrder;
    if (order === 'maxIndex')
        return createMaxIndexOrder;
    return null;
}
exports.normalizeComparator = normalizeComparator;
function applyOrder(groups, comparator) {
    for (const group of groups) {
        group.sort(comparator);
    }
}
exports.applyOrder = applyOrder;
function domainOf(value, scale) {
    return (scale === null || scale === void 0 ? void 0 : scale.domain) || Array.from(new Set(value));
}
exports.domainOf = domainOf;
function normalizeGroupBy(groupBy) {
    if (Array.isArray(groupBy))
        return groupBy;
    return [groupBy];
}
function createSeriesOrder(data, Y, S) {
    return ascendingComparator((i) => S[i]);
}
function createFunctionOrder(order) {
    return (data, Y, S) => {
        return ascendingComparator((i) => order(data[i]));
    };
}
function createFieldsOrder(order) {
    return (data, Y, S) => {
        return (i, j) => order.reduce((eq, f) => (eq !== 0 ? eq : (0, d3_array_1.ascending)(data[i][f], data[j][f])), 0);
    };
}
function createValueOrder(data, Y, S) {
    return ascendingComparator((i) => Y[i]);
}
function createSumOrder(data, Y, S) {
    const I = (0, array_1.indexOf)(data);
    const groups = Array.from((0, d3_array_1.group)(I, (i) => S[+i]).entries());
    const seriesSum = new Map(groups.map(([k, GI]) => [k, GI.reduce((s, i) => s + +Y[i])]));
    return ascendingComparator((i) => seriesSum.get(S[i]));
}
function createMaxIndexOrder(data, Y, S) {
    const I = (0, array_1.indexOf)(data);
    const groups = Array.from((0, d3_array_1.group)(I, (i) => S[+i]).entries());
    const seriesMaxIndex = new Map(groups.map(([k, GI]) => [k, (0, d3_array_1.maxIndex)(GI, (i) => Y[i])]));
    return ascendingComparator((i) => seriesMaxIndex.get(S[i]));
}
function ascendingComparator(order) {
    return (i, j) => (0, d3_array_1.ascending)(order(i), order(j));
}
//# sourceMappingURL=order.js.map
}, function(modId) { var map = {"../../utils/helper":1751263815829,"../../utils/array":1751263815830,"./helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815829, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepAssign = exports.isUnset = exports.isStrictObject = exports.maybePercentage = exports.omitPrefixObject = exports.filterPrefixObject = exports.prefixObject = exports.maybeSubObject = exports.subObject = exports.appendTransform = exports.useMemo = exports.random = exports.defined = exports.copyAttributes = exports.error = exports.capitalizeFirst = exports.composeAsync = exports.compose = exports.identity = exports.groupNameOf = exports.seriesOf = exports.dataOf = exports.getViewFromElement = void 0;
const util_1 = require("@antv/util");
const scale_1 = require("@antv/scale");
/**
 * @description Get element's ancestor view node.
 * @param elemenet G2 element.
 * @returns Element's ancestor view node.
 */
function getViewFromElement(element) {
    var _a;
    let current = element;
    while (current) {
        if (((_a = current.attributes) === null || _a === void 0 ? void 0 : _a.class) === 'view')
            return current;
        current = current.parentNode;
    }
    return null;
}
exports.getViewFromElement = getViewFromElement;
/**
 * @description Get element's original data.
 * @param elemenet G2 element.
 * @param elemenet View data, if not provided, will get from element's ancestor view.
 * @returns The original data of the element.
 */
function dataOf(element, viewData) {
    const view = viewData !== null && viewData !== void 0 ? viewData : getViewFromElement(element).__data__;
    const datum = element.__data__;
    const { markKey, index, seriesIndex } = datum;
    const { markState } = view;
    const selectedMark = Array.from(markState.keys()).find((mark) => mark.key === markKey);
    if (!selectedMark)
        return;
    if (seriesIndex) {
        return seriesIndex.map((i) => selectedMark.data[i]);
    }
    return selectedMark.data[index];
}
exports.dataOf = dataOf;
/**
 * @description Get element's series name.
 * @param elemenet G2 element.
 * @returns The series name of the element.
 */
function seriesOf(elemenet) {
    const viewData = getViewFromElement(elemenet).__data__;
    const { scale } = viewData;
    return groupNameOf(scale, elemenet.__data__);
}
exports.seriesOf = seriesOf;
/**
 * Get group name with view's scale and element's datum.
 */
function groupNameOf(scale, datum) {
    const { color: scaleColor, series: scaleSeries, facet = false } = scale;
    const { color, series } = datum;
    const invertAble = (scale) => {
        return (scale &&
            scale.invert &&
            !(scale instanceof scale_1.Band) &&
            !(scale instanceof scale_1.Constant));
    };
    // For non constant color channel.
    if (invertAble(scaleSeries)) {
        const cloned = scaleSeries.clone();
        return cloned.invert(series);
    }
    if (series &&
        scaleSeries instanceof scale_1.Band &&
        scaleSeries.invert(series) !== color &&
        !facet) {
        return scaleSeries.invert(series);
    }
    if (invertAble(scaleColor)) {
        const name = scaleColor.invert(color);
        // For threshold scale.
        if (Array.isArray(name))
            return null;
        return name;
    }
    return null;
}
exports.groupNameOf = groupNameOf;
function identity(x) {
    return x;
}
exports.identity = identity;
/**
 * Composes functions from left to right.
 */
function compose(fns) {
    return fns.reduce((composed, fn) => (x, ...args) => fn(composed(x, ...args), ...args), identity);
}
exports.compose = compose;
/**
 * Composes single-argument async functions from left to right.
 */
function composeAsync(fns) {
    return fns.reduce((composed, fn) => (x) => __awaiter(this, void 0, void 0, function* () {
        const value = yield composed(x);
        return fn(value);
    }), identity);
}
exports.composeAsync = composeAsync;
function capitalizeFirst(str) {
    return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
}
exports.capitalizeFirst = capitalizeFirst;
function error(message = '') {
    throw new Error(message);
}
exports.error = error;
function copyAttributes(target, source) {
    const { attributes } = source;
    const exclude = new Set(['id', 'className']);
    for (const [key, value] of Object.entries(attributes)) {
        if (!exclude.has(key)) {
            target.attr(key, value);
        }
    }
}
exports.copyAttributes = copyAttributes;
function defined(x) {
    return x !== undefined && x !== null && !Number.isNaN(x);
}
exports.defined = defined;
function random(a, b) {
    return a + (b - a) * Math.random();
}
exports.random = random;
function useMemo(compute) {
    const map = new Map();
    return (key) => {
        if (map.has(key))
            return map.get(key);
        const value = compute(key);
        map.set(key, value);
        return value;
    };
}
exports.useMemo = useMemo;
function appendTransform(node, transform) {
    const { transform: preTransform } = node.style;
    const unset = (d) => d === 'none' || d === undefined;
    const prefix = unset(preTransform) ? '' : preTransform;
    node.style.transform = `${prefix} ${transform}`.trimStart();
}
exports.appendTransform = appendTransform;
function subObject(obj, prefix) {
    return maybeSubObject(obj, prefix) || {};
}
exports.subObject = subObject;
function maybeSubObject(obj, prefix) {
    const entries = Object.entries(obj || {})
        .filter(([key]) => key.startsWith(prefix))
        .map(([key, value]) => [(0, util_1.lowerFirst)(key.replace(prefix, '').trim()), value])
        .filter(([key]) => !!key);
    return entries.length === 0 ? null : Object.fromEntries(entries);
}
exports.maybeSubObject = maybeSubObject;
function prefixObject(obj, prefix) {
    return Object.fromEntries(Object.entries(obj).map(([key, value]) => {
        return [`${prefix}${(0, util_1.upperFirst)(key)}`, value];
    }));
}
exports.prefixObject = prefixObject;
function filterPrefixObject(obj, prefix) {
    return Object.fromEntries(Object.entries(obj).filter(([key]) => prefix.find((p) => key.startsWith(p))));
}
exports.filterPrefixObject = filterPrefixObject;
function omitPrefixObject(obj, ...prefixes) {
    return Object.fromEntries(Object.entries(obj).filter(([key]) => prefixes.every((prefix) => !key.startsWith(prefix))));
}
exports.omitPrefixObject = omitPrefixObject;
function maybePercentage(x, size) {
    if (x === undefined)
        return null;
    if (typeof x === 'number')
        return x;
    const px = +x.replace('%', '');
    return Number.isNaN(px) ? null : (px / 100) * size;
}
exports.maybePercentage = maybePercentage;
function isStrictObject(d) {
    return (typeof d === 'object' &&
        !(d instanceof Date) &&
        d !== null &&
        !Array.isArray(d));
}
exports.isStrictObject = isStrictObject;
function isUnset(value) {
    return value === null || value === false;
}
exports.isUnset = isUnset;
function deepAssign(dist, src, maxLevel = 5, level = 0) {
    if (level >= maxLevel)
        return;
    for (const key of Object.keys(src)) {
        const value = src[key];
        if (!(0, util_1.isPlainObject)(value) || !(0, util_1.isPlainObject)(dist[key])) {
            dist[key] = value;
        }
        else {
            deepAssign(dist[key], value, maxLevel, level + 1);
        }
    }
    return dist;
}
exports.deepAssign = deepAssign;
//# sourceMappingURL=helper.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815830, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.combine = exports.divide = exports.unique = exports.isFlatArray = exports.lastOf = exports.firstOf = exports.transpose = exports.indexOf = exports.mapObject = void 0;
/**
 * Calls a defined callback function on each key:value of a object,
 * and returns a object contains the result.
 */
function mapObject(object, callbackfn) {
    return Object.entries(object).reduce((obj, [key, value]) => {
        obj[key] = callbackfn(value, key, object);
        return obj;
    }, {});
}
exports.mapObject = mapObject;
function indexOf(array) {
    return array.map((_, i) => i);
}
exports.indexOf = indexOf;
/**
 * @example [[1, 2, 3], ['a', 'b', 'c']] => [[1, 'a'], [2, 'b'], [3, 'c']]
 */
function transpose(matrix) {
    const row = matrix.length;
    const col = matrix[0].length;
    // Note: new Array(col).fill(new Array(row)) is not ok!!!
    // Because in this case it will fill new Array(col) with the same array: new Array(row).
    const transposed = new Array(col).fill(0).map(() => new Array(row));
    for (let i = 0; i < col; i++) {
        for (let j = 0; j < row; j++) {
            transposed[i][j] = matrix[j][i];
        }
    }
    return transposed;
}
exports.transpose = transpose;
function firstOf(array) {
    return array[0];
}
exports.firstOf = firstOf;
function lastOf(array) {
    return array[array.length - 1];
}
exports.lastOf = lastOf;
function isFlatArray(array) {
    return !array.some(Array.isArray);
}
exports.isFlatArray = isFlatArray;
function unique(array) {
    return Array.from(new Set(array));
}
exports.unique = unique;
function divide(array, callbackfn) {
    const result = [[], []];
    array.forEach((item) => {
        result[callbackfn(item) ? 0 : 1].push(item);
    });
    return result;
}
exports.divide = divide;
function comb(array, len = array.length) {
    if (len === 1)
        return array.map((item) => [item]);
    const result = [];
    for (let i = 0; i < array.length; i++) {
        const rest = array.slice(i + 1);
        const restComb = comb(rest, len - 1);
        restComb.forEach((comb) => {
            result.push([array[i], ...comb]);
        });
    }
    return result;
}
/**
 * get all combinations of two elements in an array
 * @example [1, 2, 3] => [[1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
 * @param array
 * @returns
 */
function combine(array) {
    if (array.length === 1)
        return [array];
    const result = [];
    for (let i = 1; i <= array.length; i++) {
        result.push(...comb(array, i));
    }
    return result;
}
exports.combine = combine;
//# sourceMappingURL=array.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815831, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeTitle = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const dateFormat_1 = require("../utils/dateFormat");
const helper_2 = require("./utils/helper");
/**
 * Infer title channel from x-position channel.
 */
const MaybeTitle = (options = {}) => {
    const { channel = 'x' } = options;
    return (I, mark) => {
        const { encode } = mark;
        const { tooltip } = mark;
        if ((0, helper_1.isUnset)(tooltip))
            return [I, mark];
        const { title } = tooltip;
        if (title !== undefined)
            return [I, mark];
        const titles = Object.keys(encode)
            .filter((key) => key.startsWith(channel))
            .filter((key) => !encode[key].inferred)
            .map((key) => (0, helper_2.columnOf)(encode, key))
            .filter(([T]) => T)
            .map((d) => d[0]);
        if (titles.length === 0)
            return [I, mark];
        const T = [];
        for (const i of I) {
            T[i] = {
                value: titles
                    .map((t) => t[i] instanceof Date ? (0, dateFormat_1.dynamicFormatDateTime)(t[i]) : t[i])
                    .join(', '),
            };
        }
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                tooltip: {
                    title: T,
                },
            }),
        ];
    };
};
exports.MaybeTitle = MaybeTitle;
exports.MaybeTitle.props = {};
//# sourceMappingURL=maybeTitle.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/dateFormat":1751263815832,"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815832, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.dynamicFormatDateTime = void 0;
function fillZero(digit) {
    if (Math.abs(digit) > 10)
        return String(digit);
    return digit.toString().padStart(2, '0');
}
function dynamicFormatDateTime(date) {
    const year = date.getFullYear();
    const month = fillZero(date.getMonth() + 1);
    const day = fillZero(date.getDate());
    const yyyyMMDD = `${year}-${month}-${day}`;
    const hour = date.getHours();
    const minutes = date.getMinutes();
    const seconds = date.getSeconds();
    if (hour || minutes || seconds)
        return `${yyyyMMDD} ${fillZero(hour)}:${fillZero(minutes)}:${fillZero(seconds)}`;
    return yyyyMMDD;
}
exports.dynamicFormatDateTime = dynamicFormatDateTime;
//# sourceMappingURL=dateFormat.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815833, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeZeroX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add zero constant encode for x channel.
 * This is useful for interval geometry.
 */
const MaybeZeroX = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { x } = encode;
        if (x !== undefined)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: { x: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
                scale: { x: { guide: null } },
            }),
        ];
    };
};
exports.MaybeZeroX = MaybeZeroX;
exports.MaybeZeroX.props = {};
//# sourceMappingURL=maybeZeroX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815834, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeZeroY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add zero constant encode for y channel.
 */
const MaybeZeroY = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { y } = encode;
        if (y !== undefined)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: { y: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
                scale: { y: { guide: null } },
            }),
        ];
    };
};
exports.MaybeZeroY = MaybeZeroY;
exports.MaybeZeroY.props = {};
//# sourceMappingURL=maybeZeroY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815835, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeZeroZ = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add zero constant encode for z channel.
 */
const MaybeZeroZ = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { z } = encode;
        if (z !== undefined)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: { z: (0, helper_1.inferredColumn)((0, helper_1.constant)(I, 0)) },
                scale: { z: { guide: null } },
            }),
        ];
    };
};
exports.MaybeZeroZ = MaybeZeroZ;
exports.MaybeZeroZ.props = {};
//# sourceMappingURL=maybeZeroZ.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815836, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeSize = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeSize = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { size } = encode;
        if (size !== undefined)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, { encode: { size: (0, helper_1.visualColumn)((0, helper_1.constant)(I, 3)) } }),
        ];
    };
};
exports.MaybeSize = MaybeSize;
exports.MaybeSize.props = {};
//# sourceMappingURL=maybeSize.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815837, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeKey = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Infer key for every element.
 */
const MaybeKey = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { key } = encode, rest = __rest(encode, ["key"]);
        if (key !== undefined)
            return [I, mark];
        const values = Object.values(rest).map(({ value }) => value);
        const K = I.map((i) => values
            .filter(Array.isArray)
            .map((V) => V[i])
            .join('-'));
        return [I, (0, util_1.deepMix)({}, mark, { encode: { key: (0, helper_1.column)(K) } })];
    };
};
exports.MaybeKey = MaybeKey;
exports.MaybeKey.props = {};
//# sourceMappingURL=maybeKey.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815838, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeSeries = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Assume color channel is series channel.
 */
const MaybeSeries = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { series, color } = encode;
        if (series !== undefined || color === undefined)
            return [I, mark];
        const [C, fc] = (0, helper_1.columnOf)(encode, 'color');
        return [I, (0, util_1.deepMix)({}, mark, { encode: { series: (0, helper_1.column)(C, fc) } })];
    };
};
exports.MaybeSeries = MaybeSeries;
exports.MaybeSeries.props = {};
//# sourceMappingURL=maybeSeries.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815839, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeTupleY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeTupleY = () => {
    return (I, mark) => {
        const { data } = mark;
        if (!Array.isArray(data) || data.some(helper_1.isObject))
            return [I, mark];
        return [I, (0, util_1.deepMix)({}, mark, { encode: { y: (0, helper_1.column)(data) } })];
    };
};
exports.MaybeTupleY = MaybeTupleY;
exports.MaybeTupleY.props = {};
//# sourceMappingURL=maybeTupleY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815840, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeTupleX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeTupleX = () => {
    return (I, mark) => {
        const { data } = mark;
        if (!Array.isArray(data) || data.some(helper_1.isObject))
            return [I, mark];
        return [I, (0, util_1.deepMix)({}, mark, { encode: { x: (0, helper_1.column)(data) } })];
    };
};
exports.MaybeTupleX = MaybeTupleX;
exports.MaybeTupleX.props = {};
//# sourceMappingURL=maybeTupleX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815841, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeIdentityY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeIdentityY = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { y1 } = encode;
        if (y1)
            return [I, mark];
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        return [I, (0, util_1.deepMix)({}, mark, { encode: { y1: (0, helper_1.column)([...Y]) } })];
    };
};
exports.MaybeIdentityY = MaybeIdentityY;
exports.MaybeIdentityY.props = {};
//# sourceMappingURL=maybeIdentityY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815842, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeIdentityX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeIdentityX = () => {
    return (I, mark) => {
        const { encode } = mark;
        const { x1 } = encode;
        if (x1)
            return [I, mark];
        const [X] = (0, helper_1.columnOf)(encode, 'x');
        return [I, (0, util_1.deepMix)({}, mark, { encode: { x1: (0, helper_1.column)([...X]) } })];
    };
};
exports.MaybeIdentityX = MaybeIdentityX;
exports.MaybeIdentityX.props = {};
//# sourceMappingURL=maybeIdentityX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815843, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeDefaultX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add a default encode for rangeX
 * when data is just an array
 */
const MaybeDefaultX = () => {
    return (I, mark) => {
        const { data } = mark;
        if (Array.isArray(data) &&
            (data.every(Array.isArray) || !data.some(helper_1.isObject))) {
            const extractX = (data, index) => Array.isArray(data[0])
                ? data.map((item) => item[index])
                : [data[index]];
            return [
                I,
                (0, util_1.deepMix)({}, mark, {
                    encode: {
                        x: (0, helper_1.column)(extractX(data, 0)),
                        x1: (0, helper_1.column)(extractX(data, 1)),
                    },
                }),
            ];
        }
        return [I, mark];
    };
};
exports.MaybeDefaultX = MaybeDefaultX;
exports.MaybeDefaultX.props = {};
//# sourceMappingURL=maybeDefaultX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815844, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeDefaultY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add a default encode for rangeY
 * when data is just an array
 */
const MaybeDefaultY = () => {
    return (I, mark) => {
        const { data } = mark;
        if (Array.isArray(data) &&
            (data.every(Array.isArray) || !data.some(helper_1.isObject))) {
            const extractY = (data, index) => Array.isArray(data[0])
                ? data.map((item) => item[index])
                : [data[index]];
            return [
                I,
                (0, util_1.deepMix)({}, mark, {
                    encode: {
                        y: (0, helper_1.column)(extractY(data, 0)),
                        y1: (0, helper_1.column)(extractY(data, 1)),
                    },
                }),
            ];
        }
        return [I, mark];
    };
};
exports.MaybeDefaultY = MaybeDefaultY;
exports.MaybeDefaultY.props = {};
//# sourceMappingURL=maybeDefaultY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815845, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeTooltip = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
/**
 * Infer tooltip channel from specified channel.
 */
const MaybeTooltip = (options) => {
    const { channel } = options;
    return (I, mark) => {
        const { encode, tooltip } = mark;
        if ((0, helper_1.isUnset)(tooltip))
            return [I, mark];
        const { items = [] } = tooltip;
        if (!items || items.length > 0)
            return [I, mark];
        const channels = Array.isArray(channel) ? channel : [channel];
        const newItems = channels.flatMap((channel) => Object.keys(encode)
            .filter((key) => key.startsWith(channel))
            .map((key) => {
            const { field, value, inferred = false, aggregate } = encode[key];
            if (inferred)
                return null;
            // Do not show inferred column.
            if (aggregate && value)
                return { channel: key };
            if (field)
                return { field };
            if (value)
                return { channel: key };
            return null;
        })
            .filter((d) => d !== null));
        return [I, (0, util_1.deepMix)({}, mark, { tooltip: { items: newItems } })];
    };
};
exports.MaybeTooltip = MaybeTooltip;
exports.MaybeTooltip.props = {};
//# sourceMappingURL=maybeTooltip.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815846, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeZeroPadding = void 0;
const util_1 = require("@antv/util");
/**
 * Set padding of x and y scale to zero.
 */
const MaybeZeroPadding = () => {
    return (I, mark) => {
        return [
            I,
            (0, util_1.deepMix)({ scale: { x: { padding: 0 }, y: { padding: 0 } } }, mark),
        ];
    };
};
exports.MaybeZeroPadding = MaybeZeroPadding;
exports.MaybeZeroPadding.props = {};
//# sourceMappingURL=maybeZeroPadding.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815847, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeVisualPosition = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Set visual position with style.x and style.y.
 * The priority of style.x, style.y is higher than data.
 */
const MaybeVisualPosition = () => {
    return (I, mark) => {
        const { data, style = {} } = mark, restMark = __rest(mark, ["data", "style"]);
        const { x: x0, y: y0 } = style, rest = __rest(style, ["x", "y"]);
        if (x0 == undefined || y0 == undefined)
            return [I, mark];
        const x = x0 || 0;
        const y = y0 || 0;
        return [
            [0],
            (0, util_1.deepMix)({}, restMark, {
                data: [0],
                cartesian: true,
                encode: {
                    x: (0, helper_1.column)([x]),
                    y: (0, helper_1.column)([y]),
                },
                scale: {
                    x: { type: 'identity', independent: true, guide: null },
                    y: { type: 'identity', independent: true, guide: null }, // hide axis
                },
                style: rest,
            }),
        ];
    };
};
exports.MaybeVisualPosition = MaybeVisualPosition;
exports.MaybeVisualPosition.props = {};
//# sourceMappingURL=maybeVisualPosition.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815848, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeFunctionAttribute = void 0;
const util_1 = require("@antv/util");
/**
 * Mark functional attribute constant.
 */
const MaybeFunctionAttribute = () => {
    return (I, mark) => {
        const { style = {} } = mark;
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                style: Object.assign(Object.assign({}, style), Object.fromEntries(Object.entries(style)
                    .filter(([, v]) => typeof v === 'function')
                    .map(([k, v]) => [k, () => v]))),
            }),
        ];
    };
};
exports.MaybeFunctionAttribute = MaybeFunctionAttribute;
exports.MaybeFunctionAttribute.props = {};
//# sourceMappingURL=maybeFunctionAttribute.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815849, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeTuple = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeTuple = () => {
    return (I, mark) => {
        const { data } = mark;
        if (!Array.isArray(data) || data.some(helper_1.isObject))
            return [I, mark];
        const position = Array.isArray(data[0]) ? data : [data];
        const X = position.map((d) => d[0]);
        const Y = position.map((d) => d[1]);
        return [I, (0, util_1.deepMix)({}, mark, { encode: { x: (0, helper_1.column)(X), y: (0, helper_1.column)(Y) } })];
    };
};
exports.MaybeTuple = MaybeTuple;
exports.MaybeTuple.props = {};
//# sourceMappingURL=maybeTuple.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815850, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MaybeGradient = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
/**
 * Add 3 constant encode for size channel.
 * This is useful for point geometry.
 */
const MaybeGradient = () => {
    return (I, mark) => {
        const { style = {}, encode } = mark;
        const { series } = encode;
        const { gradient } = style;
        if (!gradient || series)
            return [I, mark];
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: {
                    series: (0, helper_1.visualColumn)((0, helper_1.constant)(I, undefined)),
                },
            }),
        ];
    };
};
exports.MaybeGradient = MaybeGradient;
exports.MaybeGradient.props = {};
//# sourceMappingURL=maybeGradient.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815851, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DodgeX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
/**
 * The dodge group marks into series by color or series channel,
 * and then produce new series channel for each series by specified order,
 * say to form horizontal "columns" by specified channels.
 */
const DodgeX = (options = {}) => {
    const { groupBy = 'x', reverse = false, orderBy, padding } = options, rest = __rest(options, ["groupBy", "reverse", "orderBy", "padding"]);
    return (I, mark) => {
        const { data, encode, scale } = mark;
        const { series: scaleSeries } = scale;
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        const [S] = (0, helper_1.maybeColumnOf)(encode, 'series', 'color');
        const domainSeries = (0, order_1.domainOf)(S, scaleSeries);
        const newMark = (0, util_1.deepMix)({}, mark, {
            scale: {
                series: {
                    domain: domainSeries,
                    paddingInner: padding,
                },
            },
        });
        // Create groups and apply specified order for each group.
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        const createComparator = (0, order_1.normalizeComparator)(orderBy);
        if (!createComparator) {
            return [I, (0, util_1.deepMix)(newMark, { encode: { series: (0, helper_1.column)(S) } })];
        }
        // Sort and Update series for each mark related to series domain.
        const comparator = createComparator(data, Y, S);
        if (comparator)
            (0, order_1.applyOrder)(groups, comparator);
        const newS = new Array(I.length);
        for (const G of groups) {
            if (reverse)
                G.reverse();
            for (let i = 0; i < G.length; i++) {
                newS[G[i]] = domainSeries[i];
            }
        }
        return [
            I,
            (0, util_1.deepMix)(newMark, {
                encode: {
                    series: (0, helper_1.column)(orderBy ? newS : S),
                },
            }),
        ];
    };
};
exports.DodgeX = DodgeX;
exports.DodgeX.props = {};
//# sourceMappingURL=dodgeX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815852, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.StackEnter = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./utils/helper");
/**
 * Group marks by channels into groups and stacking their enterDelay
 * to make marks show up groups by groups.
 * It will update enterDelay channel for each mark by its enterDuration and group.
 * @todo Support orderBy.
 * @todo Sort among groups(e.g. reverse).
 * @todo Stack enter in groups rather than between groups?
 * @todo Auto inter this statistic for scaleInY animation in stacked interval?
 * @todo All the groups shared the enterDuration?
 */
const StackEnter = (options) => {
    const { groupBy = ['x'], reducer = (I, V) => V[I[0]], orderBy = null, reverse = false, duration, } = options;
    return (I, mark) => {
        const { encode } = mark;
        // Extract group information by each specified channel,
        // and skip if all values of channels are empty.
        const by = Array.isArray(groupBy) ? groupBy : [groupBy];
        const groupEntries = by.map((k) => [k, (0, helper_1.columnOf)(encode, k)[0]]);
        if (groupEntries.length === 0)
            return [I, mark];
        // Nest group index and flatten them in right order among timeline.
        // [[1, 2, 3, 4, 5, 6]] ->
        // [[1, 2, 3], [4, 5, 6]] ->
        // [[1], [2], [3], [4], [5], [6]]
        let groups = [I];
        for (const [, V] of groupEntries) {
            const newGroups = [];
            for (const I of groups) {
                const G = Array.from((0, d3_array_1.group)(I, (i) => V[i]).values());
                // @todo sort by x.
                newGroups.push(...G);
            }
            groups = newGroups;
        }
        // const {color} = encode;
        if (orderBy) {
            const [V] = (0, helper_1.columnOf)(encode, orderBy);
            if (V)
                groups.sort((I, J) => reducer(I, V) - reducer(J, V));
            if (reverse)
                groups.reverse();
        }
        // Stack delay for each group.
        const t = (duration || 3000) / groups.length;
        const [ED] = duration
            ? [(0, helper_1.constant)(I, t)] // If specified duration, generate enter duration for each.
            : (0, helper_1.maybeColumnOf)(encode, 'enterDuration', (0, helper_1.constant)(I, t));
        const [EDL] = (0, helper_1.maybeColumnOf)(encode, 'enterDelay', (0, helper_1.constant)(I, 0));
        const newEnterDelay = new Array(I.length);
        for (let i = 0, pd = 0; i < groups.length; i++) {
            const I = groups[i];
            const maxDuration = (0, d3_array_1.max)(I, (i) => +ED[i]);
            for (const j of I)
                newEnterDelay[j] = +EDL[j] + pd;
            pd += maxDuration;
        }
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: {
                    enterDuration: (0, helper_1.visualColumn)(ED),
                    enterDelay: (0, helper_1.visualColumn)(newEnterDelay),
                },
            }),
        ];
    };
};
exports.StackEnter = StackEnter;
exports.StackEnter.props = {};
//# sourceMappingURL=stackEnter.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815853, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NormalizeY = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const helper_2 = require("./utils/helper");
const order_1 = require("./utils/order");
function normalizeBasis(basis) {
    if (typeof basis === 'function')
        return basis;
    const registry = {
        min: (I, Y) => (0, d3_array_1.min)(I, (i) => Y[+i]),
        max: (I, Y) => (0, d3_array_1.max)(I, (i) => Y[+i]),
        first: (I, Y) => Y[I[0]],
        last: (I, Y) => Y[I[I.length - 1]],
        mean: (I, Y) => (0, d3_array_1.mean)(I, (i) => Y[+i]),
        median: (I, Y) => (0, d3_array_1.median)(I, (i) => Y[+i]),
        sum: (I, Y) => (0, d3_array_1.sum)(I, (i) => Y[+i]),
        deviation: (I, Y) => (0, d3_array_1.deviation)(I, (i) => Y[+i]),
    };
    return registry[basis] || d3_array_1.max;
}
/**
 * Group marks into series by specified channels, and then transform
 * each series's value, say to transform them relative to some basis
 * to apply a moving average.
 */
const NormalizeY = (options = {}) => {
    const { groupBy = 'x', basis = 'max' } = options;
    return (I, mark) => {
        const { encode, tooltip } = mark;
        const { x } = encode, rest = __rest(encode, ["x"]);
        // Extract and create new channels starts with y, such as y, y1.
        const Yn = Object.entries(rest)
            .filter(([k]) => k.startsWith('y'))
            .map(([k]) => [k, (0, helper_2.columnOf)(encode, k)[0]]);
        const [, Y] = Yn.find(([k]) => k === 'y');
        const newYn = Yn.map(([k]) => [k, new Array(I.length)]);
        // Group marks into series by specified keys.
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        // Transform y channels for each group based on basis.
        const basisFunction = normalizeBasis(basis);
        for (const I of groups) {
            // Compute basis only base on y.
            const basisValue = basisFunction(I, Y);
            for (const i of I) {
                for (let j = 0; j < Yn.length; j++) {
                    const [, V] = Yn[j];
                    const [, newV] = newYn[j];
                    newV[i] = +V[i] / basisValue;
                }
            }
        }
        const specifiedTooltip = (0, helper_1.isUnset)(tooltip) || ((tooltip === null || tooltip === void 0 ? void 0 : tooltip.items) && (tooltip === null || tooltip === void 0 ? void 0 : tooltip.items.length) !== 0);
        return [
            I,
            (0, util_1.deepMix)({}, mark, Object.assign({ encode: Object.fromEntries(newYn.map(([k, v]) => [k, (0, helper_2.column)(v, (0, helper_2.columnOf)(encode, k)[1])])) }, (!specifiedTooltip &&
                encode.y0 && {
                tooltip: { items: [{ channel: 'y0' }] },
            }))),
        ];
    };
};
exports.NormalizeY = NormalizeY;
exports.NormalizeY.props = {};
//# sourceMappingURL=normalizeY.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815854, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Jitter = exports.interpolate = exports.rangeOf = void 0;
const scale_1 = require("@antv/scale");
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
function rangeOf(value, scaleOptions, padding) {
    if (value === null)
        return [-0.5, 0.5];
    const domain = (0, order_1.domainOf)(value, scaleOptions);
    const scale = new scale_1.Band({ domain, range: [0, 1], padding });
    const step = scale.getBandWidth();
    return [-step / 2, step / 2];
}
exports.rangeOf = rangeOf;
function interpolate(t, a, b) {
    return a * (1 - t) + b * t;
}
exports.interpolate = interpolate;
/**
 * The jitter transform produce dx and dy channels for marks (especially for point)
 * with ordinal x and y dimension, say to make them jitter in their own space.
 */
const Jitter = (options = {}) => {
    const { padding = 0, paddingX = padding, paddingY = padding, random = Math.random, } = options;
    return (I, mark) => {
        const { encode, scale } = mark;
        const { x: scaleX, y: scaleY } = scale;
        const [X] = (0, helper_1.columnOf)(encode, 'x');
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        const rangeX = rangeOf(X, scaleX, paddingX);
        const rangeY = rangeOf(Y, scaleY, paddingY);
        const DY = I.map(() => interpolate(random(), ...rangeY));
        const DX = I.map(() => interpolate(random(), ...rangeX));
        return [
            I,
            (0, util_1.deepMix)({
                scale: {
                    x: { padding: 0.5 },
                    y: { padding: 0.5 },
                },
            }, mark, {
                encode: { dy: (0, helper_1.column)(DY), dx: (0, helper_1.column)(DX) },
            }),
        ];
    };
};
exports.Jitter = Jitter;
exports.Jitter.props = {};
//# sourceMappingURL=jitter.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815855, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.JitterX = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const jitter_1 = require("./jitter");
/**
 * The JitterX transform produce dy channels for marks (especially for point)
 * with ordinal x and y dimension, say to make them jitter in their own space.
 */
const JitterX = (options = {}) => {
    const { padding = 0, random = Math.random } = options;
    return (I, mark) => {
        const { encode, scale } = mark;
        const { x: scaleX } = scale;
        const [X] = (0, helper_1.columnOf)(encode, 'x');
        const rangeX = (0, jitter_1.rangeOf)(X, scaleX, padding);
        const DX = I.map(() => (0, jitter_1.interpolate)(random(), ...rangeX));
        return [
            I,
            (0, util_1.deepMix)({ scale: { x: { padding: 0.5 } } }, mark, {
                encode: { dx: (0, helper_1.column)(DX) },
            }),
        ];
    };
};
exports.JitterX = JitterX;
exports.JitterX.props = {};
//# sourceMappingURL=jitterX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./jitter":1751263815854}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815856, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.JitterY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const jitter_1 = require("./jitter");
/**
 * The JitterY transform produce dy channels for marks (especially for point)
 * with ordinal x and y dimension, say to make them jitter in their own space.
 */
const JitterY = (options = {}) => {
    const { padding = 0, random = Math.random } = options;
    return (I, mark) => {
        const { encode, scale } = mark;
        const { y: scaleY } = scale;
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        const rangeY = (0, jitter_1.rangeOf)(Y, scaleY, padding);
        const DY = I.map(() => (0, jitter_1.interpolate)(random(), ...rangeY));
        return [
            I,
            (0, util_1.deepMix)({ scale: { y: { padding: 0.5 } } }, mark, {
                encode: { dy: (0, helper_1.column)(DY) },
            }),
        ];
    };
};
exports.JitterY = JitterY;
exports.JitterY.props = {};
//# sourceMappingURL=jitterY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./jitter":1751263815854}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815857, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SymmetryY = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
/**
 * The SymmetryY transform apply offset for y channels, say to transform
 * them to be symmetry.
 */
const SymmetryY = (options = {}) => {
    const { groupBy = 'x' } = options;
    return (I, mark) => {
        const { encode } = mark;
        const { x } = encode, rest = __rest(encode, ["x"]);
        // Extract and create new channels starts with y, such as y, y1.
        const Yn = Object.entries(rest)
            .filter(([k]) => k.startsWith('y'))
            .map(([k]) => [k, (0, helper_1.columnOf)(encode, k)[0]]);
        const newYn = Yn.map(([k]) => [k, new Array(I.length)]);
        // Group marks into series by specified keys.
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        const MY = new Array(groups.length);
        for (let i = 0; i < groups.length; i++) {
            const I = groups[i];
            const Y = I.flatMap((i) => Yn.map(([, V]) => +V[i]));
            const [minY, maxY] = (0, d3_array_1.extent)(Y);
            MY[i] = (minY + maxY) / 2;
        }
        const maxMiddleY = Math.max(...MY);
        for (let m = 0; m < groups.length; m++) {
            const offset = maxMiddleY - MY[m];
            const I = groups[m];
            for (const i of I) {
                for (let j = 0; j < Yn.length; j++) {
                    const [, V] = Yn[j];
                    const [, newV] = newYn[j];
                    newV[i] = +V[i] + offset;
                }
            }
        }
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: Object.fromEntries(newYn.map(([k, v]) => [k, (0, helper_1.column)(v, (0, helper_1.columnOf)(encode, k)[1])])),
            }),
        ];
    };
};
exports.SymmetryY = SymmetryY;
exports.SymmetryY.props = {};
//# sourceMappingURL=symmetryY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815858, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.DiffY = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
/**
 * The DiffY transform apply offset for y0 channels.
 * Keep y unchanged, set y1 = max(otherY), if y1 > y, remove the data.
 */
const DiffY = (options = {}) => {
    const { groupBy = 'x' } = options;
    return (I, mark) => {
        const { encode } = mark;
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        const [_, fy1] = (0, helper_1.columnOf)(encode, 'y1');
        // Create groups and apply specified order for each group.
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        // Only adjust Y1 channel.
        const newY1 = new Array(I.length);
        for (const G of groups) {
            const YG = G.map((i) => +Y[i]);
            // Process each series.
            for (let idx = 0; idx < G.length; idx++) {
                const i = G[idx];
                // Get the max Y of current group with current Y exclude.
                const max = Math.max(...YG.filter((_, _i) => _i !== idx));
                // Diff Y value.
                newY1[i] = +Y[i] > max ? max : Y[i];
            }
        }
        return [
            I,
            (0, util_1.deepMix)({}, mark, {
                encode: {
                    y1: (0, helper_1.column)(newY1, fy1),
                },
            }),
        ];
    };
};
exports.DiffY = DiffY;
exports.DiffY.props = {};
//# sourceMappingURL=diffY.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815859, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Select = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./utils/helper");
const order_1 = require("./utils/order");
function first(I, V) {
    return [I[0]];
}
function last(I, V) {
    const i = I.length - 1;
    return [I[i]];
}
function max(I, V) {
    const i = (0, d3_array_1.maxIndex)(I, (i) => V[i]);
    return [I[i]];
}
function min(I, V) {
    const i = (0, d3_array_1.minIndex)(I, (i) => V[i]);
    return [I[i]];
}
function normalizeSelector(selector) {
    if (typeof selector === 'function')
        return selector;
    const registry = { first, last, max, min };
    return registry[selector] || first;
}
/**
 * The select transform groups marks with specified channels, and
 * filter index by specified selector for each series, say to
 * pull a single or multiple values out of each series.
 */
const Select = (options = {}) => {
    const { groupBy = 'series', channel, selector } = options;
    return (I, mark) => {
        const { encode } = mark;
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        const [V] = (0, helper_1.columnOf)(encode, channel);
        const selectFunction = normalizeSelector(selector);
        return [groups.flatMap((GI) => selectFunction(GI, V)), mark];
    };
};
exports.Select = Select;
exports.Select.props = {};
//# sourceMappingURL=select.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825,"./utils/order":1751263815828}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815860, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectX = void 0;
const select_1 = require("./select");
/**
 * The selectX transform filter index by y channel.
 */
const SelectX = (options = {}) => {
    const { selector } = options, rest = __rest(options, ["selector"]);
    return (0, select_1.Select)(Object.assign({ channel: 'x', selector }, rest));
};
exports.SelectX = SelectX;
exports.SelectX.props = {};
//# sourceMappingURL=selectX.js.map
}, function(modId) { var map = {"./select":1751263815859}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815861, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectY = void 0;
const select_1 = require("./select");
/**
 * The selectY transform filter index by y channel.
 */
const SelectY = (options = {}) => {
    const { selector } = options, rest = __rest(options, ["selector"]);
    return (0, select_1.Select)(Object.assign({ channel: 'y', selector }, rest));
};
exports.SelectY = SelectY;
exports.SelectY.props = {};
//# sourceMappingURL=selectY.js.map
}, function(modId) { var map = {"./select":1751263815859}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815862, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupX = void 0;
const group_1 = require("./group");
/**
 * The GroupX transform group data by x channel, and aggregate.
 */
const GroupX = (options = {}) => {
    return (0, group_1.Group)(Object.assign(Object.assign({}, options), { channels: ['x', 'color', 'series'] }));
};
exports.GroupX = GroupX;
exports.GroupX.props = {};
//# sourceMappingURL=groupX.js.map
}, function(modId) { var map = {"./group":1751263815863}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815863, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Group = void 0;
const order_1 = require("./utils/order");
const groupN_1 = require("./groupN");
/**
 * The Group transform group data by x and y channels, and aggregate.
 */
const Group = (options = {}) => {
    const { channels = ['x', 'y'] } = options, rest = __rest(options, ["channels"]);
    const groupBy = (I, mark) => (0, order_1.createGroups)(channels, I, mark);
    return (0, groupN_1.GroupN)(Object.assign(Object.assign({}, rest), { groupBy }));
};
exports.Group = Group;
exports.Group.props = {};
//# sourceMappingURL=group.js.map
}, function(modId) { var map = {"./utils/order":1751263815828,"./groupN":1751263815864}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815864, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupN = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const array_1 = require("../utils/array");
const helper_1 = require("./utils/helper");
function builtinFormatter(summary) {
    return (d) => (d === null ? summary : `${summary} of ${d}`);
}
function normalizeReducer(reducer) {
    if (typeof reducer === 'function')
        return [reducer, null];
    const registry = { mean, max, count, first, last, sum, min, median };
    const reducerFunction = registry[reducer];
    if (!reducerFunction)
        throw new Error(`Unknown reducer: ${reducer}.`);
    return reducerFunction();
}
function mean() {
    const reducer = (I, V) => (0, d3_array_1.mean)(I, (i) => +V[i]);
    const formatter = builtinFormatter('mean');
    return [reducer, formatter];
}
function median() {
    const reducer = (I, V) => (0, d3_array_1.median)(I, (i) => +V[i]);
    const formatter = builtinFormatter('median');
    return [reducer, formatter];
}
function max() {
    const reducer = (I, V) => (0, d3_array_1.max)(I, (i) => +V[i]);
    const formatter = builtinFormatter('max');
    return [reducer, formatter];
}
function min() {
    const reducer = (I, V) => (0, d3_array_1.min)(I, (i) => +V[i]);
    const formatter = builtinFormatter('min');
    return [reducer, formatter];
}
function count() {
    const reducer = (I, V) => I.length;
    const formatter = builtinFormatter('count');
    return [reducer, formatter];
}
function sum() {
    const reducer = (I, V) => (0, d3_array_1.sum)(I, (i) => +V[i]);
    const formatter = builtinFormatter('sum');
    return [reducer, formatter];
}
function first() {
    const reducer = (I, V) => V[I[0]];
    const formatter = builtinFormatter('first');
    return [reducer, formatter];
}
function last() {
    const reducer = (I, V) => V[I[I.length - 1]];
    const formatter = builtinFormatter('last');
    return [reducer, formatter];
}
/**
 * The Group transform group data by x and y channels, and aggregate.
 */
const GroupN = (options = {}) => {
    const { groupBy } = options, rest = __rest(options, ["groupBy"]);
    return (I, mark) => {
        const { data, encode } = mark;
        const groups = groupBy(I, mark);
        if (!groups)
            return [I, mark];
        // Extract field from from channel
        // x1 from x, y1 from y, etc,.
        const maybeFrom = (field, reducer) => {
            if (field)
                return field;
            const { from } = reducer;
            if (!from)
                return field;
            const [, field1] = (0, helper_1.columnOf)(encode, from);
            return field1;
        };
        const outputs = Object.entries(rest).map(([channel, reducer]) => {
            const [reducerFunction, formatter] = normalizeReducer(reducer);
            const [V, field] = (0, helper_1.columnOf)(encode, channel);
            const field1 = maybeFrom(field, reducer);
            const RV = groups.map((I) => reducerFunction(I, V !== null && V !== void 0 ? V : data));
            return [
                channel,
                Object.assign(Object.assign({}, (0, helper_1.nonConstantColumn)(RV, (formatter === null || formatter === void 0 ? void 0 : formatter(field1)) || field1)), { aggregate: true }),
            ];
        });
        const reducedColumns = Object.keys(encode).map((key) => {
            const [V, fv] = (0, helper_1.columnOf)(encode, key);
            const GV = groups.map((I) => V[I[0]]);
            return [key, (0, helper_1.column)(GV, fv)];
        });
        const GD = groups.map((I) => data[I[0]]);
        const GI = (0, array_1.indexOf)(groups);
        return [
            GI,
            (0, util_1.deepMix)({}, mark, {
                data: GD,
                encode: Object.fromEntries([...reducedColumns, ...outputs]),
            }),
        ];
    };
};
exports.GroupN = GroupN;
exports.GroupN.props = {};
//# sourceMappingURL=groupN.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815865, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupY = void 0;
const group_1 = require("./group");
/**
 * The GroupY transform group data by x channel, and aggregate.
 */
const GroupY = (options = {}) => {
    return (0, group_1.Group)(Object.assign(Object.assign({}, options), { channels: ['y', 'color', 'series'] }));
};
exports.GroupY = GroupY;
exports.GroupY.props = {};
//# sourceMappingURL=groupY.js.map
}, function(modId) { var map = {"./group":1751263815863}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815866, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupColor = void 0;
const group_1 = require("./group");
/**
 * The GroupColor transform group data by x channel, and aggregate.
 */
const GroupColor = (options = {}) => {
    return (0, group_1.Group)(Object.assign(Object.assign({}, options), { channels: ['color'] }));
};
exports.GroupColor = GroupColor;
exports.GroupColor.props = {};
//# sourceMappingURL=groupColor.js.map
}, function(modId) { var map = {"./group":1751263815863}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815867, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortX = void 0;
const sort_1 = require("./sort");
/**
 * Sort domain of x scale of mark groups by groups.
 */
const SortX = (options = {}) => {
    return (0, sort_1.Sort)(Object.assign(Object.assign({}, options), { channel: 'x' }));
};
exports.SortX = SortX;
exports.SortX.props = {};
//# sourceMappingURL=sortX.js.map
}, function(modId) { var map = {"./sort":1751263815868}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815868, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sort = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./utils/helper");
function createReducer(channel, options, encode) {
    const { by = channel, reducer = 'max' } = options;
    const [V] = (0, helper_1.columnOf)(encode, by);
    if (typeof reducer === 'function')
        return (GI) => reducer(GI, V);
    if (reducer === 'max')
        return (GI) => (0, d3_array_1.max)(GI, (i) => +V[i]);
    if (reducer === 'min')
        return (GI) => (0, d3_array_1.min)(GI, (i) => +V[i]);
    if (reducer === 'sum')
        return (GI) => (0, d3_array_1.sum)(GI, (i) => +V[i]);
    if (reducer === 'median')
        return (GI) => (0, d3_array_1.median)(GI, (i) => +V[i]);
    if (reducer === 'mean')
        return (GI) => (0, d3_array_1.mean)(GI, (i) => +V[i]);
    if (reducer === 'first')
        return (GI) => V[GI[0]];
    if (reducer === 'last')
        return (GI) => V[GI[GI.length - 1]];
    throw new Error(`Unknown reducer: ${reducer}`);
}
// If domain is specified, only sort data in the domain.
function filterIndex(I, values, specifiedDomain) {
    if (!Array.isArray(specifiedDomain))
        return I;
    const domain = new Set(specifiedDomain);
    return I.filter((i) => domain.has(values[i]));
}
/**
 * Sort marks groups by groups.
 */
const Sort = (options = {}) => {
    return (I, mark) => {
        const { reverse, slice, channel, by, ordinal = true, reducer } = options;
        const { encode, scale = {} } = mark;
        const domain = scale[channel].domain;
        const [V] = (0, helper_1.columnOf)(encode, by !== null && by !== void 0 ? by : channel);
        const [T] = (0, helper_1.columnOf)(encode, channel);
        const normalizeReducer = createReducer(channel, { by, reducer }, encode);
        const SI = filterIndex(I, T, domain);
        const sortedDomain = (0, d3_array_1.groupSort)(SI, normalizeReducer, (i) => T[i]);
        // when ordinal is true, do not change the index of the data.
        const sortedI = !ordinal ? (0, d3_array_1.sort)(I, (i) => V[i]) : I;
        if (reverse) {
            !ordinal && sortedI.reverse();
            sortedDomain.reverse();
        }
        const s = typeof slice === 'number' ? [0, slice] : slice;
        const slicedDomain = slice ? sortedDomain.slice(...s) : sortedDomain;
        return [
            sortedI,
            (0, util_1.deepMix)(mark, { scale: { [channel]: { domain: slicedDomain } } }),
        ];
    };
};
exports.Sort = Sort;
exports.Sort.props = {};
//# sourceMappingURL=sort.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815869, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortColor = void 0;
const sort_1 = require("./sort");
/**
 * Sort domain of x scale of mark groups by groups.
 */
const SortColor = (options = {}) => {
    return (0, sort_1.Sort)(Object.assign(Object.assign({}, options), { channel: 'color' }));
};
exports.SortColor = SortColor;
exports.SortColor.props = {};
//# sourceMappingURL=sortColor.js.map
}, function(modId) { var map = {"./sort":1751263815868}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815870, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortY = void 0;
const sort_1 = require("./sort");
/**
 * Sort domain of x scale of mark groups by groups.
 */
const SortY = (options = {}) => {
    return (0, sort_1.Sort)(Object.assign(Object.assign({}, options), { channel: 'y' }));
};
exports.SortY = SortY;
exports.SortY.props = {};
//# sourceMappingURL=sortY.js.map
}, function(modId) { var map = {"./sort":1751263815868}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815871, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.FlexX = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./utils/helper");
function valueOf(data, field) {
    if (typeof field === 'string')
        return data.map((d) => d[field]);
    return data.map(field);
}
function createReducer(reducer, V) {
    if (typeof reducer === 'function')
        return (GI) => reducer(GI, V);
    if (reducer === 'sum')
        return (GI) => (0, d3_array_1.sum)(GI, (i) => +V[i]);
    throw new Error(`Unknown reducer: ${reducer}`);
}
/**
 * Produce flex options from data for x scale.
 */
const FlexX = (options = {}) => {
    const { field, channel = 'y', reducer = 'sum' } = options;
    return (I, mark) => {
        const { data, encode } = mark;
        const [x] = (0, helper_1.columnOf)(encode, 'x');
        const V = field ? valueOf(data, field) : (0, helper_1.columnOf)(encode, channel)[0];
        const reducerFunction = createReducer(reducer, V);
        const flex = (0, d3_array_1.rollups)(I, reducerFunction, (i) => x[i]).map((d) => d[1]);
        return [I, (0, util_1.deepMix)({}, mark, { scale: { x: { flex } } })];
    };
};
exports.FlexX = FlexX;
exports.FlexX.props = {};
//# sourceMappingURL=flexX.js.map
}, function(modId) { var map = {"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815872, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Pack = void 0;
const util_1 = require("@antv/util");
const vector_1 = require("../utils/vector");
function pack(options) {
    const { padding = 0, direction = 'col' } = options;
    return (P, count, layout) => {
        const pcount = P.length;
        if (pcount === 0)
            return [];
        // col * row >= count
        // row is close to col * aspect, so
        // col * (col * aspect) >= count
        const { innerWidth, innerHeight } = layout;
        const aspect = innerHeight / innerWidth;
        let col = Math.ceil(Math.sqrt(count / aspect));
        // Increase col to avoid total height of packed shape
        // being large than height of bbox.
        let size = innerWidth / col;
        let row = Math.ceil(count / col);
        let h0 = row * size;
        while (h0 > innerHeight) {
            col = col + 1;
            size = innerWidth / col;
            row = Math.ceil(count / col);
            h0 = row * size;
        }
        // Some offset to increase the space usage.
        const space = innerHeight - row * size;
        const intervalY = row <= 1 ? 0 : space / (row - 1);
        const [offsetX, offsetY] = row <= 1
            ? [
                (innerWidth - pcount * size) / (pcount - 1),
                (innerHeight - size) / 2,
            ]
            : [0, 0];
        return P.map((points, m) => {
            const [x, y, width, height] = (0, vector_1.calcBBox)(points);
            const i = direction === 'col' ? m % col : Math.floor(m / row);
            const j = direction === 'col' ? Math.floor(m / col) : m % row;
            const newX = i * size;
            const newY = (row - j - 1) * size + space;
            const sx = (size - padding) / width;
            const sy = (size - padding) / height;
            // Translate the shape and mark to make sure the center of
            // shape is overlap before and after scale transformation.
            const tx = newX - x + offsetX * i + (1 / 2) * padding;
            const ty = newY - y - intervalY * j - offsetY + (1 / 2) * padding;
            return `translate(${tx}, ${ty}) scale(${sx}, ${sy})`;
        });
    };
}
/**
 * Uniform pack to avid overlap.
 * @todo Improve or change algorithm to increase space usage.
 * @todo Take some special case into account.
 */
const Pack = (options) => {
    return (I, mark) => {
        return [I, (0, util_1.deepMix)({}, mark, { modifier: pack(options), axis: false })];
    };
};
exports.Pack = Pack;
exports.Pack.props = {};
//# sourceMappingURL=pack.js.map
}, function(modId) { var map = {"../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815873, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.mid = exports.calcBBox = exports.angleBetween = exports.angleWithQuadrant = exports.angle = exports.dist = exports.add = exports.sub = void 0;
function sub([x1, y1], [x2, y2]) {
    return [x1 - x2, y1 - y2];
}
exports.sub = sub;
function add([x1, y1], [x2, y2]) {
    return [x1 + x2, y1 + y2];
}
exports.add = add;
function dist([x0, y0], [x1, y1]) {
    return Math.sqrt(Math.pow((x0 - x1), 2) + Math.pow((y0 - y1), 2));
}
exports.dist = dist;
/**
 * Calculate angle of vector [x, y].
 */
function angle([x, y]) {
    return Math.atan2(y, x);
}
exports.angle = angle;
/**
 * Calculate angle of [x, y], then + Math.PI / 2.
 * Because of the difference between `Geometric coordinate system` and `Visualization coordinate system`.
 * @returns
 */
function angleWithQuadrant([x, y]) {
    return angle([x, y]) + Math.PI / 2;
}
exports.angleWithQuadrant = angleWithQuadrant;
function angleBetween(v0, v1) {
    const a0 = angle(v0);
    const a1 = angle(v1);
    if (a0 < a1)
        return a1 - a0;
    return Math.PI * 2 - (a0 - a1);
}
exports.angleBetween = angleBetween;
function calcBBox(points) {
    let minX = Infinity;
    let maxX = -Infinity;
    let minY = Infinity;
    let maxY = -Infinity;
    for (const [x, y] of points) {
        minX = Math.min(x, minX);
        maxX = Math.max(x, maxX);
        minY = Math.min(y, minY);
        maxY = Math.max(y, maxY);
    }
    const width = maxX - minX;
    const height = maxY - minY;
    return [minX, minY, width, height];
}
exports.calcBBox = calcBBox;
/**
 * Get the center of two points.
 */
function mid([x1, y1], [x2, y2]) {
    return [(x1 + x2) / 2, (y1 + y2) / 2];
}
exports.mid = mid;
//# sourceMappingURL=vector.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815874, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BinX = void 0;
const bin_1 = require("./bin");
const BinX = (options = {}) => {
    const { thresholds } = options;
    return (0, bin_1.Bin)(Object.assign(Object.assign({}, options), { thresholdsX: thresholds, groupChannels: ['color'], binChannels: ['x'] }));
};
exports.BinX = BinX;
exports.BinX.props = {};
//# sourceMappingURL=binX.js.map
}, function(modId) { var map = {"./bin":1751263815875}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815875, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bin = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const groupN_1 = require("./groupN");
const helper_2 = require("./utils/helper");
const THRESHOLD = 'thresholds';
/**
 * @see https://github.com/observablehq/plot/blob/main/src/transforms/bin.js
 */
function thresholdAuto(values) {
    const [min, max] = (0, d3_array_1.extent)(values);
    return Math.min(200, (0, d3_array_1.thresholdScott)(values, min, max));
}
/**
 * The Bin aggregate data.
 * @todo More threshold method.
 * @todo Performance.
 */
const Bin = (options = {}) => {
    const { groupChannels = ['color'], binChannels = ['x', 'y'] } = options, rest = __rest(options, ["groupChannels", "binChannels"]);
    const channelIndexKey = {};
    // Group indexes and update channelIndexKey.
    const groupBy = (I, mark) => {
        const { encode } = mark;
        const binValues = binChannels.map((channel) => {
            const [V] = (0, helper_2.columnOf)(encode, channel);
            return V;
        });
        const thresholds = (0, helper_1.subObject)(rest, THRESHOLD);
        const DI = I.filter((i) => binValues.every((V) => (0, helper_1.defined)(V[i])));
        // Group indexes by both discrete and quantitative channels.
        const groupKeys = [
            // For discrete channels, use value as group key.
            ...groupChannels
                .map((d) => {
                const [V] = (0, helper_2.columnOf)(encode, d);
                return V;
            })
                .filter(helper_1.defined)
                .map((V) => (i) => V[i]),
            // For quantitative channels, use extent of bin as group key.
            ...binChannels.map((d, i) => {
                const V = binValues[i];
                const t = thresholds[d] || thresholdAuto(V);
                const bins = (0, d3_array_1.bin)()
                    .thresholds(t)
                    .value((i) => +V[i])(DI);
                const indexKey = new Map(bins.flatMap((bin) => {
                    const { x0, x1 } = bin;
                    const key = `${x0},${x1}`;
                    return bin.map((i) => [i, key]);
                }));
                channelIndexKey[d] = indexKey;
                return (i) => indexKey.get(i);
            }),
        ];
        // Group by indexes by channel keys.
        const key = (i) => groupKeys.map((key) => key(i)).join('-');
        return Array.from((0, d3_array_1.group)(DI, key).values());
    };
    return (0, groupN_1.GroupN)(Object.assign(Object.assign(Object.assign({}, Object.fromEntries(Object.entries(rest).filter(([k]) => !k.startsWith(THRESHOLD)))), Object.fromEntries(binChannels.flatMap((channel) => {
        const start = ([i]) => +channelIndexKey[channel].get(i).split(',')[0];
        const end = ([i]) => +channelIndexKey[channel].get(i).split(',')[1];
        end.from = channel;
        return [
            [channel, start],
            [`${channel}1`, end],
        ];
    }))), { groupBy }));
};
exports.Bin = Bin;
exports.Bin.props = {};
//# sourceMappingURL=bin.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./groupN":1751263815864,"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815876, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sample = void 0;
// @ts-ignore medianIndex exist in d3-array@3.2.0, but @types/d3-array Expired.
const d3_array_1 = require("@antv/vendor/d3-array");
const order_1 = require("./utils/order");
const helper_1 = require("./utils/helper");
const lttb_1 = require("./utils/lttb");
function normalizeSample(strategy) {
    if (typeof strategy === 'function')
        return strategy;
    if (strategy === 'lttb')
        return lttb_1.lttb;
    const strategies = {
        first: (f) => [f[0]],
        last: (f) => [f[f.length - 1]],
        min: (f, X, Y) => [
            f[(0, d3_array_1.minIndex)(f, (i) => Y[i])],
        ],
        max: (f, X, Y) => [
            f[(0, d3_array_1.maxIndex)(f, (i) => Y[i])],
        ],
        median: (f, X, Y) => [
            f[(0, d3_array_1.medianIndex)(f, (i) => Y[i])],
        ],
    };
    const sampleFunction = strategies[strategy] || strategies.median;
    return (I, X, Y, thresholds) => {
        // Sepreate group to frames, then sample each frame.
        // Keep more data as possible.
        const frameSize = Math.max(1, Math.floor(I.length / thresholds));
        const frames = getFrames(I, frameSize);
        return frames.flatMap((frame) => sampleFunction(frame, X, Y));
    };
}
/**
 * Split the array into frame with each frameSize.
 */
function getFrames(I, frameSize) {
    const size = I.length;
    const frames = [];
    let i = 0;
    while (i < size) {
        frames.push(I.slice(i, (i += frameSize)));
    }
    return frames;
}
/**
 * The sample transform groups marks with specified groupBy fields, and
 * sample data for each group when data.length >= threshold(default = 2000).
 */
const Sample = (options = {}) => {
    const { strategy = 'median', thresholds = 2000, groupBy = ['series', 'color'], } = options;
    const sampleFunction = normalizeSample(strategy);
    return (I, mark) => {
        const { encode } = mark;
        const groups = (0, order_1.createGroups)(groupBy, I, mark);
        const [X] = (0, helper_1.columnOf)(encode, 'x');
        const [Y] = (0, helper_1.columnOf)(encode, 'y');
        return [
            groups.flatMap((g) => sampleFunction(g, X, Y, thresholds)),
            mark,
        ];
    };
};
exports.Sample = Sample;
exports.Sample.props = {};
//# sourceMappingURL=sample.js.map
}, function(modId) { var map = {"./utils/order":1751263815828,"./utils/helper":1751263815825,"./utils/lttb":1751263815877}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815877, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.lttb = void 0;
/**
 * Sample data with lttb(Largest-Triangle-Three-Buckets) algo (https://github.com/pingec/downsample-lttb).
 * Return the sampled index array.
 */
function lttb(I, X, Y, thresholds) {
    const length = I.length;
    if (thresholds >= length || thresholds === 0) {
        return I;
    }
    const x = (i) => X[I[i]] * 1;
    const y = (i) => Y[I[i]] * 1;
    const sampled = [];
    // Bucket size. Leave room for start and end data points.
    const every = (length - 2) / (thresholds - 2);
    let a = 0; // Initially a is the first point in the triangle.
    let maxArea;
    let area;
    let nextA;
    sampled.push(a); // Always add the first point.
    for (let i = 0; i < thresholds - 2; i++) {
        // Calculate point average for next bucket (containing c).
        let avgX = 0;
        let avgY = 0;
        let start = Math.floor((i + 1) * every) + 1;
        let end = Math.floor((i + 2) * every) + 1;
        end = Math.min(end, length);
        const size = end - start;
        for (; start < end; start++) {
            avgX += x(start);
            avgY += y(start);
        }
        avgX /= size;
        avgY /= size;
        // Get the range for this bucket.
        let frameStart = Math.floor((i + 0) * every) + 1;
        const frameEnd = Math.floor((i + 1) * every) + 1;
        // Point a.
        const pointA = [x(a), y(a)];
        maxArea = area = -1;
        for (; frameStart < frameEnd; frameStart++) {
            // Calculate triangle area over three buckets.
            area =
                Math.abs((pointA[0] - avgX) * (x(frameStart) - pointA[1]) -
                    (pointA[0] - y(frameStart)) * (avgY - pointA[0])) * 0.5;
            if (area > maxArea) {
                maxArea = area;
                nextA = frameStart; // Next a is this b.
            }
        }
        sampled.push(nextA); // Pick this point from the bucket.
        a = nextA; // This a is the next a (chosen b).
    }
    sampled.push(length - 1); // Always add last.
    return sampled.map((a) => I[a]);
}
exports.lttb = lttb;
//# sourceMappingURL=lttb.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815878, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Filter = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const helper_2 = require("./utils/helper");
function normalizeValue(value) {
    if (typeof value === 'object')
        return [value.value, value.ordinal];
    else
        return [value, true];
}
function filterWhenNoElements(mark) {
    var _a;
    const { encode } = mark;
    // keep y-axis
    const noElementMark = Object.assign(Object.assign({}, mark), { encode: Object.assign(Object.assign({}, mark.encode), { y: Object.assign(Object.assign({}, mark.encode.y), { value: [] }) }) });
    const targetField = (_a = encode === null || encode === void 0 ? void 0 : encode.color) === null || _a === void 0 ? void 0 : _a.field;
    if (!encode || !targetField) {
        return noElementMark;
    }
    // 获取color的筛选源
    let filterObject;
    for (const [key, v] of Object.entries(encode)) {
        if ((key === 'x' || key === 'y') && v.field === targetField) {
            filterObject = Object.assign(Object.assign({}, filterObject), { [key]: Object.assign(Object.assign({}, v), { value: [] }) });
        }
    }
    if (!filterObject) {
        return noElementMark;
    }
    return Object.assign(Object.assign({}, mark), { encode: Object.assign(Object.assign({}, mark.encode), filterObject) });
}
/**
 * The Filter transform filter channels.
 */
const Filter = (options = {}) => {
    return (I, mark) => {
        const { encode, data } = mark;
        const filters = Object.entries(options)
            .map(([key, v]) => {
            const [V] = (0, helper_2.columnOf)(encode, key);
            // Skip empty channel.
            if (!V)
                return null;
            const [value, ordinal = true] = normalizeValue(v);
            if (typeof value === 'function')
                return (i) => value(V[i]);
            if (ordinal) {
                const expectedValues = Array.isArray(value) ? value : [value];
                // Skip empty expected values.
                if (expectedValues.length === 0)
                    return null;
                return (i) => expectedValues.includes(V[i]);
            }
            else {
                const [start, end] = value;
                return (i) => V[i] >= start && V[i] <= end;
            }
        })
            .filter(helper_1.defined);
        // Filter index and channels.
        const totalFilter = (i) => filters.every((f) => f(i));
        const FI = I.filter(totalFilter);
        const newIndex = FI.map((_, i) => i);
        if (filters.length === 0) {
            const targetMark = filterWhenNoElements(mark);
            return [I, targetMark];
        }
        const newEncodes = Object.entries(encode).map(([key, encode]) => {
            return [
                key,
                Object.assign(Object.assign({}, encode), { value: newIndex
                        .map((i) => encode.value[FI[i]])
                        .filter((v) => v !== undefined) }),
            ];
        });
        return [
            newIndex,
            (0, util_1.deepMix)({}, mark, {
                encode: Object.fromEntries(newEncodes),
                // Filter data for tooltip item.
                data: FI.map((i) => data[i]),
            }),
        ];
    };
};
exports.Filter = Filter;
exports.Filter.props = {};
//# sourceMappingURL=filter.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils/helper":1751263815825}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815879, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BoxShape = exports.PolygonRibbon = exports.PolygonShape = exports.ImageShape = exports.LinkArc = exports.LinkVHV = exports.LinkSmooth = exports.LinkShape = exports.AreaHV = exports.AreaVH = exports.AreaHVH = exports.AreaSmooth = exports.AreaShape = exports.TextTag = exports.TextBadge = exports.TextShape = exports.VectorShape = exports.PointCircle = exports.PointTriangleDown = exports.PointTriangle = exports.PointTick = exports.PointSquare = exports.PointShape = exports.PointPlus = exports.PointLine = exports.PointHyphen = exports.PointHexagon = exports.PointDiamond = exports.PointCross = exports.PointBowtie = exports.PointHollowCircle = exports.PointHollowTriangleDown = exports.PointHollowTriangle = exports.PointHollowSquare = exports.PointHollow = exports.PointHollowHexagon = exports.PointHollowDiamond = exports.PointHollowBowtie = exports.LineTrail = exports.LineHVH = exports.LineVH = exports.LineHV = exports.LineSmooth = exports.LineShape = exports.CellHollow = exports.CellShape = exports.IntervalPyramid = exports.IntervalFunnel = exports.IntervalHollow = exports.IntervalShape = void 0;
exports.GaugeRound = exports.LiquidShape = exports.ShapeShape = exports.RectHollow = exports.RectShape = exports.RangeShape = exports.HeatmapShape = exports.DensityShape = exports.PathHollow = exports.PathShape = exports.LabelShape = exports.ConnectorShape = exports.LineXY = exports.BoxViolin = void 0;
var rect_1 = require("./interval/rect");
Object.defineProperty(exports, "IntervalShape", { enumerable: true, get: function () { return rect_1.Rect; } });
var hollow_1 = require("./interval/hollow");
Object.defineProperty(exports, "IntervalHollow", { enumerable: true, get: function () { return hollow_1.Hollow; } });
var funnel_1 = require("./interval/funnel");
Object.defineProperty(exports, "IntervalFunnel", { enumerable: true, get: function () { return funnel_1.Funnel; } });
var pyramid_1 = require("./interval/pyramid");
Object.defineProperty(exports, "IntervalPyramid", { enumerable: true, get: function () { return pyramid_1.Pyramid; } });
var rect_2 = require("./interval/rect");
Object.defineProperty(exports, "CellShape", { enumerable: true, get: function () { return rect_2.Rect; } });
var hollow_2 = require("./interval/hollow");
Object.defineProperty(exports, "CellHollow", { enumerable: true, get: function () { return hollow_2.Hollow; } });
var line_1 = require("./line/line");
Object.defineProperty(exports, "LineShape", { enumerable: true, get: function () { return line_1.Line; } });
var smooth_1 = require("./line/smooth");
Object.defineProperty(exports, "LineSmooth", { enumerable: true, get: function () { return smooth_1.Smooth; } });
var hv_1 = require("./line/hv");
Object.defineProperty(exports, "LineHV", { enumerable: true, get: function () { return hv_1.HV; } });
var vh_1 = require("./line/vh");
Object.defineProperty(exports, "LineVH", { enumerable: true, get: function () { return vh_1.VH; } });
var hvh_1 = require("./line/hvh");
Object.defineProperty(exports, "LineHVH", { enumerable: true, get: function () { return hvh_1.HVH; } });
var trail_1 = require("./line/trail");
Object.defineProperty(exports, "LineTrail", { enumerable: true, get: function () { return trail_1.Trail; } });
var hollowBowtie_1 = require("./point/hollowBowtie");
Object.defineProperty(exports, "PointHollowBowtie", { enumerable: true, get: function () { return hollowBowtie_1.HollowBowtie; } });
var hollowDiamond_1 = require("./point/hollowDiamond");
Object.defineProperty(exports, "PointHollowDiamond", { enumerable: true, get: function () { return hollowDiamond_1.HollowDiamond; } });
var hollowHexagon_1 = require("./point/hollowHexagon");
Object.defineProperty(exports, "PointHollowHexagon", { enumerable: true, get: function () { return hollowHexagon_1.HollowHexagon; } });
var hollow_3 = require("./point/hollow");
Object.defineProperty(exports, "PointHollow", { enumerable: true, get: function () { return hollow_3.HollowPoint; } });
var hollowSquare_1 = require("./point/hollowSquare");
Object.defineProperty(exports, "PointHollowSquare", { enumerable: true, get: function () { return hollowSquare_1.HollowSquare; } });
var hollowTriangle_1 = require("./point/hollowTriangle");
Object.defineProperty(exports, "PointHollowTriangle", { enumerable: true, get: function () { return hollowTriangle_1.HollowTriangle; } });
var hollowTriangleDown_1 = require("./point/hollowTriangleDown");
Object.defineProperty(exports, "PointHollowTriangleDown", { enumerable: true, get: function () { return hollowTriangleDown_1.HollowTriangleDown; } });
var hollowCircle_1 = require("./point/hollowCircle");
Object.defineProperty(exports, "PointHollowCircle", { enumerable: true, get: function () { return hollowCircle_1.HollowCircle; } });
var bowtie_1 = require("./point/bowtie");
Object.defineProperty(exports, "PointBowtie", { enumerable: true, get: function () { return bowtie_1.Bowtie; } });
var cross_1 = require("./point/cross");
Object.defineProperty(exports, "PointCross", { enumerable: true, get: function () { return cross_1.Cross; } });
var diamond_1 = require("./point/diamond");
Object.defineProperty(exports, "PointDiamond", { enumerable: true, get: function () { return diamond_1.Diamond; } });
var hexagon_1 = require("./point/hexagon");
Object.defineProperty(exports, "PointHexagon", { enumerable: true, get: function () { return hexagon_1.Hexagon; } });
var hyphen_1 = require("./point/hyphen");
Object.defineProperty(exports, "PointHyphen", { enumerable: true, get: function () { return hyphen_1.Hyphen; } });
var line_2 = require("./point/line");
Object.defineProperty(exports, "PointLine", { enumerable: true, get: function () { return line_2.Line; } });
var plus_1 = require("./point/plus");
Object.defineProperty(exports, "PointPlus", { enumerable: true, get: function () { return plus_1.Plus; } });
var point_1 = require("./point/point");
Object.defineProperty(exports, "PointShape", { enumerable: true, get: function () { return point_1.Point; } });
var square_1 = require("./point/square");
Object.defineProperty(exports, "PointSquare", { enumerable: true, get: function () { return square_1.Square; } });
var tick_1 = require("./point/tick");
Object.defineProperty(exports, "PointTick", { enumerable: true, get: function () { return tick_1.Tick; } });
var triangle_1 = require("./point/triangle");
Object.defineProperty(exports, "PointTriangle", { enumerable: true, get: function () { return triangle_1.Triangle; } });
var triangleDown_1 = require("./point/triangleDown");
Object.defineProperty(exports, "PointTriangleDown", { enumerable: true, get: function () { return triangleDown_1.TriangleDown; } });
var circle_1 = require("./point/circle");
Object.defineProperty(exports, "PointCircle", { enumerable: true, get: function () { return circle_1.Circle; } });
var vector_1 = require("./vector/vector");
Object.defineProperty(exports, "VectorShape", { enumerable: true, get: function () { return vector_1.Vector; } });
var text_1 = require("./text/text");
Object.defineProperty(exports, "TextShape", { enumerable: true, get: function () { return text_1.Text; } });
var badge_1 = require("./text/badge");
Object.defineProperty(exports, "TextBadge", { enumerable: true, get: function () { return badge_1.Badge; } });
var tag_1 = require("./text/tag");
Object.defineProperty(exports, "TextTag", { enumerable: true, get: function () { return tag_1.Tag; } });
var area_1 = require("./area/area");
Object.defineProperty(exports, "AreaShape", { enumerable: true, get: function () { return area_1.Area; } });
var smooth_2 = require("./area/smooth");
Object.defineProperty(exports, "AreaSmooth", { enumerable: true, get: function () { return smooth_2.Smooth; } });
var hvh_2 = require("./area/hvh");
Object.defineProperty(exports, "AreaHVH", { enumerable: true, get: function () { return hvh_2.HVH; } });
var vh_2 = require("./area/vh");
Object.defineProperty(exports, "AreaVH", { enumerable: true, get: function () { return vh_2.VH; } });
var hv_2 = require("./area/hv");
Object.defineProperty(exports, "AreaHV", { enumerable: true, get: function () { return hv_2.HV; } });
var link_1 = require("./link/link");
Object.defineProperty(exports, "LinkShape", { enumerable: true, get: function () { return link_1.Link; } });
var smooth_3 = require("./link/smooth");
Object.defineProperty(exports, "LinkSmooth", { enumerable: true, get: function () { return smooth_3.Smooth; } });
var vhv_1 = require("./link/vhv");
Object.defineProperty(exports, "LinkVHV", { enumerable: true, get: function () { return vhv_1.VHV; } });
var arc_1 = require("./link/arc");
Object.defineProperty(exports, "LinkArc", { enumerable: true, get: function () { return arc_1.Arc; } });
var image_1 = require("./image/image");
Object.defineProperty(exports, "ImageShape", { enumerable: true, get: function () { return image_1.Image; } });
var polygon_1 = require("./polygon/polygon");
Object.defineProperty(exports, "PolygonShape", { enumerable: true, get: function () { return polygon_1.Polygon; } });
var ribbon_1 = require("./polygon/ribbon");
Object.defineProperty(exports, "PolygonRibbon", { enumerable: true, get: function () { return ribbon_1.Ribbon; } });
var box_1 = require("./box/box");
Object.defineProperty(exports, "BoxShape", { enumerable: true, get: function () { return box_1.Box; } });
var violin_1 = require("./box/violin");
Object.defineProperty(exports, "BoxViolin", { enumerable: true, get: function () { return violin_1.Violin; } });
var line_3 = require("./lineXY/line");
Object.defineProperty(exports, "LineXY", { enumerable: true, get: function () { return line_3.Line; } });
var connector_1 = require("./connector/connector");
Object.defineProperty(exports, "ConnectorShape", { enumerable: true, get: function () { return connector_1.Connector; } });
var label_1 = require("./label/label");
Object.defineProperty(exports, "LabelShape", { enumerable: true, get: function () { return label_1.Label; } });
var path_1 = require("./path/path");
Object.defineProperty(exports, "PathShape", { enumerable: true, get: function () { return path_1.Path; } });
var hollow_4 = require("./path/hollow");
Object.defineProperty(exports, "PathHollow", { enumerable: true, get: function () { return hollow_4.Hollow; } });
var density_1 = require("./density/density");
Object.defineProperty(exports, "DensityShape", { enumerable: true, get: function () { return density_1.Density; } });
var heatmap_1 = require("./heatmap/heatmap");
Object.defineProperty(exports, "HeatmapShape", { enumerable: true, get: function () { return heatmap_1.Heatmap; } });
var rect_3 = require("./interval/rect");
Object.defineProperty(exports, "RangeShape", { enumerable: true, get: function () { return rect_3.Rect; } });
var rect_4 = require("./interval/rect");
Object.defineProperty(exports, "RectShape", { enumerable: true, get: function () { return rect_4.Rect; } });
var hollow_5 = require("./interval/hollow");
Object.defineProperty(exports, "RectHollow", { enumerable: true, get: function () { return hollow_5.Hollow; } });
var shape_1 = require("./shape/shape");
Object.defineProperty(exports, "ShapeShape", { enumerable: true, get: function () { return shape_1.Shape; } });
var liquid_1 = require("./liquid/liquid");
Object.defineProperty(exports, "LiquidShape", { enumerable: true, get: function () { return liquid_1.Liquid; } });
var round_1 = require("./gauge/round");
Object.defineProperty(exports, "GaugeRound", { enumerable: true, get: function () { return round_1.Round; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./interval/rect":1751263815880,"./interval/hollow":1751263815886,"./interval/funnel":1751263815887,"./interval/pyramid":1751263815888,"./line/line":1751263815889,"./line/smooth":1751263815892,"./line/hv":1751263815893,"./line/vh":1751263815894,"./line/hvh":1751263815895,"./line/trail":1751263815896,"./point/hollowBowtie":1751263815897,"./point/hollowDiamond":1751263815901,"./point/hollowHexagon":1751263815902,"./point/hollow":1751263815903,"./point/hollowSquare":1751263815904,"./point/hollowTriangle":1751263815905,"./point/hollowTriangleDown":1751263815906,"./point/hollowCircle":1751263815907,"./point/bowtie":1751263815909,"./point/cross":1751263815910,"./point/diamond":1751263815911,"./point/hexagon":1751263815912,"./point/hyphen":1751263815913,"./point/line":1751263815914,"./point/plus":1751263815915,"./point/point":1751263815916,"./point/square":1751263815917,"./point/tick":1751263815918,"./point/triangle":1751263815919,"./point/triangleDown":1751263815920,"./point/circle":1751263815908,"./vector/vector":1751263815921,"./text/text":1751263815922,"./text/badge":1751263815924,"./text/tag":1751263815925,"./area/area":1751263815926,"./area/smooth":1751263815928,"./area/hvh":1751263815929,"./area/vh":1751263815930,"./area/hv":1751263815931,"./link/link":1751263815932,"./link/smooth":1751263815933,"./link/vhv":1751263815934,"./link/arc":1751263815935,"./image/image":1751263815936,"./polygon/polygon":1751263815938,"./polygon/ribbon":1751263815939,"./box/box":1751263815940,"./box/violin":1751263815941,"./lineXY/line":1751263815942,"./connector/connector":1751263815943,"./label/label":1751263815944,"./path/path":1751263815961,"./path/hollow":1751263815963,"./density/density":1751263815964,"./heatmap/heatmap":1751263815965,"./shape/shape":1751263815969,"./liquid/liquid":1751263815970,"./gauge/round":1751263815973}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815880, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Rect = void 0;
const color_1 = require("./color");
/**
 * Render rect in different coordinate and using color channel for stroke and fill attribute.
 * The stroke attribute is valid with specified lineWidth attribute which defaults to zero.
 */
const Rect = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill' }, options), context);
};
exports.Rect = Rect;
exports.Rect.props = Object.assign(Object.assign({}, color_1.Color.props), { defaultMarker: 'square' });
//# sourceMappingURL=rect.js.map
}, function(modId) { var map = {"./color":1751263815881}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815881, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Color = exports.rect = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const selection_1 = require("../../utils/selection");
const vector_1 = require("../../utils/vector");
const number_1 = require("../../utils/number");
const utils_1 = require("../utils");
// Render rect in different coordinate.
function rect(document, points, value, coordinate, style = {}) {
    const { inset = 0, radius = 0, insetLeft = inset, insetTop = inset, insetRight = inset, insetBottom = inset, radiusBottomLeft = radius, radiusBottomRight = radius, radiusTopLeft = radius, radiusTopRight = radius, minWidth = -Infinity, maxWidth = Infinity, minHeight = -Infinity } = style, rest = __rest(style, ["inset", "radius", "insetLeft", "insetTop", "insetRight", "insetBottom", "radiusBottomLeft", "radiusBottomRight", "radiusTopLeft", "radiusTopRight", "minWidth", "maxWidth", "minHeight"]);
    if (!(0, coordinate_1.isPolar)(coordinate) && !(0, coordinate_1.isHelix)(coordinate)) {
        const tpShape = !!(0, coordinate_1.isTranspose)(coordinate);
        const [p0, , p2] = tpShape ? (0, utils_1.reorder)(points) : points;
        const [x, y] = p0;
        const [width, height] = (0, vector_1.sub)(p2, p0);
        // Deal with width or height is negative.
        const absX = width > 0 ? x : x + width;
        const absY = height > 0 ? y : y + height;
        const absWidth = Math.abs(width);
        const absHeight = Math.abs(height);
        const finalX = absX + insetLeft;
        const finalY = absY + insetTop;
        const finalWidth = absWidth - (insetLeft + insetRight);
        const finalHeight = absHeight - (insetTop + insetBottom);
        const clampWidth = tpShape
            ? (0, number_1.clamp)(finalWidth, minHeight, Infinity)
            : (0, number_1.clamp)(finalWidth, minWidth, maxWidth);
        const clampHeight = tpShape
            ? (0, number_1.clamp)(finalHeight, minWidth, maxWidth)
            : (0, number_1.clamp)(finalHeight, minHeight, Infinity);
        const clampX = tpShape ? finalX : finalX - (clampWidth - finalWidth) / 2;
        const clampY = tpShape
            ? finalY - (clampHeight - finalHeight) / 2
            : finalY - (clampHeight - finalHeight);
        return (0, selection_1.select)(document.createElement('rect', {}))
            .style('x', clampX)
            .style('y', clampY)
            .style('width', clampWidth)
            .style('height', clampHeight)
            .style('radius', [
            radiusTopLeft,
            radiusTopRight,
            radiusBottomRight,
            radiusBottomLeft,
        ])
            .call(utils_1.applyStyle, rest)
            .node();
    }
    // Render path in polar coordinate.
    const { y, y1 } = value;
    const center = coordinate.getCenter();
    const arcObject = (0, utils_1.getArcObject)(coordinate, points, [y, y1]);
    const path = (0, d3_shape_1.arc)()
        .cornerRadius(radius)
        .padAngle((inset * Math.PI) / 180);
    return (0, selection_1.select)(document.createElement('path', {}))
        .style('d', path(arcObject))
        .style('transform', `translate(${center[0]}, ${center[1]})`)
        .style('radius', radius)
        .style('inset', inset)
        .call(utils_1.applyStyle, rest)
        .node();
}
exports.rect = rect;
/**
 * Render rect in different coordinate.
 * Calc arc path based on control points directly rather startAngle, endAngle, innerRadius,
 * outerRadius. This is not accurate and will cause bug when the range of y scale is [1, 0]
 * for cell geometry.
 */
const Color = (options, context) => {
    // Render border only when colorAttribute is stroke.
    const { colorAttribute, opacityAttribute = 'fill', first = true, last = true } = options, style = __rest(options, ["colorAttribute", "opacityAttribute", "first", "last"]);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor, radius: defaultRadius = 0 } = defaults, restDefaults = __rest(defaults, ["color", "radius"]);
        const defaultLineWidth = restDefaults.lineWidth || 1;
        const { stroke, radius = defaultRadius, radiusTopLeft = radius, radiusTopRight = radius, radiusBottomRight = radius, radiusBottomLeft = radius, innerRadius = 0, innerRadiusTopLeft = innerRadius, innerRadiusTopRight = innerRadius, innerRadiusBottomRight = innerRadius, innerRadiusBottomLeft = innerRadius, lineWidth = colorAttribute === 'stroke' || stroke ? defaultLineWidth : 0, inset = 0, insetLeft = inset, insetRight = inset, insetBottom = inset, insetTop = inset, minWidth, maxWidth, minHeight } = style, rest = __rest(style, ["stroke", "radius", "radiusTopLeft", "radiusTopRight", "radiusBottomRight", "radiusBottomLeft", "innerRadius", "innerRadiusTopLeft", "innerRadiusTopRight", "innerRadiusBottomRight", "innerRadiusBottomLeft", "lineWidth", "inset", "insetLeft", "insetRight", "insetBottom", "insetTop", "minWidth", "maxWidth", "minHeight"]);
        const { color = defaultColor, opacity } = value;
        // Extended style, which is not supported by native g shape,
        // should apply at first.
        const standardDirRadius = [
            first ? radiusTopLeft : innerRadiusTopLeft,
            first ? radiusTopRight : innerRadiusTopRight,
            last ? radiusBottomRight : innerRadiusBottomRight,
            last ? radiusBottomLeft : innerRadiusBottomLeft,
        ];
        const standardDir = [
            'radiusTopLeft',
            'radiusTopRight',
            'radiusBottomRight',
            'radiusBottomLeft',
        ];
        // Transpose: rotate it clockwise by 90.
        if ((0, coordinate_1.isTranspose)(coordinate)) {
            standardDir.push(standardDir.shift());
        }
        const extendedStyle = Object.assign(Object.assign({ radius }, Object.fromEntries(standardDir.map((d, i) => [d, standardDirRadius[i]]))), { inset,
            insetLeft,
            insetRight,
            insetBottom,
            insetTop,
            minWidth,
            maxWidth,
            minHeight });
        return ((0, selection_1.select)(rect(document, points, value, coordinate, extendedStyle))
            .call(utils_1.applyStyle, restDefaults)
            .style('fill', 'transparent')
            .style(colorAttribute, color)
            .style((0, utils_1.toOpacityKey)(options), opacity)
            .style('lineWidth', lineWidth)
            .style('stroke', stroke === undefined ? color : stroke)
            // shape.style has higher priority.
            .call(utils_1.applyStyle, rest)
            .node());
    };
};
exports.Color = Color;
// @todo Should Shape have default animations using for ordinal scale?
exports.Color.props = {
    defaultEnterAnimation: 'scaleInY',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=color.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/selection":1751263815883,"../../utils/vector":1751263815873,"../../utils/number":1751263815884,"../utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815882, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.getTransformOptions = exports.angleOf = exports.radiusOf = exports.getRadius = exports.isNonCartesian = exports.isTheta = exports.isCircular = exports.isRadar = exports.isFisheye = exports.isParallel = exports.isHelix = exports.isRadial = exports.isPolar = exports.isTranspose = void 0;
function isTranspose(coordinate) {
    const { transformations } = coordinate.getOptions();
    const transposes = transformations
        .map(([type]) => type)
        .filter((type) => type === 'transpose');
    return transposes.length % 2 !== 0;
}
exports.isTranspose = isTranspose;
function isPolar(coordinate) {
    const { transformations } = coordinate.getOptions();
    return transformations.some(([type]) => type === 'polar');
}
exports.isPolar = isPolar;
function isRadial(coordinate) {
    const { transformations } = coordinate.getOptions();
    return (
    // distinguish radial from theta.
    transformations.some(([type]) => type === 'reflect') &&
        transformations.some(([type]) => type.startsWith('transpose')));
}
exports.isRadial = isRadial;
function isHelix(coordinate) {
    const { transformations } = coordinate.getOptions();
    return transformations.some(([type]) => type === 'helix');
}
exports.isHelix = isHelix;
function isParallel(coordinate) {
    const { transformations } = coordinate.getOptions();
    return transformations.some(([type]) => type === 'parallel');
}
exports.isParallel = isParallel;
function isFisheye(coordinate) {
    const { transformations } = coordinate.getOptions();
    return transformations.some(([type]) => type === 'fisheye');
}
exports.isFisheye = isFisheye;
function isRadar(coordinate) {
    return isParallel(coordinate) && isPolar(coordinate);
}
exports.isRadar = isRadar;
function isCircular(coordinate) {
    return isHelix(coordinate) || isPolar(coordinate);
}
exports.isCircular = isCircular;
function isTheta(coordinate) {
    return isPolar(coordinate) && isTranspose(coordinate);
}
exports.isTheta = isTheta;
function isNonCartesian(coordinate) {
    return (isPolar(coordinate) ||
        isParallel(coordinate) ||
        isRadial(coordinate) ||
        isTheta(coordinate));
}
exports.isNonCartesian = isNonCartesian;
function getRadius(coordinate) {
    if (isCircular(coordinate)) {
        const [width, height] = coordinate.getSize();
        const polar = coordinate
            .getOptions()
            .transformations.find((t) => t[0] === 'polar');
        // coordinate.size * outerRadius.
        if (polar)
            return (Math.max(width, height) / 2) * polar[4];
    }
    return 0;
}
exports.getRadius = getRadius;
function radiusOf(coordinate) {
    const { transformations } = coordinate.getOptions();
    const [, , , innerRadius, outerRadius] = transformations.find((d) => d[0] === 'polar');
    return [+innerRadius, +outerRadius];
}
exports.radiusOf = radiusOf;
function angleOf(coordinate, isRadius = true) {
    const { transformations } = coordinate.getOptions();
    const [, startAngle, endAngle] = transformations.find((d) => d[0] === 'polar');
    return isRadius
        ? [(+startAngle * 180) / Math.PI, (+endAngle * 180) / Math.PI]
        : [startAngle, endAngle];
}
exports.angleOf = angleOf;
function getTransformOptions(coordinate, type) {
    const { transformations } = coordinate.getOptions();
    const [, ...args] = transformations.find((d) => d[0] === type);
    return args;
}
exports.getTransformOptions = getTransformOptions;
//# sourceMappingURL=coordinate.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815883, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Selection = exports.select = void 0;
const g_1 = require("@antv/g");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("./helper");
function select(node) {
    return new Selection([node], null, node, node.ownerDocument);
}
exports.select = select;
/**
 * A simple implementation of d3-selection for @antv/g.
 * It has the core features of d3-selection and extended ability.
 * Every methods of selection returns new selection if elements
 * are mutated(e.g. append, remove), otherwise return the selection itself(e.g. attr, style).
 * @see https://github.com/d3/d3-selection
 * @see https://github.com/antvis/g
 * @todo Nested selections.
 * @todo More useful functor.
 */
class Selection {
    constructor(elements = null, data = null, parent = null, document = null, selections = [
        null,
        null,
        null,
        null,
        null,
    ], transitions = [], updateElements = []) {
        this._elements = Array.from(elements);
        this._data = data;
        this._parent = parent;
        this._document = document;
        this._enter = selections[0];
        this._update = selections[1];
        this._exit = selections[2];
        this._merge = selections[3];
        this._split = selections[4];
        this._transitions = transitions;
        this._facetElements = updateElements;
    }
    selectAll(selector) {
        const elements = typeof selector === 'string'
            ? this._parent.querySelectorAll(selector)
            : selector;
        return new Selection(elements, null, this._elements[0], this._document);
    }
    selectFacetAll(selector) {
        const elements = typeof selector === 'string'
            ? this._parent.querySelectorAll(selector)
            : selector;
        return new Selection(this._elements, null, this._parent, this._document, undefined, undefined, elements);
    }
    /**
     * @todo Replace with querySelector which has bug now.
     */
    select(selector) {
        const element = typeof selector === 'string'
            ? this._parent.querySelectorAll(selector)[0] || null
            : selector;
        return new Selection([element], null, element, this._document);
    }
    append(node) {
        const callback = typeof node === 'function' ? node : () => this.createElement(node);
        const elements = [];
        if (this._data !== null) {
            // For empty selection, append new element to parent.
            // Each element is bind with datum.
            for (let i = 0; i < this._data.length; i++) {
                const d = this._data[i];
                const [datum, from] = Array.isArray(d) ? d : [d, null];
                const newElement = callback(datum, i);
                newElement.__data__ = datum;
                if (from !== null)
                    newElement.__fromElements__ = from;
                this._parent.appendChild(newElement);
                elements.push(newElement);
            }
            return new Selection(elements, null, this._parent, this._document);
        }
        else {
            // For non-empty selection, append new element to
            // selected element and return new selection.
            for (let i = 0; i < this._elements.length; i++) {
                const element = this._elements[i];
                const datum = element.__data__;
                const newElement = callback(datum, i);
                element.appendChild(newElement);
                elements.push(newElement);
            }
            return new Selection(elements, null, elements[0], this._document);
        }
    }
    maybeAppend(id, node, className) {
        const element = this._elements[0];
        const child = element.getElementById(id);
        if (child) {
            return new Selection([child], null, this._parent, this._document);
        }
        const newChild = typeof node === 'string' ? this.createElement(node) : node();
        newChild.id = id;
        if (className)
            newChild.className = className;
        element.appendChild(newChild);
        return new Selection([newChild], null, this._parent, this._document);
    }
    /**
     * Bind data to elements, and produce three selection:
     * Enter: Selection with empty elements and data to be bind to elements.
     * Update: Selection with elements to be updated.
     * Exit: Selection with elements to be removed.
     */
    data(data, id = (d) => d, groupId = () => null) {
        // An Array of new data.
        const enter = [];
        // An Array of elements to be updated.
        const update = [];
        // A Set of elements to be removed.
        const exit = new Set(this._elements);
        // An Array of data to be merged into one element.
        const merge = [];
        // A Set of elements to be split into multiple datum.
        const split = new Set();
        // A Map from key to each element.
        const keyElement = new Map(this._elements.map((d, i) => [id(d.__data__, i), d]));
        // A Map from key to exist element. The Update Selection
        // can get element from this map, this is for diff among
        // facets.
        const keyUpdateElement = new Map(this._facetElements.map((d, i) => [id(d.__data__, i), d]));
        // A Map from groupKey to a group of elements.
        const groupKeyElements = (0, d3_array_1.group)(this._elements, (d) => groupId(d.__data__));
        // Diff data with selection(elements with data).
        // !!! Note
        // The switch is strictly ordered, not not change the order of them.
        for (let i = 0; i < data.length; i++) {
            const datum = data[i];
            const key = id(datum, i);
            const groupKey = groupId(datum, i);
            // Append element to update selection if incoming data has
            // exactly the same key with elements.
            if (keyElement.has(key)) {
                const element = keyElement.get(key);
                element.__data__ = datum;
                element.__facet__ = false;
                update.push(element);
                exit.delete(element);
                keyElement.delete(key);
                // Append element to update selection if incoming data has
                // exactly the same key with updateElements.
            }
            else if (keyUpdateElement.has(key)) {
                const element = keyUpdateElement.get(key);
                element.__data__ = datum;
                // Flag this element should update its parentNode.
                element.__facet__ = true;
                update.push(element);
                keyUpdateElement.delete(key);
                // Append datum to merge selection if existed elements has
                // its key as groupKey.
            }
            else if (groupKeyElements.has(key)) {
                const group = groupKeyElements.get(key);
                merge.push([datum, group]);
                for (const element of group)
                    exit.delete(element);
                groupKeyElements.delete(key);
                // Append element to split selection if incoming data has
                // groupKey as its key, and bind to datum for it.
            }
            else if (keyElement.has(groupKey)) {
                const element = keyElement.get(groupKey);
                if (element.__toData__)
                    element.__toData__.push(datum);
                else
                    element.__toData__ = [datum];
                split.add(element);
                exit.delete(element);
            }
            else {
                // @todo Data with non-unique key.
                enter.push(datum);
            }
        }
        // Create new selection with enter, update and exit.
        const S = [
            new Selection([], enter, this._parent, this._document),
            new Selection(update, null, this._parent, this._document),
            new Selection(exit, null, this._parent, this._document),
            new Selection([], merge, this._parent, this._document),
            new Selection(split, null, this._parent, this._document),
        ];
        return new Selection(this._elements, null, this._parent, this._document, S);
    }
    merge(other) {
        const elements = [...this._elements, ...other._elements];
        const transitions = [...this._transitions, ...other._transitions];
        return new Selection(elements, null, this._parent, this._document, undefined, transitions);
    }
    createElement(type) {
        if (this._document) {
            return this._document.createElement(type, {});
        }
        const Ctor = Selection.registry[type];
        if (Ctor)
            return new Ctor();
        return (0, helper_1.error)(`Unknown node type: ${type}`);
    }
    /**
     * Apply callback for each selection(enter, update, exit)
     * and merge them into one selection.
     */
    join(enter = (d) => d, update = (d) => d, exit = (d) => d.remove(), merge = (d) => d, split = (d) => d.remove()) {
        const newEnter = enter(this._enter);
        const newUpdate = update(this._update);
        const newExit = exit(this._exit);
        const newMerge = merge(this._merge);
        const newSplit = split(this._split);
        return newUpdate
            .merge(newEnter)
            .merge(newExit)
            .merge(newMerge)
            .merge(newSplit);
    }
    remove() {
        // Remove node immediately if there is no transition,
        // otherwise wait until transition finished.
        for (let i = 0; i < this._elements.length; i++) {
            const transition = this._transitions[i];
            if (transition) {
                const T = Array.isArray(transition) ? transition : [transition];
                Promise.all(T.map((d) => d.finished)).then(() => {
                    const element = this._elements[i];
                    element.remove();
                });
            }
            else {
                const element = this._elements[i];
                element.remove();
            }
        }
        return new Selection([], null, this._parent, this._document, undefined, this._transitions);
    }
    each(callback) {
        for (let i = 0; i < this._elements.length; i++) {
            const element = this._elements[i];
            const datum = element.__data__;
            callback(datum, i, element);
        }
        return this;
    }
    attr(key, value) {
        const callback = typeof value !== 'function' ? () => value : value;
        return this.each(function (d, i, element) {
            if (value !== undefined)
                element[key] = callback(d, i, element);
        });
    }
    style(key, value) {
        const callback = typeof value !== 'function' ? () => value : value;
        return this.each(function (d, i, element) {
            if (value !== undefined)
                element.style[key] = callback(d, i, element);
        });
    }
    transition(value) {
        const callback = typeof value !== 'function' ? () => value : value;
        const { _transitions: T } = this;
        return this.each(function (d, i, element) {
            T[i] = callback(d, i, element);
        });
    }
    on(event, handler) {
        this.each(function (d, i, element) {
            element.addEventListener(event, handler);
        });
        return this;
    }
    call(callback, ...args) {
        callback(this, ...args);
        return this;
    }
    node() {
        return this._elements[0];
    }
    nodes() {
        return this._elements;
    }
    transitions() {
        return this._transitions;
    }
    parent() {
        return this._parent;
    }
}
exports.Selection = Selection;
Selection.registry = {
    g: g_1.Group,
    rect: g_1.Rect,
    circle: g_1.Circle,
    path: g_1.Path,
    text: g_1.Text,
    ellipse: g_1.Ellipse,
    image: g_1.Image,
    line: g_1.Line,
    polygon: g_1.Polygon,
    polyline: g_1.Polyline,
    html: g_1.HTML,
};
//# sourceMappingURL=selection.js.map
}, function(modId) { var map = {"./helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815884, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.prettyNumber = exports.clamp = void 0;
/**
 * Clamp number within the inclusive range within the lower and upper bounds.
 */
function clamp(v, lower, upper) {
    return Math.max(lower, Math.min(v, upper));
}
exports.clamp = clamp;
/**
 * Precision conversion
 */
function prettyNumber(n, precision = 10) {
    if (typeof n !== 'number')
        return n;
    return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(precision));
}
exports.prettyNumber = prettyNumber;
//# sourceMappingURL=number.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815885, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.getOrigin = exports.getTransform = exports.toOpacityKey = exports.getConnectStyle = exports.getArcObject = exports.reorder = exports.computeGradient = exports.appendArc = exports.arrowPoints = exports.appendPolygon = exports.applyStyle = void 0;
const scale_1 = require("@antv/scale");
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const array_1 = require("../utils/array");
const coordinate_1 = require("../utils/coordinate");
const vector_1 = require("../utils/vector");
function applyStyle(selection, style) {
    for (const [key, value] of Object.entries(style)) {
        selection.style(key, value);
    }
}
exports.applyStyle = applyStyle;
/**
 * Draw polygon path with points.
 * @param path
 * @param points
 */
function appendPolygon(path, points) {
    points.forEach((p, idx) => idx === 0 ? path.moveTo(p[0], p[1]) : path.lineTo(p[0], p[1]));
    path.closePath();
    return path;
}
exports.appendPolygon = appendPolygon;
/**
 * Draw arrow between `from` and `to`.
 * @param from
 * @param to
 * @returns
 */
function arrowPoints(from, to, options) {
    const { arrowSize } = options;
    const size = typeof arrowSize === 'string'
        ? (+parseFloat(arrowSize) / 100) * (0, vector_1.dist)(from, to)
        : arrowSize;
    // TODO Use config from style.
    // Default arrow rotate is 30°.
    const arrowAngle = Math.PI / 6;
    const angle = Math.atan2(to[1] - from[1], to[0] - from[0]);
    const arrowAngle1 = Math.PI / 2 - angle - arrowAngle;
    const arrow1 = [
        to[0] - size * Math.sin(arrowAngle1),
        to[1] - size * Math.cos(arrowAngle1),
    ];
    const arrowAngle2 = angle - arrowAngle;
    const arrow2 = [
        to[0] - size * Math.cos(arrowAngle2),
        to[1] - size * Math.sin(arrowAngle2),
    ];
    return [arrow1, arrow2];
}
exports.arrowPoints = arrowPoints;
/**
 * Draw arc by from -> to, with center and radius.
 * @param path
 * @param from
 * @param to
 * @param center
 * @param radius
 */
function appendArc(path, from, to, center, radius) {
    const startAngle = (0, vector_1.angle)((0, vector_1.sub)(center, from)) + Math.PI;
    const endAngle = (0, vector_1.angle)((0, vector_1.sub)(center, to)) + Math.PI;
    path.arc(center[0], center[1], radius, startAngle, endAngle, endAngle - startAngle < 0);
    return path;
}
exports.appendArc = appendArc;
/**
 * @todo Fix wrong key point.
 */
function computeGradient(C, X, Y, from = 'y', mode = 'between', tpShape = false) {
    // The angles of gradients rendering are varies when 'from' and 'tpShape' are different.
    const getTheta = (from, tpShape) => {
        if (from === 'y' || from === true) {
            if (tpShape) {
                return 180;
            }
            else {
                return 90;
            }
        }
        else {
            if (tpShape) {
                return 90;
            }
            else {
                return 0;
            }
        }
    };
    const P = from === 'y' || from === true ? Y : X;
    const theta = getTheta(from, tpShape);
    const I = (0, array_1.indexOf)(P);
    const [min, max] = (0, d3_array_1.extent)(I, (i) => P[i]);
    // This need to improve for non-uniform distributed colors.
    const p = new scale_1.Linear({
        domain: [min, max],
        range: [0, 100],
    });
    const percentage = (i) => (0, util_1.isNumber)(P[i]) && !Number.isNaN(P[i]) ? p.map(P[i]) : 0;
    const gradientMode = {
        // Interpolate the colors for this segment.
        between: (i) => `${C[i]} ${percentage(i)}%`,
        // Use the color of the start point as the color for this segment.
        start: (i) => i === 0
            ? `${C[i]} ${percentage(i)}%`
            : `${C[i - 1]} ${percentage(i)}%, ${C[i]} ${percentage(i)}%`,
        // Use the color of the end point as the color for this segment.
        end: (i) => i === C.length - 1
            ? `${C[i]} ${percentage(i)}%`
            : `${C[i]} ${percentage(i)}%, ${C[i + 1]} ${percentage(i)}%`,
    };
    const gradient = I.sort((a, b) => percentage(a) - percentage(b))
        .map(gradientMode[mode] || gradientMode['between'])
        .join(',');
    return `linear-gradient(${theta}deg, ${gradient})`;
}
exports.computeGradient = computeGradient;
function reorder(points) {
    const [p0, p1, p2, p3] = points;
    return [p3, p0, p1, p2];
}
exports.reorder = reorder;
function getArcObject(coordinate, points, Y) {
    const [p0, p1, , p3] = (0, coordinate_1.isTranspose)(coordinate) ? reorder(points) : points;
    const [y, y1] = Y;
    const center = coordinate.getCenter();
    const a1 = (0, vector_1.angleWithQuadrant)((0, vector_1.sub)(p0, center));
    const a2 = (0, vector_1.angleWithQuadrant)((0, vector_1.sub)(p1, center));
    // There are two situations that a2 === a1:
    // 1. a1 - a2 = 0
    // 2. |a1 - a2| = Math.PI * 2
    // Distinguish them by y and y1:
    const a3 = a2 === a1 && y !== y1 ? a2 + Math.PI * 2 : a2;
    return {
        startAngle: a1,
        endAngle: a3 - a1 >= 0 ? a3 : Math.PI * 2 + a3,
        innerRadius: (0, vector_1.dist)(p3, center),
        outerRadius: (0, vector_1.dist)(p0, center),
    };
}
exports.getArcObject = getArcObject;
/**
 * Pick connectStyle from style.
 * @param style
 */
function getConnectStyle(style) {
    const PREFIX = 'connect';
    return Object.fromEntries(Object.entries(style)
        .filter(([key]) => key.startsWith(PREFIX))
        .map(([key, value]) => [
        (0, util_1.lowerFirst)(key.replace(PREFIX, '').trim()),
        value,
    ])
        .filter(([key]) => key !== undefined));
}
exports.getConnectStyle = getConnectStyle;
function toOpacityKey(options) {
    const { colorAttribute, opacityAttribute = colorAttribute } = options;
    return `${opacityAttribute}Opacity`;
}
exports.toOpacityKey = toOpacityKey;
function getTransform(coordinate, value) {
    if (!(0, coordinate_1.isPolar)(coordinate))
        return '';
    const center = coordinate.getCenter();
    const { transform: suffix } = value;
    return `translate(${center[0]}, ${center[1]}) ${suffix || ''}`;
}
exports.getTransform = getTransform;
function getOrigin(points) {
    if (points.length === 1)
        return points[0];
    const [[x0, y0, z0 = 0], [x2, y2, z2 = 0]] = points;
    return [(x0 + x2) / 2, (y0 + y2) / 2, (z0 + z2) / 2];
}
exports.getOrigin = getOrigin;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"../utils/coordinate":1751263815882,"../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815886, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Hollow = void 0;
const color_1 = require("./color");
/**
 * Render rect in different coordinate and using color channel for stroke attribute.
 */
const Hollow = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke' }, options), context);
};
exports.Hollow = Hollow;
exports.Hollow.props = Object.assign(Object.assign({}, color_1.Color.props), { defaultMarker: 'hollowSquare' });
//# sourceMappingURL=hollow.js.map
}, function(modId) { var map = {"./color":1751263815881}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815887, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Funnel = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const selection_1 = require("../../utils/selection");
const utils_1 = require("../utils");
/**
 * Adjust and return the new `points`.
 */
function getFunnelPoints(points, nextPoints, coordinate) {
    const [p0, p1, p2, p3] = points;
    if ((0, coordinate_1.isTranspose)(coordinate)) {
        const newP1 = [nextPoints ? nextPoints[0][0] : p1[0], p1[1]];
        const newP2 = [nextPoints ? nextPoints[3][0] : p2[0], p2[1]];
        return [p0, newP1, newP2, p3];
    }
    const newP1 = [p1[0], nextPoints ? nextPoints[0][1] : p1[1]];
    const newP2 = [p2[0], nextPoints ? nextPoints[3][1] : p2[1]];
    return [p0, newP1, newP2, p3];
}
/**
 * Render funnel in different coordinate and using color channel for stroke and fill attribute.
 */
const Funnel = (options, context) => {
    const { adjustPoints = getFunnelPoints } = options, style = __rest(options, ["adjustPoints"]);
    const { coordinate, document } = context;
    return (points, value, defaults, point2d) => {
        const { index } = value;
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const nextPoints = point2d[index + 1];
        const funnelPoints = adjustPoints(points, nextPoints, coordinate);
        const tpShape = !!(0, coordinate_1.isTranspose)(coordinate);
        const [p0, p1, p2, p3] = tpShape ? (0, utils_1.reorder)(funnelPoints) : funnelPoints;
        const { color = defaultColor, opacity } = value;
        const b = (0, d3_shape_1.line)().curve(d3_shape_1.curveLinearClosed)([p0, p1, p2, p3]);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', b)
            .style('fill', color)
            .style('fillOpacity', opacity)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Funnel = Funnel;
exports.Funnel.props = {
    defaultMarker: 'square',
};
//# sourceMappingURL=funnel.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/selection":1751263815883,"../utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815888, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Pyramid = void 0;
const coordinate_1 = require("../../utils/coordinate");
const funnel_1 = require("./funnel");
/**
 * Adjust and return the new `points`.
 */
function getPyramidPoints(points, nextPoints, coordinate) {
    const [p0, p1, p2, p3] = points;
    if ((0, coordinate_1.isTranspose)(coordinate)) {
        const newP1 = [
            nextPoints ? nextPoints[0][0] : (p1[0] + p2[0]) / 2,
            p1[1],
        ];
        const newP2 = [
            nextPoints ? nextPoints[3][0] : (p1[0] + p2[0]) / 2,
            p2[1],
        ];
        return [p0, newP1, newP2, p3];
    }
    const newP1 = [
        p1[0],
        nextPoints ? nextPoints[0][1] : (p1[1] + p2[1]) / 2,
    ];
    const newP2 = [
        p2[0],
        nextPoints ? nextPoints[3][1] : (p1[1] + p2[1]) / 2,
    ];
    return [p0, newP1, newP2, p3];
}
/**
 * Render pyramid in different coordinate and using color channel for stroke and fill attribute.
 */
const Pyramid = (options, context) => {
    return (0, funnel_1.Funnel)(Object.assign({ adjustPoints: getPyramidPoints }, options), context);
};
exports.Pyramid = Pyramid;
exports.Pyramid.props = {
    defaultMarker: 'square',
};
//# sourceMappingURL=pyramid.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"./funnel":1751263815887}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815889, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Line = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const curve_1 = require("./curve");
const Line = (options, context) => {
    const { coordinate } = context;
    return (...params) => {
        const curve = (0, coordinate_1.isPolar)(coordinate) ? d3_shape_1.curveLinearClosed : d3_shape_1.curveLinear;
        return (0, curve_1.Curve)(Object.assign({ curve }, options), context)(...params);
    };
};
exports.Line = Line;
exports.Line.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'line' });
//# sourceMappingURL=line.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815890, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Curve = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const selection_1 = require("../../utils/selection");
const utils_1 = require("../utils");
const createElement_1 = require("../../utils/createElement");
const helper_1 = require("../../utils/helper");
const vector_1 = require("../../utils/vector");
const DoublePath = (0, createElement_1.createElement)((g) => {
    const { d1, d2, style1, style2 } = g.attributes;
    const document = g.ownerDocument;
    (0, selection_1.select)(g)
        .maybeAppend('line', () => document.createElement('path', {}))
        .style('d', d1)
        .call(utils_1.applyStyle, style1);
    (0, selection_1.select)(g)
        .maybeAppend('line1', () => document.createElement('path', {}))
        .style('d', d2)
        .call(utils_1.applyStyle, style2);
});
/**
 * Given a points sequence, split it into an array of defined points
 * and an array of undefined segments.
 *
 * Input - [[1, 2], [3, 4], [null, null], [null, null], [5, 6], [null, null], [7, 8]]
 * Output
 *  - [[1, 2], [3, 4], [5, 6], [7, 8]]
 *  - [
 *      [[3, 4], [5, 6]],
 *      [[5, 6], [7, 8]]
 *    ]
 */
function segmentation(points, defined) {
    const definedPoints = [];
    const segments = [];
    let m = false; // Is in a undefined sequence.
    let dp = null; // The previous defined point.
    for (const p of points) {
        // If current point is a undefined point,
        // enter a undefined sequence.
        if (!defined(p[0]) || !defined(p[1]))
            m = true;
        else {
            definedPoints.push(p);
            // If current point is a defined point,
            // and is in a undefined sequence, save
            // the two closest defined points as this
            // undefined sequence and exit it.
            if (m) {
                m = false;
                segments.push([dp, p]);
            }
            // Update the previous defined point.
            dp = p;
        }
    }
    return [definedPoints, segments];
}
const Curve = (options, context) => {
    const { curve, gradient = false, 
    // The color for each segment.
    gradientColor = 'between', defined = (d) => !Number.isNaN(d) && d !== undefined && d !== null, connect: connectNulls = false } = options, style = __rest(options, ["curve", "gradient", "gradientColor", "defined", "connect"]);
    const { coordinate, document } = context;
    return (P, value, defaults) => {
        // Compute styles.
        const { color: defaultColor, lineWidth: defaultSize } = defaults, rest = __rest(defaults, ["color", "lineWidth"]);
        const { color = defaultColor, size = defaultSize, seriesColor: sc, seriesX: sx, seriesY: sy, } = value;
        const transform = (0, utils_1.getTransform)(coordinate, value);
        const tpShape = (0, coordinate_1.isTranspose)(coordinate);
        const stroke = gradient && sc
            ? (0, utils_1.computeGradient)(sc, sx, sy, gradient, gradientColor, tpShape)
            : color;
        const finalStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), (stroke && { stroke })), (size && { lineWidth: size })), (transform && { transform })), style);
        // Compute points and segments.
        let linePath;
        if ((0, coordinate_1.isPolar)(coordinate)) {
            const center = coordinate.getCenter();
            linePath = (points) => (0, d3_shape_1.lineRadial)()
                .angle((_, idx) => (0, vector_1.angleWithQuadrant)((0, vector_1.sub)(points[idx], center)))
                .radius((_, idx) => (0, vector_1.dist)(points[idx], center))
                .defined(([x, y]) => defined(x) && defined(y))
                .curve(curve)(points);
        }
        else {
            linePath = (0, d3_shape_1.line)()
                .x((d) => d[0])
                .y((d) => d[1])
                .defined(([x, y]) => defined(x) && defined(y))
                .curve(curve);
        }
        const [DP, MS] = segmentation(P, defined);
        const connectStyle = (0, helper_1.subObject)(finalStyle, 'connect');
        const missing = !!MS.length;
        // Draw one path of connected defined points.
        if (!missing || (connectNulls && !Object.keys(connectStyle).length)) {
            return (0, selection_1.select)(document.createElement('path', {}))
                .style('d', linePath(DP) || [])
                .call(utils_1.applyStyle, finalStyle)
                .node();
        }
        // Draw one path of unconnected defined points.
        if (missing && !connectNulls) {
            return (0, selection_1.select)(document.createElement('path', {}))
                .style('d', linePath(P))
                .call(utils_1.applyStyle, finalStyle)
                .node();
        }
        // Draw two path.
        // One for unconnected defined points.
        // One for connected segments.
        const connectPath = (segments) => segments.map(linePath).join(',');
        return (0, selection_1.select)(new DoublePath())
            .style('style1', Object.assign(Object.assign({}, finalStyle), connectStyle))
            .style('style2', finalStyle)
            .style('d1', connectPath(MS))
            .style('d2', linePath(P))
            .node();
    };
};
exports.Curve = Curve;
exports.Curve.props = {
    defaultMarker: 'smooth',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=curve.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/selection":1751263815883,"../utils":1751263815885,"../../utils/createElement":1751263815891,"../../utils/helper":1751263815829,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815891, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.createElement = void 0;
const g_1 = require("@antv/g");
function createElement(descriptor) {
    const render = typeof descriptor === 'function' ? descriptor : descriptor.render;
    return class extends g_1.CustomElement {
        connectedCallback() {
            this.draw();
        }
        attributeChangedCallback() {
            this.draw();
        }
        draw() {
            render(this);
        }
    };
}
exports.createElement = createElement;
//# sourceMappingURL=createElement.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815892, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Smooth = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const curve_1 = require("./curve");
const Smooth = (options, context) => {
    const rest = __rest(options, []);
    const { coordinate } = context;
    return (...params) => {
        const curve = (0, coordinate_1.isPolar)(coordinate)
            ? d3_shape_1.curveCatmullRomClosed
            : (0, coordinate_1.isTranspose)(coordinate)
                ? d3_shape_1.curveMonotoneY
                : d3_shape_1.curveMonotoneX;
        return (0, curve_1.Curve)(Object.assign({ curve }, rest), context)(...params);
    };
};
exports.Smooth = Smooth;
exports.Smooth.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'smooth' });
//# sourceMappingURL=smooth.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815893, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HV = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const HV = (options, context) => {
    return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStepAfter }, options), context);
};
exports.HV = HV;
exports.HV.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'hv' });
//# sourceMappingURL=hv.js.map
}, function(modId) { var map = {"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815894, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.VH = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const VH = (options, context) => {
    return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStepBefore }, options), context);
};
exports.VH = VH;
exports.VH.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'vh' });
//# sourceMappingURL=vh.js.map
}, function(modId) { var map = {"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815895, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HVH = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const HVH = (options, context) => {
    return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStep }, options), context);
};
exports.HVH = HVH;
exports.HVH.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'hvh' });
//# sourceMappingURL=hvh.js.map
}, function(modId) { var map = {"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815896, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Trail = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const selection_1 = require("../../utils/selection");
const utils_1 = require("../utils");
const vector_1 = require("../../utils/vector");
const helper_1 = require("../../utils/helper");
const curve_1 = require("./curve");
/**
 *
 * x9-x0---------x1-x2
 * /   |r1        |r2 \
 *x8---p0---------p1---x3
 * \ r4|          | r3 /
 *  x7-x6--------x5-x4
 */
function stroke(path, p0, p1, s0, s1) {
    const v = (0, vector_1.sub)(p1, p0);
    const a = (0, vector_1.angle)(v);
    const a1 = a + Math.PI / 2;
    const r1 = [(s0 / 2) * Math.cos(a1), (s0 / 2) * Math.sin(a1)];
    const r2 = [(s1 / 2) * Math.cos(a1), (s1 / 2) * Math.sin(a1)];
    const r3 = [(s1 / 2) * Math.cos(a), (s1 / 2) * Math.sin(a)];
    const r4 = [(s0 / 2) * Math.cos(a), (s0 / 2) * Math.sin(a)];
    const x0 = (0, vector_1.add)(p0, r1);
    const x1 = (0, vector_1.add)(p1, r2);
    const x2 = (0, vector_1.add)(x1, r3);
    const x3 = (0, vector_1.add)(p1, r3);
    const x4 = (0, vector_1.sub)(x3, r2);
    const x5 = (0, vector_1.sub)(p1, r2);
    const x6 = (0, vector_1.sub)(p0, r1);
    const x7 = (0, vector_1.sub)(x6, r4);
    const x8 = (0, vector_1.sub)(p0, r4);
    const x9 = (0, vector_1.sub)(x0, r4);
    path.moveTo(...x0);
    path.lineTo(...x1);
    path.arcTo(...x2, ...x3, s1 / 2);
    path.arcTo(...x4, ...x5, s1 / 2);
    path.lineTo(...x6);
    path.arcTo(...x7, ...x8, s0 / 2);
    path.arcTo(...x9, ...x0, s0 / 2);
    path.closePath();
}
// @todo Support connect and connectStyle.
const Trail = (options, context) => {
    const { document } = context;
    return (P, value, defaults) => {
        const { seriesSize, color } = value;
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const path = (0, d3_path_1.path)();
        for (let i = 0; i < P.length - 1; i++) {
            const p0 = P[i];
            const p1 = P[i + 1];
            const s0 = seriesSize[i];
            const s1 = seriesSize[i + 1];
            if ([...p0, ...p1].every(helper_1.defined))
                stroke(path, p0, p1, s0, s1);
        }
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('fill', color || defaultColor)
            .style('d', path.toString())
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Trail = Trail;
exports.Trail.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'line' });
//# sourceMappingURL=trail.js.map
}, function(modId) { var map = {"../../utils/selection":1751263815883,"../utils":1751263815885,"../../utils/vector":1751263815873,"../../utils/helper":1751263815829,"./curve":1751263815890}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815897, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowBowtie = void 0;
const color_1 = require("./color");
/**
 * ▷◁
 */
const HollowBowtie = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'bowtie' }, options), context);
};
exports.HollowBowtie = HollowBowtie;
exports.HollowBowtie.props = Object.assign({ defaultMarker: 'hollowBowtie' }, color_1.Color.props);
//# sourceMappingURL=hollowBowtie.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815898, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Color = exports.getRadius = void 0;
const coordinate_1 = require("../../utils/coordinate");
const marker_1 = require("../../utils/marker");
const selection_1 = require("../../utils/selection");
const string_1 = require("../../utils/string");
const utils_1 = require("../utils");
function getRadius(mode, points, value, coordinate) {
    if (points.length === 1)
        return undefined;
    const { size } = value;
    if (mode === 'fixed')
        return size;
    if (mode === 'normal' || (0, coordinate_1.isFisheye)(coordinate)) {
        const [[x0, y0], [x2, y2]] = points;
        const a = Math.abs((x2 - x0) / 2);
        const b = Math.abs((y2 - y0) / 2);
        return Math.max(0, (a + b) / 2);
    }
    return size;
}
exports.getRadius = getRadius;
/**
 * Render point in different coordinate.
 */
const Color = (options, context) => {
    // Render border only when colorAttribute is stroke.
    const { colorAttribute, symbol, mode = 'auto' } = options, style = __rest(options, ["colorAttribute", "symbol", "mode"]);
    const path = marker_1.Symbols.get((0, string_1.camelCase)(symbol)) || marker_1.Symbols.get('point');
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { lineWidth, color: defaultColor } = defaults;
        const finalLineWidth = style.stroke ? lineWidth || 1 : lineWidth;
        const { color = defaultColor, transform, opacity } = value;
        const [cx, cy] = (0, utils_1.getOrigin)(points);
        const r = getRadius(mode, points, value, coordinate);
        const finalRadius = r || style.r || defaults.r;
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, defaults)
            .style('fill', 'transparent')
            .style('d', path(cx, cy, finalRadius))
            .style('lineWidth', finalLineWidth)
            .style('transform', transform)
            .style('transformOrigin', `${cx - finalRadius} ${cy - finalRadius}`)
            .style('stroke', color)
            .style((0, utils_1.toOpacityKey)(options), opacity)
            .style(colorAttribute, color)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Color = Color;
exports.Color.props = {
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=color.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/marker":1751263815899,"../../utils/selection":1751263815883,"../../utils/string":1751263815900,"../utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815899, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.unregisterSymbol = exports.registerSymbol = exports.useMarker = exports.Symbols = void 0;
const g_1 = require("@antv/g");
const point = (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],
        ['Z'],
    ];
};
point.style = ['fill'];
const hollowPoint = point.bind(undefined);
hollowPoint.style = ['stroke', 'lineWidth'];
const square = (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'],
    ];
};
square.style = ['fill'];
const rect = square.bind(undefined);
rect.style = ['fill'];
const hollowSquare = square.bind(undefined);
hollowSquare.style = ['stroke', 'lineWidth'];
const diamond = (x, y, r) => {
    const hr = r * 0.618;
    return [
        ['M', x - hr, y],
        ['L', x, y - r],
        ['L', x + hr, y],
        ['L', x, y + r],
        ['Z'],
    ];
};
diamond.style = ['fill'];
const hollowDiamond = diamond.bind(undefined);
hollowDiamond.style = ['stroke', 'lineWidth'];
const triangle = (x, y, r) => {
    const 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.style = ['fill'];
const hollowTriangle = triangle.bind(undefined);
hollowTriangle.style = ['stroke', 'lineWidth'];
const triangleDown = (x, y, r) => {
    const diffY = r * Math.sin((1 / 3) * Math.PI);
    return [
        ['M', x - r, y - diffY],
        ['L', x + r, y - diffY],
        ['L', x, y + diffY],
        ['Z'],
    ];
};
triangleDown.style = ['fill'];
const hollowTriangleDown = triangleDown.bind(undefined);
hollowTriangleDown.style = ['stroke', 'lineWidth'];
const hexagon = (x, y, r) => {
    const 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'],
    ];
};
hexagon.style = ['fill'];
const hollowHexagon = hexagon.bind(undefined);
hollowHexagon.style = ['stroke', 'lineWidth'];
const bowtie = (x, y, r) => {
    const 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'],
    ];
};
bowtie.style = ['fill'];
const hollowBowtie = bowtie.bind(undefined);
hollowBowtie.style = ['stroke', 'lineWidth'];
const line = (x, y, r) => {
    return [
        ['M', x, y + r],
        ['L', x, y - r],
    ];
};
line.style = ['stroke', 'lineWidth'];
const cross = (x, y, r) => {
    return [
        ['M', x - r, y - r],
        ['L', x + r, y + r],
        ['M', x + r, y - r],
        ['L', x - r, y + r],
    ];
};
cross.style = ['stroke', 'lineWidth'];
const tick = (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],
    ];
};
tick.style = ['stroke', 'lineWidth'];
const plus = (x, y, r) => {
    return [
        ['M', x - r, y],
        ['L', x + r, y],
        ['M', x, y - r],
        ['L', x, y + r],
    ];
};
plus.style = ['stroke', 'lineWidth'];
const hyphen = (x, y, r) => {
    return [
        ['M', x - r, y],
        ['L', x + r, y],
    ];
};
hyphen.style = ['stroke', 'lineWidth'];
const dot = (x, y, r) => {
    return [
        ['M', x - r, y],
        ['L', x + r, y],
    ];
};
dot.style = ['stroke', 'lineWidth'];
const dash = dot.bind(undefined);
dash.style = ['stroke', 'lineWidth'];
const smooth = (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],
    ];
};
smooth.style = ['stroke', 'lineWidth'];
const hv = (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],
    ];
};
hv.style = ['stroke', 'lineWidth'];
const vh = (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.style = ['stroke', 'lineWidth'];
const hvh = (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],
    ];
};
hvh.style = ['stroke', 'lineWidth'];
const vhv = (x, y, r) => {
    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],
    ];
};
vhv.style = ['stroke', 'lineWidth'];
exports.Symbols = new Map([
    ['bowtie', bowtie],
    ['cross', cross],
    ['dash', dash],
    ['diamond', diamond],
    ['dot', dot],
    ['hexagon', hexagon],
    ['hollowBowtie', hollowBowtie],
    ['hollowDiamond', hollowDiamond],
    ['hollowHexagon', hollowHexagon],
    ['hollowPoint', hollowPoint],
    ['hollowSquare', hollowSquare],
    ['hollowTriangle', hollowTriangle],
    ['hollowTriangleDown', hollowTriangleDown],
    ['hv', hv],
    ['hvh', hvh],
    ['hyphen', hyphen],
    ['line', line],
    ['plus', plus],
    ['point', point],
    ['rect', rect],
    ['smooth', smooth],
    ['square', square],
    ['tick', tick],
    ['triangleDown', triangleDown],
    ['triangle', triangle],
    ['vh', vh],
    ['vhv', vhv],
]);
function useMarker(type, _a) {
    var { d, fill, lineWidth, path, stroke, color } = _a, style = __rest(_a, ["d", "fill", "lineWidth", "path", "stroke", "color"]);
    const symbol = exports.Symbols.get(type) || exports.Symbols.get('point');
    return (...args) => {
        const path = new g_1.Path({
            style: Object.assign(Object.assign({}, style), { d: symbol(...args), stroke: symbol.style.includes('stroke') ? color || stroke : '', fill: symbol.style.includes('fill') ? color || fill : '', lineWidth: symbol.style.includes('lineWidth')
                    ? lineWidth || lineWidth || 2
                    : 0 }),
        });
        return path;
    };
}
exports.useMarker = useMarker;
function registerSymbol(type, marker) {
    exports.Symbols.set(type, marker);
}
exports.registerSymbol = registerSymbol;
function unregisterSymbol(type) {
    exports.Symbols.delete(type);
}
exports.unregisterSymbol = unregisterSymbol;
//# sourceMappingURL=marker.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815900, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.kebabCase = exports.camelCase = void 0;
/**
 * camelCase('foo-bar');
 * // => 'fooBar'
 * @param s
 */
function camelCase(s) {
    return s.replace(/-(\w)/g, function (_, letter) {
        return letter.toUpperCase();
    });
}
exports.camelCase = camelCase;
/**
 * kebabCase('fooBar');
 * // => 'foo-bar'
 * @param s
 */
function kebabCase(s) {
    return s.replace(/([A-Z])/g, '-$1').toLowerCase();
}
exports.kebabCase = kebabCase;
//# sourceMappingURL=string.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815901, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowDiamond = void 0;
const color_1 = require("./color");
/**
 * ◇
 */
const HollowDiamond = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'diamond' }, options), context);
};
exports.HollowDiamond = HollowDiamond;
exports.HollowDiamond.props = Object.assign({ defaultMarker: 'hollowDiamond' }, color_1.Color.props);
//# sourceMappingURL=hollowDiamond.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815902, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowHexagon = void 0;
const color_1 = require("./color");
/**
 * ⬡
 */
const HollowHexagon = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'hexagon' }, options), context);
};
exports.HollowHexagon = HollowHexagon;
exports.HollowHexagon.props = Object.assign({ defaultMarker: 'hollowHexagon' }, color_1.Color.props);
//# sourceMappingURL=hollowHexagon.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815903, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowPoint = void 0;
const color_1 = require("./color");
/**
 * ○
 */
const HollowPoint = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'point' }, options), context);
};
exports.HollowPoint = HollowPoint;
exports.HollowPoint.props = Object.assign({ defaultMarker: 'hollowPoint' }, color_1.Color.props);
//# sourceMappingURL=hollow.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815904, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowSquare = void 0;
const color_1 = require("./color");
/**
 * □
 */
const HollowSquare = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'square' }, options), context);
};
exports.HollowSquare = HollowSquare;
exports.HollowSquare.props = Object.assign({ defaultMarker: 'hollowSquare' }, color_1.Color.props);
//# sourceMappingURL=hollowSquare.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815905, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowTriangle = void 0;
const color_1 = require("./color");
/**
 * △
 */
const HollowTriangle = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'triangle' }, options), context);
};
exports.HollowTriangle = HollowTriangle;
exports.HollowTriangle.props = Object.assign({ defaultMarker: 'hollowTriangle' }, color_1.Color.props);
//# sourceMappingURL=hollowTriangle.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815906, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowTriangleDown = void 0;
const color_1 = require("./color");
/**
 * ▽
 */
const HollowTriangleDown = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'triangle-down' }, options), context);
};
exports.HollowTriangleDown = HollowTriangleDown;
exports.HollowTriangleDown.props = Object.assign({ defaultMarker: 'hollowTriangleDown' }, color_1.Color.props);
//# sourceMappingURL=hollowTriangleDown.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815907, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HollowCircle = void 0;
const circle_1 = require("./circle");
/**
 * ○
 */
const HollowCircle = (options, context) => {
    return (0, circle_1.BaseCircle)(Object.assign({ colorAttribute: 'stroke' }, options), context);
};
exports.HollowCircle = HollowCircle;
exports.HollowCircle.props = Object.assign({ defaultMarker: 'hollowPoint' }, circle_1.Circle.props);
//# sourceMappingURL=hollowCircle.js.map
}, function(modId) { var map = {"./circle":1751263815908}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815908, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Circle = exports.BaseCircle = void 0;
const selection_1 = require("../../utils/selection");
const utils_1 = require("../utils");
const color_1 = require("./color");
/**
 * Render point in different coordinate.
 */
const BaseCircle = (options, context) => {
    // Render border only when colorAttribute is stroke.
    const { colorAttribute, mode = 'auto' } = options, style = __rest(options, ["colorAttribute", "mode"]);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { lineWidth, color: defaultColor } = defaults;
        const finalLineWidth = style.stroke ? lineWidth || 1 : lineWidth;
        const { color = defaultColor, transform, opacity } = value;
        const [cx, cy] = (0, utils_1.getOrigin)(points);
        const r = (0, color_1.getRadius)(mode, points, value, coordinate);
        const finalRadius = r || style.r || defaults.r;
        return (0, selection_1.select)(document.createElement('circle', {}))
            .call(utils_1.applyStyle, defaults)
            .style('fill', 'transparent')
            .style('cx', cx)
            .style('cy', cy)
            .style('r', finalRadius)
            .style('lineWidth', finalLineWidth)
            .style('transform', transform)
            .style('transformOrigin', `${cx} ${cy}`)
            .style('stroke', color)
            .style((0, utils_1.toOpacityKey)(options), opacity)
            .style(colorAttribute, color)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.BaseCircle = BaseCircle;
/**
 * ●
 */
const Circle = (options, context) => {
    return (0, exports.BaseCircle)(Object.assign({ colorAttribute: 'fill' }, options), context);
};
exports.Circle = Circle;
exports.Circle.props = {
    defaultMarker: 'circle',
    defaultEnterAnimation: 'fadeIn',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=circle.js.map
}, function(modId) { var map = {"../../utils/selection":1751263815883,"../utils":1751263815885,"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815909, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Bowtie = void 0;
const color_1 = require("./color");
/**
 * ▶◀
 */
const Bowtie = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'bowtie' }, options), context);
};
exports.Bowtie = Bowtie;
exports.Bowtie.props = Object.assign({ defaultMarker: 'bowtie' }, color_1.Color.props);
//# sourceMappingURL=bowtie.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815910, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Cross = void 0;
const color_1 = require("./color");
/**
 * ✕
 */
const Cross = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'cross' }, options), context);
};
exports.Cross = Cross;
exports.Cross.props = Object.assign({ defaultMarker: 'cross' }, color_1.Color.props);
//# sourceMappingURL=cross.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815911, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Diamond = void 0;
const color_1 = require("./color");
/**
 * ◆
 */
const Diamond = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'diamond' }, options), context);
};
exports.Diamond = Diamond;
exports.Diamond.props = Object.assign({ defaultMarker: 'diamond' }, color_1.Color.props);
//# sourceMappingURL=diamond.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815912, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Hexagon = void 0;
const color_1 = require("./color");
/**
 * ⭓
 */
const Hexagon = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'hexagon' }, options), context);
};
exports.Hexagon = Hexagon;
exports.Hexagon.props = Object.assign({ defaultMarker: 'hexagon' }, color_1.Color.props);
//# sourceMappingURL=hexagon.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815913, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Hyphen = void 0;
const color_1 = require("./color");
/**
 * -
 */
const Hyphen = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'hyphen' }, options), context);
};
exports.Hyphen = Hyphen;
exports.Hyphen.props = Object.assign({ defaultMarker: 'hyphen' }, color_1.Color.props);
//# sourceMappingURL=hyphen.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815914, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Line = void 0;
const color_1 = require("./color");
/**
 * |
 */
const Line = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'line' }, options), context);
};
exports.Line = Line;
exports.Line.props = Object.assign({ defaultMarker: 'line' }, color_1.Color.props);
//# sourceMappingURL=line.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815915, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Plus = void 0;
const color_1 = require("./color");
/**
 * +
 */
const Plus = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'plus' }, options), context);
};
exports.Plus = Plus;
exports.Plus.props = Object.assign({ defaultMarker: 'plus' }, color_1.Color.props);
//# sourceMappingURL=plus.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815916, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Point = void 0;
const color_1 = require("./color");
/**
 * ●
 */
const Point = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'point' }, options), context);
};
exports.Point = Point;
exports.Point.props = Object.assign({ defaultMarker: 'point' }, color_1.Color.props);
//# sourceMappingURL=point.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815917, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Square = void 0;
const color_1 = require("./color");
/**
 * ■
 */
const Square = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'square' }, options), context);
};
exports.Square = Square;
exports.Square.props = Object.assign({ defaultMarker: 'square' }, color_1.Color.props);
//# sourceMappingURL=square.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815918, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tick = void 0;
const color_1 = require("./color");
/**
 * 工
 */
const Tick = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'stroke', symbol: 'tick' }, options), context);
};
exports.Tick = Tick;
exports.Tick.props = Object.assign({ defaultMarker: 'tick' }, color_1.Color.props);
//# sourceMappingURL=tick.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815919, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Triangle = void 0;
const color_1 = require("./color");
/**
 * ▲
 */
const Triangle = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'triangle' }, options), context);
};
exports.Triangle = Triangle;
exports.Triangle.props = Object.assign({ defaultMarker: 'triangle' }, color_1.Color.props);
//# sourceMappingURL=triangle.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815920, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.TriangleDown = void 0;
const color_1 = require("./color");
/**
 * ▼
 */
const TriangleDown = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill', symbol: 'triangle-down' }, options), context);
};
exports.TriangleDown = TriangleDown;
exports.TriangleDown.props = Object.assign({ defaultMarker: 'triangleDown' }, color_1.Color.props);
//# sourceMappingURL=triangleDown.js.map
}, function(modId) { var map = {"./color":1751263815898}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815921, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vector = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
/**
 * Connect 2 points with a single line with arrow.
 * ----->
 */
const Vector = (options, context) => {
    const { arrow = true, arrowSize = '40%' } = options, style = __rest(options, ["arrow", "arrowSize"]);
    const { document } = context;
    return (points, value, defaults) => {
        const { defaultColor } = defaults, rest = __rest(defaults, ["defaultColor"]);
        const { color = defaultColor, transform } = value;
        const [from, to] = points;
        // Draw line
        const path = (0, d3_path_1.path)();
        path.moveTo(...from);
        path.lineTo(...to);
        // Draw 2 arrows.
        if (arrow) {
            // Calculate arrow end point.
            const [arrow1, arrow2] = (0, utils_1.arrowPoints)(from, to, { arrowSize });
            path.moveTo(...arrow1);
            path.lineTo(...to);
            path.lineTo(...arrow2);
        }
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Vector = Vector;
exports.Vector.props = {
    defaultMarker: 'line',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=vector.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815922, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
const utils_1 = require("../../shape/utils");
const selection_1 = require("../../utils/selection");
const advance_1 = require("./advance");
/**
 * @todo autoRotate when in polar coordinate
 */
const Text = (options, context) => {
    const { coordinate } = context;
    return (points, value, defaults) => {
        const { color, text = '', fontSize, rotate = 0, transform = '' } = value;
        const textStyle = {
            text: String(text),
            stroke: color,
            fill: color,
            fontSize,
        };
        const [[x0, y0]] = points;
        return (0, selection_1.select)(new advance_1.Advance())
            .style('x', x0)
            .style('y', y0)
            .call(utils_1.applyStyle, defaults)
            .style('transform', `${transform}rotate(${+rotate})`)
            .style('coordCenter', coordinate.getCenter())
            .call(utils_1.applyStyle, textStyle)
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Text = Text;
exports.Text.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=text.js.map
}, function(modId) { var map = {"../../shape/utils":1751263815885,"../../utils/selection":1751263815883,"./advance":1751263815923}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815923, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Advance = void 0;
const util_1 = require("@antv/util");
const component_1 = require("@antv/component");
const d3_shape_1 = require("@antv/vendor/d3-shape");
const createElement_1 = require("../../utils/createElement");
const utils_1 = require("../utils");
const helper_1 = require("../../utils/helper");
const selection_1 = require("../../utils/selection");
const vector_1 = require("../../utils/vector");
function getConnectorPoint(shape) {
    const { min: [x0, y0], max: [x1, y1], } = shape.getLocalBounds();
    let x = 0;
    let y = 0;
    if (x0 > 0)
        x = x0;
    if (x1 < 0)
        x = x1;
    if (y0 > 0)
        y = y0;
    if (y1 < 0)
        y = y1;
    return [x, y];
}
function inferBackgroundBounds(textShape, padding = []) {
    const [top = 0, right = 0, bottom = top, left = right] = padding;
    const container = textShape.parentNode;
    const angle = container.getEulerAngles();
    container.setEulerAngles(0);
    const { min, halfExtents } = textShape.getLocalBounds();
    const [x, y] = min;
    const [hw, hh] = halfExtents;
    container.setEulerAngles(angle);
    return {
        x: x - left,
        y: y - top,
        width: hw * 2 + left + right,
        height: hh * 2 + top + bottom,
    };
}
const cos = (p0, p1, p2) => {
    const a = (0, vector_1.dist)(p0, p1);
    const b = (0, vector_1.dist)(p1, p2);
    const c = (0, vector_1.dist)(p2, p0);
    return (Math.pow(a, 2) + Math.pow(b, 2) - Math.pow(c, 2)) / (2 * a * b);
};
// A path from element to label.
// Adapted drawLabelLine from https://github.com/antvis/G2/blob/master/src/geometry/label/layout/pie/spider.ts
function inferConnectorPath(shape, end, control, coordCenter, left = true, top = true) {
    const path = (points) => (0, d3_shape_1.line)()(points);
    if (!end[0] && !end[1])
        return path([getConnectorPoint(shape), end]);
    if (!control.length)
        return path([[0, 0], end]);
    const [inflection, start] = control;
    const p1 = [...start];
    const p2 = [...inflection];
    // Label has been adjusted, so add offset to the label.
    if (start[0] !== inflection[0]) {
        const offset = left ? -4 : 4;
        p1[1] = start[1];
        // For the label in the first quadrant.
        if (top && !left) {
            p1[0] = Math.max(inflection[0], start[0] - offset);
            if (start[1] < inflection[1]) {
                p2[1] = p1[1];
            }
            else {
                p2[1] = inflection[1];
                p2[0] = Math.max(p2[0], p1[0] - offset);
            }
        }
        // For the label in the second quadrant.
        if (!top && !left) {
            p1[0] = Math.max(inflection[0], start[0] - offset);
            if (start[1] > inflection[1]) {
                p2[1] = p1[1];
            }
            else {
                p2[1] = inflection[1];
                p2[0] = Math.max(p2[0], p1[0] - offset);
            }
        }
        // For the label in the third quadrant.
        if (!top && left) {
            p1[0] = Math.min(inflection[0], start[0] - offset);
            if (start[1] > inflection[1]) {
                p2[1] = p1[1];
            }
            else {
                p2[1] = inflection[1];
                p2[0] = Math.min(p2[0], p1[0] - offset);
            }
        }
        // For the label in the fourth quadrant.
        if (top && left) {
            p1[0] = Math.min(inflection[0], start[0] - offset);
            if (start[1] < inflection[1]) {
                p2[1] = p1[1];
            }
            else {
                p2[1] = inflection[1];
                p2[0] = Math.min(p2[0], p1[0] - offset);
            }
        }
    }
    return path([start, p1, p2, inflection, end]);
}
exports.Advance = (0, createElement_1.createElement)((g) => {
    const _a = g.attributes, { className, 
    // Do not pass className
    class: _c, transform, rotate, labelTransform, labelTransformOrigin, x, y, x0 = x, y0 = y, text, background, connector, startMarker, endMarker, coordCenter, innerHTML } = _a, rest = __rest(_a, ["className", "class", "transform", "rotate", "labelTransform", "labelTransformOrigin", "x", "y", "x0", "y0", "text", "background", "connector", "startMarker", "endMarker", "coordCenter", "innerHTML"]);
    g.style.transform = `translate(${x}, ${y})`;
    // Position is invalid, do not render the UI,
    // or clear previous elements.
    if ([x, y, x0, y0].some((v) => !(0, util_1.isNumber)(v))) {
        g.children.forEach((d) => d.remove());
        return;
    }
    const _b = (0, helper_1.subObject)(rest, 'background'), { padding } = _b, backgroundStyle = __rest(_b, ["padding"]);
    const _d = (0, helper_1.subObject)(rest, 'connector'), { points: controlPoints = [] } = _d, connectorStyle = __rest(_d, ["points"]);
    let textShape;
    if (innerHTML) {
        textShape = (0, selection_1.select)(g)
            .maybeAppend('html', 'html', className)
            .style('zIndex', 0)
            .style('innerHTML', innerHTML)
            .call(utils_1.applyStyle, Object.assign({ transform: labelTransform, transformOrigin: labelTransformOrigin }, rest))
            .node();
    }
    else {
        textShape = (0, selection_1.select)(g)
            .maybeAppend('text', 'text')
            .style('zIndex', 0)
            .style('text', text)
            .call(utils_1.applyStyle, Object.assign({ textBaseline: 'middle', transform: labelTransform, transformOrigin: labelTransformOrigin }, rest))
            .node();
    }
    const rect = (0, selection_1.select)(g)
        .maybeAppend('background', 'rect')
        .style('zIndex', -1)
        .call(utils_1.applyStyle, inferBackgroundBounds(textShape, padding))
        .call(utils_1.applyStyle, background ? backgroundStyle : {})
        .node();
    const left = +x0 < coordCenter[0];
    const top = +y0 < coordCenter[1];
    const end = [+x0 - +x, +y0 - +y];
    const connectorPath = inferConnectorPath(rect, end, controlPoints, coordCenter, left, top);
    const markerStart = startMarker &&
        new component_1.Marker({
            id: 'startMarker',
            style: Object.assign({ x: 0, y: 0 }, (0, helper_1.subObject)(rest, 'startMarker')),
        });
    const markerEnd = endMarker &&
        new component_1.Marker({
            id: 'endMarker',
            style: Object.assign({ x: 0, y: 0 }, (0, helper_1.subObject)(rest, 'endMarker')),
        });
    (0, selection_1.select)(g)
        .maybeAppend('connector', 'path')
        .style('zIndex', 0)
        .style('d', connectorPath)
        .style('markerStart', markerStart)
        .style('markerEnd', markerEnd)
        .call(utils_1.applyStyle, connector ? connectorStyle : {});
});
//# sourceMappingURL=advance.js.map
}, function(modId) { var map = {"../../utils/createElement":1751263815891,"../utils":1751263815885,"../../utils/helper":1751263815829,"../../utils/selection":1751263815883,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815924, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Badge = void 0;
const component_1 = require("@antv/component");
const createElement_1 = require("../../utils/createElement");
const helper_1 = require("../../utils/helper");
const selection_1 = require("../../utils/selection");
const utils_1 = require("../../shape/utils");
/**
 * Get the path to draw a built-in badge, which is like a balloon.
 */
function getPath(r) {
    const offset = r / Math.sqrt(2);
    const dy = r * Math.sqrt(2);
    const [p0x, p0y] = [-offset, offset - dy];
    const [p1x, p1y] = [0, 0];
    const [p2x, p2y] = [offset, offset - dy];
    return [
        ['M', p0x, p0y],
        ['A', r, r, 0, 1, 1, p2x, p2y],
        ['L', p1x, p1y],
        ['Z'],
    ];
}
function inferTextPosition(shape) {
    const { min, max } = shape.getLocalBounds();
    return [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5];
}
const BadgeShape = (0, createElement_1.createElement)((g) => {
    const _a = g.attributes, { class: className, x: x0, y: y0, transform } = _a, rest = __rest(_a, ["class", "x", "y", "transform"]);
    const markerStyle = (0, helper_1.subObject)(rest, 'marker');
    const { size = 24 } = markerStyle;
    const symbol = () => getPath(size / 2);
    const bgShape = (0, selection_1.select)(g)
        .maybeAppend('marker', () => new component_1.Marker({}))
        .call((selection) => selection.node().update(Object.assign({ symbol }, markerStyle)))
        .node();
    const [x, y] = inferTextPosition(bgShape);
    (0, selection_1.select)(g)
        .maybeAppend('text', 'text')
        .style('x', x)
        .style('y', y)
        .call(utils_1.applyStyle, rest);
});
const Badge = (options, context) => {
    const style = __rest(options, []);
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, text = '' } = value;
        const textStyle = {
            text: String(text),
            stroke: color,
            fill: color,
        };
        const [[x0, y0]] = points;
        return (0, selection_1.select)(new BadgeShape())
            .call(utils_1.applyStyle, rest)
            .style('transform', `translate(${x0},${y0})`)
            .call(utils_1.applyStyle, textStyle)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Badge = Badge;
exports.Badge.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=badge.js.map
}, function(modId) { var map = {"../../utils/createElement":1751263815891,"../../utils/helper":1751263815829,"../../utils/selection":1751263815883,"../../shape/utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815925, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tag = void 0;
const g_1 = require("@antv/g");
const utils_1 = require("../../shape/utils");
const selection_1 = require("../../utils/selection");
/**
 * @todo autoRotate when in polar coordinate
 * Tag shape for Text mark, used in wordCloud plot.
 */
const Tag = (options, context) => {
    const { coordinate } = context;
    return (points, value, defaults) => {
        const { color, text = '', fontSize, rotate = 0, transform = '' } = value;
        const textStyle = {
            text: String(text),
            stroke: color,
            fill: color,
            fontSize,
            textAlign: 'center',
            textBaseline: 'middle',
        };
        const [[x0, y0]] = points;
        const n = (0, selection_1.select)(new g_1.Text())
            .style('x', x0)
            .style('y', y0)
            .call(utils_1.applyStyle, defaults)
            .style('transformOrigin', 'center center')
            .style('transform', `${transform}rotate(${rotate}deg)`)
            .style('coordCenter', coordinate.getCenter())
            .call(utils_1.applyStyle, textStyle)
            .call(utils_1.applyStyle, options)
            .node();
        return n;
    };
};
exports.Tag = Tag;
exports.Tag.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=tag.js.map
}, function(modId) { var map = {"../../shape/utils":1751263815885,"../../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815926, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Area = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const curve_1 = require("./curve");
const Area = (options, context) => {
    const { coordinate } = context;
    return (...params) => {
        const curve = (0, coordinate_1.isPolar)(coordinate) ? d3_shape_1.curveLinearClosed : d3_shape_1.curveLinear;
        return (0, curve_1.Curve)(Object.assign({ curve: curve }, options), context)(...params);
    };
};
exports.Area = Area;
exports.Area.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'square' });
//# sourceMappingURL=area.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"./curve":1751263815927}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815927, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Curve = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
const utils_1 = require("../utils");
const helper_1 = require("../../utils/helper");
const createElement_1 = require("../../utils/createElement");
/**
 * Given a points sequence, split it into an array of defined points
 * and an array of undefined segments.
 *
 * Input - [p0, p1, p2, p3, p4, p5], p1 ~ p2 is `Y1`, p3 ~ p5 is `Y0`.
 * Output - When all of Y1 & Y0 is defined, move into defined points, or else undefined segments.
 */
function segmentation(points, defined) {
    const definedPointsY1 = [];
    const definedPointsY0 = [];
    const segments = [];
    let m = false; // Is in a undefined sequence.
    let dp = null; // The previous defined point.
    const mid = points.length / 2;
    for (let i = 0; i < mid; i++) {
        const y1 = points[i];
        const y0 = points[i + mid];
        // If current point is a undefined point,
        // enter a undefined sequence.
        if ([...y1, ...y0].some((v) => !defined(v)))
            m = true;
        else {
            definedPointsY1.push(y1);
            definedPointsY0.push(y0);
            // If current point is a defined point,
            // and is in a undefined sequence, save
            // the two closest defined points as this
            // undefined sequence and exit it.
            if (m && dp) {
                m = false;
                const [dpy1, dpy0] = dp;
                segments.push([dpy1, y1, dpy0, y0]);
            }
            // Update the previous defined point.
            dp = [y1, y0];
        }
    }
    return [definedPointsY1.concat(definedPointsY0), segments];
}
const DoubleArea = (0, createElement_1.createElement)((g) => {
    const { areaPath, connectPath, areaStyle, connectStyle } = g.attributes;
    const document = g.ownerDocument;
    (0, selection_1.select)(g)
        .maybeAppend('connect-path', () => document.createElement('path', {}))
        .style('d', connectPath)
        .call(utils_1.applyStyle, connectStyle);
    (0, selection_1.select)(g)
        .maybeAppend('area-path', () => document.createElement('path', {}))
        .style('d', areaPath)
        .call(utils_1.applyStyle, areaStyle);
});
const Curve = (options, context) => {
    const { curve, gradient = false, defined = (d) => !Number.isNaN(d) && d !== undefined && d !== null, connect: connectNulls = false } = options, style = __rest(options, ["curve", "gradient", "defined", "connect"]);
    const { coordinate, document } = context;
    return (P, value, defaults) => {
        const { color: defaultColor } = defaults;
        const { color = defaultColor, seriesColor: sc, seriesX: sx, seriesY: sy, } = value;
        const tpShape = (0, coordinate_1.isTranspose)(coordinate);
        const transform = (0, utils_1.getTransform)(coordinate, value);
        const fill = gradient && sc
            ? (0, utils_1.computeGradient)(sc, sx, sy, gradient, undefined, tpShape)
            : color;
        const finalStyle = Object.assign(Object.assign(Object.assign(Object.assign({}, defaults), { stroke: fill, fill: fill }), (transform && { transform })), style);
        const [DP, MS] = segmentation(P, defined);
        const connectStyle = (0, helper_1.subObject)(finalStyle, 'connect');
        const missing = !!MS.length;
        const getPathNode = (path) => {
            return (0, selection_1.select)(document.createElement('path', {}))
                .style('d', path || '')
                .call(utils_1.applyStyle, finalStyle)
                .node();
        };
        if (!(0, coordinate_1.isPolar)(coordinate)) {
            /**
             * Draw area shape by points.
             */
            const areaPath = (points) => {
                const Y1 = points.slice(0, points.length / 2);
                const Y0 = points.slice(points.length / 2);
                return tpShape
                    ? (0, d3_shape_1.area)()
                        .y((_, idx) => Y1[idx][1])
                        .x1((_, idx) => Y1[idx][0])
                        .x0((_, idx) => Y0[idx][0])
                        .defined((_, idx) => [...Y1[idx], ...Y0[idx]].every(defined))
                        .curve(curve)(Y1)
                    : (0, d3_shape_1.area)()
                        .x((_, idx) => Y1[idx][0])
                        .y1((_, idx) => Y1[idx][1])
                        .y0((_, idx) => Y0[idx][1])
                        .defined((_, idx) => [...Y1[idx], ...Y0[idx]].every(defined))
                        .curve(curve)(Y1);
            };
            // Draw one area of connected defined points.
            if (!missing || (connectNulls && !Object.keys(connectStyle).length)) {
                return getPathNode(areaPath(DP));
            }
            // Draw one area of unconnected defined points.
            if (missing && !connectNulls) {
                return getPathNode(areaPath(P));
            }
            // Draw two area.
            // One for unconnected defined points.
            // One for connected segments.
            return (0, selection_1.select)(new DoubleArea())
                .style('areaStyle', finalStyle)
                .style('connectStyle', Object.assign(Object.assign({}, connectStyle), style))
                .style('areaPath', areaPath(P))
                .style('connectPath', MS.map(areaPath).join(''))
                .node();
        }
        else {
            /**
             * Draw areaRadial shape by points.
             */
            const areaRadialPath = (points) => {
                const center = coordinate.getCenter();
                const Y1 = points.slice(0, points.length / 2);
                const Y0 = points.slice(points.length / 2);
                return (0, d3_shape_1.areaRadial)()
                    .angle((_, idx) => (0, vector_1.angleWithQuadrant)((0, vector_1.sub)(Y1[idx], center)))
                    .outerRadius((_, idx) => (0, vector_1.dist)(Y1[idx], center))
                    .innerRadius((_, idx) => (0, vector_1.dist)(Y0[idx], center))
                    .defined((_, idx) => [...Y1[idx], ...Y0[idx]].every(defined))
                    .curve(curve)(Y0);
            };
            // Draw one area of connected defined points.
            if (!missing || (connectNulls && !Object.keys(connectStyle).length)) {
                return getPathNode(areaRadialPath(DP));
            }
            // Draw one area of unconnected defined points.
            if (missing && !connectNulls) {
                return getPathNode(areaRadialPath(P));
            }
            // Draw two area.
            // One for unconnected defined points.
            // One for connected segments.
            return (0, selection_1.select)(new DoubleArea())
                .style('areaStyle', finalStyle)
                .style('connectStyle', Object.assign(Object.assign({}, connectStyle), style))
                .style('areaPath', areaRadialPath(P))
                .style('connectPath', MS.map(areaRadialPath).join(''))
                .node();
        }
    };
};
exports.Curve = Curve;
exports.Curve.props = {
    defaultMarker: 'smooth',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=curve.js.map
}, function(modId) { var map = {"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873,"../utils":1751263815885,"../../utils/helper":1751263815829,"../../utils/createElement":1751263815891}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815928, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Smooth = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const curve_1 = require("./curve");
const Smooth = (options, context) => {
    const rest = __rest(options, []);
    const { coordinate } = context;
    return (...params) => {
        const curve = (0, coordinate_1.isPolar)(coordinate)
            ? d3_shape_1.curveCatmullRomClosed
            : (0, coordinate_1.isTranspose)(coordinate)
                ? d3_shape_1.curveMonotoneY
                : d3_shape_1.curveMonotoneX;
        return (0, curve_1.Curve)(Object.assign({ curve }, rest), context)(...params);
    };
};
exports.Smooth = Smooth;
exports.Smooth.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'smooth' });
//# sourceMappingURL=smooth.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"./curve":1751263815927}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815929, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HVH = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const HVH = (options, context) => {
    return (...params) => {
        return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStep }, options), context)(...params);
    };
};
exports.HVH = HVH;
exports.HVH.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'hvh' });
//# sourceMappingURL=hvh.js.map
}, function(modId) { var map = {"./curve":1751263815927}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815930, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.VH = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const VH = (options, context) => {
    return (...params) => {
        return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStepBefore }, options), context)(...params);
    };
};
exports.VH = VH;
exports.VH.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'vh' });
//# sourceMappingURL=vh.js.map
}, function(modId) { var map = {"./curve":1751263815927}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815931, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HV = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const curve_1 = require("./curve");
const HV = (options, context) => {
    return (...params) => {
        return (0, curve_1.Curve)(Object.assign({ curve: d3_shape_1.curveStepAfter }, options), context)(...params);
    };
};
exports.HV = HV;
exports.HV.props = Object.assign(Object.assign({}, curve_1.Curve.props), { defaultMarker: 'hv' });
//# sourceMappingURL=hv.js.map
}, function(modId) { var map = {"./curve":1751263815927}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815932, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Link = void 0;
const vector_1 = require("../../shape/vector/vector");
/**
 * Connect 2 points with a single line with arrow.
 * ----->
 */
const Link = (options, context) => {
    const { arrow = false } = options;
    return (...params) => {
        return (0, vector_1.Vector)(Object.assign(Object.assign({}, options), { arrow }), context)(...params);
    };
};
exports.Link = Link;
exports.Link.props = {
    defaultMarker: 'line',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=link.js.map
}, function(modId) { var map = {"../../shape/vector/vector":1751263815921}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815933, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Smooth = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
/**
 * Connect 2 points with a smooth line, used in tree.
 */
const Smooth = (options, context) => {
    const style = __rest(options, []);
    const { document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, transform } = value;
        const [from, to] = points;
        const path = (0, d3_path_1.path)();
        path.moveTo(from[0], from[1]);
        path.bezierCurveTo(from[0] / 2 + to[0] / 2, from[1], from[0] / 2 + to[0] / 2, to[1], to[0], to[1]);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Smooth = Smooth;
exports.Smooth.props = {
    defaultMarker: 'smooth',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=smooth.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815934, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VHV = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
/**
 * Get vhv path in different coordinate.
 */
function getVHVPath(from, to, coordinate, ratio) {
    const path = (0, d3_path_1.path)();
    if ((0, coordinate_1.isPolar)(coordinate)) {
        const center = coordinate.getCenter();
        const a = (0, vector_1.dist)(from, center);
        const b = (0, vector_1.dist)(to, center);
        const radius = (b - a) * ratio + a;
        path.moveTo(from[0], from[1]);
        (0, utils_1.appendArc)(path, from, to, center, radius);
        path.lineTo(to[0], to[1]);
        return path;
    }
    if ((0, coordinate_1.isTranspose)(coordinate)) {
        path.moveTo(from[0], from[1]);
        // VHV in x.
        path.lineTo(from[0] + (to[0] - from[0]) * ratio, from[1]);
        path.lineTo(from[0] + (to[0] - from[0]) * ratio, to[1]);
        path.lineTo(to[0], to[1]);
        return path;
    }
    path.moveTo(from[0], from[1]);
    // VHV in y.
    path.lineTo(from[0], from[1] + (to[1] - from[1]) * ratio);
    path.lineTo(to[0], from[1] + (to[1] - from[1]) * ratio);
    path.lineTo(to[0], to[1]);
    return path;
}
/**
 * Connect 2 points with a VHV line, used in tree.
 */
const VHV = (options, context) => {
    const { cornerRatio = 1 / 3 } = options, style = __rest(options, ["cornerRatio"]);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { defaultColor } = defaults, rest = __rest(defaults, ["defaultColor"]);
        const { color = defaultColor, transform } = value;
        const [from, to] = points;
        const path = getVHVPath(from, to, coordinate, cornerRatio);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.VHV = VHV;
exports.VHV.props = {
    defaultMarker: 'vhv',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=vhv.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815935, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Arc = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
/**
 * Connect points for 2 points:
 * - In rect, draw half circle.
 * - In polar, draw quadratic curve.
 */
const Arc = (options, context) => {
    const style = __rest(options, []);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, transform } = value;
        const [from, to] = points;
        const path = (0, d3_path_1.path)();
        path.moveTo(from[0], from[1]);
        if ((0, coordinate_1.isPolar)(coordinate)) {
            const center = coordinate.getCenter();
            path.quadraticCurveTo(center[0], center[1], to[0], to[1]);
        }
        else {
            const center = (0, vector_1.mid)(from, to);
            const raduis = (0, vector_1.dist)(from, to) / 2;
            (0, utils_1.appendArc)(path, from, to, center, raduis);
        }
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Arc = Arc;
exports.Arc.props = {
    defaultMarker: 'smooth',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=arc.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815936, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Image = void 0;
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const utils_2 = require("../../mark/utils");
const Image = (options, context) => {
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, src = '', size = 32, transform = '' } = value;
        let { width = size, height = size } = options;
        const [[x0, y0]] = points;
        // Support percentage width, height.
        const [w, h] = coordinate.getSize();
        width = typeof width === 'string' ? (0, utils_2.p)(width) * w : width;
        height = typeof height === 'string' ? (0, utils_2.p)(height) * h : height;
        const x = x0 - Number(width) / 2;
        const y = y0 - Number(height) / 2;
        return (0, selection_1.select)(document.createElement('image', {}))
            .call(utils_1.applyStyle, rest)
            .style('x', x)
            .style('y', y)
            .style('src', src)
            .style('stroke', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, options)
            .style('width', width)
            .style('height', height)
            .node();
    };
};
exports.Image = Image;
exports.Image.props = {
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=image.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../mark/utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815937, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeData = exports.valueof = exports.field = exports.visualMark = exports.p = exports.createBandOffset = exports.bandWidth = exports.basePostInference = exports.basePreInference = exports.baseAnnotationChannels = exports.tooltipXd = exports.tooltip1d = exports.tooltip2d = exports.tooltip3d = exports.baseGeometryChannels = exports.baseChannels = void 0;
const transform_1 = require("../transform");
function baseChannels(options = {}) {
    const { shapes } = options;
    return [
        { name: 'color' },
        { name: 'opacity' },
        { name: 'shape', range: shapes },
        { name: 'enterType' },
        { name: 'enterDelay', scaleKey: 'enter' },
        { name: 'enterDuration', scaleKey: 'enter' },
        { name: 'enterEasing' },
        { name: 'key', scale: 'identity' },
        { name: 'groupKey', scale: 'identity' },
        { name: 'label', scale: 'identity' },
    ];
}
exports.baseChannels = baseChannels;
function baseGeometryChannels(options = {}) {
    return [...baseChannels(options), { name: 'title', scale: 'identity' }];
}
exports.baseGeometryChannels = baseGeometryChannels;
function tooltip3d() {
    return [
        { type: transform_1.MaybeTitle, channel: 'color' },
        { type: transform_1.MaybeTooltip, channel: ['x', 'y', 'z'] },
    ];
}
exports.tooltip3d = tooltip3d;
function tooltip2d() {
    return [
        { type: transform_1.MaybeTitle, channel: 'color' },
        { type: transform_1.MaybeTooltip, channel: ['x', 'y'] },
    ];
}
exports.tooltip2d = tooltip2d;
function tooltip1d() {
    return [
        { type: transform_1.MaybeTitle, channel: 'x' },
        { type: transform_1.MaybeTooltip, channel: ['y'] },
    ];
}
exports.tooltip1d = tooltip1d;
function tooltipXd() {
    return [
        { type: transform_1.MaybeTitle, channel: 'color' },
        { type: transform_1.MaybeTooltip, channel: ['position'] },
    ];
}
exports.tooltipXd = tooltipXd;
function baseAnnotationChannels(options = {}) {
    return baseChannels(options);
}
exports.baseAnnotationChannels = baseAnnotationChannels;
function basePreInference() {
    return [{ type: transform_1.MaybeKey }];
}
exports.basePreInference = basePreInference;
function basePostInference() {
    return [];
}
exports.basePostInference = basePostInference;
function bandWidth(scale, x) {
    return scale.getBandWidth(scale.invert(x));
}
exports.bandWidth = bandWidth;
function createBandOffset(scale, value, options = {}) {
    const { x: X, y: Y, series: S } = value;
    const { x, y, series } = scale;
    const { style: { bandOffset = series ? 0 : 0.5, bandOffsetX = bandOffset, bandOffsetY = bandOffset, } = {}, } = options;
    const isBandX = !!(x === null || x === void 0 ? void 0 : x.getBandWidth);
    const isBandY = !!(y === null || y === void 0 ? void 0 : y.getBandWidth);
    const isSeries = !!(series === null || series === void 0 ? void 0 : series.getBandWidth);
    if (!isBandX && !isBandY)
        return (d) => d;
    return (d, i) => {
        const widthX = isBandX ? bandWidth(x, X[i]) : 0;
        const widthY = isBandY ? bandWidth(y, Y[i]) : 0;
        const f = () => (bandWidth(series, S[i]) / 2 + +S[i]) * widthX;
        const offset = isSeries && S ? f() : 0;
        const [x0, y0] = d;
        return [x0 + bandOffsetX * widthX + offset, y0 + bandOffsetY * widthY];
    };
}
exports.createBandOffset = createBandOffset;
function p(d) {
    return parseFloat(d) / 100;
}
exports.p = p;
function visualMark(index, scale, value, coordinate) {
    const { x: X, y: Y } = value;
    const { innerWidth, innerHeight } = coordinate.getOptions();
    const P = Array.from(index, (i) => {
        const x0 = X[i];
        const y0 = Y[i];
        const x = typeof x0 === 'string' ? p(x0) * innerWidth : +x0;
        const y = typeof y0 === 'string' ? p(y0) * innerHeight : +y0;
        return [[x, y]];
    });
    return [index, P];
}
exports.visualMark = visualMark;
function field(encode) {
    return typeof encode === 'function' ? encode : (d) => d[encode];
}
exports.field = field;
function valueof(data, encode) {
    return Array.from(data, field(encode));
}
exports.valueof = valueof;
function initializeData(data, encode) {
    const { source = (d) => d.source, target = (d) => d.target, value = (d) => d.value, } = encode;
    const { links, nodes } = data;
    const LS = valueof(links, source);
    const LT = valueof(links, target);
    const LV = valueof(links, value);
    return {
        links: links.map((_, i) => ({
            target: LT[i],
            source: LS[i],
            value: LV[i],
        })),
        nodes: nodes || Array.from(new Set([...LS, ...LT]), (key) => ({ key })),
    };
}
exports.initializeData = initializeData;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {"../transform":1751263815823}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815938, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Polygon = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const coordinate_1 = require("../../utils/coordinate");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const vector_1 = require("../../utils/vector");
function getPolygonPath(points, coordinate) {
    const path = (0, d3_path_1.path)();
    // In polar, draw arc.
    if ((0, coordinate_1.isPolar)(coordinate)) {
        const center = coordinate.getCenter();
        const closedPoints = [...points, points[0]];
        // Calculate dist array for cache.
        const dists = closedPoints.map((p) => (0, vector_1.dist)(p, center));
        closedPoints.forEach((curr, idx) => {
            if (idx === 0) {
                path.moveTo(curr[0], curr[1]);
                return;
            }
            const currDist = dists[idx];
            const prev = points[idx - 1];
            const prevDist = dists[idx - 1];
            // When radius is equal, draw 2 point with arc.
            // todo: choose a minimum value.
            if (prevDist !== undefined && Math.abs(currDist - prevDist) < 1e-10) {
                (0, utils_1.appendArc)(path, prev, curr, center, currDist);
            }
            else {
                path.lineTo(curr[0], curr[1]);
            }
        });
        path.closePath();
        return path;
    }
    // In rect, draw polygon.
    return (0, utils_1.appendPolygon)(path, points);
}
const Polygon = (options, context) => {
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, transform } = value;
        const path = getPolygonPath(points, coordinate);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color)
            .style('fill', color)
            .style('transform', transform)
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Polygon = Polygon;
exports.Polygon.props = {
    defaultMarker: 'square',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=polygon.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815939, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Ribbon = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
function getRibbonPath(points, coordinate) {
    const [p0, p1, p2, p3] = points;
    const path = (0, d3_path_1.path)();
    // In polar, draw shape only for Chord.
    if ((0, coordinate_1.isPolar)(coordinate)) {
        const center = coordinate.getCenter();
        const radius = (0, vector_1.dist)(center, p0);
        path.moveTo(p0[0], p0[1]);
        // p0 -> p2
        path.quadraticCurveTo(center[0], center[1], p2[0], p2[1]);
        // p2 -> p3
        (0, utils_1.appendArc)(path, p2, p3, center, radius);
        // p3 -> p1
        path.quadraticCurveTo(center[0], center[1], p1[0], p1[1]);
        // p1 -> p0
        (0, utils_1.appendArc)(path, p1, p0, center, radius);
        path.closePath();
        return path;
    }
    // In Rect, draw shape for Sankey.
    path.moveTo(p0[0], p0[1]);
    path.bezierCurveTo(p0[0] / 2 + p2[0] / 2, p0[1], p0[0] / 2 + p2[0] / 2, p2[1], p2[0], p2[1]);
    path.lineTo(p3[0], p3[1]);
    path.bezierCurveTo(p3[0] / 2 + p1[0] / 2, p3[1], p3[0] / 2 + p1[0] / 2, p1[1], p1[0], p1[1]);
    path.lineTo(p0[0], p0[1]);
    path.closePath();
    return path;
}
/**
 * Connect points for 4 points:
 * - In rect, draw ribbon used in Sankey.
 * - In polar, draw arc used in Chord.
 */
const Ribbon = (options, context) => {
    const style = __rest(options, []);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor, transform } = value;
        const path = getRibbonPath(points, coordinate);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('fill', color || defaultColor)
            .style('stroke', color || defaultColor)
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Ribbon = Ribbon;
exports.Ribbon.props = {
    defaultMarker: 'square',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=ribbon.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815940, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Box = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
function getPath(points, coordinate) {
    const path = (0, d3_path_1.path)();
    if (!(0, coordinate_1.isPolar)(coordinate)) {
        path.moveTo(...points[0]);
        path.lineTo(...points[1]);
        path.moveTo(...points[2]);
        path.lineTo(...points[3]);
        path.moveTo(...points[4]);
        path.lineTo(...points[5]);
        path.lineTo(...points[6]);
        path.lineTo(...points[7]);
        path.closePath();
        path.moveTo(...points[8]);
        path.lineTo(...points[9]);
        path.moveTo(...points[10]);
        path.lineTo(...points[11]);
        path.moveTo(...points[12]);
        path.lineTo(...points[13]);
    }
    else {
        // In polar coordinate.
        const center = coordinate.getCenter();
        const [x, y] = center;
        const startAngle = (0, vector_1.angle)((0, vector_1.sub)(points[0], center));
        const endAngle = (0, vector_1.angle)((0, vector_1.sub)(points[1], center));
        const radiusHigh = (0, vector_1.dist)(center, points[2]);
        const radiusQ3 = (0, vector_1.dist)(center, points[3]);
        const radiusMedian = (0, vector_1.dist)(center, points[8]);
        const radiusQ1 = (0, vector_1.dist)(center, points[10]);
        const radiusLow = (0, vector_1.dist)(center, points[11]);
        path.moveTo(...points[0]);
        path.arc(x, y, radiusHigh, startAngle, endAngle);
        path.arc(x, y, radiusHigh, endAngle, startAngle, true);
        path.moveTo(...points[2]);
        path.lineTo(...points[3]);
        path.moveTo(...points[4]);
        path.arc(x, y, radiusQ3, startAngle, endAngle); // 4 -> 5
        path.lineTo(...points[6]); // 5 -> 6
        path.arc(x, y, radiusQ1, endAngle, startAngle, true); // 6 -> 7
        path.closePath();
        path.moveTo(...points[8]);
        path.arc(x, y, radiusMedian, startAngle, endAngle); // 8 -> 9
        path.arc(x, y, radiusMedian, endAngle, startAngle, true); // 9 -> 8
        path.moveTo(...points[10]);
        path.lineTo(...points[11]);
        path.moveTo(...points[12]);
        path.arc(x, y, radiusLow, startAngle, endAngle); // 12 -> 13
        path.arc(x, y, radiusLow, endAngle, startAngle, true); // 13 -> 12
    }
    return path;
}
const Box = (options, context) => {
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color, transform } = value;
        const { color: defaultColor, fill = defaultColor, stroke = defaultColor } = defaults, rest = __rest(defaults, ["color", "fill", "stroke"]);
        const path = getPath(points, coordinate);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', stroke)
            .style('fill', color || fill)
            .style('transform', transform)
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Box = Box;
exports.Box.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=box.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815941, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Violin = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const coordinate_1 = require("../../utils/coordinate");
const vector_1 = require("../../utils/vector");
function getPath(p, coordinate, size = 4) {
    const path = (0, d3_path_1.path)();
    if (!(0, coordinate_1.isPolar)(coordinate)) {
        path.moveTo(...p[2]);
        path.lineTo(...p[3]);
        path.lineTo(p[3][0] - size, p[3][1]);
        path.lineTo(p[10][0] - size, p[10][1]);
        path.lineTo(p[10][0] + size, p[10][1]);
        path.lineTo(p[3][0] + size, p[3][1]);
        path.lineTo(...p[3]);
        path.closePath();
        path.moveTo(...p[10]);
        path.lineTo(...p[11]);
        path.moveTo(p[3][0] + size / 2, p[8][1]);
        path.arc(p[3][0], p[8][1], size / 2, 0, Math.PI * 2);
        path.closePath();
        return path;
    }
    const center = coordinate.getCenter();
    const [x, y] = center;
    const radiusQ3 = (0, vector_1.dist)(center, p[3]);
    const radiusMedian = (0, vector_1.dist)(center, p[8]);
    const radiusQ1 = (0, vector_1.dist)(center, p[10]);
    const middleAngle = (0, vector_1.angle)((0, vector_1.sub)(p[2], center));
    const rectAngle = Math.asin(size / radiusMedian);
    const startAngle = middleAngle - rectAngle;
    const endAngle = middleAngle + rectAngle;
    path.moveTo(...p[2]);
    path.lineTo(...p[3]);
    path.moveTo(Math.cos(startAngle) * radiusQ3 + x, Math.sin(startAngle) * radiusQ3 + y);
    path.arc(x, y, radiusQ3, startAngle, endAngle);
    path.lineTo(Math.cos(endAngle) * radiusQ1 + x, Math.sin(endAngle) * radiusQ1 + y);
    path.arc(x, y, radiusQ1, endAngle, startAngle, true);
    path.lineTo(Math.cos(startAngle) * radiusQ3 + x, Math.sin(startAngle) * radiusQ3 + y);
    path.closePath();
    path.moveTo(...p[10]);
    path.lineTo(...p[11]);
    const a = (startAngle + endAngle) / 2;
    path.moveTo(Math.cos(a) * (radiusMedian + size / 2) + x, Math.sin(a) * (radiusMedian + size / 2) + y);
    path.arc(Math.cos(a) * radiusMedian + x, Math.sin(a) * radiusMedian + y, size / 2, a, Math.PI * 2 + a);
    path.closePath();
    return path;
}
const Violin = (options, context) => {
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color, transform } = value;
        // TODO: how to setting it by size channel.
        const size = 4;
        const { color: defaultColor, fill = defaultColor, stroke = defaultColor } = defaults, rest = __rest(defaults, ["color", "fill", "stroke"]);
        const path = getPath(points, coordinate, size);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', stroke)
            .style('fill', color || fill)
            .style('transform', transform)
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Violin = Violin;
exports.Violin.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=violin.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"../../utils/coordinate":1751263815882,"../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815942, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Line = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const selection_1 = require("../../utils/selection");
const vector_1 = require("../../utils/vector");
const helper_1 = require("../../utils/helper");
const utils_1 = require("../utils");
function getArrowMarker(document, arrowSize, arrowStyle) {
    const arrowMarker = document.createElement('path', {
        style: Object.assign({ d: `M ${arrowSize},${arrowSize} L -${arrowSize},0 L ${arrowSize},-${arrowSize} L 0,0 Z`, transformOrigin: 'center' }, arrowStyle),
    });
    return arrowMarker;
}
function getPath(points, coordinate) {
    if (!(0, coordinate_1.isPolar)(coordinate))
        return (0, d3_shape_1.line)()
            .x((d) => d[0])
            .y((d) => d[1])(points);
    const center = coordinate.getCenter();
    return (0, d3_shape_1.arc)()({
        startAngle: 0,
        endAngle: Math.PI * 2,
        outerRadius: (0, vector_1.dist)(points[0], center),
        innerRadius: (0, vector_1.dist)(points[1], center),
    });
}
function getTransform(coordinate, transform) {
    if (!(0, coordinate_1.isPolar)(coordinate))
        return transform;
    const [cx, cy] = coordinate.getCenter();
    return `translate(${cx}, ${cy}) ${transform || ''}`;
}
const Line = (options, context) => {
    const { arrow, arrowSize = 4 } = options, style = __rest(options, ["arrow", "arrowSize"]);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor, lineWidth } = defaults, shapeTheme = __rest(defaults, ["color", "lineWidth"]);
        const { color = defaultColor, size = lineWidth } = value;
        const arrowMarker = arrow
            ? getArrowMarker(document, arrowSize, Object.assign({ fill: style.stroke || color, stroke: style.stroke || color }, (0, helper_1.subObject)(style, 'arrow')))
            : null;
        const path = getPath(points, coordinate);
        const transform = getTransform(coordinate, value.transform);
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, shapeTheme)
            .style('d', path)
            .style('stroke', color)
            .style('lineWidth', size)
            .style('transform', transform)
            .style('markerEnd', arrowMarker)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Line = Line;
exports.Line.props = {
    defaultMarker: 'line',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=line.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/selection":1751263815883,"../../utils/vector":1751263815873,"../../utils/helper":1751263815829,"../utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815943, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connector = void 0;
const g_1 = require("@antv/g");
const component_1 = require("@antv/component");
const d3_shape_1 = require("@antv/vendor/d3-shape");
const coordinate_1 = require("../../utils/coordinate");
const helper_1 = require("../../utils/helper");
const selection_1 = require("../../utils/selection");
const utils_1 = require("../utils");
function inferSymbol(x, y, r) {
    return [['M', x, y], ['L', x + 2 * r, y - r], ['L', x + 2 * r, y + r], ['Z']];
}
/**
 * @todo support polar later.
 */
function inferConnectorPath(points) {
    return (0, d3_shape_1.line)()
        .x((d) => d[0])
        .y((d) => d[1])(points);
}
function getPoints(coordinate, points, sourceOffsetY, targetOffsetY, sourceOffsetX, targetOffsetX, length1 = 0) {
    const [[x0, y0], [x1, y1]] = points;
    if ((0, coordinate_1.isTranspose)(coordinate)) {
        const X0 = x0 + sourceOffsetY;
        const X1 = x1 + targetOffsetY;
        const X = X0 + length1;
        const Y0 = y0 + sourceOffsetX;
        const Y1 = y1 + targetOffsetX;
        return [
            [X0, Y0],
            [X, Y0],
            [X, Y1],
            [X1, Y1],
        ];
    }
    const Y0 = y0 - sourceOffsetY;
    const Y1 = y1 - targetOffsetY;
    const Y = Y0 - length1;
    const X0 = x0 - sourceOffsetX;
    const X1 = x1 - targetOffsetX;
    return [
        [X0, Y0],
        [X0, Y],
        [X1, Y],
        [X1, Y1],
    ];
}
const Connector = (options, context) => {
    const { offsetX = 0, sourceOffsetX = offsetX, targetOffsetX = offsetX, offsetY = 0, sourceOffsetY = offsetY, targetOffsetY = offsetY, connectLength1: length1, endMarker = true } = options, style = __rest(options, ["offsetX", "sourceOffsetX", "targetOffsetX", "offsetY", "sourceOffsetY", "targetOffsetY", "connectLength1", "endMarker"]);
    const { coordinate } = context;
    return (points, value, defaults) => {
        const { color: defaultColor, connectLength1 } = defaults, rest = __rest(defaults, ["color", "connectLength1"]);
        const { color, transform } = value;
        const P = getPoints(coordinate, points, sourceOffsetY, targetOffsetY, sourceOffsetX, targetOffsetX, length1 !== null && length1 !== void 0 ? length1 : connectLength1);
        const makerStyle = (0, helper_1.subObject)(Object.assign(Object.assign({}, style), defaults), 'endMarker');
        return (0, selection_1.select)(new g_1.Path())
            .call(utils_1.applyStyle, rest)
            .style('d', inferConnectorPath(P))
            .style('stroke', color || defaultColor)
            .style('transform', transform)
            .style('markerEnd', endMarker
            ? new component_1.Marker({
                className: 'marker',
                style: Object.assign(Object.assign({}, makerStyle), { symbol: inferSymbol }),
            })
            : null)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Connector = Connector;
exports.Connector.props = {
    defaultMarker: 'line',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=connector.js.map
}, function(modId) { var map = {"../../utils/coordinate":1751263815882,"../../utils/helper":1751263815829,"../../utils/selection":1751263815883,"../utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815944, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__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;
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Label = void 0;
const selection_1 = require("../../utils/selection");
const utils_1 = require("../../shape/utils");
const coordinate_1 = require("../../utils/coordinate");
const string_1 = require("../../utils/string");
const advance_1 = require("../text/advance");
const PositionProcessor = __importStar(require("./position"));
function inferPosition(position, coordinate) {
    if (position !== undefined)
        return position;
    if ((0, coordinate_1.isCircular)(coordinate))
        return 'inside';
    if ((0, coordinate_1.isTranspose)(coordinate))
        return 'right';
    return 'top';
}
function getDefaultStyle(points, value, coordinate, theme, options, labels) {
    // For non-series mark, calc position for label based on
    // position and the bounds of shape.
    const { position } = value;
    const { render } = options;
    const p = inferPosition(position, coordinate);
    const labelType = render
        ? 'htmlLabel'
        : p === 'inside'
            ? 'innerLabel'
            : 'label';
    const t = theme[labelType];
    const v = Object.assign({}, t, value);
    const processor = PositionProcessor[(0, string_1.camelCase)(p)];
    if (!processor) {
        throw new Error(`Unknown position: ${p}`);
    }
    return Object.assign(Object.assign({}, t), processor(p, points, v, coordinate, options, labels));
}
/**
 * Render normal label for each mark.
 * @todo Support position option: middle...
 */
const Label = (options, context) => {
    const { coordinate, theme } = context;
    const { render } = options;
    return (points, value, style, labels) => {
        const { text, x, y, transform: specifiedTS = '', transformOrigin, className = '' } = value, overrideStyle = __rest(value, ["text", "x", "y", "transform", "transformOrigin", "className"]);
        const _a = getDefaultStyle(points, value, coordinate, theme, options, labels), { rotate = 0, transform = '' } = _a, defaultStyle = __rest(_a, ["rotate", "transform"]);
        return (0, selection_1.select)(new advance_1.Advance())
            .call(utils_1.applyStyle, defaultStyle)
            .style('text', `${text}`)
            .style('className', `${className} g2-label`)
            .style('innerHTML', render ? render(text, value.datum, value.index) : undefined)
            .style('labelTransform', `${transform} rotate(${+rotate}) ${specifiedTS}`.trim())
            .style('labelTransformOrigin', transformOrigin)
            .style('coordCenter', coordinate.getCenter())
            .call(utils_1.applyStyle, overrideStyle)
            .node();
    };
};
exports.Label = Label;
exports.Label.props = {
    defaultMarker: 'point',
};
//# sourceMappingURL=label.js.map
}, function(modId) { var map = {"../../utils/selection":1751263815883,"../../shape/utils":1751263815885,"../../utils/coordinate":1751263815882,"../../utils/string":1751263815900,"../text/advance":1751263815923,"./position":1751263815945}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815945, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.topRight = exports.topLeft = exports.top = exports.surround = exports.spider = exports.right = exports.outside = exports.left = exports.inside = exports.bottomRight = exports.bottomLeft = exports.bottom = exports.area = void 0;
var area_1 = require("./area");
Object.defineProperty(exports, "area", { enumerable: true, get: function () { return area_1.area; } });
var bottom_1 = require("./bottom");
Object.defineProperty(exports, "bottom", { enumerable: true, get: function () { return bottom_1.bottom; } });
var bottomLeft_1 = require("./bottomLeft");
Object.defineProperty(exports, "bottomLeft", { enumerable: true, get: function () { return bottomLeft_1.bottomLeft; } });
var bottomRight_1 = require("./bottomRight");
Object.defineProperty(exports, "bottomRight", { enumerable: true, get: function () { return bottomRight_1.bottomRight; } });
var inside_1 = require("./inside");
Object.defineProperty(exports, "inside", { enumerable: true, get: function () { return inside_1.inside; } });
var left_1 = require("./left");
Object.defineProperty(exports, "left", { enumerable: true, get: function () { return left_1.left; } });
var outside_1 = require("./outside");
Object.defineProperty(exports, "outside", { enumerable: true, get: function () { return outside_1.outside; } });
var right_1 = require("./right");
Object.defineProperty(exports, "right", { enumerable: true, get: function () { return right_1.right; } });
var spider_1 = require("./spider");
Object.defineProperty(exports, "spider", { enumerable: true, get: function () { return spider_1.spider; } });
var surround_1 = require("./surround");
Object.defineProperty(exports, "surround", { enumerable: true, get: function () { return surround_1.surround; } });
var top_1 = require("./top");
Object.defineProperty(exports, "top", { enumerable: true, get: function () { return top_1.top; } });
var topLeft_1 = require("./topLeft");
Object.defineProperty(exports, "topLeft", { enumerable: true, get: function () { return topLeft_1.topLeft; } });
var topRight_1 = require("./topRight");
Object.defineProperty(exports, "topRight", { enumerable: true, get: function () { return topRight_1.topRight; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./area":1751263815946,"./bottom":1751263815947,"./bottomLeft":1751263815949,"./bottomRight":1751263815950,"./inside":1751263815951,"./left":1751263815952,"./outside":1751263815953,"./right":1751263815954,"./spider":1751263815955,"./surround":1751263815957,"./top":1751263815958,"./topLeft":1751263815959,"./topRight":1751263815960}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815946, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.area = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const vector_1 = require("../../../utils/vector");
/**
 * Only for Area label.
 */
function area(position, points, value, coordinate) {
    const l = points.length / 2;
    const Y1 = points.slice(0, l);
    const Y0 = points.slice(l);
    // Get the maximal space for label.
    let idx = (0, d3_array_1.maxIndex)(Y1, (p, i) => Math.abs(p[1] - Y0[i][1]));
    // Do not show label at first and last.
    idx = Math.max(Math.min(idx, l - 2), 1);
    const mid = (i) => [Y1[i][0], (Y1[i][1] + Y0[i][1]) / 2];
    const point = mid(idx);
    const prev = mid(idx - 1);
    const next = mid(idx + 1);
    // todo: G rotate only support deg.
    const rotate = ((0, vector_1.angle)((0, vector_1.sub)(next, prev)) / Math.PI) * 180;
    return {
        x: point[0],
        y: point[1],
        transform: `rotate(${rotate})`,
        textAlign: 'center',
        textBaseline: 'middle',
    };
}
exports.area = area;
//# sourceMappingURL=area.js.map
}, function(modId) { var map = {"../../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815947, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.bottom = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "bottom", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=bottom.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815948, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultStyle = exports.inferIdentityStyle = exports.inferRotation = exports.pointOfArc = exports.inferRadialStyle = exports.inferNonCircularStyle = void 0;
const utils_1 = require("../../../shape/utils");
const coordinate_1 = require("../../../utils/coordinate");
const helper_1 = require("../../../utils/helper");
const vector_1 = require("../../../utils/vector");
function inferNonCircularStyle(position, points, value, coordinate) {
    const { bounds } = value;
    const [[x0, y0], [x1, y1]] = bounds;
    const w = x1 - x0;
    const h = y1 - y0;
    const xy = (options) => {
        const { x: ox, y: oy } = options;
        const px = (0, helper_1.maybePercentage)(value.x, w);
        const py = (0, helper_1.maybePercentage)(value.y, h);
        return Object.assign(Object.assign({}, options), { x: (px || ox) + x0, y: (py || oy) + y0 });
    };
    // 4 direction.
    if (position === 'left')
        return xy({ x: 0, y: h / 2, textAlign: 'start', textBaseline: 'middle' });
    if (position === 'right')
        return xy({ x: w, y: h / 2, textAlign: 'end', textBaseline: 'middle' });
    if (position === 'top')
        return xy({ x: w / 2, y: 0, textAlign: 'center', textBaseline: 'top' });
    if (position === 'bottom')
        return xy({ x: w / 2, y: h, textAlign: 'center', textBaseline: 'bottom' });
    // 4 corner position.
    if (position === 'top-left')
        return xy({ x: 0, y: 0, textAlign: 'start', textBaseline: 'top' });
    if (position === 'top-right')
        return xy({ x: w, y: 0, textAlign: 'end', textBaseline: 'top' });
    if (position === 'bottom-left')
        return xy({ x: 0, y: h, textAlign: 'start', textBaseline: 'bottom' });
    if (position === 'bottom-right')
        return xy({ x: w, y: h, textAlign: 'end', textBaseline: 'bottom' });
    // default return 'inside'
    return xy({
        x: w / 2,
        y: h / 2,
        textAlign: 'center',
        textBaseline: 'middle',
    });
}
exports.inferNonCircularStyle = inferNonCircularStyle;
function inferRadialStyle(position, points, value, coordinate) {
    const { y, y1, autoRotate, rotateToAlignArc } = value;
    const center = coordinate.getCenter();
    const arcObject = (0, utils_1.getArcObject)(coordinate, points, [y, y1]);
    const { innerRadius, outerRadius, startAngle, endAngle } = arcObject;
    const angle = position === 'inside' ? (startAngle + endAngle) / 2 : endAngle;
    const rotate = inferRotation(angle, autoRotate, rotateToAlignArc);
    const point = (() => {
        const [p0, p1] = points;
        const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
        const [x, y] = position === 'inside' ? pointOfArc(center, angle, radius) : (0, vector_1.mid)(p0, p1);
        return { x, y };
    })();
    return Object.assign(Object.assign({}, point), { textAlign: position === 'inside' ? 'center' : 'start', textBaseline: 'middle', rotate });
}
exports.inferRadialStyle = inferRadialStyle;
function pointOfArc(center, angle, radius) {
    return [
        center[0] + Math.sin(angle) * radius,
        center[1] - Math.cos(angle) * radius,
    ];
}
exports.pointOfArc = pointOfArc;
function inferRotation(angle, autoRotate, rotateToAlignArc) {
    if (!autoRotate)
        return 0;
    const append = rotateToAlignArc ? 0 : Math.sin(angle) < 0 ? 90 : -90;
    return (angle / Math.PI) * 180 + append;
}
exports.inferRotation = inferRotation;
function inferInnerCircularStyle(position, points, value, coordinate) {
    const { y, y1, autoRotate, rotateToAlignArc, radius: radiusRatio = 0.5, offset = 0, } = value;
    const arcObject = (0, utils_1.getArcObject)(coordinate, points, [y, y1]);
    const { startAngle, endAngle } = arcObject;
    const center = coordinate.getCenter();
    const angle = (startAngle + endAngle) / 2;
    const rotate = inferRotation(angle, autoRotate, rotateToAlignArc);
    const textStyle = { textAlign: 'center', textBaseline: 'middle', rotate };
    const { innerRadius, outerRadius } = arcObject;
    const r0 = innerRadius + (outerRadius - innerRadius) * radiusRatio;
    const r1 = r0 + offset;
    const [x0, y0] = pointOfArc(center, angle, r1);
    return Object.assign({ x: x0, y: y0 }, textStyle);
}
// Set to null will not be set with default value as below.
// const { x = 0 } = options;
function maybeUndefined(d) {
    return d === undefined ? null : d;
}
function inferIdentityStyle(position, points, value, coordinate) {
    const { bounds } = value;
    const [p] = bounds;
    return {
        x: maybeUndefined(p[0]),
        y: maybeUndefined(p[1]),
    };
}
exports.inferIdentityStyle = inferIdentityStyle;
function getDefaultStyle(position, points, value, coordinate) {
    const { bounds } = value;
    // When bounds.length = 1
    // For series mark, such as line and area.
    // The bounds for text is defined with only one point.
    // Use this point as the label position.
    if (bounds.length === 1) {
        return inferIdentityStyle(position, points, value, coordinate);
    }
    const inferDefaultStyle = (0, coordinate_1.isRadial)(coordinate)
        ? inferRadialStyle
        : (0, coordinate_1.isCircular)(coordinate)
            ? inferInnerCircularStyle
            : inferNonCircularStyle;
    return inferDefaultStyle(position, points, value, coordinate);
}
exports.getDefaultStyle = getDefaultStyle;
//# sourceMappingURL=default.js.map
}, function(modId) { var map = {"../../../shape/utils":1751263815885,"../../../utils/coordinate":1751263815882,"../../../utils/helper":1751263815829,"../../../utils/vector":1751263815873}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815949, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.bottomLeft = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "bottomLeft", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=bottomLeft.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815950, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.bottomRight = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "bottomRight", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=bottomRight.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815951, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.inside = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "inside", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=inside.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815952, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.left = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "left", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=left.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815953, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.outside = exports.inferOutsideCircularStyle = exports.angleOf = exports.radiusOf = exports.linePoints = void 0;
const utils_1 = require("../../../shape/utils");
const coordinate_1 = require("../../../utils/coordinate");
const default_1 = require("./default");
function linePoints(center, angle, radius, radius1, offsetX) {
    const [x0, y0] = (0, default_1.pointOfArc)(center, angle, radius);
    const [x1, y1] = (0, default_1.pointOfArc)(center, angle, radius1);
    const sign = Math.sin(angle) > 0 ? 1 : -1;
    return [
        [x0, y0],
        [x1, y1],
        [x1 + sign * offsetX, y1],
    ];
}
exports.linePoints = linePoints;
function radiusOf(points, value, coordinate) {
    const arcObject = (0, utils_1.getArcObject)(coordinate, points, [value.y, value.y1]);
    const { innerRadius, outerRadius } = arcObject;
    return innerRadius + (outerRadius - innerRadius);
}
exports.radiusOf = radiusOf;
function angleOf(points, value, coordinate) {
    const arcObject = (0, utils_1.getArcObject)(coordinate, points, [value.y, value.y1]);
    const { startAngle, endAngle } = arcObject;
    return (startAngle + endAngle) / 2;
}
exports.angleOf = angleOf;
function inferOutsideCircularStyle(position, points, value, coordinate) {
    const { autoRotate, rotateToAlignArc, offset = 0, connector = true, connectorLength = offset, connectorLength2 = 0, connectorDistance = 0, } = value;
    const center = coordinate.getCenter();
    const angle = angleOf(points, value, coordinate);
    const sign = Math.sin(angle) > 0 ? 1 : -1;
    const rotate = (0, default_1.inferRotation)(angle, autoRotate, rotateToAlignArc);
    const textStyle = {
        textAlign: sign > 0 || (0, coordinate_1.isRadial)(coordinate) ? 'start' : 'end',
        textBaseline: 'middle',
        rotate,
    };
    const radius = radiusOf(points, value, coordinate);
    const radius1 = radius + (connector ? connectorLength : offset);
    const [[x0, y0], [x1, y1], [x2, y2]] = linePoints(center, angle, radius, radius1, connector ? connectorLength2 : 0);
    const dx = connector ? +connectorDistance * sign : 0;
    const x = x2 + dx;
    const y = y2;
    const connectorStyle = {
        connector,
        connectorPoints: [
            [x1 - x, y1 - y],
            [x2 - x, y2 - y],
        ],
    };
    return Object.assign(Object.assign({ x0,
        y0, x: x2 + dx, y: y2 }, textStyle), connectorStyle);
}
exports.inferOutsideCircularStyle = inferOutsideCircularStyle;
function outside(position, points, value, coordinate) {
    const { bounds } = value;
    // When bounds.length = 1
    // For series mark, such as line and area.
    // The bounds for text is defined with only one point.
    // Use this point as the label position.
    if (bounds.length === 1) {
        return (0, default_1.inferIdentityStyle)(position, points, value, coordinate);
    }
    const inferDefaultStyle = (0, coordinate_1.isRadial)(coordinate)
        ? default_1.inferRadialStyle
        : (0, coordinate_1.isCircular)(coordinate)
            ? inferOutsideCircularStyle
            : default_1.inferNonCircularStyle;
    return inferDefaultStyle(position, points, value, coordinate);
}
exports.outside = outside;
//# sourceMappingURL=outside.js.map
}, function(modId) { var map = {"../../../shape/utils":1751263815885,"../../../utils/coordinate":1751263815882,"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815954, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.right = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "right", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=right.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815955, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.spider = void 0;
const coordinate_1 = require("../../../utils/coordinate");
const outside_1 = require("./outside");
const utils_1 = require("./utils");
const styleByPoints = new WeakMap();
function compute(points, value, coordinate) {
    const { connectorLength, connectorLength2, connectorDistance } = value;
    const style = __rest((0, outside_1.inferOutsideCircularStyle)('outside', points, value, coordinate), []);
    const center = coordinate.getCenter();
    const radius = (0, outside_1.radiusOf)(points, value, coordinate);
    const angle = (0, outside_1.angleOf)(points, value, coordinate);
    const radius1 = radius + connectorLength + connectorLength2;
    const sign = Math.sin(angle) > 0 ? 1 : -1;
    const newX = center[0] + (radius1 + +connectorDistance) * sign;
    const { x: originX } = style;
    const dx = newX - originX;
    style.x += dx;
    style.connectorPoints[0][0] -= dx;
    return style;
}
/**
 * Spider label transform only suitable for the labels in polar coordinate,
 * labels should distinguish coordinate type.
 */
function spider(position, points, value, coordinate, options, labels) {
    if (!(0, coordinate_1.isCircular)(coordinate))
        return {};
    if (styleByPoints.has(points))
        return styleByPoints.get(points);
    const computed = labels.map((points) => compute(points, value, coordinate));
    const { width, height } = coordinate.getOptions();
    const left = computed.filter((d) => d.x < width / 2);
    const right = computed.filter((d) => d.x >= width / 2);
    const extendedOptions = Object.assign(Object.assign({}, options), { height });
    (0, utils_1.hideAndDodgeY)(left, extendedOptions);
    (0, utils_1.hideAndDodgeY)(right, extendedOptions);
    computed.forEach((style, i) => styleByPoints.set(labels[i], style));
    return styleByPoints.get(points);
}
exports.spider = spider;
//# sourceMappingURL=spider.js.map
}, function(modId) { var map = {"../../../utils/coordinate":1751263815882,"./outside":1751263815953,"./utils":1751263815956}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815956, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.hideAndDodgeY = exports.dodgeY = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
// Optimize antiCollision from: https://github.com/antvis/G2/blob/master/src/geometry/label/layout/pie/util.ts
function dodgeY(labels, options = {}) {
    const { labelHeight = 14, height } = options;
    // Sort labels by y and init boxes (one box for each label)
    const sortedLabels = (0, d3_array_1.sort)(labels, (d) => d.y);
    const n = sortedLabels.length;
    const boxes = new Array(n);
    for (let i = 0; i < n; i++) {
        const label = sortedLabels[i];
        const { y } = label;
        boxes[i] = { y, y1: y + labelHeight, labels: [y] };
    }
    // Merge boxes until no overlapping boxes or only one box left.
    // All the boxes should start higher than 0, but maybe higher than height.
    let overlap = true;
    while (overlap) {
        overlap = false;
        // Scan backward because boxes maybe deleted.
        for (let i = boxes.length - 1; i > 0; i--) {
            const box = boxes[i];
            const preBox = boxes[i - 1];
            if (preBox.y1 > box.y) {
                overlap = true;
                preBox.labels.push(...box.labels);
                boxes.splice(i, 1);
                // Compute new y1 to contain the current box.
                preBox.y1 += box.y1 - box.y;
                // Make sure the new box is in the range of [0, height].
                const newHeight = preBox.y1 - preBox.y;
                preBox.y1 = Math.max(Math.min(preBox.y1, height), newHeight);
                preBox.y = preBox.y1 - newHeight;
            }
        }
    }
    let i = 0;
    for (const box of boxes) {
        const { y, labels } = box;
        let prevY = y - labelHeight;
        for (const curY of labels) {
            const label = sortedLabels[i++];
            const expectedY = prevY + labelHeight;
            const dy = expectedY - curY;
            label.connectorPoints[0][1] -= dy;
            label.y = prevY + labelHeight;
            prevY += labelHeight;
        }
    }
}
exports.dodgeY = dodgeY;
function hideAndDodgeY(unsorted, options) {
    const labels = (0, d3_array_1.sort)(unsorted, (d) => d.y);
    const { height, labelHeight = 14 } = options;
    const maxCount = Math.ceil(height / labelHeight);
    if (labels.length <= maxCount)
        return dodgeY(labels, options);
    const filtered = [];
    for (let i = 0; i < labels.length; i++) {
        // Hide labels out of range.
        if (i < labels.length - maxCount) {
            labels[i].opacity = 0;
            labels[i].connector = false;
        }
        else
            filtered.push(labels[i]);
    }
    dodgeY(filtered, options);
}
exports.hideAndDodgeY = hideAndDodgeY;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815957, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.surround = void 0;
const coordinate_1 = require("../../../utils/coordinate");
const vector_1 = require("../../../utils/vector");
const default_1 = require("./default");
const outside_1 = require("./outside");
/**
 * Surround label transform is used to make labels surround circular.
 */
function surround(position, points, value, coordinate) {
    if (!(0, coordinate_1.isCircular)(coordinate))
        return {};
    const { connectorLength, connectorLength2, connectorDistance } = value;
    const style = __rest((0, outside_1.inferOutsideCircularStyle)('outside', points, value, coordinate), []);
    const { x0, y0 } = style;
    const center = coordinate.getCenter();
    const radius = (0, coordinate_1.getRadius)(coordinate);
    const radius1 = radius + connectorLength;
    const angle = (0, vector_1.angleWithQuadrant)([x0 - center[0], y0 - center[1]]);
    const sign = Math.sin(angle) > 0 ? 1 : -1;
    const [newX, newY] = (0, default_1.pointOfArc)(center, angle, radius1);
    style.x = newX + (connectorLength2 + connectorDistance) * sign;
    style.y = newY;
    return style;
}
exports.surround = surround;
//# sourceMappingURL=surround.js.map
}, function(modId) { var map = {"../../../utils/coordinate":1751263815882,"../../../utils/vector":1751263815873,"./default":1751263815948,"./outside":1751263815953}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815958, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.top = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "top", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=top.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815959, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.topLeft = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "topLeft", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=topLeft.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815960, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.topRight = void 0;
var default_1 = require("./default");
Object.defineProperty(exports, "topRight", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
//# sourceMappingURL=topRight.js.map
}, function(modId) { var map = {"./default":1751263815948}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815961, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0;
const color_1 = require("./color");
/**
 * A filled path.
 */
const Path = (options, context) => {
    return (0, color_1.Color)(Object.assign({ colorAttribute: 'fill' }, options), context);
};
exports.Path = Path;
exports.Path.props = {
    defaultMarker: 'hvh',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=path.js.map
}, function(modId) { var map = {"./color":1751263815962}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815962, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Color = void 0;
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
/**
 * Draw a filled or hollow path.
 */
const Color = (options, context) => {
    const { arrow, colorAttribute } = options, style = __rest(options, ["arrow", "colorAttribute"]);
    const { coordinate, document } = context;
    return (points, value, defaults) => {
        const { color: defaultColor, stroke } = defaults, rest = __rest(defaults, ["color", "stroke"]);
        const { d, color = defaultColor } = value;
        const [width, height] = coordinate.getSize();
        return ((0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            // Path support string, function with parameter { width, height }.
            .style('d', typeof d === 'function' ? d({ width, height }) : d)
            .style(colorAttribute, color)
            .call(utils_1.applyStyle, style)
            .node());
    };
};
exports.Color = Color;
exports.Color.props = {
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=color.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815963, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Hollow = void 0;
const color_1 = require("./color");
/**
 * A hollow path.
 */
const Hollow = (options, context) => {
    return (0, color_1.Color)(Object.assign({ fill: 'none', colorAttribute: 'stroke' }, options), context);
};
exports.Hollow = Hollow;
exports.Hollow.props = {
    defaultMarker: 'hvh',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=hollow.js.map
}, function(modId) { var map = {"./color":1751263815962}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815964, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Density = void 0;
const d3_path_1 = require("@antv/vendor/d3-path");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
/**
 * Draw density shape.
 */
const Density = (options, context) => {
    const { document } = context;
    return (points, value, defaults) => {
        const { transform } = value;
        const { color: defaultColor } = defaults, rest = __rest(defaults, ["color"]);
        const { color = defaultColor } = value;
        const [first, ...p] = points;
        // todo smooth, hollow
        const path = (0, d3_path_1.path)();
        path.moveTo(...first);
        p.forEach(([x, y]) => {
            path.lineTo(x, y);
        });
        path.closePath();
        return (0, selection_1.select)(document.createElement('path', {}))
            .call(utils_1.applyStyle, rest)
            .style('d', path.toString())
            .style('stroke', color || defaultColor) // Always has stroke color.
            .style('fill', color || defaultColor)
            .style('fillOpacity', 0.4)
            .style('transform', transform)
            .call(utils_1.applyStyle, options)
            .node();
    };
};
exports.Density = Density;
exports.Density.props = {
    defaultMarker: 'square',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=density.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815965, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Heatmap = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const utils_1 = require("../utils");
const selection_1 = require("../../utils/selection");
const renderer_1 = require("./renderer");
function deleteKey(obj, fn) {
    return Object.keys(obj).reduce((r, k) => {
        const v = obj[k];
        if (!fn(v, k))
            r[k] = v;
        return r;
    }, {});
}
const Heatmap = (options, context) => {
    const { gradient, opacity, maxOpacity, minOpacity, blur, useGradientOpacity } = options, style = __rest(options, ["gradient", "opacity", "maxOpacity", "minOpacity", "blur", "useGradientOpacity"]);
    const { coordinate, createCanvas, document } = context;
    return (points, value, defaults) => {
        const { transform } = value;
        const [width, height] = coordinate.getSize();
        const data = points.map((p) => ({
            x: p[0],
            y: p[1],
            value: p[2],
            radius: p[3],
        }));
        const min = (0, d3_array_1.min)(points, (p) => p[2]);
        const max = (0, d3_array_1.max)(points, (p) => p[2]);
        const options = {
            gradient,
            opacity,
            minOpacity,
            maxOpacity,
            blur,
            useGradientOpacity,
        };
        const ctx = width && height
            ? (0, renderer_1.HeatmapRenderer)(width, height, min, max, data, deleteKey(options, (v) => v === undefined), createCanvas)
            : { canvas: null };
        return (0, selection_1.select)(document.createElement('image', {}))
            .call(utils_1.applyStyle, defaults)
            .style('x', 0)
            .style('y', 0)
            .style('width', width)
            .style('height', height)
            .style('src', ctx.canvas.toDataURL())
            .style('transform', transform)
            .call(utils_1.applyStyle, style)
            .node();
    };
};
exports.Heatmap = Heatmap;
exports.Heatmap.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=heatmap.js.map
}, function(modId) { var map = {"../utils":1751263815885,"../../utils/selection":1751263815883,"./renderer":1751263815966}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815966, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.HeatmapRenderer = void 0;
const lru_1 = require("../../../utils/lru");
const gradient_1 = require("./gradient");
function newCanvas(createCanvas, width, height) {
    const c = createCanvas ? createCanvas() : document.createElement('canvas');
    c.width = width;
    c.height = height;
    return c;
}
/**
 * Get a point with template.
 * @param radius
 * @param blurFactor
 * @returns
 */
const getPointTemplate = (0, lru_1.lru)((radius, blurFactor, createCanvas) => {
    const tplCanvas = newCanvas(createCanvas, radius * 2, radius * 2);
    const tplCtx = tplCanvas.getContext('2d');
    const x = radius;
    const y = radius;
    if (blurFactor === 1) {
        tplCtx.beginPath();
        tplCtx.arc(x, y, radius, 0, 2 * Math.PI, false);
        tplCtx.fillStyle = 'rgba(0,0,0,1)';
        tplCtx.fill();
    }
    else {
        const gradient = tplCtx.createRadialGradient(x, y, radius * blurFactor, x, y, radius);
        gradient.addColorStop(0, 'rgba(0,0,0,1)');
        gradient.addColorStop(1, 'rgba(0,0,0,0)');
        tplCtx.fillStyle = gradient;
        tplCtx.fillRect(0, 0, 2 * radius, 2 * radius);
    }
    return tplCanvas;
}, (radius) => `${radius}`);
/**
 * Get a color palette with len = 256 base on gradient.
 * @param gradientConfig
 * @returns
 */
function getColorPalette(gradientConfig, createCanvas) {
    const paletteCanvas = newCanvas(createCanvas, 256, 1);
    const paletteCtx = paletteCanvas.getContext('2d');
    const gradient = paletteCtx.createLinearGradient(0, 0, 256, 1);
    (0, gradient_1.parseGradient)(gradientConfig).forEach(([r, c]) => {
        gradient.addColorStop(r, c);
    });
    paletteCtx.fillStyle = gradient;
    paletteCtx.fillRect(0, 0, 256, 1);
    return paletteCtx.getImageData(0, 0, 256, 1).data;
}
/**
 * Draw all circle with alpha.
 */
function drawAlpha(shadowCtx, min, max, data, options, createCanvas) {
    const { blur } = options;
    let len = data.length;
    while (len--) {
        const { x, y, value: v, radius } = data[len];
        // Ff value is bigger than max, use max as value.
        const value = Math.min(v, max);
        const rectX = x - radius;
        const rectY = y - radius;
        const tpl = getPointTemplate(radius, 1 - blur, createCanvas);
        // Value from minimum / value range, => [0, 1].
        const templateAlpha = (value - min) / (max - min);
        // Small values are not visible because globalAlpha < .001 cannot be read from imageData.
        shadowCtx.globalAlpha = Math.max(templateAlpha, 0.001);
        shadowCtx.drawImage(tpl, rectX, rectY);
    }
    return shadowCtx;
}
function colorize(shadowCtx, maxWidth, maxHeight, palette, options) {
    const { minOpacity, opacity, maxOpacity, useGradientOpacity } = options;
    const x = 0;
    const y = 0;
    const width = maxWidth;
    const height = maxHeight;
    const img = shadowCtx.getImageData(x, y, width, height);
    const imgData = img.data;
    const len = imgData.length;
    for (let i = 3; i < len; i += 4) {
        const alpha = imgData[i];
        const offset = alpha * 4;
        if (!offset) {
            continue;
        }
        // Should be in [min, max], min >= 0.
        const finalAlpha = opacity || Math.max(0, Math.min(maxOpacity, Math.max(minOpacity, alpha)));
        // Update rgba.
        imgData[i - 3] = palette[offset];
        imgData[i - 2] = palette[offset + 1];
        imgData[i - 1] = palette[offset + 2];
        imgData[i] = useGradientOpacity ? palette[offset + 3] : finalAlpha;
    }
    return img;
}
/**
 * Render a heatmap with canvas.
 * See [heatmap.js](https://github.com/pa7/heatmap.js/blob/master/src/renderer/canvas2d.js).
 */
function HeatmapRenderer(width, height, min, max, data, options, createCanvas) {
    const opts = Object.assign({ blur: 0.85, minOpacity: 0, opacity: 0.6, maxOpacity: 1, gradient: [
            [0.25, 'rgb(0,0,255)'],
            [0.55, 'rgb(0,255,0)'],
            [0.85, 'yellow'],
            [1.0, 'rgb(255,0,0)'],
        ] }, options);
    opts.minOpacity *= 255;
    opts.opacity *= 255;
    opts.maxOpacity *= 255;
    const shadowCanvas = newCanvas(createCanvas, width, height);
    const shadowCtx = shadowCanvas.getContext('2d');
    const palette = getColorPalette(opts.gradient, createCanvas);
    shadowCtx.clearRect(0, 0, width, height);
    drawAlpha(shadowCtx, min, max, data, opts, createCanvas);
    const img = colorize(shadowCtx, width, height, palette, opts);
    const canvas = newCanvas(createCanvas, width, height);
    const ctx = canvas.getContext('2d');
    ctx.putImageData(img, 0, 0);
    return ctx;
}
exports.HeatmapRenderer = HeatmapRenderer;
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"../../../utils/lru":1751263815967,"./gradient":1751263815968}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815967, function(require, module, exports) {

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lru = void 0;
const flru_1 = __importDefault(require("flru"));
const cache = (0, flru_1.default)(3);
/**
 * A decorator to return new function with LRU cache.
 */
function lru(fn, keyFn = (...args) => `${args[0]}`, maxSize = 16) {
    const cache = (0, flru_1.default)(maxSize);
    return (...args) => {
        const key = keyFn(...args);
        let v = cache.get(key);
        if (cache.has(key))
            return cache.get(key);
        v = fn(...args);
        cache.set(key, v);
        return v;
    };
}
exports.lru = lru;
//# sourceMappingURL=lru.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815968, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseGradient = void 0;
/**
 * Parse heatmap gradient.
 */
function parseGradient(gradient) {
    if (typeof gradient === 'string') {
        return gradient.split(' ').map((stop) => {
            const [r, c] = stop.split(':');
            return [+r, c];
        });
    }
    return gradient;
}
exports.parseGradient = parseGradient;
//# sourceMappingURL=gradient.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815969, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Shape = void 0;
/**
 * Draw a custom shape.
 */
const Shape = (options, context) => {
    const { render } = options, rest = __rest(options, ["render"]);
    return (points) => {
        const [[x0, y0]] = points;
        return render(Object.assign(Object.assign({}, rest), { x: x0, y: y0 }), context);
    };
};
exports.Shape = Shape;
exports.Shape.props = {
    defaultMarker: 'point',
    defaultEnterAnimation: 'fadeIn',
    defaultUpdateAnimation: 'morphing',
    defaultExitAnimation: 'fadeOut',
};
//# sourceMappingURL=shape.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815970, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Liquid = void 0;
const util_1 = require("@antv/util");
const wave_1 = require("./wave");
const shapes_1 = require("./shapes");
const getLiquidShape = (shape = 'circle') => shapes_1.LiquidShapesPath[shape] || shapes_1.LiquidShapesPath.circle;
const Liquid = (options, context) => {
    if (!context)
        return;
    const { coordinate } = context;
    const { liquidOptions, styleOptions } = options;
    const { liquidShape, percent } = liquidOptions;
    const { background: backgroundStyle, outline = {}, wave = {} } = styleOptions, attr = __rest(styleOptions, ["background", "outline", "wave"]);
    const { border = 2, distance = 0 } = outline, outlineStyle = __rest(outline, ["border", "distance"]);
    const { length = 192, count = 3 } = wave;
    return (points, cfg, defaultAttr) => {
        const { document } = context.canvas;
        const { color, fillOpacity } = defaultAttr;
        const attrs = Object.assign(Object.assign({ fill: color }, defaultAttr), attr);
        const g = document.createElement('g', {});
        // Center x/y.
        const [centerX, centerY] = coordinate.getCenter();
        // [width,height].
        const size = coordinate.getSize();
        const radius = Math.min(...size) / 2;
        // 1、Gets the path of the overall shape.
        const buildPath = (0, util_1.isFunction)(liquidShape)
            ? liquidShape
            : getLiquidShape(liquidShape);
        const shapePath = buildPath(centerX, centerY, radius, ...size);
        // 2、Background create.
        if (Object.keys(backgroundStyle).length) {
            const backgroundShape = document.createElement('path', {
                style: Object.assign({ d: shapePath, fill: '#fff' }, backgroundStyle),
            });
            g.appendChild(backgroundShape);
        }
        // Percent > 0 Mapping water waves.
        if (percent > 0) {
            // 3. Clip create.
            const clipShape = document.createElement('path', {
                style: {
                    d: shapePath,
                },
            });
            g.appendChild(clipShape);
            g.style.clipPath = clipShape;
            // 4. Wave create.
            (0, wave_1.addWave)(centerX, centerY, 1 - percent, count, attrs, g, clipShape.getBBox().y, radius * 2, length, true, document);
        }
        // 5. Draw distance.
        const distanceShape = document.createElement('path', {
            style: {
                d: shapePath,
                fill: 'transparent',
                lineWidth: border + 2 * distance,
                stroke: '#fff',
            },
        });
        // 6. Draw border.
        const borderShape = document.createElement('path', {
            style: Object.assign(Object.assign(Object.assign({ d: shapePath, stroke: color, strokeOpacity: fillOpacity, lineWidth: border }, attrs), outlineStyle), { fill: 'transparent' }),
        });
        g.appendChild(distanceShape);
        g.appendChild(borderShape);
        return g;
    };
};
exports.Liquid = Liquid;
exports.Liquid.props = {};
//# sourceMappingURL=liquid.js.map
}, function(modId) { var map = {"./wave":1751263815971,"./shapes":1751263815972}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815971, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.addWave = void 0;
const DURATION = 5000;
/**
 * A function of linear mapping.
 * @param min
 * @param max
 * @param factor
 */
function lerp(min, max, factor) {
    return min + (max - min) * factor;
}
/**
 * Using Bessel curve to simulate sine wave.
 * 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 x          x position of the left-most point (a).
 * @param stage      0-3, stating which part of the wave it is.
 * @param waveLength wave length of the sine wave.
 * @param amplitude  wave amplitude.
 * @return Sinusoidal segment curve.
 */
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],
    ];
}
/**
 * Get wave path.
 * @param radius
 * @param waterLevel      water level
 * @param waveLength      wave length
 * @param phase
 * @param amplitude
 * @param cx              center x
 * @param cy              center y
 * @return path           path
 */
function getWaterWavePath(radius, waterLevel, waveLength, phase, amplitude, cx, cy) {
    const curves = Math.ceil(((2 * radius) / waveLength) * 4) * 4;
    const path = [];
    let _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;
    const 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.
     * |      |
     * +------+
     */
    let waveRight = 0;
    for (let c = 0; c < curves; ++c) {
        const stage = c % 4;
        const 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(['Z']);
    return path;
}
/**
 * Add wave.
 * @param x           center x
 * @param y           center y
 * @param level       wave level 0～1
 * @param waveCount   wave count
 * @param waveAttrs   style
 * @param group       g
 * @param minY        Minimum height
 * @param radius      radius
 * @param waveLength  wave length
 * @param animation  animation config
 * @param document
 */
function addWave(x, y, level, waveCount, waveAttrs, group, minY, radius, waveLength, animation, document) {
    // Box property Color width height.
    const { fill, fillOpacity, opacity } = waveAttrs;
    // Number of cyclic waveCount.
    for (let idx = 0; idx < waveCount; idx++) {
        const factor = waveCount <= 1 ? 1 : idx / (waveCount - 1);
        const path = getWaterWavePath(radius, minY + radius * level, waveLength, 0, 
        // Amplitude height.
        radius / 40, x, y);
        // Create wave path.
        const wave = document.createElement('path', {
            style: {
                d: path,
                fill,
                opacity: lerp(0.2, 0.9, factor) * Number(opacity || fillOpacity),
            },
        });
        group.appendChild(wave);
        try {
            if (animation === false)
                return;
            const keyframes = [
                {
                    transform: 'translate(0, 0)',
                },
                {
                    transform: `translate(${waveLength * 2}, 0)`,
                },
            ];
            wave.animate(keyframes, {
                duration: lerp(0.5 * DURATION, DURATION, factor) * 2,
                iterations: Infinity,
            });
        }
        catch (e) {
            console.warn('off-screen group animate error!');
        }
    }
}
exports.addWave = addWave;
//# sourceMappingURL=wave.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815972, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LiquidShapesPath = void 0;
/**
 * @param x center x
 * @param y center y
 * @param radius
 */
function circle(x, y, r) {
    return `
      M ${x} ${y - r} 
      a ${r} ${r} 0 1 0 0 ${r * 2}
      a ${r} ${r} 0 1 0 0 ${-r * 2}
      Z
    `;
}
/**
 * @param x center x
 * @param y center y
 * @param radius
 */
function rect(x, y, r) {
    const GOLDEN_SECTION_RATIO = 0.618;
    const w = r * GOLDEN_SECTION_RATIO;
    return `
      M ${x - w} ${y - r}
      L ${x + w} ${y - r}
      L ${x + w} ${y + r}
      L ${x - w} ${y + r}
      Z
    `;
}
/**
 * @param x center x
 * @param y center y
 * @param radius
 */
function diamond(x, y, r) {
    return `
      M ${x} ${y - r}
      L ${x + r} ${y}
      L ${x} ${y + r}
      L ${x - r} ${y}
      Z
    `;
}
/**
 * @param x center x
 * @param y center y
 * @param radius
 */
function triangle(x, y, r) {
    return `
      M ${x} ${y - r}
      L ${x + r} ${y + r}
      L ${x - r} ${y + r}
      Z
    `;
}
/**
 * @param x center x
 * @param y center y
 * @param radius
 */
function pin(x, y, radius) {
    const w = (radius * 4) / 3;
    const h = Math.max(w, radius * 2);
    const r = w / 2;
    // Attrs of the upper circle.
    const cx = x;
    const cy = r + y - h / 2;
    const theta = Math.asin(r / ((h - r) * 0.85));
    const dy = Math.sin(theta) * r;
    const dx = Math.cos(theta) * r;
    // The start point of the path.
    const x0 = cx - dx;
    const y0 = cy + dy;
    // Control point.
    const cpX = x;
    const cpY = cy + r / Math.sin(theta);
    return `
      M ${x0} ${y0}
      A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}
      Q ${cpX} ${cpY} ${x} ${y + h / 2}
      Q ${cpX} ${cpY} ${x0} ${y0}
      Z 
    `;
}
exports.LiquidShapesPath = {
    pin,
    rect,
    circle,
    diamond,
    triangle,
};
//# sourceMappingURL=shapes.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815973, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Round = void 0;
const util_1 = require("@antv/util");
// Get point1 point2 radius.
const getR = (point1, point2) => {
    return (Math.sqrt(Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2)) / 2);
};
// Gauge round.
const Round = (options, context) => {
    if (!context)
        return;
    const { coordinate } = context;
    if (!(coordinate === null || coordinate === void 0 ? void 0 : coordinate.getCenter))
        return;
    // Get coordinate center point.
    const center = coordinate.getCenter();
    return (points, cfg, defaultCfg) => {
        const { document } = context.canvas;
        const { color, index } = cfg;
        const g = document.createElement('g', {});
        const minR = getR(points[0], points[1]);
        const maxR = getR(points[0], center) * 2;
        /**
         * MinR small circle radius,  maxR big circle radius.
         * Draw four arcs.
         * Style lineWidth and stroke for the time being inset.
         */
        const roundPath = document.createElement('path', {
            style: Object.assign(Object.assign(Object.assign({ d: [
                    ['M', ...points[0]],
                    ['A', minR, minR, 0, 1, 0, ...points[1]],
                    ['A', maxR + minR * 2, maxR + minR * 2, 0, 0, 0, ...points[2]],
                    ['A', minR, minR, 0, 1, index === 0 ? 0 : 1, ...points[3]],
                    ['A', maxR, maxR, 0, 0, 1, ...points[0]],
                    ['Z'],
                ] }, defaultCfg), (0, util_1.omit)(options, ['shape', 'last', 'first'])), { fill: color || defaultCfg.color }),
        });
        g.appendChild(roundPath);
        return g;
    };
};
exports.Round = Round;
//# sourceMappingURL=round.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815974, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Rect = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    rect: shape_1.RectShape,
    hollow: shape_1.RectHollow,
};
const Rect = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, x1: X1, y: Y, y1: Y1 } = value;
        const P = Array.from(index, (i) => {
            const p1 = [+X[i], +Y[i]];
            const p2 = [+X1[i], +Y[i]];
            const p3 = [+X1[i], +Y1[i]];
            const p4 = [+X[i], +Y1[i]];
            return [p1, p2, p3, p4].map((d) => coordinate.map(d));
        });
        return [index, P];
    };
};
exports.Rect = Rect;
exports.Rect.props = {
    defaultShape: 'rect',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeZeroY1 }],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
    interaction: {
        shareTooltip: true,
    },
};
//# sourceMappingURL=rect.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815975, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Line = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const coordinate_1 = require("../utils/coordinate");
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    line: shape_1.LineShape,
    smooth: shape_1.LineSmooth,
    hv: shape_1.LineHV,
    vh: shape_1.LineVH,
    hvh: shape_1.LineHVH,
    trail: shape_1.LineTrail,
};
const line = (index, scale, value, coordinate) => {
    var _a, _b;
    const { series: S, x: X, y: Y } = value;
    const { x, y } = scale;
    // Because x and y channel is not strictly required in Line.props,
    // it should throw error with empty x or y channels.
    if (X === undefined || Y === undefined) {
        throw new Error('Missing encode for x or y channel.');
    }
    // Group data into series.
    // There is only one series without specified series encode.
    const series = S ? Array.from((0, d3_array_1.group)(index, (i) => S[i]).values()) : [index];
    const I = series.map((group) => group[0]).filter((i) => i !== undefined);
    // A group of data corresponds to one line.
    const xoffset = (((_a = x === null || x === void 0 ? void 0 : x.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(x)) || 0) / 2;
    const yoffset = (((_b = y === null || y === void 0 ? void 0 : y.getBandWidth) === null || _b === void 0 ? void 0 : _b.call(y)) || 0) / 2;
    const P = Array.from(series, (I) => {
        return I.map((i) => coordinate.map([+X[i] + xoffset, +Y[i] + yoffset]));
    });
    return [I, P, series];
};
const parallel = (index, scale, value, coordinate) => {
    // Extract all value for position[number] channels.
    const PV = Object.entries(value)
        .filter(([key]) => key.startsWith('position'))
        .map(([, value]) => value);
    // Because position channel is not strictly required in Line.props,
    // it should throw error with empty position values.
    if (PV.length === 0) {
        throw new Error('Missing encode for position channel.');
    }
    // Close the loop for radar(= parallel + polar) coordinate.
    if ((0, coordinate_1.isPolar)(coordinate))
        PV.push(PV[0]);
    // One data corresponds to one line.
    const P = Array.from(index, (i) => {
        // Transform high dimension vector to a list of two-dimension vectors.
        // [a, b, c] -> [d, e, f, g, h, i]
        const vector = PV.map((pv) => +pv[i]);
        const vectors = coordinate.map(vector);
        // Two-dimension vectors are stored in a flat array, so extract them.
        // [d, e, f, g, h, i] -> [d, e], [f, g], [h, i]
        const points = [];
        for (let i = 0; i < vectors.length; i += 2) {
            points.push([vectors[i], vectors[i + 1]]);
        }
        return points;
    });
    return [index, P];
};
/**
 * Convert value for each channel to line shapes.
 */
const Line = () => {
    return (index, scale, value, coordinate) => {
        const mark = (0, coordinate_1.isParallel)(coordinate) ? parallel : line;
        return mark(index, scale, value, coordinate);
    };
};
exports.Line = Line;
exports.Line.props = {
    defaultShape: 'line',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x' },
        { name: 'y' },
        { name: 'position', independent: true },
        { name: 'size' },
        { name: 'series', scale: 'band' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        // !!!Note This order is very important.
        { type: transform_1.MaybeGradient },
        { type: transform_1.MaybeSeries },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)(), ...(0, utils_1.tooltipXd)()],
    interaction: {
        shareTooltip: true,
        seriesTooltip: true,
        crosshairs: true,
    },
};
//# sourceMappingURL=line.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815976, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Point = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    hollow: shape_1.PointHollow,
    hollowDiamond: shape_1.PointHollowDiamond,
    hollowHexagon: shape_1.PointHollowHexagon,
    hollowSquare: shape_1.PointHollowSquare,
    hollowTriangleDown: shape_1.PointHollowTriangleDown,
    hollowTriangle: shape_1.PointHollowTriangle,
    hollowBowtie: shape_1.PointHollowBowtie,
    hollowCircle: shape_1.PointHollowCircle,
    point: shape_1.PointShape,
    plus: shape_1.PointPlus,
    diamond: shape_1.PointDiamond,
    square: shape_1.PointSquare,
    triangle: shape_1.PointTriangle,
    hexagon: shape_1.PointHexagon,
    cross: shape_1.PointCross,
    bowtie: shape_1.PointBowtie,
    hyphen: shape_1.PointHyphen,
    line: shape_1.PointLine,
    tick: shape_1.PointTick,
    triangleDown: shape_1.PointTriangleDown,
    circle: shape_1.PointCircle,
};
/**
 * Convert value for each channel to point shapes.
 * Calc the bbox of each point based on x, y and r.
 * This is for allowing their radius can be affected by coordinate(e.g. fisheye).
 */
const Point = (options) => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, x1: X1, y1: Y1, size: S, dx: DX, dy: DY } = value;
        const [width, height] = coordinate.getSize();
        const offset = (0, utils_1.createBandOffset)(scale, value, options);
        const xy = (i) => {
            const dx = +((DX === null || DX === void 0 ? void 0 : DX[i]) || 0);
            const dy = +((DY === null || DY === void 0 ? void 0 : DY[i]) || 0);
            const x = X1 ? (+X[i] + +X1[i]) / 2 : +X[i];
            const y = Y1 ? (+Y[i] + +Y1[i]) / 2 : +Y[i];
            const cx = x + dx;
            const cy = y + dy;
            return [cx, cy];
        };
        const P = S
            ? Array.from(index, (i) => {
                const [cx, cy] = xy(i);
                const r = +S[i];
                const a = r / width;
                const b = r / height;
                const p1 = [cx - a, cy - b];
                const p2 = [cx + a, cy + b];
                return [
                    coordinate.map(offset(p1, i)),
                    coordinate.map(offset(p2, i)),
                ];
            })
            : Array.from(index, (i) => [coordinate.map(offset(xy(i), i))]);
        return [index, P];
    };
};
exports.Point = Point;
exports.Point.props = {
    defaultShape: 'hollow',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'series', scale: 'band' },
        { name: 'size', quantitative: 'sqrt' },
        { name: 'dx', scale: 'identity' },
        { name: 'dy', scale: 'identity' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeZeroX },
        { type: transform_1.MaybeZeroY },
    ],
    postInference: [...(0, utils_1.basePostInference)(), { type: transform_1.MaybeSize }, ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=point.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815977, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    text: shape_1.TextShape,
    badge: shape_1.TextBadge,
    tag: shape_1.TextTag,
};
const Text = (options) => {
    const { cartesian = false } = options;
    if (cartesian)
        return utils_1.visualMark;
    return ((index, scale, value, coordinate) => {
        const { x: X, y: Y } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, options);
        const P = Array.from(index, (i) => {
            const p = [+X[i], +Y[i]];
            return [coordinate.map(offset(p, i))];
        });
        return [index, P];
    });
};
exports.Text = Text;
exports.Text.props = {
    defaultShape: 'text',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'text', scale: 'identity' },
        { name: 'fontSize', scale: 'identity' },
        { name: 'rotate', scale: 'identity' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeTuple },
        { type: transform_1.MaybeVisualPosition },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=text.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815978, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Cell = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    cell: shape_1.CellShape,
    hollow: shape_1.CellHollow,
};
/**
 * Convert value for each channel to Cell shapes.
 * Calc the bbox of each Cell based on x, y and r.
 * This is for allowing their radius can be affected by coordinate(e.g. fisheye).
 */
const Cell = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y } = value;
        const x = scale.x;
        const y = scale.y;
        const P = Array.from(index, (i) => {
            const width = x.getBandWidth(x.invert(+X[i]));
            const height = y.getBandWidth(y.invert(+Y[i]));
            const x1 = +X[i];
            const y1 = +Y[i];
            const p1 = [x1, y1];
            const p2 = [x1 + width, y1];
            const p3 = [x1 + width, y1 + height];
            const p4 = [x1, y1 + height];
            return [p1, p2, p3, p4].map((d) => coordinate.map(d));
        });
        return [index, P];
    };
};
exports.Cell = Cell;
exports.Cell.props = {
    defaultShape: 'cell',
    defaultLabelShape: 'label',
    shape,
    composite: false,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true, scale: 'band' },
        { name: 'y', required: true, scale: 'band' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeZeroX },
        { type: transform_1.MaybeZeroY },
        { type: transform_1.MaybeZeroPadding },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=cell.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815979, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Area = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    area: shape_1.AreaShape,
    smooth: shape_1.AreaSmooth,
    hvh: shape_1.AreaHVH,
    vh: shape_1.AreaVH,
    hv: shape_1.AreaHV,
};
/*
 * Convert value for each channel to area shapes.
 *
 *     ▲
 *     │
 *     │                                         y2
 *     │
 *     │                     y1     xxxxxxxxxxxxx
 *     │                         xxxx            x
 *     │                      xxx                x
 *     │                    xxx                  x
 *     │        y0       xxx                     x
 *     │           xxxxxxx                       x
 *     │          x                              x
 *     │         xx                              x
 *     │         x                               x
 *     │         x                               x
 *     │         x                               x
 *     │         x                               x
 *     │         x                               x
 *     │         x                               x
 *     │         x                               x
 * ────┼─────────x───────────────────────────────x──────────────►
 *     │        y3             y4                y5
 */
const Area = () => {
    return (index, scale, value, coordinate) => {
        var _a, _b;
        const { x: X, y: Y, y1: Y1, series: S } = value;
        const { x, y } = scale;
        // Group data by series field.
        const series = S ? Array.from((0, d3_array_1.group)(index, (i) => S[i]).values()) : [index];
        const I = series.map((group) => group[0]).filter((i) => i !== undefined);
        // A group of data corresponds to one area.
        const xoffset = (((_a = x === null || x === void 0 ? void 0 : x.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(x)) || 0) / 2;
        const yoffset = (((_b = y === null || y === void 0 ? void 0 : y.getBandWidth) === null || _b === void 0 ? void 0 : _b.call(y)) || 0) / 2;
        const P = Array.from(series, (SI) => {
            const l = SI.length;
            const points = new Array(l * 2);
            for (let idx = 0; idx < SI.length; idx++) {
                const i = SI[idx];
                points[idx] = coordinate.map([+X[i] + xoffset, +Y[i] + yoffset]); // y1
                points[l + idx] = coordinate.map([+X[i] + xoffset, +Y1[i] + yoffset]); // y0
            }
            return points;
        });
        return [I, P, series];
    };
};
exports.Area = Area;
exports.Area.props = {
    defaultShape: 'area',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'size' },
        { name: 'series', scale: 'band' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeSeries },
        { type: transform_1.MaybeZeroY1 },
        { type: transform_1.MaybeZeroPadding },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
    interaction: {
        shareTooltip: true,
        seriesTooltip: true,
        crosshairs: true,
    },
};
//# sourceMappingURL=area.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815980, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Link = void 0;
const transform_1 = require("../transform");
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const shape = {
    link: shape_1.LinkShape,
    arc: shape_1.LinkArc,
    smooth: shape_1.LinkSmooth,
    vhv: shape_1.LinkVHV,
};
/**
 * Connect `start` to `end` with single line.
 */
const Link = (options) => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, x1: X1 = X, y1: Y1 = Y } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, options);
        const P = index.map((i) => [
            coordinate.map(offset([+X[i], +Y[i]], i)),
            coordinate.map(offset([+X1[i], +Y1[i]], i)),
        ]);
        return [index, P];
    };
};
exports.Link = Link;
exports.Link.props = {
    defaultShape: 'link',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeIdentityY },
        { type: transform_1.MaybeIdentityX },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=link.js.map
}, function(modId) { var map = {"../transform":1751263815823,"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815981, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Image = void 0;
const transform_1 = require("../transform");
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const shape = {
    image: shape_1.ImageShape,
};
const Image = (options) => {
    const { cartesian } = options;
    if (cartesian)
        return utils_1.visualMark;
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, options);
        const P = Array.from(index, (i) => {
            const p = [+X[i], +Y[i]];
            return [coordinate.map(offset(p, i))];
        });
        return [index, P];
    };
};
exports.Image = Image;
exports.Image.props = {
    defaultShape: 'image',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'src', scale: 'identity' },
        { name: 'size' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeTuple },
        { type: transform_1.MaybeVisualPosition },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=image.js.map
}, function(modId) { var map = {"../transform":1751263815823,"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815982, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Polygon = void 0;
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const shape = {
    polygon: shape_1.PolygonShape,
    ribbon: shape_1.PolygonRibbon,
};
/**
 * Convert value for each channel to polygon shapes.
 */
const Polygon = () => {
    return (index, scale, value, coordinate) => {
        const Xn = Object.entries(value)
            .filter(([key]) => key.startsWith('x'))
            .map(([, value]) => value);
        const Yn = Object.entries(value)
            .filter(([key]) => key.startsWith('y'))
            .map(([, value]) => value);
        const P = index.map((i) => {
            const Pn = [];
            for (let j = 0; j < Xn.length; j++) {
                const x = Xn[j][i];
                if (x === undefined)
                    break;
                const y = Yn[j][i];
                Pn.push(coordinate.map([+x, +y]));
            }
            return Pn;
        });
        return [index, P];
    };
};
exports.Polygon = Polygon;
exports.Polygon.props = {
    defaultShape: 'polygon',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)()],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=polygon.js.map
}, function(modId) { var map = {"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815983, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Box = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    box: shape_1.BoxShape,
    violin: shape_1.BoxViolin,
};
/**
 * Convert value for each channel to box shapes.
 *
 * p0           p2          p1
 *    ──────────┬──────────
 *              │
 *              │
 *              │
 *              │
 *              │
 *              │
 *              │ p3
 * p4 ┌─────────┴──────────┐ p5
 *    │                    │
 *    │                    │
 * p8 ├────────────────────┤ p9
 *    │                    │
 *    │        p10         │
 * p7 └─────────┬──────────┘ p6
 *              │
 *              │
 *              │
 *              │
 *              │
 *              │
 *              │
 *              │
 *   ───────────┴───────────
 * p12         p11           p13
 */
const Box = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, y1: Y1, y2: Y2, y3: Y3, y4: Y4, series: S } = value;
        // Calc width for each box.
        // The scales for x and series channels must be band scale.
        const xScale = scale.x;
        const series = scale.series;
        const P = Array.from(index, (i) => {
            const groupWidth = xScale.getBandWidth(xScale.invert(+X[i]));
            const ratio = series ? series.getBandWidth(series.invert(+(S === null || S === void 0 ? void 0 : S[i]))) : 1;
            const width = groupWidth * ratio;
            const offset = (+(S === null || S === void 0 ? void 0 : S[i]) || 0) * groupWidth;
            const x = +X[i] + offset + width / 2;
            const [low, q1, median, q3, high] = [
                +Y[i],
                +Y1[i],
                +Y2[i],
                +Y3[i],
                +Y4[i],
            ];
            const P13 = [
                [x - width / 2, high],
                [x + width / 2, high],
                [x, high],
                [x, q3],
                [x - width / 2, q3],
                [x + width / 2, q3],
                [x + width / 2, q1],
                [x - width / 2, q1],
                [x - width / 2, median],
                [x + width / 2, median],
                [x, q1],
                [x, low],
                [x - width / 2, low],
                [x + width / 2, low],
            ];
            return P13.map((d) => coordinate.map(d));
        });
        return [index, P];
    };
};
exports.Box = Box;
exports.Box.props = {
    defaultShape: 'box',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', scale: 'band', required: true },
        { name: 'y', required: true },
        { name: 'series', scale: 'band' },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeZeroX }],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
    interaction: {
        shareTooltip: true,
    },
};
//# sourceMappingURL=box.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815984, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Vector = void 0;
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const shape = {
    vector: shape_1.VectorShape,
};
/**
 * Convert value for each channel to start, end.
 * The angle starts from the X axis(right direction).
 */
const Vector = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, size: S, rotate: R } = value;
        const [width, height] = coordinate.getSize();
        const P = index.map((i) => {
            const angle = (+R[i] / 180) * Math.PI;
            const s = +S[i];
            const a = s / width;
            const b = s / height;
            const vx = a * Math.cos(angle);
            const vy = -b * Math.sin(angle);
            return [
                coordinate.map([+X[i] - vx / 2, +Y[i] - vy / 2]),
                coordinate.map([+X[i] + vx / 2, +Y[i] + vy / 2]),
            ];
        });
        return [index, P];
    };
};
exports.Vector = Vector;
exports.Vector.props = {
    defaultShape: 'vector',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'rotate', required: true, scale: 'identity' },
        { name: 'size', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)()],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=vector.js.map
}, function(modId) { var map = {"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815985, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LineY = void 0;
const util_1 = require("@antv/util");
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    line: shape_1.LineXY,
};
const LineY = (options) => {
    return (index, scale, value, coordinate) => {
        const { y: Y } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, (0, util_1.deepMix)({ style: { bandOffset: 0 } }, options));
        const P = Array.from(index, (i) => {
            const p1 = [0, Y[i]];
            const p2 = [1, Y[i]];
            return [p1, p2].map((d) => coordinate.map(offset(d, i)));
        });
        return [index, P];
    };
};
exports.LineY = LineY;
exports.LineY.props = {
    defaultShape: 'line',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeTupleY }],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=lineY.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815986, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LineX = void 0;
const util_1 = require("@antv/util");
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    line: shape_1.LineXY,
};
const LineX = (options) => {
    return (index, scale, value, coordinate) => {
        const { x: X } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, (0, util_1.deepMix)({ style: { bandOffset: 0 } }, options));
        const P = Array.from(index, (i) => {
            const p1 = [X[i], 1];
            const p2 = [X[i], 0];
            return [p1, p2].map((d) => coordinate.map(offset(d, i)));
        });
        return [index, P];
    };
};
exports.LineX = LineX;
exports.LineX.props = {
    defaultShape: 'line',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeTupleX }],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=lineX.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815987, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Connector = void 0;
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const link_1 = require("./link");
const shape = {
    connector: shape_1.ConnectorShape,
};
const Connector = (...args) => {
    return (0, link_1.Link)(...args);
};
exports.Connector = Connector;
exports.Connector.props = {
    defaultShape: 'connector',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)()],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=connector.js.map
}, function(modId) { var map = {"../shape":1751263815879,"./utils":1751263815937,"./link":1751263815980}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815988, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Range = exports.AbstractRange = void 0;
const shape_1 = require("../shape");
const utils_1 = require("./utils");
function extend(channel, extended, value, scale) {
    if (extended)
        return () => [0, 1];
    const { [channel]: C, [`${channel}1`]: C1 } = value;
    return (i) => {
        var _a;
        const offset = ((_a = scale.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(scale, scale.invert(+C1[i]))) || 0;
        return [C[i], C1[i] + offset];
    };
}
function AbstractRange(options = {}) {
    const { extendX = false, extendY = false } = options;
    return (index, scale, value, coordinate) => {
        const x = extend('x', extendX, value, scale.x);
        const y = extend('y', extendY, value, scale.y);
        const P = Array.from(index, (i) => {
            const [x1, x2] = x(i);
            const [y1, y2] = y(i);
            const p1 = [x1, y1];
            const p2 = [x2, y1];
            const p3 = [x2, y2];
            const p4 = [x1, y2];
            return [p1, p2, p3, p4].map((d) => coordinate.map(d));
        });
        return [index, P];
    };
}
exports.AbstractRange = AbstractRange;
const shape = { range: shape_1.RangeShape };
const Range = () => {
    return AbstractRange();
};
exports.Range = Range;
exports.Range.props = {
    defaultShape: 'range',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)()],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=range.js.map
}, function(modId) { var map = {"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815989, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.RangeX = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const range_1 = require("./range");
const shape = {
    range: shape_1.RangeShape,
};
const RangeX = () => {
    return (0, range_1.AbstractRange)({ extendY: true });
};
exports.RangeX = RangeX;
exports.RangeX.props = {
    defaultShape: 'range',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeDefaultX }],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=rangeX.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937,"./range":1751263815988}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815990, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.RangeY = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const range_1 = require("./range");
const shape = {
    range: shape_1.RangeShape,
};
const RangeY = () => {
    return (0, range_1.AbstractRange)({ extendX: true });
};
exports.RangeY = RangeY;
exports.RangeY.props = {
    defaultShape: 'range',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseAnnotationChannels)({ shapes: Object.keys(shape) }),
        { name: 'y', required: true },
    ],
    preInference: [...(0, utils_1.basePreInference)(), { type: transform_1.MaybeDefaultY }],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=rangeY.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937,"./range":1751263815988}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815991, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sankey = void 0;
const util_1 = require("@antv/util");
const sankey_1 = require("../data/sankey");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const utils_1 = require("./utils");
const DEFAULT_LAYOUT_OPTIONS = {
    nodeId: (d) => d.key,
    nodeWidth: 0.02,
    nodePadding: 0.02,
};
const DEFAULT_NODE_OPTIONS = {
    type: 'polygon',
    axis: false,
    legend: false,
    encode: {
        shape: 'polygon',
        x: 'x',
        y: 'y',
    },
    scale: {
        x: { type: 'identity' },
        y: { type: 'identity' },
    },
    style: {
        stroke: '#000',
    },
};
const DEFAULT_LINK_OPTIONS = {
    type: 'polygon',
    axis: false,
    legend: false,
    encode: {
        shape: 'ribbon',
        x: 'x',
        y: 'y',
    },
    style: {
        fillOpacity: 0.5,
        stroke: undefined,
    },
};
const DEFAULT_LABEL_OPTIONS = {
    textAlign: (d) => (d.x[0] < 0.5 ? 'start' : 'end'),
    position: (d) => (d.x[0] < 0.5 ? 'right' : 'left'),
    fontSize: 10,
};
/**
 * @todo Add interaction
 * @todo Add source-link color mode
 */
const Sankey = (options) => {
    const { data, encode = {}, scale, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, interaction, } = options;
    // Initialize data, generating nodes by link if is not specified.
    const { links, nodes } = (0, utils_1.initializeData)(data, encode);
    // Extract encode for node and link.
    const nodeEncode = (0, helper_1.subObject)(encode, 'node');
    const linkEncode = (0, helper_1.subObject)(encode, 'link');
    const { key: nodeKey = (d) => d.key, color = nodeKey } = nodeEncode;
    // Transform data, using nodeKey as nodeId.
    const { links: linkData, nodes: nodeData } = (0, sankey_1.Sankey)(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), { nodeId: (0, utils_1.field)(nodeKey) }), layout))({ links, nodes });
    // Extract label style and apply defaults.
    const _a = (0, helper_1.subObject)(style, 'label'), { text = nodeKey, spacing = 5 } = _a, labelStyle = __rest(_a, ["text", "spacing"]);
    const key1 = (0, utils_1.field)(nodeKey);
    const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
        title: key1,
        items: [{ field: 'value' }],
    }, true);
    const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
        title: '',
        items: [
            (d) => ({ name: 'source', value: key1(d.source) }),
            (d) => ({ name: 'target', value: key1(d.target) }),
        ],
    });
    return [
        (0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
            data: nodeData,
            encode: Object.assign(Object.assign({}, nodeEncode), { color }),
            scale,
            style: (0, helper_1.subObject)(style, 'node'),
            labels: [
                Object.assign(Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), { text, dx: (d) => (d.x[0] < 0.5 ? spacing : -spacing) }), labelStyle),
                ...nodeLabels,
            ],
            tooltip: nodeTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'node'),
            axis: false,
            interaction,
        }),
        (0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
            data: linkData,
            encode: linkEncode,
            labels: linkLabels,
            style: Object.assign({ fill: linkEncode.color ? undefined : '#aaa', lineWidth: 0 }, (0, helper_1.subObject)(style, 'link')),
            tooltip: linkTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'link'),
            interaction,
        }),
    ];
};
exports.Sankey = Sankey;
exports.Sankey.props = {};
//# sourceMappingURL=sankey.js.map
}, function(modId) { var map = {"../data/sankey":1751263815992,"../utils/helper":1751263815829,"../utils/mark":1751263815997,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815992, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sankey = void 0;
const d3_sankey_1 = require("./utils/d3-sankey");
const DEFAULT_OPTIONS = {
    nodeAlign: 'justify',
    nodeWidth: 0.008,
    nodePadding: 0.03,
    nodes: (graph) => graph.nodes,
    links: (graph) => graph.links,
    nodeSort: undefined,
    linkSort: undefined,
    iterations: 6,
};
const ALIGN_METHOD = {
    left: d3_sankey_1.left,
    right: d3_sankey_1.right,
    center: d3_sankey_1.center,
    justify: d3_sankey_1.justify,
};
function getNodeAlignFunction(nodeAlign) {
    const type = typeof nodeAlign;
    if (type === 'string')
        return ALIGN_METHOD[nodeAlign] || d3_sankey_1.justify;
    if (type === 'function')
        return nodeAlign;
    return d3_sankey_1.justify;
}
/**
 * Compute the node and edge position, return a graph representing the Sankey layout. All will be normalized to [[0, 0], [1, 1]]
 * Required graph data (nodes, edges)
 */
const Sankey = (options) => {
    return (data) => {
        const { nodeId, nodeSort, nodeAlign, nodeWidth, nodePadding, nodeDepth, nodes: nodeNodes, links: nodeLinks, linkSort, iterations, } = Object.assign({}, DEFAULT_OPTIONS, options);
        const sankeyProcessor = (0, d3_sankey_1.sankey)()
            .nodeSort(nodeSort)
            .linkSort(linkSort)
            .links(nodeLinks)
            .nodes(nodeNodes)
            .nodeWidth(nodeWidth)
            .nodePadding(nodePadding)
            .nodeDepth(nodeDepth)
            .nodeAlign(getNodeAlignFunction(nodeAlign))
            .iterations(iterations)
            .extent([
            [0, 0],
            [1, 1],
        ]);
        if (typeof nodeId === 'function') {
            sankeyProcessor.nodeId(nodeId);
        }
        const layoutData = sankeyProcessor(data);
        const { nodes: N, links: L } = layoutData;
        const nodes = N.map((node) => {
            const { x0, x1, y0, y1 } = node;
            /* points
             * 3---2
             * |   |
             * 0---1
             */
            return Object.assign(Object.assign({}, node), { x: [x0, x1, x1, x0], y: [y0, y0, y1, y1] });
        });
        const links = L.map((edge) => {
            const { source, target } = edge;
            const sx = source.x1;
            const tx = target.x0;
            const offset = edge.width / 2;
            return Object.assign(Object.assign({}, edge), { x: [sx, sx, tx, tx], y: [
                    edge.y0 + offset,
                    edge.y0 - offset,
                    edge.y1 + offset,
                    edge.y1 - offset,
                ] });
        });
        return { nodes, links };
    };
};
exports.Sankey = Sankey;
exports.Sankey.props = {};
//# sourceMappingURL=sankey.js.map
}, function(modId) { var map = {"./utils/d3-sankey":1751263815993}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815993, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.sankey = exports.justify = exports.right = exports.left = exports.center = void 0;
/**
 * Sankey layout, fork from https://github.com/d3/d3-sankey/tree/master/src (todo, optimize algorithm)
 *
 * Major changes:
 *
 * 1. modify some set and map traverse
 * 2. fix some error caused by [empty] array
 * 3. support `nodeDepth` through align method
 */
const sankey_1 = require("./sankey");
Object.defineProperty(exports, "sankey", { enumerable: true, get: function () { return sankey_1.Sankey; } });
var align_1 = require("./align");
Object.defineProperty(exports, "center", { enumerable: true, get: function () { return align_1.center; } });
Object.defineProperty(exports, "left", { enumerable: true, get: function () { return align_1.left; } });
Object.defineProperty(exports, "right", { enumerable: true, get: function () { return align_1.right; } });
Object.defineProperty(exports, "justify", { enumerable: true, get: function () { return align_1.justify; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./sankey":1751263815994,"./align":1751263815995}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815994, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sankey = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const align_1 = require("./align");
const constant_1 = require("./constant");
function ascendingSourceBreadth(a, b) {
    return ascendingBreadth(a.source, b.source) || a.index - b.index;
}
function ascendingTargetBreadth(a, b) {
    return ascendingBreadth(a.target, b.target) || a.index - b.index;
}
function ascendingBreadth(a, b) {
    return a.y0 - b.y0;
}
function value(d) {
    return d.value;
}
function defaultId(d) {
    return d.index;
}
function defaultNodes(graph) {
    return graph.nodes;
}
function defaultLinks(graph) {
    return graph.links;
}
function find(nodeById, id) {
    const node = nodeById.get(id);
    if (!node)
        throw new Error('missing: ' + id);
    return node;
}
function computeLinkBreadths({ nodes }) {
    for (const node of nodes) {
        let y0 = node.y0;
        let y1 = y0;
        for (const link of node.sourceLinks) {
            link.y0 = y0 + link.width / 2;
            y0 += link.width;
        }
        for (const link of node.targetLinks) {
            link.y1 = y1 + link.width / 2;
            y1 += link.width;
        }
    }
}
function Sankey() {
    let x0 = 0, y0 = 0, x1 = 1, y1 = 1; // extent
    let dx = 24; // nodeWidth
    let dy = 8, py; // nodePadding
    let id = defaultId;
    let align = align_1.justify;
    let depth;
    let sort;
    let linkSort;
    let nodes = defaultNodes;
    let links = defaultLinks;
    let iterations = 6;
    function sankey(arg) {
        const graph = {
            nodes: nodes(arg),
            links: links(arg),
        };
        computeNodeLinks(graph);
        computeNodeValues(graph);
        computeNodeDepths(graph);
        computeNodeHeights(graph);
        computeNodeBreadths(graph);
        computeLinkBreadths(graph);
        return graph;
    }
    sankey.update = function (graph) {
        computeLinkBreadths(graph);
        return graph;
    };
    sankey.nodeId = function (_) {
        return arguments.length
            ? ((id = typeof _ === 'function' ? _ : (0, constant_1.constant)(_)), sankey)
            : id;
    };
    sankey.nodeAlign = function (_) {
        return arguments.length
            ? ((align = typeof _ === 'function' ? _ : (0, constant_1.constant)(_)), sankey)
            : align;
    };
    sankey.nodeDepth = function (_) {
        return arguments.length
            ? ((depth = typeof _ === 'function' ? _ : _), sankey)
            : depth;
    };
    sankey.nodeSort = function (_) {
        return arguments.length ? ((sort = _), sankey) : sort;
    };
    sankey.nodeWidth = function (_) {
        return arguments.length ? ((dx = +_), sankey) : dx;
    };
    sankey.nodePadding = function (_) {
        return arguments.length ? ((dy = py = +_), sankey) : dy;
    };
    sankey.nodes = function (_) {
        return arguments.length
            ? ((nodes = typeof _ === 'function' ? _ : (0, constant_1.constant)(_)), sankey)
            : nodes;
    };
    sankey.links = function (_) {
        return arguments.length
            ? ((links = typeof _ === 'function' ? _ : (0, constant_1.constant)(_)), sankey)
            : links;
    };
    sankey.linkSort = function (_) {
        return arguments.length ? ((linkSort = _), sankey) : linkSort;
    };
    sankey.size = function (_) {
        return arguments.length
            ? ((x0 = y0 = 0), (x1 = +_[0]), (y1 = +_[1]), sankey)
            : [x1 - x0, y1 - y0];
    };
    sankey.extent = function (_) {
        return arguments.length
            ? ((x0 = +_[0][0]),
                (x1 = +_[1][0]),
                (y0 = +_[0][1]),
                (y1 = +_[1][1]),
                sankey)
            : [
                [x0, y0],
                [x1, y1],
            ];
    };
    sankey.iterations = function (_) {
        return arguments.length ? ((iterations = +_), sankey) : iterations;
    };
    function computeNodeLinks({ nodes, links }) {
        nodes.forEach((node, idx) => {
            node.index = idx;
            node.sourceLinks = [];
            node.targetLinks = [];
        });
        const nodeById = new Map(nodes.map((d) => [id(d), d]));
        links.forEach((link, idx) => {
            link.index = idx;
            let { source, target } = link;
            if (typeof source !== 'object')
                source = link.source = find(nodeById, source);
            if (typeof target !== 'object')
                target = link.target = find(nodeById, target);
            source.sourceLinks.push(link);
            target.targetLinks.push(link);
        });
        if (linkSort != null) {
            for (const { sourceLinks, targetLinks } of nodes) {
                sourceLinks.sort(linkSort);
                targetLinks.sort(linkSort);
            }
        }
    }
    function computeNodeValues({ nodes }) {
        for (const node of nodes) {
            node.value =
                node.fixedValue === undefined
                    ? Math.max((0, d3_array_1.sum)(node.sourceLinks, value), (0, d3_array_1.sum)(node.targetLinks, value))
                    : node.fixedValue;
        }
    }
    function computeNodeDepths({ nodes }) {
        const n = nodes.length;
        let current = new Set(nodes);
        let next = new Set();
        let x = 0;
        while (current.size) {
            current.forEach((node) => {
                node.depth = x;
                for (const { target } of node.sourceLinks) {
                    next.add(target);
                }
            });
            if (++x > n)
                throw new Error('circular link');
            current = next;
            next = new Set();
        }
        // 如果配置了 depth，则设置自定义 depth
        if (depth) {
            const maxDepth = Math.max((0, d3_array_1.max)(nodes, (d) => d.depth) + 1, 0);
            let node;
            for (let i = 0; i < nodes.length; i++) {
                node = nodes[i];
                node.depth = depth.call(null, node, maxDepth);
            }
        }
    }
    function computeNodeHeights({ nodes }) {
        const n = nodes.length;
        let current = new Set(nodes);
        let next = new Set();
        let x = 0;
        while (current.size) {
            current.forEach((node) => {
                node.height = x;
                for (const { source } of node.targetLinks) {
                    next.add(source);
                }
            });
            if (++x > n)
                throw new Error('circular link');
            current = next;
            next = new Set();
        }
    }
    function computeNodeLayers({ nodes }) {
        const x = Math.max((0, d3_array_1.max)(nodes, (d) => d.depth) + 1, 0);
        const kx = (x1 - x0 - dx) / (x - 1);
        const columns = new Array(x).fill(0).map(() => []);
        for (const node of nodes) {
            const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
            node.layer = i;
            node.x0 = x0 + i * kx;
            node.x1 = node.x0 + dx;
            if (columns[i])
                columns[i].push(node);
            else
                columns[i] = [node];
        }
        if (sort)
            for (const column of columns) {
                column.sort(sort);
            }
        return columns;
    }
    function initializeNodeBreadths(columns) {
        const ky = (0, d3_array_1.min)(columns, (c) => (y1 - y0 - (c.length - 1) * py) / (0, d3_array_1.sum)(c, value));
        for (const nodes of columns) {
            let y = y0;
            for (const node of nodes) {
                node.y0 = y;
                node.y1 = y + node.value * ky;
                y = node.y1 + py;
                for (const link of node.sourceLinks) {
                    link.width = link.value * ky;
                }
            }
            y = (y1 - y + py) / (nodes.length + 1);
            for (let i = 0; i < nodes.length; ++i) {
                const node = nodes[i];
                node.y0 += y * (i + 1);
                node.y1 += y * (i + 1);
            }
            reorderLinks(nodes);
        }
    }
    function computeNodeBreadths(graph) {
        const columns = computeNodeLayers(graph);
        py = Math.min(dy, (y1 - y0) / ((0, d3_array_1.max)(columns, (c) => c.length) - 1));
        initializeNodeBreadths(columns);
        for (let i = 0; i < iterations; ++i) {
            const alpha = Math.pow(0.99, i);
            const beta = Math.max(1 - alpha, (i + 1) / iterations);
            relaxRightToLeft(columns, alpha, beta);
            relaxLeftToRight(columns, alpha, beta);
        }
    }
    // Reposition each node based on its incoming (target) links.
    function relaxLeftToRight(columns, alpha, beta) {
        for (let i = 1, n = columns.length; i < n; ++i) {
            const column = columns[i];
            for (const target of column) {
                let y = 0;
                let w = 0;
                for (const { source, value } of target.targetLinks) {
                    const v = value * (target.layer - source.layer);
                    y += targetTop(source, target) * v;
                    w += v;
                }
                if (!(w > 0))
                    continue;
                const dy = (y / w - target.y0) * alpha;
                target.y0 += dy;
                target.y1 += dy;
                reorderNodeLinks(target);
            }
            if (sort === undefined)
                column.sort(ascendingBreadth);
            if (column.length)
                resolveCollisions(column, beta);
        }
    }
    // Reposition each node based on its outgoing (source) links.
    function relaxRightToLeft(columns, alpha, beta) {
        for (let n = columns.length, i = n - 2; i >= 0; --i) {
            const column = columns[i];
            for (const source of column) {
                let y = 0;
                let w = 0;
                for (const { target, value } of source.sourceLinks) {
                    const v = value * (target.layer - source.layer);
                    y += sourceTop(source, target) * v;
                    w += v;
                }
                if (!(w > 0))
                    continue;
                const dy = (y / w - source.y0) * alpha;
                source.y0 += dy;
                source.y1 += dy;
                reorderNodeLinks(source);
            }
            if (sort === undefined)
                column.sort(ascendingBreadth);
            if (column.length)
                resolveCollisions(column, beta);
        }
    }
    function resolveCollisions(nodes, alpha) {
        const i = nodes.length >> 1;
        const subject = nodes[i];
        resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
        resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
        resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
        resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
    }
    // Push any overlapping nodes down.
    function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
        for (; i < nodes.length; ++i) {
            const node = nodes[i];
            const dy = (y - node.y0) * alpha;
            if (dy > 1e-6)
                (node.y0 += dy), (node.y1 += dy);
            y = node.y1 + py;
        }
    }
    // Push any overlapping nodes up.
    function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
        for (; i >= 0; --i) {
            const node = nodes[i];
            const dy = (node.y1 - y) * alpha;
            if (dy > 1e-6)
                (node.y0 -= dy), (node.y1 -= dy);
            y = node.y0 - py;
        }
    }
    function reorderNodeLinks({ sourceLinks, targetLinks }) {
        if (linkSort === undefined) {
            for (const { source: { sourceLinks }, } of targetLinks) {
                sourceLinks.sort(ascendingTargetBreadth);
            }
            for (const { target: { targetLinks }, } of sourceLinks) {
                targetLinks.sort(ascendingSourceBreadth);
            }
        }
    }
    function reorderLinks(nodes) {
        if (linkSort === undefined) {
            for (const { sourceLinks, targetLinks } of nodes) {
                sourceLinks.sort(ascendingTargetBreadth);
                targetLinks.sort(ascendingSourceBreadth);
            }
        }
    }
    // Returns the target.y0 that would produce an ideal link from source to target.
    function targetTop(source, target) {
        let y = source.y0 - ((source.sourceLinks.length - 1) * py) / 2;
        for (const { target: node, width } of source.sourceLinks) {
            if (node === target)
                break;
            y += width + py;
        }
        for (const { source: node, width } of target.targetLinks) {
            if (node === source)
                break;
            y -= width;
        }
        return y;
    }
    // Returns the source.y0 that would produce an ideal link from source to target.
    function sourceTop(source, target) {
        let y = target.y0 - ((target.targetLinks.length - 1) * py) / 2;
        for (const { source: node, width } of target.targetLinks) {
            if (node === source)
                break;
            y += width + py;
        }
        for (const { target: node, width } of source.sourceLinks) {
            if (node === target)
                break;
            y -= width;
        }
        return y;
    }
    return sankey;
}
exports.Sankey = Sankey;
//# sourceMappingURL=sankey.js.map
}, function(modId) { var map = {"./align":1751263815995,"./constant":1751263815996}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815995, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.center = exports.justify = exports.right = exports.left = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
function targetDepth(d) {
    return d.target.depth;
}
function left(node) {
    return node.depth;
}
exports.left = left;
function right(node, n) {
    return n - 1 - node.height;
}
exports.right = right;
function justify(node, n) {
    return node.sourceLinks.length ? node.depth : n - 1;
}
exports.justify = justify;
function center(node) {
    return node.targetLinks.length
        ? node.depth
        : node.sourceLinks.length
            ? (0, d3_array_1.min)(node.sourceLinks, targetDepth) - 1
            : 0;
}
exports.center = center;
//# sourceMappingURL=align.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815996, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.constant = void 0;
function constant(x) {
    return function () {
        return x;
    };
}
exports.constant = constant;
//# sourceMappingURL=constant.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815997, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.maybeAnimation = exports.isFullTooltip = exports.maybeTooltip = exports.subTooltip = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("./helper");
function subTooltip(tooltip, name, defaults = {}, main = false) {
    if ((0, helper_1.isUnset)(tooltip))
        return tooltip;
    if (Array.isArray(tooltip) && main)
        return tooltip;
    const sub = (0, helper_1.subObject)(tooltip, name);
    return (0, util_1.deepMix)(defaults, sub);
}
exports.subTooltip = subTooltip;
function maybeTooltip(tooltip, defaults = {}) {
    if ((0, helper_1.isUnset)(tooltip))
        return tooltip;
    if (Array.isArray(tooltip))
        return tooltip;
    if (!isFullTooltip(tooltip))
        return tooltip;
    return (0, util_1.deepMix)(defaults, tooltip);
}
exports.maybeTooltip = maybeTooltip;
function isFullTooltip(tooltip) {
    if (Object.keys(tooltip).length === 0)
        return true;
    const { title, items } = tooltip;
    return title !== undefined || items !== undefined;
}
exports.isFullTooltip = isFullTooltip;
function maybeAnimation(animate, sub) {
    return typeof animate === 'object' ? (0, helper_1.subObject)(animate, sub) : animate;
}
exports.maybeAnimation = maybeAnimation;
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {"./helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815998, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Chord = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const arc_1 = require("../data/arc");
const utils_1 = require("./utils");
const DEFAULT_LAYOUT_OPTIONS = {
    y: 0,
    thickness: 0.05,
    marginRatio: 0.1,
    id: (node) => node.key,
    source: (edge) => edge.source,
    target: (edge) => edge.target,
    sourceWeight: (edge) => edge.value || 1,
    targetWeight: (edge) => edge.value || 1,
    sortBy: null, // optional, id | weight | frequency | {function}
};
const DEFAULT_NODE_OPTIONS = {
    type: 'polygon',
    axis: false,
    legend: false,
    encode: {
        shape: 'polygon',
        x: 'x',
        y: 'y',
    },
    scale: {
        x: { type: 'identity' },
        y: { type: 'identity' },
    },
    style: {
        opacity: 1,
        fillOpacity: 1,
        lineWidth: 1,
    },
};
const DEFAULT_LINK_OPTIONS = {
    type: 'polygon',
    axis: false,
    legend: false,
    encode: {
        shape: 'ribbon',
        x: 'x',
        y: 'y',
    },
    style: {
        opacity: 0.5,
        lineWidth: 1,
    },
};
const DEFAULT_LABEL_OPTIONS = {
    position: 'outside',
    fontSize: 10,
};
const Chord = (options, context) => {
    const { data, encode = {}, scale, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
    // Initialize data, generating nodes by link if is not specified.
    const { nodes, links } = (0, utils_1.initializeData)(data, encode);
    // Extract encode for node and link.
    const nodeEncode = (0, helper_1.subObject)(encode, 'node');
    const linkEncode = (0, helper_1.subObject)(encode, 'link');
    const { key: nodeKey = (d) => d.key, color = nodeKey } = nodeEncode;
    const { linkEncodeColor = (d) => d.source } = linkEncode;
    const { nodeWidthRatio = DEFAULT_LAYOUT_OPTIONS.thickness, nodePaddingRatio = DEFAULT_LAYOUT_OPTIONS.marginRatio } = layout, restLayout = __rest(layout, ["nodeWidthRatio", "nodePaddingRatio"]);
    const { nodes: nodeData, edges: linkData } = (0, arc_1.Arc)(Object.assign(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), { id: (0, utils_1.field)(nodeKey), thickness: nodeWidthRatio, marginRatio: nodePaddingRatio }), restLayout), { weight: true }))({ nodes, edges: links });
    // Extract label style and apply defaults.
    const _a = (0, helper_1.subObject)(style, 'label'), { text = nodeKey } = _a, labelStyle = __rest(_a, ["text"]);
    const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
        title: '',
        items: [(d) => ({ name: d.key, value: d.value })],
    }, true);
    const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
        title: '',
        items: [(d) => ({ name: `${d.source} -> ${d.target}`, value: d.value })],
    });
    const { height, width } = context;
    const minimumLen = Math.min(height, width);
    return [
        (0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
            data: linkData,
            encode: Object.assign(Object.assign({}, linkEncode), { color: linkEncodeColor }),
            labels: linkLabels,
            style: Object.assign({ fill: linkEncodeColor ? undefined : '#aaa' }, (0, helper_1.subObject)(style, 'link')),
            tooltip: linkTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'link'),
        }),
        (0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
            data: nodeData,
            encode: Object.assign(Object.assign({}, nodeEncode), { color }),
            scale,
            style: (0, helper_1.subObject)(style, 'node'),
            coordinate: {
                type: 'polar',
                // Leave enough rendering space for the label.
                outerRadius: (minimumLen - 20) / minimumLen,
                startAngle: -Math.PI * 2,
                endAngle: 0,
            },
            labels: [
                Object.assign(Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), { text }), labelStyle),
                ...nodeLabels,
            ],
            tooltip: nodeTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'node'),
            axis: false,
        }),
    ];
};
exports.Chord = Chord;
exports.Chord.props = {};
//# sourceMappingURL=chord.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/mark":1751263815997,"../data/arc":1751263815999,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263815999, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Arc = void 0;
const arc_1 = require("../data/utils/arc");
/**
 * For arc diagram(edge with weight) or chord diagram(with weight)
 */
const Arc = (options) => {
    return (data) => {
        return (0, arc_1.Arc)(options)(data);
    };
};
exports.Arc = Arc;
exports.Arc.props = {};
//# sourceMappingURL=arc.js.map
}, function(modId) { var map = {"../data/utils/arc":1751263816000}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816000, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Arc = void 0;
var arc_1 = require("./arc");
Object.defineProperty(exports, "Arc", { enumerable: true, get: function () { return arc_1.Arc; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./arc":1751263816001}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816001, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Arc = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../../../utils/helper");
const SortMethods = __importStar(require("./sort"));
const DEFAULT_OPTIONS = {
    y: 0,
    thickness: 0.05,
    weight: false,
    marginRatio: 0.1,
    id: (node) => node.id,
    source: (edge) => edge.source,
    target: (edge) => edge.target,
    sourceWeight: (edge) => edge.value || 1,
    targetWeight: (edge) => edge.value || 1,
    sortBy: null,
};
/**
 * Layout for Arc / Chord diagram with d3 style.
 */
function Arc(options) {
    const { y, thickness, weight, marginRatio, id, source, target, sourceWeight, targetWeight, sortBy, } = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
    function arc(data) {
        // Clone first.
        const nodes = data.nodes.map((n) => (Object.assign({}, n)));
        const edges = data.edges.map((n) => (Object.assign({}, n)));
        // Keep reference in below functions.
        preprocess(nodes, edges);
        sortNodes(nodes, edges);
        layoutNodes(nodes, edges);
        layoutEdges(nodes, edges);
        return { nodes, edges };
    }
    /**
     * Calculate id, value, frequency for node, and source,target for edge.
     */
    function preprocess(nodes, edges) {
        edges.forEach((edge) => {
            edge.source = source(edge);
            edge.target = target(edge);
            edge.sourceWeight = sourceWeight(edge);
            edge.targetWeight = targetWeight(edge);
        });
        // Group edges by source, target.
        const edgesBySource = (0, d3_array_1.group)(edges, (e) => e.source);
        const edgesByTarget = (0, d3_array_1.group)(edges, (e) => e.target);
        nodes.forEach((node) => {
            node.id = id(node);
            const sources = edgesBySource.has(node.id)
                ? edgesBySource.get(node.id)
                : [];
            const targets = edgesByTarget.has(node.id)
                ? edgesByTarget.get(node.id)
                : [];
            node.frequency = sources.length + targets.length;
            node.value =
                (0, d3_array_1.sum)(sources, (d) => d.sourceWeight) +
                    (0, d3_array_1.sum)(targets, (d) => d.targetWeight);
        });
        return { nodes, edges };
    }
    function sortNodes(nodes, edges) {
        const method = typeof sortBy === 'function' ? sortBy : SortMethods[sortBy];
        if (method) {
            nodes.sort(method);
        }
    }
    function layoutNodes(nodes, edges) {
        const size = nodes.length;
        if (!size) {
            throw (0, helper_1.error)("Invalid nodes: it's empty!");
        }
        // No weight.
        if (!weight) {
            const deltaX = 1 / size;
            nodes.forEach((node, i) => {
                node.x = (i + 0.5) * deltaX;
                node.y = y;
            });
            return { nodes, edges };
        }
        // todo: marginRatio should be in [0, 1)
        // todo: thickness shoule be in (0, 1)
        const margin = marginRatio / (2 * size);
        const total = nodes.reduce((prev, node) => (prev += node.value), 0);
        nodes.reduce((deltaX, node) => {
            node.weight = node.value / total;
            node.width = node.weight * (1 - marginRatio);
            node.height = thickness;
            /* points
             * 3---2
             * |   |
             * 0---1
             */
            const minX = margin + deltaX;
            const maxX = minX + node.width;
            const minY = y - thickness / 2;
            const maxY = minY + thickness;
            node.x = [minX, maxX, maxX, minX];
            node.y = [minY, minY, maxY, maxY];
            // Return next deltaX.
            return deltaX + node.width + 2 * margin;
        }, 0);
        return {
            nodes,
            edges,
        };
    }
    /**
     * Get edge layout information from nodes, and save into edge object.
     */
    function layoutEdges(nodes, edges) {
        const nodesMap = new Map(nodes.map((d) => [d.id, d]));
        if (!weight) {
            edges.forEach((edge) => {
                const sourceId = source(edge);
                const targetId = target(edge);
                const sourceNode = nodesMap.get(sourceId);
                const targetNode = nodesMap.get(targetId);
                // Edge's layout information is Equal with node.
                if (sourceNode && targetNode) {
                    edge.x = [sourceNode.x, targetNode.x];
                    edge.y = [sourceNode.y, targetNode.y];
                }
            });
            return { nodes, edges };
        }
        // Initial edge.x, edge.y.
        edges.forEach((edge) => {
            edge.x = [0, 0, 0, 0];
            edge.y = [y, y, y, y];
        });
        // Group edges by source, target.
        const edgesBySource = (0, d3_array_1.group)(edges, (e) => e.source);
        const edgesByTarget = (0, d3_array_1.group)(edges, (e) => e.target);
        // When weight = true, we need to calculation the bbox of edge start/end.
        nodes.forEach((node) => {
            const { edges, width, x, y, value, id } = node;
            const sourceEdges = edgesBySource.get(id) || [];
            const targetEdges = edgesByTarget.get(id) || [];
            let offset = 0;
            /* points
             * 0----------2
             * |          |
             * 1----------3
             */
            sourceEdges.map((edge) => {
                const w = (edge.sourceWeight / value) * width;
                edge.x[0] = x[0] + offset;
                edge.x[1] = x[0] + offset + w;
                offset += w;
            });
            targetEdges.forEach((edge) => {
                const w = (edge.targetWeight / value) * width;
                edge.x[3] = x[0] + offset;
                edge.x[2] = x[0] + offset + w;
                offset += w;
            });
        });
    }
    return arc;
}
exports.Arc = Arc;
//# sourceMappingURL=arc.js.map
}, function(modId) { var map = {"../../../utils/helper":1751263815829,"./sort":1751263816002}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816002, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.name = exports.id = exports.frequency = exports.weight = void 0;
function weight(a, b) {
    return b.value - a.value;
}
exports.weight = weight;
function frequency(a, b) {
    return b.frequency - a.frequency;
}
exports.frequency = frequency;
function id(a, b) {
    return `${a.id}`.localeCompare(`${b.id}`);
}
exports.id = id;
function name(a, b) {
    return `${a.name}`.localeCompare(`${b.name}`);
}
exports.name = name;
//# sourceMappingURL=sort.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816003, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0;
const shape_1 = require("../shape");
const utils_1 = require("./utils");
const shape = {
    path: shape_1.PathShape,
    hollow: shape_1.PathHollow,
};
/**
 * Draw a path.
 */
const Path = (options) => {
    return (index, scale, value, coordinate) => {
        // The points is meaning less for path mark,
        // because the position of path shapes specified
        // by the d option. So set [0, 0] for render pipeline.
        return [index, index.map(() => [[0, 0]])];
    };
};
exports.Path = Path;
exports.Path.props = {
    defaultShape: 'path',
    defaultLabelShape: 'label',
    shape,
    composite: false,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'd', scale: 'identity' },
    ],
    preInference: [...(0, utils_1.basePreInference)()],
    postInference: [...(0, utils_1.basePostInference)()],
};
//# sourceMappingURL=path.js.map
}, function(modId) { var map = {"../shape":1751263815879,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816004, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Treemap = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const treeDataTransform_1 = require("../utils/treeDataTransform");
// Defaults
const GET_DEFAULT_LAYOUT_OPTIONS = (width, height) => ({
    tile: 'treemapSquarify',
    ratio: 0.5 * (1 + Math.sqrt(5)),
    size: [width, height],
    round: false,
    ignoreParentValue: true,
    padding: 0,
    paddingInner: 0,
    paddingOuter: 0,
    paddingTop: 0,
    paddingRight: 0,
    paddingBottom: 0,
    paddingLeft: 0,
    sort: (a, b) => b.value - a.value,
    layer: 0,
});
const GET_DEFAULT_OPTIONS = (width, height) => ({
    type: 'rect',
    axis: false,
    encode: {
        x: 'x',
        y: 'y',
        key: 'id',
        color: (d) => d.path[1],
    },
    scale: {
        x: { domain: [0, width], range: [0, 1] },
        y: { domain: [0, height], range: [0, 1] },
    },
    style: {
        stroke: '#fff',
    },
    state: {
        active: { opacity: 0.6 },
        inactive: { opacity: 1 },
    },
});
const DEFAULT_LABEL_OPTIONS = {
    fontSize: 10,
    text: (d) => (0, util_1.last)(d.path),
    position: 'inside',
    fill: '#000',
    textOverflow: 'clip',
    wordWrap: true,
    maxLines: 1,
    wordWrapWidth: (d) => d.x1 - d.x0,
    isTreemapLabel: true,
};
const DEFAULT_TOOLTIP_OPTIONS = {
    title: (d) => { var _a, _b; return (_b = (_a = d.path) === null || _a === void 0 ? void 0 : _a.join) === null || _b === void 0 ? void 0 : _b.call(_a, '.'); },
    items: [{ field: 'value' }],
};
const DEFAULT_TOOLTIP_OPTIONS_DRILL = {
    title: (d) => (0, util_1.last)(d.path),
    items: [{ field: 'value' }],
};
const Treemap = (options, context) => {
    const { width, height, options: markOptions } = context;
    const { data, encode = {}, scale, style = {}, layout = {}, labels = [], tooltip = {} } = options, resOptions = __rest(options, ["data", "encode", "scale", "style", "layout", "labels", "tooltip"]);
    const treemapDrillDown = (0, util_1.get)(markOptions, [
        'interaction',
        'treemapDrillDown',
    ]);
    // Layout
    const layoutOptions = (0, util_1.deepMix)({}, GET_DEFAULT_LAYOUT_OPTIONS(width, height), layout, {
        layer: treemapDrillDown
            ? (d) => {
                return d.depth === 1;
            }
            : layout.layer,
    });
    // Data
    const [transformedData, transformedDataAll] = (0, treeDataTransform_1.treeDataTransform)(data, layoutOptions, encode);
    // Label
    const labelStyle = (0, helper_1.subObject)(style, 'label');
    return (0, util_1.deepMix)({}, GET_DEFAULT_OPTIONS(width, height), Object.assign(Object.assign({ data: transformedData, scale,
        style, labels: [
            Object.assign(Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), labelStyle), (treemapDrillDown && { cursor: 'pointer' })),
            ...labels,
        ] }, resOptions), { encode, tooltip: (0, mark_1.maybeTooltip)(tooltip, DEFAULT_TOOLTIP_OPTIONS), axis: false }), treemapDrillDown
        ? {
            interaction: Object.assign(Object.assign({}, resOptions.interaction), { treemapDrillDown: treemapDrillDown
                    ? Object.assign(Object.assign({}, treemapDrillDown), { originData: transformedDataAll, layout: layoutOptions }) : undefined }),
            encode: Object.assign({ color: (d) => (0, util_1.last)(d.path) }, encode),
            tooltip: (0, mark_1.maybeTooltip)(tooltip, DEFAULT_TOOLTIP_OPTIONS_DRILL),
        }
        : {});
};
exports.Treemap = Treemap;
exports.Treemap.props = {};
//# sourceMappingURL=treemap.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/mark":1751263815997,"../utils/treeDataTransform":1751263816005}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816005, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.treeDataTransform = void 0;
const util_1 = require("@antv/util");
const d3_hierarchy_1 = require("@antv/vendor/d3-hierarchy");
const utils_1 = require("../mark/utils");
/**
 * @description Path need when the data is a flat json structure,
 * and the tree object structure do not need.
 */
function generateHierarchyRoot(data, path) {
    if (Array.isArray(data)) {
        return typeof path === 'function'
            ? (0, d3_hierarchy_1.stratify)().path(path)(data)
            : (0, d3_hierarchy_1.stratify)()(data);
    }
    return (0, d3_hierarchy_1.hierarchy)(data);
}
function addObjectDataPath(root, path = [root.data.name]) {
    // @ts-ignore
    root.id = root.id || root.data.name;
    root.path = path;
    if (root.children) {
        root.children.forEach((item) => {
            // @ts-ignore
            item.id = `${root.id}/${item.data.name}`;
            item.path = [...path, item.data.name];
            addObjectDataPath(item, item.path);
        });
    }
}
function addArrayDataPath(root) {
    const name = (0, util_1.get)(root, ['data', 'name']);
    if (name.replaceAll) {
        root.path = name.replaceAll('.', '/').split('/');
    }
    if (root.children) {
        root.children.forEach((item) => {
            addArrayDataPath(item);
        });
    }
}
function getTileMethod(tile, ratio) {
    const tiles = {
        treemapBinary: d3_hierarchy_1.treemapBinary,
        treemapDice: d3_hierarchy_1.treemapDice,
        treemapSlice: d3_hierarchy_1.treemapSlice,
        treemapSliceDice: d3_hierarchy_1.treemapSliceDice,
        treemapSquarify: d3_hierarchy_1.treemapSquarify,
        treemapResquarify: d3_hierarchy_1.treemapResquarify,
    };
    const tileMethod = tile === 'treemapSquarify' ? tiles[tile].ratio(ratio) : tiles[tile];
    if (!tileMethod) {
        throw new TypeError('Invalid tile method!');
    }
    return tileMethod;
}
function treeDataTransform(data, layout, encode) {
    const { value } = encode;
    const tileMethod = getTileMethod(layout.tile, layout.ratio);
    const root = generateHierarchyRoot(data, layout.path);
    if ((0, util_1.isArray)(data)) {
        addArrayDataPath(root);
    }
    else {
        addObjectDataPath(root);
    }
    // Calculate the value and sort.
    value
        ? root
            .sum((d) => layout.ignoreParentValue && d.children
            ? 0
            : (0, utils_1.field)(value)(d))
            .sort(layout.sort)
        : root.count();
    (0, d3_hierarchy_1.treemap)()
        .tile(tileMethod)
        // @ts-ignore
        .size(layout.size)
        .round(layout.round)
        .paddingInner(layout.paddingInner)
        .paddingOuter(layout.paddingOuter)
        .paddingTop(layout.paddingTop)
        .paddingRight(layout.paddingRight)
        .paddingBottom(layout.paddingBottom)
        .paddingLeft(layout.paddingLeft)(root);
    const nodes = root.descendants().map((d) => Object.assign(d, {
        id: d.id.replace(/^\//, ''),
        x: [d.x0, d.x1],
        y: [d.y0, d.y1],
    }));
    const filterData = nodes.filter(typeof layout.layer === 'function'
        ? layout.layer
        : (d) => d.height === layout.layer);
    return [filterData, nodes];
}
exports.treeDataTransform = treeDataTransform;
//# sourceMappingURL=treeDataTransform.js.map
}, function(modId) { var map = {"../mark/utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816006, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pack = void 0;
const util_1 = require("@antv/util");
const d3_hierarchy_1 = require("@antv/vendor/d3-hierarchy");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const utils_1 = require("./utils");
const GET_DEFAULT_LAYOUT_OPTIONS = (width, height) => ({
    size: [width, height],
    padding: 0,
    sort: (a, b) => b.value - a.value,
});
const GET_DEFAULT_OPTIONS = (width, height, encode) => ({
    type: 'point',
    axis: false,
    legend: false,
    scale: {
        x: { domain: [0, width] },
        y: { domain: [0, height] },
        size: { type: 'identity' },
    },
    encode: {
        x: 'x',
        y: 'y',
        size: 'r',
        shape: 'point',
    },
    style: {
        fill: !encode.color ? (d) => (d.height === 0 ? '#ddd' : '#fff') : undefined,
        stroke: !encode.color ? (d) => (d.height === 0 ? '' : '#000') : undefined,
    },
});
const DEFAULT_LABEL_OPTIONS = {
    text: '',
    position: 'inside',
    textOverflow: 'clip',
    wordWrap: true,
    maxLines: 1,
    wordWrapWidth: (d) => d.r * 2,
};
const DEFAULT_TOOLTIP_OPTIONS = {
    title: (d) => d.data.name,
    items: [{ field: 'value' }],
};
const dataTransform = (data, layout, encode) => {
    const { value } = encode;
    const root = (0, util_1.isArray)(data)
        ? (0, d3_hierarchy_1.stratify)().path(layout.path)(data)
        : (0, d3_hierarchy_1.hierarchy)(data);
    value ? root.sum((d) => (0, utils_1.field)(value)(d)).sort(layout.sort) : root.count();
    // @ts-ignore
    (0, d3_hierarchy_1.pack)().size(layout.size).padding(layout.padding)(root);
    return root.descendants();
};
const Pack = (markOptions, context) => {
    const { width, height } = context;
    const { data, encode = {}, scale = {}, style = {}, layout = {}, labels = [], tooltip = {} } = markOptions, resOptions = __rest(markOptions, ["data", "encode", "scale", "style", "layout", "labels", "tooltip"]);
    const DEFAULT_OPTIONS = GET_DEFAULT_OPTIONS(width, height, encode);
    const transformedData = dataTransform(data, (0, util_1.deepMix)({}, GET_DEFAULT_LAYOUT_OPTIONS(width, height), layout), (0, util_1.deepMix)({}, DEFAULT_OPTIONS['encode'], encode));
    const labelStyle = (0, helper_1.subObject)(style, 'label');
    return (0, util_1.deepMix)({}, DEFAULT_OPTIONS, Object.assign(Object.assign({ data: transformedData, encode,
        scale,
        style, labels: [
            Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), labelStyle),
            ...labels,
        ] }, resOptions), { tooltip: (0, mark_1.maybeTooltip)(tooltip, DEFAULT_TOOLTIP_OPTIONS), axis: false }));
};
exports.Pack = Pack;
exports.Pack.props = {};
//# sourceMappingURL=pack.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/mark":1751263815997,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816007, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Boxplot = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
function min(I, V) {
    return (0, d3_array_1.min)(I, (i) => V[i]);
}
function max(I, V) {
    return (0, d3_array_1.max)(I, (i) => V[i]);
}
function lower(I, V) {
    const lo = q1(I, V) * 2.5 - q3(I, V) * 1.5;
    return (0, d3_array_1.min)(I, (i) => (V[i] >= lo ? V[i] : NaN));
}
function q1(I, V) {
    return (0, d3_array_1.quantile)(I, 0.25, (i) => V[i]);
}
function q2(I, V) {
    return (0, d3_array_1.quantile)(I, 0.5, (i) => V[i]);
}
function q3(I, V) {
    return (0, d3_array_1.quantile)(I, 0.75, (i) => V[i]);
}
function upper(I, V) {
    const hi = q3(I, V) * 2.5 - q1(I, V) * 1.5;
    return (0, d3_array_1.max)(I, (i) => (V[i] <= hi ? V[i] : NaN));
}
/**
 * Group marks by x and reserve outlier indexes.
 */
function OutlierY() {
    return (I, mark) => {
        const { encode } = mark;
        const { y, x } = encode;
        const { value: V } = y;
        const { value: X } = x;
        const GI = Array.from((0, d3_array_1.group)(I, (i) => X[+i]).values());
        const FI = GI.flatMap((I) => {
            const lo = lower(I, V);
            const hi = upper(I, V);
            return I.filter((i) => V[i] < lo || V[i] > hi);
        });
        return [FI, mark];
    };
}
const Boxplot = (options) => {
    const { data, encode, style = {}, tooltip = {}, transform, animate } = options, rest = __rest(options, ["data", "encode", "style", "tooltip", "transform", "animate"]);
    const { point = true } = style, restStyle = __rest(style, ["point"]);
    const { y } = encode;
    const encodeY = { y, y1: y, y2: y, y3: y, y4: y };
    const qy = { y1: q1, y2: q2, y3: q3 };
    // Tooltips.
    const boxTooltip = (0, mark_1.subTooltip)(tooltip, 'box', {
        items: [
            { channel: 'y', name: 'min' },
            { channel: 'y1', name: 'q1' },
            { channel: 'y2', name: 'q2' },
            { channel: 'y3', name: 'q3' },
            { channel: 'y4', name: 'max' },
        ],
    }, true);
    const pointTooltip = (0, mark_1.subTooltip)(tooltip, 'point', {
        title: { channel: 'x' },
        items: [{ name: 'outlier', channel: 'y' }],
    });
    // Only show min and max instead of lower and upper.
    // Only draw a box.
    if (!point) {
        return Object.assign({ type: 'box', data: data, transform: [
                Object.assign(Object.assign({ type: 'groupX', y: min }, qy), { y4: max }),
            ], encode: Object.assign(Object.assign({}, encode), encodeY), style: restStyle, tooltip: boxTooltip }, rest);
    }
    const boxStyle = (0, helper_1.subObject)(restStyle, 'box');
    const pointStyle = (0, helper_1.subObject)(restStyle, 'point');
    return [
        Object.assign({ type: 'box', data: data, transform: [
                Object.assign(Object.assign({ type: 'groupX', y: lower }, qy), { y4: upper }),
            ], encode: Object.assign(Object.assign({}, encode), encodeY), style: boxStyle, tooltip: boxTooltip, animate: (0, mark_1.maybeAnimation)(animate, 'box') }, rest),
        // Draw outliers.
        {
            type: 'point',
            data: data,
            transform: [{ type: OutlierY }],
            encode,
            style: Object.assign({}, pointStyle),
            tooltip: pointTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'point'),
        },
    ];
};
exports.Boxplot = Boxplot;
exports.Boxplot.props = {};
//# sourceMappingURL=boxplot.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/mark":1751263815997}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816008, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Shape = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    shape: shape_1.ShapeShape,
};
/**
 * @todo Unify with text, image and point.
 */
const Shape = (options) => {
    const { cartesian } = options;
    if (cartesian)
        return utils_1.visualMark;
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y } = value;
        const offset = (0, utils_1.createBandOffset)(scale, value, options);
        const P = Array.from(index, (i) => {
            const p = [+X[i], +Y[i]];
            return [coordinate.map(offset(p, i))];
        });
        return [index, P];
    };
};
exports.Shape = Shape;
exports.Shape.props = {
    defaultShape: 'shape',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        { name: 'x', required: true },
        { name: 'y', required: true },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeTuple },
        { type: transform_1.MaybeVisualPosition },
        { type: transform_1.MaybeFunctionAttribute },
    ],
};
//# sourceMappingURL=shape.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816009, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForceGraph = void 0;
const d3_force_1 = require("@antv/vendor/d3-force");
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const utils_1 = require("./utils");
const DEFAULT_LAYOUT_OPTIONS = {
    joint: true,
};
const DEFAULT_LINK_OPTIONS = {
    type: 'link',
    axis: false,
    legend: false,
    encode: {
        x: [(d) => d.source.x, (d) => d.target.x],
        y: [(d) => d.source.y, (d) => d.target.y],
    },
    style: {
        stroke: '#999',
        strokeOpacity: 0.6,
    },
};
const DEFAULT_NODE_OPTIONS = {
    type: 'point',
    axis: false,
    legend: false,
    encode: {
        x: 'x',
        y: 'y',
        size: 5,
        color: 'group',
        shape: 'point',
    },
    style: {
        stroke: '#fff',
    },
};
const DEFAULT_LABEL_OPTIONS = {
    text: '',
};
function dataTransform(data, layout, encode) {
    const { nodes, links } = data;
    const { joint, nodeStrength, linkStrength } = layout;
    const { nodeKey = (d) => d.id, linkKey = (d) => d.id } = encode;
    const nodeForce = (0, d3_force_1.forceManyBody)();
    const linkForce = (0, d3_force_1.forceLink)(links).id((0, utils_1.field)(linkKey));
    typeof nodeStrength === 'function' && nodeForce.strength(nodeStrength);
    typeof linkStrength === 'function' && linkForce.strength(linkStrength);
    const simulation = (0, d3_force_1.forceSimulation)(nodes)
        .force('link', linkForce)
        .force('charge', nodeForce);
    joint
        ? simulation.force('center', (0, d3_force_1.forceCenter)())
        : simulation.force('x', (0, d3_force_1.forceX)()).force('y', (0, d3_force_1.forceY)());
    simulation.stop();
    const n = Math.ceil(Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay()));
    for (let i = 0; i < n; i++)
        simulation.tick();
    return {
        nodesData: nodes,
        linksData: links,
    };
}
const ForceGraph = (options) => {
    const { data, encode: e = {}, scale, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
    const { nodeKey = (d) => d.id, linkKey = (d) => d.id } = e, restEncode = __rest(e, ["nodeKey", "linkKey"]);
    const encode = Object.assign({ nodeKey, linkKey }, restEncode);
    const nodeEncode = (0, helper_1.subObject)(encode, 'node');
    const linkEncode = (0, helper_1.subObject)(encode, 'link');
    const { links, nodes } = (0, utils_1.initializeData)(data, encode);
    const { nodesData, linksData } = dataTransform({ links, nodes }, (0, util_1.deepMix)({}, DEFAULT_LAYOUT_OPTIONS, layout), encode);
    const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
        items: [
            (d) => ({ name: 'source', value: (0, utils_1.field)(linkKey)(d.source) }),
            (d) => ({ name: 'target', value: (0, utils_1.field)(linkKey)(d.target) }),
        ],
    });
    const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
        items: [(d) => ({ name: 'key', value: (0, utils_1.field)(nodeKey)(d) })],
    }, true);
    return [
        (0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
            data: linksData,
            encode: linkEncode,
            labels: linkLabels,
            style: (0, helper_1.subObject)(style, 'link'),
            tooltip: linkTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'link'),
        }),
        (0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
            data: nodesData,
            encode: Object.assign({}, nodeEncode),
            scale,
            style: (0, helper_1.subObject)(style, 'node'),
            tooltip: nodeTooltip,
            labels: [
                Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), (0, helper_1.subObject)(style, 'label')),
                ...nodeLabels,
            ],
            animate: (0, mark_1.maybeAnimation)(animate, 'link'),
        }),
    ];
};
exports.ForceGraph = ForceGraph;
exports.ForceGraph.props = {};
//# sourceMappingURL=forceGraph.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/mark":1751263815997,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816010, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tree = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const tree_1 = require("../data/tree");
const mark_1 = require("../utils/mark");
const DEFAULT_LAYOUT_OPTIONS = {
    sortBy: (a, b) => b.value - a.value,
};
const DEFAULT_NODE_OPTIONS = {
    axis: false,
    legend: false,
    type: 'point',
    encode: {
        x: 'x',
        y: 'y',
        size: 2,
        shape: 'point',
    },
};
const DEFAULT_LINK_OPTIONS = {
    type: 'link',
    encode: {
        x: 'x',
        y: 'y',
        shape: 'smooth',
    },
};
const DEFAULT_LABEL_OPTIONS = {
    text: '',
    fontSize: 10,
};
const Tree = (options) => {
    const { data, encode = {}, scale = {}, style = {}, layout = {}, nodeLabels = [], linkLabels = [], animate = {}, tooltip = {}, } = options;
    const valueEncode = encode === null || encode === void 0 ? void 0 : encode.value;
    const { nodes, edges } = (0, tree_1.Tree)(Object.assign(Object.assign(Object.assign({}, DEFAULT_LAYOUT_OPTIONS), layout), { field: valueEncode }))(data);
    const nodeTooltip = (0, mark_1.subTooltip)(tooltip, 'node', {
        title: 'name',
        items: ['value'],
    }, true);
    const linkTooltip = (0, mark_1.subTooltip)(tooltip, 'link', {
        title: '',
        items: [
            (d) => ({ name: 'source', value: d.source.name }),
            (d) => ({ name: 'target', value: d.target.name }),
        ],
    });
    return [
        (0, util_1.deepMix)({}, DEFAULT_LINK_OPTIONS, {
            data: edges,
            encode: (0, helper_1.subObject)(encode, 'link'),
            scale: (0, helper_1.subObject)(scale, 'link'),
            labels: linkLabels,
            style: Object.assign({ stroke: '#999' }, (0, helper_1.subObject)(style, 'link')),
            tooltip: linkTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'link'),
        }),
        (0, util_1.deepMix)({}, DEFAULT_NODE_OPTIONS, {
            data: nodes,
            scale: (0, helper_1.subObject)(scale, 'node'),
            encode: (0, helper_1.subObject)(encode, 'node'),
            labels: [
                Object.assign(Object.assign({}, DEFAULT_LABEL_OPTIONS), (0, helper_1.subObject)(style, 'label')),
                ...nodeLabels,
            ],
            style: Object.assign({}, (0, helper_1.subObject)(style, 'node')),
            tooltip: nodeTooltip,
            animate: (0, mark_1.maybeAnimation)(animate, 'node'),
        }),
    ];
};
exports.Tree = Tree;
exports.Tree.props = {};
//# sourceMappingURL=tree.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../data/tree":1751263816011,"../utils/mark":1751263815997}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816011, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Tree = void 0;
const d3_hierarchy_1 = require("@antv/vendor/d3-hierarchy");
const cluster_1 = require("./cluster");
const Tree = (options) => {
    return (0, cluster_1.hierarchyFunction)(d3_hierarchy_1.tree)(options);
};
exports.Tree = Tree;
exports.Tree.props = {};
//# sourceMappingURL=tree.js.map
}, function(modId) { var map = {"./cluster":1751263816012}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816012, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Cluster = exports.hierarchyFunction = void 0;
const d3_hierarchy_1 = require("@antv/vendor/d3-hierarchy");
const hierarchyFunction = (layoutFunction) => (options) => {
    return (data) => {
        const { field = 'value', nodeSize, separation, sortBy, as = ['x', 'y'], } = options;
        const [x, y] = as;
        // Process root data.
        const root = (0, d3_hierarchy_1.hierarchy)(data, (d) => d.children)
            .sum((d) => d[field])
            .sort(sortBy);
        // Layout
        const c = layoutFunction();
        c.size([1, 1]);
        if (nodeSize)
            c.nodeSize(nodeSize);
        if (separation)
            c.separation(separation);
        c(root);
        const nodes = [];
        root.each((node) => {
            node[x] = node.x;
            node[y] = node.y;
            node.name = node.data.name;
            nodes.push(node);
        });
        const edges = root.links();
        edges.forEach((edge) => {
            edge[x] = [edge.source[x], edge.target[x]];
            edge[y] = [edge.source[y], edge.target[y]];
        });
        return { nodes, edges };
    };
};
exports.hierarchyFunction = hierarchyFunction;
const Cluster = (options) => {
    return (0, exports.hierarchyFunction)(d3_hierarchy_1.cluster)(options);
};
exports.Cluster = Cluster;
exports.Cluster.props = {};
//# sourceMappingURL=cluster.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816013, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WordCloud = void 0;
const util_1 = require("@antv/util");
function initializeData(data, encode) {
    const { text = 'text', value = 'value' } = encode;
    return data.map((d) => (Object.assign(Object.assign({}, d), { text: d[text], value: d[value] })));
}
const GET_DEFAULT_OPTIONS = () => ({
    axis: false,
    type: 'text',
    encode: {
        x: 'x',
        y: 'y',
        text: 'text',
        rotate: 'rotate',
        fontSize: 'size',
        shape: 'tag',
    },
    scale: {
        x: { range: [0, 1] },
        y: { range: [0, 1] },
    },
    style: {
        fontFamily: (d) => d.fontFamily,
    },
    tooltip: {
        items: [
            (datum) => ({
                name: datum.text,
                value: datum.value,
            }),
        ],
    },
});
const WordCloud = (options, context) => __awaiter(void 0, void 0, void 0, function* () {
    const { width, height } = context;
    const { data, encode = {}, scale, style = {}, layout = {} } = options, resOptions = __rest(options, ["data", "encode", "scale", "style", "layout"]);
    const initializedData = initializeData(data, encode);
    return (0, util_1.deepMix)({}, GET_DEFAULT_OPTIONS(), Object.assign(Object.assign({ data: {
            value: initializedData,
            transform: [
                Object.assign({ type: 'wordCloud', size: [width, height] }, layout),
            ],
        }, encode,
        scale,
        style }, resOptions), { axis: false }));
});
exports.WordCloud = WordCloud;
exports.WordCloud.props = {};
//# sourceMappingURL=wordCloud.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816014, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Gauge = void 0;
const util_1 = require("@antv/util");
const g_1 = require("@antv/g");
const helper_1 = require("../utils/helper");
const coordinate_1 = require("../utils/coordinate");
const coordinate_2 = require("../coordinate");
const utils_1 = require("../shape/utils");
const selection_1 = require("../utils/selection");
const shape_1 = require("../shape");
const indicatorShape = (options, context) => {
    const { shape, radius } = options, style = __rest(options, ["shape", "radius"]);
    const pointerStyle = (0, helper_1.subObject)(style, 'pointer');
    const pinStyle = (0, helper_1.subObject)(style, 'pin');
    const { shape: pointerShape } = pointerStyle, resPointerStyle = __rest(pointerStyle, ["shape"]);
    const { shape: pinShape } = pinStyle, resPinStyle = __rest(pinStyle, ["shape"]);
    const { coordinate, theme } = context;
    return (points, value) => {
        // Invert points.
        const invertedPoints = points.map((p) => coordinate.invert(p));
        // Get new coordinate.
        const [startAngle, endAngle, innerRadius] = (0, coordinate_1.getTransformOptions)(coordinate, 'polar');
        const newCoordinate = coordinate.clone();
        const { color: stroke } = value;
        const newTransformations = (0, coordinate_2.Radial)({
            startAngle,
            endAngle,
            innerRadius,
            outerRadius: radius,
        });
        newTransformations.push(['cartesian']);
        newCoordinate.update({
            transformations: newTransformations,
        });
        const newPoints = invertedPoints.map((p) => newCoordinate.map(p));
        const [x, y] = (0, utils_1.getOrigin)(newPoints);
        const [cx, cy] = coordinate.getCenter();
        const pointerAttrs = Object.assign(Object.assign({ x1: x, y1: y, x2: cx, y2: cy, stroke }, resPointerStyle), style);
        const pinAttrs = Object.assign(Object.assign({ cx,
            cy,
            stroke }, resPinStyle), style);
        const indicatorGroup = (0, selection_1.select)(new g_1.Group());
        if (!(0, helper_1.isUnset)(pointerShape)) {
            typeof pointerShape === 'function'
                ? indicatorGroup.append(() => pointerShape(newPoints, value, newCoordinate, theme))
                : indicatorGroup.append('line').call(utils_1.applyStyle, pointerAttrs).node();
        }
        if (!(0, helper_1.isUnset)(pinShape)) {
            typeof pinShape === 'function'
                ? indicatorGroup.append(() => pinShape(newPoints, value, newCoordinate, theme))
                : indicatorGroup.append('circle').call(utils_1.applyStyle, pinAttrs).node();
        }
        return indicatorGroup.node();
    };
};
const DEFAULT_OPTIONS = {
    coordinate: {
        type: 'radial',
        innerRadius: 0.9,
        outerRadius: 1,
        startAngle: (-11 / 10) * Math.PI,
        endAngle: (1 / 10) * Math.PI,
    },
    axis: {
        x: false,
    },
    legend: false,
    tooltip: false,
    encode: {
        x: 'x',
        y: 'y',
        color: 'color',
    },
    scale: {
        color: {
            range: ['#30BF78', '#D0D0D0'],
        },
    },
};
const DEFAULT_INDICATOR_OPTIONS = {
    style: {
        shape: indicatorShape,
        lineWidth: 4,
        pointerLineCap: 'round',
        pinR: 10,
        pinFill: '#fff',
        radius: 0.6,
    },
};
const DEFAULT_TEXT_OPTIONS = {
    type: 'text',
    style: {
        x: '50%',
        y: '60%',
        textAlign: 'center',
        textBaseline: 'middle',
        fontSize: 20,
        fontWeight: 800,
        fill: '#888',
    },
    tooltip: false,
};
function getGaugeData(data) {
    if ((0, util_1.isNumber)(data)) {
        // Percent range [0, 1].
        const percent = Math.max(0, Math.min(data, 1));
        return {
            percent,
            target: percent,
            total: 1,
        };
    }
    return data;
}
function dataTransform(data, scale) {
    const { name = 'score', target, total, percent, thresholds = [], } = getGaugeData(data);
    const _target = percent || target;
    const _total = percent ? 1 : total;
    const newScale = Object.assign({ y: {
            domain: [0, _total],
        } }, scale);
    if (!thresholds.length) {
        return {
            targetData: [{ x: name, y: _target, color: 'target' }],
            totalData: [
                { x: name, y: _target, color: 'target' },
                { x: name, y: _total - _target, color: 'total' },
            ],
            target: _target,
            total: _total,
            scale: newScale,
        };
    }
    return {
        targetData: [{ x: name, y: _target, color: 'target' }],
        totalData: thresholds.map((d, i) => ({
            x: name,
            y: i >= 1 ? d - thresholds[i - 1] : d,
            color: i,
        })),
        target: _target,
        total: _total,
        scale: newScale,
    };
}
function getTextContent(textStyle, { target, total }) {
    const { content } = textStyle;
    return content ? content(target, total) : target.toString();
}
const Gauge = (options) => {
    const { data = {}, scale = {}, style = {}, animate = {}, transform = [] } = options, resOptions = __rest(options, ["data", "scale", "style", "animate", "transform"]);
    const { targetData, totalData, target, total, scale: newScale, } = dataTransform(data, scale);
    const _a = (0, helper_1.subObject)(style, 'text'), { tooltip } = _a, textStyle = __rest(_a, ["tooltip"]);
    // pointer + pin
    const indicatorStyle = (0, helper_1.filterPrefixObject)(style, ['pointer', 'pin']);
    const arcStyle = (0, helper_1.subObject)(style, 'arc');
    const shape = arcStyle.shape;
    return [
        (0, util_1.deepMix)({}, DEFAULT_OPTIONS, Object.assign({ type: 'interval', transform: [{ type: 'stackY' }], data: totalData, scale: newScale, style: shape === 'round' ? Object.assign(Object.assign({}, arcStyle), { shape: shape_1.GaugeRound }) : arcStyle, animate: typeof animate === 'object' ? (0, helper_1.subObject)(animate, 'arc') : animate }, resOptions)),
        (0, util_1.deepMix)({}, DEFAULT_OPTIONS, DEFAULT_INDICATOR_OPTIONS, Object.assign({ type: 'point', data: targetData, scale: newScale, style: indicatorStyle, animate: typeof animate === 'object' ? (0, helper_1.subObject)(animate, 'indicator') : animate }, resOptions)),
        (0, util_1.deepMix)({}, DEFAULT_TEXT_OPTIONS, {
            style: Object.assign({ text: getTextContent(textStyle, { target, total }) }, textStyle),
            tooltip,
            animate: typeof animate === 'object' ? (0, helper_1.subObject)(animate, 'text') : animate,
        }),
    ];
};
exports.Gauge = Gauge;
exports.Gauge.props = {};
//# sourceMappingURL=gauge.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/coordinate":1751263815882,"../coordinate":1751263815805,"../shape/utils":1751263815885,"../utils/selection":1751263815883,"../shape":1751263815879}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816015, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Density = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    density: shape_1.DensityShape,
};
const Density = () => {
    return (index, scale, value, coordinate) => {
        const { x: X, series: S } = value;
        const Yn = Object.entries(value)
            .filter(([key]) => key.startsWith('y'))
            .map(([, value]) => value);
        const SZn = Object.entries(value)
            .filter(([key]) => key.startsWith('size'))
            .map(([, value]) => value);
        // Because x and y channel is not strictly required in Line.props,
        // it should throw error with empty x or y channels.
        if (X === undefined || Yn === undefined || SZn === undefined) {
            throw new Error('Missing encode for x or y or size channel.');
        }
        // Calc width for each box.
        // The scales for x and series channels must be band scale.
        const xScale = scale.x;
        const series = scale.series;
        const P = Array.from(index, (i) => {
            const groupWidth = xScale.getBandWidth(xScale.invert(+X[i]));
            const ratio = series ? series.getBandWidth(series.invert(+(S === null || S === void 0 ? void 0 : S[i]))) : 1;
            const width = groupWidth * ratio;
            const offset = (+(S === null || S === void 0 ? void 0 : S[i]) || 0) * groupWidth;
            const x = +X[i] + offset + width / 2;
            const PN = [
                ...Yn.map((_, idx) => [x + +SZn[idx][i] / index.length, +Yn[idx][i]]),
                ...Yn.map((_, idx) => [
                    x - +SZn[idx][i] / index.length,
                    +Yn[idx][i],
                ]).reverse(), // left
            ];
            return PN.map((p) => coordinate.map(p));
        });
        return [index, P];
    };
};
exports.Density = Density;
exports.Density.props = {
    defaultShape: 'density',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', scale: 'band', required: true },
        { name: 'y', required: true },
        { name: 'size', required: true },
        { name: 'series', scale: 'band' },
        { name: 'size', required: true, scale: 'identity' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeZeroY1 },
        { type: transform_1.MaybeZeroX },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip1d)()],
    interaction: { shareTooltip: true },
};
//# sourceMappingURL=density.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816016, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Heatmap = void 0;
const shape_1 = require("../shape");
const transform_1 = require("../transform");
const utils_1 = require("./utils");
const shape = {
    heatmap: shape_1.HeatmapShape,
};
/**
 * Draw heatmap with gradient.
 */
const Heatmap = (options) => {
    return (index, scale, value, coordinate) => {
        const { x: X, y: Y, size: S, color: C } = value;
        const P = Array.from(index, (i) => {
            // Default size = 40.
            const r = S ? +S[i] : 40;
            // Warning: x, y, value, radius.
            return [...coordinate.map([+X[i], +Y[i]]), C[i], r];
        });
        return [[0], [P]];
    };
};
exports.Heatmap = Heatmap;
exports.Heatmap.props = {
    defaultShape: 'heatmap',
    defaultLabelShape: 'label',
    composite: false,
    shape,
    channels: [
        ...(0, utils_1.baseGeometryChannels)({ shapes: Object.keys(shape) }),
        { name: 'x', required: true },
        { name: 'y', required: true },
        { name: 'color', scale: 'identity', required: true },
        { name: 'size' },
    ],
    preInference: [
        ...(0, utils_1.basePreInference)(),
        { type: transform_1.MaybeZeroX },
        { type: transform_1.MaybeZeroY },
    ],
    postInference: [...(0, utils_1.basePostInference)(), ...(0, utils_1.tooltip2d)()],
};
//# sourceMappingURL=heatmap.js.map
}, function(modId) { var map = {"../shape":1751263815879,"../transform":1751263815823,"./utils":1751263815937}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816017, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Liquid = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const number_1 = require("../utils/number");
const shape_1 = require("../shape");
const DEFAULT_OPTIONS = {
    axis: {
        x: false,
        y: false,
    },
    legend: false,
    tooltip: false,
    encode: {
        x: 'type',
        y: 'percent',
    },
    scale: {
        y: {
            domain: [0, 1],
        },
    },
    style: {
        shape: shape_1.LiquidShape,
    },
    animate: {
        enter: {
            type: 'fadeIn',
        },
    },
};
const DEFAULT_TEXT_OPTIONS = {
    type: 'text',
    style: {
        x: '50%',
        y: '50%',
        textAlign: 'center',
        textBaseline: 'middle',
        fontSize: 20,
        fontWeight: 800,
        fill: '#888',
    },
    animate: {
        enter: {
            type: 'fadeIn',
        },
    },
};
const Liquid = (options) => {
    const { data = {}, style = {}, animate } = options, resOptions = __rest(options, ["data", "style", "animate"]);
    // Compatible with old data structures: { percent: number } and percent >= 0.
    const percent = Math.max(0, (0, util_1.isNumber)(data) ? data : data === null || data === void 0 ? void 0 : data.percent);
    const newData = [{ percent, type: 'liquid' }];
    const contentStyle = Object.assign(Object.assign({}, (0, helper_1.subObject)(style, 'text')), (0, helper_1.subObject)(style, 'content'));
    const outline = (0, helper_1.subObject)(style, 'outline');
    const wave = (0, helper_1.subObject)(style, 'wave');
    const background = (0, helper_1.subObject)(style, 'background');
    return [
        (0, util_1.deepMix)({}, DEFAULT_OPTIONS, Object.assign({ type: 'interval', data: newData, style: {
                liquidOptions: {
                    percent,
                    liquidShape: style === null || style === void 0 ? void 0 : style.shape,
                },
                styleOptions: Object.assign(Object.assign({}, style), { outline,
                    wave,
                    background }),
            }, animate }, resOptions)),
        (0, util_1.deepMix)({}, DEFAULT_TEXT_OPTIONS, {
            style: Object.assign({ text: `${(0, number_1.prettyNumber)(percent * 100)} %` }, contentStyle),
            animate,
        }),
    ];
};
exports.Liquid = Liquid;
exports.Liquid.props = {};
//# sourceMappingURL=liquid.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/number":1751263815884,"../shape":1751263815879}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816018, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Category20 = exports.Category10 = void 0;
var category10_1 = require("./category10");
Object.defineProperty(exports, "Category10", { enumerable: true, get: function () { return category10_1.Category10; } });
var category20_1 = require("./category20");
Object.defineProperty(exports, "Category20", { enumerable: true, get: function () { return category20_1.Category20; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./category10":1751263816019,"./category20":1751263816020}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816019, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Category10 = void 0;
/**
 * Classic palette of AntV for ordinal data with 10 colors.
 */
const Category10 = () => {
    return [
        '#5B8FF9',
        '#5AD8A6',
        '#5D7092',
        '#F6BD16',
        '#6F5EF9',
        '#6DC8EC',
        '#945FB9',
        '#FF9845',
        '#1E9493',
        '#FF99C3',
    ];
};
exports.Category10 = Category10;
exports.Category10.props = {};
//# sourceMappingURL=category10.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816020, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Category20 = void 0;
/**
 * Classic palette of AntV for ordinal data with 20 colors.
 */
const Category20 = () => {
    return [
        '#5B8FF9',
        '#CDDDFD',
        '#5AD8A6',
        '#CDF3E4',
        '#5D7092',
        '#CED4DE',
        '#F6BD16',
        '#FCEBB9',
        '#6F5EF9',
        '#D3CEFD',
        '#6DC8EC',
        '#D3EEF9',
        '#945FB9',
        '#DECFEA',
        '#FF9845',
        '#FFE0C7',
        '#1E9493',
        '#BBDEDE',
        '#FF99C3',
        '#FFE0ED',
    ];
};
exports.Category20 = Category20;
exports.Category20.props = {};
//# sourceMappingURL=category20.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816021, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Constant = exports.Sequential = exports.Sqrt = exports.Quantize = exports.Quantile = exports.Threshold = exports.Pow = exports.Log = exports.Time = exports.Point = exports.Identity = exports.Ordinal = exports.Linear = exports.Band = void 0;
var band_1 = require("./band");
Object.defineProperty(exports, "Band", { enumerable: true, get: function () { return band_1.Band; } });
var linear_1 = require("./linear");
Object.defineProperty(exports, "Linear", { enumerable: true, get: function () { return linear_1.Linear; } });
var ordinal_1 = require("./ordinal");
Object.defineProperty(exports, "Ordinal", { enumerable: true, get: function () { return ordinal_1.Ordinal; } });
var identity_1 = require("./identity");
Object.defineProperty(exports, "Identity", { enumerable: true, get: function () { return identity_1.Identity; } });
var point_1 = require("./point");
Object.defineProperty(exports, "Point", { enumerable: true, get: function () { return point_1.Point; } });
var time_1 = require("./time");
Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return time_1.Time; } });
var log_1 = require("./log");
Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return log_1.Log; } });
var pow_1 = require("./pow");
Object.defineProperty(exports, "Pow", { enumerable: true, get: function () { return pow_1.Pow; } });
var threshold_1 = require("./threshold");
Object.defineProperty(exports, "Threshold", { enumerable: true, get: function () { return threshold_1.Threshold; } });
var quantile_1 = require("./quantile");
Object.defineProperty(exports, "Quantile", { enumerable: true, get: function () { return quantile_1.Quantile; } });
var quantize_1 = require("./quantize");
Object.defineProperty(exports, "Quantize", { enumerable: true, get: function () { return quantize_1.Quantize; } });
var sqrt_1 = require("./sqrt");
Object.defineProperty(exports, "Sqrt", { enumerable: true, get: function () { return sqrt_1.Sqrt; } });
var sequential_1 = require("./sequential");
Object.defineProperty(exports, "Sequential", { enumerable: true, get: function () { return sequential_1.Sequential; } });
var constant_1 = require("./constant");
Object.defineProperty(exports, "Constant", { enumerable: true, get: function () { return constant_1.Constant; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./band":1751263816022,"./linear":1751263816023,"./ordinal":1751263816024,"./identity":1751263816025,"./point":1751263816026,"./time":1751263816027,"./log":1751263816028,"./pow":1751263816029,"./threshold":1751263816030,"./quantile":1751263816031,"./quantize":1751263816032,"./sqrt":1751263816033,"./sequential":1751263816034,"./constant":1751263816035}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816022, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Band = void 0;
const scale_1 = require("@antv/scale");
const Band = (options) => {
    return new scale_1.Band(options);
};
exports.Band = Band;
exports.Band.props = {};
//# sourceMappingURL=band.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816023, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Linear = void 0;
const scale_1 = require("@antv/scale");
const Linear = (options) => {
    return new scale_1.Linear(options);
};
exports.Linear = Linear;
exports.Linear.props = {};
//# sourceMappingURL=linear.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816024, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Ordinal = void 0;
const scale_1 = require("@antv/scale");
const Ordinal = (options) => {
    return new scale_1.Ordinal(options);
};
exports.Ordinal = Ordinal;
exports.Ordinal.props = {};
//# sourceMappingURL=ordinal.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816025, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Identity = void 0;
const scale_1 = require("@antv/scale");
const Identity = (options) => {
    return new scale_1.Identity(options);
};
exports.Identity = Identity;
exports.Identity.props = {};
//# sourceMappingURL=identity.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816026, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Point = void 0;
const scale_1 = require("@antv/scale");
const Point = (options) => {
    return new scale_1.Point(options);
};
exports.Point = Point;
exports.Point.props = {};
//# sourceMappingURL=point.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816027, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Time = void 0;
const scale_1 = require("@antv/scale");
const Time = (options) => {
    return new scale_1.Time(options);
};
exports.Time = Time;
exports.Time.props = {};
//# sourceMappingURL=time.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816028, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Log = void 0;
const scale_1 = require("@antv/scale");
const Log = (options) => {
    return new scale_1.Log(options);
};
exports.Log = Log;
exports.Log.props = {};
//# sourceMappingURL=log.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816029, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Pow = void 0;
const scale_1 = require("@antv/scale");
const Pow = (options) => {
    return new scale_1.Pow(options);
};
exports.Pow = Pow;
exports.Pow.props = {};
//# sourceMappingURL=pow.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816030, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Threshold = void 0;
const scale_1 = require("@antv/scale");
const Threshold = (options) => {
    return new scale_1.Threshold(options);
};
exports.Threshold = Threshold;
exports.Threshold.props = {};
//# sourceMappingURL=threshold.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816031, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Quantile = void 0;
const scale_1 = require("@antv/scale");
const Quantile = (options) => {
    return new scale_1.Quantile(options);
};
exports.Quantile = Quantile;
exports.Quantile.props = {};
//# sourceMappingURL=quantile.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816032, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Quantize = void 0;
const scale_1 = require("@antv/scale");
const Quantize = (options) => {
    return new scale_1.Quantize(options);
};
exports.Quantize = Quantize;
exports.Quantize.props = {};
//# sourceMappingURL=quantize.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816033, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sqrt = void 0;
const scale_1 = require("@antv/scale");
const Sqrt = (options) => {
    return new scale_1.Sqrt(options);
};
exports.Sqrt = Sqrt;
exports.Sqrt.props = {};
//# sourceMappingURL=sqrt.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816034, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sequential = void 0;
const scale_1 = require("@antv/scale");
const Sequential = (options) => {
    return new scale_1.Sequential(options);
};
exports.Sequential = Sequential;
exports.Sequential.props = {};
//# sourceMappingURL=sequential.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816035, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Constant = void 0;
const scale_1 = require("@antv/scale");
const Constant = (options) => {
    return new scale_1.Constant(options);
};
exports.Constant = Constant;
exports.Constant.props = {};
//# sourceMappingURL=constant.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816036, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Dark = exports.Light = exports.Academy = exports.ClassicDark = exports.Classic = void 0;
var classic_1 = require("./classic");
Object.defineProperty(exports, "Classic", { enumerable: true, get: function () { return classic_1.Classic; } });
var classicDark_1 = require("./classicDark");
Object.defineProperty(exports, "ClassicDark", { enumerable: true, get: function () { return classicDark_1.ClassicDark; } });
var academy_1 = require("./academy");
Object.defineProperty(exports, "Academy", { enumerable: true, get: function () { return academy_1.Academy; } });
var light_1 = require("./light");
Object.defineProperty(exports, "Light", { enumerable: true, get: function () { return light_1.Light; } });
var dark_1 = require("./dark");
Object.defineProperty(exports, "Dark", { enumerable: true, get: function () { return dark_1.Dark; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./classic":1751263816037,"./classicDark":1751263816040,"./academy":1751263816042,"./light":1751263816038,"./dark":1751263816041}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816037, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Classic = void 0;
const util_1 = require("@antv/util");
const light_1 = require("./light");
/**
 * Default theme.
 */
const Classic = (options) => {
    return (0, util_1.deepMix)({}, (0, light_1.Light)(), {
        category10: 'category10',
        category20: 'category20',
    }, options);
};
exports.Classic = Classic;
exports.Classic.props = {};
//# sourceMappingURL=classic.js.map
}, function(modId) { var map = {"./light":1751263816038}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816038, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Light = exports.tokens = void 0;
const util_1 = require("@antv/util");
const create_1 = require("./create");
exports.tokens = {
    colorBlack: '#1D2129',
    colorWhite: '#ffffff',
    colorStroke: '#416180',
    colorDefault: '#1783FF',
    colorBackground: 'transparent',
    category10: [
        '#1783FF',
        '#00C9C9',
        '#F0884D',
        '#D580FF',
        '#7863FF',
        '#60C42D',
        '#BD8F24',
        '#FF80CA',
        '#2491B3',
        '#17C76F',
    ],
    category20: [
        '#1783FF',
        '#00C9C9',
        '#F0884D',
        '#D580FF',
        '#7863FF',
        '#60C42D',
        '#BD8F24',
        '#FF80CA',
        '#2491B3',
        '#17C76F',
        '#AABA01',
        '#BC7CFC',
        '#237CBC',
        '#2DE379',
        '#CE8032',
        '#FF7AF4',
        '#545FD3',
        '#AFE410',
        '#D8C608',
        '#FFA1E0',
    ],
    padding1: 8,
    padding2: 12,
    padding3: 20,
    alpha90: 0.9,
    alpha65: 0.65,
    alpha45: 0.45,
    alpha25: 0.25,
    alpha10: 0.1,
};
const defaults = (0, create_1.create)(exports.tokens);
/**
 * Default theme.
 */
const Light = (options) => {
    return (0, util_1.deepMix)({}, defaults, options);
};
exports.Light = Light;
exports.Light.props = {};
//# sourceMappingURL=light.js.map
}, function(modId) { var map = {"./create":1751263816039}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816039, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.create = void 0;
function create({ colorDefault, colorBlack, colorWhite, colorStroke, colorBackground, padding1, padding2, padding3, alpha90, alpha65, alpha45, alpha25, alpha10, category10, category20, sizeDefault = 1, padding = 'auto', margin = 16, }) {
    return {
        padding,
        margin,
        size: sizeDefault,
        color: colorDefault,
        category10,
        category20,
        enter: {
            duration: 300,
            fill: 'both',
            delay: 0,
        },
        update: {
            duration: 300,
            fill: 'both',
            delay: 0,
        },
        exit: {
            duration: 300,
            fill: 'both',
            delay: 0,
        },
        view: {
            viewFill: colorBackground,
            plotFill: 'transparent',
            mainFill: 'transparent',
            contentFill: 'transparent',
        },
        line: {
            line: {
                fill: '',
                strokeOpacity: 1,
                lineWidth: 1,
                lineCap: 'round',
            },
        },
        point: {
            point: {
                r: 3,
                fillOpacity: 0.95,
                lineWidth: 0,
            },
            hollow: {
                r: 3,
                strokeOpacity: 0.95,
                lineWidth: 1,
            },
            plus: {
                r: 3,
                strokeOpacity: 0.95,
                lineWidth: 3,
            },
            diamond: {
                r: 3,
                strokeOpacity: 0.95,
                lineWidth: 1,
            },
        },
        interval: {
            rect: {
                fillOpacity: 0.95,
            },
            hollow: {
                fill: '',
                strokeOpacity: 1,
                lineWidth: 2,
            },
        },
        area: {
            area: {
                fillOpacity: 0.85,
                lineWidth: 0,
            },
        },
        polygon: {
            polygon: {
                fillOpacity: 0.95,
            },
        },
        cell: {
            cell: {
                fillOpacity: 0.95,
            },
            hollow: {
                fill: '',
                strokeOpacity: 1,
                lineWidth: 2,
            },
        },
        rect: {
            rect: {
                fillOpacity: 0.95,
            },
            hollow: {
                fill: '',
                strokeOpacity: 1,
                lineWidth: 2,
            },
        },
        link: {
            link: {
                fill: '',
                strokeOpacity: 1,
            },
        },
        vector: {
            vector: {
                fillOpacity: 1,
            },
        },
        box: {
            box: {
                fillOpacity: 0.95,
                stroke: colorBlack,
                lineWidth: 1,
            },
        },
        text: {
            text: {
                fill: '#1D2129',
                fontSize: 12,
                lineWidth: 0,
                connectorStroke: colorStroke,
                connectorStrokeOpacity: 0.45,
                connectorLineWidth: 1,
                backgroundFill: colorStroke,
                backgroundFillOpacity: 0.15,
                backgroundPadding: [2, 4],
                startMarkerSymbol: 'circle',
                startMarkerSize: 4,
                endMarkerSymbol: 'circle',
                endMarkerSize: 4,
            },
            badge: {
                fill: '#1D2129',
                fillOpacity: 0.65,
                lineWidth: 0,
                fontSize: 10,
                textAlign: 'center',
                textBaseline: 'middle',
                markerFill: colorStroke,
                markerFillOpacity: 0.25,
                markerStrokeOpacity: 0,
            },
        },
        lineX: {
            line: {
                stroke: colorStroke,
                strokeOpacity: 0.45,
                lineWidth: 1,
            },
        },
        lineY: {
            line: {
                stroke: colorStroke,
                strokeOpacity: 0.45,
                lineWidth: 1,
            },
        },
        rangeX: {
            range: {
                fill: colorStroke,
                fillOpacity: 0.15,
                lineWidth: 0,
            },
        },
        rangeY: {
            range: {
                fill: colorStroke,
                fillOpacity: 0.15,
                lineWidth: 0,
            },
        },
        connector: {
            connector: {
                stroke: colorStroke,
                strokeOpacity: 0.45,
                lineWidth: 1,
                connectLength1: 12,
                endMarker: true,
                endMarkerSize: 6,
                endMarkerFill: colorStroke,
                endMarkerFillOpacity: 0.95,
            },
        },
        axis: {
            arrow: false,
            gridLineDash: [3, 4],
            gridLineWidth: 0.5,
            gridStroke: colorBlack,
            gridStrokeOpacity: alpha10,
            labelAlign: 'horizontal',
            labelFill: colorBlack,
            labelOpacity: alpha45,
            labelFontSize: 12,
            labelFontWeight: 'normal',
            labelSpacing: padding1,
            line: false,
            lineLineWidth: 0.5,
            lineStroke: colorBlack,
            lineStrokeOpacity: alpha45,
            tickLength: 4,
            tickLineWidth: 1,
            tickStroke: colorBlack,
            tickOpacity: alpha45,
            titleFill: colorBlack,
            titleOpacity: alpha90,
            titleFontSize: 12,
            titleFontWeight: 'normal',
            titleSpacing: 12,
            titleTransformOrigin: 'center',
            lineArrowOffset: 6,
            lineArrowSize: 6,
        },
        axisTop: {
            gridDirection: 'positive',
            labelDirection: 'negative',
            tickDirection: 'negative',
            titlePosition: 'top',
            titleSpacing: 12,
            labelSpacing: 4,
            titleTextBaseline: 'middle',
        },
        axisBottom: {
            gridDirection: 'negative',
            labelDirection: 'positive',
            tickDirection: 'positive',
            titlePosition: 'bottom',
            titleSpacing: 12,
            labelSpacing: 4,
            titleTextBaseline: 'bottom',
            titleTransform: 'translate(0, 8)',
        },
        axisLeft: {
            gridDirection: 'positive',
            labelDirection: 'negative',
            labelSpacing: 4,
            tickDirection: 'negative',
            titlePosition: 'left',
            titleSpacing: 12,
            titleTextBaseline: 'middle',
            titleDirection: 'vertical',
            titleTransform: 'rotate(-90) translate(0, -8)',
            titleTransformOrigin: 'center',
        },
        axisRight: {
            gridDirection: 'negative',
            labelDirection: 'positive',
            labelSpacing: 4,
            tickDirection: 'positive',
            titlePosition: 'right',
            titleSpacing: 12,
            titleTextBaseline: 'top',
            titleDirection: 'vertical',
            titleTransformOrigin: 'center',
        },
        axisLinear: {
            girdClosed: true,
            gridConnect: 'arc',
            gridDirection: 'negative',
            gridType: 'surround',
            titlePosition: 'top',
            titleSpacing: 0,
        },
        axisArc: {
            title: false,
            titlePosition: 'inner',
            line: false,
            tick: true,
            labelSpacing: 4,
        },
        axisRadar: {
            girdClosed: true,
            gridStrokeOpacity: 0.3,
            gridType: 'surround',
            tick: false,
            titlePosition: 'start',
        },
        legendCategory: {
            backgroundFill: 'transparent',
            itemBackgroundFill: 'transparent',
            itemLabelFill: colorBlack,
            itemLabelFillOpacity: alpha90,
            itemLabelFontSize: 12,
            itemLabelFontWeight: 'normal',
            itemMarkerFillOpacity: 1,
            itemMarkerSize: 8,
            itemSpacing: [padding1, padding1],
            itemValueFill: colorBlack,
            itemValueFillOpacity: 0.65,
            itemValueFontSize: 12,
            itemValueFontWeight: 'normal',
            navButtonFill: colorBlack,
            navButtonFillOpacity: 0.65,
            navPageNumFill: colorBlack,
            navPageNumFillOpacity: 0.45,
            navPageNumFontSize: 12,
            padding: 8,
            title: false,
            titleFill: colorBlack,
            titleFillOpacity: 0.65,
            titleFontSize: 12,
            titleFontWeight: 'normal',
            titleSpacing: 4,
            tickStroke: colorBlack,
            tickStrokeOpacity: 0.25,
            rowPadding: padding1,
            colPadding: padding2,
            maxRows: 3,
            maxCols: 3,
        },
        legendContinuous: {
            handleHeight: 12,
            handleLabelFill: colorBlack,
            handleLabelFillOpacity: alpha45,
            handleLabelFontSize: 12,
            handleLabelFontWeight: 'normal',
            handleMarkerFill: colorBlack,
            handleMarkerFillOpacity: 0.6,
            handleMarkerLineWidth: 1,
            handleMarkerStroke: colorBlack,
            handleMarkerStrokeOpacity: 0.25,
            handleWidth: 10,
            labelFill: colorBlack,
            labelFillOpacity: alpha45,
            labelFontSize: 12,
            labelFontWeight: 'normal',
            labelSpacing: 3,
            tick: true,
            tickLength: 12,
            ribbonSize: 12,
            ribbonFill: '#aaa',
            handle: true,
            handleLabel: false,
            handleShape: 'slider',
            handleIconSize: 12 / 1.8,
            indicator: false,
            titleFontSize: 12,
            titleSpacing: 4,
            titleFontWeight: 'normal',
            titleFillOpacity: alpha90,
            tickStroke: colorBlack,
            tickStrokeOpacity: alpha45,
        },
        label: {
            fill: colorBlack,
            fillOpacity: 0.65,
            fontSize: 12,
            fontWeight: 'normal',
            stroke: undefined,
            offset: 12,
            connectorStroke: colorBlack,
            connectorStrokeOpacity: 0.45,
            connectorLineWidth: 1,
            connectorLength: 12,
            connectorLength2: 8,
            connectorDistance: 4,
        },
        innerLabel: {
            fill: colorWhite,
            fontSize: 12,
            fillOpacity: 0.85,
            fontWeight: 'normal',
            stroke: undefined,
            offset: 0,
        },
        htmlLabel: {
            fontSize: 12,
            opacity: 0.65,
            color: colorBlack,
            fontWeight: 'normal',
        },
        slider: {
            trackSize: 16,
            trackFill: colorStroke,
            trackFillOpacity: 1,
            selectionFill: colorDefault,
            selectionFillOpacity: 0.15,
            handleIconSize: 10,
            handleIconFill: '#f7f7f7',
            handleIconFillOpacity: 1,
            handleIconStroke: colorBlack,
            handleIconStrokeOpacity: 0.25,
            handleIconLineWidth: 1,
            handleIconRadius: 2,
            handleLabelFill: colorBlack,
            handleLabelFillOpacity: 0.45,
            handleLabelFontSize: 12,
            handleLabelFontWeight: 'normal',
        },
        scrollbar: {
            padding: [0, 0, 0, 0],
            trackSize: 6,
            isRound: true,
            slidable: true,
            scrollable: true,
            trackFill: '#e5e5e5',
            trackFillOpacity: 0,
            thumbFill: '#000',
            thumbFillOpacity: 0.15,
            thumbHighlightedFillOpacity: 0.2,
        },
        title: {
            spacing: 8,
            titleFill: colorBlack,
            titleFillOpacity: alpha90,
            titleFontSize: 16,
            titleFontWeight: 'bold',
            titleTextBaseline: 'top',
            subtitleFill: colorBlack,
            subtitleFillOpacity: alpha65,
            subtitleFontSize: 12,
            subtitleFontWeight: 'normal',
            subtitleTextBaseline: 'top',
        },
        tooltip: {
            css: {
                '.g2-tooltip': {
                    'font-family': 'sans-serif',
                },
            },
        },
    };
}
exports.create = create;
//# sourceMappingURL=create.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816040, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassicDark = void 0;
const dark_1 = require("./dark");
/**
 * Dark theme.
 */
const ClassicDark = (options) => {
    return Object.assign({}, (0, dark_1.Dark)(), {
        category10: 'category10',
        category20: 'category20',
    }, options);
};
exports.ClassicDark = ClassicDark;
exports.ClassicDark.props = {};
//# sourceMappingURL=classicDark.js.map
}, function(modId) { var map = {"./dark":1751263816041}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816041, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Dark = exports.tokens = void 0;
const util_1 = require("@antv/util");
const create_1 = require("./create");
exports.tokens = {
    colorBlack: '#fff',
    colorWhite: '#000',
    colorStroke: '#416180',
    colorDefault: '#1783FF',
    colorBackground: 'transparent',
    category10: [
        '#1783FF',
        '#00C9C9',
        '#F0884D',
        '#D580FF',
        '#7863FF',
        '#60C42D',
        '#BD8F24',
        '#FF80CA',
        '#2491B3',
        '#17C76F',
    ],
    category20: [
        '#1783FF',
        '#00C9C9',
        '#F0884D',
        '#D580FF',
        '#7863FF',
        '#60C42D',
        '#BD8F24',
        '#FF80CA',
        '#2491B3',
        '#17C76F',
        '#AABA01',
        '#BC7CFC',
        '#237CBC',
        '#2DE379',
        '#CE8032',
        '#FF7AF4',
        '#545FD3',
        '#AFE410',
        '#D8C608',
        '#FFA1E0',
    ],
    padding1: 8,
    padding2: 12,
    padding3: 20,
    alpha90: 0.9,
    alpha65: 0.65,
    alpha45: 0.45,
    alpha25: 0.25,
    alpha10: 0.25,
};
const defaults = (0, create_1.create)(exports.tokens);
const Dark = (options) => {
    return (0, util_1.deepMix)({}, defaults, {
        tooltip: {
            crosshairsStroke: '#fff',
            crosshairsLineWidth: 1,
            crosshairsStrokeOpacity: 0.25,
            css: {
                '.g2-tooltip': {
                    background: '#1f1f1f',
                    opacity: 0.95,
                },
                '.g2-tooltip-title': {
                    color: '#A6A6A6',
                },
                '.g2-tooltip-list-item-name-label': {
                    color: '#A6A6A6',
                },
                '.g2-tooltip-list-item-value': {
                    color: '#A6A6A6',
                },
            },
        },
    }, options);
};
exports.Dark = Dark;
//# sourceMappingURL=dark.js.map
}, function(modId) { var map = {"./create":1751263816039}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816042, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Academy = exports.tokens = void 0;
const util_1 = require("@antv/util");
const create_1 = require("./create");
exports.tokens = {
    colorBlack: '#000',
    colorWhite: '#fff',
    colorStroke: '#888',
    colorDefault: '#4e79a7',
    colorBackground: 'transparent',
    category10: [
        '#4e79a7',
        '#f28e2c',
        '#e15759',
        '#76b7b2',
        '#59a14f',
        '#edc949',
        '#af7aa1',
        '#ff9da7',
        '#9c755f',
        '#bab0ab',
    ],
    category20: [
        '#4e79a7',
        '#f28e2c',
        '#e15759',
        '#76b7b2',
        '#59a14f',
        '#edc949',
        '#af7aa1',
        '#ff9da7',
        '#9c755f',
        '#bab0ab',
    ],
    padding1: 8,
    padding2: 12,
    padding3: 20,
    alpha90: 0.9,
    alpha65: 0.65,
    alpha45: 0.45,
    alpha25: 0.25,
    alpha10: 0.1,
};
const defaults = (0, create_1.create)(exports.tokens);
const Academy = (options) => {
    return (0, util_1.deepMix)({}, defaults, {
        text: { text: { fontSize: 10 } },
        axis: {
            gridLineDash: [0, 0],
            gridLineWidth: 1,
            gridStroke: '#ddd',
            gridStrokeOpacity: 1,
            labelOpacity: 1,
            labelStrokeOpacity: 1,
            labelFontSize: 10,
            line: true,
            lineLineWidth: 1,
            lineStroke: '#888',
            lineStrokeOpacity: 1,
            tickLength: 5,
            tickStrokeOpacity: 1,
            titleOpacity: 1,
            titleStrokeOpacity: 1,
            titleFillOpacity: 1,
            titleFontSize: 11,
            titleFontWeight: 'bold',
        },
        axisLeft: {
            gridFilter: (_, i) => i !== 0,
        },
        axisRight: {
            gridFilter: (_, i) => i !== 0,
        },
        legendCategory: {
            itemLabelFillOpacity: 1,
            itemLabelFontSize: 10,
            itemValueFillOpacity: 1,
            itemValueFontSize: 10,
            titleFillOpacity: 1,
            titleFontSize: 11,
            titleFontWeight: 'bold',
        },
        legendContinuous: {
            handleLabelFontSize: 10,
            labelFillOpacity: 0.45,
            labelFontSize: 10,
        },
        label: {
            fontSize: 10,
        },
        innerLabel: {
            fontSize: 10,
        },
        htmlLabel: {
            fontSize: 10,
        },
        slider: {
            handleLabelFontSize: 10,
            trackFillOpacity: 0.05,
        },
    }, options);
};
exports.Academy = Academy;
exports.Academy.props = {};
//# sourceMappingURL=academy.js.map
}, function(modId) { var map = {"./create":1751263816039}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816043, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Legends = exports.ScrollbarY = exports.ScrollbarX = exports.SliderY = exports.SliderX = exports.TitleComponent = exports.LegendContinuousSize = exports.LegendContinuousBlockSize = exports.LegendContinuousBlock = exports.LegendContinuous = exports.LegendCategory = exports.AxisRadar = exports.AxisY = exports.AxisX = exports.AxisArc = exports.AxisLinear = void 0;
var axis_1 = require("./axis");
Object.defineProperty(exports, "AxisLinear", { enumerable: true, get: function () { return axis_1.LinearAxis; } });
Object.defineProperty(exports, "AxisArc", { enumerable: true, get: function () { return axis_1.ArcAxis; } });
var axisX_1 = require("./axisX");
Object.defineProperty(exports, "AxisX", { enumerable: true, get: function () { return axisX_1.AxisX; } });
var axisY_1 = require("./axisY");
Object.defineProperty(exports, "AxisY", { enumerable: true, get: function () { return axisY_1.AxisY; } });
var axisRadar_1 = require("./axisRadar");
Object.defineProperty(exports, "AxisRadar", { enumerable: true, get: function () { return axisRadar_1.AxisRadar; } });
var legendCategory_1 = require("./legendCategory");
Object.defineProperty(exports, "LegendCategory", { enumerable: true, get: function () { return legendCategory_1.LegendCategory; } });
var legendContinuous_1 = require("./legendContinuous");
Object.defineProperty(exports, "LegendContinuous", { enumerable: true, get: function () { return legendContinuous_1.LegendContinuous; } });
var legendContinuousBlock_1 = require("./legendContinuousBlock");
Object.defineProperty(exports, "LegendContinuousBlock", { enumerable: true, get: function () { return legendContinuousBlock_1.LegendContinuousBlock; } });
var legendContinuousBlockSize_1 = require("./legendContinuousBlockSize");
Object.defineProperty(exports, "LegendContinuousBlockSize", { enumerable: true, get: function () { return legendContinuousBlockSize_1.LegendContinuousBlockSize; } });
var legendContinuousSize_1 = require("./legendContinuousSize");
Object.defineProperty(exports, "LegendContinuousSize", { enumerable: true, get: function () { return legendContinuousSize_1.LegendContinuousSize; } });
var title_1 = require("./title");
Object.defineProperty(exports, "TitleComponent", { enumerable: true, get: function () { return title_1.TitleComponent; } });
var sliderX_1 = require("./sliderX");
Object.defineProperty(exports, "SliderX", { enumerable: true, get: function () { return sliderX_1.SliderX; } });
var sliderY_1 = require("./sliderY");
Object.defineProperty(exports, "SliderY", { enumerable: true, get: function () { return sliderY_1.SliderY; } });
var scrollbarX_1 = require("./scrollbarX");
Object.defineProperty(exports, "ScrollbarX", { enumerable: true, get: function () { return scrollbarX_1.ScrollbarX; } });
var scrollbarY_1 = require("./scrollbarY");
Object.defineProperty(exports, "ScrollbarY", { enumerable: true, get: function () { return scrollbarY_1.ScrollbarY; } });
var legends_1 = require("./legends");
Object.defineProperty(exports, "Legends", { enumerable: true, get: function () { return legends_1.Legends; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./axis":1751263816044,"./axisX":1751263816046,"./axisY":1751263816047,"./axisRadar":1751263816048,"./legendCategory":1751263816049,"./legendContinuous":1751263816050,"./legendContinuousBlock":1751263816051,"./legendContinuousBlockSize":1751263816052,"./legendContinuousSize":1751263816053,"./title":1751263816054,"./sliderX":1751263816055,"./sliderY":1751263816058,"./scrollbarX":1751263816059,"./scrollbarY":1751263816061,"./legends":1751263816062}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816044, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArcAxis = exports.LinearAxis = exports.rotateAxis = void 0;
const component_1 = require("@antv/component");
const scale_1 = require("@antv/scale");
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const d3_format_1 = require("@antv/vendor/d3-format");
const coordinate_1 = require("../utils/coordinate");
const number_1 = require("../utils/number");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
function rotateAxis(axis, options) {
    const { eulerAngles, origin } = options;
    if (origin) {
        axis.setOrigin(origin);
    }
    if (eulerAngles) {
        axis.rotate(eulerAngles[0], eulerAngles[1], eulerAngles[2]);
    }
}
exports.rotateAxis = rotateAxis;
function sizeOf(coordinate) {
    // @ts-ignore
    const { innerWidth, innerHeight, depth } = coordinate.getOptions();
    return [innerWidth, innerHeight, depth];
}
function createFisheye(position, coordinate) {
    const { width, height } = coordinate.getOptions();
    return (tick) => {
        if (!(0, coordinate_1.isFisheye)(coordinate))
            return tick;
        const tickPoint = position === 'bottom' ? [tick, 1] : [0, tick];
        const vector = coordinate.map(tickPoint);
        if (position === 'bottom') {
            const v = vector[0];
            const x = new scale_1.Linear({
                domain: [0, width],
                range: [0, 1],
            });
            return x.map(v);
        }
        else if (position === 'left') {
            const v = vector[1];
            const x = new scale_1.Linear({
                domain: [0, height],
                range: [0, 1],
            });
            return x.map(v);
        }
        return tick;
    };
}
function ticksOf(scale, domain, tickMethod) {
    if (scale.getTicks)
        return scale.getTicks();
    if (!tickMethod)
        return domain;
    const [min, max] = (0, d3_array_1.extent)(domain, (d) => +d);
    const { tickCount } = scale.getOptions();
    return tickMethod(min, max, tickCount);
}
// Set inset for axis.
function createInset(position, coordinate) {
    if ((0, coordinate_1.isPolar)(coordinate))
        return (d) => d;
    const options = coordinate.getOptions();
    const { innerWidth, innerHeight, insetTop, insetBottom, insetLeft, insetRight, } = options;
    const [start, end, size] = position === 'left' || position === 'right'
        ? [insetTop, insetBottom, innerHeight]
        : [insetLeft, insetRight, innerWidth];
    const x = new scale_1.Linear({
        domain: [0, 1],
        range: [start / size, 1 - end / size],
    });
    return (i) => x.map(i);
}
/**
 * Calc ticks based on scale and coordinate.
 */
function getData(scale, domain, tickCount, defaultTickFormatter, tickFilter, tickMethod, position, coordinate) {
    var _a;
    if (tickCount !== undefined || tickMethod !== undefined) {
        scale.update(Object.assign(Object.assign({}, (tickCount && { tickCount })), (tickMethod && { tickMethod })));
    }
    const ticks = ticksOf(scale, domain, tickMethod);
    const filteredTicks = tickFilter ? ticks.filter(tickFilter) : ticks;
    const toString = (d) => d instanceof Date
        ? String(d)
        : typeof d === 'object' && !!d
            ? d
            : String(d);
    const labelFormatter = defaultTickFormatter || ((_a = scale.getFormatter) === null || _a === void 0 ? void 0 : _a.call(scale)) || toString;
    const applyInset = createInset(position, coordinate);
    const applyFisheye = createFisheye(position, coordinate);
    const isHorizontal = (position) => ['top', 'bottom', 'center', 'outer'].includes(position);
    const isVertical = (position) => ['left', 'right'].includes(position);
    // @todo GUI should consider the overlap problem for the first
    // and label of arc axis.
    if ((0, coordinate_1.isPolar)(coordinate) || (0, coordinate_1.isTranspose)(coordinate)) {
        return filteredTicks.map((d, i, array) => {
            var _a, _b;
            const offset = ((_a = scale.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(scale, d)) / 2 || 0;
            const tick = applyInset(scale.map(d) + offset);
            const shouldReverse = ((0, coordinate_1.isRadial)(coordinate) && position === 'center') ||
                ((0, coordinate_1.isTranspose)(coordinate) &&
                    ((_b = scale.getTicks) === null || _b === void 0 ? void 0 : _b.call(scale)) &&
                    isHorizontal(position)) ||
                ((0, coordinate_1.isTranspose)(coordinate) && isVertical(position));
            return {
                value: shouldReverse ? 1 - tick : tick,
                label: toString(labelFormatter((0, number_1.prettyNumber)(d), i, array)),
                id: String(i),
            };
        });
    }
    return filteredTicks.map((d, i, array) => {
        var _a;
        const offset = ((_a = scale.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(scale, d)) / 2 || 0;
        const tick = applyFisheye(applyInset(scale.map(d) + offset));
        const shouldReverse = isVertical(position);
        return {
            value: shouldReverse ? 1 - tick : tick,
            label: toString(labelFormatter((0, number_1.prettyNumber)(d), i, array)),
            id: String(i),
        };
    });
}
function inferGridLength(position, coordinate, plane = 'xy') {
    const [width, height, depth] = sizeOf(coordinate);
    if (plane === 'xy') {
        if (position.includes('bottom') || position.includes('top'))
            return height;
        return width;
    }
    else if (plane === 'xz') {
        if (position.includes('bottom') || position.includes('top'))
            return depth;
        return width;
    }
    else {
        if (position.includes('bottom') || position.includes('top'))
            return height;
        return depth;
    }
}
function inferLabelOverlap(transform = [], style) {
    if (transform.length > 0)
        return transform;
    const { labelAutoRotate, labelAutoHide, labelAutoEllipsis, labelAutoWrap } = style;
    const finalTransforms = [];
    const addToTransforms = (overlap, state) => {
        if (state) {
            finalTransforms.push(Object.assign(Object.assign({}, overlap), state));
        }
    };
    addToTransforms({
        type: 'rotate',
        optionalAngles: [0, 15, 30, 45, 60, 90],
    }, labelAutoRotate);
    addToTransforms({ type: 'ellipsis', minLength: 20 }, labelAutoEllipsis);
    addToTransforms({ type: 'hide' }, labelAutoHide);
    addToTransforms({ type: 'wrap', wordWrapWidth: 100, maxLines: 3, recoveryWhenFail: true }, labelAutoWrap);
    return finalTransforms;
}
function inferArcStyle(position, bbox, innerRadius, outerRadius, coordinate) {
    const { x, y, width, height } = bbox;
    const center = [x + width / 2, y + height / 2];
    const radius = Math.min(width, height) / 2;
    const [startAngle, endAngle] = (0, coordinate_1.angleOf)(coordinate);
    const [w, h] = sizeOf(coordinate);
    const r = Math.min(w, h) / 2;
    const common = {
        center,
        radius,
        startAngle,
        endAngle,
        gridLength: (outerRadius - innerRadius) * r,
    };
    if (position === 'inner') {
        // @ts-ignore
        const { insetLeft, insetTop } = coordinate.getOptions();
        return Object.assign(Object.assign({}, common), { center: [center[0] - insetLeft, center[1] - insetTop], labelAlign: 'perpendicular', labelDirection: 'positive', tickDirection: 'positive', gridDirection: 'negative' });
    }
    // arc outer
    return Object.assign(Object.assign({}, common), { labelAlign: 'parallel', labelDirection: 'negative', tickDirection: 'negative', gridDirection: 'positive' });
}
function inferGrid(value, coordinate, scale) {
    if ((0, coordinate_1.isTheta)(coordinate) || (0, coordinate_1.isParallel)(coordinate))
        return false;
    // Display axis grid for non-discrete values.
    return value === undefined ? !!scale.getTicks : value;
}
function infer3DAxisLinearOverrideStyle(coordinate) {
    // @ts-ignore
    const { depth } = coordinate.getOptions();
    return depth
        ? {
            tickIsBillboard: true,
            lineIsBillboard: true,
            labelIsBillboard: true,
            titleIsBillboard: true,
            gridIsBillboard: true,
        }
        : {};
}
function inferAxisLinearOverrideStyle(position, orientation, bbox, coordinate, xScale) {
    const { x, y, width, height } = bbox;
    if (position === 'bottom') {
        return { startPos: [x, y], endPos: [x + width, y] };
    }
    if (position === 'left') {
        return { startPos: [x + width, y + height], endPos: [x + width, y] };
    }
    if (position === 'right') {
        return { startPos: [x, y + height], endPos: [x, y] };
    }
    if (position === 'top') {
        return { startPos: [x, y + height], endPos: [x + width, y + height] };
    }
    // linear axis, maybe in parallel, polar, radial or radar systems.
    if (position === 'center') {
        // axisY
        if (orientation === 'vertical') {
            return {
                startPos: [x, y],
                endPos: [x, y + height],
            };
        }
        // axisX
        else if (orientation === 'horizontal') {
            return {
                startPos: [x, y],
                endPos: [x + width, y],
            };
        }
        // axis with rotate
        else if (typeof orientation === 'number') {
            const [cx, cy] = coordinate.getCenter();
            const [innerRadius, outerRadius] = (0, coordinate_1.radiusOf)(coordinate);
            const [startAngle, endAngle] = (0, coordinate_1.angleOf)(coordinate);
            const r = Math.min(width, height) / 2;
            // @ts-ignore
            const { insetLeft, insetTop } = coordinate.getOptions();
            const innerR = innerRadius * r;
            const outerR = outerRadius * r;
            const [actualCx, actualCy] = [cx + x - insetLeft, cy + y - insetTop];
            const [cos, sin] = [Math.cos(orientation), Math.sin(orientation)];
            const startPos = [
                actualCx + outerR * cos,
                actualCy + outerR * sin,
            ];
            const endPos = [
                actualCx + innerR * cos,
                actualCy + innerR * sin,
            ];
            const getAxisXDomainLength = () => {
                const { domain } = xScale.getOptions();
                return domain.length;
            };
            const controllAngleCount = (0, coordinate_1.isPolar)(coordinate) && xScale ? getAxisXDomainLength() : 3;
            return {
                startPos,
                endPos,
                gridClosed: Math.abs(endAngle - startAngle - 360) < 1e-6,
                gridCenter: [actualCx, actualCy],
                gridControlAngles: new Array(controllAngleCount)
                    .fill(0)
                    .map((d, i, arr) => ((endAngle - startAngle) / controllAngleCount) * i),
            };
        }
    }
    // position is inner or outer for arc axis won't be here
    return {};
}
const ArcAxisComponent = (options) => {
    const { order, size, position, orientation, labelFormatter, tickFilter, tickCount, tickMethod, important = {}, style = {}, indexBBox, title, grid = false } = options, rest = __rest(options, ["order", "size", "position", "orientation", "labelFormatter", "tickFilter", "tickCount", "tickMethod", "important", "style", "indexBBox", "title", "grid"]);
    return ({ scales: [scale], value, coordinate, theme }) => {
        const { bbox } = value;
        const { domain } = scale.getOptions();
        const data = getData(scale, domain, tickCount, labelFormatter, tickFilter, tickMethod, position, coordinate);
        // Bind computed bbox if exists.
        const labels = indexBBox
            ? data.map((d, i) => {
                const bbox = indexBBox.get(i);
                if (!bbox)
                    return d;
                // bbox: [label, bbox]
                // Make than indexBBox can match current label.
                if (bbox[0] !== d.label)
                    return d;
                return Object.assign(Object.assign({}, d), { bbox: bbox[1] });
            })
            : data;
        const [innerRadius, outerRadius] = (0, coordinate_1.radiusOf)(coordinate);
        const defaultStyle = inferArcStyle(position, bbox, innerRadius, outerRadius, coordinate);
        const { axis: axisTheme, axisArc = {} } = theme;
        const finalStyle = (0, utils_1.adaptor)((0, util_1.deepMix)({}, axisTheme, axisArc, defaultStyle, Object.assign(Object.assign({ type: 'arc', data: labels, titleText: (0, utils_1.titleContent)(title), grid }, rest), important)));
        return new component_1.Axis({
            // @fixme transform is not valid for arcAxis.
            // @ts-ignore
            style: (0, util_1.omit)(finalStyle, ['transform']),
        });
    };
};
function inferThemeStyle(scale, coordinate, theme, direction, position, orientation) {
    const baseStyle = theme.axis;
    const positionStyle = ['top', 'right', 'bottom', 'left'].includes(position)
        ? theme[`axis${(0, helper_1.capitalizeFirst)(position)}`]
        : theme.axisLinear;
    const channel = scale.getOptions().name;
    const channelStyle = theme[`axis${(0, util_1.upperFirst)(channel)}`] || {};
    return Object.assign({}, baseStyle, positionStyle, channelStyle);
}
function inferDefaultStyle(scale, coordinate, theme, direction, position, orientation) {
    const themeStyle = inferThemeStyle(scale, coordinate, theme, direction, position, orientation);
    if (position === 'center') {
        return Object.assign(Object.assign(Object.assign(Object.assign({}, themeStyle), { labelDirection: direction === 'right' ? 'negative' : 'positive' }), (direction === 'center'
            ? { labelTransform: 'translate(50%,0)' }
            : null)), { tickDirection: direction === 'right' ? 'negative' : 'positive', labelSpacing: direction === 'center' ? 0 : 4, titleSpacing: (0, utils_1.isVertical)(orientation) ? 10 : 0, tick: direction === 'center' ? false : undefined });
    }
    return themeStyle;
}
const LinearAxisComponent = (options) => {
    const { direction = 'left', important = {}, labelFormatter, order, orientation, actualPosition, position, size, style = {}, title, tickCount, tickFilter, tickMethod, transform, indexBBox } = options, userDefinitions = __rest(options, ["direction", "important", "labelFormatter", "order", "orientation", "actualPosition", "position", "size", "style", "title", "tickCount", "tickFilter", "tickMethod", "transform", "indexBBox"]);
    return ({ scales, value, coordinate, theme }) => {
        const { bbox } = value;
        const [scale] = scales;
        const { domain, xScale } = scale.getOptions();
        const defaultStyle = inferDefaultStyle(scale, coordinate, theme, direction, position, orientation);
        const internalAxisStyle = Object.assign(Object.assign(Object.assign({}, defaultStyle), style), userDefinitions);
        const gridLength = inferGridLength(actualPosition || position, coordinate, options.plane);
        const overrideStyle = inferAxisLinearOverrideStyle(position, orientation, bbox, coordinate, xScale);
        const threeDOverrideStyle = infer3DAxisLinearOverrideStyle(coordinate);
        const data = getData(scale, domain, tickCount, labelFormatter, tickFilter, tickMethod, position, coordinate);
        // Bind computed bbox if exists.
        const labels = indexBBox
            ? data.map((d, i) => {
                const bbox = indexBBox.get(i);
                if (!bbox)
                    return d;
                // bbox: [label, bbox]
                // Make than indexBBox can match current label.
                if (bbox[0] !== d.label)
                    return d;
                return Object.assign(Object.assign({}, d), { bbox: bbox[1] });
            })
            : data;
        const finalAxisStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, internalAxisStyle), { type: 'linear', data: labels, crossSize: size, titleText: (0, utils_1.titleContent)(title), labelOverlap: inferLabelOverlap(transform, internalAxisStyle), grid: inferGrid(internalAxisStyle.grid, coordinate, scale), gridLength, 
            // Always showLine, make title could align the end of axis.
            line: true, indexBBox }), (!internalAxisStyle.line ? { lineOpacity: 0 } : null)), overrideStyle), threeDOverrideStyle), important);
        // For hide overlap, do not set crossSize.
        const hasHide = finalAxisStyle.labelOverlap.find((d) => d.type === 'hide');
        if (hasHide)
            finalAxisStyle.crossSize = false;
        return new component_1.Axis({
            className: 'axis',
            style: (0, utils_1.adaptor)(finalAxisStyle),
        });
    };
};
const axisFactor = (axis) => {
    return (options) => {
        const { labelFormatter: useDefinedLabelFormatter, labelFilter: userDefinedLabelFilter = () => true, } = options;
        return (context) => {
            var _a;
            const { scales: [scale], } = context;
            const ticks = ((_a = scale.getTicks) === null || _a === void 0 ? void 0 : _a.call(scale)) || scale.getOptions().domain;
            const labelFormatter = typeof useDefinedLabelFormatter === 'string'
                ? (0, d3_format_1.format)(useDefinedLabelFormatter)
                : useDefinedLabelFormatter;
            const labelFilter = (datum, index, array) => userDefinedLabelFilter(ticks[index], index, ticks);
            const normalizedOptions = Object.assign(Object.assign({}, options), { labelFormatter,
                labelFilter,
                scale });
            return axis(normalizedOptions)(context);
        };
    };
};
exports.LinearAxis = axisFactor(LinearAxisComponent);
exports.ArcAxis = axisFactor(ArcAxisComponent);
exports.LinearAxis.props = {
    defaultPosition: 'center',
    defaultSize: 45,
    defaultOrder: 0,
    defaultCrossPadding: [12, 12],
    defaultPadding: [12, 12],
};
exports.ArcAxis.props = {
    defaultPosition: 'outer',
    defaultOrientation: 'vertical',
    defaultSize: 45,
    defaultOrder: 0,
    defaultCrossPadding: [12, 12],
    defaultPadding: [12, 12],
};
//# sourceMappingURL=axis.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../utils/number":1751263815884,"../utils/helper":1751263815829,"./utils":1751263816045}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816045, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.adaptor = exports.domainOf = exports.inferComponentShape = exports.isVertical = exports.isHorizontal = exports.scaleOf = exports.LegendCategoryLayout = exports.G2Layout = exports.inferComponentLayout = exports.titleContent = exports.maybeAppend = exports.createComponent = void 0;
const g_1 = require("@antv/g");
const component_1 = require("@antv/component");
const util_1 = require("@antv/util");
const selection_1 = require("../utils/selection");
function createComponent(descriptor) {
    return class extends g_1.CustomElement {
        constructor(config) {
            super(config);
            this.descriptor = descriptor;
        }
        connectedCallback() {
            var _a, _b;
            (_b = (_a = this.descriptor).render) === null || _b === void 0 ? void 0 : _b.call(_a, this.attributes, this);
        }
        update(cfg = {}) {
            var _a, _b;
            this.attr((0, util_1.deepMix)({}, this.attributes, cfg));
            (_b = (_a = this.descriptor).render) === null || _b === void 0 ? void 0 : _b.call(_a, this.attributes, this);
        }
    };
}
exports.createComponent = createComponent;
function maybeAppend(parent, selector, node) {
    if (!parent.querySelector(selector)) {
        return (0, selection_1.select)(parent).append(node);
    }
    return (0, selection_1.select)(parent).select(selector);
}
exports.maybeAppend = maybeAppend;
function titleContent(field) {
    return Array.isArray(field) ? field.join(', ') : `${field || ''}`;
}
exports.titleContent = titleContent;
function inferComponentLayout(position, userDefinitions) {
    const preset = {
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'flex-start',
        alignItems: 'center',
    };
    let { flexDirection, justifyContent, alignItems } = preset;
    const layout = {
        top: ['row', 'flex-start', 'center'],
        bottom: ['row', 'flex-start', 'center'],
        left: ['column', 'flex-start', 'center'],
        right: ['column', 'flex-start', 'center'],
        center: ['column', 'center', 'center'],
    };
    if (position in layout) {
        [flexDirection, justifyContent, alignItems] = layout[position];
    }
    return Object.assign({ display: 'flex', flexDirection,
        justifyContent,
        alignItems }, userDefinitions);
}
exports.inferComponentLayout = inferComponentLayout;
class G2Layout extends component_1.Layout {
    get child() {
        var _a;
        return (_a = this.children) === null || _a === void 0 ? void 0 : _a[0];
    }
    update(options) {
        var _a;
        this.attr(options);
        const { subOptions } = options;
        (_a = this.child) === null || _a === void 0 ? void 0 : _a.update(subOptions);
    }
}
exports.G2Layout = G2Layout;
class LegendCategoryLayout extends G2Layout {
    update(options) {
        var _a;
        const { subOptions } = options;
        this.attr(options);
        (_a = this.child) === null || _a === void 0 ? void 0 : _a.update(subOptions);
    }
}
exports.LegendCategoryLayout = LegendCategoryLayout;
function scaleOf(scales, type) {
    var _a;
    return (_a = scales.filter((s) => s.getOptions().name === type)) === null || _a === void 0 ? void 0 : _a[0];
}
exports.scaleOf = scaleOf;
function isHorizontal(orientation) {
    return orientation === 'horizontal' || orientation === 0;
}
exports.isHorizontal = isHorizontal;
function isVertical(orientation) {
    return orientation === 'vertical' || orientation === -Math.PI / 2;
}
exports.isVertical = isVertical;
function inferComponentShape(value, options, component) {
    const { bbox } = value;
    const { position = 'top', size: userDefinedSize, length: userDefinedLength, } = options;
    const isHorizontal = ['top', 'bottom', 'center'].includes(position);
    const [bboxSize, bboxLength] = isHorizontal
        ? [bbox.height, bbox.width]
        : [bbox.width, bbox.height];
    const { defaultSize, defaultLength } = component.props;
    const size = userDefinedSize || defaultSize || bboxSize;
    const length = userDefinedLength || defaultLength || bboxLength;
    const orientation = isHorizontal ? 'horizontal' : 'vertical';
    const [width, height] = isHorizontal ? [length, size] : [size, length];
    return {
        orientation,
        width,
        height,
        size,
        length,
    };
}
exports.inferComponentShape = inferComponentShape;
function domainOf(scales) {
    // to get a available scale's domain
    return scales
        .find((scale) => scale.getOptions().domain.length > 0)
        .getOptions().domain;
}
exports.domainOf = domainOf;
function adaptor(style) {
    const reservedKeys = [
        'arrow',
        'crosshairs',
        'grid',
        'handle',
        'handleLabel',
        'indicator',
        'label',
        'line',
        'tick',
        'tip',
        'title',
        'trunc',
    ];
    // @ts-ignore
    const { style: styles } = style, rest = __rest(style, ["style"]);
    const finalStyle = {};
    Object.entries(rest).forEach(([key, value]) => {
        if (reservedKeys.includes(key)) {
            finalStyle[`show${(0, util_1.upperFirst)(key)}`] = value;
        }
        else
            finalStyle[key] = value;
    });
    return Object.assign(Object.assign({}, finalStyle), styles);
}
exports.adaptor = adaptor;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {"../utils/selection":1751263815883}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816046, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.axisXConfig = exports.AxisX = void 0;
const axis_1 = require("./axis");
/**
 * LinearAxis component bind to x scale.
 */
const AxisX = (options) => {
    return (...args) => {
        // empirical value for crossPadding
        const axisX = (0, axis_1.LinearAxis)(Object.assign({}, { crossPadding: 50 }, options))(...args);
        (0, axis_1.rotateAxis)(axisX, options);
        return axisX;
    };
};
exports.AxisX = AxisX;
exports.AxisX.props = Object.assign(Object.assign({}, axis_1.LinearAxis.props), { defaultPosition: 'bottom' });
function axisXConfig() { }
exports.axisXConfig = axisXConfig;
//# sourceMappingURL=axisX.js.map
}, function(modId) { var map = {"./axis":1751263816044}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816047, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.AxisY = void 0;
const axis_1 = require("./axis");
/**
 * LinearAxis component bind to y scale.
 */
const AxisY = (options) => {
    return (...args) => {
        const axisY = (0, axis_1.LinearAxis)(Object.assign({}, { crossPadding: 10 }, options))(...args);
        (0, axis_1.rotateAxis)(axisY, options);
        return axisY;
    };
};
exports.AxisY = AxisY;
exports.AxisY.props = Object.assign(Object.assign({}, axis_1.LinearAxis.props), { defaultPosition: 'left' });
//# sourceMappingURL=axisY.js.map
}, function(modId) { var map = {"./axis":1751263816044}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816048, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AxisRadar = void 0;
const coordinate_1 = require("../utils/coordinate");
const axis_1 = require("./axis");
function inferTitleTransform(orientation) {
    const internalOrientation = orientation % (Math.PI * 2);
    if (internalOrientation === Math.PI / 2) {
        return { titleTransform: 'translate(0, 50%)' };
    }
    if (internalOrientation > -Math.PI / 2 && internalOrientation < Math.PI / 2) {
        return { titleTransform: 'translate(50%, 0)' };
    }
    if (internalOrientation > Math.PI / 2 &&
        internalOrientation < (Math.PI * 3) / 2) {
        return { titleTransform: 'translate(-50%, 0)' };
    }
    return {};
}
function inferAxisStyle(options, theme, coordinate, scales) {
    const { radar } = options;
    const [scale] = scales;
    const name = scale.getOptions().name;
    const [startAngle, endAngle] = (0, coordinate_1.angleOf)(coordinate);
    const { axisRadar: radarTheme = {} } = theme;
    return Object.assign(Object.assign({}, radarTheme), { grid: name === 'position', gridConnect: 'line', gridControlAngles: new Array(radar.count).fill(0).map((_, i) => {
            const angle = (endAngle - startAngle) / radar.count;
            return angle * i;
        }) });
}
const AxisRadar = (options) => {
    const { important = {} } = options, restOptions = __rest(options, ["important"]);
    return (context) => {
        const { theme, coordinate, scales } = context;
        return (0, axis_1.LinearAxis)(Object.assign(Object.assign(Object.assign({}, restOptions), inferTitleTransform(options.orientation)), { important: Object.assign(Object.assign({}, inferAxisStyle(options, theme, coordinate, scales)), important) }))(context);
    };
};
exports.AxisRadar = AxisRadar;
exports.AxisRadar.props = Object.assign(Object.assign({}, axis_1.LinearAxis.props), { defaultPosition: 'center' });
//# sourceMappingURL=axisRadar.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"./axis":1751263816044}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816049, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendCategory = void 0;
const component_1 = require("@antv/component");
const util_1 = require("@antv/util");
const d3_format_1 = require("@antv/vendor/d3-format");
const scale_1 = require("@antv/scale");
const marker_1 = require("../utils/marker");
const utils_1 = require("./utils");
function inferShape(scales, markState) {
    const shapeScale = (0, utils_1.scaleOf)(scales, 'shape');
    const colorScale = (0, utils_1.scaleOf)(scales, 'color');
    // NOTE!!!
    // scaleOrdinal.map will mute domain.
    const shapeScale1 = shapeScale ? shapeScale.clone() : null;
    // Infer the main shape if multiple marks are used.
    const shapes = [];
    for (const [mark, state] of markState) {
        const namespace = mark.type;
        const domain = (colorScale === null || colorScale === void 0 ? void 0 : colorScale.getOptions().domain.length) > 0
            ? colorScale === null || colorScale === void 0 ? void 0 : colorScale.getOptions().domain
            : state.data;
        const shape = domain.map((d, i) => {
            var _a;
            if (shapeScale1)
                return shapeScale1.map(d || 'point');
            return ((_a = mark === null || mark === void 0 ? void 0 : mark.style) === null || _a === void 0 ? void 0 : _a.shape) || state.defaultShape || 'point';
        });
        if (typeof namespace === 'string')
            shapes.push([namespace, shape]);
    }
    if (shapes.length === 0)
        return ['point', ['point']];
    if (shapes.length === 1)
        return shapes[0];
    if (!shapeScale)
        return shapes[0];
    // Evaluate the maximum likelihood of shape
    const { range } = shapeScale.getOptions();
    return shapes
        .map(([namespace, shape]) => {
        let sum = 0;
        for (let i = 0; i < shapes.length; i++) {
            const targetShape = range[i % range.length];
            if (shape[i] === targetShape)
                sum++;
        }
        return [sum / shape.length, [namespace, shape]];
    })
        .sort((a, b) => b[0] - a[0])[0][1];
}
function inferItemMarker(options, context) {
    const { scales, library, markState } = context;
    const [mark, shapes] = inferShape(scales, markState);
    const { itemMarker, itemMarkerSize: size } = options;
    const create = (name, d) => {
        var _a, _b, _c;
        const marker = ((_c = (_b = (_a = library[`mark.${mark}`]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.shape[name]) === null || _c === void 0 ? void 0 : _c.props.defaultMarker) || (0, util_1.last)(name.split('.'));
        const radius = typeof size === 'function' ? size(d) : size;
        return () => (0, marker_1.useMarker)(marker, { color: d.color })(0, 0, radius);
    };
    const shapeOf = (i) => `${shapes[i]}`;
    const shapeScale = (0, utils_1.scaleOf)(scales, 'shape');
    if (shapeScale && !itemMarker)
        return (d, i) => create(shapeOf(i), d);
    if (typeof itemMarker === 'function') {
        return (d, i) => {
            // @todo Fix this in GUI.
            // It should pass primitive value rather object.
            const node = itemMarker(d.id, i);
            if (typeof node === 'string')
                return create(node, d);
            return node;
        };
    }
    return (d, i) => create(itemMarker || shapeOf(i), d);
}
function inferItemMarkerOpacity(scales) {
    const scale = (0, utils_1.scaleOf)(scales, 'opacity');
    if (scale) {
        const { range } = scale.getOptions();
        return (d, i) => range[i];
    }
    return undefined;
}
function inferItemMarkerSize(scales, defaults) {
    const scale = (0, utils_1.scaleOf)(scales, 'size');
    if (scale instanceof scale_1.Identity)
        return scale.map(NaN) * 2;
    return defaults;
}
function inferCategoryStyle(options, context) {
    const { labelFormatter = (d) => `${d}` } = options;
    const { scales, theme } = context;
    const defaultSize = theme.legendCategory.itemMarkerSize;
    const itemMarkerSize = inferItemMarkerSize(scales, defaultSize);
    const baseStyle = {
        itemMarker: inferItemMarker(Object.assign(Object.assign({}, options), { itemMarkerSize }), context),
        itemMarkerSize: itemMarkerSize,
        itemMarkerOpacity: inferItemMarkerOpacity(scales),
    };
    const finalLabelFormatter = typeof labelFormatter === 'string'
        ? (0, d3_format_1.format)(labelFormatter)
        : labelFormatter;
    const colorScale = (0, utils_1.scaleOf)(scales, 'color');
    const domain = (0, utils_1.domainOf)(scales);
    const colorOf = colorScale
        ? (d) => colorScale.map(d)
        : () => context.theme.color;
    return Object.assign(Object.assign({}, baseStyle), { data: domain.map((d) => ({
            id: d,
            label: finalLabelFormatter(d),
            color: colorOf(d),
        })) });
}
function inferLegendShape(value, options, component) {
    const { position } = options;
    if (position === 'center') {
        const { bbox } = value;
        // to be confirm: if position is center, we should use the width and height of user definition.
        const { width, height } = bbox;
        return { width, height };
    }
    const { width, height } = (0, utils_1.inferComponentShape)(value, options, component);
    return { width, height };
}
function filterEmptyIds(legendStyle) {
    return Object.assign(Object.assign({}, legendStyle), { data: (legendStyle === null || legendStyle === void 0 ? void 0 : legendStyle.data.filter((item) => item.id !== '')) || [] });
}
/**
 * Guide Component for ordinal color scale.
 */
const LegendCategory = (options) => {
    const { labelFormatter, layout, order, orientation, position, size, title, cols, itemMarker } = options, style = __rest(options, ["labelFormatter", "layout", "order", "orientation", "position", "size", "title", "cols", "itemMarker"]);
    const { gridRow } = style;
    return (context) => {
        const { value, theme } = context;
        const { bbox } = value;
        const { width, height } = inferLegendShape(value, options, exports.LegendCategory);
        const finalLayout = (0, utils_1.inferComponentLayout)(position, layout);
        const legendStyle = Object.assign(Object.assign(Object.assign(Object.assign({ orientation: ['right', 'left', 'center'].includes(position)
                ? 'vertical'
                : 'horizontal', width,
            height, layout: cols !== undefined ? 'grid' : 'flex' }, (cols !== undefined && { gridCol: cols })), (gridRow !== undefined && { gridRow })), { titleText: (0, utils_1.titleContent)(title) }), inferCategoryStyle(options, context));
        const { legendCategory: legendTheme = {} } = theme;
        // Filter out the data items with empty string IDs in the wordCloud's data before generating the legend.
        const categoryStyle = (0, utils_1.adaptor)(Object.assign({}, legendTheme, filterEmptyIds(legendStyle), style));
        const layoutWrapper = new utils_1.LegendCategoryLayout({
            style: Object.assign(Object.assign({ x: bbox.x, y: bbox.y, width: bbox.width, height: bbox.height }, finalLayout), { 
                // @ts-ignore
                subOptions: categoryStyle }),
        });
        layoutWrapper.appendChild(new component_1.Category({
            className: 'legend-category',
            style: categoryStyle,
        }));
        return layoutWrapper;
    };
};
exports.LegendCategory = LegendCategory;
exports.LegendCategory.props = {
    defaultPosition: 'top',
    defaultOrder: 1,
    defaultSize: 40,
    defaultCrossPadding: [12, 12],
    defaultPadding: [12, 12],
};
//# sourceMappingURL=legendCategory.js.map
}, function(modId) { var map = {"../utils/marker":1751263815899,"./utils":1751263816045}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816050, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendContinuous = void 0;
const g_1 = require("@antv/g");
const component_1 = require("@antv/component");
const scale_1 = require("@antv/scale");
const d3_format_1 = require("@antv/vendor/d3-format");
const array_1 = require("../utils/array");
const utils_1 = require("./utils");
function updateShapeDimensions(shape, finalSize, orientation) {
    shape.size = finalSize;
    if ((0, utils_1.isHorizontal)(orientation)) {
        shape.height = finalSize;
    }
    else {
        shape.width = finalSize;
    }
    return shape;
}
function inferContinuousShape(value, options, component) {
    const { size } = options;
    const shape = (0, utils_1.inferComponentShape)(value, options, component);
    return updateShapeDimensions(shape, size, shape.orientation);
}
function getFormatter(max) {
    return (value) => ({
        value: value / max,
        label: String(value),
    });
}
function getQuantizeOrQuantileConfig(shape, colorScale, min, max, range) {
    const thresholds = colorScale.thresholds;
    const formatter = getFormatter(max);
    return Object.assign(Object.assign({}, shape), { color: range, data: [min, ...thresholds, max].map(formatter) });
}
function getThresholdConfig(shape, colorScale, range) {
    const thresholds = colorScale.thresholds;
    const data = [-Infinity, ...thresholds, Infinity].map((value, index) => ({
        value: index,
        label: value,
    }));
    return Object.assign(Object.assign({}, shape), { data, color: range, labelFilter: (datum, index) => {
            return index > 0 && index < data.length - 1;
        } });
}
function rangeOf(scale) {
    const { domain } = scale.getOptions();
    const [min, max] = [domain[0], (0, array_1.lastOf)(domain)];
    return [min, max];
}
/**
 * if color scale is not defined, create a constant color scale based on default color
 * @param scale
 * @param theme
 */
function createColorScale(scale, defaultColor) {
    const options = scale.getOptions();
    const newScale = scale.clone();
    newScale.update(Object.assign(Object.assign({}, options), { range: [(0, g_1.parseColor)(defaultColor).toString()] }));
    return newScale;
}
function getLinearConfig(shape, colorScale, sizeScale, opacityScale, scales, theme) {
    const { length } = shape;
    const definedScale = sizeScale || opacityScale;
    // Only use defaultColor when there is no color scale
    // in this view.
    const defaultColor = scales.color
        ? theme.legendContinuous.ribbonFill || 'black'
        : theme.color;
    const scale = colorScale || createColorScale(definedScale, defaultColor);
    const [min, max] = rangeOf(scale);
    const [domainMin, domainMax] = rangeOf([colorScale, sizeScale, opacityScale]
        .filter((d) => d !== undefined)
        .find((d) => !(d instanceof scale_1.Constant)));
    return Object.assign(Object.assign({}, shape), { domain: [domainMin, domainMax], data: scale.getTicks().map((value) => ({ value })), color: new Array(Math.floor(length)).fill(0).map((d, i) => {
            const value = ((max - min) / (length - 1)) * i + min;
            const color = scale.map(value) || defaultColor;
            const opacity = opacityScale ? opacityScale.map(value) : 1;
            return color.replace(/rgb[a]*\(([\d]{1,3}) *, *([\d]{1,3}) *, *([\d]{1,3})[\S\s]*\)/, (match, p1, p2, p3) => `rgba(${p1}, ${p2}, ${p3}, ${opacity})`);
        }) });
}
function inferContinuousConfig(scales, scale, value, options, component, theme) {
    const colorScale = (0, utils_1.scaleOf)(scales, 'color');
    const shape = inferContinuousShape(value, options, component);
    if (colorScale instanceof scale_1.Threshold) {
        const { range } = colorScale.getOptions();
        const [min, max] = rangeOf(colorScale);
        // for quantize, quantile scale
        if (colorScale instanceof scale_1.Quantize || colorScale instanceof scale_1.Quantile) {
            return getQuantizeOrQuantileConfig(shape, colorScale, min, max, range);
        }
        // for threshold
        return getThresholdConfig(shape, colorScale, range);
    }
    // for linear, pow, sqrt, log, time, utc scale
    const sizeScale = (0, utils_1.scaleOf)(scales, 'size');
    const opacityScale = (0, utils_1.scaleOf)(scales, 'opacity');
    return getLinearConfig(shape, colorScale, sizeScale, opacityScale, scale, theme);
}
/**
 * Guide Component for continuous color scale.
 * @todo Custom style.
 */
const LegendContinuous = (options) => {
    const { labelFormatter, layout, order, orientation, position, size, title, style, crossPadding, padding } = options, rest = __rest(options, ["labelFormatter", "layout", "order", "orientation", "position", "size", "title", "style", "crossPadding", "padding"]);
    return ({ scales, value, theme, scale }) => {
        const { bbox } = value;
        const { x, y, width, height } = bbox;
        const finalLayout = (0, utils_1.inferComponentLayout)(position, layout);
        const { legendContinuous: legendTheme = {} } = theme;
        const finalStyle = (0, utils_1.adaptor)(Object.assign({}, legendTheme, Object.assign(Object.assign({ titleText: (0, utils_1.titleContent)(title), labelAlign: 'value', labelFormatter: typeof labelFormatter === 'string'
                ? (d) => (0, d3_format_1.format)(labelFormatter)(d.label)
                : labelFormatter }, inferContinuousConfig(scales, scale, value, options, exports.LegendContinuous, theme)), style), rest));
        const layoutWrapper = new utils_1.G2Layout({
            style: Object.assign(Object.assign({ x,
                y,
                width,
                height }, finalLayout), { 
                // @ts-ignore
                subOptions: finalStyle }),
        });
        layoutWrapper.appendChild(new component_1.Continuous({
            className: 'legend-continuous',
            style: finalStyle,
        }));
        return layoutWrapper;
    };
};
exports.LegendContinuous = LegendContinuous;
exports.LegendContinuous.props = {
    defaultPosition: 'top',
    defaultOrientation: 'vertical',
    defaultOrder: 1,
    defaultSize: 60,
    defaultLength: 200,
    defaultLegendSize: 60,
    defaultPadding: [20, 10],
    defaultCrossPadding: [12, 12], // [horizontal, vertical]
};
//# sourceMappingURL=legendContinuous.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"./utils":1751263816045}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816051, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendContinuousBlock = void 0;
const legendContinuous_1 = require("./legendContinuous");
const LegendContinuousBlock = (options) => {
    return (...args) => (0, legendContinuous_1.LegendContinuous)(Object.assign({}, { block: true }, options))(...args);
};
exports.LegendContinuousBlock = LegendContinuousBlock;
exports.LegendContinuousBlock.props = Object.assign(Object.assign({}, legendContinuous_1.LegendContinuous.props), { defaultPosition: 'top', defaultOrientation: 'horizontal' });
//# sourceMappingURL=legendContinuousBlock.js.map
}, function(modId) { var map = {"./legendContinuous":1751263816050}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816052, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendContinuousBlockSize = void 0;
const legendContinuous_1 = require("./legendContinuous");
const legendContinuousSize_1 = require("./legendContinuousSize");
const LegendContinuousBlockSize = (options) => {
    return (0, legendContinuousSize_1.LegendContinuousSize)(Object.assign({}, { block: true }, options));
};
exports.LegendContinuousBlockSize = LegendContinuousBlockSize;
exports.LegendContinuousBlockSize.props = Object.assign(Object.assign({}, legendContinuous_1.LegendContinuous.props), { defaultPosition: 'top', defaultOrientation: 'horizontal' });
//# sourceMappingURL=legendContinuousBlockSize.js.map
}, function(modId) { var map = {"./legendContinuous":1751263816050,"./legendContinuousSize":1751263816053}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816053, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendContinuousSize = void 0;
const utils_1 = require("./utils");
const legendContinuous_1 = require("./legendContinuous");
const LegendContinuousSize = (options) => {
    return (context) => {
        const { scales } = context;
        const sizeScale = (0, utils_1.scaleOf)(scales, 'size');
        return (0, legendContinuous_1.LegendContinuous)(Object.assign({}, {
            type: 'size',
            data: sizeScale.getTicks().map((value, index) => ({
                value,
                label: String(value),
            })),
        }, options))(context);
    };
};
exports.LegendContinuousSize = LegendContinuousSize;
exports.LegendContinuousSize.props = Object.assign(Object.assign({}, legendContinuous_1.LegendContinuous.props), { defaultPosition: 'top', defaultOrientation: 'horizontal' });
//# sourceMappingURL=legendContinuousSize.js.map
}, function(modId) { var map = {"./utils":1751263816045,"./legendContinuous":1751263816050}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816054, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TitleComponent = void 0;
const util_1 = require("@antv/util");
const utils_1 = require("../shape/utils");
const helper_1 = require("../utils/helper");
const utils_2 = require("./utils");
function inferStyleByAlign(x, y, width, align) {
    switch (align) {
        case 'center':
            return {
                x: x + width / 2,
                y,
                textAlign: 'middle',
            };
        case 'right':
            return {
                x: x + width,
                y,
                textAlign: 'right',
            };
        default:
            return {
                x,
                y,
                textAlign: 'left',
            };
    }
}
const Title = (0, utils_2.createComponent)({
    render(attributes, container) {
        const { width, title, subtitle, spacing = 2, align = 'left', x, y } = attributes, style = __rest(attributes, ["width", "title", "subtitle", "spacing", "align", "x", "y"]);
        container.style.transform = `translate(${x}, ${y})`;
        const titleStyle = (0, helper_1.subObject)(style, 'title');
        const subtitleStyle = (0, helper_1.subObject)(style, 'subtitle');
        const mainTitle = (0, utils_2.maybeAppend)(container, '.title', 'text')
            .attr('className', 'title')
            .call(utils_1.applyStyle, Object.assign(Object.assign(Object.assign({}, inferStyleByAlign(0, 0, width, align)), { fontSize: 14, textBaseline: 'top', text: title }), titleStyle))
            .node();
        const bounds = mainTitle.getLocalBounds();
        (0, utils_2.maybeAppend)(container, '.sub-title', 'text')
            .attr('className', 'sub-title')
            .call((selection) => {
            if (!subtitle)
                return selection.node().remove();
            selection.node().attr(Object.assign(Object.assign(Object.assign({}, inferStyleByAlign(0, bounds.max[1] + spacing, width, align)), { fontSize: 12, textBaseline: 'top', text: subtitle }), subtitleStyle));
        });
    },
});
/**
 * Title Component.
 */
const TitleComponent = (options) => {
    return ({ value, theme }) => {
        const { x, y, width, height } = value.bbox;
        return new Title({
            style: (0, util_1.deepMix)({}, theme.title, Object.assign({ x,
                y,
                width,
                height }, options)),
        });
    };
};
exports.TitleComponent = TitleComponent;
exports.TitleComponent.props = {
    defaultPosition: 'top',
    defaultOrder: 2,
    defaultSize: 36,
    defaultCrossPadding: [20, 20],
    defaultPadding: [12, 12],
};
//# sourceMappingURL=title.js.map
}, function(modId) { var map = {"../shape/utils":1751263815885,"../utils/helper":1751263815829,"./utils":1751263816045}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816055, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SliderX = void 0;
const slider_1 = require("./slider");
/**
 * SliderX component.
 */
const SliderX = (options) => {
    return (0, slider_1.Slider)(Object.assign(Object.assign({}, options), { orientation: 'horizontal' }));
};
exports.SliderX = SliderX;
exports.SliderX.props = Object.assign(Object.assign({}, slider_1.Slider.props), { defaultPosition: 'bottom' });
//# sourceMappingURL=sliderX.js.map
}, function(modId) { var map = {"./slider":1751263816056}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816056, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Slider = void 0;
const component_1 = require("@antv/component");
const d3_format_1 = require("@antv/vendor/d3-format");
const util_1 = require("@antv/util");
const coordinate_1 = require("../utils/coordinate");
const scale_1 = require("../utils/scale");
function inferPosition(bbox, position, trackSize) {
    const { x, y, width, height } = bbox;
    if (position === 'left')
        return [x + width - trackSize, y];
    if (position === 'right')
        return [x, y];
    if (position === 'bottom')
        return [x, y];
    if (position === 'top')
        return [x, y + height - trackSize];
}
/**
 * Slider component.
 */
const Slider = (options) => {
    // do not pass size.
    const { orientation, labelFormatter, size, style = {}, position } = options, rest = __rest(options, ["orientation", "labelFormatter", "size", "style", "position"]);
    return (context) => {
        var _a;
        const { scales: [scale], value, theme, coordinate, } = context;
        const { bbox } = value;
        const { width, height } = bbox;
        const { slider: sliderTheme = {} } = theme;
        const defaultFormatter = ((_a = scale.getFormatter) === null || _a === void 0 ? void 0 : _a.call(scale)) || ((v) => v + '');
        const formatter = typeof labelFormatter === 'string'
            ? (0, d3_format_1.format)(labelFormatter)
            : labelFormatter;
        const isHorizontal = orientation === 'horizontal';
        const reverse = (0, coordinate_1.isTranspose)(coordinate) && isHorizontal;
        const { trackSize = sliderTheme.trackSize } = style;
        const [x0, y0] = inferPosition(bbox, position, trackSize);
        return new component_1.Slider({
            className: 'slider',
            style: Object.assign({}, sliderTheme, Object.assign(Object.assign({ x: x0, y: y0, trackLength: isHorizontal ? width : height, orientation, formatter: (v) => {
                    const f = formatter || defaultFormatter;
                    const v1 = reverse ? 1 - v : v;
                    const tick = (0, scale_1.invert)(scale, v1, true);
                    return f(tick);
                }, sparklineData: inferSparklineData(options, context) }, style), rest)),
        });
    };
};
exports.Slider = Slider;
function markValue(markState, channels) {
    const [value] = Array.from(markState.entries())
        .filter(([mark]) => mark.type === 'line' || mark.type === 'area')
        .filter(([mark]) => mark.slider)
        .map(([mark]) => {
        const { encode, slider } = mark;
        if (slider === null || slider === void 0 ? void 0 : slider.x) {
            const channel = (name) => {
                const channel = encode[name];
                return [name, channel ? channel.value : undefined];
            };
            return Object.fromEntries(channels.map(channel));
        }
    });
    if (!(value === null || value === void 0 ? void 0 : value.series))
        return value === null || value === void 0 ? void 0 : value.y;
    const result = value.series.reduce((acc, curr, index) => {
        acc[curr] = acc[curr] || [];
        acc[curr].push(value.y[index]);
        return acc;
    }, {});
    return Object.values(result);
}
function inferSparklineData(options, context) {
    const { markState } = context;
    if ((0, util_1.isArray)(options.sparklineData))
        return options.sparklineData;
    return markValue(markState, ['y', 'series']);
}
exports.Slider.props = {
    defaultPosition: 'bottom',
    defaultSize: 24,
    defaultOrder: 1,
    defaultCrossPadding: [12, 12],
    defaultPadding: [12, 12],
};
//# sourceMappingURL=slider.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../utils/scale":1751263816057}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816057, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.pixelsOf = exports.abstractOf = exports.selectionOf = exports.domainOf = exports.invert = exports.isOrdinalScale = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
function constrain(x, lo, hi) {
    return Math.min(hi, Math.max(lo, x));
}
function isOrdinalScale(scale) {
    return !!scale.getBandWidth;
}
exports.isOrdinalScale = isOrdinalScale;
function invert(scale, x, start) {
    if (!isOrdinalScale(scale))
        return scale.invert(x);
    const { adjustedRange } = scale;
    const { domain } = scale.getOptions();
    const offset = start ? -1 : 0;
    const step = scale.getStep();
    const range = start ? adjustedRange : adjustedRange.map((d) => d + step);
    // R[i0 - 1] < x <= R[i0]
    const i0 = (0, d3_array_1.bisectLeft)(range, x);
    const i1 = constrain(i0 + offset, 0, domain.length - 1);
    return domain[i1];
}
exports.invert = invert;
function domainOf(scale, values, ratioX) {
    if (!values)
        return scale.getOptions().domain;
    if (!isOrdinalScale(scale)) {
        const sortedDomain = (0, d3_array_1.sort)(values);
        if (!ratioX)
            return sortedDomain;
        const [d] = sortedDomain;
        const { range } = scale.getOptions();
        const [r0, r1] = range;
        const v = r0 > r1 ? -1 : 1;
        const d1 = scale.invert(scale.map(d) + v * ratioX);
        return [d, d1];
    }
    const { domain } = scale.getOptions();
    const v1 = values[0];
    const start = domain.indexOf(v1);
    if (ratioX) {
        const end = start + Math.round(domain.length * ratioX);
        return domain.slice(start, end);
    }
    const v2 = values[values.length - 1];
    const end = domain.indexOf(v2);
    return domain.slice(start, end + 1);
}
exports.domainOf = domainOf;
function selectionOf(x, y, x1, y1, scale, coordinate) {
    const { x: scaleX, y: scaleY } = scale;
    const abstractDomain = (point, start) => {
        const [x, y] = coordinate.invert(point);
        return [invert(scaleX, x, start), invert(scaleY, y, start)];
    };
    const p0 = abstractDomain([x, y], true);
    const p1 = abstractDomain([x1, y1], false);
    const domainX = domainOf(scaleX, [p0[0], p1[0]]);
    const domainY = domainOf(scaleY, [p0[1], p1[1]]);
    return [domainX, domainY];
}
exports.selectionOf = selectionOf;
function abstractOf(domain, scale) {
    const [d0, d1] = domain;
    const maybeStep = (scale) => (scale.getStep ? scale.getStep() : 0);
    return [scale.map(d0), scale.map(d1) + maybeStep(scale)];
}
exports.abstractOf = abstractOf;
function pixelsOf(selection, scale, coordinate) {
    const { x: scaleX, y: scaleY } = scale;
    const [X, Y] = selection;
    const AX = abstractOf(X, scaleX);
    const AY = abstractOf(Y, scaleY);
    const p0 = [AX[0], AY[0]];
    const p1 = [AX[1], AY[1]];
    const [x, y] = coordinate.map(p0);
    const [x1, y1] = coordinate.map(p1);
    return [x, y, x1, y1];
}
exports.pixelsOf = pixelsOf;
//# sourceMappingURL=scale.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816058, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SliderY = void 0;
const slider_1 = require("./slider");
/**
 * SliderY component.
 */
const SliderY = (options) => {
    return (0, slider_1.Slider)(Object.assign(Object.assign({}, options), { orientation: 'vertical' }));
};
exports.SliderY = SliderY;
exports.SliderY.props = Object.assign(Object.assign({}, slider_1.Slider.props), { defaultPosition: 'left' });
//# sourceMappingURL=sliderY.js.map
}, function(modId) { var map = {"./slider":1751263816056}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816059, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScrollbarX = void 0;
const scrollbar_1 = require("./scrollbar");
/**
 * ScrollbarX component.
 */
const ScrollbarX = (options) => {
    return (0, scrollbar_1.Scrollbar)(Object.assign(Object.assign({}, options), { orientation: 'horizontal' }));
};
exports.ScrollbarX = ScrollbarX;
exports.ScrollbarX.props = Object.assign(Object.assign({}, scrollbar_1.Scrollbar.props), { defaultPosition: 'bottom' });
//# sourceMappingURL=scrollbarX.js.map
}, function(modId) { var map = {"./scrollbar":1751263816060}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816060, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scrollbar = void 0;
const component_1 = require("@antv/component");
/**
 * Scrollbar component.
 */
const Scrollbar = (options) => {
    const { orientation, labelFormatter, style } = options, rest = __rest(options, ["orientation", "labelFormatter", "style"]);
    return ({ scales: [scale], value, theme }) => {
        const { bbox } = value;
        const { x, y, width, height } = bbox;
        const { scrollbar: scrollbarTheme = {} } = theme;
        const { ratio, range } = scale.getOptions();
        const mainSize = orientation === 'horizontal' ? width : height;
        const actualSize = mainSize / ratio;
        const [r0, r1] = range;
        const value1 = r1 > r0 ? 0 : 1;
        return new component_1.Scrollbar({
            className: 'g2-scrollbar',
            style: Object.assign({}, scrollbarTheme, Object.assign(Object.assign(Object.assign(Object.assign({}, style), { x,
                y, trackLength: mainSize, value: value1 }), rest), { orientation, contentLength: actualSize, viewportLength: mainSize })),
        });
    };
};
exports.Scrollbar = Scrollbar;
exports.Scrollbar.props = {
    defaultPosition: 'bottom',
    defaultSize: 24,
    defaultOrder: 1,
    defaultCrossPadding: [12, 12],
    defaultPadding: [12, 12],
};
//# sourceMappingURL=scrollbar.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816061, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScrollbarY = void 0;
const scrollbar_1 = require("./scrollbar");
/**
 * ScrollbarY component.
 */
const ScrollbarY = (options) => {
    return (0, scrollbar_1.Scrollbar)(Object.assign(Object.assign({}, options), { orientation: 'vertical' }));
};
exports.ScrollbarY = ScrollbarY;
exports.ScrollbarY.props = Object.assign(Object.assign({}, scrollbar_1.Scrollbar.props), { defaultPosition: 'left' });
//# sourceMappingURL=scrollbarY.js.map
}, function(modId) { var map = {"./scrollbar":1751263816060}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816062, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Legends = void 0;
const g_1 = require("@antv/g");
// A empty component to pass parse view tree stage.
const Legends = (options) => {
    return () => {
        return new g_1.Group();
    };
};
exports.Legends = Legends;
exports.Legends.props = {};
//# sourceMappingURL=legends.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816063, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GrowInY = exports.GrowInX = exports.PathIn = exports.ZoomOut = exports.ZoomIn = exports.WaveIn = exports.Morphing = exports.FadeOut = exports.FadeIn = exports.ScaleOutY = exports.ScaleInY = exports.ScaleOutX = exports.ScaleInX = void 0;
var scaleInX_1 = require("./scaleInX");
Object.defineProperty(exports, "ScaleInX", { enumerable: true, get: function () { return scaleInX_1.ScaleInX; } });
var scaleOutX_1 = require("./scaleOutX");
Object.defineProperty(exports, "ScaleOutX", { enumerable: true, get: function () { return scaleOutX_1.ScaleOutX; } });
var scaleInY_1 = require("./scaleInY");
Object.defineProperty(exports, "ScaleInY", { enumerable: true, get: function () { return scaleInY_1.ScaleInY; } });
var scaleOutY_1 = require("./scaleOutY");
Object.defineProperty(exports, "ScaleOutY", { enumerable: true, get: function () { return scaleOutY_1.ScaleOutY; } });
var fadeIn_1 = require("./fadeIn");
Object.defineProperty(exports, "FadeIn", { enumerable: true, get: function () { return fadeIn_1.FadeIn; } });
var fadeOut_1 = require("./fadeOut");
Object.defineProperty(exports, "FadeOut", { enumerable: true, get: function () { return fadeOut_1.FadeOut; } });
var morphing_1 = require("./morphing");
Object.defineProperty(exports, "Morphing", { enumerable: true, get: function () { return morphing_1.Morphing; } });
var waveIn_1 = require("./waveIn");
Object.defineProperty(exports, "WaveIn", { enumerable: true, get: function () { return waveIn_1.WaveIn; } });
var zoomIn_1 = require("./zoomIn");
Object.defineProperty(exports, "ZoomIn", { enumerable: true, get: function () { return zoomIn_1.ZoomIn; } });
var zoomOut_1 = require("./zoomOut");
Object.defineProperty(exports, "ZoomOut", { enumerable: true, get: function () { return zoomOut_1.ZoomOut; } });
var pathIn_1 = require("./pathIn");
Object.defineProperty(exports, "PathIn", { enumerable: true, get: function () { return pathIn_1.PathIn; } });
var growInX_1 = require("./growInX");
Object.defineProperty(exports, "GrowInX", { enumerable: true, get: function () { return growInX_1.GrowInX; } });
var growInY_1 = require("./growInY");
Object.defineProperty(exports, "GrowInY", { enumerable: true, get: function () { return growInY_1.GrowInY; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./scaleInX":1751263816064,"./scaleOutX":1751263816065,"./scaleInY":1751263816066,"./scaleOutY":1751263816067,"./fadeIn":1751263816068,"./fadeOut":1751263816069,"./morphing":1751263816070,"./waveIn":1751263816072,"./zoomIn":1751263816073,"./zoomOut":1751263816074,"./pathIn":1751263816075,"./growInX":1751263816076,"./growInY":1751263816077}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816064, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScaleInX = void 0;
const coordinate_1 = require("../utils/coordinate");
/**
 * Scale mark from nothing to desired shape in x direction.
 */
const ScaleInX = (options, context) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    const { coordinate } = context;
    return (from, _, defaults) => {
        const [shape] = from;
        const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = shape.style;
        const [transformOrigin, transform] = (0, coordinate_1.isTranspose)(coordinate)
            ? [`left bottom`, `scale(1, ${ZERO})`] // left-bottom corner
            : [`left top`, `scale(${ZERO}, 1)`]; // left-top corner
        // Using a short fadeIn transition to hide element with scale(0.001)
        // which is still visible.
        const keyframes = [
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.01,
            },
            {
                transform: `${prefix} scale(1, 1)`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        return animation;
    };
};
exports.ScaleInX = ScaleInX;
//# sourceMappingURL=scaleInX.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816065, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScaleOutX = void 0;
const coordinate_1 = require("../utils/coordinate");
/**
 * Scale mark from desired shape to nothing in x direction.
 */
const ScaleOutX = (options, context) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    const { coordinate } = context;
    return (from, _, defaults) => {
        const [shape] = from;
        const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = shape.style;
        const [transformOrigin, transform] = (0, coordinate_1.isTranspose)(coordinate)
            ? [`left bottom`, `scale(1, ${ZERO})`] // left-bottom corner
            : [`left top`, `scale(${ZERO}, 1)`]; // left-top corner
        // Using a short fadeIn transition to hide element with scale(0.001)
        // which is still visible.
        const keyframes = [
            {
                transform: `${prefix} scale(1, 1)`.trimStart(),
                transformOrigin,
            },
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.99,
            },
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        return animation;
    };
};
exports.ScaleOutX = ScaleOutX;
//# sourceMappingURL=scaleOutX.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816066, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScaleInY = void 0;
const g_1 = require("@antv/g");
const coordinate_1 = require("../utils/coordinate");
const utils_1 = require("../shape/utils");
/**
 * Scale mark from nothing to desired shape in y direction.
 */
const ScaleInY = (options, context) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    const { coordinate } = context;
    // the polar coordinate need
    g_1.CSS.registerProperty({
        name: 'scaleInYRadius',
        inherits: false,
        initialValue: '',
        interpolable: true,
        syntax: g_1.PropertySyntax.NUMBER,
    });
    return (from, _, defaults) => {
        const [shape] = from;
        const PolarScaleInY = (shape) => {
            const { __data__, style } = shape;
            const { fillOpacity = 1, strokeOpacity = 1, opacity = 1 } = style;
            const { points, y, y1 } = __data__;
            const arcObject = (0, utils_1.getArcObject)(coordinate, points, [y, y1]);
            const { innerRadius, outerRadius } = arcObject;
            const keyframes = [
                {
                    scaleInYRadius: innerRadius + ZERO,
                    fillOpacity: 0,
                    strokeOpacity: 0,
                    opacity: 0,
                },
                {
                    scaleInYRadius: innerRadius + ZERO,
                    fillOpacity,
                    strokeOpacity,
                    opacity,
                    offset: 0.01,
                },
                {
                    scaleInYRadius: outerRadius,
                    fillOpacity,
                    strokeOpacity,
                    opacity,
                },
            ];
            const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
            return animation;
        };
        const RectangularScaleInY = (shape) => {
            const { style } = shape;
            const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = style;
            const [transformOrigin, transform] = (0, coordinate_1.isTranspose)(coordinate)
                ? [`left top`, `scale(${ZERO}, 1)`] // left-top corner
                : [`left bottom`, `scale(1, ${ZERO})`]; // left-bottom corner
            // Using a short fadeIn transition to hide element with scale(0.001)
            // which is still visible.
            const keyframes = [
                {
                    transform: `${prefix} ${transform}`.trimStart(),
                    transformOrigin,
                    fillOpacity: 0,
                    strokeOpacity: 0,
                    opacity: 0,
                },
                {
                    transform: `${prefix} ${transform}`.trimStart(),
                    transformOrigin,
                    fillOpacity,
                    strokeOpacity,
                    opacity,
                    offset: 0.01,
                },
                {
                    transform: `${prefix} scale(1, 1)`.trimStart(),
                    transformOrigin,
                    fillOpacity,
                    strokeOpacity,
                    opacity,
                },
            ];
            const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
            return animation;
        };
        if ((0, coordinate_1.isPolar)(coordinate)) {
            return PolarScaleInY(shape);
        }
        else {
            return RectangularScaleInY(shape);
        }
    };
};
exports.ScaleInY = ScaleInY;
//# sourceMappingURL=scaleInY.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../shape/utils":1751263815885}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816067, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScaleOutY = void 0;
const coordinate_1 = require("../utils/coordinate");
/**
 * Scale mark from desired shape to nothing in y direction.
 */
const ScaleOutY = (options, context) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    const { coordinate } = context;
    return (from, _, defaults) => {
        const [shape] = from;
        const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = shape.style;
        const [transformOrigin, transform] = (0, coordinate_1.isTranspose)(coordinate)
            ? [`left top`, `scale(${ZERO}, 1)`] // left-top corner
            : [`left bottom`, `scale(1, ${ZERO})`]; // left-bottom corner
        // Using a short fadeIn transition to hide element with scale(0.001)
        // which is still visible.
        const keyframes = [
            {
                transform: `${prefix} scale(1, 1)`.trimStart(),
                transformOrigin,
            },
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.99,
            },
            {
                transform: `${prefix} ${transform}`.trimStart(),
                transformOrigin,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        return animation;
    };
};
exports.ScaleOutY = ScaleOutY;
//# sourceMappingURL=scaleOutY.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816068, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.FadeIn = void 0;
/**
 * Transform mark from transparent to solid.
 */
const FadeIn = (options) => {
    return (from, _, defaults) => {
        const [shape] = from;
        const { fillOpacity = 1, strokeOpacity = 1, opacity = 1 } = shape.style;
        const keyframes = [
            { fillOpacity: 0, strokeOpacity: 0, opacity: 0 },
            {
                fillOpacity,
                strokeOpacity,
                opacity,
            },
        ];
        return shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
    };
};
exports.FadeIn = FadeIn;
exports.FadeIn.props = {};
//# sourceMappingURL=fadeIn.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816069, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.FadeOut = void 0;
/**
 * Transform mark from solid to transparent.
 */
const FadeOut = (options) => {
    return (from, _, defaults) => {
        const [shape] = from;
        const { fillOpacity = 1, strokeOpacity = 1, opacity = 1 } = shape.style;
        const keyframes = [
            {
                fillOpacity,
                strokeOpacity,
                opacity,
            },
            { fillOpacity: 0, strokeOpacity: 0, opacity: 0 },
        ];
        return shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
    };
};
exports.FadeOut = FadeOut;
exports.FadeOut.props = {};
//# sourceMappingURL=fadeOut.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816070, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Morphing = void 0;
const g_1 = require("@antv/g");
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
function localBBoxOf(shape) {
    const { min, max } = shape.getLocalBounds();
    const [x0, y0] = min;
    const [x1, y1] = max;
    const height = y1 - y0;
    const width = x1 - x0;
    return [x0, y0, width, height];
}
function d(bbox) {
    const [x, y, width, height] = bbox;
    return `
    M ${x} ${y}
    L ${x + width} ${y}
    L ${x + width} ${y + height}
    L ${x} ${y + height}
    Z
  `;
}
function pack(shape, count) {
    const [x0, y0, width, height] = localBBoxOf(shape);
    const aspect = height / width;
    const col = Math.ceil(Math.sqrt(count / aspect));
    const row = Math.ceil(count / col);
    const B = [];
    const h = height / row;
    let j = 0;
    let n = count;
    while (n > 0) {
        const c = Math.min(n, col);
        const w = width / c;
        for (let i = 0; i < c; i++) {
            const x = x0 + i * w;
            const y = y0 + j * h;
            B.push(d([x, y, w, h]));
        }
        n -= c;
        j += 1;
    }
    return B;
}
function normalizeSplit(split = 'pack') {
    if (typeof split == 'function')
        return split;
    return pack;
}
/**
 * Use attributes relative to geometry to do shape to shape animation.
 *
 * For example, the x, y, width, height of `Rect`, the cx, cy, r of `Circle`.
 * And for `Group`, it will use the bbox of the group.
 */
function shapeToShape(from, to, timeEffect) {
    let { transform: fromTransform } = from.style;
    const { transform: toTransform } = to.style;
    // Replace first to get right bbox after mounting.
    replaceChild(to, from);
    let keys = utils_1.attributeKeys;
    if (from.nodeName === g_1.Shape.GROUP) {
        // Apply translate and scale transform.
        const [x0, y0, w0, h0] = localBBoxOf(from);
        const [x1, y1, w1, h1] = localBBoxOf(to);
        const dx = x0 - x1;
        const dy = y0 - y1;
        const sx = w0 / w1;
        const sy = h0 / h1;
        fromTransform = `translate(${dx}, ${dy}) scale(${sx}, ${sy})`;
    }
    else {
        keys = keys.concat(utils_1.GEOMETRY_ATTRIBUTES[from.nodeName] || []);
    }
    const keyframes = [
        Object.assign({ transform: fromTransform !== null && fromTransform !== void 0 ? fromTransform : 'none' }, (0, utils_1.attributeOf)(from, keys, true)),
        Object.assign({ transform: toTransform !== null && toTransform !== void 0 ? toTransform : 'none' }, (0, utils_1.attributeOf)(to, keys, true)),
    ];
    const animation = to.animate(keyframes, timeEffect);
    return animation;
}
/**
 * Replace object and copy className and __data__
 */
function replaceChild(newChild, oldChild) {
    newChild['__data__'] = oldChild['__data__'];
    newChild.className = oldChild.className;
    // @ts-ignore
    newChild.markType = oldChild.markType;
    oldChild.parentNode.replaceChild(newChild, oldChild);
}
/**
 * Replace element with a path shape.
 */
function maybePath(node, d) {
    const { nodeName } = node;
    if (nodeName === 'path')
        return node;
    const path = new g_1.Path({
        style: Object.assign(Object.assign({}, (0, utils_1.attributeOf)(node, utils_1.attributeKeys)), { d }),
    });
    replaceChild(path, node);
    return path;
}
function hasUniqueString(search, pattern) {
    const first = search.indexOf(pattern);
    const last = search.lastIndexOf(pattern);
    return first === last;
}
// Path definition with multiple m and M command has sub path.
// eg. 'M10,10...M20,20', 'm10,10...m20,20'
function hasSubPath(path) {
    return !hasUniqueString(path, 'm') || !hasUniqueString(path, 'M');
}
function shape2path(shape) {
    const path = (0, g_1.convertToPath)(shape);
    if (!path)
        return;
    // Path definition with sub path can't do path morphing animation,
    // so skip this kind of path.
    if (hasSubPath(path))
        return;
    return path;
}
// Check if the path has a markerEnd | markerStart
function hasMarker(shape) {
    const { nodeName } = shape;
    if (nodeName === 'path') {
        const attributes = (0, util_1.get)(shape, 'attributes');
        return attributes.markerEnd || attributes.markerStart;
    }
    return false;
}
function oneToOne(shape, from, to, timeEffect) {
    // If the nodeTypes of from and to are equal,
    // or non of them can convert to path,
    // the apply shape to shape animation.
    const { nodeName: fromName } = from;
    const { nodeName: toName } = to;
    const fromPath = shape2path(from);
    const toPath = shape2path(to);
    const isSameNodes = fromName === toName && fromName !== 'path';
    const hasNonPathNode = fromPath === undefined || toPath === undefined;
    // Path with mark can not use animate like ordinary path.
    const isPathWithMarker = hasMarker(from) || hasMarker(to);
    if (isSameNodes || hasNonPathNode || isPathWithMarker)
        return shapeToShape(from, to, timeEffect);
    const pathShape = maybePath(shape, fromPath);
    // Convert Path will take transform, anchor, etc into account,
    // so there is no need to specify these attributes in keyframes.
    const keyframes = [
        Object.assign({}, (0, utils_1.attributeOf)(from, utils_1.attributeKeys)),
        Object.assign({}, (0, utils_1.attributeOf)(to, utils_1.attributeKeys)),
    ];
    if (fromPath !== toPath) {
        keyframes[0].d = fromPath;
        keyframes[1].d = toPath;
        const animation = pathShape.animate(keyframes, timeEffect);
        animation.onfinish = () => {
            // Should keep the original path definition.
            (0, helper_1.copyAttributes)(pathShape, to);
            pathShape.style.d = toPath;
            pathShape.style.transform = 'none';
        };
        // Remove transform because it already applied in path
        // converted by convertToPath.
        pathShape.style.transform = 'none';
        return animation;
    }
    // No need to apply animation since fromPath equals toPath.
    return null;
}
function oneToMultiple(from, to, timeEffect, split) {
    // Hide the shape to be split before being removing.
    from.style.visibility = 'hidden';
    const D = split(from, to.length);
    return to.map((shape, i) => {
        const path = new g_1.Path({
            style: Object.assign({ d: D[i] }, (0, utils_1.attributeOf)(from, utils_1.attributeKeys)),
        });
        return oneToOne(shape, path, shape, timeEffect);
    });
}
function multipleToOne(from, to, timeEffect, split) {
    const D = split(to, from.length);
    const { fillOpacity = 1, strokeOpacity = 1, opacity = 1 } = to.style;
    const keyframes = [
        { fillOpacity: 0, strokeOpacity: 0, opacity: 0 },
        { fillOpacity: 0, strokeOpacity: 0, opacity: 0, offset: 0.99 },
        {
            fillOpacity,
            strokeOpacity,
            opacity,
        },
    ];
    const animation = to.animate(keyframes, timeEffect);
    const animations = from.map((shape, i) => {
        const path = new g_1.Path({
            style: {
                d: D[i],
                fill: to.style.fill,
            },
        });
        return oneToOne(shape, shape, path, timeEffect);
    });
    return [...animations, animation];
}
/**
 * Morphing animations.
 * @todo Support more split function.
 */
const Morphing = (options) => {
    return (from, to, defaults) => {
        const split = normalizeSplit(options.split);
        const timeEffect = Object.assign(Object.assign({}, defaults), options);
        const { length: fl } = from;
        const { length: tl } = to;
        if ((fl === 1 && tl === 1) || (fl > 1 && tl > 1)) {
            const [f] = from;
            const [t] = to;
            return oneToOne(f, f, t, timeEffect);
        }
        if (fl === 1 && tl > 1) {
            const [f] = from;
            return oneToMultiple(f, to, timeEffect, split);
        }
        if (fl > 1 && tl === 1) {
            const [t] = to;
            return multipleToOne(from, t, timeEffect, split);
        }
        return null;
    };
};
exports.Morphing = Morphing;
exports.Morphing.props = {};
//# sourceMappingURL=morphing.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils":1751263816071}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816071, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.attributeKeys = exports.attributeOf = exports.GEOMETRY_ATTRIBUTES = void 0;
const g_1 = require("@antv/g");
const DEFAULT_ATTRIBUTE_VALUE = {
    opacity: 1,
    strokeOpacity: 1,
    fillOpacity: 1,
    lineWidth: 0,
    x: 0,
    y: 0,
    cx: 0,
    cy: 0,
    r: 0,
    rx: 0,
    ry: 0,
    width: 0,
    height: 0,
};
exports.GEOMETRY_ATTRIBUTES = {
    [g_1.Shape.CIRCLE]: ['cx', 'cy', 'r'],
    [g_1.Shape.ELLIPSE]: ['cx', 'cy', 'rx', 'ry'],
    [g_1.Shape.RECT]: ['x', 'y', 'width', 'height'],
    [g_1.Shape.IMAGE]: ['x', 'y', 'width', 'height'],
    [g_1.Shape.LINE]: ['x1', 'y1', 'x2', 'y2'],
    [g_1.Shape.POLYLINE]: ['points'],
    [g_1.Shape.POLYGON]: ['points'],
};
function attributeOf(shape, keys, useDefaultValue = false) {
    const attribute = {};
    for (const key of keys) {
        const value = shape.style[key];
        if (value) {
            attribute[key] = value;
        }
        else if (useDefaultValue) {
            attribute[key] = DEFAULT_ATTRIBUTE_VALUE[key];
        }
    }
    return attribute;
}
exports.attributeOf = attributeOf;
exports.attributeKeys = [
    'fill',
    'stroke',
    'fillOpacity',
    'strokeOpacity',
    'opacity',
    'lineWidth',
];
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816072, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.WaveIn = void 0;
const d3_shape_1 = require("@antv/vendor/d3-shape");
const g_1 = require("@antv/g");
const utils_1 = require("../shape/utils");
const coordinate_1 = require("../utils/coordinate");
const scaleInX_1 = require("./scaleInX");
/**
 * Transform mark from transparent to solid.
 */
const WaveIn = (options, context) => {
    const ZERO = 0.0001;
    // @see https://g-next.antv.vision/zh/docs/api/css/css-properties-values-api#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B1%9E%E6%80%A7
    g_1.CSS.registerProperty({
        name: 'waveInArcAngle',
        inherits: false,
        initialValue: '',
        interpolable: true,
        syntax: g_1.PropertySyntax.NUMBER,
    });
    const { coordinate } = context;
    return (from, to, defaults) => {
        const [shape] = from;
        if (!(0, coordinate_1.isPolar)(coordinate)) {
            return (0, scaleInX_1.ScaleInX)(options, context)(from, to, defaults);
        }
        const { __data__, style } = shape;
        const { radius = 0, inset = 0, fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = style;
        const { points, y, y1 } = __data__;
        const path = (0, d3_shape_1.arc)()
            .cornerRadius(radius)
            .padAngle((inset * Math.PI) / 180);
        const arcObject = (0, utils_1.getArcObject)(coordinate, points, [y, y1]);
        const { startAngle, endAngle } = arcObject;
        const keyframes = [
            // Use custom interpolable CSS property.
            {
                waveInArcAngle: startAngle + ZERO,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
            {
                waveInArcAngle: startAngle + ZERO,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.01,
            },
            {
                waveInArcAngle: endAngle,
                fillOpacity,
                strokeOpacity,
                opacity,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        animation.onframe = function () {
            shape.style.d = path(Object.assign(Object.assign({}, arcObject), { endAngle: Number(shape.style.waveInArcAngle) }));
        };
        animation.onfinish = function () {
            shape.style.d = path(Object.assign(Object.assign({}, arcObject), { endAngle: endAngle }));
        };
        return animation;
    };
};
exports.WaveIn = WaveIn;
exports.WaveIn.props = {};
//# sourceMappingURL=waveIn.js.map
}, function(modId) { var map = {"../shape/utils":1751263815885,"../utils/coordinate":1751263815882,"./scaleInX":1751263816064}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816073, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ZoomIn = void 0;
const ZoomIn = (options) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    return (from, _, defaults) => {
        const [shape] = from;
        const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = shape.style;
        const transformOrigin = 'center center';
        const keyframes = [
            {
                transform: `${prefix} scale(${ZERO})`.trimStart(),
                transformOrigin,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
            {
                transform: `${prefix} scale(${ZERO})`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.01,
            },
            {
                transform: `${prefix} scale(1)`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        return animation;
    };
};
exports.ZoomIn = ZoomIn;
//# sourceMappingURL=zoomIn.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816074, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ZoomOut = void 0;
const ZoomOut = (options) => {
    // Small enough to hide or show very small part of mark,
    // but bigger enough to not cause bug.
    const ZERO = 0.0001;
    return (from, _, defaults) => {
        const [shape] = from;
        const { transform: prefix = '', fillOpacity = 1, strokeOpacity = 1, opacity = 1, } = shape.style;
        const transformOrigin = 'center center';
        const keyframes = [
            { transform: `${prefix} scale(1)`.trimStart(), transformOrigin },
            {
                transform: `${prefix} scale(${ZERO})`.trimStart(),
                transformOrigin,
                fillOpacity,
                strokeOpacity,
                opacity,
                offset: 0.99,
            },
            {
                transform: `${prefix} scale(${ZERO})`.trimStart(),
                transformOrigin,
                fillOpacity: 0,
                strokeOpacity: 0,
                opacity: 0,
            },
        ];
        const animation = shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
        return animation;
    };
};
exports.ZoomOut = ZoomOut;
//# sourceMappingURL=zoomOut.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816075, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.PathIn = void 0;
/**
 * Transform mark from transparent to solid.
 */
const PathIn = (options) => {
    return (from, _, defaults) => {
        var _a, _b;
        const [shape] = from;
        const length = ((_b = (_a = shape).getTotalLength) === null || _b === void 0 ? void 0 : _b.call(_a)) || 0;
        const keyframes = [
            { lineDash: [0, length] },
            { lineDash: [length, 0] },
        ];
        return shape.animate(keyframes, Object.assign(Object.assign({}, defaults), options));
    };
};
exports.PathIn = PathIn;
exports.PathIn.props = {};
//# sourceMappingURL=pathIn.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816076, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GrowInX = void 0;
const g_1 = require("@antv/g");
const scaleInX_1 = require("./scaleInX");
/**
 * Scale mark from nothing to desired shape in x direction.
 */
const GrowInX = (options, context) => {
    return (from, to, defaults) => {
        const [shape] = from;
        const { min: [x, y], halfExtents, } = shape.getLocalBounds();
        const width = halfExtents[0] * 2;
        const height = halfExtents[1] * 2;
        const clipPath = new g_1.Path({
            style: {
                d: `M${x},${y}L${x + width},${y}L${x + width},${y + height}L${x},${y + height}Z`,
            },
        });
        shape.appendChild(clipPath);
        shape.style.clipPath = clipPath;
        const animation = (0, scaleInX_1.ScaleInX)(options, context)([clipPath], to, defaults);
        return animation;
    };
};
exports.GrowInX = GrowInX;
exports.GrowInX.props = {};
//# sourceMappingURL=growInX.js.map
}, function(modId) { var map = {"./scaleInX":1751263816064}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816077, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GrowInY = void 0;
const g_1 = require("@antv/g");
const scaleInY_1 = require("./scaleInY");
/**
 * Scale mark from nothing to desired shape in x direction.
 */
const GrowInY = (options, context) => {
    return (from, to, defaults) => {
        const [shape] = from;
        const { min: [x, y], halfExtents, } = shape.getLocalBounds();
        const width = halfExtents[0] * 2;
        const height = halfExtents[1] * 2;
        const clipPath = new g_1.Path({
            style: {
                d: `M${x},${y}L${x + width},${y}L${x + width},${y + height}L${x},${y + height}Z`,
            },
        });
        shape.appendChild(clipPath);
        shape.style.clipPath = clipPath;
        const animation = (0, scaleInY_1.ScaleInY)(options, context)([clipPath], to, defaults);
        return animation;
    };
};
exports.GrowInY = GrowInY;
exports.GrowInY.props = {};
//# sourceMappingURL=growInY.js.map
}, function(modId) { var map = {"./scaleInY":1751263816066}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816078, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementPointMove = exports.TreemapDrillDown = exports.Event = exports.Poptip = exports.ScrollbarFilter = exports.SliderFilter = exports.BrushYFilter = exports.BrushXFilter = exports.BrushFilter = exports.BrushAxisHighlight = exports.BrushYHighlight = exports.BrushXHighlight = exports.BrushHighlight = exports.LegendHighlight = exports.LegendFilter = exports.Tooltip = exports.Fisheye = exports.ChartIndex = exports.ElementSelectByColor = exports.ElementSelectByX = exports.ElementSelect = exports.ElementHighlightByColor = exports.ElementHighlightByX = exports.ElementHighlight = void 0;
var elementHighlight_1 = require("./elementHighlight");
Object.defineProperty(exports, "ElementHighlight", { enumerable: true, get: function () { return elementHighlight_1.ElementHighlight; } });
var elementHighlightByX_1 = require("./elementHighlightByX");
Object.defineProperty(exports, "ElementHighlightByX", { enumerable: true, get: function () { return elementHighlightByX_1.ElementHighlightByX; } });
var elementHighlightByColor_1 = require("./elementHighlightByColor");
Object.defineProperty(exports, "ElementHighlightByColor", { enumerable: true, get: function () { return elementHighlightByColor_1.ElementHighlightByColor; } });
var elementSelect_1 = require("./elementSelect");
Object.defineProperty(exports, "ElementSelect", { enumerable: true, get: function () { return elementSelect_1.ElementSelect; } });
var elementSelectByX_1 = require("./elementSelectByX");
Object.defineProperty(exports, "ElementSelectByX", { enumerable: true, get: function () { return elementSelectByX_1.ElementSelectByX; } });
var elementSelectByColor_1 = require("./elementSelectByColor");
Object.defineProperty(exports, "ElementSelectByColor", { enumerable: true, get: function () { return elementSelectByColor_1.ElementSelectByColor; } });
var chartIndex_1 = require("./chartIndex");
Object.defineProperty(exports, "ChartIndex", { enumerable: true, get: function () { return chartIndex_1.ChartIndex; } });
var fisheye_1 = require("./fisheye");
Object.defineProperty(exports, "Fisheye", { enumerable: true, get: function () { return fisheye_1.Fisheye; } });
var tooltip_1 = require("./tooltip");
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return tooltip_1.Tooltip; } });
var legendFilter_1 = require("./legendFilter");
Object.defineProperty(exports, "LegendFilter", { enumerable: true, get: function () { return legendFilter_1.LegendFilter; } });
var legendHighlight_1 = require("./legendHighlight");
Object.defineProperty(exports, "LegendHighlight", { enumerable: true, get: function () { return legendHighlight_1.LegendHighlight; } });
var brushHighlight_1 = require("./brushHighlight");
Object.defineProperty(exports, "BrushHighlight", { enumerable: true, get: function () { return brushHighlight_1.BrushHighlight; } });
var brushXHighlight_1 = require("./brushXHighlight");
Object.defineProperty(exports, "BrushXHighlight", { enumerable: true, get: function () { return brushXHighlight_1.BrushXHighlight; } });
var brushYHighlight_1 = require("./brushYHighlight");
Object.defineProperty(exports, "BrushYHighlight", { enumerable: true, get: function () { return brushYHighlight_1.BrushYHighlight; } });
var brushAxisHighlight_1 = require("./brushAxisHighlight");
Object.defineProperty(exports, "BrushAxisHighlight", { enumerable: true, get: function () { return brushAxisHighlight_1.BrushAxisHighlight; } });
var brushFilter_1 = require("./brushFilter");
Object.defineProperty(exports, "BrushFilter", { enumerable: true, get: function () { return brushFilter_1.BrushFilter; } });
var brushXFilter_1 = require("./brushXFilter");
Object.defineProperty(exports, "BrushXFilter", { enumerable: true, get: function () { return brushXFilter_1.BrushXFilter; } });
var brushYFilter_1 = require("./brushYFilter");
Object.defineProperty(exports, "BrushYFilter", { enumerable: true, get: function () { return brushYFilter_1.BrushYFilter; } });
var sliderFilter_1 = require("./sliderFilter");
Object.defineProperty(exports, "SliderFilter", { enumerable: true, get: function () { return sliderFilter_1.SliderFilter; } });
var scrollbarFilter_1 = require("./scrollbarFilter");
Object.defineProperty(exports, "ScrollbarFilter", { enumerable: true, get: function () { return scrollbarFilter_1.ScrollbarFilter; } });
var poptip_1 = require("./poptip");
Object.defineProperty(exports, "Poptip", { enumerable: true, get: function () { return poptip_1.Poptip; } });
var event_1 = require("./event");
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return event_1.Event; } });
var treemapDrillDown_1 = require("./treemapDrillDown");
Object.defineProperty(exports, "TreemapDrillDown", { enumerable: true, get: function () { return treemapDrillDown_1.TreemapDrillDown; } });
var elementPointMove_1 = require("./elementPointMove");
Object.defineProperty(exports, "ElementPointMove", { enumerable: true, get: function () { return elementPointMove_1.ElementPointMove; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./elementHighlight":1751263816079,"./elementHighlightByX":1751263816124,"./elementHighlightByColor":1751263816125,"./elementSelect":1751263816126,"./elementSelectByX":1751263816127,"./elementSelectByColor":1751263816128,"./chartIndex":1751263816129,"./fisheye":1751263816130,"./tooltip":1751263816131,"./legendFilter":1751263816132,"./legendHighlight":1751263816133,"./brushHighlight":1751263816134,"./brushXHighlight":1751263816135,"./brushYHighlight":1751263816136,"./brushAxisHighlight":1751263816137,"./brushFilter":1751263816138,"./brushXFilter":1751263816139,"./brushYFilter":1751263816140,"./sliderFilter":1751263816141,"./scrollbarFilter":1751263816142,"./poptip":1751263816143,"./event":1751263816113,"./treemapDrillDown":1751263816144,"./elementPointMove":1751263816145}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816079, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementHighlight = exports.elementHighlight = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
/**
 * highlight a group of elements.
 */
function elementHighlight(root, { elements: elementsof, // given the root of chart returns elements to be manipulated
datum, // given each element returns the datum of it
groupKey: eleGroupKey = (d) => d, // group elements by specified key
regionGroupKey = (d) => d, // how to group elements when hover region
link = false, // draw link or not
background = false, // draw background or not
delay = 60, // delay to unhighlighted element
scale, coordinate, emitter, state = {}, region = false, regionEleFilter = (el) => utils_1.VALID_FIND_BY_X_MARKS.includes(el.markType), // some elements can not be highlighted by region, like shapes in pie.
 }) {
    var _a, _b;
    const allElements = (_a = elementsof(root)) !== null && _a !== void 0 ? _a : [];
    const elements = region ? allElements.filter(regionEleFilter) : allElements;
    const elementSet = new Set(elements);
    const groupKey = region ? regionGroupKey : eleGroupKey;
    const keyGroup = (0, d3_array_1.group)(elements, groupKey);
    const findElement = (0, utils_1.createFindElementByEvent)({
        elementsof,
        root,
        coordinate,
        scale,
    });
    const valueof = (0, utils_1.createValueof)(elements, datum);
    const [appendLink, removeLink] = (0, utils_1.renderLink)(Object.assign({ elements,
        valueof,
        link,
        coordinate }, (0, helper_1.subObject)(state.active, 'link')));
    const [appendBackground, removeBackground, isBackground] = (0, utils_1.renderBackground)(Object.assign({ document: root.ownerDocument, scale,
        coordinate,
        background,
        valueof }, (0, helper_1.subObject)(state.active, 'background')));
    const elementStyle = (0, util_1.deepMix)(state, {
        active: Object.assign({}, (((_b = state.active) === null || _b === void 0 ? void 0 : _b.offset) && {
            //Apply translate to mock slice out.
            transform: (...params) => {
                const value = state.active.offset(...params);
                const [, i] = params;
                return (0, utils_1.offsetTransform)(elements[i], value, coordinate);
            },
        })),
    });
    const useState = (0, utils_1.createUseState)(elementStyle, elements);
    const { updateState, removeState, hasState } = useState(valueof);
    let out; // Timer for delaying unhighlighted.
    const pointerover = (event) => {
        const { nativeEvent = true } = event;
        let element = event.target;
        if (region) {
            element = findElement(event);
        }
        if (!elementSet.has(element))
            return;
        if (out)
            clearTimeout(out);
        const k = groupKey(element);
        const group = keyGroup.get(k);
        const groupSet = new Set(group);
        for (const e of elements) {
            if (groupSet.has(e)) {
                if (!hasState(e, 'active'))
                    updateState(e, 'active');
            }
            else {
                updateState(e, 'inactive');
                removeLink(e);
            }
            if (e !== element)
                removeBackground(e);
        }
        appendBackground(element);
        appendLink(group);
        // Emit events.
        if (!nativeEvent)
            return;
        emitter.emit('element:highlight', {
            nativeEvent,
            data: {
                data: datum(element),
                group: group.map(datum),
            },
        });
    };
    const delayUnhighlighted = () => {
        if (out)
            clearTimeout(out);
        out = setTimeout(() => {
            unhighlighted();
            out = null;
        }, delay);
    };
    const unhighlighted = (nativeEvent = true) => {
        for (const e of elements) {
            removeState(e, 'active', 'inactive');
            removeBackground(e);
            removeLink(e);
        }
        if (nativeEvent) {
            emitter.emit('element:unhighlight', { nativeEvent });
        }
    };
    const pointerout = (event) => {
        let element = event.target;
        if (region) {
            element = findElement(event);
        }
        if (!element) {
            if (delay > 0)
                delayUnhighlighted();
            else
                unhighlighted();
            return;
        }
        if (background && !isBackground(element))
            return;
        if (!background && !elementSet.has(element))
            return;
        if (delay > 0)
            delayUnhighlighted();
        else
            unhighlighted();
    };
    const pointerleave = () => {
        unhighlighted();
    };
    root.addEventListener('pointerover', pointerover);
    root.addEventListener('pointermove', pointerover);
    root.addEventListener('pointerout', pointerout);
    root.addEventListener('pointerleave', pointerleave);
    const onRest = (e) => {
        const { nativeEvent } = e;
        if (nativeEvent)
            return;
        unhighlighted(false);
    };
    const onHighlight = (e) => {
        const { nativeEvent } = e;
        if (nativeEvent)
            return;
        const { data } = e.data;
        const element = (0, utils_1.selectElementByData)(elements, data, datum);
        if (!element)
            return;
        pointerover({ target: element, nativeEvent: false });
    };
    emitter.on('element:highlight', onHighlight);
    emitter.on('element:unhighlight', onRest);
    return () => {
        root.removeEventListener('pointerover', pointerover);
        root.removeEventListener('pointermove', pointerover);
        root.removeEventListener('pointerout', pointerout);
        root.removeEventListener('pointerleave', pointerleave);
        emitter.off('element:highlight', onHighlight);
        emitter.off('element:unhighlight', onRest);
        for (const e of elements) {
            removeBackground(e);
            removeLink(e);
        }
    };
}
exports.elementHighlight = elementHighlight;
function ElementHighlight(_a) {
    var { delay, createGroup, createRegionGroup, background = false, link = false } = _a, rest = __rest(_a, ["delay", "createGroup", "createRegionGroup", "background", "link"]);
    return (context, _, emitter) => {
        const { container, view, options } = context;
        const { scale, coordinate } = view;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        return elementHighlight(plotArea, Object.assign({ elements: utils_1.selectG2Elements, datum: (0, utils_1.createDatumof)(view), groupKey: createGroup ? createGroup(view) : undefined, regionGroupKey: createRegionGroup
                ? createRegionGroup(view)
                : (0, utils_1.createXKey)(view), coordinate,
            scale, state: (0, utils_1.mergeState)(options, [
                ['active', background ? {} : { lineWidth: '1', stroke: '#000' }],
                'inactive',
            ]), background,
            link,
            delay,
            emitter }, rest));
    };
}
exports.ElementHighlight = ElementHighlight;
ElementHighlight.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementHighlight.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816080, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFindElementByEvent = exports.VALID_FIND_BY_X_MARKS = exports.maybeRoot = exports.getThetaPath = exports.getElements = exports.getPointsPath = exports.getPointsR = exports.selectElementByData = exports.restoreCursor = exports.setCursor = exports.renderBackground = exports.offsetTransform = exports.renderLink = exports.createValueof = exports.mergeState = exports.useState = exports.createUseState = exports.createDatumof = exports.createXKey = exports.createColorKey = exports.boundsOfBrushArea = exports.brushMousePosition = exports.mousePosition = exports.bboxOf = exports.selectPlotArea = exports.selectFacetViews = exports.selectFacetG2Elements = exports.selectG2Elements = void 0;
const g_1 = require("@antv/g");
const d3_path_1 = require("@antv/vendor/d3-path");
const d3_array_1 = require("@antv/vendor/d3-array");
const util_1 = require("@antv/util");
const selection_1 = require("../utils/selection");
const array_1 = require("../utils/array");
const runtime_1 = require("../runtime");
const scale_1 = require("../utils/scale");
const color_1 = require("../shape/interval/color");
const coordinate_1 = require("../utils/coordinate");
const style_1 = require("../utils/style");
const utils_1 = require("../shape/utils");
const vector_1 = require("../utils/vector");
const traverse_elements_1 = require("../utils/traverse-elements");
/**
 * Given root of chart returns elements to be manipulated
 */
function selectG2Elements(root) {
    return (0, selection_1.select)(root)
        .selectAll(`.${runtime_1.ELEMENT_CLASS_NAME}`)
        .nodes()
        .filter((d) => !d.__removed__);
}
exports.selectG2Elements = selectG2Elements;
function selectFacetG2Elements(target, viewInstances) {
    return selectFacetViews(target, viewInstances).flatMap(({ container }) => selectG2Elements(container));
}
exports.selectFacetG2Elements = selectFacetG2Elements;
function selectFacetViews(target, viewInstances) {
    return viewInstances.filter((d) => d !== target && d.options.parentKey === target.options.key);
}
exports.selectFacetViews = selectFacetViews;
function selectPlotArea(root) {
    return (0, selection_1.select)(root).select(`.${runtime_1.PLOT_CLASS_NAME}`).node();
}
exports.selectPlotArea = selectPlotArea;
function bboxOf(element) {
    // The geometry bounds of a group is empty, so return the render bounds.
    if (element.tagName === 'g')
        return element.getRenderBounds();
    // Compute the geometry bounds related to the parent.
    const bounds = element.getGeometryBounds();
    const aabb = new g_1.AABB();
    aabb.setFromTransformedAABB(bounds, element.getWorldTransform());
    return aabb;
}
exports.bboxOf = bboxOf;
function mousePosition(target, event) {
    const { offsetX, offsetY } = event;
    const bbox = bboxOf(target);
    const { min: [x, y], max: [x1, y1], } = bbox;
    const isOutX = offsetX < x || offsetX > x1;
    const isOutY = offsetY < y || offsetY > y1;
    if (isOutX || isOutY)
        return null;
    return [offsetX - x, offsetY - y];
}
exports.mousePosition = mousePosition;
/**
 * @todo Pass bbox rather than calc it here.
 */
function brushMousePosition(target, event) {
    const { offsetX, offsetY } = event;
    const [x, y, x1, y1] = boundsOfBrushArea(target);
    return [
        Math.min(x1, Math.max(x, offsetX)) - x,
        Math.min(y1, Math.max(y, offsetY)) - y,
    ];
}
exports.brushMousePosition = brushMousePosition;
function boundsOfBrushArea(target) {
    // Calc bbox after clipping.
    const bbox = target.getRenderBounds();
    const { min: [x0, y0], max: [x1, y1], } = bbox;
    return [x0, y0, x1, y1];
}
exports.boundsOfBrushArea = boundsOfBrushArea;
function createColorKey(view) {
    return (element) => element.__data__.color;
}
exports.createColorKey = createColorKey;
function createXKey(view) {
    return (element) => element.__data__.x;
}
exports.createXKey = createXKey;
function createDatumof(view) {
    const views = Array.isArray(view) ? view : [view];
    const keyData = new Map(views.flatMap((view) => {
        const marks = Array.from(view.markState.keys());
        return marks.map((mark) => [keyed(view.key, mark.key), mark.data]);
    }));
    return (element) => {
        const { index, markKey, viewKey } = element.__data__;
        const data = keyData.get(keyed(viewKey, markKey));
        return data[index];
    };
}
exports.createDatumof = createDatumof;
/**
 * A state manager for G2Element.
 * The keys for each state's style start with the state name.
 * { selectedFill, selectedStroke } is for selected state.
 * { unselectedFill, unselectedStroke } is for unselected state.
 */
/**
 * Define state priorities, higher number means higher priority.
 */
const STATE_PRIORITIES = {
    selected: 3,
    unselected: 3,
    active: 2,
    inactive: 2,
    default: 1,
};
/**
 * Define state groups, states in the same group are mutually exclusive.
 */
const STATE_GROUPS = {
    selection: ['selected', 'unselected'],
    highlight: ['active', 'inactive'],
};
const setElementAttribute = (element, k, v) => {
    (0, traverse_elements_1.traverseElements)(element, (el) => {
        if ('setAttribute' in el && typeof el.setAttribute === 'function') {
            el.setAttribute(k, v);
        }
    });
};
function createUseState(style, elements) {
    // Apply interaction style to all elements.
    elements.forEach((element) => {
        // @ts-ignore
        const currentStyle = element.__interactionStyle__;
        if (currentStyle) {
            // @ts-ignore
            element.__interactionStyle__ = Object.assign(Object.assign({}, currentStyle), style);
        }
        else {
            // @ts-ignore
            element.__interactionStyle__ = style;
        }
    });
    return (valueof = (d, element) => d, setAttribute = setElementAttribute) => useState(undefined, valueof, setAttribute);
}
exports.createUseState = createUseState;
function useState(style, valueof = (d, element) => d, setAttribute = setElementAttribute) {
    const STATES = '__states__';
    const ORIGINAL = '__ordinal__';
    // Get state priority.
    const getStatePriority = (stateName) => STATE_PRIORITIES[stateName] || STATE_PRIORITIES.default;
    // Get the group that a state belongs to.
    const getStateGroup = (stateName) => {
        var _a;
        return (_a = Object.entries(STATE_GROUPS).find(([_, states]) => states.includes(stateName))) === null || _a === void 0 ? void 0 : _a[0];
    };
    // Mix style for each state and apply it to element.
    const applyState = (element) => {
        var _a;
        const { [STATES]: states = [], [ORIGINAL]: original = {} } = element;
        // Sort states by priority.
        const sortedStates = [...states].sort((a, b) => getStatePriority(b) - getStatePriority(a));
        // Create a Map to track the highest priority state for each style attribute.
        const styleAttributeMap = new Map();
        // Iterate through all states to find the highest priority state for each style attribute.
        for (const state of sortedStates) {
            // If style exists, use it directly, else use interaction style on element.
            const stateStyles = ((_a = (style !== null && style !== void 0 ? style : element.__interactionStyle__)) === null || _a === void 0 ? void 0 : _a[state]) || {};
            for (const [key, value] of Object.entries(stateStyles)) {
                if (!styleAttributeMap.has(key)) {
                    styleAttributeMap.set(key, value);
                }
            }
        }
        // Apply styles including original styles.
        const finalStyle = Object.assign({}, original);
        for (const [key, value] of styleAttributeMap.entries()) {
            finalStyle[key] = value;
        }
        if (Object.keys(finalStyle).length === 0)
            return;
        // Apply final styles to the element.
        for (const [key, value] of Object.entries(finalStyle)) {
            const currentValue = (0, style_1.getStyle)(element, key);
            const v = valueof(value, element);
            setAttribute(element, key, v);
            // Store the attribute if it does not exist in original.
            if (!(key in original))
                original[key] = currentValue;
        }
        element[ORIGINAL] = original;
    };
    const initState = (element) => {
        if (element[STATES])
            return;
        element[STATES] = [];
        return;
    };
    /**
     * Update states and update element, handle conflict states automatically.
     */
    const updateState = (element, ...states) => {
        initState(element);
        const currentStates = element[STATES];
        // Collect all new state groups.
        const newStateGroups = new Set(states
            .map((state) => getStateGroup(state))
            .filter((group) => group !== undefined));
        // Exclude old states that are in the new state group.
        const remainingStates = currentStates.filter((existingState) => !newStateGroups.has(getStateGroup(existingState)));
        element[STATES] = [...remainingStates, ...states];
        applyState(element);
    };
    /**
     * Set the states and update element.
     */
    const setState = (element, ...states) => {
        initState(element);
        element[STATES] = [...states];
        applyState(element);
    };
    /**
     * Remove the states and update element.
     */
    const removeState = (element, ...states) => {
        initState(element);
        for (const state of states) {
            const index = element[STATES].indexOf(state);
            if (index !== -1) {
                element[STATES].splice(index, 1);
            }
        }
        applyState(element);
    };
    const hasState = (element, state) => {
        initState(element);
        return element[STATES].indexOf(state) !== -1;
    };
    return {
        setState,
        updateState,
        removeState,
        hasState,
    };
}
exports.useState = useState;
function isEmptyObject(obj) {
    if (obj === undefined)
        return true;
    if (typeof obj !== 'object')
        return false;
    return Object.keys(obj).length === 0;
}
// A function to generate key for mark each view.
function keyed(viewKey, markKey) {
    return `${viewKey},${markKey}`;
}
function mergeState(options, states) {
    // Index state by mark key and view key.
    const views = Array.isArray(options) ? options : [options];
    const markState = views.flatMap((view) => view.marks.map((mark) => [keyed(view.key, mark.key), mark.state]));
    const state = {};
    // Update each specified state.
    for (const descriptor of states) {
        const [key, defaults] = Array.isArray(descriptor)
            ? descriptor
            : [descriptor, {}];
        // Update each specified mark state.
        state[key] = markState.reduce((merged, mark) => {
            // Normalize state.
            const [markKey, markState = {}] = mark;
            const selectedState = isEmptyObject(markState[key])
                ? defaults
                : markState[key];
            // Update each state attribute.
            for (const [attr, value] of Object.entries(selectedState)) {
                const oldValue = merged[attr];
                const newValue = (data, index, array, element) => {
                    const k = keyed(element.__data__.viewKey, element.__data__.markKey);
                    if (markKey !== k)
                        return oldValue === null || oldValue === void 0 ? void 0 : oldValue(data, index, array, element);
                    if (typeof value !== 'function')
                        return value;
                    return value(data, index, array, element);
                };
                merged[attr] = newValue;
            }
            return merged;
        }, {});
    }
    return state;
}
exports.mergeState = mergeState;
// @todo Support elements from different view.
function createValueof(elements, datum) {
    const elementIndex = new Map(elements.map((d, i) => [d, i]));
    const fa = datum ? elements.map(datum) : elements;
    return (d, e) => {
        if (typeof d !== 'function')
            return d;
        const i = elementIndex.get(e);
        const fe = datum ? datum(e) : e;
        return d(fe, i, fa, e);
    };
}
exports.createValueof = createValueof;
function renderLink(_a) {
    var { link = false, valueof = (d, element) => d, coordinate } = _a, style = __rest(_a, ["link", "valueof", "coordinate"]);
    const LINK_CLASS_NAME = 'element-link';
    if (!link)
        return [() => { }, () => { }];
    const pointsOf = (element) => element.__data__.points;
    const pathPointsOf = (P0, P1) => {
        const [, p1, p2] = P0;
        const [p0, , , p3] = P1;
        const P = [p1, p0, p3, p2];
        return P;
    };
    const append = (elements) => {
        var _a;
        if (elements.length <= 1)
            return;
        // Sort elements by normalized x to avoid cross.
        const sortedElements = (0, d3_array_1.sort)(elements, (e0, e1) => {
            const { x: x0 } = e0.__data__;
            const { x: x1 } = e1.__data__;
            const dx = x0 - x1;
            return dx;
        });
        for (let i = 1; i < sortedElements.length; i++) {
            const p = (0, d3_path_1.path)();
            const e0 = sortedElements[i - 1];
            const e1 = sortedElements[i];
            const [p0, p1, p2, p3] = pathPointsOf(pointsOf(e0), pointsOf(e1));
            p.moveTo(...p0);
            p.lineTo(...p1);
            p.lineTo(...p2);
            p.lineTo(...p3);
            p.closePath();
            const _b = (0, array_1.mapObject)(style, (d) => valueof(d, e0)), { fill = e0.getAttribute('fill') } = _b, rest = __rest(_b, ["fill"]);
            const link = new g_1.Path({
                className: LINK_CLASS_NAME,
                style: Object.assign({ d: p.toString(), fill, zIndex: -2 }, rest),
            });
            // @ts-ignore
            (_a = e0.link) === null || _a === void 0 ? void 0 : _a.remove();
            e0.parentNode.appendChild(link);
            // @ts-ignore
            e0.link = link;
        }
    };
    const remove = (element) => {
        var _a;
        (_a = element.link) === null || _a === void 0 ? void 0 : _a.remove();
        element.link = null;
    };
    return [append, remove];
}
exports.renderLink = renderLink;
// Apply translate to mock slice out.
function offsetTransform(element, offset, coordinate) {
    const append = (t) => {
        const { transform } = element.style;
        return transform ? `${transform} ${t}` : t;
    };
    if ((0, coordinate_1.isPolar)(coordinate)) {
        const { points } = element.__data__;
        const [p0, p1] = (0, coordinate_1.isTranspose)(coordinate) ? (0, utils_1.reorder)(points) : points;
        const center = coordinate.getCenter();
        const v0 = (0, vector_1.sub)(p0, center);
        const v1 = (0, vector_1.sub)(p1, center);
        const a0 = (0, vector_1.angle)(v0);
        const da = (0, vector_1.angleBetween)(v0, v1);
        const amid = a0 + da / 2;
        const dx = offset * Math.cos(amid);
        const dy = offset * Math.sin(amid);
        return append(`translate(${dx}, ${dy})`);
    }
    if ((0, coordinate_1.isTranspose)(coordinate))
        return append(`translate(${offset}, 0)`);
    return append(`translate(0, ${-offset})`);
}
exports.offsetTransform = offsetTransform;
function renderBackground(_a) {
    var { document, background, scale, coordinate, valueof } = _a, rest = __rest(_a, ["document", "background", "scale", "coordinate", "valueof"]);
    const BACKGROUND_CLASS_NAME = 'element-background';
    // Don't have background.
    if (!background)
        return [() => { }, () => { }];
    const extentOf = (scale, x, padding) => {
        const ax = scale.invert(x);
        const mid = x + scale.getBandWidth(ax) / 2;
        const half = scale.getStep(ax) / 2;
        const offset = half * padding;
        return [mid - half + offset, mid + half - offset];
    };
    const sizeXOf = (element, padding) => {
        const { x: scaleX } = scale;
        if (!(0, scale_1.isOrdinalScale)(scaleX))
            return [0, 1];
        const { __data__: data } = element;
        const { x } = data;
        const [e1, e2] = extentOf(scaleX, x, padding);
        return [e1, e2];
    };
    const sizeYOf = (element, padding) => {
        const { y: scaleY } = scale;
        if (!(0, scale_1.isOrdinalScale)(scaleY))
            return [0, 1];
        const { __data__: data } = element;
        const { y } = data;
        const [e1, e2] = extentOf(scaleY, y, padding);
        return [e1, e2];
    };
    const bandShapeOf = (element, style) => {
        const { padding } = style;
        const [x1, x2] = sizeXOf(element, padding);
        const [y1, y2] = sizeYOf(element, padding);
        const points = [
            [x1, y1],
            [x2, y1],
            [x2, y2],
            [x1, y2],
        ].map((d) => coordinate.map(d));
        const { __data__: data } = element;
        const { y: dy, y1: dy1 } = data;
        return (0, color_1.rect)(document, points, { y: dy, y1: dy1 }, coordinate, style);
    };
    // Shape without ordinal style.
    // Clone and scale it.
    const cloneShapeOf = (element, style) => {
        const { transform = 'scale(1.2, 1.2)', transformOrigin = 'center center', stroke = '' } = style, rest = __rest(style, ["transform", "transformOrigin", "stroke"]);
        const finalStyle = Object.assign({ transform, transformOrigin, stroke }, rest);
        const shape = element.cloneNode(true);
        for (const [key, value] of Object.entries(finalStyle)) {
            shape.style[key] = value;
        }
        return shape;
    };
    const isOrdinalShape = () => {
        const { x, y } = scale;
        return [x, y].some(scale_1.isOrdinalScale);
    };
    const append = (element) => {
        if (element.background)
            element.background.remove();
        const _a = (0, array_1.mapObject)(rest, (d) => valueof(d, element)), { fill = '#CCD6EC', fillOpacity = 0.3, zIndex = -2, padding = 0.001, lineWidth = 0 } = _a, style = __rest(_a, ["fill", "fillOpacity", "zIndex", "padding", "lineWidth"]);
        const finalStyle = Object.assign(Object.assign({}, style), { fill,
            fillOpacity,
            zIndex,
            padding,
            lineWidth });
        const shapeOf = isOrdinalShape() ? bandShapeOf : cloneShapeOf;
        const shape = shapeOf(element, finalStyle);
        shape.className = BACKGROUND_CLASS_NAME;
        element.parentNode.parentNode.appendChild(shape);
        element.background = shape;
    };
    const remove = (element) => {
        var _a;
        (_a = element.background) === null || _a === void 0 ? void 0 : _a.remove();
        element.background = null;
    };
    const is = (element) => {
        return element.className === BACKGROUND_CLASS_NAME;
    };
    return [append, remove, is];
}
exports.renderBackground = renderBackground;
function setCursor(root, cursor) {
    // @ts-ignore
    const canvas = root.getRootNode().defaultView;
    const dom = canvas.getContextService().getDomElement();
    if (dom === null || dom === void 0 ? void 0 : dom.style) {
        root.cursor = dom.style.cursor;
        dom.style.cursor = cursor;
    }
}
exports.setCursor = setCursor;
function restoreCursor(root) {
    setCursor(root, root.cursor);
}
exports.restoreCursor = restoreCursor;
function selectElementByData(elements, data, datum) {
    return elements.find((d) => Object.entries(data).every(([key, value]) => datum(d)[key] === value));
}
exports.selectElementByData = selectElementByData;
function getPointsR(point, nextPoint) {
    return Math.sqrt(Math.pow(point[0] - nextPoint[0], 2) + Math.pow(point[1] - nextPoint[1], 2));
}
exports.getPointsR = getPointsR;
// Points create path.
function getPointsPath(points, isClose = false) {
    const path = (0, util_1.filter)(points, (d) => !!d).map((d, i) => {
        return [i === 0 ? 'M' : 'L', ...d];
    });
    if (isClose) {
        path.push(['Z']);
    }
    return path;
}
exports.getPointsPath = getPointsPath;
// Get element.
function getElements(plot) {
    return plot.querySelectorAll('.element');
}
exports.getElements = getElements;
// Get Theta coordinate round path.
function getThetaPath(center, points, isBig = 0) {
    const path = [['M', ...points[1]]];
    const innerRadius = getPointsR(center, points[1]);
    const outerRadius = getPointsR(center, points[0]);
    if (innerRadius === 0) {
        path.push(['L', ...points[3]], ['A', outerRadius, outerRadius, 0, isBig, 1, ...points[0]], ['Z']);
    }
    else {
        path.push(['A', innerRadius, innerRadius, 0, isBig, 0, ...points[2]], ['L', ...points[3]], ['A', outerRadius, outerRadius, 0, isBig, 1, ...points[0]], ['Z']);
    }
    return path;
}
exports.getThetaPath = getThetaPath;
function maybeRoot(node, rootOf) {
    if (rootOf(node))
        return node;
    let root = node.parent;
    while (root && !rootOf(root))
        root = root.parent;
    return root;
}
exports.maybeRoot = maybeRoot;
exports.VALID_FIND_BY_X_MARKS = ['interval', 'point', 'density'];
/**
 * @description Create function that can find element by event.
 * @returns Element find function.
 */
function createFindElementByEvent({ elementsof, root, coordinate, scale, validFindByXMarks = exports.VALID_FIND_BY_X_MARKS, }) {
    var _a, _b;
    let elements = elementsof(root);
    const getValidFindByXMarks = (d) => validFindByXMarks.includes(d.markType);
    const hasValidFindByXMarks = elements.find(getValidFindByXMarks);
    // Try to find element by x position.
    if (hasValidFindByXMarks) {
        elements = elements.filter(getValidFindByXMarks);
        const scaleX = scale.x;
        const scaleSeries = scale.series;
        const bandWidth = (_b = (_a = scaleX === null || scaleX === void 0 ? void 0 : scaleX.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(scaleX)) !== null && _b !== void 0 ? _b : 0;
        const xof = scaleSeries
            ? (d) => {
                const seriesCount = Math.round(1 / scaleSeries.valueBandWidth);
                return (d.__data__.x +
                    d.__data__.series * bandWidth +
                    bandWidth / (seriesCount * 2));
            }
            : (d) => d.__data__.x + bandWidth / 2;
        // Sort for bisector search.
        elements.sort((a, b) => xof(a) - xof(b));
        return (event) => {
            const mouse = mousePosition(root, event);
            if (!mouse)
                return;
            const [abstractX] = coordinate.invert(mouse);
            const search = (0, d3_array_1.bisector)(xof).center;
            const i = search(elements, abstractX);
            const target = elements[i];
            return target;
        };
    }
    // If there is no valid element find by x, just return the target element.
    return (event) => {
        const { target } = event;
        return maybeRoot(target, (node) => {
            if (!node.classList)
                return false;
            return node.classList.includes('element');
        });
    };
}
exports.createFindElementByEvent = createFindElementByEvent;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {"../utils/selection":1751263815883,"../utils/array":1751263815830,"../runtime":1751263816081,"../utils/scale":1751263816057,"../shape/interval/color":1751263815881,"../utils/coordinate":1751263815882,"../utils/style":1751263816122,"../shape/utils":1751263815885,"../utils/vector":1751263815873,"../utils/traverse-elements":1751263816123}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816081, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroy = exports.renderToMountedElement = exports.render = void 0;
__exportStar(require("./constant"), exports);
__exportStar(require("./types/common"), exports);
__exportStar(require("./types/component"), exports);
__exportStar(require("./types/options"), exports);
__exportStar(require("./types/transform"), exports);
__exportStar(require("./types/encode"), exports);
__exportStar(require("./types/mark"), exports);
__exportStar(require("./types/data"), exports);
var render_1 = require("./render");
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return render_1.render; } });
Object.defineProperty(exports, "renderToMountedElement", { enumerable: true, get: function () { return render_1.renderToMountedElement; } });
Object.defineProperty(exports, "destroy", { enumerable: true, get: function () { return render_1.destroy; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./constant":1751263816082,"./types/common":1751263816083,"./types/component":1751263816084,"./types/options":1751263816085,"./types/transform":1751263816086,"./types/encode":1751263816087,"./types/mark":1751263816088,"./types/data":1751263816089,"./render":1751263816090}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816082, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.MASK_CLASS_NAME = exports.AREA_CLASS_NAME = exports.LABEL_CLASS_NAME = exports.COMPONENT_CLASS_NAME = exports.PLOT_CLASS_NAME = exports.VIEW_CLASS_NAME = exports.ELEMENT_CLASS_NAME = exports.LABEL_LAYER_CLASS_NAME = exports.MAIN_LAYER_CLASS_NAME = void 0;
exports.MAIN_LAYER_CLASS_NAME = 'main-layer';
exports.LABEL_LAYER_CLASS_NAME = 'label-layer';
exports.ELEMENT_CLASS_NAME = 'element';
exports.VIEW_CLASS_NAME = 'view';
exports.PLOT_CLASS_NAME = 'plot';
exports.COMPONENT_CLASS_NAME = 'component';
exports.LABEL_CLASS_NAME = 'label';
exports.AREA_CLASS_NAME = 'area';
exports.MASK_CLASS_NAME = 'mask';
//# sourceMappingURL=constant.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816083, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=common.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816084, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=component.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816085, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=options.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816086, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=transform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816087, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=encode.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816088, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816089, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816090, function(require, module, exports) {

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroy = exports.renderToMountedElement = exports.render = void 0;
const g_1 = require("@antv/g");
const g_canvas_1 = require("@antv/g-canvas");
const g_plugin_dragndrop_1 = require("@antv/g-plugin-dragndrop");
const util_1 = require("@antv/util");
const event_emitter_1 = __importDefault(require("@antv/event-emitter"));
const selection_1 = require("../utils/selection");
const event_1 = require("../utils/event");
const helper_1 = require("../utils/helper");
const expr_1 = require("../utils/expr");
const plot_1 = require("./plot");
const constant_1 = require("./constant");
const option_preprocess_1 = require("./option-preprocess");
/**
 * Infer key for each node of view tree.
 * Each key should be unique in the entire view tree.
 * The key is for incremental render when view tree is changed.
 * @todo Fix custom key equals to inferred key.
 */
function inferKeys(options) {
    const root = (0, util_1.deepMix)({}, options);
    const nodeParent = new Map([[root, null]]);
    const nodeIndex = new Map([[null, -1]]);
    const discovered = [root];
    while (discovered.length) {
        const node = discovered.shift();
        // If key of node is not specified, using parentKey and the index for it
        // in parent.children as its key.
        // e.g. The key of node named 'a' will be 'a', and the key of node named
        // 'b' will be 'parent-1' in the following view tree specification.
        // { key: 'parent', children: [{ name: 'a', key: 'a' }, { name: 'b' }] }
        if (node.key === undefined) {
            const parent = nodeParent.get(node);
            const index = nodeIndex.get(node);
            const key = parent === null ? `${0}` : `${parent.key}-${index}`;
            node.key = key;
        }
        const { children = [] } = node;
        if (Array.isArray(children)) {
            for (let i = 0; i < children.length; i++) {
                // Clone node as well.
                const child = (0, util_1.deepMix)({}, children[i]);
                children[i] = child;
                nodeParent.set(child, node);
                nodeIndex.set(child, i);
                discovered.push(child);
            }
        }
    }
    return root;
}
function Canvas(width, height) {
    const renderer = new g_canvas_1.Renderer();
    // DragAndDropPlugin is for interaction.
    renderer.registerPlugin(new g_plugin_dragndrop_1.Plugin());
    return new g_1.Canvas({
        width,
        height,
        container: document.createElement('div'),
        renderer: renderer,
    });
}
function render(options, context = {}, resolve = () => { }, reject = (e) => {
    throw e;
}) {
    const afterParsedOptions = (0, expr_1.parseOptionsExpr)(options);
    // Initialize the context if it is not provided.
    const { width = 640, height = 480, depth = 0 } = afterParsedOptions;
    // Preprocessing here, such as syntactic sugar.
    const preprocessedOption = (0, option_preprocess_1.preprocessOption)(afterParsedOptions);
    const keyed = inferKeys(preprocessedOption);
    const { canvas = Canvas(width, height), emitter = new event_emitter_1.default(), library, } = context;
    context.canvas = canvas;
    context.emitter = emitter;
    const { width: prevWidth, height: prevHeight } = canvas.getConfig();
    if (prevWidth !== width || prevHeight !== height) {
        canvas.resize(width, height);
    }
    emitter.emit(event_1.ChartEvent.BEFORE_RENDER);
    // Plot the chart and mutate context.
    // Make sure that plot chart after container is ready for every time.
    const selection = (0, selection_1.select)(canvas.document.documentElement);
    canvas.ready
        .then(() => (0, plot_1.plot)(Object.assign(Object.assign({}, keyed), { width, height, depth }), selection, context))
        .then(() => {
        // Place the center of whole scene at z axis' origin.
        if (depth) {
            const [x, y] = canvas.document.documentElement.getPosition();
            // Since `render` method can be called for multiple times, use setPosition instead of translate here.
            canvas.document.documentElement.setPosition(x, y, -depth / 2);
        }
        // Wait for the next tick.
        // FIXME: Use `rendered?` event instead of `requestAnimationFrame`.
        canvas.requestAnimationFrame(() => {
            canvas.requestAnimationFrame(() => {
                emitter.emit(event_1.ChartEvent.AFTER_RENDER);
                resolve === null || resolve === void 0 ? void 0 : resolve();
            });
        });
    })
        .catch((e) => {
        reject === null || reject === void 0 ? void 0 : reject(e);
    });
    // Return the container HTML element wraps the canvas or svg element.
    return normalizeContainer(canvas.getConfig().container);
}
exports.render = render;
function renderToMountedElement(options, context = {}, resolve = () => { }, reject = (e) => {
    throw e;
}) {
    var _a;
    // Initialize the context if it is not provided.
    const { width = 640, height = 480 } = options;
    const keyed = inferKeys(options);
    const { group = new g_1.Group(), emitter = new event_emitter_1.default(), library, } = context;
    if (!(group === null || group === void 0 ? void 0 : group.parentElement)) {
        (0, helper_1.error)(`renderToMountedElement can't render chart to unmounted group.`);
    }
    const selection = (0, selection_1.select)(group);
    context.group = group;
    context.emitter = emitter;
    context.canvas =
        context.canvas || ((_a = group === null || group === void 0 ? void 0 : group.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView);
    emitter.emit(event_1.ChartEvent.BEFORE_RENDER);
    // Plot the chart and mutate context.
    // Make sure that plot chart after container is ready for every time.
    (0, plot_1.plot)(Object.assign(Object.assign({}, keyed), { width, height }), selection, context)
        .then(() => {
        var _a;
        (_a = context.canvas) === null || _a === void 0 ? void 0 : _a.requestAnimationFrame(() => {
            emitter.emit(event_1.ChartEvent.AFTER_RENDER);
            resolve === null || resolve === void 0 ? void 0 : resolve();
        });
    })
        .catch((e) => {
        reject === null || reject === void 0 ? void 0 : reject(e);
    });
    // Return the Group wraps the canvas or svg element.
    return group;
}
exports.renderToMountedElement = renderToMountedElement;
function destroy(options, context = {}, isDestroyCanvas = false) {
    const { canvas, emitter } = context;
    if (canvas) {
        destroyAllInteractions(canvas);
        isDestroyCanvas ? canvas.destroy() : canvas.destroyChildren();
    }
    emitter.off();
}
exports.destroy = destroy;
/**
 * Destroy all interactions mounted on the canvas.
 */
function destroyAllInteractions(canvas) {
    const viewGroups = canvas.getRoot().querySelectorAll(`.${constant_1.VIEW_CLASS_NAME}`);
    viewGroups === null || viewGroups === void 0 ? void 0 : viewGroups.forEach((group) => {
        const { nameInteraction = new Map() } = group;
        if ((nameInteraction === null || nameInteraction === void 0 ? void 0 : nameInteraction.size) > 0) {
            Array.from(nameInteraction === null || nameInteraction === void 0 ? void 0 : nameInteraction.values()).forEach((value) => {
                value === null || value === void 0 ? void 0 : value.destroy();
            });
        }
    });
}
function normalizeContainer(container) {
    return typeof container === 'string'
        ? document.getElementById(container)
        : container;
}
//# sourceMappingURL=render.js.map
}, function(modId) { var map = {"../utils/selection":1751263815883,"../utils/event":1751263816091,"../utils/helper":1751263815829,"../utils/expr":1751263816092,"./plot":1751263816093,"./constant":1751263816082,"./option-preprocess":1751263816119}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816091, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartEvent = void 0;
// to prevent users from tampering with internal values.
exports.ChartEvent = {
    BEFORE_RENDER: 'beforerender',
    AFTER_RENDER: 'afterrender',
    BEFORE_PAINT: 'beforepaint',
    AFTER_PAINT: 'afterpaint',
    BEFORE_CHANGE_DATA: 'beforechangedata',
    AFTER_CHANGE_DATA: 'afterchangedata',
    BEFORE_CLEAR: 'beforeclear',
    AFTER_CLEAR: 'afterclear',
    BEFORE_DESTROY: 'beforedestroy',
    AFTER_DESTROY: 'afterdestroy',
    BEFORE_CHANGE_SIZE: 'beforechangesize',
    AFTER_CHANGE_SIZE: 'afterchangesize',
    POINTER_TAP: 'pointertap',
    POINTER_DOWN: 'pointerdown',
    POINTER_UP: 'pointerup',
    POINTER_OVER: 'pointerover',
    POINTER_OUT: 'pointerout',
    POINTER_MOVE: 'pointermove',
    POINTER_ENTER: 'pointerenter',
    POINTER_LEAVE: 'pointerleave',
    POINTER_UPOUTSIDE: 'pointerupoutside',
    DRAG_START: 'dragstart',
    DRAG: 'drag',
    DRAG_END: 'dragend',
    DRAG_ENTER: 'dragenter',
    DRAG_LEAVE: 'dragleave',
    DRAG_OVER: 'dragover',
    DROP: 'DROP',
    CLICK: 'click',
    DBLCLICK: 'dblclick',
};
//# sourceMappingURL=event.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816092, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseOptionsExpr = exports.EXPR_WHITE_LIST = void 0;
const expr_1 = require("@antv/expr");
const util_1 = require("@antv/util");
const lru_1 = require("./lru");
// Whitelist of properties that can contain expressions.
exports.EXPR_WHITE_LIST = ['style', 'encode', 'labels', 'children'];
/**
 * Compiles an expression string into a function.
 * @param expr Expression string to compile.
 * @returns Compiled function or original string if empty.
 */
const compileExpression = (0, lru_1.lru)((expr) => {
    const evaluator = (0, expr_1.compile)(expr);
    return (...args) => {
        const paramNames = Array.from({ length: args.length }, (_, i) => String.fromCharCode(97 + i));
        const namedParams = Object.fromEntries(args.map((value, index) => [paramNames[index], value]));
        // global is used to overview what can i get in props.
        return evaluator(Object.assign(Object.assign({}, namedParams), { global: Object.assign({}, namedParams) }));
    };
}, (expr) => expr, 128);
/**
 * Processes options object to convert expressions to functions.
 * @param options Options object to process.
 * @param isSpecRoot Whether the options is the root of the spec.
 * @returns Processed options object with expressions converted to functions.
 */
function parseOptionsExpr(options, isSpecRoot = true) {
    if (Array.isArray(options)) {
        return options.map((_, i) => parseOptionsExpr(options[i], isSpecRoot));
    }
    if (typeof options === 'object' && options) {
        return (0, util_1.mapValues)(options, (value, key) => {
            // if options is root and the key is in the white list, parse the expression.
            if (isSpecRoot && exports.EXPR_WHITE_LIST.includes(key)) {
                return parseOptionsExpr(value, key === 'children');
            }
            if (!isSpecRoot) {
                return parseOptionsExpr(value, false);
            }
            return value;
        });
    }
    // if options is a string and is a valid expression.
    if (typeof options === 'string') {
        const trimmed = options.trim();
        if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
            return compileExpression(trimmed.slice(1, -1));
        }
    }
    return options;
}
exports.parseOptionsExpr = parseOptionsExpr;
//# sourceMappingURL=expr.js.map
}, function(modId) { var map = {"./lru":1751263815967}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816093, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyStyle = exports.plot = void 0;
const g_1 = require("@antv/g");
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const d3_format_1 = require("@antv/vendor/d3-format");
const array_1 = require("../utils/array");
const event_1 = require("../utils/event");
const helper_1 = require("../utils/helper");
const selection_1 = require("../utils/selection");
const component_1 = require("./component");
const constant_1 = require("./constant");
const coordinate_1 = require("./coordinate");
const layout_1 = require("./layout");
const library_1 = require("./library");
const mark_1 = require("./mark");
const scale_1 = require("./scale");
const transform_1 = require("./transform");
function plot(options, selection, context) {
    var _a;
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const [useComposition] = (0, library_1.useLibrary)('composition', library);
        const [useInteraction] = (0, library_1.useLibrary)('interaction', library);
        // Some helper functions.
        const marks = new Set(Object.keys(library)
            .map((d) => { var _a; return (_a = /mark\.(.*)/.exec(d)) === null || _a === void 0 ? void 0 : _a[1]; })
            .filter(helper_1.defined));
        const staticMarks = new Set(Object.keys(library)
            .map((d) => { var _a; return (_a = /component\.(.*)/.exec(d)) === null || _a === void 0 ? void 0 : _a[1]; })
            .filter(helper_1.defined));
        const typeOf = (node) => {
            const { type } = node;
            if (typeof type === 'function') {
                // @ts-ignore
                const { props = {} } = type;
                const { composite = true } = props;
                if (composite)
                    return 'mark';
            }
            if (typeof type !== 'string')
                return type;
            if (marks.has(type) || staticMarks.has(type))
                return 'mark';
            return type;
        };
        const isMark = (node) => typeOf(node) === 'mark';
        const isStandardView = (node) => typeOf(node) === 'standardView';
        const isStaticMark = (node) => {
            const { type } = node;
            if (typeof type !== 'string')
                return false;
            if (staticMarks.has(type))
                return true;
            return false;
        };
        const transform = (node) => {
            if (isStandardView(node))
                return [node];
            const type = typeOf(node);
            const composition = useComposition({ type, static: isStaticMark(node) });
            return composition(node);
        };
        // Some temporary variables help parse the view tree.
        const views = [];
        const viewNode = new Map();
        const nodeState = new Map();
        const discovered = [options];
        const nodeGenerators = [];
        while (discovered.length) {
            const node = discovered.shift();
            if (isStandardView(node)) {
                // Initialize view to get data to be visualized. If the marks
                // of the view have already been initialized (facet view),
                // initialize the view based on the initialized mark states,
                // otherwise initialize it from beginning.
                const state = nodeState.get(node);
                const [view, children] = state
                    ? initializeState(state, node, library)
                    : yield initializeView(node, context);
                viewNode.set(view, node);
                views.push(view);
                // Transform children, they will be transformed into
                // standardView if they are mark or view node.
                const transformedNodes = children
                    .flatMap(transform)
                    .map((d) => (0, coordinate_1.coordinate2Transform)(d, library));
                discovered.push(...transformedNodes);
                // Only StandardView can be treated as facet and it
                // should sync position scales among facets normally.
                if (transformedNodes.every(isStandardView)) {
                    const states = yield Promise.all(transformedNodes.map((d) => initializeMarks(d, context)));
                    // Note!!!
                    // This will mutate scales for marks.
                    (0, scale_1.syncFacetsScales)(states);
                    for (let i = 0; i < transformedNodes.length; i++) {
                        const nodeT = transformedNodes[i];
                        const state = states[i];
                        nodeState.set(nodeT, state);
                    }
                }
            }
            else {
                // Apply transform to get data in advance for non-mark composition
                // node, which makes sure that composition node can preprocess the
                // data to produce more nodes based on it.
                const n = isMark(node) ? node : yield applyTransform(node, context);
                const N = transform(n);
                if (Array.isArray(N))
                    discovered.push(...N);
                else if (typeof N === 'function')
                    nodeGenerators.push(N());
            }
        }
        context.emitter.emit(event_1.ChartEvent.BEFORE_PAINT);
        // Plot chart.
        const enterContainer = new Map();
        const updateContainer = new Map();
        const transitions = [];
        selection
            .selectAll(className(constant_1.VIEW_CLASS_NAME))
            .data(views, (d) => d.key)
            .join((enter) => enter
            .append('g')
            .attr('className', constant_1.VIEW_CLASS_NAME)
            .attr('id', (view) => view.key)
            .call(applyTranslate)
            .each(function (view, i, element) {
            plotView(view, (0, selection_1.select)(element), transitions, context);
            enterContainer.set(view, element);
        }), (update) => update.call(applyTranslate).each(function (view, i, element) {
            plotView(view, (0, selection_1.select)(element), transitions, context);
            updateContainer.set(view, element);
        }), (exit) => exit
            .each(function (d, i, element) {
            // Remove existed interactions.
            const interactions = element['nameInteraction'].values();
            for (const interaction of interactions) {
                interaction.destroy();
            }
        })
            .remove());
        // Apply interactions.
        const viewInstanceof = (viewContainer, updateInteractions, oldStore) => {
            return Array.from(viewContainer.entries()).map(([view, container]) => {
                // Index state by component or interaction name,
                // such as legend, scrollbar, brushFilter.
                // Each state transform options to another options.
                const store = oldStore || new Map();
                const setState = (key, reducer = (x) => x) => store.set(key, reducer);
                const options = viewNode.get(view);
                const update = createUpdateView((0, selection_1.select)(container), options, context);
                return {
                    view,
                    container,
                    options,
                    setState,
                    update: (from, updateTypes) => __awaiter(this, void 0, void 0, function* () {
                        // Apply all state functions to get new options.
                        const reducer = (0, helper_1.compose)(Array.from(store.values()));
                        const newOptions = reducer(options);
                        return yield update(newOptions, from, () => {
                            if ((0, util_1.isArray)(updateTypes)) {
                                updateInteractions(viewContainer, updateTypes, store);
                            }
                        });
                    }),
                };
            });
        };
        const updateInteractions = (container = updateContainer, updateType, oldStore) => {
            var _a;
            // Interactions for update views.
            const updateViewInstances = viewInstanceof(container, updateInteractions, oldStore);
            for (const target of updateViewInstances) {
                const { options, container } = target;
                const nameInteraction = container['nameInteraction'];
                let typeOptions = inferInteraction(options);
                if (updateType) {
                    typeOptions = typeOptions.filter((v) => updateType.includes(v[0]));
                }
                for (const typeOption of typeOptions) {
                    const [type, option] = typeOption;
                    // Remove interaction for existed views.
                    const prevInteraction = nameInteraction.get(type);
                    if (prevInteraction)
                        (_a = prevInteraction.destroy) === null || _a === void 0 ? void 0 : _a.call(prevInteraction);
                    // Apply new interaction.
                    if (option) {
                        const interaction = useThemeInteraction(target.view, type, option, useInteraction);
                        const destroy = interaction(target, updateViewInstances, context.emitter);
                        nameInteraction.set(type, { destroy });
                    }
                }
            }
        };
        // Interactions for enter views.
        const enterViewInstances = viewInstanceof(enterContainer, updateInteractions);
        for (const target of enterViewInstances) {
            const { options } = target;
            // A Map index interaction by interaction name.
            const nameInteraction = new Map();
            target.container['nameInteraction'] = nameInteraction;
            // Apply interactions.
            for (const typeOption of inferInteraction(options)) {
                const [type, option] = typeOption;
                if (option) {
                    const interaction = useThemeInteraction(target.view, type, option, useInteraction);
                    const destroy = interaction(target, enterViewInstances, context.emitter);
                    nameInteraction.set(type, { destroy });
                }
            }
        }
        updateInteractions();
        // Author animations.
        const { width, height } = options;
        const keyframes = [];
        for (const nodeGenerator of nodeGenerators) {
            // Delay the rendering of animation keyframe. Different animation
            // created by different nodeGenerator will play in the same time.
            // eslint-disable-next-line no-async-promise-executor
            const keyframe = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
                for (const node of nodeGenerator) {
                    const sizedNode = Object.assign({ width, height }, node);
                    yield plot(sizedNode, selection, context);
                }
                resolve();
            }));
            keyframes.push(keyframe);
        }
        context.views = views;
        // Clear and update animation.
        (_a = context.animations) === null || _a === void 0 ? void 0 : _a.forEach((animation) => animation === null || animation === void 0 ? void 0 : animation.cancel());
        context.animations = transitions;
        context.emitter.emit(event_1.ChartEvent.AFTER_PAINT);
        // Note!!!
        // The returned promise will never resolved if one of nodeGenerator
        // never stop to yield node, which may created by a keyframe composition
        // with iteration count set to infinite.
        const finished = transitions
            .filter(helper_1.defined)
            .map(cancel)
            .map((d) => d.finished);
        return Promise.all([...finished, ...keyframes]);
    });
}
exports.plot = plot;
function applyTranslate(selection) {
    selection.style('transform', (d) => `translate(${d.layout.x}, ${d.layout.y})`);
}
function definedInteraction(library) {
    const [, createInteraction] = (0, library_1.useLibrary)('interaction', library);
    return (d) => {
        const [name, options] = d;
        try {
            return [name, createInteraction(name)];
        }
        catch (_a) {
            return [name, options.type];
        }
    };
}
function createUpdateView(selection, options, context) {
    const { library } = context;
    const createDefinedInteraction = definedInteraction(library);
    const filter = (d) => d[1] && d[1].props && d[1].props.reapplyWhenUpdate;
    const interactions = inferInteraction(options);
    const updates = interactions
        .map(createDefinedInteraction)
        .filter(filter)
        .map((d) => d[0]);
    return (newOptions, source, callback) => __awaiter(this, void 0, void 0, function* () {
        const transitions = [];
        const [newView, newChildren] = yield initializeView(newOptions, context);
        plotView(newView, selection, transitions, context);
        // Update interaction need to reapply when update.
        for (const name of updates.filter((d) => d !== source)) {
            updateInteraction(name, selection, newOptions, newView, context);
        }
        for (const child of newChildren) {
            plot(child, selection, context);
        }
        callback();
        return { options: newOptions, view: newView };
    });
}
function updateInteraction(name, selection, options, view, context) {
    var _a;
    const { library } = context;
    const [useInteraction] = (0, library_1.useLibrary)('interaction', library);
    // Instances for interaction.
    const container = selection.node();
    const nameInteraction = container['nameInteraction'];
    const interactionOptions = inferInteraction(options).find(([d]) => d === name);
    // Destroy older interaction.
    const interaction = nameInteraction.get(name);
    if (!interaction)
        return;
    (_a = interaction.destroy) === null || _a === void 0 ? void 0 : _a.call(interaction);
    if (!interactionOptions[1])
        return;
    // Apply new interaction.
    const applyInteraction = useThemeInteraction(view, name, interactionOptions[1], useInteraction);
    const target = {
        options,
        view,
        container: selection.node(),
        update: (options) => Promise.resolve(options),
    };
    const destroy = applyInteraction(target, [], context.emitter);
    nameInteraction.set(name, { destroy });
}
function initializeView(options, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const flattenOptions = yield transformMarks(options, context);
        const mergedOptions = bubbleOptions(flattenOptions);
        // @todo Remove this.
        // !!! NOTE: Mute original view options.
        // Update interaction and coordinate for this view.
        options.interaction = mergedOptions.interaction;
        options.coordinate = mergedOptions.coordinate;
        // @ts-ignore
        options.marks = [...mergedOptions.marks, ...mergedOptions.components];
        const transformedOptions = (0, coordinate_1.coordinate2Transform)(mergedOptions, library);
        const state = yield initializeMarks(transformedOptions, context);
        return initializeState(state, transformedOptions, library);
    });
}
function bubbleOptions(options) {
    const { coordinate: viewCoordinate = {}, interaction: viewInteraction = {}, style: viewStyle = {}, marks } = options, rest = __rest(options, ["coordinate", "interaction", "style", "marks"]);
    const markCoordinates = marks.map((d) => d.coordinate || {});
    const markInteractions = marks.map((d) => d.interaction || {});
    const markViewStyles = marks.map((d) => d.viewStyle || {});
    const newCoordinate = [...markCoordinates, viewCoordinate].reduceRight((prev, cur) => (0, util_1.deepMix)(prev, cur), {});
    const newInteraction = [viewInteraction, ...markInteractions].reduce((prev, cur) => (0, util_1.deepMix)(prev, cur), {});
    const newStyle = [...markViewStyles, viewStyle].reduce((prev, cur) => (0, util_1.deepMix)(prev, cur), {});
    return Object.assign(Object.assign({}, rest), { marks, coordinate: newCoordinate, interaction: newInteraction, style: newStyle });
}
function transformMarks(options, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const [useMark, createMark] = (0, library_1.useLibrary)('mark', library);
        const staticMarks = new Set(Object.keys(library)
            .map((d) => { var _a; return (_a = /component\.(.*)/.exec(d)) === null || _a === void 0 ? void 0 : _a[1]; })
            .filter(helper_1.defined));
        const { marks } = options;
        const flattenMarks = [];
        const components = [];
        const discovered = [...marks];
        const { width, height } = (0, layout_1.computeRoughPlotSize)(options);
        const markOptions = { options, width, height };
        // Pre order traversal.
        while (discovered.length) {
            const [node] = discovered.splice(0, 1);
            // Apply data transform to get data.
            const mark = (yield applyTransform(node, context));
            const { type = (0, helper_1.error)('G2Mark type is required.'), key } = mark;
            // For components.
            if (staticMarks.has(type))
                components.push(mark);
            else {
                const { props = {} } = createMark(type);
                const { composite = true } = props;
                if (!composite)
                    flattenMarks.push(mark);
                else {
                    // Unwrap data from { value: data } to data,
                    // then the composite mark can process the normalized data.
                    const { data } = mark;
                    const newMark = Object.assign(Object.assign({}, mark), { data: data ? (Array.isArray(data) ? data : data.value) : data });
                    // Convert composite mark to marks.
                    const marks = yield useMark(newMark, markOptions);
                    const M = Array.isArray(marks) ? marks : [marks];
                    discovered.unshift(...M.map((d, i) => (Object.assign(Object.assign({}, d), { key: `${key}-${i}` }))));
                }
            }
        }
        return Object.assign(Object.assign({}, options), { marks: flattenMarks, components });
    });
}
function initializeMarks(options, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const [useTheme] = (0, library_1.useLibrary)('theme', library);
        const [, createMark] = (0, library_1.useLibrary)('mark', library);
        const { theme: partialTheme, marks: partialMarks, coordinates = [], } = options;
        const theme = useTheme(inferTheme(partialTheme));
        const markState = new Map();
        // Initialize channels for marks.
        for (const markOptions of partialMarks) {
            const { type } = markOptions;
            const { props = {} } = createMark(type);
            const markAndState = yield (0, mark_1.initializeMark)(markOptions, props, context);
            if (markAndState) {
                const [initializedMark, state] = markAndState;
                markState.set(initializedMark, state);
            }
        }
        // Group channels by scale key, each group has scale.
        const scaleChannels = (0, d3_array_1.group)(Array.from(markState.values()).flatMap((d) => d.channels), ({ scaleKey }) => scaleKey);
        // Infer scale for each channel groups.
        for (const channels of scaleChannels.values()) {
            // Merge scale options for these channels.
            const scaleOptions = channels.reduce((total, { scale }) => (0, util_1.deepMix)(total, scale), {});
            const { scaleKey } = channels[0];
            // Use the fields of the first channel as the title.
            const { values: FV } = channels[0];
            const fields = Array.from(new Set(FV.map((d) => d.field).filter(helper_1.defined)));
            const options = (0, util_1.deepMix)({
                guide: { title: fields.length === 0 ? undefined : fields },
                field: fields[0],
            }, scaleOptions);
            // Use the name of the first channel as the scale name.
            const { name } = channels[0];
            const values = channels.flatMap(({ values }) => values.map((d) => d.value));
            const scale = Object.assign(Object.assign({}, (0, scale_1.inferScale)(name, values, options, coordinates, theme, library)), { uid: Symbol('scale'), key: scaleKey });
            channels.forEach((channel) => (channel.scale = scale));
        }
        return markState;
    });
}
function useThemeInteraction(view, type, option, useInteraction) {
    const theme = view.theme;
    const defaults = typeof type === 'string' ? theme[type] || {} : {};
    const interaction = useInteraction((0, util_1.deepMix)(defaults, Object.assign({ type }, option)));
    return interaction;
}
function initializeState(markState, options, library) {
    var _a;
    const [useMark] = (0, library_1.useLibrary)('mark', library);
    const [useTheme] = (0, library_1.useLibrary)('theme', library);
    const [useLabelTransform] = (0, library_1.useLibrary)('labelTransform', library);
    const { key, frame = false, theme: partialTheme, clip, style = {}, labelTransform = [], } = options;
    const theme = useTheme(inferTheme(partialTheme));
    // Infer components and compute layout.
    const states = Array.from(markState.values());
    const scales = (0, scale_1.collectScales)(states, options);
    const components = (0, component_1.normalizeComponents)((0, component_1.inferComponent)(inferComponentScales(Array.from(scales), states, markState), options, library));
    const layout = (0, layout_1.computeLayout)(components, options, theme, library);
    const coordinate = (0, coordinate_1.createCoordinate)(layout, options, library);
    const framedStyle = frame
        ? (0, util_1.deepMix)({ mainLineWidth: 1, mainStroke: '#000' }, style)
        : style;
    // Place components and mutate their bbox.
    (0, layout_1.placeComponents)((0, component_1.groupComponents)(components), coordinate, layout);
    // AxisZ need a copy of axisX and axisY to show grids in X-Z & Y-Z planes.
    (0, layout_1.processAxisZ)(components);
    // Index scale instance by uid.
    const uidScale = new Map(Array.from(markState.values()).flatMap((state) => {
        const { channels } = state;
        return channels.map(({ scale }) => [
            scale.uid,
            (0, scale_1.useRelationScale)(scale, library),
        ]);
    }));
    (0, scale_1.groupTransform)(markState, uidScale);
    // Scale from marks and components.
    const scaleInstance = {};
    // Initialize scale from components.
    for (const component of components) {
        const { scales: scaleDescriptors = [] } = component;
        const scales = [];
        for (const descriptor of scaleDescriptors) {
            const { name, uid } = descriptor;
            const scale = (_a = uidScale.get(uid)) !== null && _a !== void 0 ? _a : (0, scale_1.useRelationScale)(descriptor, library);
            scales.push(scale);
            // Delivery the scale of axisX to the AxisY,
            // in order to calculate the angle of axisY component when rendering radar chart.
            if (name === 'y') {
                scale.update(Object.assign(Object.assign({}, scale.getOptions()), { xScale: scaleInstance.x }));
            }
            (0, scale_1.assignScale)(scaleInstance, { [name]: scale });
        }
        component.scaleInstances = scales;
    }
    // Calc data to be rendered for each mark.
    // @todo More readable APIs for Container which stays
    // the same style with JS standard and lodash APIs.
    // @todo More proper way to index scale for different marks.
    const children = [];
    const dataMap = new Map();
    for (const [mark, state] of markState.entries()) {
        const { 
        // scale,
        // Callback to create children options based on this mark.
        children: createChildren, 
        // The total count of data (both show and hide)for this facet.
        // This is for unit visualization to sync data domain.
        dataDomain, modifier, key: markKey, data, } = mark;
        dataMap.set(markKey, data);
        const { index, channels, tooltip } = state;
        const scale = Object.fromEntries(channels.map(({ name, scale }) => [name, scale]));
        // Transform abstract value to visual value by scales.
        const markScaleInstance = (0, array_1.mapObject)(scale, ({ uid }) => uidScale.get(uid));
        (0, scale_1.assignScale)(scaleInstance, markScaleInstance);
        const value = (0, scale_1.applyScale)(channels, markScaleInstance);
        // Calc points and transformation for each data,
        // and then transform visual value to visual data.
        const calcPoints = useMark(mark);
        const [I, P, S] = filterValid(calcPoints(index, markScaleInstance, value, coordinate));
        const count = dataDomain || I.length;
        const T = modifier ? modifier(P, count, layout) : [];
        const titleOf = (i) => { var _a, _b; return (_b = (_a = tooltip.title) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.value; };
        const itemsOf = (i) => tooltip.items.map((V) => V[i]);
        const visualData = I.map((d, i) => {
            const datum = Object.assign({ points: P[i], transform: T[i], index: d, markKey, viewKey: key, data: data[d] }, (tooltip && {
                title: titleOf(d),
                items: itemsOf(d),
            }));
            for (const [k, V] of Object.entries(value)) {
                datum[k] = V[d];
                if (S)
                    datum[`series${(0, util_1.upperFirst)(k)}`] = S[i].map((i) => V[i]);
            }
            if (S)
                datum['seriesIndex'] = S[i];
            if (S && tooltip) {
                datum['seriesItems'] = S[i].map((si) => itemsOf(si));
                datum['seriesTitle'] = S[i].map((si) => titleOf(si));
            }
            return datum;
        });
        state.data = visualData;
        state.index = I;
        // Create children options by children callback,
        // and then propagate data to each child.
        const markChildren = createChildren === null || createChildren === void 0 ? void 0 : createChildren(visualData, markScaleInstance, layout);
        children.push(...(markChildren || []));
    }
    const view = {
        layout,
        theme,
        coordinate,
        markState,
        key,
        clip,
        scale: scaleInstance,
        style: framedStyle,
        components,
        data: dataMap,
        labelTransform: (0, helper_1.compose)(labelTransform.map(useLabelTransform)),
    };
    return [view, children];
}
function plotView(view, selection, transitions, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const { components, theme, layout, markState, coordinate, key, style, clip, scale, } = view;
        // Render background for the different areas.
        const { x, y, width, height } = layout, rest = __rest(layout, ["x", "y", "width", "height"]);
        const areaKeys = ['view', 'plot', 'main', 'content'];
        const I = areaKeys.map((_, i) => i);
        const sizeKeys = ['a', 'margin', 'padding', 'inset'];
        const areaStyles = areaKeys.map((d) => (0, helper_1.maybeSubObject)(Object.assign({}, theme.view, style), d));
        const areaSizes = sizeKeys.map((d) => (0, helper_1.subObject)(rest, d));
        const styleArea = (selection) => selection
            .style('x', (i) => areaLayouts[i].x)
            .style('y', (i) => areaLayouts[i].y)
            .style('width', (i) => areaLayouts[i].width)
            .style('height', (i) => areaLayouts[i].height)
            .each(function (i, d, element) {
            applyStyle((0, selection_1.select)(element), areaStyles[i]);
        });
        let px = 0;
        let py = 0;
        let pw = width;
        let ph = height;
        const areaLayouts = I.map((i) => {
            const size = areaSizes[i];
            const { left = 0, top = 0, bottom = 0, right = 0 } = size;
            px += left;
            py += top;
            pw -= left + right;
            ph -= top + bottom;
            return {
                x: px,
                y: py,
                width: pw,
                height: ph,
            };
        });
        selection
            .selectAll(className(constant_1.AREA_CLASS_NAME))
            .data(
        // Only render area with defined style.
        I.filter((i) => (0, helper_1.defined)(areaStyles[i])), (i) => areaKeys[i])
            .join((enter) => enter
            .append('rect')
            .attr('className', constant_1.AREA_CLASS_NAME)
            .style('zIndex', -2)
            .call(styleArea), (update) => update.call(styleArea), (exit) => exit.remove());
        const animationExtent = computeAnimationExtent(markState);
        const componentAnimateOptions = animationExtent
            ? { duration: animationExtent[1] }
            : false;
        // Render components.
        // @todo renderComponent return ctor and options.
        // Key for each type of component.
        // Index them grouped by position.
        for (const [, C] of (0, d3_array_1.groups)(components, (d) => `${d.type}-${d.position}`)) {
            C.forEach((d, i) => (d.index = i));
        }
        const componentsTransitions = selection
            .selectAll(className(constant_1.COMPONENT_CLASS_NAME))
            .data(components, (d) => `${d.type}-${d.position}-${d.index}`)
            .join((enter) => enter
            .append('g')
            .style('zIndex', ({ zIndex }) => zIndex || -1)
            .attr('className', constant_1.COMPONENT_CLASS_NAME)
            .append((options) => (0, component_1.renderComponent)((0, util_1.deepMix)({ animate: componentAnimateOptions, scale }, options), coordinate, theme, library, markState)), (update) => update.transition(function (options, i, element) {
            const { preserve = false } = options;
            if (preserve)
                return;
            const newComponent = (0, component_1.renderComponent)((0, util_1.deepMix)({ animate: componentAnimateOptions, scale }, options), coordinate, theme, library, markState);
            const { attributes } = newComponent;
            const [node] = element.childNodes;
            return node.update(attributes, false);
        }))
            .transitions();
        transitions.push(...componentsTransitions.flat().filter(helper_1.defined));
        // Main layer is for showing the main visual representation such as marks. There
        // may be multiple main layers for a view, each main layer correspond to one of marks.
        // @todo Test DOM structure.
        const T = selection
            .selectAll(className(constant_1.PLOT_CLASS_NAME))
            .data([layout], () => key)
            .join((enter) => enter
            // Make this layer interactive, such as click and mousemove events.
            .append('rect')
            .style('zIndex', 0)
            .style('fill', 'transparent')
            .attr('className', constant_1.PLOT_CLASS_NAME)
            .call(updateBBox)
            .call(updateLayers, Array.from(markState.keys()))
            .call(applyClip, clip), (update) => update
            .call(updateLayers, Array.from(markState.keys()))
            .call((selection) => {
            return animationExtent
                ? animateBBox(selection, animationExtent)
                : updateBBox(selection);
        })
            .call(applyClip, clip))
            .transitions();
        transitions.push(...T.flat());
        // Render marks with corresponding data.
        for (const [mark, state] of markState.entries()) {
            const { data } = state;
            const { key, class: cls, type } = mark;
            const viewNode = selection.select(`#${key}`);
            const shapeFunction = createMarkShapeFunction(mark, state, view, context);
            const enterFunction = createEnterFunction(mark, state, view, library);
            const updateFunction = createUpdateFunction(mark, state, view, library);
            const exitFunction = createExitFunction(mark, state, view, library);
            const facetElements = selectFacetElements(selection, viewNode, cls, 'element');
            const T = viewNode
                .selectAll(className(constant_1.ELEMENT_CLASS_NAME))
                .selectFacetAll(facetElements)
                .data(data, (d) => d.key, (d) => d.groupKey)
                .join((enter) => enter
                .append(shapeFunction)
                // Note!!! Only one className can be set.
                // Using attribute as alternative for other classNames.
                .attr('className', constant_1.ELEMENT_CLASS_NAME)
                .attr('markType', type)
                .transition(function (data, i, element) {
                return enterFunction(data, [element]);
            }), (update) => update.call((selection) => {
                const parent = selection.parent();
                const origin = (0, helper_1.useMemo)((node) => {
                    const [x, y] = node.getBounds().min;
                    return [x, y];
                });
                selection
                    .transition(function (data, index, element) {
                    maybeFacetElement(element, parent, origin);
                    const node = shapeFunction(data, index);
                    const animation = updateFunction(data, [element], [node]);
                    if (animation === null || animation === void 0 ? void 0 : animation.length)
                        return animation;
                    if (element.nodeName === node.nodeName &&
                        node.nodeName !== 'g') {
                        (0, helper_1.copyAttributes)(element, node);
                    }
                    else {
                        element.parentNode.replaceChild(node, element);
                        node.className = constant_1.ELEMENT_CLASS_NAME;
                        // @ts-ignore
                        node.markType = type;
                        // @ts-ignore
                        node.__data__ = element.__data__;
                    }
                    return animation;
                })
                    .attr('markType', type)
                    .attr('className', constant_1.ELEMENT_CLASS_NAME);
            }), (exit) => {
                return exit
                    .each(function (d, i, element) {
                    element.__removed__ = true;
                })
                    .transition(function (data, i, element) {
                    return exitFunction(data, [element]);
                })
                    .remove();
            }, (merge) => merge
                // Append elements to be merged.
                .append(shapeFunction)
                .attr('className', constant_1.ELEMENT_CLASS_NAME)
                .attr('markType', type)
                .transition(function (data, i, element) {
                // Remove merged elements after animation finishing.
                const { __fromElements__: fromElements } = element;
                const transition = updateFunction(data, fromElements, [element]);
                const exit = new selection_1.Selection(fromElements, null, element.parentNode);
                exit.transition(transition).remove();
                return transition;
            }), (split) => split
                .transition(function (data, i, element) {
                // Append splitted shapes.
                const enter = new selection_1.Selection([], element.__toData__, element.parentNode);
                const toElements = enter
                    .append(shapeFunction)
                    .attr('className', constant_1.ELEMENT_CLASS_NAME)
                    .attr('markType', type)
                    .nodes();
                return updateFunction(data, [element], toElements);
            })
                // Remove elements to be splitted after animation finishing.
                .remove())
                .transitions();
            transitions.push(...T.flat());
        }
        // Plot label for this view.
        plotLabel(view, selection, transitions, library, context);
    });
}
/**
 * Auto hide labels be specify label layout.
 */
function plotLabel(view, selection, transitions, library, context) {
    const [useLabelTransform] = (0, library_1.useLibrary)('labelTransform', library);
    const { markState, labelTransform } = view;
    const labelLayer = selection.select(className(constant_1.LABEL_LAYER_CLASS_NAME)).node();
    // A Map index shapeFunction by label.
    const labelShapeFunction = new Map();
    // A Map index options by label.
    const labelDescriptor = new Map();
    // Get all labels for this view.
    const labels = Array.from(markState.entries()).flatMap(([mark, state]) => {
        const { labels: labelOptions = [], key } = mark;
        const shapeFunction = createLabelShapeFunction(mark, state, view, library, context);
        const elements = selection
            .select(`#${key}`)
            .selectAll(className(constant_1.ELEMENT_CLASS_NAME))
            .nodes()
            // Only select the valid element.
            .filter((n) => !n.__removed__);
        return labelOptions.flatMap((labelOption, i) => {
            const { transform = [] } = labelOption, options = __rest(labelOption, ["transform"]);
            return elements.flatMap((e) => {
                const L = getLabels(options, i, e);
                L.forEach((l) => {
                    labelShapeFunction.set(l, (data) => shapeFunction(Object.assign(Object.assign({}, data), { element: e })));
                    labelDescriptor.set(l, labelOption);
                });
                return L;
            });
        });
    });
    // Render all labels.
    const labelShapes = (0, selection_1.select)(labelLayer)
        .selectAll(className(constant_1.LABEL_CLASS_NAME))
        .data(labels, (d) => d.key)
        .join((enter) => enter
        .append((d) => labelShapeFunction.get(d)(d))
        .attr('className', constant_1.LABEL_CLASS_NAME), (update) => update.each(function (d, i, element) {
        // @todo Handle Label with different type.
        const shapeFunction = labelShapeFunction.get(d);
        const node = shapeFunction(d);
        (0, helper_1.copyAttributes)(element, node);
    }), (exit) => exit.remove())
        .nodes();
    // Apply group-level transforms.
    const labelGroups = (0, d3_array_1.group)(labelShapes, (d) => labelDescriptor.get(d.__data__));
    const { coordinate, layout } = view;
    const labelTransformContext = {
        canvas: context.canvas,
        coordinate,
        layout,
    };
    for (const [label, shapes] of labelGroups) {
        const { transform = [] } = label;
        const transformFunction = (0, helper_1.compose)(transform.map(useLabelTransform));
        transformFunction(shapes, labelTransformContext);
    }
    // Apply view-level transform.
    if (labelTransform) {
        labelTransform(labelShapes, labelTransformContext);
    }
}
function getLabels(label, labelIndex, element) {
    const { seriesIndex: SI, seriesKey, points, key, index } = element.__data__;
    const bounds = getLocalBounds(element);
    if (!SI) {
        return [
            Object.assign(Object.assign({}, label), { key: `${key}-${labelIndex}`, bounds,
                index,
                points, dependentElement: element }),
        ];
    }
    const selector = normalizeLabelSelector(label);
    const F = SI.map((index, i) => (Object.assign(Object.assign({}, label), { key: `${seriesKey[i]}-${labelIndex}`, bounds: [points[i]], index,
        points, dependentElement: element })));
    return selector ? selector(F) : F;
}
function filterValid([I, P, S]) {
    if (S)
        return [I, P, S];
    const definedIndex = [];
    const definedPoints = [];
    for (let i = 0; i < I.length; i++) {
        const d = I[i];
        const p = P[i];
        if (p.every(([x, y]) => (0, helper_1.defined)(x) && (0, helper_1.defined)(y))) {
            definedIndex.push(d);
            definedPoints.push(p);
        }
    }
    return [definedIndex, definedPoints];
}
function normalizeLabelSelector(label) {
    const { selector } = label;
    if (!selector)
        return null;
    if (typeof selector === 'function')
        return selector;
    if (selector === 'first')
        return (I) => [I[0]];
    if (selector === 'last')
        return (I) => [I[I.length - 1]];
    throw new Error(`Unknown selector: ${selector}`);
}
/**
 * Avoid getting error bounds caused by element animations.
 * @todo Remove this temporary handle method, if runtime supports
 * correct process: drawElement, do label layout and then do
 * transitions together.
 */
function getLocalBounds(element) {
    const cloneElement = element.cloneNode(true);
    const animations = element.getAnimations();
    cloneElement.style.visibility = 'hidden';
    animations.forEach((animation) => {
        const keyframes = animation.effect.getKeyframes();
        cloneElement.attr(keyframes[keyframes.length - 1]);
    });
    element.parentNode.appendChild(cloneElement);
    const bounds = cloneElement.getLocalBounds();
    cloneElement.destroy();
    const { min, max } = bounds;
    return [min, max];
}
function createLabelShapeFunction(mark, state, view, library, context) {
    const [useShape] = (0, library_1.useLibrary)('shape', library);
    const { data: abstractData, encode } = mark;
    const { data: visualData, defaultLabelShape } = state;
    const point2d = visualData.map((d) => d.points);
    const channel = (0, array_1.mapObject)(encode, (d) => d.value);
    // Assemble Context.
    const { theme, coordinate } = view;
    const shapeContext = Object.assign(Object.assign({}, context), { document: (0, library_1.documentOf)(context), theme,
        coordinate });
    return (options) => {
        // Computed values from data and styles.
        const { index, points } = options;
        const datum = abstractData[index];
        const { formatter = (d) => `${d}`, transform, style: abstractStyle, render, selector, element } = options, abstractOptions = __rest(options, ["formatter", "transform", "style", "render", "selector", "element"]);
        const visualOptions = (0, array_1.mapObject)(Object.assign(Object.assign({}, abstractOptions), abstractStyle), (d) => valueOf(d, datum, index, abstractData, {
            channel,
            element,
        }));
        const { shape = defaultLabelShape, text } = visualOptions, style = __rest(visualOptions, ["shape", "text"]);
        const f = typeof formatter === 'string' ? (0, d3_format_1.format)(formatter) : formatter;
        const value = Object.assign(Object.assign({}, style), { text: f(text, datum, index, abstractData), datum });
        // Params for create shape.
        const shapeOptions = Object.assign({ type: `label.${shape}`, render }, style);
        const shapeFunction = useShape(shapeOptions, shapeContext);
        const defaults = getDefaultsStyle(theme, 'label', shape, 'label');
        return shapeFunction(points, value, defaults, point2d);
    };
}
function valueOf(value, datum, i, data, options) {
    if (typeof value === 'function')
        return value(datum, i, data, options);
    if (typeof value !== 'string')
        return value;
    if ((0, helper_1.isStrictObject)(datum) && datum[value] !== undefined)
        return datum[value];
    return value;
}
/**
 * Compute max duration for this frame.
 */
function computeAnimationExtent(markState) {
    let maxDuration = -Infinity;
    let minDelay = Infinity;
    for (const [mark, state] of markState) {
        const { animate = {} } = mark;
        const { data } = state;
        const { enter = {}, update = {}, exit = {} } = animate;
        const { type: defaultUpdateType, duration: defaultUpdateDuration = 300, delay: defaultUpdateDelay = 0, } = update;
        const { type: defaultEnterType, duration: defaultEnterDuration = 300, delay: defaultEnterDelay = 0, } = enter;
        const { type: defaultExitType, duration: defaultExitDuration = 300, delay: defaultExitDelay = 0, } = exit;
        for (const d of data) {
            const { updateType = defaultUpdateType, updateDuration = defaultUpdateDuration, updateDelay = defaultUpdateDelay, enterType = defaultEnterType, enterDuration = defaultEnterDuration, enterDelay = defaultEnterDelay, exitDuration = defaultExitDuration, exitDelay = defaultExitDelay, exitType = defaultExitType, } = d;
            if (updateType === undefined || updateType) {
                maxDuration = Math.max(maxDuration, updateDuration + updateDelay);
                minDelay = Math.min(minDelay, updateDelay);
            }
            if (exitType === undefined || exitType) {
                maxDuration = Math.max(maxDuration, exitDuration + exitDelay);
                minDelay = Math.min(minDelay, exitDelay);
            }
            if (enterType === undefined || enterType) {
                maxDuration = Math.max(maxDuration, enterDuration + enterDelay);
                minDelay = Math.min(minDelay, enterDelay);
            }
        }
    }
    if (maxDuration === -Infinity)
        return null;
    return [minDelay, maxDuration - minDelay];
}
function selectFacetElements(selection, current, facetClassName, elementClassName) {
    const group = selection.node().parentElement;
    return group
        .findAll((node) => node.style.facet !== undefined &&
        node.style.facet === facetClassName &&
        node !== current.node())
        .flatMap((node) => node.getElementsByClassName(elementClassName));
}
/**
 * Update the parent of element and apply transform to make it
 * stay in original position.
 */
function maybeFacetElement(element, parent, originOf) {
    if (!element.__facet__)
        return;
    // element -> g#main -> rect#plot
    const prePlot = element.parentNode.parentNode;
    // g#main -> rect#plot
    const newPlot = parent.parentNode;
    const [px, py] = originOf(prePlot);
    const [x, y] = originOf(newPlot);
    const translate = `translate(${px - x}, ${py - y})`;
    (0, helper_1.appendTransform)(element, translate);
    parent.append(element);
}
function createMarkShapeFunction(mark, state, view, context) {
    const { library } = context;
    const [useShape] = (0, library_1.useLibrary)('shape', library);
    const { data: abstractData, encode } = mark;
    const { defaultShape, data, shape: shapeLibrary } = state;
    const channel = (0, array_1.mapObject)(encode, (d) => d.value);
    const point2d = data.map((d) => d.points);
    const { theme, coordinate } = view;
    const { type: markType, style = {} } = mark;
    const shapeContext = Object.assign(Object.assign({}, context), { document: (0, library_1.documentOf)(context), coordinate,
        theme });
    return (data) => {
        const { shape: styleShape = defaultShape } = style;
        const { shape = styleShape, points, seriesIndex, index: i } = data, v = __rest(data, ["shape", "points", "seriesIndex", "index"]);
        const value = Object.assign(Object.assign({}, v), { index: i });
        // Get data-driven style.
        // If it is a series shape, such as area and line,
        // provides the series of abstract data and indices
        // for this shape, otherwise the single datum and
        // index.
        const abstractDatum = seriesIndex
            ? seriesIndex.map((i) => abstractData[i])
            : abstractData[i];
        const I = seriesIndex ? seriesIndex : i;
        const visualStyle = (0, array_1.mapObject)(style, (d) => valueOf(d, abstractDatum, I, abstractData, { channel }));
        // Try get shape from mark first, then from library.
        const shapeFunction = shapeLibrary[shape]
            ? shapeLibrary[shape](visualStyle, shapeContext)
            : useShape(Object.assign(Object.assign({}, visualStyle), { type: shapeName(mark, shape) }), shapeContext);
        const defaults = getDefaultsStyle(theme, markType, shape, defaultShape);
        return shapeFunction(points, value, defaults, point2d);
    };
}
function getDefaultsStyle(theme, mark, shape, defaultShape) {
    if (typeof mark !== 'string')
        return;
    const { color } = theme;
    const markTheme = theme[mark] || {};
    const shapeTheme = markTheme[shape] || markTheme[defaultShape];
    return Object.assign({ color }, shapeTheme);
}
function createAnimationFunction(type, mark, state, view, library) {
    var _a, _b;
    const [, createShape] = (0, library_1.useLibrary)('shape', library);
    const [useAnimation] = (0, library_1.useLibrary)('animation', library);
    const { defaultShape, shape: shapeLibrary } = state;
    const { theme, coordinate } = view;
    const upperType = (0, util_1.upperFirst)(type);
    const key = `default${upperType}Animation`;
    // Get shape from mark first, then from library.
    const { [key]: defaultAnimation } = ((_a = shapeLibrary[defaultShape]) === null || _a === void 0 ? void 0 : _a.props) ||
        createShape(shapeName(mark, defaultShape)).props;
    const { [type]: defaultEffectTiming = {} } = theme;
    const animate = ((_b = mark.animate) === null || _b === void 0 ? void 0 : _b[type]) || {};
    const context = { coordinate };
    return (data, from, to) => {
        const { [`${type}Type`]: animation, [`${type}Delay`]: delay, [`${type}Duration`]: duration, [`${type}Easing`]: easing, } = data;
        const options = Object.assign({ type: animation || defaultAnimation }, animate);
        if (!options.type)
            return null;
        const animateFunction = useAnimation(options, context);
        const value = { delay, duration, easing };
        const A = animateFunction(from, to, (0, util_1.deepMix)(defaultEffectTiming, value));
        let an = [];
        if (!Array.isArray(A)) {
            an = [A];
        }
        else {
            an = A;
        }
        return an.filter(Boolean);
    };
}
function createEnterFunction(mark, state, view, library) {
    return createAnimationFunction('enter', mark, state, view, library);
}
/**
 * Animation will not cancel automatically, it should be canceled
 * manually. This is very important for performance.
 */
function cancel(animation) {
    animation.finished.then(() => {
        animation.cancel();
    });
    return animation;
}
function createUpdateFunction(mark, state, view, library) {
    return createAnimationFunction('update', mark, state, view, library);
}
function createExitFunction(mark, state, view, library) {
    return createAnimationFunction('exit', mark, state, view, library);
}
function inferTheme(theme = {}) {
    if (typeof theme === 'string')
        return { type: theme };
    const { type = 'light' } = theme, rest = __rest(theme, ["type"]);
    return Object.assign(Object.assign({}, rest), { type });
}
/**
 * @todo Infer builtin tooltips.
 */
function inferInteraction(view) {
    const defaults = {
        event: true,
        tooltip: true,
        // @todo Inferred by slider self.
        sliderFilter: true,
        legendFilter: true,
        scrollbarFilter: true,
    };
    const { interaction = {} } = view;
    return Object.entries((0, util_1.deepMix)(defaults, interaction)).reverse();
}
function applyTransform(node, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { data } = node, rest = __rest(node, ["data"]);
        if (data == undefined)
            return node;
        const [, { data: newData }] = yield (0, transform_1.applyDataTransform)([], { data }, context);
        return Object.assign({ data: newData }, rest);
    });
}
function updateBBox(selection) {
    selection
        .style('transform', (d) => `translate(${d.paddingLeft + d.marginLeft}, ${d.paddingTop + d.marginTop})`)
        .style('width', (d) => d.innerWidth)
        .style('height', (d) => d.innerHeight);
}
function animateBBox(selection, extent) {
    const [delay, duration] = extent;
    selection.transition(function (data, i, element) {
        const { transform, width, height } = element.style;
        const { paddingLeft, paddingTop, innerWidth, innerHeight, marginLeft, marginTop, } = data;
        const keyframes = [
            {
                transform,
                width,
                height,
            },
            {
                transform: `translate(${paddingLeft + marginLeft}, ${paddingTop + marginTop})`,
                width: innerWidth,
                height: innerHeight,
            },
        ];
        return element.animate(keyframes, { delay, duration, fill: 'both' });
    });
}
function shapeName(mark, name) {
    const { type } = mark;
    if (typeof name === 'string')
        return `${type}.${name}`;
    return name;
}
/**
 * Create and update layer for each mark.
 * All the layers created here are treated as main layers.
 */
function updateLayers(selection, marks) {
    const facet = (d) => (d.class !== undefined ? `${d.class}` : '');
    // Skip for empty selection, it can't append nodes.
    const nodes = selection.nodes();
    if (nodes.length === 0)
        return;
    selection
        .selectAll(className(constant_1.MAIN_LAYER_CLASS_NAME))
        .data(marks, (d) => d.key)
        .join((enter) => enter
        .append('g')
        .attr('className', constant_1.MAIN_LAYER_CLASS_NAME)
        .attr('id', (d) => d.key)
        .style('facet', facet)
        .style('fill', 'transparent')
        .style('zIndex', (d) => { var _a; return (_a = d.zIndex) !== null && _a !== void 0 ? _a : 0; }), (update) => update
        .style('facet', facet)
        .style('fill', 'transparent')
        .style('zIndex', (d) => { var _a; return (_a = d.zIndex) !== null && _a !== void 0 ? _a : 0; }), (exit) => exit.remove());
    const labelLayer = selection.select(className(constant_1.LABEL_LAYER_CLASS_NAME)).node();
    if (labelLayer)
        return;
    selection
        .append('g')
        .attr('className', constant_1.LABEL_LAYER_CLASS_NAME)
        .style('zIndex', 0);
}
function className(...names) {
    return names.map((d) => `.${d}`).join('');
}
function applyClip(selection, clip) {
    if (!selection.node())
        return;
    selection.style('clipPath', (data) => {
        if (!clip)
            return null;
        const { paddingTop: y, paddingLeft: x, marginLeft: x1, marginTop: y1, innerWidth: width, innerHeight: height, } = data;
        return new g_1.Rect({ style: { x: x + x1, y: y + y1, width, height } });
    });
}
function inferComponentScales(scales, states, markState) {
    // add shape scale to state.
    var _a;
    // for cell, omit shape scale.
    // @todo support shape scale for cell.
    for (const [key] of markState.entries()) {
        if (key.type === 'cell') {
            return scales.filter((scale) => scale.name !== 'shape');
        }
    }
    // can't infer shape scale if there are multiple states.
    if (states.length !== 1 || scales.some((scale) => scale.name === 'shape')) {
        return scales;
    }
    const { defaultShape: shape } = states[0];
    const acceptMarkTypes = ['point', 'line', 'rect', 'hollow'];
    if (!acceptMarkTypes.includes(shape))
        return scales;
    const shapeMap = {
        point: 'point',
        line: 'hyphen',
        rect: 'square',
        hollow: 'hollow',
    };
    // create shape scale
    const field = ((_a = scales.find((scale) => scale.name === 'color')) === null || _a === void 0 ? void 0 : _a.field) || null;
    const shapeScale = {
        field,
        name: 'shape',
        type: 'constant',
        domain: [],
        range: [shapeMap[shape]],
    };
    return [...scales, shapeScale];
}
function applyStyle(selection, style) {
    for (const [key, value] of Object.entries(style)) {
        selection.style(key, value);
    }
}
exports.applyStyle = applyStyle;
//# sourceMappingURL=plot.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"../utils/event":1751263816091,"../utils/helper":1751263815829,"../utils/selection":1751263815883,"./component":1751263816094,"./constant":1751263816082,"./coordinate":1751263816096,"./layout":1751263816116,"./library":1751263816097,"./mark":1751263816117,"./scale":1751263816114,"./transform":1751263816118}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816094, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.styleOf = exports.computeTitleBBox = exports.computeLabelsBBox = exports.createScale = exports.computeComponentSize = exports.groupComponents = exports.flatComponents = exports.normalizeComponents = exports.renderComponent = exports.inferComponent = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const d3_format_1 = require("@antv/vendor/d3-format");
const g_1 = require("@antv/g");
const coordinate_1 = require("../coordinate");
const array_1 = require("../utils/array");
const number_1 = require("../utils/number");
const helper_1 = require("../utils/helper");
const constant_1 = require("../component/constant");
const coordinate_2 = require("./coordinate");
const library_1 = require("./library");
const scale_1 = require("./scale");
const scale_2 = require("./types/scale");
function inferComponent(scales, partialOptions, library) {
    const { coordinates = [], title } = partialOptions;
    const [, createGuideComponent] = (0, library_1.useLibrary)('component', library);
    const displayedScales = scales.filter(({ guide }) => {
        if (guide === null)
            return false;
        return true;
    });
    const components = [];
    // Sliders and scrollbar component.
    const sliders = inferScrollableComponents(partialOptions, scales, library);
    components.push(...sliders);
    // Title components.
    if (title) {
        const { props } = createGuideComponent('title');
        const { defaultPosition, defaultOrientation, defaultOrder, defaultSize, defaultCrossPadding, } = props;
        const titleOptions = typeof title === 'string' ? { title } : title;
        components.push(Object.assign({ type: 'title', position: defaultPosition, orientation: defaultOrientation, order: defaultOrder, crossPadding: defaultCrossPadding[0], defaultSize }, titleOptions));
    }
    // Axis and legends.
    const inferredComponents = inferComponentsType(displayedScales, coordinates);
    inferredComponents.forEach(([type, relativeScales]) => {
        const { props } = createGuideComponent(type);
        const { defaultPosition, defaultPlane = 'xy', defaultOrientation, defaultSize, defaultOrder, defaultLength, defaultPadding: DP = [0, 0], defaultCrossPadding: DCP = [0, 0], } = props;
        // @todo to be confirm if the scale can be merged.
        // const scale: G2ScaleOptions = Object.assign({}, ...relativeScales);
        const scale = (0, util_1.deepMix)({}, ...relativeScales);
        const { guide: guideOptions, field } = scale;
        // A scale may have multiple guides.
        const guides = Array.isArray(guideOptions) ? guideOptions : [guideOptions];
        for (const partialGuide of guides) {
            const [position, orientation] = inferComponentPositionAndOrientation(type, defaultPosition, defaultOrientation, partialGuide, relativeScales, displayedScales, coordinates);
            // Skip if position and orientation are not specified.
            // @example the last axis of radar chart
            if (!position && !orientation)
                continue;
            const isVertical = position === 'left' || position === 'right';
            const defaultPadding = isVertical ? DP[1] : DP[0];
            const defaultCrossPadding = isVertical ? DCP[1] : DCP[0];
            const { size, order = defaultOrder, length = defaultLength, padding = defaultPadding, crossPadding = defaultCrossPadding, } = partialGuide;
            components.push(Object.assign(Object.assign({ title: field }, partialGuide), { defaultSize,
                length,
                position, plane: defaultPlane, orientation,
                padding,
                order,
                crossPadding,
                size,
                type, scales: relativeScales }));
        }
    });
    return components;
}
exports.inferComponent = inferComponent;
function renderComponent(component, coordinate, theme, library, markState) {
    const [useGuideComponent] = (0, library_1.useLibrary)('component', library);
    const { scaleInstances: scales, scale, bbox } = component, options = __rest(component, ["scaleInstances", "scale", "bbox"]);
    const value = { bbox, library };
    const render = useGuideComponent(options);
    return render({
        coordinate,
        library,
        markState,
        scales,
        theme,
        value,
        scale,
    });
}
exports.renderComponent = renderComponent;
function normalizeComponents(components) {
    return components.map((d) => {
        const component = (0, util_1.deepMix)(d, d.style);
        delete component.style;
        return component;
    });
}
exports.normalizeComponents = normalizeComponents;
function flatComponents(components) {
    return components.flatMap((d) => (d.type == 'group' ? d.children : d));
}
exports.flatComponents = flatComponents;
// Wrap legends into a group component.
function groupComponents(components, crossSize) {
    // Group components by key.
    const P = ['left', 'right', 'bottom', 'top'];
    const key = ({ type, position, group }) => {
        if (!P.includes(position))
            return Symbol('independent');
        if (group === undefined) {
            if (type.startsWith('legend'))
                return `legend-${position}`;
            return Symbol('independent');
        }
        if (group === 'independent')
            return Symbol('independent');
        return group;
    };
    const grouped = (0, d3_array_1.groups)(components, key);
    // Update attributes of group components,
    // and maybe flatten group components without enough room.
    return grouped.flatMap(([, components]) => {
        if (components.length === 1)
            return components[0];
        // If crossSize defined, group components only when has
        // enough room.
        if (crossSize !== undefined) {
            // Compute total length.
            const DL = components
                .filter((d) => d.length !== undefined)
                .map((d) => d.length);
            const totalLength = (0, d3_array_1.sum)(DL);
            // If there is no enough room for components,
            // do not group.
            if (totalLength > crossSize) {
                components.forEach((d) => (d.group = Symbol('independent')));
                return components;
            }
            // Group legends and update legend length.
            const emptyLength = crossSize - totalLength;
            const emptyCount = components.length - DL.length;
            const length = emptyLength / emptyCount;
            components.forEach((d) => {
                if (d.length !== undefined)
                    return;
                d.length = length;
            });
        }
        // Create a group component.
        const size = (0, d3_array_1.max)(components, (d) => d.size);
        const order = (0, d3_array_1.max)(components, (d) => d.order);
        const crossPadding = (0, d3_array_1.max)(components, (d) => d.crossPadding);
        const position = components[0].position;
        return {
            type: 'group',
            size,
            order,
            position,
            children: components,
            crossPadding,
        };
    });
}
exports.groupComponents = groupComponents;
function inferLegendComponentType(scales, coordinates) {
    // Filter accepts scales.
    const channels = ['shape', 'size', 'color', 'opacity'];
    const isConstantSize = (type, name) => type === 'constant' && name === 'size';
    const accepts = scales.filter(({ type, name }) => typeof type === 'string' &&
        channels.includes(name) &&
        !isConstantSize(type, name));
    // Group scales by fields.
    const constants = accepts.filter(({ type }) => type === 'constant');
    const nonConstants = accepts.filter(({ type }) => type !== 'constant');
    const groupKey = (d) => (d.field ? d.field : Symbol('independent'));
    const fieldScales = (0, d3_array_1.groups)(nonConstants, groupKey)
        .map(([key, scales]) => [key, [...scales, ...constants]])
        .filter(([, scales]) => scales.some((scale) => scale.type !== 'constant'));
    const scalesByField = new Map(fieldScales);
    // Skip empty scales.
    if (scalesByField.size === 0)
        return [];
    // Infer components.
    const sort = (arr) => arr.sort(([a], [b]) => a.localeCompare(b));
    const components = Array.from(scalesByField)
        .map(([, scs]) => {
        const combinations = (0, array_1.combine)(scs).sort((a, b) => b.length - a.length);
        const options = combinations.map((combination) => ({
            combination,
            option: combination.map((scale) => [scale.name, getScaleType(scale)]),
        }));
        // For category legend.
        for (const { option, combination } of options) {
            // If every scale is constant, do not display legend.
            if (option.every((d) => d[1] === 'constant'))
                continue;
            if (option.every((d) => d[1] === 'discrete' || d[1] === 'constant')) {
                return ['legendCategory', combination];
            }
        }
        // For reset legend.
        // @todo Remove this.
        for (const [componentType, accords] of constant_1.LEGEND_INFER_STRATEGIES) {
            for (const { option, combination } of options) {
                if (accords.some((accord) => (0, util_1.isEqual)(sort(accord), sort(option)))) {
                    return [componentType, combination];
                }
            }
        }
        return null;
    })
        .filter(helper_1.defined);
    return components;
}
function getScaleType(scale) {
    const { type } = scale;
    if (typeof type !== 'string')
        return null;
    if (type in scale_2.ContinuousScale)
        return 'continuous';
    if (type in scale_2.DiscreteScale)
        return 'discrete';
    if (type in scale_2.DistributionScale)
        return 'distribution';
    if (type in scale_2.ConstantScale)
        return 'constant';
    return null;
}
function inferAxisComponentType(scales, coordinates) {
    return scales
        .map((scale) => {
        const { name } = scale;
        // todo wait for gui provide helix axis
        if ((0, coordinate_2.isHelix)(coordinates) || (0, coordinate_2.isTheta)(coordinates))
            return null;
        if ((0, coordinate_2.isTranspose)(coordinates) &&
            ((0, coordinate_2.isPolar)(coordinates) || (0, coordinate_2.isRadial)(coordinates)))
            return null;
        // infer axis
        if (name.startsWith('x')) {
            if ((0, coordinate_2.isPolar)(coordinates))
                return ['axisArc', [scale]];
            if ((0, coordinate_2.isRadial)(coordinates))
                return ['axisLinear', [scale]];
            return [(0, coordinate_2.isTranspose)(coordinates) ? 'axisY' : 'axisX', [scale]];
        }
        if (name.startsWith('y')) {
            if ((0, coordinate_2.isPolar)(coordinates))
                return ['axisLinear', [scale]];
            if ((0, coordinate_2.isRadial)(coordinates))
                return ['axisArc', [scale]];
            return [(0, coordinate_2.isTranspose)(coordinates) ? 'axisX' : 'axisY', [scale]];
        }
        // Only support linear axis for z.
        if (name.startsWith('z')) {
            return ['axisZ', [scale]];
        }
        if (name.startsWith('position')) {
            if ((0, coordinate_2.isRadar)(coordinates))
                return ['axisRadar', [scale]];
            if (!(0, coordinate_2.isPolar)(coordinates))
                return ['axisY', [scale]];
        }
        return null;
    })
        .filter(helper_1.defined);
}
function inferComponentsType(scales, coordinates) {
    const availableScales = scales.filter((scale) => (0, scale_1.isValidScale)(scale));
    return [
        ...inferLegendComponentType(availableScales, coordinates),
        ...inferAxisComponentType(availableScales, coordinates),
    ];
}
function angleOf(coordinates) {
    const polar = (0, coordinate_2.coordOf)(coordinates, 'polar');
    if (polar.length) {
        const lastPolar = polar[polar.length - 1];
        const { startAngle, endAngle } = (0, coordinate_1.getPolarOptions)(lastPolar);
        return [startAngle, endAngle];
    }
    const radial = (0, coordinate_2.coordOf)(coordinates, 'radial');
    if (radial.length) {
        const lastRadial = radial[radial.length - 1];
        const { startAngle, endAngle } = (0, coordinate_1.getRadialOptions)(lastRadial);
        return [startAngle, endAngle];
    }
    return [-Math.PI / 2, (Math.PI / 2) * 3];
}
/**
 * match index of position
 */
function matchPosition(name) {
    const match = /position(\d*)/g.exec(name);
    if (!match)
        return null;
    return +match[1];
}
function inferAxisPositionAndOrientation(type, ordinalPosition, relativeScales, scales, coordinates) {
    // a axis only has one scale
    const { name } = relativeScales[0];
    // todo, in current resolution, the radar chart is implement by parallel + polar coordinate.
    // implementation plan to be confirmed.
    // in current implementation, it must to add the first position encode to it's last.
    // so we won't render the last axis repeatably.
    if (type === 'axisRadar') {
        const positions = scales.filter((scale) => scale.name.startsWith('position'));
        const index = matchPosition(name);
        if (index === null)
            return [null, null];
        // infer radar axis orientation
        const [startAngle, endAngle] = angleOf(coordinates);
        const positionLength = (0, coordinate_2.isRadar)(coordinates)
            ? positions.length
            : positions.length - 1;
        const angle = ((endAngle - startAngle) / positionLength) * index + startAngle;
        return ['center', angle];
    }
    if (type === 'axisY' && (0, coordinate_2.isParallel)(coordinates)) {
        return (0, coordinate_2.isTranspose)(coordinates)
            ? ['center', 'horizontal']
            : ['center', 'vertical'];
    }
    // in non-cartesian coordinate systems, infer the arc axis angle
    if (type === 'axisLinear') {
        const [startAngle] = angleOf(coordinates);
        return ['center', startAngle];
    }
    if (type === 'axisArc') {
        if (ordinalPosition[0] === 'inner')
            return ['inner', null];
        return ['outer', null];
    }
    if ((0, coordinate_2.isPolar)(coordinates))
        return ['center', null];
    if ((0, coordinate_2.isRadial)(coordinates))
        return ['center', null];
    if ((type === 'axisX' && (0, coordinate_2.isReflect)(coordinates)) ||
        (type === 'axisX' && (0, coordinate_2.isReflectY)(coordinates))) {
        return ['top', null];
    }
    // if (type === 'axisX') return ['bottom', null];
    return ordinalPosition;
}
// @todo Infer position by coordinates.
function inferComponentPositionAndOrientation(type, defaultPosition, defaultOrientation, guide, relativeScales, scales, coordinates) {
    const [startAngle] = angleOf(coordinates);
    const ordinalPositionAndOrientation = [
        guide.position || defaultPosition,
        startAngle !== null && startAngle !== void 0 ? startAngle : defaultOrientation,
    ];
    if (typeof type === 'string' && type.startsWith('axis')) {
        return inferAxisPositionAndOrientation(type, ordinalPositionAndOrientation, relativeScales, scales, coordinates);
    }
    if (typeof type === 'string' &&
        type.startsWith('legend') &&
        (0, coordinate_2.isPolar)(coordinates)) {
        if (guide.position === 'center')
            return ['center', 'vertical'];
    }
    // for general component, use default position
    return ordinalPositionAndOrientation;
}
function inferScrollableType(name, type, coordinates = []) {
    if (name === 'x')
        return (0, coordinate_2.isTranspose)(coordinates) ? `${type}Y` : `${type}X`;
    if (name === 'y')
        return (0, coordinate_2.isTranspose)(coordinates) ? `${type}X` : `${type}Y`;
    return null;
}
/**
 * Infer scrollable components, such as slider and scrollbar.
 */
function inferScrollableComponents(partialOptions, scales, library) {
    const [, createGuideComponent] = (0, library_1.useLibrary)('component', library);
    const { coordinates } = partialOptions;
    function normalized(type, channelName, scale, options) {
        const componentType = inferScrollableType(channelName, type, coordinates);
        if (!options || !componentType)
            return;
        const { props } = createGuideComponent(componentType);
        const { defaultPosition, defaultSize, defaultOrder, defaultCrossPadding: [crossPadding], } = props;
        return Object.assign(Object.assign({ position: defaultPosition, defaultSize, order: defaultOrder, type: componentType, crossPadding }, options), { scales: [scale] });
    }
    return scales
        .filter((d) => d.slider || d.scrollbar)
        .flatMap((scale) => {
        const { slider, scrollbar, name: channelName } = scale;
        return [
            normalized('slider', channelName, scale, slider),
            normalized('scrollbar', channelName, scale, scrollbar),
        ];
    })
        .filter((d) => !!d);
}
// !!! Note Mutate component.size and component.
function computeComponentSize(component, crossSize, crossPadding, position, theme, library) {
    // Only compute and update size of components in padding area.
    const { type } = component;
    const paddingAreas = ['left', 'right', 'bottom', 'top'];
    if (!paddingAreas.includes(position))
        return;
    if (typeof type !== 'string')
        return;
    const t = type;
    const createCompute = () => {
        if (t.startsWith('axis'))
            return computeAxisSize;
        if (t.startsWith('group'))
            return computeGroupSize;
        if (t.startsWith('legendContinuous'))
            return computeContinuousLegendSize;
        if (t === 'legendCategory')
            return computeCategoryLegendSize;
        if (t.startsWith('slider'))
            return computeSliderSize;
        if (t === 'title')
            return computeTitleSize;
        if (t.startsWith('scrollbar'))
            return computeScrollbarSize;
        return () => { };
    };
    return createCompute()(component, crossSize, crossPadding, position, theme, library);
}
exports.computeComponentSize = computeComponentSize;
function computeGroupSize(component, crossSize, crossPadding, position, theme, library) {
    const { children } = component;
    const maxCrossPadding = (0, d3_array_1.max)(children, (d) => d.crossPadding);
    children.forEach((d) => (d.crossPadding = maxCrossPadding));
    children.forEach((child) => computeComponentSize(child, crossSize, crossPadding, position, theme, library));
    const maxSize = (0, d3_array_1.max)(children, (d) => d.size);
    component.size = maxSize;
    children.forEach((d) => (d.size = maxSize));
}
function computeScrollbarSize(component, crossSize, crossPadding, position, theme, library) {
    const { trackSize = 6 } = (0, util_1.deepMix)({}, theme.scrollbar, component);
    component.size = trackSize;
}
function computeTitleSize(component, crossSize, crossPadding, position, theme, library) {
    const _a = (0, util_1.deepMix)({}, theme.title, component), { title, subtitle, spacing = 0 } = _a, style = __rest(_a, ["title", "subtitle", "spacing"]);
    if (title) {
        const titleStyle = (0, helper_1.subObject)(style, 'title');
        const titleBBox = computeLabelSize(title, titleStyle);
        component.size = titleBBox.height;
    }
    if (subtitle) {
        const subtitleStyle = (0, helper_1.subObject)(style, 'subtitle');
        const subtitleBBox = computeLabelSize(subtitle, subtitleStyle);
        component.size += spacing + subtitleBBox.height;
    }
}
function computeSliderSize(component, crossSize, crossPadding, position, theme, library) {
    const styleOf = () => {
        const { slider } = theme;
        return (0, util_1.deepMix)({}, slider, component);
    };
    const { trackSize, handleIconSize } = styleOf();
    const size = Math.max(trackSize, handleIconSize * 2.4);
    component.size = size;
}
function computeAxisSize(component, crossSize, crossPadding, position, theme, library) {
    var _a;
    // If padding is auto, use hide as the labelTransform by default
    // to avoid overlap between labels.
    component.transform = component.transform || [{ type: 'hide' }];
    // Vertical or horizontal.
    const isVertical = position === 'left' || position === 'right';
    // Get styles to be applied.
    const style = styleOf(component, position, theme);
    const { tickLength = 0, labelSpacing = 0, titleSpacing = 0, labelAutoRotate } = style, rest = __rest(style, ["tickLength", "labelSpacing", "titleSpacing", "labelAutoRotate"]);
    // Compute Labels.
    const scale = createScale(component, library);
    const labelBBoxes = computeLabelsBBox(rest, scale);
    const paddingTick = tickLength + labelSpacing;
    if (labelBBoxes && labelBBoxes.length) {
        const maxLabelWidth = (0, d3_array_1.max)(labelBBoxes, (d) => d.width);
        const maxLabelHeight = (0, d3_array_1.max)(labelBBoxes, (d) => d.height);
        if (isVertical) {
            component.size = maxLabelWidth + paddingTick;
        }
        else {
            const { tickFilter, labelTransform } = component;
            // If the labels can't be placed horizontally, and labelTransform is unset,
            // rotate 90 deg to display them.
            if (overflowX(scale, labelBBoxes, crossSize, crossPadding, tickFilter) &&
                !labelTransform &&
                labelAutoRotate !== false &&
                labelAutoRotate !== null) {
                component.labelTransform = 'rotate(90)';
                component.size = maxLabelWidth + paddingTick;
            }
            else {
                component.labelTransform = (_a = component.labelTransform) !== null && _a !== void 0 ? _a : 'rotate(0)';
                component.size = maxLabelHeight + paddingTick;
            }
        }
    }
    else {
        component.size = tickLength;
    }
    // Compute title.
    const titleBBox = computeTitleBBox(rest);
    if (titleBBox) {
        if (isVertical) {
            component.size += titleSpacing + titleBBox.width;
        }
        else {
            component.size += titleSpacing + titleBBox.height;
        }
    }
}
function computeContinuousLegendSize(component, crossSize, crossPadding, position, theme, library) {
    // Get styles.
    const styleOf = () => {
        const { legendContinuous } = theme;
        return (0, util_1.deepMix)({}, legendContinuous, component);
    };
    const _a = styleOf(), { labelSpacing = 0, titleSpacing = 0 } = _a, rest = __rest(_a, ["labelSpacing", "titleSpacing"]);
    // Vertical or horizontal.
    const isVertical = position === 'left' || position === 'right';
    // Ribbon styles.
    const ribbonStyles = (0, helper_1.subObject)(rest, 'ribbon');
    const { size: ribbonSize } = ribbonStyles;
    const handleIconStyles = (0, helper_1.subObject)(rest, 'handleIcon');
    const { size: handleIconSize } = handleIconStyles;
    const mainSize = Math.max(ribbonSize, handleIconSize * 2.4);
    component.size = mainSize;
    // Compute labels.
    const scale = createScale(component, library);
    const labelBBoxes = computeLabelsBBox(rest, scale);
    if (labelBBoxes) {
        const key = isVertical ? 'width' : 'height';
        const size = (0, d3_array_1.max)(labelBBoxes, (d) => d[key]);
        component.size += size + labelSpacing;
    }
    // Compute title.
    const titleBBox = computeTitleBBox(rest);
    if (titleBBox) {
        if (isVertical) {
            component.size = Math.max(component.size, titleBBox.width);
        }
        else {
            component.size += titleSpacing + titleBBox.height;
        }
    }
}
function computeCategoryLegendSize(component, crossSize0, crossPadding, position, theme, library) {
    const styleOf = () => {
        const { legendCategory } = theme;
        const { title } = component;
        const [defaultTitle, specifiedTitle] = Array.isArray(title)
            ? [title, undefined]
            : [undefined, title];
        return (0, util_1.deepMix)({ title: defaultTitle }, legendCategory, Object.assign(Object.assign({}, component), { title: specifiedTitle }));
    };
    const _a = styleOf(), { itemSpacing, itemMarkerSize, titleSpacing, rowPadding, colPadding, maxCols = Infinity, maxRows = Infinity } = _a, rest = __rest(_a, ["itemSpacing", "itemMarkerSize", "titleSpacing", "rowPadding", "colPadding", "maxCols", "maxRows"]);
    const { cols, length } = component;
    const getRows = (rows) => Math.min(rows, maxRows);
    const getCols = (cols) => Math.min(cols, maxCols);
    // Vertical or horizontal.
    const isVertical = position === 'left' || position === 'right';
    const crossSize = length === undefined
        ? crossSize0 + (isVertical ? 0 : crossPadding[0] + crossPadding[1])
        : length;
    // Compute title.
    const titleBBox = computeTitleBBox(rest);
    const scale = createScale(component, library);
    const labelBBoxes = computeLabelsBBox(rest, scale, 'itemLabel');
    const height = Math.max(labelBBoxes[0].height, itemMarkerSize) + rowPadding;
    const widthOf = (w, padding = 0) => itemMarkerSize + w + itemSpacing[0] + padding;
    // Only support grid layout for vertical area.
    const computeVerticalSize = () => {
        let maxSize = -Infinity;
        let pos = 0;
        let cols = 1;
        let rows = 0;
        let maxRows = -Infinity;
        let maxPos = -Infinity;
        const titleHeight = titleBBox ? titleBBox.height : 0;
        const maxHeight = crossSize - titleHeight;
        for (const { width } of labelBBoxes) {
            const w = widthOf(width, colPadding);
            maxSize = Math.max(maxSize, w);
            if (pos + height > maxHeight) {
                cols++;
                maxRows = Math.max(maxRows, rows);
                maxPos = Math.max(maxPos, pos);
                rows = 1;
                pos = height;
            }
            else {
                pos += height;
                rows++;
            }
        }
        if (cols <= 1) {
            maxRows = rows;
            maxPos = pos;
        }
        component.size = maxSize * getCols(cols);
        component.length = maxPos + titleHeight;
        (0, util_1.deepMix)(component, { cols: getCols(cols), gridRow: maxRows });
    };
    // Horizontal grid layout.
    const computeHorizontalGrid = () => {
        const rows = Math.ceil(labelBBoxes.length / cols);
        const maxWidth = (0, d3_array_1.max)(labelBBoxes, (d) => widthOf(d.width)) * cols;
        component.size = height * getRows(rows) - rowPadding;
        component.length = Math.min(maxWidth, crossSize);
    };
    // Horizontal flex layout.
    const computeHorizontalFlex = () => {
        let rows = 1;
        let pos = 0;
        let maxPos = -Infinity;
        for (const { width } of labelBBoxes) {
            const w = widthOf(width, colPadding);
            if (pos + w > crossSize) {
                maxPos = Math.max(maxPos, pos);
                pos = w;
                rows++;
            }
            else {
                pos += w;
            }
        }
        if (rows === 1)
            maxPos = pos;
        component.size = height * getRows(rows) - rowPadding;
        component.length = maxPos;
    };
    if (isVertical)
        computeVerticalSize();
    else if (typeof cols === 'number')
        computeHorizontalGrid();
    else
        computeHorizontalFlex();
    // Compute titles.
    if (titleBBox) {
        if (isVertical) {
            component.size = Math.max(component.size, titleBBox.width);
        }
        else {
            component.size += titleSpacing + titleBBox.height;
        }
    }
}
function createScale(component, library) {
    const [useScale] = (0, library_1.useLibrary)('scale', library);
    // Init scale, the tickCount of axis has higher priority than scale.
    const { scales, tickCount, tickMethod } = component;
    const scaleOptions = scales.find((d) => d.type !== 'constant' && d.type !== 'identity');
    if (tickCount !== undefined)
        scaleOptions.tickCount = tickCount;
    if (tickMethod !== undefined)
        scaleOptions.tickMethod = tickMethod;
    return useScale(scaleOptions);
}
exports.createScale = createScale;
function computeLabelsBBox(component, scale, key = 'label') {
    const { labelFormatter, tickFilter, label = true } = component, style = __rest(component, ["labelFormatter", "tickFilter", "label"]);
    if (!label)
        return null;
    // Get labels to be rendered.
    const labels = labelsOf(scale, labelFormatter, tickFilter);
    const labelStyle = (0, helper_1.subObject)(style, key);
    const labelStyles = labels.map((d, i) => Object.fromEntries(Object.entries(labelStyle).map(([key, value]) => [
        key,
        typeof value === 'function' ? value(d, i) : value,
    ])));
    const labelBBoxes = labels.map((d, i) => {
        const normalizeStyle = labelStyles[i];
        return computeLabelSize(d, normalizeStyle);
    });
    // Cache boxes to avoid computed twice.
    // @todo GUI use untransformed bbox, so it can't cache if
    // label.style has transform attributes.
    const hasTransform = labelStyles.some((d) => d.transform);
    if (!hasTransform) {
        const I = labels.map((_, i) => i);
        component.indexBBox = new Map(I.map((i) => [i, [labels[i], labelBBoxes[i]]]));
    }
    return labelBBoxes;
}
exports.computeLabelsBBox = computeLabelsBBox;
function computeTitleBBox(component) {
    const isFalsy = (x) => x === false || x === null;
    const { title } = component, style = __rest(component, ["title"]);
    if (isFalsy(title) || title === undefined)
        return null;
    const titleStyle = (0, helper_1.subObject)(style, 'title');
    const { direction, transform } = titleStyle;
    const titleText = Array.isArray(title) ? title.join(',') : title;
    if (typeof titleText !== 'string')
        return null;
    const titleBBox = computeLabelSize(titleText, Object.assign(Object.assign({}, titleStyle), { transform: transform || (direction === 'vertical' ? 'rotate(-90)' : '') }));
    return titleBBox;
}
exports.computeTitleBBox = computeTitleBBox;
function styleOf(axis, position, theme) {
    const { title } = axis;
    const [defaultTitle, specifiedTitle] = Array.isArray(title)
        ? [title, undefined]
        : [undefined, title];
    const { axis: baseStyle, 
    // @ts-ignore
    [`axis${(0, helper_1.capitalizeFirst)(position)}`]: positionStyle, } = theme;
    return (0, util_1.deepMix)({ title: defaultTitle }, baseStyle, positionStyle, Object.assign(Object.assign({}, axis), { title: specifiedTitle }));
}
exports.styleOf = styleOf;
function ticksOf(scale, tickFilter) {
    const ticks = scale.getTicks ? scale.getTicks() : scale.getOptions().domain;
    if (!tickFilter)
        return ticks;
    return ticks.filter(tickFilter);
}
function labelsOf(scale, labelFormatter, tickFilter) {
    const T = ticksOf(scale, tickFilter);
    const ticks = T.map((d) => (typeof d === 'number' ? (0, number_1.prettyNumber)(d) : d));
    const formatter = labelFormatter
        ? typeof labelFormatter === 'string'
            ? (0, d3_format_1.format)(labelFormatter)
            : labelFormatter
        : scale.getFormatter
            ? scale.getFormatter()
            : (d) => `${d}`;
    return ticks.map(formatter);
}
function offsetOf(scale, d) {
    if (!scale.getBandWidth)
        return 0;
    const offset = scale.getBandWidth(d) / 2;
    return offset;
}
function overflowX(scale, labelBBoxes, crossSize, crossPadding, tickFilter) {
    // If actual size bigger than container size, overflow.
    const totalSize = (0, d3_array_1.sum)(labelBBoxes, (d) => d.width);
    if (totalSize > crossSize)
        return true;
    // Clone scale to get visual position for labels.
    const scaleX = scale.clone();
    scaleX.update({ range: [0, crossSize] });
    const ticks = ticksOf(scale, tickFilter);
    const X = ticks.map((d) => scaleX.map(d) + offsetOf(scaleX, d));
    const I = ticks.map((_, i) => i);
    const startX = -crossPadding[0];
    const endX = crossSize + crossPadding[1];
    const extent = (x, bbox) => {
        const { width } = bbox;
        return [x - width / 2, x + width / 2];
    };
    // Collision detection.
    for (let i = 0; i < I.length; i++) {
        const x = X[i];
        const [x0, x1] = extent(x, labelBBoxes[i]);
        // If a label is out of plot area, overflow.
        if (x0 < startX || x1 > endX)
            return true;
        const y = X[i + 1];
        if (y) {
            // If two labels intersect, overflow.
            const [y0] = extent(y, labelBBoxes[i + 1]);
            if (x1 > y0)
                return true;
        }
    }
    return false;
}
function computeLabelSize(d, style) {
    const shape = normalizeLabel(d);
    const { filter } = style, rest = __rest(style, ["filter"]);
    shape.attr(Object.assign(Object.assign({}, rest), { visibility: 'none' }));
    const bbox = shape.getBBox();
    return bbox;
}
function normalizeLabel(d) {
    if (d instanceof g_1.DisplayObject)
        return d;
    return new g_1.Text({ style: { text: `${d}` } });
}
//# sourceMappingURL=component.js.map
}, function(modId) { var map = {"../coordinate":1751263815805,"../utils/array":1751263815830,"../utils/number":1751263815884,"../utils/helper":1751263815829,"../component/constant":1751263816095,"./coordinate":1751263816096,"./library":1751263816097,"./scale":1751263816114,"./types/scale":1751263816115}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816095, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LEGEND_INFER_STRATEGIES = void 0;
/**
 * @examples
 * ✅
 * color - `discrete`, shape - `constant`
 * legendCategory.rule[27] is matched
 *
 * ❎
 * shape - `discrete`, size - `constant`
 * There are no rules to match
 *
 */
exports.LEGEND_INFER_STRATEGIES = [
    [
        'legendCategory',
        [
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
                ['shape', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
                ['shape', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'constant'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
                ['shape', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
                ['shape', 'discrete'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
                ['shape', 'discrete'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['shape', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
                ['shape', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
                ['shape', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['shape', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
                ['shape', 'discrete'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'constant'],
                ['shape', 'discrete'],
            ],
            // [
            //   ['color', 'constant'],
            //   ['opacity', 'constant'],
            //   ['size', 'constant'],
            // ],
            // [
            //   ['color', 'constant'],
            //   ['shape', 'constant'],
            //   ['size', 'constant'],
            // ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
                ['shape', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['shape', 'discrete'],
            ],
            [
                ['color', 'discrete'],
                ['size', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'discrete'],
            ],
            [
                ['color', 'discrete'],
                ['opacity', 'constant'],
            ],
            [
                ['color', 'discrete'],
                ['shape', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['shape', 'discrete'],
            ],
            [
                ['color', 'constant'],
                ['size', 'constant'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'discrete'],
            ],
            // [
            //   ['color', 'constant'],
            //   ['opacity', 'constant'],
            // ],
            // [
            //   ['color', 'constant'],
            //   ['shape', 'constant'],
            // ],
            [['color', 'discrete']],
            // [['color', 'constant']],
        ],
    ],
    [
        'legendContinuousSize',
        [
            [
                ['color', 'continuous'],
                ['opacity', 'continuous'],
                ['size', 'continuous'],
            ],
            [
                ['color', 'constant'],
                ['opacity', 'continuous'],
                ['size', 'continuous'],
            ],
            [
                ['color', 'continuous'],
                ['size', 'continuous'],
            ],
            [
                ['color', 'constant'],
                ['size', 'continuous'],
            ],
            [
                ['size', 'continuous'],
                ['opacity', 'continuous'],
            ],
            [['size', 'continuous']],
        ],
    ],
    [
        'legendContinuousBlockSize',
        [
            [
                ['color', 'distribution'],
                ['opacity', 'distribution'],
                ['size', 'distribution'],
            ],
            [
                ['color', 'distribution'],
                ['size', 'distribution'],
            ],
        ],
    ],
    [
        'legendContinuousBlock',
        [
            [
                ['color', 'distribution'],
                ['opacity', 'continuous'],
            ],
            [['color', 'distribution']],
        ],
    ],
    [
        'legendContinuous',
        [
            [
                ['color', 'continuous'],
                ['opacity', 'continuous'],
            ],
            [['color', 'continuous']],
            [['opacity', 'continuous']],
        ],
    ],
];
//# sourceMappingURL=constant.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816096, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isReflectY = exports.isRadar = exports.isRadial = exports.isReflect = exports.isTheta = exports.isParallel = exports.isTranspose = exports.isHelix = exports.isPolar = exports.coordOf = exports.coordinate2Transform = exports.createCoordinate = void 0;
const coord_1 = require("@antv/coord");
const library_1 = require("./library");
function createCoordinate(layout, partialOptions, library) {
    const [useCoordinate] = (0, library_1.useLibrary)('coordinate', library);
    const { innerHeight, innerWidth, insetLeft, insetTop, insetRight, insetBottom, } = layout;
    const { coordinates: partialTransform = [] } = partialOptions;
    const transform = inferCoordinate(partialTransform);
    const isCartesian3D = transform[0].type === 'cartesian3D';
    const options = Object.assign(Object.assign({}, layout), { x: insetLeft, y: insetTop, width: innerWidth - insetLeft - insetRight, height: innerHeight - insetBottom - insetTop, transformations: transform.flatMap(useCoordinate) });
    const coordinate = isCartesian3D
        ? // @ts-ignore
            new coord_1.Coordinate3D(options)
        : new coord_1.Coordinate(options);
    return coordinate;
}
exports.createCoordinate = createCoordinate;
function coordinate2Transform(node, library) {
    // @ts-ignore
    const { coordinate = {}, coordinates } = node, rest = __rest(node, ["coordinate", "coordinates"]);
    // If coordinates are already set, it means that the coordinate has been processed
    // during the initialization. There is not need to process it during update.
    if (coordinates)
        return node;
    const { type, transform = [] } = coordinate, options = __rest(coordinate, ["type", "transform"]);
    if (!type)
        return Object.assign(Object.assign({}, rest), { coordinates: transform });
    const [, createCoordinate] = (0, library_1.useLibrary)('coordinate', library);
    const { transform: isTransform = false } = createCoordinate(type).props || {};
    if (isTransform) {
        throw new Error(`Unknown coordinate: ${type}.`);
    }
    return Object.assign(Object.assign({}, rest), { coordinates: [Object.assign({ type }, options), ...transform] });
}
exports.coordinate2Transform = coordinate2Transform;
function coordOf(coordinates, type) {
    return coordinates.filter((d) => d.type === type);
}
exports.coordOf = coordOf;
/**
 * todo Duplication is not considered
 */
function isPolar(coordinates) {
    return coordOf(coordinates, 'polar').length > 0;
}
exports.isPolar = isPolar;
function isHelix(coordinates) {
    return coordOf(coordinates, 'helix').length > 0;
}
exports.isHelix = isHelix;
/**
 * todo The number of transposes matters
 */
function isTranspose(coordinates) {
    return coordOf(coordinates, 'transpose').length % 2 === 1;
}
exports.isTranspose = isTranspose;
function isParallel(coordinates) {
    return coordOf(coordinates, 'parallel').length > 0;
}
exports.isParallel = isParallel;
function isTheta(coordinates) {
    return coordOf(coordinates, 'theta').length > 0;
}
exports.isTheta = isTheta;
function isReflect(coordinates) {
    return coordOf(coordinates, 'reflect').length > 0;
}
exports.isReflect = isReflect;
function isRadial(coordinates) {
    return coordOf(coordinates, 'radial').length > 0;
}
exports.isRadial = isRadial;
function isRadar(coordinates) {
    return coordOf(coordinates, 'radar').length > 0;
}
exports.isRadar = isRadar;
/**
 * todo The axis corresponding to the Y reversal is not reversed
 */
function isReflectY(coordinates) {
    return coordOf(coordinates, 'reflectY').length > 0;
}
exports.isReflectY = isReflectY;
function inferCoordinate(coordinates) {
    if (coordinates.find((d) => d.type === 'cartesian' || d.type === 'cartesian3D'))
        return coordinates;
    return [...coordinates, { type: 'cartesian' }];
}
//# sourceMappingURL=coordinate.js.map
}, function(modId) { var map = {"./library":1751263816097}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816097, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.documentOf = exports.useLibrary = void 0;
const helper_1 = require("../utils/helper");
const builtinlib_1 = require("../lib/builtinlib");
function useLibrary(namespace, publicLibrary) {
    const library = Object.assign(Object.assign({}, (0, builtinlib_1.builtinlib)()), publicLibrary);
    const create = (type) => {
        if (typeof type !== 'string')
            return type;
        const key = `${namespace}.${type}`;
        return library[key] || (0, helper_1.error)(`Unknown Component: ${key}`);
    };
    const use = (options, context) => {
        const { type } = options, rest = __rest(options, ["type"]);
        if (!type)
            (0, helper_1.error)(`Plot type is required!`);
        const currentLibrary = create(type);
        return currentLibrary === null || currentLibrary === void 0 ? void 0 : currentLibrary(rest, context);
    };
    return [use, create];
}
exports.useLibrary = useLibrary;
function documentOf(library) {
    const { canvas, group } = library;
    return ((canvas === null || canvas === void 0 ? void 0 : canvas.document) ||
        (group === null || group === void 0 ? void 0 : group.ownerDocument) ||
        (0, helper_1.error)(`Cannot find library document`));
}
exports.documentOf = documentOf;
//# sourceMappingURL=library.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../lib/builtinlib":1751263816098}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816098, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.builtinlib = void 0;
const component_1 = require("../component");
const composition_1 = require("../composition");
const shape_1 = require("../shape");
const event_1 = require("../interaction/event");
// Some private visual components, they are not public to
// users, only for runtime.
function builtinlib() {
    return {
        'component.axisRadar': component_1.AxisRadar,
        'component.axisLinear': component_1.AxisLinear,
        'component.axisArc': component_1.AxisArc,
        'component.legendContinuousBlock': component_1.LegendContinuousBlock,
        'component.legendContinuousBlockSize': component_1.LegendContinuousBlockSize,
        'component.legendContinuousSize': component_1.LegendContinuousSize,
        'interaction.event': event_1.Event,
        'composition.mark': composition_1.Mark,
        'composition.view': composition_1.View,
        'shape.label.label': shape_1.LabelShape,
    };
}
exports.builtinlib = builtinlib;
//# sourceMappingURL=builtinlib.js.map
}, function(modId) { var map = {"../component":1751263816043,"../composition":1751263816099,"../shape":1751263815879,"../interaction/event":1751263816113}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816099, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.GeoView = exports.GeoPath = exports.TimingKeyframe = exports.FacetCircle = exports.RepeatMatrix = exports.FacetRect = exports.Mark = exports.View = exports.SpaceFlex = exports.SpaceLayer = void 0;
var spaceLayer_1 = require("./spaceLayer");
Object.defineProperty(exports, "SpaceLayer", { enumerable: true, get: function () { return spaceLayer_1.SpaceLayer; } });
var spaceFlex_1 = require("./spaceFlex");
Object.defineProperty(exports, "SpaceFlex", { enumerable: true, get: function () { return spaceFlex_1.SpaceFlex; } });
var view_1 = require("./view");
Object.defineProperty(exports, "View", { enumerable: true, get: function () { return view_1.View; } });
var mark_1 = require("./mark");
Object.defineProperty(exports, "Mark", { enumerable: true, get: function () { return mark_1.Mark; } });
var facetRect_1 = require("./facetRect");
Object.defineProperty(exports, "FacetRect", { enumerable: true, get: function () { return facetRect_1.FacetRect; } });
var repeatMatrix_1 = require("./repeatMatrix");
Object.defineProperty(exports, "RepeatMatrix", { enumerable: true, get: function () { return repeatMatrix_1.RepeatMatrix; } });
var facetCircle_1 = require("./facetCircle");
Object.defineProperty(exports, "FacetCircle", { enumerable: true, get: function () { return facetCircle_1.FacetCircle; } });
var timingKeyframe_1 = require("./timingKeyframe");
Object.defineProperty(exports, "TimingKeyframe", { enumerable: true, get: function () { return timingKeyframe_1.TimingKeyframe; } });
var geoPath_1 = require("./geoPath");
Object.defineProperty(exports, "GeoPath", { enumerable: true, get: function () { return geoPath_1.GeoPath; } });
var geoView_1 = require("./geoView");
Object.defineProperty(exports, "GeoView", { enumerable: true, get: function () { return geoView_1.GeoView; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./spaceLayer":1751263816100,"./spaceFlex":1751263816102,"./view":1751263816103,"./mark":1751263816104,"./facetRect":1751263816105,"./repeatMatrix":1751263816107,"./facetCircle":1751263816108,"./timingKeyframe":1751263816109,"./geoPath":1751263816110,"./geoView":1751263816111}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816100, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpaceLayer = void 0;
const utils_1 = require("./utils");
/**
 * @todo Propagate more options to children.
 */
const SpaceLayer = () => {
    return (options) => {
        const { children } = options;
        if (!Array.isArray(children))
            return [];
        const { x: viewX = 0, y: viewY = 0, width: viewWidth, height: viewHeight, data: layerData, } = options;
        return children.map((_a) => {
            var { data, x, y, width, height } = _a, rest = __rest(_a, ["data", "x", "y", "width", "height"]);
            return (Object.assign(Object.assign({}, rest), { data: (0, utils_1.mergeData)(data, layerData), x: x !== null && x !== void 0 ? x : viewX, y: y !== null && y !== void 0 ? y : viewY, width: width !== null && width !== void 0 ? width : viewWidth, height: height !== null && height !== void 0 ? height : viewHeight }));
        });
    };
};
exports.SpaceLayer = SpaceLayer;
exports.SpaceLayer.props = {};
//# sourceMappingURL=spaceLayer.js.map
}, function(modId) { var map = {"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816101, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeData = exports.isObject = exports.useOverrideAdaptor = exports.useDefaultAdaptor = void 0;
const util_1 = require("@antv/util");
/**
 * Adaptor return default options for raw options.
 */
function useDefaultAdaptor(adaptor) {
    return (options, ...rest) => (0, util_1.deepMix)({}, adaptor(options, ...rest), options);
}
exports.useDefaultAdaptor = useDefaultAdaptor;
/**
 * Adaptor return options override raw options.
 */
function useOverrideAdaptor(adaptor) {
    return (options, ...rest) => (0, util_1.deepMix)({}, options, adaptor(options, ...rest));
}
exports.useOverrideAdaptor = useOverrideAdaptor;
function isObject(d) {
    if (d instanceof Date)
        return false;
    return typeof d === 'object';
}
exports.isObject = isObject;
function mergeData(dataDescriptor, dataValue) {
    if (!dataDescriptor)
        return dataValue;
    if (Array.isArray(dataDescriptor))
        return dataDescriptor;
    if (isObject(dataDescriptor)) {
        const { value = dataValue } = dataDescriptor, rest = __rest(dataDescriptor, ["value"]);
        return Object.assign(Object.assign({}, rest), { value });
    }
    return dataDescriptor;
}
exports.mergeData = mergeData;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816102, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpaceFlex = void 0;
const utils_1 = require("./utils");
/**
 * @todo Propagate more options to children.
 */
const SpaceFlex = () => {
    return (options) => {
        const { children } = options;
        if (!Array.isArray(children))
            return [];
        const { direction = 'row', ratio = children.map(() => 1), padding = 0, data: flexData, } = options;
        const [mainStart, mainSize, crossSize, crossStart] = direction === 'col'
            ? ['y', 'height', 'width', 'x']
            : ['x', 'width', 'height', 'y'];
        const sum = ratio.reduce((total, value) => total + value);
        const totalSize = options[mainSize] - padding * (children.length - 1);
        const sizes = ratio.map((value) => totalSize * (value / sum));
        const newChildren = [];
        let next = options[mainStart] || 0;
        for (let i = 0; i < sizes.length; i += 1) {
            const _a = children[i], { data } = _a, rest = __rest(_a, ["data"]);
            const newData = (0, utils_1.mergeData)(data, flexData);
            newChildren.push(Object.assign({ [mainStart]: next, [mainSize]: sizes[i], [crossStart]: options[crossStart] || 0, [crossSize]: options[crossSize], data: newData }, rest));
            next += sizes[i] + padding;
        }
        return newChildren;
    };
};
exports.SpaceFlex = SpaceFlex;
exports.SpaceFlex.props = {};
//# sourceMappingURL=spaceFlex.js.map
}, function(modId) { var map = {"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816103, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.View = void 0;
const util_1 = require("@antv/util");
const utils_1 = require("./utils");
/**
 * @todo Propagate more options to children.(e.g. filter)
 * @todo Propagate encode options to children. This is useful for Matrix composition.
 * @todo Move this to runtime, do not treat it as a composition to cause confusion.
 */
const View = () => {
    return (options) => {
        const { children } = options, restOptions = __rest(options, ["children"]);
        if (!Array.isArray(children))
            return [];
        const { data: viewData, scale: viewScale = {}, axis: viewAxis = {}, legend: viewLegend = {}, encode: viewEncode = {}, transform: viewTransform = [] } = restOptions, rest = __rest(restOptions, ["data", "scale", "axis", "legend", "encode", "transform"]);
        const marks = children.map((_a) => {
            var { data, scale = {}, axis = {}, legend = {}, encode = {}, transform = [] } = _a, rest = __rest(_a, ["data", "scale", "axis", "legend", "encode", "transform"]);
            return (Object.assign({ data: (0, utils_1.mergeData)(data, viewData), scale: (0, util_1.deepMix)({}, viewScale, scale), encode: (0, util_1.deepMix)({}, viewEncode, encode), transform: [...viewTransform, ...transform], axis: axis && viewAxis ? (0, util_1.deepMix)({}, viewAxis, axis) : false, legend: legend && viewLegend ? (0, util_1.deepMix)({}, viewLegend, legend) : false }, rest));
        });
        return [Object.assign(Object.assign({}, rest), { marks, type: 'standardView' })];
    };
};
exports.View = View;
exports.View.props = {};
//# sourceMappingURL=view.js.map
}, function(modId) { var map = {"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816104, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mark = void 0;
// @todo Move this to runtime.
const Mark = ({ static: isStatic = false, } = {}) => {
    return (options) => {
        const { width, height, depth, paddingLeft, paddingRight, paddingTop, paddingBottom, padding, inset, insetLeft, insetTop, insetRight, insetBottom, margin, marginLeft, marginBottom, marginTop, marginRight, data, coordinate, theme, component, interaction, x, y, z, key, frame, labelTransform, parentKey, clip, viewStyle, title } = options, mark = __rest(options, ["width", "height", "depth", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "padding", "inset", "insetLeft", "insetTop", "insetRight", "insetBottom", "margin", "marginLeft", "marginBottom", "marginTop", "marginRight", "data", "coordinate", "theme", "component", "interaction", "x", "y", "z", "key", "frame", "labelTransform", "parentKey", "clip", "viewStyle", "title"]);
        return [
            Object.assign(Object.assign({ type: 'standardView', x,
                y,
                z,
                key,
                width,
                height,
                depth,
                padding,
                paddingLeft,
                paddingRight,
                paddingTop,
                inset,
                insetLeft,
                insetTop,
                insetRight,
                insetBottom,
                paddingBottom,
                theme,
                coordinate,
                component,
                interaction,
                frame,
                labelTransform,
                margin,
                marginLeft,
                marginBottom,
                marginTop,
                marginRight,
                parentKey,
                clip, style: viewStyle }, (!isStatic && { title })), { marks: [Object.assign(Object.assign(Object.assign({}, mark), { key: `${key}-0`, data }), (isStatic && { title }))] }),
        ];
    };
};
exports.Mark = Mark;
exports.Mark.props = {};
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816105, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FacetRect = exports.createInnerGuide = exports.setChildren = exports.setData = exports.toCell = exports.setStyle = exports.setAnimation = exports.inferColor = void 0;
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const vector_1 = require("../utils/vector");
const container_1 = require("../utils/container");
const array_1 = require("../utils/array");
const utils_1 = require("./utils");
const setScale = (0, utils_1.useDefaultAdaptor)((options) => {
    const { encode, data, scale, shareSize = false } = options;
    const { x, y } = encode;
    const flexDomain = (encode, channel) => {
        var _a;
        if (encode === undefined || !shareSize)
            return {};
        const groups = (0, d3_array_1.group)(data, (d) => d[encode]);
        const domain = ((_a = scale === null || scale === void 0 ? void 0 : scale[channel]) === null || _a === void 0 ? void 0 : _a.domain) || Array.from(groups.keys());
        const flex = domain.map((key) => {
            if (!groups.has(key))
                return 1;
            return groups.get(key).length;
        });
        return { domain, flex };
    };
    return {
        scale: {
            x: Object.assign(Object.assign({ paddingOuter: 0, paddingInner: 0.1, guide: x === undefined ? null : { position: 'top' } }, (x === undefined && { paddingInner: 0 })), flexDomain(x, 'x')),
            y: Object.assign(Object.assign({ range: [0, 1], paddingOuter: 0, paddingInner: 0.1, guide: y === undefined ? null : { position: 'right' } }, (y === undefined && { paddingInner: 0 })), flexDomain(y, 'y')),
        },
    };
});
/**
 * BFS view tree and using the last discovered color encode
 * as the top-level encode for this plot. This is useful when
 * color encode and color scale is specified in mark node.
 * It makes sense because the whole facet should shared the same
 * color encoding, but it also can be override with explicity
 * encode and scale specification.
 */
exports.inferColor = (0, utils_1.useOverrideAdaptor)((options) => {
    const { data, scale, legend } = options;
    const discovered = [options];
    let encodeColor;
    let scaleColor;
    let legendColor;
    while (discovered.length) {
        const node = discovered.shift();
        const { children, encode = {}, scale = {}, legend = {} } = node;
        const { color: c } = encode;
        const { color: cs } = scale;
        const { color: cl } = legend;
        if (c !== undefined)
            encodeColor = c;
        if (cs !== undefined)
            scaleColor = cs;
        if (cl !== undefined)
            legendColor = cl;
        if (Array.isArray(children)) {
            discovered.push(...children);
        }
    }
    const domainColor = () => {
        var _a;
        const domain = (_a = scale === null || scale === void 0 ? void 0 : scale.color) === null || _a === void 0 ? void 0 : _a.domain;
        if (domain !== undefined)
            return [domain];
        if (encodeColor === undefined)
            return [undefined];
        const color = typeof encodeColor === 'function' ? encodeColor : (d) => d[encodeColor];
        const values = data.map(color);
        if (values.some((d) => typeof d === 'number'))
            return [(0, d3_array_1.extent)(values)];
        return [Array.from(new Set(values)), 'ordinal'];
    };
    const title = typeof encodeColor === 'string' ? encodeColor : '';
    const [domain, type] = domainColor();
    return Object.assign({ encode: { color: { type: 'column', value: domain !== null && domain !== void 0 ? domain : [] } }, scale: { color: (0, util_1.deepMix)({}, scaleColor, { domain, type }) } }, (legend === undefined && {
        legend: { color: (0, util_1.deepMix)({ title }, legendColor) },
    }));
});
exports.setAnimation = (0, utils_1.useDefaultAdaptor)(() => ({
    animate: {
        enterType: 'fadeIn',
    },
}));
exports.setStyle = (0, utils_1.useOverrideAdaptor)(() => ({
    frame: false,
    encode: {
        shape: 'hollow',
    },
    style: {
        lineWidth: 0,
    },
}));
exports.toCell = (0, utils_1.useOverrideAdaptor)(() => ({
    type: 'cell',
}));
/**
 * Do not set cell data directly, the children will get wrong do if do
 * so. Use transform to set new data.
 **/
exports.setData = (0, utils_1.useOverrideAdaptor)((options) => {
    const { data } = options;
    const connector = {
        type: 'custom',
        callback: () => {
            const { data, encode } = options;
            const { x, y } = encode;
            const X = x ? Array.from(new Set(data.map((d) => d[x]))) : [];
            const Y = y ? Array.from(new Set(data.map((d) => d[y]))) : [];
            const cellData = () => {
                if (X.length && Y.length) {
                    const cellData = [];
                    for (const vx of X) {
                        for (const vy of Y) {
                            cellData.push({ [x]: vx, [y]: vy });
                        }
                    }
                    return cellData;
                }
                if (X.length)
                    return X.map((d) => ({ [x]: d }));
                if (Y.length)
                    return Y.map((d) => ({ [y]: d }));
            };
            return cellData();
        },
    };
    return {
        data: { type: 'inline', value: data, transform: [connector] },
    };
});
/**
 * @todo Move some options assignment to runtime.
 */
exports.setChildren = (0, utils_1.useOverrideAdaptor)((options, subLayout = subLayoutRect, createGuideX = createGuideXRect, createGuideY = createGuideYRect, childOptions = {}) => {
    const { data: dataValue, encode, children, scale: facetScale, x: originX = 0, y: originY = 0, shareData = false, key: viewKey, } = options;
    const { value: data } = dataValue;
    // Only support field encode now.
    const { x: encodeX, y: encodeY } = encode;
    const { color: facetScaleColor } = facetScale;
    const { domain: facetDomainColor } = facetScaleColor;
    const createChildren = (visualData, scale, layout) => {
        const { x: scaleX, y: scaleY } = scale;
        const { paddingLeft, paddingTop, marginLeft, marginTop } = layout;
        const { domain: domainX } = scaleX.getOptions();
        const { domain: domainY } = scaleY.getOptions();
        const index = (0, array_1.indexOf)(visualData);
        const bboxs = visualData.map(subLayout);
        const values = visualData.map(({ x, y }) => [
            scaleX.invert(x),
            scaleY.invert(y),
        ]);
        const filters = values.map(([fx, fy]) => (d) => {
            const { [encodeX]: x, [encodeY]: y } = d;
            const inX = encodeX !== undefined ? x === fx : true;
            const inY = encodeY !== undefined ? y === fy : true;
            return inX && inY;
        });
        const facetData2d = filters.map((f) => data.filter(f));
        const maxDataDomain = shareData
            ? (0, d3_array_1.max)(facetData2d, (data) => data.length)
            : undefined;
        const facets = values.map(([fx, fy]) => ({
            columnField: encodeX,
            columnIndex: domainX.indexOf(fx),
            columnValue: fx,
            columnValuesLength: domainX.length,
            rowField: encodeY,
            rowIndex: domainY.indexOf(fy),
            rowValue: fy,
            rowValuesLength: domainY.length,
        }));
        const normalizedChildren = facets.map((facet) => {
            if (Array.isArray(children))
                return children;
            return [children(facet)].flat(1);
        });
        return index.flatMap((i) => {
            const [left, top, width, height] = bboxs[i];
            const facet = facets[i];
            const facetData = facetData2d[i];
            const children = normalizedChildren[i];
            return children.map((_a) => {
                var _b, _c;
                var { scale, key, facet: isFacet = true, axis = {}, legend = {} } = _a, rest = __rest(_a, ["scale", "key", "facet", "axis", "legend"]);
                const guideY = ((_b = scale === null || scale === void 0 ? void 0 : scale.y) === null || _b === void 0 ? void 0 : _b.guide) || axis.y;
                const guideX = ((_c = scale === null || scale === void 0 ? void 0 : scale.x) === null || _c === void 0 ? void 0 : _c.guide) || axis.x;
                const defaultScale = {
                    x: { tickCount: encodeX ? 5 : undefined },
                    y: { tickCount: encodeY ? 5 : undefined },
                };
                const newData = isFacet
                    ? facetData
                    : facetData.length === 0
                        ? []
                        : data;
                const newScale = {
                    color: { domain: facetDomainColor },
                };
                const newAxis = {
                    x: createGuide(guideX, createGuideX)(facet, newData),
                    y: createGuide(guideY, createGuideY)(facet, newData),
                };
                return Object.assign(Object.assign({ key: `${key}-${i}`, data: newData, margin: 0, x: left + paddingLeft + originX + marginLeft, y: top + paddingTop + originY + marginTop, parentKey: viewKey, width,
                    height, paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0, frame: newData.length ? true : false, dataDomain: maxDataDomain, scale: (0, util_1.deepMix)(defaultScale, scale, newScale), axis: (0, util_1.deepMix)({}, axis, newAxis), 
                    // Hide all legends for child mark by default,
                    // they are displayed in the top-level.
                    legend: false }, rest), childOptions);
            });
        });
    };
    return {
        children: createChildren,
    };
});
function subLayoutRect(data) {
    const { points } = data;
    return (0, vector_1.calcBBox)(points);
}
/**
 * Inner guide not show title, tickLine, label and subTickLine,
 * if data is empty, do not show guide.
 */
function createInnerGuide(guide, data) {
    return data.length
        ? (0, util_1.deepMix)({
            title: false,
            tick: null,
            label: null,
        }, guide)
        : (0, util_1.deepMix)({
            title: false,
            tick: null,
            label: null,
            grid: null,
        }, guide);
}
exports.createInnerGuide = createInnerGuide;
function createGuideXRect(guide) {
    return (facet, data) => {
        const { rowIndex, rowValuesLength, columnIndex, columnValuesLength } = facet;
        // Only the bottom-most facet show axisX.
        if (rowIndex !== rowValuesLength - 1)
            return createInnerGuide(guide, data);
        // Only the bottom-left facet show title.
        const title = columnIndex !== columnValuesLength - 1 ? false : undefined;
        // If data is empty, do not show cell.
        const grid = data.length ? undefined : null;
        return (0, util_1.deepMix)({ title, grid }, guide);
    };
}
function createGuideYRect(guide) {
    return (facet, data) => {
        const { rowIndex, columnIndex } = facet;
        // Only the left-most facet show axisY.
        if (columnIndex !== 0)
            return createInnerGuide(guide, data);
        // Only the left-top facet show title.
        const title = rowIndex !== 0 ? false : undefined;
        // If data is empty, do not show cell.
        const grid = data.length ? undefined : null;
        return (0, util_1.deepMix)({ title, grid }, guide);
    };
}
function createGuide(guide, factory) {
    if (typeof guide === 'function')
        return guide;
    if (guide === null || guide === false)
        return () => null;
    return factory(guide);
}
const FacetRect = () => {
    return (options) => {
        const newOptions = container_1.Container.of(options)
            .call(exports.toCell)
            .call(exports.inferColor)
            .call(exports.setAnimation)
            .call(setScale)
            .call(exports.setStyle)
            .call(exports.setData)
            .call(exports.setChildren)
            .value();
        return [newOptions];
    };
};
exports.FacetRect = FacetRect;
exports.FacetRect.props = {};
//# sourceMappingURL=facetRect.js.map
}, function(modId) { var map = {"../utils/vector":1751263815873,"../utils/container":1751263816106,"../utils/array":1751263815830,"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816106, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Container = void 0;
class Container {
    constructor(x) {
        this.$value = x;
    }
    static of(x) {
        return new Container(x);
    }
    call(f, ...rest) {
        return (this.$value = f(this.$value, ...rest)), this;
    }
    value() {
        return this.$value;
    }
}
exports.Container = Container;
//# sourceMappingURL=container.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816107, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RepeatMatrix = void 0;
const util_1 = require("@antv/util");
const container_1 = require("../utils/container");
const vector_1 = require("../utils/vector");
const array_1 = require("../utils/array");
const facetRect_1 = require("./facetRect");
const utils_1 = require("./utils");
const setScale = (0, utils_1.useDefaultAdaptor)((options) => {
    return {
        scale: {
            x: { guide: null, paddingOuter: 0, paddingInner: 0.1 },
            y: { guide: null, range: [0, 1], paddingOuter: 0, paddingInner: 0.1 },
        },
    };
});
const setChildren = (0, utils_1.useOverrideAdaptor)((options) => {
    const { data, children, x: originX = 0, y: originY = 0, key: viewKey, } = options;
    const createChildren = (visualData, scale, layout) => {
        const { x: scaleX, y: scaleY } = scale;
        const { paddingLeft, paddingTop, marginLeft, marginTop } = layout;
        const { domain: domainX } = scaleX.getOptions();
        const { domain: domainY } = scaleY.getOptions();
        const index = (0, array_1.indexOf)(visualData);
        const bboxs = visualData.map(({ points }) => (0, vector_1.calcBBox)(points));
        const values = visualData.map(({ x, y }) => [
            scaleX.invert(x),
            scaleY.invert(y),
        ]);
        const facets = values.map(([fx, fy]) => ({
            columnField: fx,
            columnIndex: domainX.indexOf(fx),
            columnValue: fx,
            columnValuesLength: domainX.length,
            rowField: fy,
            rowIndex: domainY.indexOf(fy),
            rowValue: fy,
            rowValuesLength: domainY.length,
        }));
        const normalizedChildren = facets.map((facet) => {
            if (Array.isArray(children))
                return children;
            return [children(facet)].flat(1);
        });
        return index.flatMap((i) => {
            const [left, top, width, height] = bboxs[i];
            const [fx, fy] = values[i];
            const facet = facets[i];
            const children = normalizedChildren[i];
            return children.map((d) => {
                var _a, _b;
                const { scale, key, encode, axis, interaction } = d, rest = __rest(d, ["scale", "key", "encode", "axis", "interaction"]);
                const guideY = (_a = scale === null || scale === void 0 ? void 0 : scale.y) === null || _a === void 0 ? void 0 : _a.guide;
                const guideX = (_b = scale === null || scale === void 0 ? void 0 : scale.x) === null || _b === void 0 ? void 0 : _b.guide;
                const defaultScale = {
                    // Do not sync position scales among facets by default.
                    x: { facet: false },
                    // Do not sync position scales among facets by default.
                    y: { facet: false },
                };
                const newAxis = {
                    x: createGuideX(guideX)(facet, data),
                    y: createGuideY(guideY)(facet, data),
                };
                const defaultAxis = {
                    x: { tickCount: 5 },
                    y: { tickCount: 5 },
                };
                return Object.assign({ data, parentKey: viewKey, key: `${key}-${i}`, x: left + paddingLeft + originX + marginLeft, y: top + paddingTop + originY + marginTop, width,
                    height, margin: 0, paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0, frame: true, scale: (0, util_1.deepMix)(defaultScale, scale), axis: (0, util_1.deepMix)(defaultAxis, axis, newAxis), 
                    // Hide all legends for child mark by default,
                    // they are displayed in the top-level.
                    legend: false, encode: (0, util_1.deepMix)({}, encode, {
                        x: fx,
                        y: fy,
                    }), interaction: (0, util_1.deepMix)({}, interaction, {
                        // Register this interaction in parent node.
                        legendFilter: false,
                    }) }, rest);
            });
        });
    };
    return {
        children: createChildren,
    };
});
/**
 * @todo Use transform instead of override data directly.
 */
const setData = (0, utils_1.useOverrideAdaptor)((options) => {
    const { encode } = options, rest = __rest(options, ["encode"]);
    const { position: P = [], x: X = P, y: Y = [...P].reverse() } = encode, restEncode = __rest(encode, ["position", "x", "y"]);
    const data = [];
    for (const $x of [X].flat(1)) {
        for (const $y of [Y].flat(1)) {
            data.push({ $x, $y });
        }
    }
    return Object.assign(Object.assign({}, rest), { data, encode: Object.assign(Object.assign({}, restEncode), { x: '$x', y: '$y' }), scale: Object.assign(Object.assign({}, ([X].flat(1).length === 1 && { x: { paddingInner: 0 } })), ([Y].flat(1).length === 1 && { y: { paddingInner: 0 } })) });
});
function createGuideX(guideX) {
    if (typeof guideX === 'function')
        return guideX;
    if (guideX === null)
        return () => null;
    return (facet, data) => {
        const { rowIndex, rowValuesLength } = facet;
        // Only the bottom-most facet show axisX.
        if (rowIndex !== rowValuesLength - 1)
            return (0, facetRect_1.createInnerGuide)(guideX, data);
    };
}
function createGuideY(guideY) {
    if (typeof guideY === 'function')
        return guideY;
    if (guideY === null)
        return () => null;
    return (facet, data) => {
        const { columnIndex } = facet;
        // Only the left-most facet show axisY.
        if (columnIndex !== 0)
            return (0, facetRect_1.createInnerGuide)(guideY, data);
    };
}
/**
 * @todo Layout mode: layer, row, col...
 * @todo Specify show axis or not.
 */
const RepeatMatrix = () => {
    return (options) => {
        const newOptions = container_1.Container.of(options)
            .call(facetRect_1.toCell)
            .call(facetRect_1.inferColor)
            .call(setChildren)
            .call(setData)
            .call(facetRect_1.setAnimation)
            .call(facetRect_1.setStyle)
            .call(setScale)
            .value();
        return [newOptions];
    };
};
exports.RepeatMatrix = RepeatMatrix;
//# sourceMappingURL=repeatMatrix.js.map
}, function(modId) { var map = {"../utils/container":1751263816106,"../utils/vector":1751263815873,"../utils/array":1751263815830,"./facetRect":1751263816105,"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816108, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FacetCircle = void 0;
const container_1 = require("../utils/container");
const vector_1 = require("../utils/vector");
const facetRect_1 = require("./facetRect");
const utils_1 = require("./utils");
const setScale = (0, utils_1.useDefaultAdaptor)((options) => {
    return {
        scale: {
            x: { guide: { type: 'axisArc' }, paddingOuter: 0, paddingInner: 0.1 },
            y: { guide: null, range: [0, 1], paddingOuter: 0, paddingInner: 0.1 },
        },
    };
});
const setCoordinate = (0, utils_1.useDefaultAdaptor)((options) => {
    return {
        coordinate: { type: 'polar' },
    };
});
const setEncode = (options) => {
    const { encode } = options, rest = __rest(options, ["encode"]);
    const { position } = encode;
    return Object.assign(Object.assign({}, rest), { encode: { x: position } });
};
/**
 * Every facet should do not show both axisX and axisY by default.
 */
function createGuideFacetCircle(guide) {
    return (facet) => null;
}
/**
 * Use the inscribed circle of the sector as the
 * circumscribed circle of the new bbox.
 */
function subLayoutFacetCircle(data) {
    const { points } = data;
    const [p0, p1, p2, p3] = points;
    const sr = (0, vector_1.dist)(p0, p3); // radius of sector
    const v0 = (0, vector_1.sub)(p0, p3);
    const v1 = (0, vector_1.sub)(p1, p2);
    const a01 = (0, vector_1.angleBetween)(v0, v1);
    // sr = ir + ir / sin(theta/2)
    const t = 1 / Math.sin(a01 / 2);
    const ir = sr / (1 + t); // radius of inscribed circle
    const s = ir * Math.sqrt(2); // size of the bbox.
    // This assume the innerRadius of polar is 0.
    // @todo Compute the right origin if it's not 0,
    // or maybe pass the coordinates to get the right center.
    const [x0, y0] = p2;
    const a0 = (0, vector_1.angleWithQuadrant)(v0);
    const a3 = a0 + a01 / 2;
    const d = ir * t;
    const cx = x0 + d * Math.sin(a3); // center x of inscribed circle
    const cy = y0 - d * Math.cos(a3); // center y of inscribed circle
    return [cx - s / 2, cy - s / 2, s, s];
}
/**
 * @todo Pack.
 */
const FacetCircle = () => {
    return (options) => {
        const newOptions = container_1.Container.of(options)
            .call(facetRect_1.toCell)
            .call(setEncode)
            .call(facetRect_1.inferColor)
            .call(setCoordinate)
            .call(facetRect_1.setData)
            .call(facetRect_1.setChildren, subLayoutFacetCircle, createGuideFacetCircle, createGuideFacetCircle, { frame: false })
            .call(facetRect_1.setAnimation)
            .call(facetRect_1.setStyle)
            .call(setScale)
            .value();
        return [newOptions];
    };
};
exports.FacetCircle = FacetCircle;
//# sourceMappingURL=facetCircle.js.map
}, function(modId) { var map = {"../utils/container":1751263816106,"../utils/vector":1751263815873,"./facetRect":1751263816105,"./utils":1751263816101}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816109, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.TimingKeyframe = void 0;
const util_1 = require("@antv/util");
function range(direction, iterationCount, keyframeCount) {
    const start = 0;
    const end = keyframeCount;
    const normal = [start, end];
    const reverse = [-end + 1, -start + 1];
    if (direction === 'normal')
        return normal;
    if (direction === 'reverse')
        return reverse;
    if (direction === 'alternate') {
        return iterationCount % 2 === 0 ? normal : reverse;
    }
    if (direction === 'reverse-alternate') {
        return iterationCount % 2 === 0 ? reverse : normal;
    }
}
/**
 * Set animation options for all descendants.
 */
function setAnimation(node, duration, easing) {
    const discovered = [node];
    while (discovered.length) {
        const n = discovered.pop();
        n.animate = (0, util_1.deepMix)({
            enter: {
                duration,
            },
            update: {
                duration,
                easing,
                type: 'morphing',
                fill: 'both',
            },
            exit: {
                type: 'fadeOut',
                duration,
            },
        }, n.animate || {});
        const { children } = n;
        if (Array.isArray(children))
            discovered.push(...children);
    }
    return node;
}
/**
 * @todo More options, such as fill, totalDuration...
 */
const TimingKeyframe = () => {
    return (options) => {
        const { children = [], duration = 1000, iterationCount = 1, direction = 'normal', easing = 'ease-in-out-sine', } = options;
        const n = children.length;
        if (!Array.isArray(children) || n === 0)
            return [];
        const { key } = children[0];
        const newChildren = children
            .map((d) => (Object.assign(Object.assign({}, d), { key })))
            .map((d) => setAnimation(d, duration, easing));
        return function* () {
            let count = 0;
            let prevIndex;
            while (iterationCount === 'infinite' || count < iterationCount) {
                const [start, end] = range(direction, count, n);
                for (let i = start; i < end; i += 1) {
                    // For reverse direction, the range is from negative to negative
                    // so the absolute value of i is the real index for newChildren.
                    const index = Math.abs(i);
                    // This is for preventing alternate or reverse-alternate keyframe
                    // to yield two same node one by one when the direction change.
                    if (prevIndex !== index)
                        yield newChildren[index];
                    prevIndex = index;
                }
                count++;
            }
        };
    };
};
exports.TimingKeyframe = TimingKeyframe;
exports.TimingKeyframe.props = {};
//# sourceMappingURL=timingKeyframe.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816110, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeoPath = void 0;
/**
 * Wrap GeoPath by a GeoView.
 */
const GeoPath = () => {
    return (options) => {
        const { type, data, scale, encode, style, animate, key, state } = options, rest = __rest(options, ["type", "data", "scale", "encode", "style", "animate", "key", "state"]);
        return [
            Object.assign(Object.assign({ type: 'geoView' }, rest), { children: [
                    {
                        type: 'geoPath',
                        key: `${key}-0`,
                        data: {
                            value: data,
                        },
                        scale,
                        encode,
                        style,
                        animate,
                        state,
                    },
                ] }),
        ];
    };
};
exports.GeoPath = GeoPath;
exports.GeoPath.props = {};
//# sourceMappingURL=geoPath.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816111, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__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;
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeoView = void 0;
const scale_1 = require("@antv/scale");
const util_1 = require("@antv/util");
const d3_geo_1 = require("@antv/vendor/d3-geo");
const mark_1 = require("../utils/mark");
const d3Projection = __importStar(require("./d3Projection"));
/**
 * Get projection factory from d3-projection.
 */
function normalizeProjection(type) {
    if (typeof type === 'function')
        return type;
    const name = `geo${(0, util_1.upperFirst)(type)}`;
    const projection = d3Projection[name];
    if (!projection)
        throw new Error(`Unknown coordinate: ${type}`);
    return projection;
}
/**
 * @see https://github.com/mapbox/geojson-merge/blob/master/index.js
 */
function mergeGeoJSON(gjs) {
    return {
        type: 'FeatureCollection',
        features: gjs.flatMap((gj) => normalizeGeoJSON(gj).features),
    };
}
function normalizeGeoJSON(gj) {
    const types = {
        Point: 'geometry',
        MultiPoint: 'geometry',
        LineString: 'geometry',
        MultiLineString: 'geometry',
        Polygon: 'geometry',
        MultiPolygon: 'geometry',
        GeometryCollection: 'geometry',
        Feature: 'feature',
        FeatureCollection: 'featureCollection',
    };
    if (!gj || !gj.type)
        return null;
    const type = types[gj.type];
    if (!type)
        return null;
    if (type === 'geometry') {
        return {
            type: 'FeatureCollection',
            features: [
                {
                    type: 'Feature',
                    properties: {},
                    geometry: gj,
                },
            ],
        };
    }
    else if (type === 'feature') {
        return {
            type: 'FeatureCollection',
            features: [gj],
        };
    }
    else if (type === 'featureCollection') {
        return gj;
    }
}
/**
 * Specify the options for d3 projection
 * @see https://github.com/d3/d3-geo#projections
 * @todo Specify key each by each.
 */
function setProjectionOptions(projection, options) {
    var _a;
    for (const [key, value] of Object.entries(options)) {
        (_a = projection[key]) === null || _a === void 0 ? void 0 : _a.call(projection, value);
    }
}
function setProjectionSize(projection, nodes, layout, options) {
    const defaultOutline = () => {
        const geoNodes = nodes.filter(isGeoPath);
        // For geoPath with sphere mark, use it as outline.
        const sphere = geoNodes.find((d) => d.sphere);
        if (sphere)
            return { type: 'Sphere' };
        // Merge all GeoJSON as the outline.
        return mergeGeoJSON(geoNodes.filter((d) => !d.sphere).flatMap((d) => d.data.value));
    };
    const { outline = defaultOutline() } = options;
    const { size = 'fitExtent' } = options;
    if (size === 'fitExtent') {
        return setFitExtent(projection, outline, layout);
    }
    else if (size === 'fitWidth') {
        return setFitWidth(projection, outline, layout);
    }
}
function setFitExtent(projection, object, layout) {
    const { x, y, width, height } = layout;
    projection.fitExtent([
        [x, y],
        [width, height],
    ], object);
}
function setFitWidth(projection, object, layout) {
    const { width, height } = layout;
    const [[x0, y0], [x1, y1]] = (0, d3_geo_1.geoPath)(projection.fitWidth(width, object)).bounds(object);
    const dy = Math.ceil(y1 - y0);
    const l = Math.min(Math.ceil(x1 - x0), dy);
    const s = (projection.scale() * (l - 1)) / l;
    const [tx, ty] = projection.translate();
    const t = ty + (height - dy) / 2;
    projection.scale(s).translate([tx, t]).precision(0.2);
}
/**
 * @todo Remove this.
 */
function normalizeDataSource(node) {
    const { data } = node;
    if (Array.isArray(data))
        return Object.assign(Object.assign({}, node), { data: { value: data } });
    const { type } = data;
    if (type === 'graticule10') {
        return Object.assign(Object.assign({}, node), { data: { value: [(0, d3_geo_1.geoGraticule10)()] } });
    }
    else if (type === 'sphere') {
        // Sphere is not a standard type of GeoJSON.
        // Mark this geoPath as sphere geoPath.
        return Object.assign(Object.assign({}, node), { sphere: true, data: { value: [{ type: 'Sphere' }] } });
    }
    return node;
}
function isGeoPath(d) {
    return d.type === 'geoPath';
}
/**
 * A view with geo coordinate.
 */
const GeoView = () => {
    return (options) => {
        const { children, coordinate: projection = {} } = options;
        if (!Array.isArray(children))
            return [];
        // Get projection factory.
        const { type = 'equalEarth' } = projection, projectionOptions = __rest(projection, ["type"]);
        const createProjection = normalizeProjection(type);
        const nodes = children.map(normalizeDataSource);
        // Set path generator lazily.
        let path;
        // A custom geo coordinate.
        function Geo() {
            return [
                [
                    'custom',
                    (x, y, width, height) => {
                        // Create and set projection.
                        const visual = createProjection();
                        const layout = { x, y, width, height };
                        setProjectionSize(visual, nodes, layout, projectionOptions);
                        setProjectionOptions(visual, projectionOptions);
                        // Create path generator.
                        path = (0, d3_geo_1.geoPath)(visual);
                        // Normalize projection and projection.invert,
                        // which normalize projected points.
                        const scaleX = new scale_1.Linear({
                            domain: [x, x + width],
                        });
                        const scaleY = new scale_1.Linear({
                            domain: [y, y + height],
                        });
                        const normalize = (point) => {
                            const visualPoint = visual(point);
                            if (!visualPoint)
                                return [null, null];
                            const [vx, vy] = visualPoint;
                            return [scaleX.map(vx), scaleY.map(vy)];
                        };
                        const normalizeInvert = (point) => {
                            if (!point)
                                return null;
                            const [px, py] = point;
                            const visualPoint = [scaleX.invert(px), scaleY.invert(py)];
                            return visual.invert(visualPoint);
                        };
                        return {
                            transform: (point) => normalize(point),
                            untransform: (point) => normalizeInvert(point),
                        };
                    },
                ],
            ];
        }
        function GeoPath(options) {
            const { style, tooltip = {} } = options;
            return Object.assign(Object.assign({}, options), { type: 'path', tooltip: (0, mark_1.maybeTooltip)(tooltip, {
                    title: 'id',
                    items: [{ channel: 'color' }],
                }), style: Object.assign(Object.assign({}, style), { d: (d) => path(d) || [] }) });
        }
        const t = (d) => (isGeoPath(d) ? GeoPath(d) : d);
        return [
            Object.assign(Object.assign({}, options), { type: 'view', scale: {
                    x: { type: 'identity' },
                    y: { type: 'identity' },
                }, axis: false, coordinate: { type: Geo }, children: nodes.flatMap(t) }),
        ];
    };
};
exports.GeoView = GeoView;
exports.GeoView.props = {};
//# sourceMappingURL=geoView.js.map
}, function(modId) { var map = {"../utils/mark":1751263815997,"./d3Projection":1751263816112}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816112, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.geoTransverseMercatorRaw = exports.geoTransverseMercator = exports.geoStereographicRaw = exports.geoStereographic = exports.geoOrthographicRaw = exports.geoOrthographic = exports.geoNaturalEarth1Raw = exports.geoNaturalEarth1 = exports.geoMercatorRaw = exports.geoMercator = exports.geoProjectionMutator = exports.geoProjection = exports.geoIdentity = exports.geoGnomonicRaw = exports.geoGnomonic = exports.geoEquirectangularRaw = exports.geoEquirectangular = exports.geoEqualEarthRaw = exports.geoEqualEarth = exports.geoConicEquidistantRaw = exports.geoConicEquidistant = exports.geoConicEqualAreaRaw = exports.geoConicEqualArea = exports.geoConicConformalRaw = exports.geoConicConformal = exports.geoAzimuthalEquidistantRaw = exports.geoAzimuthalEquidistant = exports.geoAzimuthalEqualAreaRaw = exports.geoAzimuthalEqualArea = exports.geoAlbers = exports.geoAlbersUsa = void 0;
var d3_geo_1 = require("@antv/vendor/d3-geo");
Object.defineProperty(exports, "geoAlbersUsa", { enumerable: true, get: function () { return d3_geo_1.geoAlbersUsa; } });
Object.defineProperty(exports, "geoAlbers", { enumerable: true, get: function () { return d3_geo_1.geoAlbers; } });
Object.defineProperty(exports, "geoAzimuthalEqualArea", { enumerable: true, get: function () { return d3_geo_1.geoAzimuthalEqualArea; } });
Object.defineProperty(exports, "geoAzimuthalEqualAreaRaw", { enumerable: true, get: function () { return d3_geo_1.geoAzimuthalEqualAreaRaw; } });
Object.defineProperty(exports, "geoAzimuthalEquidistant", { enumerable: true, get: function () { return d3_geo_1.geoAzimuthalEquidistant; } });
Object.defineProperty(exports, "geoAzimuthalEquidistantRaw", { enumerable: true, get: function () { return d3_geo_1.geoAzimuthalEquidistantRaw; } });
Object.defineProperty(exports, "geoConicConformal", { enumerable: true, get: function () { return d3_geo_1.geoConicConformal; } });
Object.defineProperty(exports, "geoConicConformalRaw", { enumerable: true, get: function () { return d3_geo_1.geoConicConformalRaw; } });
Object.defineProperty(exports, "geoConicEqualArea", { enumerable: true, get: function () { return d3_geo_1.geoConicEqualArea; } });
Object.defineProperty(exports, "geoConicEqualAreaRaw", { enumerable: true, get: function () { return d3_geo_1.geoConicEqualAreaRaw; } });
Object.defineProperty(exports, "geoConicEquidistant", { enumerable: true, get: function () { return d3_geo_1.geoConicEquidistant; } });
Object.defineProperty(exports, "geoConicEquidistantRaw", { enumerable: true, get: function () { return d3_geo_1.geoConicEquidistantRaw; } });
Object.defineProperty(exports, "geoEqualEarth", { enumerable: true, get: function () { return d3_geo_1.geoEqualEarth; } });
Object.defineProperty(exports, "geoEqualEarthRaw", { enumerable: true, get: function () { return d3_geo_1.geoEqualEarthRaw; } });
Object.defineProperty(exports, "geoEquirectangular", { enumerable: true, get: function () { return d3_geo_1.geoEquirectangular; } });
Object.defineProperty(exports, "geoEquirectangularRaw", { enumerable: true, get: function () { return d3_geo_1.geoEquirectangularRaw; } });
Object.defineProperty(exports, "geoGnomonic", { enumerable: true, get: function () { return d3_geo_1.geoGnomonic; } });
Object.defineProperty(exports, "geoGnomonicRaw", { enumerable: true, get: function () { return d3_geo_1.geoGnomonicRaw; } });
Object.defineProperty(exports, "geoIdentity", { enumerable: true, get: function () { return d3_geo_1.geoIdentity; } });
Object.defineProperty(exports, "geoProjection", { enumerable: true, get: function () { return d3_geo_1.geoProjection; } });
Object.defineProperty(exports, "geoProjectionMutator", { enumerable: true, get: function () { return d3_geo_1.geoProjectionMutator; } });
Object.defineProperty(exports, "geoMercator", { enumerable: true, get: function () { return d3_geo_1.geoMercator; } });
Object.defineProperty(exports, "geoMercatorRaw", { enumerable: true, get: function () { return d3_geo_1.geoMercatorRaw; } });
Object.defineProperty(exports, "geoNaturalEarth1", { enumerable: true, get: function () { return d3_geo_1.geoNaturalEarth1; } });
Object.defineProperty(exports, "geoNaturalEarth1Raw", { enumerable: true, get: function () { return d3_geo_1.geoNaturalEarth1Raw; } });
Object.defineProperty(exports, "geoOrthographic", { enumerable: true, get: function () { return d3_geo_1.geoOrthographic; } });
Object.defineProperty(exports, "geoOrthographicRaw", { enumerable: true, get: function () { return d3_geo_1.geoOrthographicRaw; } });
Object.defineProperty(exports, "geoStereographic", { enumerable: true, get: function () { return d3_geo_1.geoStereographic; } });
Object.defineProperty(exports, "geoStereographicRaw", { enumerable: true, get: function () { return d3_geo_1.geoStereographicRaw; } });
Object.defineProperty(exports, "geoTransverseMercator", { enumerable: true, get: function () { return d3_geo_1.geoTransverseMercator; } });
Object.defineProperty(exports, "geoTransverseMercatorRaw", { enumerable: true, get: function () { return d3_geo_1.geoTransverseMercatorRaw; } });
//# sourceMappingURL=d3Projection.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816113, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Event = void 0;
const event_1 = require("../utils/event");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
// For extended component
function maybeComponentRoot(node) {
    return (0, utils_1.maybeRoot)(node, (node) => node.className === 'component');
}
// For extended shape.
function maybeElementRoot(node) {
    return (0, utils_1.maybeRoot)(node, (node) => node.className === 'element');
}
// For extended label.
function maybeLabelRoot(node) {
    return (0, utils_1.maybeRoot)(node, (node) => node.className === 'label');
}
function bubblesEvent(eventType, view, emitter, predicate = (event) => true) {
    return (e) => {
        if (!predicate(e))
            return;
        // Emit plot events.
        emitter.emit(`plot:${eventType}`, e);
        const { target } = e;
        // There is no target for pointerupoutside event if out of canvas.
        if (!target)
            return;
        const { className } = target;
        // If target area is plot area, do not emit extra events.
        if (className === 'plot')
            return;
        // If target is element or child of element.
        const elementRoot = maybeElementRoot(target);
        // If target is component or child of component.
        const componentRoot = maybeComponentRoot(target);
        //  If target is babel or child of babel.
        const babelRoot = maybeLabelRoot(target);
        const root = elementRoot || componentRoot || babelRoot;
        if (!root)
            return;
        const { className: elementType, markType } = root;
        const e1 = Object.assign(Object.assign({}, e), { nativeEvent: true });
        if (elementType === 'element') {
            e1['data'] = { data: (0, helper_1.dataOf)(root, view) };
            emitter.emit(`element:${eventType}`, e1);
            emitter.emit(`${markType}:${eventType}`, e1);
        }
        else if (elementType === 'label') {
            //label children [Text2, Rect2, Path2],
            e1['data'] = { data: root.attributes.datum };
            emitter.emit(`label:${eventType}`, e1);
            emitter.emit(`${className}:${eventType}`, e1);
        }
        else {
            emitter.emit(`component:${eventType}`, e1);
            emitter.emit(`${className}:${eventType}`, e1);
        }
    };
}
// @todo Provide more info for event.dataset.
function Event() {
    return (context, _, emitter) => {
        const { container, view } = context;
        // Click events.
        const click = bubblesEvent(event_1.ChartEvent.CLICK, view, emitter, (e) => e.detail === 1);
        const dblclick = bubblesEvent(event_1.ChartEvent.DBLCLICK, view, emitter, (e) => e.detail === 2);
        // Pointer events.
        const pointertap = bubblesEvent(event_1.ChartEvent.POINTER_TAP, view, emitter);
        const pointerdown = bubblesEvent(event_1.ChartEvent.POINTER_DOWN, view, emitter);
        const pointerup = bubblesEvent(event_1.ChartEvent.POINTER_UP, view, emitter);
        const pointerover = bubblesEvent(event_1.ChartEvent.POINTER_OVER, view, emitter);
        const pointerout = bubblesEvent(event_1.ChartEvent.POINTER_OUT, view, emitter);
        const pointermove = bubblesEvent(event_1.ChartEvent.POINTER_MOVE, view, emitter);
        const pointerenter = bubblesEvent(event_1.ChartEvent.POINTER_ENTER, view, emitter);
        const pointerleave = bubblesEvent(event_1.ChartEvent.POINTER_LEAVE, view, emitter);
        const pointerupoutside = bubblesEvent(event_1.ChartEvent.POINTER_UPOUTSIDE, view, emitter);
        // Drag and drop events.
        const dragstart = bubblesEvent(event_1.ChartEvent.DRAG_START, view, emitter);
        const drag = bubblesEvent(event_1.ChartEvent.DRAG, view, emitter);
        const dragend = bubblesEvent(event_1.ChartEvent.DRAG_END, view, emitter);
        const dragenter = bubblesEvent(event_1.ChartEvent.DRAG_ENTER, view, emitter);
        const dragleave = bubblesEvent(event_1.ChartEvent.DRAG_LEAVE, view, emitter);
        const dragover = bubblesEvent(event_1.ChartEvent.DRAG_OVER, view, emitter);
        const drop = bubblesEvent(event_1.ChartEvent.DROP, view, emitter);
        // For legacy usage.
        container.addEventListener('click', click);
        container.addEventListener('click', dblclick);
        // Recommend events.
        container.addEventListener('pointertap', pointertap);
        container.addEventListener('pointerdown', pointerdown);
        container.addEventListener('pointerup', pointerup);
        container.addEventListener('pointerover', pointerover);
        container.addEventListener('pointerout', pointerout);
        container.addEventListener('pointermove', pointermove);
        container.addEventListener('pointerenter', pointerenter);
        container.addEventListener('pointerleave', pointerleave);
        container.addEventListener('pointerupoutside', pointerupoutside);
        // Plugin events.
        container.addEventListener('dragstart', dragstart);
        container.addEventListener('drag', drag);
        container.addEventListener('dragend', dragend);
        container.addEventListener('dragenter', dragenter);
        container.addEventListener('dragleave', dragleave);
        container.addEventListener('dragover', dragover);
        container.addEventListener('drop', drop);
        return () => {
            container.removeEventListener('click', click);
            container.removeEventListener('click', dblclick);
            container.removeEventListener('pointertap', pointertap);
            container.removeEventListener('pointerdown', pointerdown);
            container.removeEventListener('pointerup', pointerup);
            container.removeEventListener('pointerover', pointerover);
            container.removeEventListener('pointerout', pointerout);
            container.removeEventListener('pointermove', pointermove);
            container.removeEventListener('pointerenter', pointerenter);
            container.removeEventListener('pointerleave', pointerleave);
            container.removeEventListener('pointerupoutside', pointerupoutside);
            container.removeEventListener('dragstart', dragstart);
            container.removeEventListener('drag', drag);
            container.removeEventListener('dragend', dragend);
            container.removeEventListener('dragenter', dragenter);
            container.removeEventListener('dragleave', dragleave);
            container.removeEventListener('dragover', dragover);
            container.removeEventListener('drop', drop);
        };
    };
}
exports.Event = Event;
Event.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=event.js.map
}, function(modId) { var map = {"../utils/event":1751263816091,"../utils/helper":1751263815829,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816114, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isValidScale = exports.isPosition = exports.syncFacetsScales = exports.useRelationScale = exports.assignScale = exports.useRelation = exports.collectScales = exports.groupTransform = exports.applyScale = exports.inferScale = void 0;
const scale_1 = require("@antv/scale");
const d3_array_1 = require("@antv/vendor/d3-array");
const d3ScaleChromatic = __importStar(require("@antv/vendor/d3-scale-chromatic"));
const util_1 = require("@antv/util");
const array_1 = require("../utils/array");
const helper_1 = require("../utils/helper");
const coordinate_1 = require("./coordinate");
const library_1 = require("./library");
function inferScale(name, values, options, coordinates, theme, library) {
    const { guide = {} } = options;
    const type = inferScaleType(name, values, options);
    if (typeof type !== 'string')
        return options;
    const expectedDomain = inferScaleDomain(type, name, values, options);
    const actualDomain = maybeRatio(type, expectedDomain, options);
    return Object.assign(Object.assign(Object.assign({}, options), inferScaleOptions(type, name, values, options, coordinates)), { domain: actualDomain, range: inferScaleRange(type, name, values, options, actualDomain, theme, library), expectedDomain,
        guide,
        name,
        type });
}
exports.inferScale = inferScale;
function applyScale(channels, scale) {
    const scaledValue = {};
    for (const channel of channels) {
        const { values, name: scaleName } = channel;
        const scaleInstance = scale[scaleName];
        for (const value of values) {
            const { name, value: V } = value;
            scaledValue[name] = V.map((d) => scaleInstance.map(d));
        }
    }
    return scaledValue;
}
exports.applyScale = applyScale;
function groupTransform(markState, uidScale) {
    const channels = Array.from(markState.values()).flatMap((d) => d.channels);
    const scaleGroups = (0, d3_array_1.rollups)(channels, (channels) => channels.map((d) => uidScale.get(d.scale.uid)), (d) => d.name)
        .filter(([, scales]) => scales.some((d) => typeof d.getOptions().groupTransform === 'function') && // only sync scales with groupTransform options
        scales.every((d) => d.getTicks))
        .map((d) => d[1]);
    scaleGroups.forEach((group) => {
        const groupTransform = group.map((d) => d.getOptions().groupTransform)[0];
        groupTransform(group);
    });
}
exports.groupTransform = groupTransform;
function collectScales(states, options) {
    var _a;
    const { components = [] } = options;
    const NONE_STATIC_KEYS = [
        'scale',
        'encode',
        'axis',
        'legend',
        'data',
        'transform',
    ];
    // From normal marks.
    const scales = Array.from(new Set(states.flatMap((d) => d.channels.map((d) => d.scale))));
    // From static marks.
    const nameScale = new Map(scales.map((scale) => [scale.name, scale]));
    for (const component of components) {
        const channels = inferChannelsForComponent(component);
        for (const channel of channels) {
            const scale = nameScale.get(channel);
            const staticScale = ((_a = component.scale) === null || _a === void 0 ? void 0 : _a[channel]) || {};
            const { independent = false } = staticScale;
            if (scale && !independent) {
                // Merged with exist scales if is not independent.
                const { guide } = scale;
                const guide1 = typeof guide === 'boolean' ? {} : guide;
                scale.guide = (0, util_1.deepMix)({}, guide1, component);
                Object.assign(scale, staticScale);
            }
            else {
                // Append new scales without exit scales or independent.
                const options1 = Object.assign(Object.assign({}, staticScale), { expectedDomain: staticScale.domain, name: channel, guide: (0, util_1.omit)(component, NONE_STATIC_KEYS) });
                scales.push(options1);
            }
        }
    }
    return scales;
}
exports.collectScales = collectScales;
function useRelation(relations) {
    if (!relations || !Array.isArray(relations))
        return [helper_1.identity, helper_1.identity];
    // Store original map and invert.
    let map;
    let invert;
    const conditionalize = (scale) => {
        var _a;
        map = scale.map.bind(scale);
        invert = (_a = scale.invert) === null || _a === void 0 ? void 0 : _a.bind(scale);
        // Distinguish functions[function, output] and value[vale, output] relations.
        const funcRelations = relations.filter(([v]) => typeof v === 'function');
        const valueRelations = relations.filter(([v]) => typeof v !== 'function');
        // Update scale.map
        const valueOutput = new Map(valueRelations);
        scale.map = (x) => {
            for (const [verify, value] of funcRelations) {
                if (verify(x))
                    return value;
            }
            if (valueOutput.has(x))
                return valueOutput.get(x);
            return map(x);
        };
        if (!invert)
            return scale;
        // Update scale.invert
        const outputValue = new Map(valueRelations.map(([a, b]) => [b, a]));
        const outputFunc = new Map(funcRelations.map(([a, b]) => [b, a]));
        scale.invert = (x) => {
            if (outputFunc.has(x))
                return x;
            if (outputValue.has(x))
                return outputValue.get(x);
            return invert(x);
        };
        return scale;
    };
    const deconditionalize = (scale) => {
        if (map !== null)
            scale.map = map;
        if (invert !== null)
            scale.invert = invert;
        return scale;
    };
    return [conditionalize, deconditionalize];
}
exports.useRelation = useRelation;
function assignScale(target, source) {
    const keys = Object.keys(target);
    for (const scale of Object.values(source)) {
        const { name } = scale.getOptions();
        if (!(name in target))
            target[name] = scale;
        else {
            const I = keys
                .filter((d) => d.startsWith(name))
                // Reg is for extract `1` from `x1`;
                .map((d) => +(d.replace(name, '') || 0));
            const index = (0, d3_array_1.max)(I) + 1;
            const newKey = `${name}${index}`;
            target[newKey] = scale;
            scale.getOptions().key = newKey;
        }
    }
    return target;
}
exports.assignScale = assignScale;
function useRelationScale(options, library) {
    const [useScale] = (0, library_1.useLibrary)('scale', library);
    const { relations } = options;
    const [conditionalize] = useRelation(relations);
    const scale = useScale(options);
    return conditionalize(scale);
}
exports.useRelationScale = useRelationScale;
function syncFacetsScales(states) {
    const scales = states
        .flatMap((d) => Array.from(d.values()))
        .flatMap((d) => d.channels.map((d) => d.scale));
    syncFacetsScaleByChannel(scales, 'x');
    syncFacetsScaleByChannel(scales, 'y');
}
exports.syncFacetsScales = syncFacetsScales;
function inferChannelsForComponent(component) {
    const { channels = [], type, scale = {} } = component;
    const L = ['shape', 'color', 'opacity', 'size'];
    if (channels.length !== 0)
        return channels;
    if (type === 'axisX')
        return ['x'];
    if (type === 'axisY')
        return ['y'];
    if (type === 'legends')
        return Object.keys(scale).filter((d) => L.includes(d));
    return [];
}
function syncFacetsScaleByChannel(scales, channel) {
    const S = scales.filter(({ name, facet = true }) => facet && name === channel);
    const D = S.flatMap((d) => d.domain);
    const syncedD = S.every(isQuantitativeScale)
        ? (0, d3_array_1.extent)(D)
        : S.every(isDiscreteScale)
            ? Array.from(new Set(D))
            : null;
    if (syncedD === null)
        return;
    for (const scale of S) {
        scale.domain = syncedD;
    }
}
function maybeRatio(type, domain, options) {
    const { ratio } = options;
    if (ratio === undefined || ratio === null)
        return domain;
    if (isQuantitativeScale({ type })) {
        return clampQuantitativeScale(domain, ratio, type);
    }
    if (isDiscreteScale({ type }))
        return clampDiscreteScale(domain, ratio);
    return domain;
}
function clampQuantitativeScale(domain, ratio, type) {
    const D = domain.map(Number);
    const scale = new scale_1.Linear({
        domain: D,
        range: [D[0], D[0] + (D[D.length - 1] - D[0]) * ratio],
    });
    if (type === 'time')
        return domain.map((d) => new Date(scale.map(d)));
    return domain.map((d) => scale.map(d));
}
function clampDiscreteScale(domain, ratio) {
    const index = Math.round(domain.length * ratio);
    return domain.slice(0, index);
}
function isQuantitativeScale(scale) {
    const { type } = scale;
    if (typeof type !== 'string')
        return false;
    // Do not take quantize, quantile or threshold scale into account,
    // because they are not for position scales. If they are, there is
    // no need to sync them.
    const names = ['linear', 'log', 'pow', 'time'];
    return names.includes(type);
}
function isDiscreteScale(scale) {
    const { type } = scale;
    if (typeof type !== 'string')
        return false;
    const names = ['band', 'point', 'ordinal'];
    return names.includes(type);
}
// @todo More accurate inference for different cases.
function inferScaleType(name, values, options) {
    const { type, domain, range, quantitative, ordinal } = options;
    if (type !== undefined)
        return type;
    if (isObject(values))
        return 'identity';
    if (typeof range === 'string')
        return 'linear';
    if ((domain || range || []).length > 2)
        return asOrdinalType(name, ordinal);
    if (domain !== undefined) {
        if (isOrdinal([domain]))
            return asOrdinalType(name, ordinal);
        if (isTemporal(values))
            return 'time';
        return asQuantitativeType(name, range, quantitative);
    }
    if (isOrdinal(values))
        return asOrdinalType(name, ordinal);
    if (isTemporal(values))
        return 'time';
    return asQuantitativeType(name, range, quantitative);
}
function inferScaleDomain(type, name, values, options) {
    const { domain } = options;
    if (domain !== undefined)
        return domain;
    switch (type) {
        case 'linear':
        case 'time':
        case 'log':
        case 'pow':
        case 'sqrt':
        case 'quantize':
        case 'threshold':
            return maybeMinMax(inferDomainQ(values, options), options);
        case 'band':
        case 'ordinal':
        case 'point':
            return inferDomainC(values);
        case 'quantile':
            return inferDomainO(values);
        case 'sequential':
            return maybeMinMax(inferDomainS(values), options);
        default:
            return [];
    }
}
function inferScaleRange(type, name, values, options, domain, theme, library) {
    const { range } = options;
    if (typeof range === 'string')
        return gradientColors(range);
    if (range !== undefined)
        return range;
    const { rangeMin, rangeMax } = options;
    switch (type) {
        case 'linear':
        case 'time':
        case 'log':
        case 'pow':
        case 'sqrt': {
            const colors = categoricalColors(values, options, domain, theme, library);
            const [r0, r1] = inferRangeQ(name, colors);
            return [rangeMin !== null && rangeMin !== void 0 ? rangeMin : r0, rangeMax !== null && rangeMax !== void 0 ? rangeMax : r1];
        }
        case 'band':
        case 'point': {
            const min = name === 'size' ? 5 : 0;
            const max = name === 'size' ? 10 : 1;
            return [rangeMin !== null && rangeMin !== void 0 ? rangeMin : min, rangeMax !== null && rangeMax !== void 0 ? rangeMax : max];
        }
        case 'ordinal': {
            return categoricalColors(values, options, domain, theme, library);
        }
        case 'sequential':
            return undefined;
        case 'constant':
            return [values[0][0]];
        default:
            return [];
    }
}
function inferScaleOptions(type, name, values, options, coordinates) {
    switch (type) {
        case 'linear':
        case 'time':
        case 'log':
        case 'pow':
        case 'sqrt':
            return inferOptionsQ(coordinates, options);
        case 'band':
        case 'point':
            return inferOptionsC(type, name, coordinates, options);
        case 'sequential':
            return inferOptionsS(options);
        default:
            return options;
    }
}
function categoricalColors(values, options, domain, theme, library) {
    const [usePalette] = (0, library_1.useLibrary)('palette', library);
    const { category10: c10, category20: c20 } = theme;
    const defaultPalette = (0, array_1.unique)(domain).length <= c10.length ? c10 : c20;
    const { palette = defaultPalette, offset } = options;
    if (Array.isArray(palette))
        return palette;
    // Built-in palettes have higher priority.
    try {
        return usePalette({ type: palette });
    }
    catch (e) {
        const colors = interpolatedColors(palette, domain, offset);
        if (colors)
            return colors;
        throw new Error(`Unknown Component: ${palette} `);
    }
}
function gradientColors(range) {
    return range.split('-');
}
function interpolatedColors(palette, domain, offset = (d) => d) {
    if (!palette)
        return null;
    const fullName = (0, util_1.upperFirst)(palette);
    // If scheme have enough colors, then return pre-defined colors.
    const scheme = d3ScaleChromatic[`scheme${fullName}`];
    const interpolator = d3ScaleChromatic[`interpolate${fullName}`];
    if (!scheme && !interpolator)
        return null;
    if (scheme) {
        // If is a one dimension array, return it.
        if (!scheme.some(Array.isArray))
            return scheme;
        const schemeColors = scheme[domain.length];
        if (schemeColors)
            return schemeColors;
    }
    // Otherwise interpolate to get full colors.
    return domain.map((_, i) => interpolator(offset(i / domain.length)));
}
function inferOptionsS(options) {
    const { palette = 'ylGnBu', offset } = options;
    const name = (0, util_1.upperFirst)(palette);
    const interpolator = d3ScaleChromatic[`interpolate${name}`];
    if (!interpolator)
        throw new Error(`Unknown palette: ${name}`);
    return {
        interpolator: offset ? (x) => interpolator(offset(x)) : interpolator,
    };
}
function inferOptionsQ(coordinates, options) {
    const { interpolate = scale_1.createInterpolateValue, nice = false, tickCount = 5, } = options;
    return Object.assign(Object.assign({}, options), { interpolate, nice, tickCount });
}
function inferOptionsC(type, name, coordinates, options) {
    if (options.padding !== undefined ||
        options.paddingInner !== undefined ||
        options.paddingOuter !== undefined) {
        return Object.assign(Object.assign({}, options), { unknown: NaN });
    }
    const padding = inferPadding(type, name, coordinates);
    const { paddingInner = padding, paddingOuter = padding } = options;
    return Object.assign(Object.assign({}, options), { paddingInner,
        paddingOuter,
        padding, unknown: NaN });
}
function inferPadding(type, name, coordinates) {
    // The scale for enterDelay and enterDuration should has zero padding by default.
    // Because there is no need to add extra delay for the start and the end.
    if (name === 'enterDelay' || name === 'enterDuration')
        return 0;
    if (name === 'size')
        return 0;
    if (type === 'band')
        return (0, coordinate_1.isTheta)(coordinates) ? 0 : 0.1;
    // Point scale need 0.5 padding to make interval between first and last point
    // equal to other intervals in polar coordinate.
    if (type === 'point')
        return 0.5;
    return 0;
}
function asOrdinalType(name, defaults) {
    if (defaults)
        return defaults;
    return isQuantitative(name) ? 'point' : 'ordinal';
}
function asQuantitativeType(name, range, defaults) {
    if (defaults)
        return defaults;
    if (name !== 'color')
        return 'linear';
    return range ? 'linear' : 'sequential';
}
function maybeMinMax(domain, options) {
    if (domain.length === 0)
        return domain;
    const { domainMin, domainMax } = options;
    const [d0, d1] = domain;
    return [domainMin !== null && domainMin !== void 0 ? domainMin : d0, domainMax !== null && domainMax !== void 0 ? domainMax : d1];
}
function inferDomainQ(values, options) {
    const { zero = false } = options;
    let min = Infinity;
    let max = -Infinity;
    for (const value of values) {
        for (const d of value) {
            if ((0, helper_1.defined)(d)) {
                min = Math.min(min, +d);
                max = Math.max(max, +d);
            }
        }
    }
    if (min === Infinity)
        return [];
    return zero ? [Math.min(0, min), max] : [min, max];
}
function inferDomainC(values) {
    return Array.from(new Set(values.flat()));
}
function inferDomainO(values) {
    return values.flat().sort();
}
function inferDomainS(values) {
    let min = Infinity;
    let max = -Infinity;
    for (const value of values) {
        for (const d of value) {
            if ((0, helper_1.defined)(d)) {
                min = Math.min(min, +d);
                max = Math.max(max, +d);
            }
        }
    }
    if (min === Infinity)
        return [];
    return [min < 0 ? -max : min, max];
}
/**
 * @todo More nice default range for enterDelay and enterDuration.
 * @todo Move these to channel definition.
 */
function inferRangeQ(name, palette) {
    if (name === 'enterDelay')
        return [0, 1000];
    if (name == 'enterDuration')
        return [300, 1000];
    if (name.startsWith('y') || name.startsWith('position'))
        return [1, 0];
    if (name === 'color')
        return [(0, array_1.firstOf)(palette), (0, array_1.lastOf)(palette)];
    if (name === 'opacity')
        return [0, 1];
    if (name === 'size')
        return [1, 10];
    return [0, 1];
}
function isOrdinal(values) {
    return some(values, (d) => {
        const type = typeof d;
        return type === 'string' || type === 'boolean';
    });
}
function isTemporal(values) {
    return some(values, (d) => d instanceof Date);
}
function isObject(values) {
    return some(values, helper_1.isStrictObject);
}
function some(values, callback) {
    for (const V of values) {
        if (V.some(callback))
            return true;
    }
    return false;
}
function isQuantitative(name) {
    return (name.startsWith('x') ||
        name.startsWith('y') ||
        name.startsWith('position') ||
        name.startsWith('size'));
}
// Spatial and temporal position.
function isPosition(name) {
    return (name.startsWith('x') ||
        name.startsWith('y') ||
        name.startsWith('position') ||
        name === 'enterDelay' ||
        name === 'enterDuration' ||
        name === 'updateDelay' ||
        name === 'updateDuration' ||
        name === 'exitDelay' ||
        name === 'exitDuration');
}
exports.isPosition = isPosition;
function isValidScale(scale) {
    if (!scale || !scale.type)
        return false;
    if (typeof scale.type === 'function')
        return true;
    const { type, domain, range, interpolator } = scale;
    const isValidDomain = domain && domain.length > 0;
    const isValidRange = range && range.length > 0;
    if ([
        'linear',
        'sqrt',
        'log',
        'time',
        'pow',
        'threshold',
        'quantize',
        'quantile',
        'ordinal',
        'band',
        'point',
    ].includes(type) &&
        isValidDomain &&
        isValidRange) {
        return true;
    }
    if (['sequential'].includes(type) &&
        isValidDomain &&
        (isValidRange || interpolator)) {
        return true;
    }
    if (['constant', 'identity'].includes(type) && isValidRange)
        return true;
    return false;
}
exports.isValidScale = isValidScale;
//# sourceMappingURL=scale.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"../utils/helper":1751263815829,"./coordinate":1751263816096,"./library":1751263816097}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816115, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ConstantScale = exports.DiscreteScale = exports.DistributionScale = exports.ContinuousScale = void 0;
exports.ContinuousScale = {
    linear: 'linear',
    identity: 'identity',
    log: 'log',
    pow: 'pow',
    sqrt: 'sqrt',
    sequential: 'sequential',
};
exports.DistributionScale = {
    threshold: 'threshold',
    quantize: 'quantize',
    quantile: 'quantile',
};
exports.DiscreteScale = {
    ordinal: 'ordinal',
    band: 'band',
    point: 'point',
};
exports.ConstantScale = {
    constant: 'constant',
};
//# sourceMappingURL=scale.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816116, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.placeComponents = exports.computeRoughPlotSize = exports.computeLayout = exports.processAxisZ = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const util_1 = require("@antv/util");
const coordinate_1 = require("../utils/coordinate");
const helper_1 = require("../utils/helper");
const array_1 = require("../utils/array");
const string_1 = require("../utils/string");
const component_1 = require("./component");
const coordinate_2 = require("./coordinate");
function processAxisZ(components) {
    const axisX = components.find(({ type }) => type === 'axisX');
    const axisY = components.find(({ type }) => type === 'axisY');
    const axisZ = components.find(({ type }) => type === 'axisZ');
    if (axisX && axisY && axisZ) {
        axisX.plane = 'xy';
        axisY.plane = 'xy';
        axisZ.plane = 'yz';
        axisZ.origin = [axisX.bbox.x, axisX.bbox.y, 0];
        axisZ.eulerAngles = [0, -90, 0];
        axisZ.bbox.x = axisX.bbox.x;
        axisZ.bbox.y = axisX.bbox.y;
        components.push(Object.assign(Object.assign({}, axisX), { plane: 'xz', showLabel: false, showTitle: false, origin: [axisX.bbox.x, axisX.bbox.y, 0], eulerAngles: [-90, 0, 0] }));
        components.push(Object.assign(Object.assign({}, axisY), { plane: 'yz', showLabel: false, showTitle: false, origin: [axisY.bbox.x + axisY.bbox.width, axisY.bbox.y, 0], eulerAngles: [0, -90, 0] }));
        components.push(Object.assign(Object.assign({}, axisZ), { plane: 'xz', actualPosition: 'left', showLabel: false, showTitle: false, eulerAngles: [90, -90, 0] }));
    }
}
exports.processAxisZ = processAxisZ;
function computeLayout(components, options, theme, library) {
    var _a, _b;
    const { width, height, depth, x = 0, y = 0, z = 0, inset = (_a = theme.inset) !== null && _a !== void 0 ? _a : 0, insetLeft = inset, insetTop = inset, insetBottom = inset, insetRight = inset, margin = (_b = theme.margin) !== null && _b !== void 0 ? _b : 0, marginLeft = margin, marginBottom = margin, marginTop = margin, marginRight = margin, padding = theme.padding, paddingBottom = padding, paddingLeft = padding, paddingRight = padding, paddingTop = padding, } = computeInset(components, options, theme, library);
    const MIN_CONTENT_RATIO = 1 / 4;
    const maybeClamp = (viewWidth, paddingLeft, paddingRight, pl0, pr0) => {
        // Only clamp when has marks.
        const { marks } = options;
        if (marks.length === 0)
            return [pl0, pr0];
        // If size of content is enough, skip.
        const contentSize = viewWidth - pl0 - pr0;
        const diff = contentSize - viewWidth * MIN_CONTENT_RATIO;
        if (diff > 0)
            return [pl0, pr0];
        // Shrink start and end size equally.
        const shrinkSize = viewWidth * (1 - MIN_CONTENT_RATIO);
        return [
            paddingLeft === 'auto' ? (shrinkSize * pl0) / (pl0 + pr0) : pl0,
            paddingRight === 'auto' ? (shrinkSize * pr0) / (pl0 + pr0) : pr0,
        ];
    };
    const roughPadding = (padding) => (padding === 'auto' ? 20 : padding !== null && padding !== void 0 ? padding : 20);
    const rpt = roughPadding(paddingTop);
    const rpb = roughPadding(paddingBottom);
    // Compute paddingLeft and paddingRight first to get innerWidth.
    const horizontalPadding = computePadding(components, height - rpt - rpb, [rpt + marginTop, rpb + marginBottom], ['left', 'right'], options, theme, library);
    const { paddingLeft: pl0, paddingRight: pr0 } = horizontalPadding;
    const viewWidth = width - marginLeft - marginRight;
    const [pl, pr] = maybeClamp(viewWidth, paddingLeft, paddingRight, pl0, pr0);
    const iw = viewWidth - pl - pr;
    // Compute paddingBottom and paddingTop based on innerWidth.
    const verticalPadding = computePadding(components, iw, [pl + marginLeft, pr + marginRight], ['bottom', 'top'], options, theme, library);
    const { paddingTop: pt0, paddingBottom: pb0 } = verticalPadding;
    const viewHeight = height - marginBottom - marginTop;
    const [pb, pt] = maybeClamp(viewHeight, paddingBottom, paddingTop, pb0, pt0);
    const ih = viewHeight - pb - pt;
    return {
        width,
        height,
        depth,
        insetLeft,
        insetTop,
        insetBottom,
        insetRight,
        innerWidth: iw,
        innerHeight: ih,
        paddingLeft: pl,
        paddingRight: pr,
        paddingTop: pt,
        paddingBottom: pb,
        marginLeft,
        marginBottom,
        marginTop,
        marginRight,
        x,
        y,
        z,
    };
}
exports.computeLayout = computeLayout;
// For composite mark with a layout algorithm and without axis,
// such as worldcloud, circlepack.
function computeRoughPlotSize(options) {
    const { height, width, padding = 0, paddingLeft = padding, paddingRight = padding, paddingTop = padding, paddingBottom = padding, margin = 16, marginLeft = margin, marginRight = margin, marginTop = margin, marginBottom = margin, inset = 0, insetLeft = inset, insetRight = inset, insetTop = inset, insetBottom = inset, } = options;
    // @todo Add this padding to theme.
    // 30 is default size for padding, which defined in runtime.
    const maybeAuto = (padding) => (padding === 'auto' ? 20 : padding);
    const finalWidth = width -
        maybeAuto(paddingLeft) -
        maybeAuto(paddingRight) -
        marginLeft -
        marginRight -
        insetLeft -
        insetRight;
    const finalHeight = height -
        maybeAuto(paddingTop) -
        maybeAuto(paddingBottom) -
        marginTop -
        marginBottom -
        insetTop -
        insetBottom;
    return { width: finalWidth, height: finalHeight };
}
exports.computeRoughPlotSize = computeRoughPlotSize;
function computeInset(components, options, theme, library) {
    const { coordinates } = options;
    if (!(0, coordinate_2.isPolar)(coordinates) && !(0, coordinate_2.isRadial)(coordinates)) {
        return options;
    }
    // Filter axis.
    const axes = components.filter((d) => typeof d.type === 'string' && d.type.startsWith('axis'));
    if (axes.length === 0)
        return options;
    const styles = axes.map((component) => {
        const key = component.type === 'axisArc' ? 'arc' : 'linear';
        return (0, component_1.styleOf)(component, key, theme);
    });
    // Compute max labelSpacing.
    const maxLabelSpacing = (0, d3_array_1.max)(styles, (d) => { var _a; return (_a = d.labelSpacing) !== null && _a !== void 0 ? _a : 0; });
    // Compute labelBBoxes.
    const labelBBoxes = axes
        .flatMap((component, i) => {
        const style = styles[i];
        const scale = (0, component_1.createScale)(component, library);
        const labels = (0, component_1.computeLabelsBBox)(style, scale);
        return labels;
    })
        .filter(helper_1.defined);
    const size = (0, d3_array_1.max)(labelBBoxes, (d) => d.height) + maxLabelSpacing;
    // Compute titles.
    const titleBBoxes = axes
        .flatMap((_, i) => {
        const style = styles[i];
        return (0, component_1.computeTitleBBox)(style);
    })
        .filter((d) => d !== null);
    const titleSize = titleBBoxes.length === 0 ? 0 : (0, d3_array_1.max)(titleBBoxes, (d) => d.height);
    // Update inset.
    const { inset = size, insetLeft = inset, insetBottom = inset, insetTop = inset + titleSize, insetRight = inset, } = options;
    return Object.assign(Object.assign({}, options), { insetLeft, insetBottom, insetTop, insetRight });
}
/**
 * @todo Support percentage size(e.g. 50%)
 */
function computePadding(components, crossSize, crossPadding, positions, options, theme, library) {
    const positionComponents = (0, d3_array_1.group)(components, (d) => d.position);
    const { padding = theme.padding, paddingLeft = padding, paddingRight = padding, paddingBottom = padding, paddingTop = padding, } = options;
    const layout = {
        paddingBottom,
        paddingLeft,
        paddingTop,
        paddingRight,
    };
    for (const position of positions) {
        const key = `padding${(0, helper_1.capitalizeFirst)((0, string_1.camelCase)(position))}`;
        const components = positionComponents.get(position) || [];
        const value = layout[key];
        const defaultSizeOf = (d) => {
            if (d.size === undefined)
                d.size = d.defaultSize;
        };
        const sizeOf = (d) => {
            if (d.type === 'group') {
                d.children.forEach(defaultSizeOf);
                d.size = (0, d3_array_1.max)(d.children, (d) => d.size);
            }
            else {
                d.size = d.defaultSize;
            }
        };
        const autoSizeOf = (d) => {
            if (d.size)
                return;
            if (value !== 'auto')
                sizeOf(d);
            else {
                // Compute component size dynamically.
                (0, component_1.computeComponentSize)(d, crossSize, crossPadding, position, theme, library);
                defaultSizeOf(d);
            }
        };
        const maybeHide = (d) => {
            if (!d.type.startsWith('axis'))
                return;
            if (d.labelAutoHide === undefined)
                d.labelAutoHide = true;
        };
        const isHorizontal = position === 'bottom' || position === 'top';
        // !!!Note
        // Mute axis component padding.
        // The first axis do not has padding.
        const minOrder = (0, d3_array_1.min)(components, (d) => d.order);
        const axes = components.filter((d) => d.type.startsWith('axis') && d.order == minOrder);
        if (axes.length)
            axes[0].crossPadding = 0;
        // Specified padding.
        if (typeof value === 'number') {
            components.forEach(defaultSizeOf);
            components.forEach(maybeHide);
        }
        else {
            // Compute padding dynamically.
            if (components.length === 0) {
                layout[key] = 0;
            }
            else {
                const size = isHorizontal
                    ? crossSize + crossPadding[0] + crossPadding[1]
                    : crossSize;
                const grouped = (0, component_1.groupComponents)(components, size);
                grouped.forEach(autoSizeOf);
                const totalSize = grouped.reduce((sum, { size, crossPadding = 12 }) => sum + size + crossPadding, 0);
                layout[key] = totalSize;
            }
        }
    }
    return layout;
}
function placeComponents(components, coordinate, layout) {
    // Group components by plane & position.
    const positionComponents = (0, d3_array_1.group)(components, (d) => `${d.plane || 'xy'}-${d.position}`);
    const { paddingLeft, paddingRight, paddingTop, paddingBottom, marginLeft, marginTop, marginBottom, marginRight, innerHeight, innerWidth, insetBottom, insetLeft, insetRight, insetTop, height, width, depth, } = layout;
    const planes = {
        xy: createSection({
            width,
            height,
            paddingLeft,
            paddingRight,
            paddingTop,
            paddingBottom,
            marginLeft,
            marginTop,
            marginBottom,
            marginRight,
            innerHeight,
            innerWidth,
            insetBottom,
            insetLeft,
            insetRight,
            insetTop,
        }),
        yz: createSection({
            width: depth,
            height: height,
            paddingLeft: 0,
            paddingRight: 0,
            paddingTop: 0,
            paddingBottom: 0,
            marginLeft: 0,
            marginTop: 0,
            marginBottom: 0,
            marginRight: 0,
            innerWidth: depth,
            innerHeight: height,
            insetBottom: 0,
            insetLeft: 0,
            insetRight: 0,
            insetTop: 0,
        }),
        xz: createSection({
            width,
            height: depth,
            paddingLeft: 0,
            paddingRight: 0,
            paddingTop: 0,
            paddingBottom: 0,
            marginLeft: 0,
            marginTop: 0,
            marginBottom: 0,
            marginRight: 0,
            innerWidth: width,
            innerHeight: depth,
            insetBottom: 0,
            insetLeft: 0,
            insetRight: 0,
            insetTop: 0,
        }),
    };
    for (const [key, components] of positionComponents.entries()) {
        const [plane, position] = key.split('-');
        const area = planes[plane][position];
        /**
         * @description non-entity components: axis in the center, inner, outer, component in the center
         * @description entity components: other components
         * @description no volume components take up no extra space
         */
        const [nonEntityComponents, entityComponents] = (0, array_1.divide)(components, (component) => {
            if (typeof component.type !== 'string')
                return false;
            if (position === 'center')
                return true;
            if (component.type.startsWith('axis') &&
                ['inner', 'outer'].includes(position)) {
                return true;
            }
            return false;
        });
        if (nonEntityComponents.length) {
            placeNonEntityComponents(nonEntityComponents, coordinate, area, position);
        }
        if (entityComponents.length) {
            placePaddingArea(components, coordinate, area);
        }
    }
}
exports.placeComponents = placeComponents;
function createSection({ width, height, paddingLeft, paddingRight, paddingTop, paddingBottom, marginLeft, marginTop, marginBottom, marginRight, innerHeight, innerWidth, insetBottom, insetLeft, insetRight, insetTop, }) {
    const pl = paddingLeft + marginLeft;
    const pt = paddingTop + marginTop;
    const pr = paddingRight + marginRight;
    const pb = paddingBottom + marginBottom;
    const plotWidth = width - marginLeft - marginRight;
    const centerSection = [
        pl + insetLeft,
        pt + insetTop,
        innerWidth - insetLeft - insetRight,
        innerHeight - insetTop - insetBottom,
        'center',
        null,
        null,
    ];
    const xySection = {
        top: [
            pl,
            0,
            innerWidth,
            pt,
            'vertical',
            true,
            d3_array_1.ascending,
            marginLeft,
            plotWidth,
        ],
        right: [width - pr, pt, pr, innerHeight, 'horizontal', false, d3_array_1.ascending],
        bottom: [
            pl,
            height - pb,
            innerWidth,
            pb,
            'vertical',
            false,
            d3_array_1.ascending,
            marginLeft,
            plotWidth,
        ],
        left: [0, pt, pl, innerHeight, 'horizontal', true, d3_array_1.ascending],
        'top-left': [pl, 0, innerWidth, pt, 'vertical', true, d3_array_1.ascending],
        'top-right': [pl, 0, innerWidth, pt, 'vertical', true, d3_array_1.ascending],
        'bottom-left': [
            pl,
            height - pb,
            innerWidth,
            pb,
            'vertical',
            false,
            d3_array_1.ascending,
        ],
        'bottom-right': [
            pl,
            height - pb,
            innerWidth,
            pb,
            'vertical',
            false,
            d3_array_1.ascending,
        ],
        center: centerSection,
        inner: centerSection,
        outer: centerSection,
    };
    return xySection;
}
function placeNonEntityComponents(components, coordinate, area, position) {
    const [axisComponents, nonAxisComponents] = (0, array_1.divide)(components, (component) => {
        if (typeof component.type === 'string' &&
            component.type.startsWith('axis')) {
            return true;
        }
        return false;
    });
    placeNonEntityAxis(axisComponents, coordinate, area, position);
    // in current stage, only legend component which located in the center can be placed
    placeCenter(nonAxisComponents, coordinate, area);
}
function placeNonEntityAxis(components, coordinate, area, position) {
    if (position === 'center') {
        if ((0, coordinate_1.isRadar)(coordinate)) {
            placeAxisRadar(components, coordinate, area, position);
        }
        else if ((0, coordinate_1.isPolar)(coordinate)) {
            placeArcLinear(components, coordinate, area);
        }
        else if ((0, coordinate_1.isParallel)(coordinate)) {
            placeAxisParallel(components, coordinate, area, components[0].orientation);
        }
    }
    else if (position === 'inner') {
        placeAxisArcInner(components, coordinate, area);
    }
    else if (position === 'outer') {
        placeAxisArcOuter(components, coordinate, area);
    }
}
function placeAxisArcInner(components, coordinate, area) {
    const [x, y, , height] = area;
    const [cx, cy] = coordinate.getCenter();
    const [innerRadius] = (0, coordinate_1.radiusOf)(coordinate);
    const r = height / 2;
    const size = innerRadius * r;
    const x0 = cx - size;
    const y0 = cy - size;
    for (let i = 0; i < components.length; i++) {
        const component = components[i];
        component.bbox = {
            x: x + x0,
            y: y + y0,
            width: size * 2,
            height: size * 2,
        };
    }
}
function placeAxisArcOuter(components, coordinate, area) {
    const [x, y, width, height] = area;
    for (const component of components) {
        component.bbox = { x, y, width, height };
    }
}
/**
 * @example arcX, arcY, axisLinear with angle
 */
function placeArcLinear(components, coordinate, area) {
    const [x, y, width, height] = area;
    for (const component of components) {
        component.bbox = { x: x, y, width, height };
    }
}
function placeAxisParallel(components, coordinate, area, orientation) {
    if (orientation === 'horizontal') {
        placeAxisParallelHorizontal(components, coordinate, area);
    }
    else if (orientation === 'vertical') {
        placeAxisParallelVertical(components, coordinate, area);
    }
}
function placeAxisParallelVertical(components, coordinate, area) {
    const [x, y, , height] = area;
    // Create a high dimension vector and map to a list of two-dimension points.
    // [0, 0, 0] -> [x0, 0, x1, 0, x2, 0]
    const vector = new Array(components.length).fill(0);
    const points = coordinate.map(vector);
    // Extract x of each points.
    // [x0, 0, x1, 0, x2, 0] -> [x0, x1, x2]
    const X = points.filter((_, i) => i % 2 === 0).map((d) => d + x);
    // Place each axis by coordinate in parallel coordinate.
    for (let i = 0; i < components.length; i++) {
        const component = components[i];
        const x = X[i];
        const width = X[i + 1] - x;
        component.bbox = { x, y, width, height };
    }
}
function placeAxisParallelHorizontal(components, coordinate, area) {
    const [x, y, width] = area;
    // Create a high dimension vector and map to a list of two-dimension points.
    // [0, 0, 0] -> [height, y0, height, y1, height, y2]
    const vector = new Array(components.length).fill(0);
    const points = coordinate.map(vector);
    // Extract y of each points.
    // [x0, 0, x1, 0, x2, 0] -> [x0, x1, x2]
    const Y = points.filter((_, i) => i % 2 === 1).map((d) => d + y);
    // Place each axis by coordinate in parallel coordinate.
    for (let i = 0; i < components.length; i++) {
        const component = components[i];
        const y = Y[i];
        const height = Y[i + 1] - y;
        component.bbox = { x, y, width, height };
    }
}
function placeAxisRadar(components, coordinate, area, position) {
    const [x, y, width, height] = area;
    for (const component of components) {
        component.bbox = { x, y, width, height };
        component.radar = {
            index: components.indexOf(component),
            count: components.length,
        };
    }
}
function placePaddingArea(components, coordinate, area) {
    const [x, y, width, height, direction, reverse, comparator, minX, totalSize] = area;
    const [mainStartKey, mainStartValue, crossStartKey, crossStartValue, mainSizeKey, mainSizeValue, crossSizeKey, crossSizeValue,] = direction === 'vertical'
        ? ['y', y, 'x', x, 'height', height, 'width', width]
        : ['x', x, 'y', y, 'width', width, 'height', height];
    // Sort components by order.
    // The smaller the order, the closer to center.
    components.sort((a, b) => comparator === null || comparator === void 0 ? void 0 : comparator(a.order, b.order));
    const isLarge = (type) => type === 'title' || type === 'group' || type.startsWith('legend');
    const crossSizeOf = (type, small, bigger) => {
        if (bigger === undefined)
            return small;
        if (isLarge(type))
            return bigger;
        return small;
    };
    const crossStartOf = (type, x, minX) => {
        if (minX === undefined)
            return x;
        if (isLarge(type))
            return minX;
        return x;
    };
    const startValue = reverse ? mainStartValue + mainSizeValue : mainStartValue;
    for (let i = 0, start = startValue; i < components.length; i++) {
        const component = components[i];
        const { crossPadding = 0, type } = component;
        const { size } = component;
        component.bbox = {
            [mainStartKey]: reverse
                ? start - size - crossPadding
                : start + crossPadding,
            [crossStartKey]: crossStartOf(type, crossStartValue, minX),
            [mainSizeKey]: size,
            [crossSizeKey]: crossSizeOf(type, crossSizeValue, totalSize),
        };
        start += (size + crossPadding) * (reverse ? -1 : 1);
    }
    // Place group components.
    const groupComponents = components.filter((d) => d.type === 'group');
    for (const group of groupComponents) {
        const { bbox, children } = group;
        const size = bbox[crossSizeKey];
        const step = size / children.length;
        const justifyContent = children.reduce((j, child) => {
            var _a;
            const j0 = (_a = child.layout) === null || _a === void 0 ? void 0 : _a.justifyContent;
            return j0 ? j0 : j;
        }, 'flex-start');
        const L = children.map((d, i) => {
            const { length = step, padding = 0 } = d;
            return length + (i === children.length - 1 ? 0 : padding);
        });
        const totalLength = (0, d3_array_1.sum)(L);
        const diff = size - totalLength;
        const offset = justifyContent === 'flex-start'
            ? 0
            : justifyContent === 'center'
                ? diff / 2
                : diff;
        for (let i = 0, start = bbox[crossStartKey] + offset; i < children.length; i++) {
            const component = children[i];
            const { padding = 0 } = component;
            const interval = i === children.length - 1 ? 0 : padding;
            component.bbox = {
                [mainSizeKey]: bbox[mainSizeKey],
                [mainStartKey]: bbox[mainStartKey],
                [crossStartKey]: start,
                [crossSizeKey]: L[i] - interval,
            };
            (0, util_1.deepMix)(component, { layout: { justifyContent } });
            start += L[i];
        }
    }
}
/**
 * @example legend in the center of radial or polar system
 */
function placeCenter(components, coordinate, area) {
    if (components.length === 0)
        return;
    const [x, y, width, height] = area;
    const [innerRadius] = (0, coordinate_1.radiusOf)(coordinate);
    const r = ((height / 2) * innerRadius) / Math.sqrt(2);
    const cx = x + width / 2;
    const cy = y + height / 2;
    for (let i = 0; i < components.length; i++) {
        const component = components[i];
        component.bbox = { x: cx - r, y: cy - r, width: r * 2, height: r * 2 };
    }
}
//# sourceMappingURL=layout.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../utils/helper":1751263815829,"../utils/array":1751263815830,"../utils/string":1751263815900,"./component":1751263816094,"./coordinate":1751263816096}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816117, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createColumnOf = exports.initializeMark = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const library_1 = require("./library");
const transform_1 = require("./transform");
function initializeMark(partialMark, partialProps, context) {
    return __awaiter(this, void 0, void 0, function* () {
        // Apply transform to mark to derive indices, data, encode, etc,.
        const [I, transformedMark] = yield applyMarkTransform(partialMark, partialProps, context);
        const { encode, scale, data, tooltip } = transformedMark;
        // Skip mark with non-tabular data. Do not skip empty
        // data, they are useful for facet to display axes.
        if (Array.isArray(data) === false) {
            return null;
        }
        // Group non-independent channels with same prefix, such as x1, x2 => x.
        // For independent channels, dot not group them, such as position1, position2.
        const { channels: channelDescriptors } = partialProps;
        const nameChannels = (0, d3_array_1.rollups)(Object.entries(encode).filter(([, value]) => (0, helper_1.defined)(value)), (values) => values.map(([key, options]) => (Object.assign({ name: key }, options))), ([key]) => {
            var _a;
            const prefix = (_a = /([^\d]+)\d*$/.exec(key)) === null || _a === void 0 ? void 0 : _a[1];
            const descriptor = channelDescriptors.find((d) => d.name === prefix);
            if (descriptor === null || descriptor === void 0 ? void 0 : descriptor.independent)
                return key;
            return prefix;
        });
        // Check required channels and initialize scale options for each channel.
        const channels = channelDescriptors
            .filter((descriptor) => {
            const { name, required } = descriptor;
            if (nameChannels.find(([d]) => d === name))
                return true;
            if (required)
                throw new Error(`Missing encoding for channel: ${name}.`);
            return false;
        })
            .flatMap((descriptor) => {
            const { name, scale: scaleType, scaleKey, range, quantitative, ordinal, } = descriptor;
            const valuesArray = nameChannels.filter(([channel]) => channel.startsWith(name));
            return valuesArray.map(([channel, values], i) => {
                const visual = values.some((d) => d.visual);
                const constant = values.some((d) => d.constant);
                const _a = scale[channel] || {}, { independent = false, 
                // Use channel name as default scale key.
                key = scaleKey || channel, 
                // Visual channel use identity scale.
                type = constant ? 'constant' : visual ? 'identity' : scaleType } = _a, scaleOptions = __rest(_a, ["independent", "key", "type"]);
                // For constant scale, infer range from data.
                const isConstant = type === 'constant';
                const finalRange = isConstant ? undefined : range;
                return {
                    name: channel,
                    values,
                    // Generate a unique key for independent channel,
                    // which will not group with any other channels.
                    scaleKey: independent || isConstant ? Symbol('independent') : key,
                    scale: Object.assign(Object.assign({ type, range: finalRange }, scaleOptions), { quantitative,
                        ordinal }),
                };
            });
        });
        return [transformedMark, Object.assign(Object.assign({}, partialProps), { index: I, channels, tooltip })];
    });
}
exports.initializeMark = initializeMark;
function createColumnOf(library) {
    const [useEncode] = (0, library_1.useLibrary)('encode', library);
    return (data, encode) => {
        if (encode === undefined)
            return null;
        if (data === undefined)
            return null;
        return Object.assign(Object.assign({}, encode), { type: 'column', value: useEncode(encode)(data), field: fieldOf(encode) });
    };
}
exports.createColumnOf = createColumnOf;
function applyMarkTransform(mark, props, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const [useTransform] = (0, library_1.useLibrary)('transform', library);
        const { preInference = [], postInference = [] } = props;
        const { transform = [] } = mark;
        const transforms = [
            transform_1.applyDefaults,
            transform_1.applyDataTransform,
            transform_1.flatEncode,
            transform_1.inferChannelsType,
            transform_1.maybeVisualChannel,
            transform_1.extractColumns,
            transform_1.maybeArrayField,
            transform_1.maybeNonAnimate,
            transform_1.addGuideToScale,
            transform_1.normalizeTooltip,
            ...preInference.map(useTransform),
            ...transform.map(useTransform),
            ...postInference.map(useTransform),
            transform_1.extractTooltip,
        ];
        let index = [];
        let transformedMark = mark;
        for (const t of transforms) {
            [index, transformedMark] = yield t(index, transformedMark, context);
        }
        return [index, transformedMark];
    });
}
function fieldOf(encode) {
    const { type, value } = encode;
    if (type === 'field' && typeof value === 'string')
        return value;
    return null;
}
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./library":1751263816097,"./transform":1751263816118}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816118, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.maybeNonAnimate = exports.addGuideToScale = exports.maybeArrayField = exports.extractTooltip = exports.normalizeTooltip = exports.extractColumns = exports.maybeVisualChannel = exports.inferChannelsType = exports.flatEncode = exports.applyDataTransform = exports.applyDefaults = exports.CALLBACK_ITEM_SYMBOL = void 0;
const util_1 = require("@antv/util");
const d3_format_1 = require("@antv/vendor/d3-format");
const array_1 = require("../utils/array");
const helper_1 = require("../utils/helper");
const mark_1 = require("../utils/mark");
const library_1 = require("./library");
const mark_2 = require("./mark");
const scale_1 = require("./scale");
exports.CALLBACK_ITEM_SYMBOL = Symbol('CALLBACK_ITEM');
// @todo Add more defaults.
function applyDefaults(I, mark, context) {
    const { encode = {}, scale = {}, transform = [] } = mark, rest = __rest(mark, ["encode", "scale", "transform"]);
    return [I, Object.assign(Object.assign({}, rest), { encode, scale, transform })];
}
exports.applyDefaults = applyDefaults;
function applyDataTransform(I, mark, context) {
    return __awaiter(this, void 0, void 0, function* () {
        const { library } = context;
        const { data } = mark;
        const [useData] = (0, library_1.useLibrary)('data', library);
        const descriptor = normalizedDataSource(data);
        const { transform: T = [] } = descriptor, connector = __rest(descriptor, ["transform"]);
        const transform = [connector, ...T];
        const transformFunctions = transform.map((t) => useData(t, context));
        const transformedData = yield (0, helper_1.composeAsync)(transformFunctions)(data);
        // Maintain the consistency of shape between input and output data.
        // If the shape of raw data is like { value: any }
        // and the returned transformedData is Object,
        // returns the wrapped data: { value: transformedData },
        // otherwise returns the processed tabular data.
        const newData = data && !Array.isArray(data) && !Array.isArray(transformedData)
            ? { value: transformedData }
            : transformedData;
        return [
            Array.isArray(transformedData) ? (0, array_1.indexOf)(transformedData) : [],
            Object.assign(Object.assign({}, mark), { data: newData }),
        ];
    });
}
exports.applyDataTransform = applyDataTransform;
function flatEncode(I, mark, context) {
    const { encode } = mark;
    if (!encode)
        return [I, mark];
    const flattenEncode = {};
    for (const [key, value] of Object.entries(encode)) {
        if (Array.isArray(value)) {
            for (let i = 0; i < value.length; i++) {
                const name = `${key}${i === 0 ? '' : i}`;
                flattenEncode[name] = value[i];
            }
        }
        else {
            flattenEncode[key] = value;
        }
    }
    return [I, Object.assign(Object.assign({}, mark), { encode: flattenEncode })];
}
exports.flatEncode = flatEncode;
function inferChannelsType(I, mark, context) {
    const { encode, data } = mark;
    if (!encode)
        return [I, mark];
    const typedEncode = (0, array_1.mapObject)(encode, (channel) => {
        if (isTypedChannel(channel))
            return channel;
        const type = inferChannelType(data, channel);
        return { type, value: channel };
    });
    return [I, Object.assign(Object.assign({}, mark), { encode: typedEncode })];
}
exports.inferChannelsType = inferChannelsType;
function maybeVisualChannel(I, mark, context) {
    const { encode } = mark;
    if (!encode)
        return [I, mark];
    const newEncode = (0, array_1.mapObject)(encode, (channel, name) => {
        const { type } = channel;
        if (type !== 'constant' || (0, scale_1.isPosition)(name))
            return channel;
        return Object.assign(Object.assign({}, channel), { constant: true });
    });
    return [I, Object.assign(Object.assign({}, mark), { encode: newEncode })];
}
exports.maybeVisualChannel = maybeVisualChannel;
function extractColumns(I, mark, context) {
    const { encode, data } = mark;
    if (!encode)
        return [I, mark];
    const { library } = context;
    const columnOf = (0, mark_2.createColumnOf)(library);
    const valuedEncode = (0, array_1.mapObject)(encode, (channel) => columnOf(data, channel));
    return [I, Object.assign(Object.assign({}, mark), { encode: valuedEncode })];
}
exports.extractColumns = extractColumns;
/**
 * Normalize mark.tooltip to {title, items}.
 */
function normalizeTooltip(I, mark, context) {
    const { tooltip = {} } = mark;
    if ((0, helper_1.isUnset)(tooltip))
        return [I, mark];
    if (Array.isArray(tooltip)) {
        return [I, Object.assign(Object.assign({}, mark), { tooltip: { items: tooltip } })];
    }
    if ((0, helper_1.isStrictObject)(tooltip) && (0, mark_1.isFullTooltip)(tooltip)) {
        return [I, Object.assign(Object.assign({}, mark), { tooltip })];
    }
    return [I, Object.assign(Object.assign({}, mark), { tooltip: { items: [tooltip] } })];
}
exports.normalizeTooltip = normalizeTooltip;
function extractTooltip(I, mark, context) {
    const { data, encode, tooltip = {} } = mark;
    if ((0, helper_1.isUnset)(tooltip))
        return [I, mark];
    const valueOf = (item) => {
        if (!item)
            return item;
        if (typeof item === 'string') {
            return I.map((i) => ({ name: item, value: data[i][item] }));
        }
        if ((0, helper_1.isStrictObject)(item)) {
            const { field, channel, color, name = field, valueFormatter = (d) => d, } = item;
            // Support d3-format.
            const normalizedValueFormatter = typeof valueFormatter === 'string'
                ? (0, d3_format_1.format)(valueFormatter)
                : valueFormatter;
            // Field name.
            const definedChannel = channel && encode[channel];
            const channelField = definedChannel && encode[channel].field;
            const name1 = name || channelField || channel;
            const values = [];
            for (const i of I) {
                const value1 = field
                    ? data[i][field]
                    : definedChannel
                        ? encode[channel].value[i]
                        : null;
                values[i] = {
                    name: name1,
                    color,
                    value: normalizedValueFormatter(value1),
                };
            }
            return values;
        }
        if (typeof item === 'function') {
            const values = [];
            for (const i of I) {
                const v = item(data[i], i, data, encode);
                if ((0, helper_1.isStrictObject)(v))
                    values[i] = Object.assign(Object.assign({}, v), { [exports.CALLBACK_ITEM_SYMBOL]: true });
                else
                    values[i] = { value: v };
            }
            return values;
        }
        return item;
    };
    const { title, items = [] } = tooltip, rest = __rest(tooltip, ["title", "items"]);
    const newTooltip = Object.assign({ title: valueOf(title), items: Array.isArray(items) ? items.map(valueOf) : [] }, rest);
    return [I, Object.assign(Object.assign({}, mark), { tooltip: newTooltip })];
}
exports.extractTooltip = extractTooltip;
function maybeArrayField(I, mark, context) {
    const { encode } = mark, rest = __rest(mark, ["encode"]);
    if (!encode)
        return [I, mark];
    const columns = Object.entries(encode);
    const arrayColumns = columns
        .filter(([, channel]) => {
        const { value: V } = channel;
        return Array.isArray(V[0]);
    })
        .flatMap(([key, V]) => {
        const columns = [[key, new Array(I.length).fill(undefined)]];
        const { value: rows } = V, rest = __rest(V, ["value"]);
        for (let i = 0; i < rows.length; i++) {
            const row = rows[i];
            if (Array.isArray(row)) {
                for (let j = 0; j < row.length; j++) {
                    const column = columns[j] || [
                        `${key}${j}`,
                        new Array(I).fill(undefined),
                    ];
                    column[1][i] = row[j];
                    columns[j] = column;
                }
            }
        }
        return columns.map(([key, value]) => [
            key,
            Object.assign({ type: 'column', value }, rest),
        ]);
    });
    const newEncode = Object.fromEntries([...columns, ...arrayColumns]);
    return [I, Object.assign(Object.assign({}, rest), { encode: newEncode })];
}
exports.maybeArrayField = maybeArrayField;
function addGuideToScale(I, mark, context) {
    const { axis = {}, legend = {}, slider = {}, scrollbar = {} } = mark;
    const normalize = (guide, channel) => {
        if (typeof guide === 'boolean')
            return guide ? {} : null;
        const eachGuide = guide[channel];
        return eachGuide === undefined || eachGuide ? eachGuide : null;
    };
    const axisChannels = typeof axis === 'object'
        ? Array.from(new Set(['x', 'y', 'z', ...Object.keys(axis)]))
        : ['x', 'y', 'z'];
    (0, util_1.deepMix)(mark, {
        scale: Object.assign(Object.assign({}, Object.fromEntries(axisChannels.map((channel) => {
            const scrollbarOptions = normalize(scrollbar, channel);
            return [
                channel,
                Object.assign({ guide: normalize(axis, channel), slider: normalize(slider, channel), scrollbar: scrollbarOptions }, (scrollbarOptions && {
                    ratio: scrollbarOptions.ratio === undefined
                        ? 0.5
                        : scrollbarOptions.ratio,
                })),
            ];
        }))), { color: { guide: normalize(legend, 'color') }, size: { guide: normalize(legend, 'size') }, shape: { guide: normalize(legend, 'shape') }, 
            // fixme: opacity is conflict with DisplayObject.opacity
            // to be confirm.
            opacity: { guide: normalize(legend, 'opacity') } }),
    });
    return [I, mark];
}
exports.addGuideToScale = addGuideToScale;
function maybeNonAnimate(I, mark, context) {
    const { animate } = mark;
    if (animate || animate === undefined)
        return [I, mark];
    (0, util_1.deepMix)(mark, {
        animate: {
            enter: { type: null },
            exit: { type: null },
            update: { type: null },
        },
    });
    return [I, mark];
}
exports.maybeNonAnimate = maybeNonAnimate;
function isTypedChannel(channel) {
    if (typeof channel !== 'object' ||
        channel instanceof Date ||
        channel === null) {
        return false;
    }
    const { type } = channel;
    return (0, helper_1.defined)(type);
}
function inferChannelType(data, channel) {
    if (typeof channel === 'function')
        return 'transform';
    if (typeof channel === 'string' && isField(data, channel))
        return 'field';
    return 'constant';
}
function isField(data, value) {
    if (!Array.isArray(data))
        return false;
    return data.some((d) => d[value] !== undefined);
}
function normalizedDataSource(data) {
    // Liquid、Gauge need number data.
    if ((0, util_1.isNumber)(data))
        return { type: 'inline', value: data };
    // Return null as a placeholder.
    if (!data)
        return { type: 'inline', value: null };
    if (Array.isArray(data))
        return { type: 'inline', value: data };
    const { type = 'inline' } = data, rest = __rest(data, ["type"]);
    return Object.assign(Object.assign({}, rest), { type });
}
//# sourceMappingURL=transform.js.map
}, function(modId) { var map = {"../utils/array":1751263815830,"../utils/helper":1751263815829,"../utils/mark":1751263815997,"./library":1751263816097,"./mark":1751263816117,"./scale":1751263816114}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816119, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.preprocessOption = void 0;
const flow_1 = require("../../utils/flow");
const style_1 = require("./style");
function preprocessOption(options) {
    const convertedOptions = adapter(options);
    // If there are children, recursively convert each child node.
    if (convertedOptions.children && Array.isArray(convertedOptions.children)) {
        convertedOptions.children = convertedOptions.children.map((child) => preprocessOption(child));
    }
    return convertedOptions;
}
exports.preprocessOption = preprocessOption;
// Entry point for all syntactic sugar functions.
function adapter(options) {
    //@todo define a type for params of flow
    return (0, flow_1.flow)(style_1.columnWidthRatio)(options);
}
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"../../utils/flow":1751263816120,"./style":1751263816121}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816120, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.flow = void 0;
/**
 * 类似 lodash.flow 的方法
 * @param flows
 */
function flow(...flows) {
    return (param) => {
        return flows.reduce((result, f) => {
            return f(result);
        }, param);
    };
}
exports.flow = flow;
//# sourceMappingURL=flow.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816121, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.columnWidthRatio = void 0;
const util_1 = require("@antv/util");
// style: { columnWidthRatio: 0.2 } => scale: { x: { padding: 0.8 } }
function columnWidthRatio(options) {
    const { style, scale, type } = options;
    const scaleOption = {};
    const columnWidthRatio = (0, util_1.get)(style, 'columnWidthRatio');
    if (columnWidthRatio && type === 'interval') {
        scaleOption.x = Object.assign(Object.assign({}, scale === null || scale === void 0 ? void 0 : scale.x), { padding: 1 - columnWidthRatio });
    }
    return Object.assign(Object.assign({}, options), { scale: Object.assign(Object.assign({}, scale), scaleOption) });
}
exports.columnWidthRatio = columnWidthRatio;
//# sourceMappingURL=style.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816122, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.show = exports.hide = exports.setStyle = exports.getStyle = void 0;
const traverse_elements_1 = require("./traverse-elements");
const defaultStyle = {
    visibility: 'visible',
    opacity: 1,
    fillOpacity: 1,
    strokeOpacity: 1,
};
function getStyle(element, key) {
    let value;
    (0, traverse_elements_1.traverseElements)(element, (el) => {
        var _a;
        if (el.tagName !== 'g' && ((_a = el.style) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
            value = el.style[key];
            return true;
        }
        return false;
    });
    return value !== null && value !== void 0 ? value : defaultStyle[key];
}
exports.getStyle = getStyle;
function setStyle(element, key, value, recursive) {
    element.style[key] = value;
    if (recursive) {
        element.children.forEach((child) => setStyle(child, key, value, recursive));
    }
}
exports.setStyle = setStyle;
function hide(element) {
    setStyle(element, 'visibility', 'hidden', true);
}
exports.hide = hide;
function show(element) {
    setStyle(element, 'visibility', 'visible', true);
}
exports.show = show;
//# sourceMappingURL=style.js.map
}, function(modId) { var map = {"./traverse-elements":1751263816123}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816123, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.traverseElements = void 0;
function traverseElements(element, visitor) {
    if (visitor(element))
        return true;
    if (element.tagName === 'g') {
        const { childNodes = [] } = element;
        for (const child of childNodes) {
            if (traverseElements(child, visitor))
                return true;
        }
    }
    return false;
}
exports.traverseElements = traverseElements;
//# sourceMappingURL=traverse-elements.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816124, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementHighlightByX = void 0;
const utils_1 = require("./utils");
const elementHighlight_1 = require("./elementHighlight");
function ElementHighlightByX(options) {
    return (0, elementHighlight_1.ElementHighlight)(Object.assign(Object.assign({}, options), { createGroup: utils_1.createXKey }));
}
exports.ElementHighlightByX = ElementHighlightByX;
ElementHighlightByX.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementHighlightByX.js.map
}, function(modId) { var map = {"./utils":1751263816080,"./elementHighlight":1751263816079}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816125, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementHighlightByColor = void 0;
const utils_1 = require("./utils");
const elementHighlight_1 = require("./elementHighlight");
function ElementHighlightByColor(options) {
    return (0, elementHighlight_1.ElementHighlight)(Object.assign(Object.assign({}, options), { createGroup: utils_1.createColorKey }));
}
exports.ElementHighlightByColor = ElementHighlightByColor;
ElementHighlightByColor.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementHighlightByColor.js.map
}, function(modId) { var map = {"./utils":1751263816080,"./elementHighlight":1751263816079}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816126, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementSelect = exports.elementSelect = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const traverse_elements_1 = require("../utils/traverse-elements");
const utils_1 = require("./utils");
/**
 * Active a group of elements.
 */
function elementSelect(root, { elements: elementsof, // given the root of chart returns elements to be manipulated
datum, // given each element returns the datum of it
groupKey = (d) => d, // group elements by specified key
regionGroupKey = (d) => d, // how to group elements when click region
link = false, // draw link or not
single = false, // single select or not
multipleSelectHotkey, // hotkey for multi-select mode
coordinate, background = false, scale, emitter, state = {}, region = false, regionEleFilter = (el) => utils_1.VALID_FIND_BY_X_MARKS.includes(el.markType), }) {
    var _a;
    const elements = elementsof(root);
    const elementSet = new Set(elements);
    const findElement = (0, utils_1.createFindElementByEvent)({
        elementsof,
        root,
        coordinate,
        scale,
    });
    const keyGroup = (0, d3_array_1.group)(elements, groupKey);
    const regionGroup = (0, d3_array_1.group)(elements, regionGroupKey);
    const valueof = (0, utils_1.createValueof)(elements, datum);
    const [appendLink, removeLink] = (0, utils_1.renderLink)(Object.assign({ link,
        elements,
        valueof,
        coordinate }, (0, helper_1.subObject)(state.selected, 'link')));
    const [appendBackground, removeBackground] = (0, utils_1.renderBackground)(Object.assign({ document: root.ownerDocument, background,
        coordinate,
        scale,
        valueof }, (0, helper_1.subObject)(state.selected, 'background')));
    const elementStyle = (0, util_1.deepMix)(state, {
        selected: Object.assign({}, (((_a = state.selected) === null || _a === void 0 ? void 0 : _a.offset) && {
            // Apply translate to mock slice out.
            transform: (...params) => {
                const value = state.selected.offset(...params);
                const [, i] = params;
                return (0, utils_1.offsetTransform)(elements[i], value, coordinate);
            },
        })),
    });
    const useState = (0, utils_1.createUseState)(elementStyle, elements);
    const { updateState, removeState, hasState } = useState(valueof);
    let isMultiSelectMode = !single; // "single" determines whether to multi-select by default
    let activeHotkey = null; // Track the currently active hotkey
    const clear = (nativeEvent = true) => {
        for (const e of elements) {
            removeState(e, 'selected', 'unselected');
            removeLink(e);
            removeBackground(e);
        }
        if (nativeEvent)
            emitter.emit('element:unselect', { nativeEvent: true });
        return;
    };
    const singleSelect = ({ event, element, nativeEvent = true, filter = (el) => true, groupBy = groupKey, groupMap = keyGroup, }) => {
        const filteredElements = elements.filter(filter);
        // Clear states if clicked selected element.
        if (hasState(element, 'selected'))
            clear();
        else {
            const k = groupBy(element);
            const group = groupMap.get(k);
            const groupSet = new Set(group);
            for (const e of filteredElements) {
                if (groupSet.has(e))
                    updateState(e, 'selected');
                else {
                    updateState(e, 'unselected');
                    removeLink(e);
                }
                if (e !== element)
                    removeBackground(e);
            }
            appendLink(group);
            appendBackground(element);
            if (!nativeEvent)
                return;
            emitter.emit('element:select', Object.assign(Object.assign({}, event), { nativeEvent, data: {
                    data: [datum(element), ...group.map(datum)],
                } }));
        }
    };
    const multipleSelect = ({ event, element, nativeEvent = true, filter = (el) => true, groupBy = groupKey, groupMap = keyGroup, }) => {
        const k = groupBy(element);
        const group = groupMap.get(k);
        const groupSet = new Set(group);
        const filteredElements = elements.filter(filter);
        if (!hasState(element, 'selected')) {
            const hasSelectedGroup = group.some((e) => hasState(e, 'selected'));
            for (const e of filteredElements) {
                if (groupSet.has(e))
                    updateState(e, 'selected');
                else if (!hasState(e, 'selected'))
                    updateState(e, 'unselected');
            }
            // Append link for each group only once.
            if (!hasSelectedGroup && link)
                appendLink(group);
            appendBackground(element);
        }
        else {
            // If there is no selected elements after resetting this group,
            // clear the states.
            const hasSelected = elements.some((e) => !groupSet.has(e) && hasState(e, 'selected'));
            if (!hasSelected)
                return clear();
            // If there are still some selected elements after resetting this group,
            // only remove the link.
            for (const e of group) {
                updateState(e, 'unselected');
                removeLink(e);
                removeBackground(e);
            }
        }
        if (!nativeEvent)
            return;
        emitter.emit('element:select', Object.assign(Object.assign({}, event), { nativeEvent, data: {
                data: elements.filter((e) => hasState(e, 'selected')).map(datum),
            } }));
    };
    const isClickElementOrGroup = (element) => {
        if (elementSet.has(element))
            return true;
        for (const group of elementSet) {
            const found = (0, traverse_elements_1.traverseElements)(group, (el) => el === element);
            if (found)
                return true;
        }
        return false;
    };
    const getRealElement = (element) => {
        if (elementSet.has(element))
            return element;
        for (const group of elementSet) {
            let match = null;
            (0, traverse_elements_1.traverseElements)(group, (el) => {
                if (el === element)
                    match = group;
            });
            if (match)
                return match;
        }
        return element;
    };
    const click = (event) => {
        const { target: element, nativeEvent = true } = event;
        const select = !isMultiSelectMode ? singleSelect : multipleSelect;
        let el = element;
        const isClickElement = isClickElementOrGroup(element);
        if (!region || isClickElement) {
            // Click non-element shape, reset.
            // Such as the rest of content area(background).
            if (!isClickElement)
                return clear();
            return select({
                event,
                element: getRealElement(el),
                nativeEvent,
                groupBy: groupKey,
            });
        }
        else {
            // Click background region area, select elements in the region.
            // Get element at cursor.x position.
            el = findElement(event);
            if (!elementSet.has(el))
                return clear();
            return select({
                event,
                element: el,
                nativeEvent,
                filter: regionEleFilter,
                groupBy: regionGroupKey,
                groupMap: regionGroup,
            });
        }
    };
    // Handle keyboard events for multi-select mode
    const hotkeys = Array.isArray(multipleSelectHotkey)
        ? multipleSelectHotkey
        : [multipleSelectHotkey];
    const handleKeyDown = (event) => {
        if (hotkeys.includes(event.code) && !activeHotkey) {
            activeHotkey = event.code;
            isMultiSelectMode = true;
        }
    };
    const handleKeyUp = (event) => {
        if (event.code === activeHotkey) {
            activeHotkey = null;
            isMultiSelectMode = false;
        }
    };
    root.addEventListener('click', click);
    if (multipleSelectHotkey) {
        // If a hotkey is set, the initial state should be single mode
        isMultiSelectMode = false;
        document.addEventListener('keydown', handleKeyDown);
        document.addEventListener('keyup', handleKeyUp);
    }
    const onSelect = (e) => {
        const { nativeEvent, data } = e;
        if (nativeEvent)
            return;
        const selectedData = !isMultiSelectMode ? data.data.slice(0, 1) : data.data;
        for (const d of selectedData) {
            const element = (0, utils_1.selectElementByData)(elements, d, datum);
            click({ target: element, nativeEvent: false });
        }
    };
    const onUnSelect = () => {
        clear(false);
    };
    emitter.on('element:select', onSelect);
    emitter.on('element:unselect', onUnSelect);
    return () => {
        for (const e of elements)
            removeLink(e);
        root.removeEventListener('click', click);
        if (multipleSelectHotkey) {
            document.removeEventListener('keydown', handleKeyDown);
            document.removeEventListener('keyup', handleKeyUp);
        }
        emitter.off('element:select', onSelect);
        emitter.off('element:unselect', onUnSelect);
    };
}
exports.elementSelect = elementSelect;
function ElementSelect(_a) {
    var { createGroup, createRegionGroup, background = false, link = false } = _a, rest = __rest(_a, ["createGroup", "createRegionGroup", "background", "link"]);
    return (context, _, emitter) => {
        const { container, view, options } = context;
        const { coordinate, scale } = view;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        return elementSelect(plotArea, Object.assign({ elements: utils_1.selectG2Elements, datum: (0, utils_1.createDatumof)(view), groupKey: createGroup ? createGroup(view) : undefined, regionGroupKey: createRegionGroup
                ? createRegionGroup(view)
                : (0, utils_1.createXKey)(view), coordinate,
            scale, state: (0, utils_1.mergeState)(options, [
                ['selected', background ? {} : { lineWidth: '1', stroke: '#000' }],
                'unselected',
            ]), background,
            link,
            emitter }, rest));
    };
}
exports.ElementSelect = ElementSelect;
ElementSelect.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementSelect.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/traverse-elements":1751263816123,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816127, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementSelectByX = void 0;
const utils_1 = require("./utils");
const elementSelect_1 = require("./elementSelect");
function ElementSelectByX(options) {
    return (0, elementSelect_1.ElementSelect)(Object.assign(Object.assign({}, options), { createGroup: utils_1.createXKey }));
}
exports.ElementSelectByX = ElementSelectByX;
ElementSelectByX.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementSelectByX.js.map
}, function(modId) { var map = {"./utils":1751263816080,"./elementSelect":1751263816126}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816128, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementSelectByColor = void 0;
const utils_1 = require("./utils");
const elementSelect_1 = require("./elementSelect");
function ElementSelectByColor(options) {
    return (0, elementSelect_1.ElementSelect)(Object.assign(Object.assign({}, options), { createGroup: utils_1.createColorKey }));
}
exports.ElementSelectByColor = ElementSelectByColor;
ElementSelectByColor.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=elementSelectByColor.js.map
}, function(modId) { var map = {"./utils":1751263816080,"./elementSelect":1751263816126}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816129, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartIndex = void 0;
const g_1 = require("@antv/g");
const util_1 = require("@antv/util");
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const runtime_1 = require("../runtime");
const utils_1 = require("./utils");
function maybeTransform(options) {
    const { transform = [] } = options;
    const normalizeY = transform.find((d) => d.type === 'normalizeY');
    if (normalizeY)
        return normalizeY;
    const newNormalizeY = { type: 'normalizeY' };
    transform.push(newNormalizeY);
    options.transform = transform;
    return newNormalizeY;
}
function markValue(markState, markName, channels) {
    const [value] = Array.from(markState.entries())
        .filter(([mark]) => mark.type === markName)
        .map(([mark]) => {
        const { encode } = mark;
        const channel = (name) => {
            const channel = encode[name];
            return [name, channel ? channel.value : undefined];
        };
        return Object.fromEntries(channels.map(channel));
    });
    return value;
}
/**
 * @todo Perf
 */
function ChartIndex(_a) {
    var { wait = 20, leading, trailing = false, labelFormatter = (date) => `${date}` } = _a, style = __rest(_a, ["wait", "leading", "trailing", "labelFormatter"]);
    return (context) => {
        const { view, container, update, setState } = context;
        const { markState, scale, coordinate } = view;
        // Get line mark value, exit if it is not existed.
        const value = markValue(markState, 'line', ['x', 'y', 'series']);
        if (!value)
            return;
        // Prepare channel value.
        const { y: Y, x: X, series: S = [] } = value;
        const I = Y.map((_, i) => i);
        const sortedX = (0, d3_array_1.sort)(I.map((i) => X[i]));
        // Prepare shapes.
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const lines = container.getElementsByClassName(runtime_1.ELEMENT_CLASS_NAME);
        const labels = container.getElementsByClassName(runtime_1.LABEL_CLASS_NAME);
        // The format of label key: `${elementKey}-index`,
        // group labels by elementKey.
        const keyofLabel = (d) => d.__data__.key.split('-')[0];
        const keyLabels = (0, d3_array_1.group)(labels, keyofLabel);
        const rule = new g_1.Line({
            style: Object.assign({ x1: 0, y1: 0, x2: 0, y2: plotArea.getAttribute('height'), stroke: 'black', lineWidth: 1 }, (0, helper_1.subObject)(style, 'rule')),
        });
        const text = new g_1.Text({
            style: Object.assign({ x: 0, y: plotArea.getAttribute('height'), text: '', fontSize: 10 }, (0, helper_1.subObject)(style, 'label')),
        });
        rule.append(text);
        plotArea.appendChild(rule);
        // Get the closet date to the rule.
        const dateByFocus = (coordinate, scaleX, focus) => {
            const [normalizedX] = coordinate.invert(focus);
            const date = scaleX.invert(normalizedX);
            return sortedX[(0, d3_array_1.bisectCenter)(sortedX, date)];
        };
        // Update rule and label content.
        const updateRule = (focus, date) => {
            rule.setAttribute('x1', focus[0]);
            rule.setAttribute('x2', focus[0]);
            text.setAttribute('text', labelFormatter(date));
        };
        // Store the new inner state alter rerender the view.
        let newView;
        // Rerender the view to update basis for each line.
        const updateBasisByRerender = (focus) => __awaiter(this, void 0, void 0, function* () {
            // Find the closetDate to the rule.
            const { x: scaleX } = scale;
            const date = dateByFocus(coordinate, scaleX, focus);
            updateRule(focus, date);
            setState('chartIndex', (options) => {
                // Clone options and get line mark.
                const clonedOptions = (0, util_1.deepMix)({}, options);
                const lineMark = clonedOptions.marks.find((d) => d.type === 'line');
                // Update domain of y scale for the line mark.
                const r = (I) => (0, d3_array_1.max)(I, (i) => +Y[i]) / (0, d3_array_1.min)(I, (i) => +Y[i]);
                const k = (0, d3_array_1.max)((0, d3_array_1.rollup)(I, r, (i) => S[i]).values());
                const domainY = [1 / k, k];
                (0, util_1.deepMix)(lineMark, {
                    scale: { y: { domain: domainY } },
                });
                // Update normalize options.
                const normalizeY = maybeTransform(lineMark);
                normalizeY.groupBy = 'color';
                normalizeY.basis = (I, Y) => {
                    const i = I[(0, d3_array_1.bisector)((i) => X[+i]).center(I, date)];
                    return Y[i];
                };
                // Disable animation.
                for (const mark of clonedOptions.marks)
                    mark.animate = false;
                return clonedOptions;
            });
            const newState = yield update('chartIndex');
            newView = newState.view;
        });
        // Only apply translate to update basis for each line.
        // If performance is ok, there is no need to use this
        // strategy to update basis.
        const updateBasisByTranslate = (focus) => {
            // Find the closetDate to the rule.
            const { scale, coordinate } = newView;
            const { x: scaleX, y: scaleY } = scale;
            const date = dateByFocus(coordinate, scaleX, focus);
            updateRule(focus, date);
            // Translate mark and label for better performance.
            for (const line of lines) {
                // Compute transform in y direction.
                const { seriesIndex: SI, key } = line.__data__;
                const i = SI[(0, d3_array_1.bisector)((i) => X[+i]).center(SI, date)];
                const p0 = [0, scaleY.map(1)]; // basis point
                const p1 = [0, scaleY.map(Y[i] / Y[SI[0]])];
                const [, y0] = coordinate.map(p0);
                const [, y1] = coordinate.map(p1);
                const dy = y0 - y1;
                line.setAttribute('transform', `translate(0, ${dy})`);
                // Update line and related label.
                const labels = keyLabels.get(key) || [];
                for (const label of labels) {
                    // @todo Replace with style.transform.
                    // It now has unexpected behavior.
                    label.setAttribute('dy', dy);
                }
            }
        };
        const updateBasis = (0, util_1.throttle)((event) => {
            const focus = (0, utils_1.mousePosition)(plotArea, event);
            if (!focus)
                return;
            updateBasisByTranslate(focus);
        }, wait, { leading, trailing });
        updateBasisByRerender([0, 0]);
        plotArea.addEventListener('pointerenter', updateBasis);
        plotArea.addEventListener('pointermove', updateBasis);
        plotArea.addEventListener('pointerleave', updateBasis);
        return () => {
            rule.remove();
            plotArea.removeEventListener('pointerenter', updateBasis);
            plotArea.removeEventListener('pointermove', updateBasis);
            plotArea.removeEventListener('pointerleave', updateBasis);
        };
    };
}
exports.ChartIndex = ChartIndex;
ChartIndex.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=chartIndex.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../runtime":1751263816081,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816130, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Fisheye = void 0;
const util_1 = require("@antv/util");
const utils_1 = require("./utils");
function maybeCoordinate(options) {
    const { coordinate = {} } = options;
    const { transform = [] } = coordinate;
    const fisheye = transform.find((d) => d.type === 'fisheye');
    if (fisheye)
        return fisheye;
    const newFisheye = { type: 'fisheye' };
    transform.push(newFisheye);
    coordinate.transform = transform;
    options.coordinate = coordinate;
    return newFisheye;
}
/**
 * @todo Bind abstract data or data index.
 */
function Fisheye({ wait = 30, leading, trailing = false, }) {
    return (context) => {
        const { options, update, setState, container } = context;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const updateFocus = (0, util_1.throttle)((event) => {
            const focus = (0, utils_1.mousePosition)(plotArea, event);
            if (!focus) {
                setState('fisheye');
                update();
                return;
            }
            setState('fisheye', (options) => {
                // Clone options and mutate it.
                // Disable animation.
                const clonedOptions = (0, util_1.deepMix)({}, options, {
                    interaction: { tooltip: { preserve: true } },
                });
                for (const mark of clonedOptions.marks)
                    mark.animate = false;
                const [x, y] = focus;
                const fisheye = maybeCoordinate(clonedOptions);
                fisheye.focusX = x;
                fisheye.focusY = y;
                fisheye.visual = true;
                return clonedOptions;
            });
            update();
        }, wait, { leading, trailing });
        // Bind events.
        plotArea.addEventListener('pointerenter', updateFocus);
        plotArea.addEventListener('pointermove', updateFocus);
        plotArea.addEventListener('pointerleave', updateFocus);
        return () => {
            plotArea.removeEventListener('pointerenter', updateFocus);
            plotArea.removeEventListener('pointermove', updateFocus);
            plotArea.removeEventListener('pointerleave', updateFocus);
        };
    };
}
exports.Fisheye = Fisheye;
//# sourceMappingURL=fisheye.js.map
}, function(modId) { var map = {"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816131, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tooltip = exports.tooltip = exports.seriesTooltip = exports.findSeriesElement = exports.findSingleElement = exports.maybeValue = void 0;
const g_1 = require("@antv/g");
const d3_array_1 = require("@antv/vendor/d3-array");
const util_1 = require("@antv/util");
const component_1 = require("@antv/component");
const helper_1 = require("../utils/helper");
const coordinate_1 = require("../utils/coordinate");
const vector_1 = require("../utils/vector");
const scale_1 = require("../utils/scale");
const transform_1 = require("../runtime/transform");
const utils_1 = require("./utils");
function getContainer(group, mount) {
    if (mount) {
        return typeof mount === 'string' ? document.querySelector(mount) : mount;
    }
    const canvas = group.ownerDocument.defaultView
        .getContextService()
        .getDomElement();
    return canvas.parentElement;
}
function getBounding(root) {
    const bbox = root.getRenderBounds();
    const { min: [x1, y1], max: [x2, y2], } = bbox;
    return {
        x: x1,
        y: y1,
        width: x2 - x1,
        height: y2 - y1,
    };
}
function getContainerOffset(container1, container2) {
    const r1 = container1.getBoundingClientRect();
    const r2 = container2.getBoundingClientRect();
    return {
        x: r1.x - r2.x,
        y: r1.y - r2.y,
    };
}
function createTooltip(container, x0, y0, position, enterable, bounding, containerOffset, css = {}, offset = [10, 10]) {
    const defaults = {
        '.g2-tooltip': {},
        '.g2-tooltip-title': {
            overflow: 'hidden',
            'white-space': 'nowrap',
            'text-overflow': 'ellipsis',
        },
    };
    const tooltipElement = new component_1.Tooltip({
        className: 'tooltip',
        style: {
            x: x0,
            y: y0,
            container: containerOffset,
            data: [],
            bounding,
            position,
            enterable,
            title: '',
            offset,
            template: {
                prefixCls: 'g2-',
            },
            style: (0, util_1.deepMix)(defaults, css),
        },
    });
    container.appendChild(tooltipElement.HTMLTooltipElement);
    return tooltipElement;
}
function showTooltip({ root, data, x, y, render, event, single, position = 'right-bottom', enterable = false, css, mount, bounding, offset, }) {
    const container = getContainer(root, mount);
    const canvasContainer = getContainer(root);
    // All the views share the same tooltip.
    const parent = single ? canvasContainer : root;
    const b = bounding || getBounding(root);
    const containerOffset = getContainerOffset(canvasContainer, container);
    const { tooltipElement = createTooltip(container, x, y, position, enterable, b, containerOffset, css, offset), } = parent;
    const { items, title = '' } = data;
    tooltipElement.update(Object.assign({ x,
        y, data: items, title,
        position,
        enterable, container: containerOffset }, (render !== undefined && {
        content: render(event, { items, title }),
    })));
    parent.tooltipElement = tooltipElement;
}
function hideTooltip({ root, single, emitter, nativeEvent = true, event = null, }) {
    if (nativeEvent) {
        emitter.emit('tooltip:hide', { nativeEvent });
    }
    const container = getContainer(root);
    const parent = single ? container : root;
    const { tooltipElement } = parent;
    if (tooltipElement) {
        // Must be clientX, clientY.
        tooltipElement.hide(event === null || event === void 0 ? void 0 : event.clientX, event === null || event === void 0 ? void 0 : event.clientY);
    }
    hideRuleY(root);
    hideRuleX(root);
    hideMarker(root);
}
function destroyTooltip({ root, single }) {
    const container = getContainer(root);
    const parent = single ? container : root;
    if (!parent)
        return;
    const { tooltipElement } = parent;
    if (tooltipElement) {
        tooltipElement.destroy();
        parent.tooltipElement = undefined;
    }
    hideRuleY(root);
    hideRuleX(root);
    hideMarker(root);
}
function showUndefined(item) {
    const { value } = item;
    return Object.assign(Object.assign({}, item), { value: value === undefined ? 'undefined' : value });
}
function singleItem(element) {
    const { __data__: datum } = element;
    const { title, items = [] } = datum;
    const newItems = items
        .filter(helper_1.defined)
        .map((_a) => {
        var { color = itemColorOf(element) } = _a, item = __rest(_a, ["color"]);
        return (Object.assign(Object.assign({}, item), { color }));
    })
        .map(showUndefined);
    return Object.assign(Object.assign({}, (title && { title })), { items: newItems });
}
function itemColorOf(element) {
    const fill = element.getAttribute('fill');
    const stroke = element.getAttribute('stroke');
    const { __data__: datum } = element;
    const { color = fill && fill !== 'transparent' ? fill : stroke } = datum;
    return color;
}
function unique(items, key = (d) => d) {
    const valueName = new Map(items.map((d) => [key(d), d]));
    return Array.from(valueName.values());
}
function groupItems(elements, scale, groupName, data = elements.map((d) => d['__data__']), theme = {}) {
    const key = (d) => (d instanceof Date ? +d : d);
    const T = unique(data.map((d) => d.title), key).filter(helper_1.defined);
    const newItems = data
        .flatMap((datum, i) => {
        const element = elements[i];
        const { items = [], title } = datum;
        const definedItems = items.filter(helper_1.defined);
        // If there is only one item, use groupName as title by default.
        const useGroupName = groupName !== undefined ? groupName : items.length <= 1 ? true : false;
        return definedItems.map((_a) => {
            var { color = itemColorOf(element) || theme.color, name } = _a, item = __rest(_a, ["color", "name"]);
            const groupName = (0, helper_1.groupNameOf)(scale, datum);
            // callback's priority is higher than groupName.
            const name1 = useGroupName && !(transform_1.CALLBACK_ITEM_SYMBOL in item)
                ? groupName || name
                : name || groupName;
            return Object.assign(Object.assign({}, item), { color, name: name1 || title });
        });
    })
        .map(showUndefined);
    return Object.assign(Object.assign({}, (T.length > 0 && { title: T.join(',') })), { items: unique(newItems, (d) => `(${key(d.name)}, ${key(d.value)}, ${key(d.color)})`) });
}
function updateRuleX(root, points, mouse, _a) {
    var { plotWidth, plotHeight, mainWidth, mainHeight, startX, startY, transposed, polar, insetLeft, insetTop } = _a, rest = __rest(_a, ["plotWidth", "plotHeight", "mainWidth", "mainHeight", "startX", "startY", "transposed", "polar", "insetLeft", "insetTop"]);
    const defaults = Object.assign({ lineWidth: 1, stroke: '#1b1e23', strokeOpacity: 0.5 }, rest);
    const createCircle = (cx, cy, r) => {
        const circle = new g_1.Circle({
            style: Object.assign({ cx,
                cy,
                r }, defaults),
        });
        root.appendChild(circle);
        return circle;
    };
    const createLine = (x1, x2, y1, y2) => {
        const line = new g_1.Line({
            style: Object.assign({ x1,
                x2,
                y1,
                y2 }, defaults),
        });
        root.appendChild(line);
        return line;
    };
    const minDistPoint = (mouse, points) => {
        // only one point do not need compute
        if (points.length === 1) {
            return points[0];
        }
        const dists = points.map((p) => (0, vector_1.dist)(p, mouse));
        const minDistIndex = (0, d3_array_1.minIndex)(dists, (d) => d);
        return points[minDistIndex];
    };
    const target = minDistPoint(mouse, points);
    const pointsOf = () => {
        if (transposed)
            return [
                startX + target[0],
                startX + target[0],
                startY,
                startY + plotHeight,
            ];
        return [startX, startX + plotWidth, target[1] + startY, target[1] + startY];
    };
    const pointsOfPolar = () => {
        const cx = startX + insetLeft + mainWidth / 2;
        const cy = startY + insetTop + mainHeight / 2;
        const cdist = (0, vector_1.dist)([cx, cy], target);
        return [cx, cy, cdist];
    };
    if (polar) {
        const [cx, cy, r] = pointsOfPolar();
        const ruleX = root.ruleX || createCircle(cx, cy, r);
        ruleX.style.cx = cx;
        ruleX.style.cy = cy;
        ruleX.style.r = r;
        root.ruleX = ruleX;
    }
    else {
        const [x1, x2, y1, y2] = pointsOf();
        const ruleX = root.ruleX || createLine(x1, x2, y1, y2);
        ruleX.style.x1 = x1;
        ruleX.style.x2 = x2;
        ruleX.style.y1 = y1;
        ruleX.style.y2 = y2;
        root.ruleX = ruleX;
    }
}
function updateRuleY(root, points, _a) {
    var { plotWidth, plotHeight, mainWidth, mainHeight, startX, startY, transposed, polar, insetLeft, insetTop } = _a, rest = __rest(_a, ["plotWidth", "plotHeight", "mainWidth", "mainHeight", "startX", "startY", "transposed", "polar", "insetLeft", "insetTop"]);
    const defaults = Object.assign({ lineWidth: 1, stroke: '#1b1e23', strokeOpacity: 0.5 }, rest);
    const Y = points.map((p) => p[1]);
    const X = points.map((p) => p[0]);
    const y = (0, d3_array_1.mean)(Y);
    const x = (0, d3_array_1.mean)(X);
    const pointsOf = () => {
        if (polar) {
            const r = Math.min(mainWidth, mainHeight) / 2;
            const cx = startX + insetLeft + mainWidth / 2;
            const cy = startY + insetTop + mainHeight / 2;
            const a = (0, vector_1.angle)((0, vector_1.sub)([x, y], [cx, cy]));
            const x0 = cx + r * Math.cos(a);
            const y0 = cy + r * Math.sin(a);
            return [cx, x0, cy, y0];
        }
        if (transposed)
            return [startX, startX + plotWidth, y + startY, y + startY];
        return [x + startX, x + startX, startY, startY + plotHeight];
    };
    const [x1, x2, y1, y2] = pointsOf();
    const createLine = () => {
        const line = new g_1.Line({
            style: Object.assign({ x1,
                x2,
                y1,
                y2 }, defaults),
        });
        root.appendChild(line);
        return line;
    };
    // Only update rule with defined series elements.
    if (X.length > 0) {
        const ruleY = root.ruleY || createLine();
        ruleY.style.x1 = x1;
        ruleY.style.x2 = x2;
        ruleY.style.y1 = y1;
        ruleY.style.y2 = y2;
        root.ruleY = ruleY;
    }
}
function hideRuleY(root) {
    if (root.ruleY) {
        root.ruleY.remove();
        root.ruleY = undefined;
    }
}
function hideRuleX(root) {
    if (root.ruleX) {
        root.ruleX.remove();
        root.ruleX = undefined;
    }
}
function updateMarker(root, { data, style, theme }) {
    if (root.markers)
        root.markers.forEach((d) => d.remove());
    const { type = '' } = style;
    const markers = data
        .filter((d) => {
        const [{ x, y }] = d;
        return (0, helper_1.defined)(x) && (0, helper_1.defined)(y);
    })
        .map((d) => {
        const [{ color, element }, point] = d;
        const originColor = color || // encode value
            element.style.fill ||
            element.style.stroke ||
            theme.color;
        const fill = type === 'hollow' ? 'transparent' : originColor;
        const stroke = type === 'hollow' ? originColor : '#fff';
        const shape = new g_1.Circle({
            className: 'g2-tooltip-marker',
            style: Object.assign({ cx: point[0], cy: point[1], fill, r: 4, stroke, lineWidth: 2, 
                // Prevents blocking clicks on elements behind.
                pointerEvents: 'none' }, style),
        });
        return shape;
    });
    for (const marker of markers)
        root.appendChild(marker);
    root.markers = markers;
}
function hideMarker(root) {
    if (root.markers) {
        root.markers.forEach((d) => d.remove());
        root.markers = [];
    }
}
function interactionKeyof(markState, key) {
    return Array.from(markState.values()).some(
    // @ts-ignore
    (d) => { var _a; return (_a = d.interaction) === null || _a === void 0 ? void 0 : _a[key]; });
}
function maybeValue(specified, defaults) {
    return specified === undefined ? defaults : specified;
}
exports.maybeValue = maybeValue;
function isEmptyTooltipData(data) {
    const { title, items } = data;
    if (items.length === 0 && title === undefined)
        return true;
    return false;
}
function hasSeries(markState) {
    return Array.from(markState.values()).some(
    // @ts-ignore
    (d) => { var _a; return ((_a = d.interaction) === null || _a === void 0 ? void 0 : _a.seriesTooltip) && d.tooltip; });
}
/**
 * Finds a single element based on the mouse event in a non-series context (e.g., single item tooltip).
 * @param root - The root display object of the chart.
 * @param event - The mouse event object (e.g., pointermove, pointerdown).
 * @param elements - Array of chart elements to search within.
 * @param coordinate - The coordinate system of the chart (e.g., Cartesian, polar).
 * @param scale - The scale configurations (e.g., x, series scales).
 * @param shared - Whether the tooltip is shared among multiple elements (e.g., grouped bars).
 * @returns The matched display object or `undefined` if no element is found.
 * @description
 * - Handles bar charts by sorting elements and using bisector search for efficient lookup.
 * - For non-bar charts, directly finds the target element from the event's target.
 * - Adjusts for bar spacing in grouped charts when `shared` is false.
 */
function findSingleElement({ root, event, elements, coordinate, scale, shared, }) {
    var _a, _b;
    const inInterval = (d) => d.markType === 'interval';
    const isBar = elements.every(inInterval) && !(0, coordinate_1.isPolar)(coordinate);
    const scaleX = scale.x;
    const scaleSeries = scale.series;
    const bandWidth = (_b = (_a = scaleX === null || scaleX === void 0 ? void 0 : scaleX.getBandWidth) === null || _a === void 0 ? void 0 : _a.call(scaleX)) !== null && _b !== void 0 ? _b : 0;
    const xof = scaleSeries
        ? (d) => {
            const seriesCount = Math.round(1 / scaleSeries.valueBandWidth);
            return (d.__data__.x +
                d.__data__.series * bandWidth +
                bandWidth / (seriesCount * 2));
        }
        : (d) => d.__data__.x + bandWidth / 2;
    // Sort for bisector search.
    if (isBar)
        elements.sort((a, b) => xof(a) - xof(b));
    const findElementByTarget = (event) => {
        const { target } = event;
        return (0, utils_1.maybeRoot)(target, (node) => {
            if (!node.classList)
                return false;
            return node.classList.includes('element');
        });
    };
    const element = isBar
        ? (event) => {
            const mouse = (0, utils_1.mousePosition)(root, event);
            if (!mouse)
                return;
            const [abstractX] = coordinate.invert(mouse);
            const search = (0, d3_array_1.bisector)(xof).center;
            const i = search(elements, abstractX);
            const target = elements[i];
            if (!shared) {
                // For grouped bar chart without shared options.
                const isGrouped = elements.find((d) => d !== target && xof(d) === xof(target));
                if (isGrouped)
                    return findElementByTarget(event);
            }
            return target;
        }
        : findElementByTarget;
    return element(event);
}
exports.findSingleElement = findSingleElement;
/**
 * Finds series-related elements and data based on the mouse event for series tooltips.
 * @param root - The root display object of the chart.
 * @param event - The mouse event object (e.g., pointermove, pointerdown).
 * @param elements - Array of chart elements to search within.
 * @param coordinate - The coordinate system of the chart (e.g., Cartesian, polar).
 * @param scale - The scale configurations (e.g., x, series scales).
 * @param startX - The starting X position of the plot area.
 * @param startY - The starting Y position of the plot area.
 * @returns An object containing:
 * - `selectedElements`: Matched display objects (series and item elements).
 * - `selectedData`: Corresponding data records of the selected elements.
 * - `filteredSeriesData`: Filtered series data closest to the mouse focus.
 * - `abstractX`: A function to convert mouse coordinates to abstract X values.
 * @description
 * - Splits elements into series and item elements for targeted searching.
 * - Handles bar charts and band scales using bisector search and coordinate inversion.
 * - Sorts elements to ensure correct visual ordering (top-to-bottom or right-to-left in transposed mode).
 * - Filters and groups data to provide accurate tooltip information for series.
 */
function findSeriesElement({ root, event, elements, coordinate, scale, startX, startY, }) {
    const transposed = (0, coordinate_1.isTranspose)(coordinate);
    // Split elements into series elements and item elements.
    const seriesElements = [];
    const itemElements = [];
    for (const element of elements) {
        const { __data__: data } = element;
        const { seriesX, title, items } = data;
        if (seriesX)
            seriesElements.push(element);
        else if (title || items)
            itemElements.push(element);
    }
    const inInterval = (d) => d.markType === 'interval';
    const isBar = itemElements.length &&
        itemElements.every(inInterval) &&
        !(0, coordinate_1.isPolar)(coordinate);
    const xof = (d) => d.__data__.x;
    // For band scale x, find the closest series element to focus,
    // useful for interval + line mark.
    const isBandScale = !!scale.x.getBandWidth;
    const closest = isBandScale && itemElements.length > 0;
    // Sorted elements from top to bottom visually,
    // or from right to left in transpose coordinate.
    seriesElements.sort((a, b) => {
        const index = transposed ? 0 : 1;
        const minY = (d) => d.getBounds().min[index];
        return transposed ? minY(b) - minY(a) : minY(a) - minY(b);
    });
    const extent = (d) => {
        const index = transposed ? 1 : 0;
        const { min, max } = d.getLocalBounds();
        return (0, d3_array_1.sort)([min[index], max[index]]);
    };
    // Sort itemElements for bisector search.
    if (isBar)
        elements.sort((a, b) => xof(a) - xof(b));
    else {
        itemElements.sort((a, b) => {
            const [minA, maxA] = extent(a);
            const [minB, maxB] = extent(b);
            const midA = (minA + maxA) / 2;
            const midB = (minB + maxB) / 2;
            return transposed ? midB - midA : midA - midB;
        });
    }
    // Get sortedIndex and X for each series elements
    const elementSortedX = new Map(seriesElements.map((element) => {
        const { __data__: data } = element;
        const { seriesX } = data;
        const seriesIndex = seriesX.map((_, i) => i);
        const sortedIndex = (0, d3_array_1.sort)(seriesIndex, (i) => seriesX[+i]);
        return [element, [sortedIndex, seriesX]];
    }));
    const { x: scaleX } = scale;
    // Apply offset for band scale x.
    const offsetX = (scaleX === null || scaleX === void 0 ? void 0 : scaleX.getBandWidth) ? scaleX.getBandWidth() / 2 : 0;
    const abstractX = (focus) => {
        const [normalizedX] = coordinate.invert(focus);
        return normalizedX - offsetX;
    };
    const indexByFocus = (event, focus, I, X) => {
        // _x is from emit event, to find the right element.
        const { _x } = event;
        const finalX = _x !== undefined ? scaleX.map(_x) : abstractX(focus);
        const DX = X.filter(helper_1.defined);
        const [minX, maxX] = (0, d3_array_1.sort)([DX[0], DX[DX.length - 1]]);
        // If only has one element(minX == maxX), show tooltip when hover whole chart
        const isOnlyOneElement = minX === maxX;
        // If closest is true, always find at least one element.
        // Otherwise, skip element out of plot area.
        if (!closest && (finalX < minX || finalX > maxX) && !isOnlyOneElement)
            return null;
        const search = (0, d3_array_1.bisector)((i) => X[+i]).center;
        const i = search(I, finalX);
        return I[i];
    };
    const elementsByFocus = isBar
        ? (focus, elements) => {
            const search = (0, d3_array_1.bisector)(xof).center;
            const i = search(elements, abstractX(focus));
            const find = elements[i];
            const groups = (0, d3_array_1.group)(elements, xof);
            const selected = groups.get(xof(find));
            return selected;
        }
        : (focus, elements) => {
            const index = transposed ? 1 : 0;
            const x = focus[index];
            const filtered = elements.filter((element) => {
                const [min, max] = extent(element);
                return x >= min && x <= max;
            });
            // If closet is true, always find at least one element.
            if (!closest || filtered.length > 0)
                return filtered;
            // Search the closet element to the focus.
            const search = (0, d3_array_1.bisector)((element) => {
                const [min, max] = extent(element);
                return (min + max) / 2;
            }).center;
            const i = search(elements, x);
            return [elements[i]].filter(helper_1.defined);
        };
    const seriesData = (element, index) => {
        const { __data__: data } = element;
        return Object.fromEntries(Object.entries(data)
            .filter(([key]) => key.startsWith('series') && key !== 'series')
            .map(([key, V]) => {
            const d = V[index];
            return [(0, util_1.lowerFirst)(key.replace('series', '')), d];
        }));
    };
    const mouse = (0, utils_1.mousePosition)(root, event);
    if (!mouse)
        return;
    const focus = [mouse[0] - startX, mouse[1] - startY];
    if (!focus)
        return;
    // Get selected item element.
    const selectedItems = elementsByFocus(focus, itemElements);
    // Get selected data item from both series element and item element.
    const selectedSeriesElements = [];
    const selectedSeriesData = [];
    for (const element of seriesElements) {
        const [sortedIndex, X] = elementSortedX.get(element);
        const index = indexByFocus(event, focus, sortedIndex, X);
        if (index !== null) {
            selectedSeriesElements.push(element);
            const d = seriesData(element, index);
            const { x, y } = d;
            const p = coordinate.map([(x || 0) + offsetX, y || 0]);
            selectedSeriesData.push([Object.assign(Object.assign({}, d), { element }), p]);
        }
    }
    // Filter selectedSeriesData with different x,
    // make sure there is only one x closest to focusX.
    const SX = Array.from(new Set(selectedSeriesData.map((d) => d[0].x)));
    const closestX = SX[(0, d3_array_1.minIndex)(SX, (x) => Math.abs(x - abstractX(focus)))];
    const filteredSeriesData = selectedSeriesData.filter((d) => d[0].x === closestX);
    const selectedData = [
        ...filteredSeriesData.map((d) => d[0]),
        ...selectedItems.map((d) => d.__data__),
    ];
    // Get the displayed tooltip data.
    const selectedElements = [...selectedSeriesElements, ...selectedItems];
    return { selectedElements, selectedData, filteredSeriesData, abstractX };
}
exports.findSeriesElement = findSeriesElement;
/**
 * Show tooltip for series item.
 */
function seriesTooltip(root, _a) {
    var { elements: elementsof, sort: sortFunction, filter: filterFunction, scale, coordinate, crosshairs, crosshairsX, crosshairsY, render, groupName, emitter, wait = 50, leading = true, trailing = false, startX = 0, startY = 0, body = true, single = true, position, enterable, mount, bounding, theme, offset, disableNative = false, marker = true, preserve = false, style: _style = {}, css = {} } = _a, rest = __rest(_a, ["elements", "sort", "filter", "scale", "coordinate", "crosshairs", "crosshairsX", "crosshairsY", "render", "groupName", "emitter", "wait", "leading", "trailing", "startX", "startY", "body", "single", "position", "enterable", "mount", "bounding", "theme", "offset", "disableNative", "marker", "preserve", "style", "css"]);
    const elements = elementsof(root);
    const style = (0, util_1.deepMix)(_style, rest);
    const polar = (0, coordinate_1.isPolar)(coordinate);
    const transposed = (0, coordinate_1.isTranspose)(coordinate);
    const { innerWidth: plotWidth, innerHeight: plotHeight, width: mainWidth, height: mainHeight, insetLeft, insetTop, } = coordinate.getOptions();
    const update = (0, util_1.throttle)((event) => {
        var _a;
        const mouse = (0, utils_1.mousePosition)(root, event);
        if (!mouse)
            return;
        const bbox = (0, utils_1.bboxOf)(root);
        const x = bbox.min[0];
        const y = bbox.min[1];
        const { selectedElements, selectedData, filteredSeriesData, abstractX } = findSeriesElement({
            root,
            event,
            elements,
            coordinate,
            scale,
            startX,
            startY,
        });
        const tooltipData = groupItems(selectedElements, scale, groupName, selectedData, theme);
        // Sort items and filter items.
        if (sortFunction) {
            tooltipData.items.sort((a, b) => sortFunction(a) - sortFunction(b));
        }
        if (filterFunction) {
            tooltipData.items = tooltipData.items.filter(filterFunction);
        }
        // Hide tooltip with no selected tooltip.
        if (selectedElements.length === 0 || isEmptyTooltipData(tooltipData)) {
            hide(event);
            return;
        }
        if (body) {
            showTooltip({
                root,
                data: tooltipData,
                x: mouse[0] + x,
                y: mouse[1] + y,
                render,
                event,
                single,
                position,
                enterable,
                mount,
                bounding,
                css,
                offset,
            });
        }
        if (crosshairs || crosshairsX || crosshairsY) {
            const ruleStyle = (0, helper_1.subObject)(style, 'crosshairs');
            const ruleStyleX = Object.assign(Object.assign({}, ruleStyle), (0, helper_1.subObject)(style, 'crosshairsX'));
            const ruleStyleY = Object.assign(Object.assign({}, ruleStyle), (0, helper_1.subObject)(style, 'crosshairsY'));
            const points = filteredSeriesData.map((d) => d[1]);
            if (crosshairsX) {
                updateRuleX(root, points, mouse, Object.assign(Object.assign({}, ruleStyleX), { plotWidth,
                    plotHeight,
                    mainWidth,
                    mainHeight,
                    insetLeft,
                    insetTop,
                    startX,
                    startY,
                    transposed,
                    polar }));
            }
            if (crosshairsY) {
                updateRuleY(root, points, Object.assign(Object.assign({}, ruleStyleY), { plotWidth,
                    plotHeight,
                    mainWidth,
                    mainHeight,
                    insetLeft,
                    insetTop,
                    startX,
                    startY,
                    transposed,
                    polar }));
            }
        }
        if (marker) {
            const markerStyles = (0, helper_1.subObject)(style, 'marker');
            updateMarker(root, {
                data: filteredSeriesData,
                style: markerStyles,
                theme,
            });
        }
        // X in focus may related multiple points when dataset is large,
        // so we need to find the first x to show tooltip.
        const firstX = (_a = filteredSeriesData[0]) === null || _a === void 0 ? void 0 : _a[0].x;
        const transformedX = firstX !== null && firstX !== void 0 ? firstX : abstractX(focus);
        emitter.emit('tooltip:show', Object.assign(Object.assign({}, event), { nativeEvent: true, data: Object.assign(Object.assign({}, tooltipData), { data: { x: (0, scale_1.invert)(scale.x, transformedX, true) } }) }));
    }, wait, { leading, trailing });
    const hide = (event) => {
        hideTooltip({ root, single, emitter, event });
    };
    const destroy = () => {
        destroyTooltip({ root, single });
    };
    const onTooltipShow = (_a) => {
        var _b;
        var { nativeEvent, data, offsetX, offsetY } = _a, rest = __rest(_a, ["nativeEvent", "data", "offsetX", "offsetY"]);
        if (nativeEvent)
            return;
        const x = (_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.x;
        const scaleX = scale.x;
        const x1 = scaleX.map(x);
        const [x2, y2] = coordinate.map([x1, 0.5]);
        const rootBounds = root.getRenderBounds();
        const minX = rootBounds.min[0];
        const minY = rootBounds.min[1];
        update(Object.assign(Object.assign({}, rest), { offsetX: offsetX !== undefined ? offsetX : minX + x2, offsetY: offsetY !== undefined ? offsetY : minY + y2, _x: x }));
    };
    const onTooltipHide = () => {
        hideTooltip({ root, single, emitter, nativeEvent: false });
    };
    const onTooltipDisable = () => {
        removeEventListeners();
        destroy();
    };
    const onTooltipEnable = () => {
        addEventListeners();
    };
    const addEventListeners = () => {
        if (!disableNative) {
            root.addEventListener('pointerdown', update);
            root.addEventListener('pointerenter', update);
            root.addEventListener('pointermove', update);
            // Only emit pointerleave event when the pointer is not in the root area.
            root.addEventListener('pointerleave', (e) => {
                if ((0, utils_1.mousePosition)(root, e))
                    return;
                hide(e);
            });
            root.addEventListener('pointerup', hide);
        }
    };
    const removeEventListeners = () => {
        if (!disableNative) {
            root.removeEventListener('pointerdown', update);
            root.removeEventListener('pointerenter', update);
            root.removeEventListener('pointermove', update);
            root.removeEventListener('pointerleave', hide);
            root.removeEventListener('pointerup', hide);
        }
    };
    addEventListeners();
    emitter.on('tooltip:show', onTooltipShow);
    emitter.on('tooltip:hide', onTooltipHide);
    emitter.on('tooltip:disable', onTooltipDisable);
    emitter.on('tooltip:enable', onTooltipEnable);
    return () => {
        removeEventListeners();
        emitter.off('tooltip:show', onTooltipShow);
        emitter.off('tooltip:hide', onTooltipHide);
        emitter.off('tooltip:disable', onTooltipDisable);
        emitter.off('tooltip:enable', onTooltipEnable);
        if (preserve) {
            hideTooltip({ root, single, emitter, nativeEvent: false });
        }
        else {
            destroy();
        }
    };
}
exports.seriesTooltip = seriesTooltip;
/**
 * Show tooltip for non-series item.
 */
function tooltip(root, { elements: elementsof, coordinate, scale, render, groupName, sort: sortFunction, filter: filterFunction, emitter, wait = 50, leading = true, trailing = false, groupKey = (d) => d, // group elements by specified key
single = true, position, enterable, datum, view, mount, bounding, theme, offset, shared = false, body = true, disableNative = false, preserve = false, css = {}, }) {
    const elements = elementsof(root);
    const keyGroup = (0, d3_array_1.group)(elements, groupKey);
    const pointermove = (0, util_1.throttle)((event) => {
        const element = findSingleElement({
            root,
            event,
            elements,
            coordinate,
            scale,
            shared,
        });
        if (!element) {
            hideTooltip({ root, single, emitter, event });
            return;
        }
        const k = groupKey(element);
        const group = keyGroup.get(k);
        if (!group) {
            return;
        }
        const data = group.length === 1 && !shared
            ? singleItem(group[0])
            : groupItems(group, scale, groupName, undefined, theme);
        // Sort items and sort.
        if (sortFunction) {
            data.items.sort((a, b) => sortFunction(a) - sortFunction(b));
        }
        if (filterFunction) {
            data.items = data.items.filter(filterFunction);
        }
        if (isEmptyTooltipData(data)) {
            hideTooltip({ root, single, emitter, event });
            return;
        }
        const { offsetX, offsetY } = event;
        if (body) {
            showTooltip({
                root,
                data,
                x: offsetX,
                y: offsetY,
                render,
                event,
                single,
                position,
                enterable,
                mount,
                bounding,
                css,
                offset,
            });
        }
        emitter.emit('tooltip:show', Object.assign(Object.assign({}, event), { nativeEvent: true, data: Object.assign(Object.assign({}, data), { data: (0, helper_1.dataOf)(element, view) }) }));
    }, wait, { leading, trailing });
    const pointerleave = (event) => {
        hideTooltip({ root, single, emitter, event });
    };
    const addEventListeners = () => {
        if (!disableNative) {
            root.addEventListener('pointerdown', pointermove);
            root.addEventListener('pointermove', pointermove);
            // Only emit pointerleave event when the pointer is not in the root area.
            // !!!DO NOT USE pointerout event, it will emit when the pointer is in the child area.
            root.addEventListener('pointerleave', pointerleave);
            root.addEventListener('pointerup', pointerleave);
        }
    };
    const removeEventListeners = () => {
        if (!disableNative) {
            root.removeEventListener('pointerdown', pointermove);
            root.removeEventListener('pointermove', pointermove);
            root.removeEventListener('pointerleave', pointerleave);
            root.removeEventListener('pointerup', pointerleave);
        }
    };
    const onTooltipShow = ({ nativeEvent, offsetX, offsetY, data: raw }) => {
        if (nativeEvent)
            return;
        const { data } = raw;
        const element = (0, utils_1.selectElementByData)(elements, data, datum);
        if (!element)
            return;
        const bbox = element.getBBox();
        const { x, y, width, height } = bbox;
        const rootBBox = root.getBBox();
        pointermove({
            target: element,
            offsetX: offsetX !== undefined ? offsetX + rootBBox.x : x + width / 2,
            offsetY: offsetY !== undefined ? offsetY + rootBBox.y : y + height / 2,
        });
    };
    const onTooltipHide = ({ nativeEvent } = {}) => {
        if (nativeEvent)
            return;
        hideTooltip({ root, single, emitter, nativeEvent: false });
    };
    const onTooltipDisable = () => {
        removeEventListeners();
        destroyTooltip({ root, single });
    };
    const onTooltipEnable = () => {
        addEventListeners();
    };
    emitter.on('tooltip:show', onTooltipShow);
    emitter.on('tooltip:hide', onTooltipHide);
    emitter.on('tooltip:enable', onTooltipEnable);
    emitter.on('tooltip:disable', onTooltipDisable);
    addEventListeners();
    return () => {
        removeEventListeners();
        emitter.off('tooltip:show', onTooltipShow);
        emitter.off('tooltip:hide', onTooltipHide);
        if (preserve) {
            hideTooltip({ root, single, emitter, nativeEvent: false });
        }
        else {
            destroyTooltip({ root, single });
        }
    };
}
exports.tooltip = tooltip;
function Tooltip(options) {
    const { shared, crosshairs, crosshairsX, crosshairsY, series, name, item = () => ({}), facet = false } = options, rest = __rest(options, ["shared", "crosshairs", "crosshairsX", "crosshairsY", "series", "name", "item", "facet"]);
    return (target, viewInstances, emitter) => {
        const { container, view } = target;
        const { scale, markState, coordinate, theme } = view;
        // Get default value from mark states.
        const defaultSeries = interactionKeyof(markState, 'seriesTooltip');
        const defaultShowCrosshairs = interactionKeyof(markState, 'crosshairs');
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const isSeries = maybeValue(series, defaultSeries);
        const crosshairsSetting = maybeValue(crosshairs, defaultShowCrosshairs);
        // For non-facet and series tooltip.
        if (isSeries && hasSeries(markState) && !facet) {
            return seriesTooltip(plotArea, Object.assign(Object.assign({}, rest), { theme, elements: utils_1.selectG2Elements, scale,
                coordinate, crosshairs: crosshairsSetting, 
                // the crosshairsX settings level: crosshairsX > crosshairs > false
                // it means crosshairsX default is false
                crosshairsX: maybeValue(maybeValue(crosshairsX, crosshairs), false), 
                // crosshairsY default depend on the crossharisSettings
                crosshairsY: maybeValue(crosshairsY, crosshairsSetting), item,
                emitter }));
        }
        // For facet and series tooltip.
        if (isSeries && facet) {
            // Get sub view instances for this view.
            const facetInstances = viewInstances.filter((d) => d !== target && d.options.parentKey === target.options.key);
            const elements = (0, utils_1.selectFacetG2Elements)(target, viewInstances);
            // Use the scale of the first view.
            const scale = facetInstances[0].view.scale;
            const bbox = plotArea.getBounds();
            const startX = bbox.min[0];
            const startY = bbox.min[1];
            Object.assign(scale, { facet: true });
            // @todo Nested structure rather than flat structure for facet?
            // Add listener to the root area.
            // @ts-ignore
            return seriesTooltip(plotArea.parentNode.parentNode, Object.assign(Object.assign({}, rest), { theme, elements: () => elements, scale,
                coordinate, crosshairs: maybeValue(crosshairs, defaultShowCrosshairs), 
                // the crosshairsX settings level: crosshairsX > crosshairs > false
                // it means crosshairsX default is false
                crosshairsX: maybeValue(maybeValue(crosshairsX, crosshairs), false), crosshairsY: maybeValue(crosshairsY, crosshairsSetting), item,
                startX,
                startY,
                emitter }));
        }
        return tooltip(plotArea, Object.assign(Object.assign({}, rest), { datum: (0, utils_1.createDatumof)(view), elements: utils_1.selectG2Elements, scale,
            coordinate, groupKey: shared ? (0, utils_1.createXKey)(view) : undefined, item,
            emitter,
            view,
            theme,
            shared }));
    };
}
exports.Tooltip = Tooltip;
Tooltip.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=tooltip.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/coordinate":1751263815882,"../utils/vector":1751263815873,"../utils/scale":1751263816057,"../runtime/transform":1751263816118,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816132, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendFilter = exports.attributesOf = exports.dataOf = exports.legendClearSetState = exports.legendsContinuousOf = exports.legendsOf = exports.itemsOf = exports.labelOf = exports.markerOf = exports.LEGEND_LABEL_CLASS_NAME = exports.LEGEND_MAKER_CLASS_NAME = exports.LEGEND_ITEMS_CLASS_NAME = exports.CONTINUOUS_LEGEND_CLASS_NAME = exports.CATEGORY_LEGEND_CLASS_NAME = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
exports.CATEGORY_LEGEND_CLASS_NAME = 'legend-category';
exports.CONTINUOUS_LEGEND_CLASS_NAME = 'legend-continuous';
exports.LEGEND_ITEMS_CLASS_NAME = 'items-item';
exports.LEGEND_MAKER_CLASS_NAME = 'legend-category-item-marker';
exports.LEGEND_LABEL_CLASS_NAME = 'legend-category-item-label';
function markerOf(item) {
    return item.getElementsByClassName(exports.LEGEND_MAKER_CLASS_NAME)[0];
}
exports.markerOf = markerOf;
function labelOf(item) {
    return item.getElementsByClassName(exports.LEGEND_LABEL_CLASS_NAME)[0];
}
exports.labelOf = labelOf;
function itemsOf(root) {
    return root.getElementsByClassName(exports.LEGEND_ITEMS_CLASS_NAME);
}
exports.itemsOf = itemsOf;
function legendsOf(root) {
    return root.getElementsByClassName(exports.CATEGORY_LEGEND_CLASS_NAME);
}
exports.legendsOf = legendsOf;
function legendsContinuousOf(root) {
    return root.getElementsByClassName(exports.CONTINUOUS_LEGEND_CLASS_NAME);
}
exports.legendsContinuousOf = legendsContinuousOf;
function legendClearSetState(root, setState) {
    const legends = [...legendsOf(root), ...legendsContinuousOf(root)];
    legends.forEach((legend) => {
        setState(legend, (v) => v);
    });
}
exports.legendClearSetState = legendClearSetState;
function dataOf(root) {
    // legend -> layout -> container
    let parent = root.parentNode;
    while (parent && !parent.__data__) {
        parent = parent.parentNode;
    }
    return parent.__data__;
}
exports.dataOf = dataOf;
function attributesOf(root) {
    let child = root;
    while (child && !child.attr('class').startsWith('legend')) {
        child = child.children[0];
    }
    return child.attributes;
}
exports.attributesOf = attributesOf;
function legendFilterOrdinal(root, { legends, // given the root of chart returns legends to be manipulated
marker: markerOf, // given the legend returns the marker
label: labelOf, // given the legend returns the label
datum, // given the legend returns the value
filter, // invoke when dispatch filter event,
emitter, channel, state = {}, // state options
 }) {
    // Index handler by item.
    const itemClick = new Map();
    const itemPointerenter = new Map();
    const itemPointerout = new Map();
    const { unselected = {
        markerStroke: '#aaa',
        markerFill: '#aaa',
        labelFill: '#aaa',
    }, } = state;
    const markerStyle = { unselected: (0, helper_1.subObject)(unselected, 'marker') };
    const labelStyle = { unselected: (0, helper_1.subObject)(unselected, 'label') };
    const { setState: setM, removeState: removeM } = (0, utils_1.useState)(markerStyle, undefined);
    const { setState: setL, removeState: removeL } = (0, utils_1.useState)(labelStyle, undefined);
    const items = Array.from(legends(root));
    let selectedValues = items.map(datum);
    const updateLegendState = () => {
        for (const item of items) {
            const value = datum(item);
            const marker = markerOf(item);
            const label = labelOf(item);
            if (!selectedValues.includes(value)) {
                setM(marker, 'unselected');
                setL(label, 'unselected');
            }
            else {
                removeM(marker, 'unselected');
                removeL(label, 'unselected');
            }
        }
    };
    for (const item of items) {
        // Defined handlers.
        const pointerenter = () => {
            (0, utils_1.setCursor)(root, 'pointer');
        };
        const pointerout = () => {
            (0, utils_1.restoreCursor)(root);
        };
        const click = (event) => __awaiter(this, void 0, void 0, function* () {
            const value = datum(item);
            const index = selectedValues.indexOf(value);
            if (index === -1)
                selectedValues.push(value);
            else
                selectedValues.splice(index, 1);
            yield filter(selectedValues);
            updateLegendState();
            const { nativeEvent = true } = event;
            if (!nativeEvent)
                return;
            if (selectedValues.length === items.length) {
                emitter.emit('legend:reset', { nativeEvent });
            }
            else {
                // Emit events.
                emitter.emit('legend:filter', Object.assign(Object.assign({}, event), { nativeEvent, data: {
                        channel,
                        values: selectedValues,
                    } }));
            }
        });
        // Bind and store handlers.
        item.addEventListener('click', click);
        item.addEventListener('pointerenter', pointerenter);
        item.addEventListener('pointerout', pointerout);
        itemClick.set(item, click);
        itemPointerenter.set(item, pointerenter);
        itemPointerout.set(item, pointerout);
    }
    const onFilter = (event) => __awaiter(this, void 0, void 0, function* () {
        const { nativeEvent } = event;
        if (nativeEvent)
            return;
        const { data } = event;
        const { channel: specifiedChannel, values } = data;
        if (specifiedChannel !== channel)
            return;
        selectedValues = values;
        yield filter(selectedValues);
        updateLegendState();
    });
    const onEnd = (event) => __awaiter(this, void 0, void 0, function* () {
        const { nativeEvent } = event;
        if (nativeEvent)
            return;
        selectedValues = items.map(datum);
        yield filter(selectedValues);
        updateLegendState();
    });
    emitter.on('legend:filter', onFilter);
    emitter.on('legend:reset', onEnd);
    return () => {
        for (const item of items) {
            item.removeEventListener('click', itemClick.get(item));
            item.removeEventListener('pointerenter', itemPointerenter.get(item));
            item.removeEventListener('pointerout', itemPointerout.get(item));
            emitter.off('legend:filter', onFilter);
            emitter.off('legend:reset', onEnd);
        }
    };
}
function legendFilterContinuous(_, { legend, filter, emitter, channel }) {
    const onValueChange = ({ detail: { value } }) => {
        filter(value);
        emitter.emit({
            nativeEvent: true,
            data: {
                channel,
                values: value,
            },
        });
    };
    legend.addEventListener('valuechange', onValueChange);
    return () => {
        legend.removeEventListener('valuechange', onValueChange);
    };
}
function filterView(context, // View instance,
{ legend, // Legend instance.
channel, // Filter Channel.
value, // Filtered Values.
ordinal, // Data type of the legend.
channels, // Channels for this legend.
allChannels, // Channels for all legends.
facet = false, // For facet.
 }) {
    return __awaiter(this, void 0, void 0, function* () {
        const { view, update, setState } = context;
        setState(legend, (viewOptions) => {
            const { marks } = viewOptions;
            // Add filter transform for every marks,
            // which will skip for mark without color channel.
            const newMarks = marks.map((mark) => {
                if (mark.type === 'legends')
                    return mark;
                // Inset after aggregate transform, such as group, and bin.
                const { transform = [], data = [] } = mark;
                const index = transform.findIndex(({ type }) => type.startsWith('group') || type.startsWith('bin'));
                const newTransform = [...transform];
                if (data.length) {
                    newTransform.splice(index + 1, 0, {
                        type: 'filter',
                        [channel]: { value, ordinal },
                    });
                }
                // Set domain of scale to preserve encoding.
                const newScale = Object.fromEntries(channels.map((channel) => [
                    channel,
                    { domain: view.scale[channel].getOptions().domain },
                ]));
                return (0, util_1.deepMix)({}, mark, Object.assign(Object.assign({ transform: newTransform, scale: newScale }, (!ordinal && { animate: false })), { legend: facet
                        ? false
                        : Object.fromEntries(allChannels.map((d) => [d, { preserve: true }])) }));
            });
            return Object.assign(Object.assign({}, viewOptions), { marks: newMarks });
        });
        yield update();
    });
}
function filterFacets(facets, options) {
    for (const facet of facets) {
        filterView(facet, Object.assign(Object.assign({}, options), { facet: true }));
    }
}
function LegendFilter() {
    return (context, contexts, emitter) => {
        const { container } = context;
        const facets = contexts.filter((d) => d !== context);
        const isFacet = facets.length > 0;
        const channelsOf = (legend) => {
            return dataOf(legend).scales.map((d) => d.name);
        };
        const legends = [
            ...legendsOf(container),
            ...legendsContinuousOf(container),
        ];
        const allChannels = legends.flatMap(channelsOf);
        const filter = isFacet
            ? (0, util_1.throttle)(filterFacets, 50, { trailing: true })
            : (0, util_1.throttle)(filterView, 50, { trailing: true });
        const removes = legends.map((legend) => {
            const { name: channel, domain } = dataOf(legend).scales[0];
            const channels = channelsOf(legend);
            const common = {
                legend,
                channel,
                channels,
                allChannels,
            };
            if (legend.className === exports.CATEGORY_LEGEND_CLASS_NAME) {
                return legendFilterOrdinal(container, {
                    legends: itemsOf,
                    marker: markerOf,
                    label: labelOf,
                    datum: (d) => {
                        const { __data__: datum } = d;
                        const { index } = datum;
                        return domain[index];
                    },
                    filter: (value) => {
                        const options = Object.assign(Object.assign({}, common), { value, ordinal: true });
                        if (isFacet)
                            filter(facets, options);
                        else
                            filter(context, options);
                    },
                    state: legend.attributes.state,
                    channel,
                    emitter,
                });
            }
            else {
                return legendFilterContinuous(container, {
                    legend,
                    filter: (value) => {
                        const options = Object.assign(Object.assign({}, common), { value, ordinal: false });
                        if (isFacet)
                            filter(facets, options);
                        else
                            filter(context, options);
                    },
                    emitter,
                    channel,
                });
            }
        });
        return () => {
            removes.forEach((remove) => remove());
        };
    };
}
exports.LegendFilter = LegendFilter;
//# sourceMappingURL=legendFilter.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816133, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegendHighlight = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
const legendFilter_1 = require("./legendFilter");
function LegendHighlight() {
    return (context, _, emitter) => {
        const { container, view, options } = context;
        const legends = (0, legendFilter_1.legendsOf)(container);
        const elements = (0, utils_1.selectG2Elements)(container);
        const channelOf = (legend) => {
            return (0, legendFilter_1.dataOf)(legend).scales[0].name;
        };
        const scaleOf = (channel) => {
            const { scale: { [channel]: scale }, } = view;
            return scale;
        };
        const markState = (0, utils_1.mergeState)(options, ['active', 'inactive']);
        const valueof = (0, utils_1.createValueof)(elements, (0, utils_1.createDatumof)(view));
        const destroys = [];
        // Bind events for each legend.
        for (const legend of legends) {
            const datumOf = (item) => {
                const { data } = legend.attributes;
                const { __data__: datum } = item;
                const { index } = datum;
                return data[index].label;
            };
            const channel = channelOf(legend);
            const items = (0, legendFilter_1.itemsOf)(legend);
            const scale = scaleOf(channel);
            const elementGroup = (0, d3_array_1.group)(elements, (d) => scale.invert(d.__data__[channel]));
            const { state: legendState = {} } = legend.attributes;
            const { inactive = {} } = legendState;
            const { setState, removeState } = (0, utils_1.useState)(markState, valueof);
            // Handle styles of inner item.
            const markerStyle = { inactive: (0, helper_1.subObject)(inactive, 'marker') };
            const labelStyle = { inactive: (0, helper_1.subObject)(inactive, 'label') };
            const { setState: setM, removeState: removeM } = (0, utils_1.useState)(markerStyle);
            const { setState: setL, removeState: removeL } = (0, utils_1.useState)(labelStyle);
            const updateLegendState = (highlight) => {
                for (const item of items) {
                    const marker = (0, legendFilter_1.markerOf)(item);
                    const label = (0, legendFilter_1.labelOf)(item);
                    if (item === highlight || highlight === null) {
                        removeM(marker, 'inactive');
                        removeL(label, 'inactive');
                    }
                    else {
                        setM(marker, 'inactive');
                        setL(label, 'inactive');
                    }
                }
            };
            const highlightItem = (event, item) => {
                // Update UI.
                const value = datumOf(item);
                const elementSet = new Set(elementGroup.get(value));
                for (const e of elements) {
                    if (elementSet.has(e))
                        setState(e, 'active');
                    else
                        setState(e, 'inactive');
                }
                updateLegendState(item);
                // Emit events.
                const { nativeEvent = true } = event;
                if (!nativeEvent)
                    return;
                emitter.emit('legend:highlight', Object.assign(Object.assign({}, event), { nativeEvent, data: { channel, value } }));
            };
            const itemPointerover = new Map();
            // Add listener for the legend items.
            for (const item of items) {
                const pointerover = (event) => {
                    highlightItem(event, item);
                };
                item.addEventListener('pointerover', pointerover);
                itemPointerover.set(item, pointerover);
            }
            // Add listener for the legend group.
            const pointerleave = (event) => {
                for (const e of elements)
                    removeState(e, 'inactive', 'active');
                updateLegendState(null);
                // Emit events.
                const { nativeEvent = true } = event;
                if (!nativeEvent)
                    return;
                emitter.emit('legend:unhighlight', { nativeEvent });
            };
            const onHighlight = (event) => {
                const { nativeEvent, data } = event;
                if (nativeEvent)
                    return;
                const { channel: specifiedChannel, value } = data;
                if (specifiedChannel !== channel)
                    return;
                const item = items.find((d) => datumOf(d) === value);
                if (!item)
                    return;
                highlightItem({ nativeEvent: false }, item);
            };
            const onUnHighlight = (event) => {
                const { nativeEvent } = event;
                if (nativeEvent)
                    return;
                pointerleave({ nativeEvent: false });
            };
            legend.addEventListener('pointerleave', pointerleave);
            emitter.on('legend:highlight', onHighlight);
            emitter.on('legend:unhighlight', onUnHighlight);
            const destroy = () => {
                legend.removeEventListener(pointerleave);
                emitter.off('legend:highlight', onHighlight);
                emitter.off('legend:unhighlight', onUnHighlight);
                for (const [item, pointerover] of itemPointerover) {
                    item.removeEventListener(pointerover);
                }
            };
            destroys.push(destroy);
        }
        return () => destroys.forEach((d) => d());
    };
}
exports.LegendHighlight = LegendHighlight;
//# sourceMappingURL=legendHighlight.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils":1751263816080,"./legendFilter":1751263816132}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816134, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushHighlight = exports.brushHighlight = exports.brush = void 0;
const g_1 = require("@antv/g");
const helper_1 = require("../utils/helper");
const scale_1 = require("../utils/scale");
const createElement_1 = require("../utils/createElement");
const selection_1 = require("../utils/selection");
const utils_1 = require("./utils");
function intersect(bbox1, bbox2) {
    const [minX1, minY1, maxX1, maxY1] = bbox1;
    const [minX2, minY2, maxX2, maxY2] = bbox2;
    return !(minX2 > maxX1 || maxX2 < minX1 || minY2 > maxY1 || maxY2 < minY1);
}
function normalizeBounds(x, y, x1, y1, extent) {
    const [minX, minY, maxX, maxY] = extent;
    return [
        Math.max(minX, Math.min(x, x1)),
        Math.max(minY, Math.min(y, y1)),
        Math.min(maxX, Math.max(x, x1)),
        Math.min(maxY, Math.max(y, y1)),
    ];
}
function bboxOf(root) {
    const { width, height } = root.getBBox();
    return [0, 0, width, height];
}
function applyStyle(selection, style) {
    for (const [key, value] of Object.entries(style)) {
        selection.style(key, value);
    }
}
const ResizableMask = (0, createElement_1.createElement)((g) => {
    const _a = g.attributes, { x, y, width, height, class: className, renders = {}, handleSize: size = 10, document } = _a, style = __rest(_a, ["x", "y", "width", "height", "class", "renders", "handleSize", "document"]);
    if (!document ||
        width === undefined ||
        height === undefined ||
        x === undefined ||
        y === undefined)
        return;
    const half = size / 2;
    const renderRect = (g, options, document) => {
        if (!g.handle) {
            g.handle = document.createElement('rect');
            g.append(g.handle);
        }
        const { handle } = g;
        handle.attr(options);
        return handle;
    };
    const _b = (0, helper_1.subObject)((0, helper_1.omitPrefixObject)(style, 'handleNW', 'handleNE'), 'handleN'), { render: handleNRender = renderRect } = _b, handleNStyle = __rest(_b, ["render"]);
    const _c = (0, helper_1.subObject)(style, 'handleE'), { render: handleERender = renderRect } = _c, handleEStyle = __rest(_c, ["render"]);
    const _d = (0, helper_1.subObject)((0, helper_1.omitPrefixObject)(style, 'handleSE', 'handleSW'), 'handleS'), { render: handleSRender = renderRect } = _d, handleSStyle = __rest(_d, ["render"]);
    const _e = (0, helper_1.subObject)(style, 'handleW'), { render: handleWRender = renderRect } = _e, handleWStyle = __rest(_e, ["render"]);
    const _f = (0, helper_1.subObject)(style, 'handleNW'), { render: handleNWRender = renderRect } = _f, handleNWStyle = __rest(_f, ["render"]);
    const _g = (0, helper_1.subObject)(style, 'handleNE'), { render: handleNERender = renderRect } = _g, handleNEStyle = __rest(_g, ["render"]);
    const _h = (0, helper_1.subObject)(style, 'handleSE'), { render: handleSERender = renderRect } = _h, handleSEStyle = __rest(_h, ["render"]);
    const _j = (0, helper_1.subObject)(style, 'handleSW'), { render: handleSWRender = renderRect } = _j, handleSWStyle = __rest(_j, ["render"]);
    const renderHandle = (g, renderNode) => {
        const { id } = g;
        const handle = renderNode(g, g.attributes, document);
        handle.id = id;
        handle.style.draggable = true;
    };
    const appendHandle = (handleRender) => {
        return () => {
            const Node = (0, createElement_1.createElement)((g) => renderHandle(g, handleRender));
            return new Node({});
        };
    };
    const container = (0, selection_1.select)(g)
        .attr('className', className)
        .style('transform', `translate(${x}, ${y})`)
        .style('draggable', true);
    container
        .maybeAppend('selection', 'rect')
        .style('draggable', true)
        .style('fill', 'transparent')
        .call(applyStyle, Object.assign(Object.assign({ width,
        height }, (0, helper_1.omitPrefixObject)(style, 'handle')), { transform: undefined }));
    container
        .maybeAppend('handle-n', appendHandle(handleNRender))
        .style('x', half)
        .style('y', -half)
        .style('width', width - size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleNStyle);
    container
        .maybeAppend('handle-e', appendHandle(handleERender))
        .style('x', width - half)
        .style('y', half)
        .style('width', size)
        .style('height', height - size)
        .style('fill', 'transparent')
        .call(applyStyle, handleEStyle);
    container
        .maybeAppend('handle-s', appendHandle(handleSRender))
        .style('x', half)
        .style('y', height - half)
        .style('width', width - size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleSStyle);
    container
        .maybeAppend('handle-w', appendHandle(handleWRender))
        .style('x', -half)
        .style('y', half)
        .style('width', size)
        .style('height', height - size)
        .style('fill', 'transparent')
        .call(applyStyle, handleWStyle);
    container
        .maybeAppend('handle-nw', appendHandle(handleNWRender))
        .style('x', -half)
        .style('y', -half)
        .style('width', size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleNWStyle);
    container
        .maybeAppend('handle-ne', appendHandle(handleNERender))
        .style('x', width - half)
        .style('y', -half)
        .style('width', size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleNEStyle);
    container
        .maybeAppend('handle-se', appendHandle(handleSERender))
        .style('x', width - half)
        .style('y', height - half)
        .style('width', size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleSEStyle);
    container
        .maybeAppend('handle-sw', appendHandle(handleSWRender))
        .style('x', -half)
        .style('y', height - half)
        .style('width', size)
        .style('height', size)
        .style('fill', 'transparent')
        .call(applyStyle, handleSWStyle);
});
function brush(root, _a) {
    var { brushed = () => { }, brushended = () => { }, brushcreated = () => { }, brushstarted = () => { }, brushupdated = () => { }, extent = bboxOf(root), brushRegion = (x, y, x1, y1, extent) => [x, y, x1, y1], reverse = false, fill = '#777', fillOpacity = '0.3', stroke = '#fff', selectedHandles = [
        'handle-n',
        'handle-e',
        'handle-s',
        'handle-w',
        'handle-nw',
        'handle-ne',
        'handle-se',
        'handle-sw',
    ] } = _a, style = __rest(_a, ["brushed", "brushended", "brushcreated", "brushstarted", "brushupdated", "extent", "brushRegion", "reverse", "fill", "fillOpacity", "stroke", "selectedHandles"]);
    let start = null; // Start point of mask.
    let end = null; // End point of mask.
    let moveStart = null; // Start point of moving mask.
    let mask = null; // Mask instance.
    let background = null;
    let creating = false;
    const [originX, originY, width, height] = extent;
    (0, utils_1.setCursor)(root, 'crosshair');
    root.style.draggable = true; // Make it response to drag event.
    // Remove old mask and init new mask.
    const initMask = (x, y, event) => {
        brushstarted(event);
        if (mask)
            mask.remove();
        if (background)
            background.remove();
        start = [x, y];
        if (reverse)
            return initReverseMask();
        initNormalMask();
    };
    const initReverseMask = () => {
        background = new g_1.Path({
            style: Object.assign(Object.assign({}, style), { fill,
                fillOpacity,
                stroke, pointerEvents: 'none' }),
        });
        mask = new ResizableMask({
            // @ts-ignore
            style: {
                x: 0,
                y: 0,
                width: 0,
                height: 0,
                draggable: true,
                document: root.ownerDocument,
            },
            className: 'mask',
        });
        root.appendChild(background);
        root.appendChild(mask);
    };
    const initNormalMask = () => {
        mask = new ResizableMask({
            // @ts-ignore
            style: Object.assign(Object.assign({ document: root.ownerDocument, x: 0, y: 0 }, style), { fill,
                fillOpacity,
                stroke, draggable: true }),
            className: 'mask',
        });
        root.appendChild(mask);
    };
    // Remove mask and reset states.
    const removeMask = (emit = true) => {
        if (mask)
            mask.remove();
        if (background)
            background.remove();
        start = null;
        end = null;
        moveStart = null;
        creating = false;
        mask = null;
        background = null;
        brushended(emit);
    };
    // Update mask and invoke brushended callback.
    const updateMask = (start, end, emit = true) => {
        const [x, y, x1, y1] = normalizeBounds(start[0], start[1], end[0], end[1], extent);
        const [fx, fy, fx1, fy1] = brushRegion(x, y, x1, y1, extent);
        if (reverse)
            updateReverseMask(fx, fy, fx1, fy1);
        else
            updateNormalMask(fx, fy, fx1, fy1);
        brushed(fx, fy, fx1, fy1, emit);
        return [fx, fy, fx1, fy1];
    };
    const updateNormalMask = (x, y, x1, y1) => {
        mask.style.x = x;
        mask.style.y = y;
        mask.style.width = x1 - x;
        mask.style.height = y1 - y;
    };
    const updateReverseMask = (x, y, x1, y1) => {
        background.style.d = `
      M${originX},${originY}L${width},${originY}L${width},${height}L${originX},${height}Z
      M${x},${y}L${x},${y1}L${x1},${y1}L${x1},${y}Z
    `;
        mask.style.x = x;
        mask.style.y = y;
        mask.style.width = x1 - x;
        mask.style.height = y1 - y;
    };
    // Move and update mask.
    const moveMask = (current) => {
        const clip = (dt, start, end, min, max) => {
            if (dt + start < min)
                return min - start;
            if (dt + end > max)
                return max - end;
            return dt;
        };
        const dx = current[0] - moveStart[0];
        const dy = current[1] - moveStart[1];
        const dx1 = clip(dx, start[0], end[0], originX, width);
        const dy1 = clip(dy, start[1], end[1], originY, height);
        const currentStart = [start[0] + dx1, start[1] + dy1];
        const currentEnd = [end[0] + dx1, end[1] + dy1];
        updateMask(currentStart, currentEnd);
    };
    const handles = {
        'handle-n': { vector: [0, 1, 0, 0], cursor: 'ns-resize' },
        'handle-e': { vector: [0, 0, 1, 0], cursor: 'ew-resize' },
        'handle-s': { vector: [0, 0, 0, 1], cursor: 'ns-resize' },
        'handle-w': { vector: [1, 0, 0, 0], cursor: 'ew-resize' },
        'handle-nw': { vector: [1, 1, 0, 0], cursor: 'nwse-resize' },
        'handle-ne': { vector: [0, 1, 1, 0], cursor: 'nesw-resize' },
        'handle-se': { vector: [0, 0, 1, 1], cursor: 'nwse-resize' },
        'handle-sw': { vector: [1, 0, 0, 1], cursor: 'nesw-resize' },
    };
    const isMask = (target) => {
        return isSelection(target) || isHandle(target);
    };
    const isHandle = (target) => {
        const { id } = target;
        if (selectedHandles.indexOf(id) === -1)
            return false;
        return new Set(Object.keys(handles)).has(id);
    };
    const isSelection = (target) => {
        return target === mask.getElementById('selection');
    };
    // If target is plot area, create mask.
    // If target is mask, about to update position.
    const dragstart = (event) => {
        const { target } = event;
        const [offsetX, offsetY] = (0, utils_1.brushMousePosition)(root, event);
        if (!mask || !isMask(target)) {
            initMask(offsetX, offsetY, event);
            creating = true;
            return;
        }
        if (isMask(target)) {
            moveStart = [offsetX, offsetY];
        }
    };
    const drag = (event) => {
        const { target } = event;
        const mouse = (0, utils_1.brushMousePosition)(root, event);
        if (!start)
            return;
        // If target is plot area, resize mask.
        if (!moveStart)
            return updateMask(start, mouse);
        // If target is selection area, move mask.
        if (isSelection(target))
            return moveMask(mouse);
        // If target is handle area, resize mask.
        const [dx, dy] = [mouse[0] - moveStart[0], mouse[1] - moveStart[1]];
        const { id } = target;
        if (handles[id]) {
            const [sx, sy, ex, ey] = handles[id].vector;
            return updateMask([start[0] + dx * sx, start[1] + dy * sy], [end[0] + dx * ex, end[1] + dy * ey]);
        }
    };
    // If target is plot area, finish creating.
    // If target is mask, finish moving mask.
    const dragend = (event) => {
        if (moveStart) {
            moveStart = null;
            // Update start and end;
            const { x, y, width, height } = mask.style;
            start = [x, y];
            end = [x + width, y + height];
            brushupdated(x, y, x + width, y + height, event);
            return;
        }
        end = (0, utils_1.brushMousePosition)(root, event);
        const [fx, fy, fx1, fy1] = updateMask(start, end);
        creating = false;
        brushcreated(fx, fy, fx1, fy1, event);
    };
    // Hide mask.
    const click = (event) => {
        const { target } = event;
        if (mask && !isMask(target))
            removeMask();
    };
    // Update cursor depends on hovered element.
    const pointermove = (event) => {
        const { target } = event;
        if (!mask || !isMask(target) || creating)
            (0, utils_1.setCursor)(root, 'crosshair');
        else if (isSelection(target))
            (0, utils_1.setCursor)(root, 'move');
        else if (isHandle(target))
            (0, utils_1.setCursor)(root, handles[target.id].cursor);
    };
    const pointerleave = () => {
        (0, utils_1.setCursor)(root, 'default');
    };
    root.addEventListener('dragstart', dragstart);
    root.addEventListener('drag', drag);
    root.addEventListener('dragend', dragend);
    root.addEventListener('click', click);
    root.addEventListener('pointermove', pointermove);
    root.addEventListener('pointerleave', pointerleave);
    return {
        mask,
        move(x, y, x1, y1, emit = true) {
            if (!mask)
                initMask(x, y, {});
            start = [x, y];
            end = [x1, y1];
            updateMask([x, y], [x1, y1], emit);
        },
        remove(emit = true) {
            if (mask)
                removeMask(emit);
        },
        destroy() {
            // Do not emit brush:end event.
            if (mask)
                removeMask(false);
            (0, utils_1.setCursor)(root, 'default');
            root.removeEventListener('dragstart', dragstart);
            root.removeEventListener('drag', drag);
            root.removeEventListener('dragend', dragend);
            root.removeEventListener('click', click);
            root.removeEventListener('pointermove', pointermove);
            root.removeEventListener('pointerleave', pointerleave);
        },
    };
}
exports.brush = brush;
function selectSiblingViews(target, viewInstances, brushKey) {
    return viewInstances.filter((d) => {
        if (d === target)
            return false;
        const { interaction = {} } = d.options;
        return Object.values(interaction).find((d) => d.brushKey === brushKey);
    });
}
function selectSiblingContainers(target, viewInstances, brushKey) {
    return selectSiblingViews(target, viewInstances, brushKey).map((d) => (0, utils_1.selectPlotArea)(d.container));
}
function selectSiblingOptions(target, viewInstances, brushKey) {
    return selectSiblingViews(target, viewInstances, brushKey).map((d) => d.options);
}
/**
 * @todo Brush over view for series view.
 * @todo Test perf.
 */
function brushHighlight(root, _a) {
    var { elements: elementof, selectedHandles, siblings: siblingsof = (root) => [], datum, brushRegion, extent: optionalExtent, reverse, scale, coordinate, series = false, key = (d) => d, bboxOf = (root) => {
        const { x, y, width, height } = root.style;
        return { x, y, width, height };
    }, state = {}, emitter } = _a, rest = __rest(_a, ["elements", "selectedHandles", "siblings", "datum", "brushRegion", "extent", "reverse", "scale", "coordinate", "series", "key", "bboxOf", "state", "emitter"]);
    const elements = elementof(root);
    const siblings = siblingsof(root);
    const siblingElements = siblings.flatMap(elementof);
    const valueof = (0, utils_1.createValueof)(elements, datum);
    const brushStyle = (0, helper_1.subObject)(rest, 'mask');
    const { setState, removeState } = (0, utils_1.useState)(state, valueof);
    const clonedElement = new Map();
    const { width: rootWidth, height: rootHeight, x: ordinalX = 0, y: ordinalY = 0, } = bboxOf(root);
    const extent = optionalExtent
        ? optionalExtent
        : [0, 0, rootWidth, rootHeight];
    const brushended = () => {
        for (const element of [...elements, ...siblingElements]) {
            removeState(element, 'active', 'inactive');
        }
    };
    const brushed = (x, y, x1, y1) => {
        var _a;
        // Hide brush for the sibling view.
        for (const sibling of siblings)
            (_a = sibling.brush) === null || _a === void 0 ? void 0 : _a.remove();
        // Store the key of the active element.
        const keys = new Set();
        // Highlight and store selected elements.
        for (const element of elements) {
            const { min, max } = element.getLocalBounds();
            const [ex, ey] = min;
            const [ex1, ey1] = max;
            if (!intersect([ex, ey, ex1, ey1], [x, y, x1, y1])) {
                setState(element, 'inactive');
            }
            else {
                setState(element, 'active');
                keys.add(key(element));
            }
        }
        // Highlight elements with same key in sibling view.
        for (const element of siblingElements) {
            if (keys.has(key(element)))
                setState(element, 'active');
            else
                setState(element, 'inactive');
        }
    };
    const seriesBrushend = () => {
        for (const element of elements)
            removeState(element, 'inactive');
        for (const cloned of clonedElement.values())
            cloned.remove();
        clonedElement.clear();
    };
    const seriesBrushed = (x, y, x1, y1) => {
        const clone = (element) => {
            const cloned = element.cloneNode();
            cloned.__data__ = element.__data__;
            element.parentNode.appendChild(cloned);
            clonedElement.set(element, cloned);
            return cloned;
        };
        // Create a clipPath shared between all children.
        const clipPath = new g_1.Rect({
            style: {
                x: x + ordinalX,
                y: y + ordinalY,
                width: x1 - x,
                height: y1 - y,
            },
        });
        root.appendChild(clipPath);
        for (const element of elements) {
            const cloned = clonedElement.get(element) || clone(element);
            cloned.style.clipPath = clipPath;
            setState(element, 'inactive');
            setState(cloned, 'active');
        }
    };
    const brushHandler = brush(root, Object.assign(Object.assign({}, brushStyle), { extent,
        brushRegion,
        reverse,
        selectedHandles, brushended: (emit) => {
            const handler = series ? seriesBrushend : brushended;
            if (emit) {
                emitter.emit('brush:remove', { nativeEvent: true });
            }
            handler();
        }, brushed: (x, y, x1, y1, emit) => {
            const selection = (0, scale_1.selectionOf)(x, y, x1, y1, scale, coordinate);
            if (emit) {
                emitter.emit('brush:highlight', {
                    nativeEvent: true,
                    data: { selection },
                });
            }
            const handler = series ? seriesBrushed : brushed;
            handler(x, y, x1, y1);
        }, brushcreated: (x, y, x1, y1, event) => {
            const selection = (0, scale_1.selectionOf)(x, y, x1, y1, scale, coordinate);
            emitter.emit('brush:end', Object.assign(Object.assign({}, event), { nativeEvent: true, data: { selection } }));
        }, brushupdated: (x, y, x1, y1, event) => {
            const selection = (0, scale_1.selectionOf)(x, y, x1, y1, scale, coordinate);
            emitter.emit('brush:end', Object.assign(Object.assign({}, event), { nativeEvent: true, data: { selection } }));
        }, brushstarted: (e) => {
            emitter.emit('brush:start', e);
        } }));
    // Move brush and highlight data.
    const onHighlight = ({ nativeEvent, data }) => {
        if (nativeEvent)
            return;
        const { selection } = data;
        const [x, y, x1, y1] = (0, scale_1.pixelsOf)(selection, scale, coordinate);
        brushHandler.move(x, y, x1, y1, false);
    };
    emitter.on('brush:highlight', onHighlight);
    // Remove brush and reset data.
    const onRemove = ({ nativeEvent } = {}) => {
        if (nativeEvent)
            return;
        brushHandler.remove(false);
    };
    emitter.on('brush:remove', onRemove);
    // Remove event handlers.
    const preBrushDestroy = brushHandler.destroy.bind(brushHandler);
    brushHandler.destroy = () => {
        emitter.off('brush:highlight', onHighlight);
        emitter.off('brush:remove', onRemove);
        preBrushDestroy();
    };
    return brushHandler;
}
exports.brushHighlight = brushHighlight;
function BrushHighlight(_a) {
    var { facet, brushKey } = _a, rest = __rest(_a, ["facet", "brushKey"]);
    return (target, viewInstances, emitter) => {
        const { container, view, options } = target;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const defaultOptions = {
            maskFill: '#777',
            maskFillOpacity: '0.3',
            maskStroke: '#fff',
            reverse: false,
        };
        const defaultStates = ['active', ['inactive', { opacity: 0.5 }]];
        const { scale, coordinate } = view;
        if (facet) {
            const bbox = plotArea.getBounds();
            const x = bbox.min[0];
            const y = bbox.min[1];
            const x1 = bbox.max[0];
            const y1 = bbox.max[1];
            return brushHighlight(plotArea.parentNode.parentNode, Object.assign(Object.assign({ elements: () => (0, utils_1.selectFacetG2Elements)(target, viewInstances), datum: (0, utils_1.createDatumof)((0, utils_1.selectFacetViews)(target, viewInstances).map((d) => d.view)), brushRegion: (x, y, x1, y1) => [x, y, x1, y1], extent: [x, y, x1, y1], state: (0, utils_1.mergeState)((0, utils_1.selectFacetViews)(target, viewInstances).map((d) => d.options), defaultStates), emitter,
                scale,
                coordinate, selectedHandles: undefined }, defaultOptions), rest));
        }
        const brush = brushHighlight(plotArea, Object.assign(Object.assign({ elements: utils_1.selectG2Elements, key: (element) => element.__data__.key, siblings: () => selectSiblingContainers(target, viewInstances, brushKey), datum: (0, utils_1.createDatumof)([
                view,
                ...selectSiblingViews(target, viewInstances, brushKey).map((d) => d.view),
            ]), brushRegion: (x, y, x1, y1) => [x, y, x1, y1], extent: undefined, state: (0, utils_1.mergeState)([options, ...selectSiblingOptions(target, viewInstances, brushKey)], defaultStates), emitter,
            scale,
            coordinate, selectedHandles: undefined }, defaultOptions), rest));
        // Bind brush to the view it belongs to.
        //@ts-ignore
        plotArea.brush = brush;
        return () => brush.destroy();
    };
}
exports.BrushHighlight = BrushHighlight;
//# sourceMappingURL=brushHighlight.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/scale":1751263816057,"../utils/createElement":1751263815891,"../utils/selection":1751263815883,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816135, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushXHighlight = exports.brushXRegion = void 0;
const brushHighlight_1 = require("./brushHighlight");
function brushXRegion(x, y, x1, y1, extent) {
    const [, minY, , maxY] = extent;
    return [x, minY, x1, maxY];
}
exports.brushXRegion = brushXRegion;
function BrushXHighlight(options) {
    return (0, brushHighlight_1.BrushHighlight)(Object.assign(Object.assign({}, options), { brushRegion: brushXRegion, selectedHandles: ['handle-e', 'handle-w'] }));
}
exports.BrushXHighlight = BrushXHighlight;
//# sourceMappingURL=brushXHighlight.js.map
}, function(modId) { var map = {"./brushHighlight":1751263816134}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816136, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushYHighlight = exports.brushYRegion = void 0;
const brushHighlight_1 = require("./brushHighlight");
function brushYRegion(x, y, x1, y1, extent) {
    const [minX, , maxX] = extent;
    return [minX, y, maxX, y1];
}
exports.brushYRegion = brushYRegion;
function BrushYHighlight(options) {
    return (0, brushHighlight_1.BrushHighlight)(Object.assign(Object.assign({}, options), { brushRegion: brushYRegion, selectedHandles: ['handle-n', 'handle-s'] }));
}
exports.BrushYHighlight = BrushYHighlight;
//# sourceMappingURL=brushYHighlight.js.map
}, function(modId) { var map = {"./brushHighlight":1751263816134}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816137, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushAxisHighlight = exports.brushAxisHighlight = exports.AXIS_HOT_AREA_CLASS_NAME = exports.AXIS_MAIN_CLASS_NAME = exports.AXIS_LINE_CLASS_NAME = exports.AXIS_CLASS_NAME = void 0;
const g_1 = require("@antv/g");
const helper_1 = require("../utils/helper");
const scale_1 = require("../utils/scale");
const brushHighlight_1 = require("./brushHighlight");
const brushXHighlight_1 = require("./brushXHighlight");
const brushYHighlight_1 = require("./brushYHighlight");
const utils_1 = require("./utils");
exports.AXIS_CLASS_NAME = 'axis';
exports.AXIS_LINE_CLASS_NAME = 'axis-line';
exports.AXIS_MAIN_CLASS_NAME = 'axis-main-group';
exports.AXIS_HOT_AREA_CLASS_NAME = 'axis-hot-area';
function axesOf(container) {
    return container.getElementsByClassName(exports.AXIS_CLASS_NAME);
}
function lineOf(axis) {
    return axis.getElementsByClassName(exports.AXIS_LINE_CLASS_NAME)[0];
}
function mainGroupOf(axis) {
    return axis.getElementsByClassName(exports.AXIS_MAIN_CLASS_NAME)[0];
}
// Use the bounds of main group of axis as the bounds of axis,
// get rid of grid and title.
function boundsOfAxis(axis) {
    return mainGroupOf(axis).getLocalBounds();
}
// Brush for vertical axis.
function verticalBrush(axis, _a) {
    var { cross, offsetX, offsetY } = _a, style = __rest(_a, ["cross", "offsetX", "offsetY"]);
    const bounds = boundsOfAxis(axis);
    const axisLine = lineOf(axis);
    const [lineX] = axisLine.getLocalBounds().min;
    const [minX, minY] = bounds.min;
    const [maxX, maxY] = bounds.max;
    const size = (maxX - minX) * 2;
    return {
        brushRegion: brushYHighlight_1.brushYRegion,
        hotZone: new g_1.Rect({
            className: exports.AXIS_HOT_AREA_CLASS_NAME,
            style: Object.assign({ 
                // If it is not cross, draw brush in both side of axisLine,
                // otherwise the draw brush within bounds area.
                width: cross ? size / 2 : size, transform: `translate(${(cross ? minX : lineX - size / 2).toFixed(2)}, ${minY})`, height: maxY - minY }, style),
        }),
        extent: cross
            ? // If it is cross, the x range is ignored.
                (x, y, x1, y1) => [-Infinity, y, Infinity, y1]
            : (x, y, x1, y1) => [
                Math.floor(minX - offsetX),
                y,
                Math.ceil(maxX - offsetX),
                y1,
            ],
    };
}
// Brush for horizontal axis.
function horizontalBrush(axis, _a) {
    var { offsetY, offsetX, cross = false } = _a, style = __rest(_a, ["offsetY", "offsetX", "cross"]);
    const bounds = boundsOfAxis(axis);
    const axisLine = lineOf(axis);
    const [, lineY] = axisLine.getLocalBounds().min;
    const [minX, minY] = bounds.min;
    const [maxX, maxY] = bounds.max;
    const size = maxY - minY;
    return {
        brushRegion: brushXHighlight_1.brushXRegion,
        hotZone: new g_1.Rect({
            className: exports.AXIS_HOT_AREA_CLASS_NAME,
            style: Object.assign({ width: maxX - minX, 
                // If it is not cross, draw brush in both side of axisLine,
                // otherwise the draw brush within bounds area.
                height: cross ? size : size * 2, transform: `translate(${minX}, ${cross ? minY : lineY - size})` }, style),
        }),
        extent: cross
            ? // If it is cross, the y range is ignored.
                (x, y, x1, y1) => [x, -Infinity, x1, Infinity]
            : (x, y, x1, y1) => [
                x,
                Math.floor(minY - offsetY),
                x1,
                Math.ceil(maxY - offsetY),
            ],
    };
}
function brushAxisHighlight(root, _a) {
    var { axes: axesOf, // given root, return axes
    elements: elementsOf, // given root, return elements
    points: pointsOf, // given shape, return control points
    horizontal: isHorizontal, // given axis, return direction
    datum, // given shape, return datum
    offsetY, // offsetY for shape area
    offsetX, // offsetX for shape area
    reverse = false, state = {}, emitter, coordinate } = _a, rest = __rest(_a, ["axes", "elements", "points", "horizontal", "datum", "offsetY", "offsetX", "reverse", "state", "emitter", "coordinate"]) // style
    ;
    const elements = elementsOf(root);
    const axes = axesOf(root);
    const valueof = (0, utils_1.createValueof)(elements, datum);
    const { setState, removeState } = (0, utils_1.useState)(state, valueof);
    const axisExtent = new Map();
    const brushStyle = (0, helper_1.subObject)(rest, 'mask');
    // Only some of shape's points in all mask, it is selected.
    const brushed = (points) => Array.from(axisExtent.values()).every(([x, y, x1, y1]) => points.some(([x0, y0]) => {
        return x0 >= x && x0 <= x1 && y0 >= y && y0 <= y1;
    }));
    const scales = axes.map((d) => d.attributes.scale);
    const extentOf = (D) => (D.length > 2 ? [D[0], D[D.length - 1]] : D);
    const indexDomain = new Map();
    const initIndexDomain = () => {
        indexDomain.clear();
        for (let i = 0; i < axes.length; i++) {
            const scale = scales[i];
            const { domain } = scale.getOptions();
            indexDomain.set(i, extentOf(domain));
        }
    };
    initIndexDomain();
    // Update element when brush changed.
    const updateElement = (i, emit) => {
        const selectedElements = [];
        for (const element of elements) {
            const points = pointsOf(element);
            if (brushed(points)) {
                setState(element, 'active');
                selectedElements.push(element);
            }
            else
                setState(element, 'inactive');
        }
        indexDomain.set(i, selectionOf(selectedElements, i));
        if (!emit)
            return;
        // Emit events.
        const selection = () => {
            if (!cross)
                return Array.from(indexDomain.values());
            const S = [];
            for (const [index, domain] of indexDomain) {
                const scale = scales[index];
                const { name } = scale.getOptions();
                if (name === 'x')
                    S[0] = domain;
                else
                    S[1] = domain;
            }
            return S;
        };
        emitter.emit('brushAxis:highlight', {
            nativeEvent: true,
            data: {
                selection: selection(),
            },
        });
    };
    const clearElement = (emit) => {
        for (const element of elements)
            removeState(element, 'active', 'inactive');
        initIndexDomain();
        if (!emit)
            return;
        emitter.emit('brushAxis:remove', { nativeEvent: true });
    };
    const selectionOf = (selected, i) => {
        const scale = scales[i];
        const { name } = scale.getOptions();
        const domain = selected.map((d) => {
            const data = d.__data__;
            return scale.invert(data[name]);
        });
        return extentOf((0, scale_1.domainOf)(scale, domain));
    };
    // Distinguish between parallel coordinates and normal charts.
    const cross = axes.some(isHorizontal) && axes.some((d) => !isHorizontal(d));
    const handlers = [];
    for (let i = 0; i < axes.length; i++) {
        const axis = axes[i];
        const createBrush = isHorizontal(axis) ? horizontalBrush : verticalBrush;
        const { hotZone, brushRegion, extent } = createBrush(axis, {
            offsetY,
            offsetX,
            cross,
            zIndex: 999,
            fill: 'transparent', // Make it interactive.
        });
        axis.parentNode.appendChild(hotZone);
        const brushHandler = (0, brushHighlight_1.brush)(hotZone, Object.assign(Object.assign({}, brushStyle), { reverse,
            brushRegion,
            brushended(emit) {
                axisExtent.delete(axis);
                if (Array.from(axisExtent.entries()).length === 0)
                    clearElement(emit);
                else
                    updateElement(i, emit);
            },
            brushed(x, y, x1, y1, emit) {
                axisExtent.set(axis, extent(x, y, x1, y1));
                updateElement(i, emit);
            } }));
        handlers.push(brushHandler);
    }
    const onRemove = (event = {}) => {
        const { nativeEvent } = event;
        if (nativeEvent)
            return;
        handlers.forEach((d) => d.remove(false));
    };
    const rangeOf = (domain, scale, axis) => {
        const [d0, d1] = domain;
        const maybeStep = (scale) => (scale.getStep ? scale.getStep() : 0);
        const x = abstractOf(d0, scale, axis);
        const x1 = abstractOf(d1, scale, axis) + maybeStep(scale);
        if (isHorizontal(axis))
            return [x, -Infinity, x1, Infinity];
        return [-Infinity, x, Infinity, x1];
    };
    const abstractOf = (x, scale, axis) => {
        const { height, width } = coordinate.getOptions();
        const scale1 = scale.clone();
        if (isHorizontal(axis))
            scale1.update({ range: [0, width] });
        else
            scale1.update({ range: [height, 0] });
        return scale1.map(x);
    };
    const onHighlight = (event) => {
        const { nativeEvent } = event;
        if (nativeEvent)
            return;
        const { selection } = event.data;
        for (let i = 0; i < handlers.length; i++) {
            const domain = selection[i];
            const handler = handlers[i];
            const axis = axes[i];
            if (domain) {
                const scale = scales[i];
                handler.move(...rangeOf(domain, scale, axis), false);
            }
            else {
                handler.remove(false);
            }
        }
    };
    emitter.on('brushAxis:remove', onRemove);
    emitter.on('brushAxis:highlight', onHighlight);
    return () => {
        handlers.forEach((d) => d.destroy());
        emitter.off('brushAxis:remove', onRemove);
        emitter.off('brushAxis:highlight', onHighlight);
    };
}
exports.brushAxisHighlight = brushAxisHighlight;
/**
 * @todo Support mask size.
 */
function BrushAxisHighlight(options) {
    return (target, _, emitter) => {
        const { container, view, options: viewOptions } = target;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const { x: x0, y: y0 } = plotArea.getBBox();
        const { coordinate } = view;
        return brushAxisHighlight(container, Object.assign({ elements: utils_1.selectG2Elements, axes: axesOf, offsetY: y0, offsetX: x0, points: (element) => element.__data__.points, horizontal: (axis) => {
                const { startPos: [sx, sy], endPos: [ex, ey], } = axis.attributes;
                // attention, non-horizontal does not mean vertical
                // it may has a specific degree angle
                return sx !== ex && sy === ey;
            }, datum: (0, utils_1.createDatumof)(view), state: (0, utils_1.mergeState)(viewOptions, [
                'active',
                ['inactive', { opacity: 0.5 }],
            ]), coordinate,
            emitter }, options));
    };
}
exports.BrushAxisHighlight = BrushAxisHighlight;
//# sourceMappingURL=brushAxisHighlight.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/scale":1751263816057,"./brushHighlight":1751263816134,"./brushXHighlight":1751263816135,"./brushYHighlight":1751263816136,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816138, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushFilter = exports.brushFilter = void 0;
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const scale_1 = require("../utils/scale");
const brushHighlight_1 = require("./brushHighlight");
const utils_1 = require("./utils");
// Mock dblclick events.
function dblclick(interval = 300) {
    let preTimeStamp = null;
    return (e) => {
        const { timeStamp } = e;
        if (preTimeStamp !== null && timeStamp - preTimeStamp < interval) {
            preTimeStamp = timeStamp;
            return true;
        }
        preTimeStamp = timeStamp;
        return false;
    };
}
function brushFilter(root, _a) {
    var { filter, reset, brushRegion, extent: optionalExtent, reverse, emitter, scale, coordinate, selection, series = false } = _a, rest = __rest(_a, ["filter", "reset", "brushRegion", "extent", "reverse", "emitter", "scale", "coordinate", "selection", "series"]);
    const brushStyle = (0, helper_1.subObject)(rest, 'mask');
    const { width: rootWidth, height: rootHeight } = root.getBBox();
    const extent = optionalExtent
        ? optionalExtent
        : [0, 0, rootWidth, rootHeight];
    const isDblclick = dblclick();
    const brush = (0, brushHighlight_1.brush)(root, Object.assign(Object.assign({}, brushStyle), { extent,
        brushRegion,
        reverse,
        brushcreated }));
    root.addEventListener('click', click);
    // Filter when brush created.
    function brushcreated(x, y, x1, y1, event) {
        if (x === x1 && y === y1)
            return;
        event.nativeEvent = true;
        filter(selection(x, y, x1, y1), event);
        brush.remove();
    }
    // Reset when dblclick.
    function click(e) {
        if (isDblclick(e)) {
            e.nativeEvent = true;
            reset(e);
        }
    }
    const onFilter = ({ nativeEvent, data }) => {
        if (nativeEvent)
            return;
        const { selection } = data;
        filter(selection, { nativeEvent: false });
    };
    emitter.on('brush:filter', onFilter);
    return () => {
        brush.destroy();
        emitter.off('brush:filter', onFilter);
        root.removeEventListener('click', click);
    };
}
exports.brushFilter = brushFilter;
function BrushFilter(_a) {
    var { hideX = true, hideY = true } = _a, rest = __rest(_a, ["hideX", "hideY"]);
    return (target, viewInstances, emitter) => {
        const { container, view, options: viewOptions, update, setState } = target;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        const defaultOptions = {
            maskFill: '#777',
            maskFillOpacity: '0.3',
            maskStroke: '#fff',
            unhighlightedOpacity: 0.5,
            reverse: false,
        };
        let filtered = false;
        let filtering = false;
        let newView = view;
        const { scale, coordinate } = view;
        return brushFilter(plotArea, Object.assign(Object.assign({ brushRegion: (x, y, x1, y1) => [x, y, x1, y1], selection: (x, y, x1, y1) => {
                const { scale, coordinate } = newView;
                return (0, scale_1.selectionOf)(x, y, x1, y1, scale, coordinate);
            }, filter: (selection, event) => __awaiter(this, void 0, void 0, function* () {
                // Avoid redundant filter.
                if (filtering)
                    return;
                filtering = true;
                // Update the domain of x and y scale to filter data.
                const [domainX, domainY] = selection;
                setState('brushFilter', (options) => {
                    const { marks } = options;
                    const newMarks = marks.map((mark) => (0, util_1.deepMix)({
                        // Hide label to keep smooth transition.
                        axis: Object.assign(Object.assign({}, (hideX && { x: { transform: [{ type: 'hide' }] } })), (hideY && { y: { transform: [{ type: 'hide' }] } })),
                    }, mark, {
                        // Set nice to false to avoid modify domain.
                        scale: {
                            x: { domain: domainX, nice: false },
                            y: { domain: domainY, nice: false },
                        },
                    }));
                    return Object.assign(Object.assign({}, viewOptions), { marks: newMarks, clip: true });
                });
                // Emit event.
                emitter.emit('brush:filter', Object.assign(Object.assign({}, event), { data: { selection: [domainX, domainY] } }));
                const newState = yield update();
                newView = newState.view;
                filtering = false;
                filtered = true;
            }), reset: (event) => {
                if (filtering || !filtered)
                    return;
                // Emit event.
                const { scale } = view;
                const { x: scaleX, y: scaleY } = scale;
                const domainX = scaleX.getOptions().domain;
                const domainY = scaleY.getOptions().domain;
                emitter.emit('brush:filter', Object.assign(Object.assign({}, event), { data: { selection: [domainX, domainY] } }));
                filtered = false;
                newView = view;
                setState('brushFilter');
                update();
            }, extent: undefined, emitter,
            scale,
            coordinate }, defaultOptions), rest));
    };
}
exports.BrushFilter = BrushFilter;
//# sourceMappingURL=brushFilter.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../utils/scale":1751263816057,"./brushHighlight":1751263816134,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816139, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushXFilter = void 0;
const brushFilter_1 = require("./brushFilter");
const brushXHighlight_1 = require("./brushXHighlight");
function BrushXFilter(options) {
    return (0, brushFilter_1.BrushFilter)(Object.assign(Object.assign({ hideX: true }, options), { brushRegion: brushXHighlight_1.brushXRegion }));
}
exports.BrushXFilter = BrushXFilter;
//# sourceMappingURL=brushXFilter.js.map
}, function(modId) { var map = {"./brushFilter":1751263816138,"./brushXHighlight":1751263816135}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816140, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.BrushYFilter = void 0;
const brushFilter_1 = require("./brushFilter");
const brushYHighlight_1 = require("./brushYHighlight");
function BrushYFilter(options) {
    return (0, brushFilter_1.BrushFilter)(Object.assign(Object.assign({ hideY: true }, options), { brushRegion: brushYHighlight_1.brushYRegion }));
}
exports.BrushYFilter = BrushYFilter;
//# sourceMappingURL=brushYFilter.js.map
}, function(modId) { var map = {"./brushFilter":1751263816138,"./brushYHighlight":1751263816136}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816141, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SliderFilter = exports.SLIDER_CLASS_NAME = void 0;
const util_1 = require("@antv/util");
const g_1 = require("@antv/g");
const coordinate_1 = require("../utils/coordinate");
const scale_1 = require("../utils/scale");
exports.SLIDER_CLASS_NAME = 'slider';
function filterDataByDomain(options, scaleOptions, prefix, hasState = false, channel0 = 'x', channel1 = 'y') {
    const { marks } = options;
    const newMarks = marks.map((mark) => {
        var _a, _b;
        return (0, util_1.deepMix)({
            // Hide label to keep smooth transition.
            axis: {
                x: { transform: [{ type: 'hide' }] },
                y: { transform: [{ type: 'hide' }] },
            },
        }, mark, {
            scale: scaleOptions,
            // Don't rerender sliders.
            [prefix]: Object.assign(Object.assign({}, (((_a = mark[prefix]) === null || _a === void 0 ? void 0 : _a[channel0]) && {
                [channel0]: Object.assign({ preserve: true }, (hasState && { ratio: null })),
            })), (((_b = mark[prefix]) === null || _b === void 0 ? void 0 : _b[channel1]) && {
                [channel1]: { preserve: true },
            })),
            animate: false,
        });
    });
    // Rerender and update view.
    return Object.assign(Object.assign({}, options), { marks: newMarks, clip: true, animate: false });
}
function abstractValue(values, scale, reverse) {
    const [x, x1] = values;
    const v = reverse ? (d) => 1 - d : (d) => d;
    const d0 = (0, scale_1.invert)(scale, v(x), true);
    const d1 = (0, scale_1.invert)(scale, v(x1), false);
    return (0, scale_1.domainOf)(scale, [d0, d1]);
}
function extentOf(domain) {
    return [domain[0], domain[domain.length - 1]];
}
/**
 * @todo Support click to reset after fix click and dragend conflict.
 */
function SliderFilter({ initDomain = {}, className = exports.SLIDER_CLASS_NAME, prefix = 'slider', setValue = (component, values) => component.setValues(values), hasState = false, wait = 50, leading = true, trailing = false, getInitValues = (slider) => {
    var _a;
    const values = (_a = slider === null || slider === void 0 ? void 0 : slider.attributes) === null || _a === void 0 ? void 0 : _a.values;
    if (values[0] !== 0 || values[1] !== 1)
        return values;
}, }) {
    return (context, _, emitter) => {
        const { container, view, update, setState } = context;
        const sliders = container.getElementsByClassName(className);
        if (!sliders.length)
            return () => { };
        let filtering = false;
        const { scale, coordinate, layout } = view;
        const { paddingLeft, paddingTop, paddingBottom, paddingRight } = layout;
        const { x: scaleX, y: scaleY } = scale;
        const transposed = (0, coordinate_1.isTranspose)(coordinate);
        const channelOf = (orientation) => {
            const channel0 = orientation === 'vertical' ? 'y' : 'x';
            const channel1 = orientation === 'vertical' ? 'x' : 'y';
            if (transposed)
                return [channel1, channel0];
            return [channel0, channel1];
        };
        const sliderHandler = new Map();
        const emitHandlers = new Set();
        // Store current domain of x and y scale.
        const channelDomain = {
            x: initDomain.x || scaleX.getOptions().domain,
            y: initDomain.y || scaleY.getOptions().domain,
        };
        for (const slider of sliders) {
            const { orientation } = slider.attributes;
            const [channel0, channel1] = channelOf(orientation);
            const eventName = `${prefix}${(0, util_1.upperFirst)(channel0)}:filter`;
            const isX = channel0 === 'x';
            const { ratio: ratioX } = scaleX.getOptions();
            const { ratio: ratioY } = scaleY.getOptions();
            const domainsOf = (event) => {
                // From abstract values.
                if (event.data) {
                    const { selection } = event.data;
                    const [X = extentOf(channelDomain.x), Y = extentOf(channelDomain.y)] = selection;
                    return isX
                        ? [(0, scale_1.domainOf)(scaleX, X, ratioX), (0, scale_1.domainOf)(scaleY, Y, ratioY)]
                        : [(0, scale_1.domainOf)(scaleY, Y, ratioY), (0, scale_1.domainOf)(scaleX, X, ratioX)];
                }
                // From visual values.
                const { value: values } = event.detail;
                const scale0 = scale[channel0];
                const domain0 = abstractValue(values, scale0, transposed && orientation === 'horizontal');
                const domain1 = channelDomain[channel1];
                return [domain0, domain1];
            };
            const onValueChange = (0, util_1.throttle)((event) => __awaiter(this, void 0, void 0, function* () {
                const { initValue = false } = event;
                if (filtering && !initValue)
                    return;
                filtering = true;
                const { nativeEvent = true } = event;
                // Get and update domain.
                const [domain0, domain1] = domainsOf(event);
                channelDomain[channel0] = domain0;
                channelDomain[channel1] = domain1;
                if (nativeEvent) {
                    // Emit events.
                    const X = isX ? domain0 : domain1;
                    const Y = isX ? domain1 : domain0;
                    emitter.emit(eventName, Object.assign(Object.assign({}, event), { nativeEvent, data: { selection: [extentOf(X), extentOf(Y)] } }));
                }
                setState(slider, (options) => (Object.assign(Object.assign({}, filterDataByDomain(options, 
                // Set nice to false to avoid modify domain.
                // Only update domain of current slider / scrollbar.
                { [channel0]: { domain: domain0, nice: false } }, prefix, hasState, channel0, channel1)), { paddingLeft,
                    paddingTop,
                    paddingBottom,
                    paddingRight })));
                yield update();
                filtering = false;
            }), wait, { leading, trailing });
            const emitHandler = (event) => {
                const { nativeEvent } = event;
                if (nativeEvent)
                    return;
                const { data } = event;
                const { selection } = data;
                const [X, Y] = selection;
                // Update data.
                slider.dispatchEvent(new g_1.CustomEvent('valuechange', {
                    data,
                    nativeEvent: false,
                }));
                // Update slider.
                const V = isX ? (0, scale_1.abstractOf)(X, scaleX) : (0, scale_1.abstractOf)(Y, scaleY);
                setValue(slider, V);
            };
            emitter.on(eventName, emitHandler);
            slider.addEventListener('valuechange', onValueChange);
            sliderHandler.set(slider, onValueChange);
            emitHandlers.add([eventName, emitHandler]);
            const values = getInitValues(slider);
            if (values) {
                // Init values.
                slider.dispatchEvent(new g_1.CustomEvent('valuechange', {
                    detail: {
                        value: values,
                    },
                    nativeEvent: false,
                    initValue: true,
                }));
            }
        }
        return () => {
            for (const [slider, handler] of sliderHandler) {
                slider.removeEventListener('valuechange', handler);
            }
            for (const [name, handler] of emitHandlers) {
                emitter.off(name, handler);
            }
        };
    };
}
exports.SliderFilter = SliderFilter;
//# sourceMappingURL=sliderFilter.js.map
}, function(modId) { var map = {"../utils/coordinate":1751263815882,"../utils/scale":1751263816057}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816142, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ScrollbarFilter = exports.SCROLLBAR_CLASS_NAME = void 0;
const sliderFilter_1 = require("./sliderFilter");
exports.SCROLLBAR_CLASS_NAME = 'g2-scrollbar';
function ScrollbarFilter(options = {}) {
    return (context, _, emitter) => {
        const { view, container } = context;
        const scrollbars = container.getElementsByClassName(exports.SCROLLBAR_CLASS_NAME);
        if (!scrollbars.length)
            return () => { };
        const { scale } = view;
        const { x: scaleX, y: scaleY } = scale;
        // The filtered domain, computed by the ratio attribute.
        const initDomain = {
            x: [...scaleX.getOptions().domain],
            y: [...scaleY.getOptions().domain],
        };
        // The ordinal domain for each channel.
        scaleX.update({ domain: scaleX.getOptions().expectedDomain });
        scaleY.update({ domain: scaleY.getOptions().expectedDomain });
        const interaction = (0, sliderFilter_1.SliderFilter)(Object.assign(Object.assign({}, options), { initDomain, className: exports.SCROLLBAR_CLASS_NAME, prefix: 'scrollbar', hasState: true, setValue: (component, values) => component.setValue(values[0]), getInitValues: (scrollbar) => {
                const values = scrollbar.slider.attributes.values;
                if (values[0] !== 0)
                    return values;
            } }));
        return interaction(context, _, emitter);
    };
}
exports.ScrollbarFilter = ScrollbarFilter;
//# sourceMappingURL=scrollbarFilter.js.map
}, function(modId) { var map = {"./sliderFilter":1751263816141}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816143, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Poptip = void 0;
const g_1 = require("@antv/g");
const string_1 = require("../utils/string");
const helper_1 = require("../utils/helper");
function dom(tag, children, style) {
    return `<${tag} style="${Object.entries(style)
        .map(([key, value]) => `${(0, string_1.kebabCase)(key)}:${value}`)
        .join(';')}">${children}</${tag}>`;
}
const defaultTipStyle = {
    backgroundColor: 'rgba(0,0,0,0.75)',
    color: '#fff',
    width: 'max-content',
    padding: '1px 4px',
    fontSize: '12px',
    borderRadius: '2.5px',
    boxShadow: '0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05)',
};
function isTipText(element) {
    if (element.nodeName !== 'text')
        return false;
    if (element.isOverflowing())
        return true;
    return false;
}
function Poptip(_a) {
    var { offsetX = 8, offsetY = 8 } = _a, style = __rest(_a, ["offsetX", "offsetY"]);
    return (context) => {
        const { container } = context;
        const [x0, y0] = container.getBounds().min;
        const tipStyle = (0, helper_1.subObject)(style, 'tip');
        const tips = new Set();
        const pointerover = (e) => {
            const { target } = e;
            if (!isTipText(target)) {
                e.stopPropagation();
                return;
            }
            const { offsetX: mouseX, offsetY: mouseY } = e;
            const x = mouseX + offsetX - x0;
            const y = mouseY + offsetY - y0;
            if (target.tip) {
                target.tip.style.x = x;
                target.tip.style.y = y;
                return;
            }
            const { text } = target.style;
            const tipELement = new g_1.HTML({
                className: 'poptip',
                style: {
                    innerHTML: dom('div', text, Object.assign(Object.assign({}, defaultTipStyle), tipStyle)),
                    x,
                    y,
                },
            });
            container.appendChild(tipELement);
            target.tip = tipELement;
            tips.add(tipELement);
        };
        const pointerout = (e) => {
            const { target } = e;
            if (!isTipText(target)) {
                e.stopPropagation();
                return;
            }
            if (!target.tip)
                return;
            target.tip.remove();
            target.tip = null;
            tips.delete(target.tip);
        };
        container.addEventListener('pointerover', pointerover);
        container.addEventListener('pointerout', pointerout);
        return () => {
            container.removeEventListener('pointerover', pointerover);
            container.removeEventListener('pointerout', pointerout);
            tips.forEach((tip) => tip.remove());
        };
    };
}
exports.Poptip = Poptip;
Poptip.props = {
    reapplyWhenUpdate: true,
};
//# sourceMappingURL=poptip.js.map
}, function(modId) { var map = {"../utils/string":1751263815900,"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816144, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreemapDrillDown = void 0;
const g_1 = require("@antv/g");
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const runtime_1 = require("../runtime");
const selection_1 = require("../utils/selection");
const treeDataTransform_1 = require("../utils/treeDataTransform");
const legendFilter_1 = require("./legendFilter");
const utils_1 = require("./utils");
function selectPlotArea(root) {
    return (0, selection_1.select)(root).select(`.${runtime_1.PLOT_CLASS_NAME}`).node();
}
// Default breadCrumb config.
const DEFAULT_BREADCRUMB_STYLE = {
    breadCrumbFill: 'rgba(0, 0, 0, 0.85)',
    breadCrumbFontSize: 12,
    breadCrumbY: 12,
    activeFill: 'rgba(0, 0, 0, 0.5)',
};
/**
 * TreemapDrillDown interaction.
 */
function TreemapDrillDown(drillDownOptions = {}) {
    const { originData = [], layout } = drillDownOptions, style = __rest(drillDownOptions, ["originData", "layout"]);
    const breadCrumb = (0, util_1.deepMix)({}, DEFAULT_BREADCRUMB_STYLE, style);
    const breadCrumbStyle = (0, helper_1.subObject)(breadCrumb, 'breadCrumb');
    const breadCrumbActiveStyle = (0, helper_1.subObject)(breadCrumb, 'active');
    return (context) => {
        const { update, setState, container, options } = context;
        const plotArea = selectPlotArea(container);
        const mark = options.marks[0];
        const { state } = mark;
        // Create breadCrumbTextsGroup,save textSeparator、drillTexts.
        const textGroup = new g_1.Group();
        plotArea.appendChild(textGroup);
        // Modify the data and scale according to the path and the level of the current click, so as to achieve the effect of drilling down and drilling up and initialization.
        const drillDownClick = (path, depth) => __awaiter(this, void 0, void 0, function* () {
            // Clear text.
            textGroup.removeChildren();
            // More path creation text.
            if (depth) {
                let name = '';
                let y = breadCrumbStyle.y;
                let x = 0;
                const textPath = [];
                const maxWidth = plotArea.getBBox().width;
                // Create path: 'type1 / type2 / type3' -> '/ type1 / type2 / type3'.
                const drillTexts = path.map((text, index) => {
                    name = `${name}${text}/`;
                    textPath.push(text);
                    const drillText = new g_1.Text({
                        name: name.replace(/\/$/, ''),
                        style: Object.assign(Object.assign({ text,
                            x, 
                            // @ts-ignore
                            path: [...textPath], depth: index }, breadCrumbStyle), { y }),
                    });
                    textGroup.appendChild(drillText);
                    x += drillText.getBBox().width;
                    const textSeparator = new g_1.Text({
                        style: Object.assign(Object.assign({ x, text: ' / ' }, breadCrumbStyle), { y }),
                    });
                    textGroup.appendChild(textSeparator);
                    x += textSeparator.getBBox().width;
                    /**
                     * Page width exceeds maximum, line feed.
                     * | ----maxWidth---- |
                     * | / tyep1 / tyep2 / type3 |
                     * ->
                     * | ----maxWidth---- |
                     * | / tyep1 / tyep2  |
                     * | / type3 |
                     */
                    if (x > maxWidth) {
                        y = textGroup.getBBox().height + breadCrumbStyle.y;
                        x = 0;
                        drillText.attr({
                            x,
                            y,
                        });
                        x += drillText.getBBox().width;
                        textSeparator.attr({
                            x,
                            y,
                        });
                        x += textSeparator.getBBox().width;
                    }
                    if (index === (0, util_1.size)(path) - 1) {
                        textSeparator.remove();
                    }
                    return drillText;
                });
                // Add Active, Add TreemapDrillDown
                drillTexts.forEach((item, index) => {
                    // Last drillText
                    if (index === (0, util_1.size)(drillTexts) - 1)
                        return;
                    const originalAttrs = Object.assign({}, item.attributes);
                    item.attr('cursor', 'pointer');
                    item.addEventListener('mouseenter', () => {
                        item.attr(breadCrumbActiveStyle);
                    });
                    item.addEventListener('mouseleave', () => {
                        item.attr(originalAttrs);
                    });
                    item.addEventListener('click', () => {
                        drillDownClick((0, util_1.get)(item, ['style', 'path']), (0, util_1.get)(item, ['style', 'depth']));
                    });
                });
            }
            // LegendFilter interaction and treemapDrillDown clash.
            (0, legendFilter_1.legendClearSetState)(container, setState);
            // Update marks.
            setState('treemapDrillDown', (viewOptions) => {
                const { marks } = viewOptions;
                // Add filter transform for every marks,
                // which will skip for mark without color channel.
                const strPath = path.join('/');
                const newMarks = marks.map((mark) => {
                    if (mark.type !== 'rect')
                        return mark;
                    let newData = originData;
                    if (depth) {
                        const filterData = originData
                            .filter((item) => {
                            const id = (0, util_1.get)(item, ['id']);
                            return id && (id.match(`${strPath}/`) || strPath.match(id));
                        })
                            .map((item) => ({
                            value: item.height === 0 ? (0, util_1.get)(item, ['value']) : undefined,
                            name: (0, util_1.get)(item, ['id']),
                        }));
                        const { paddingLeft, paddingBottom, paddingRight } = layout;
                        // New drill layout for calculation x y and filtration data.
                        const newLayout = Object.assign(Object.assign({}, layout), { paddingTop: (layout.paddingTop || textGroup.getBBox().height + 10) /
                                (depth + 1), paddingLeft: paddingLeft / (depth + 1), paddingBottom: paddingBottom / (depth + 1), paddingRight: paddingRight / (depth + 1), path: (d) => d.name, layer: (d) => d.depth === depth + 1 });
                        // Transform the new matrix tree data.
                        newData = (0, treeDataTransform_1.treeDataTransform)(filterData, newLayout, {
                            value: 'value',
                        })[0];
                    }
                    else {
                        newData = originData.filter((item) => {
                            return item.depth === 1;
                        });
                    }
                    const colorDomain = [];
                    newData.forEach(({ path }) => {
                        colorDomain.push((0, util_1.last)(path));
                    });
                    // TreemapDrillDown by filtering the data and scale.
                    return (0, util_1.deepMix)({}, mark, {
                        data: newData,
                        scale: {
                            color: { domain: colorDomain },
                        },
                    });
                });
                return Object.assign(Object.assign({}, viewOptions), { marks: newMarks });
            });
            // The second argument is to allow the legendFilter event to be re-added; the update method itself causes legend to lose the interaction event.
            yield update(undefined, ['legendFilter']);
        });
        //
        const keyofLabel = (d) => d.attributes.key.split('-')[0];
        const keyofRect = (d) => (0, util_1.get)(d, ['__data__', 'key']);
        // Elements and BreadCrumb click.
        const createDrillClick = (e) => {
            const item = e.target;
            const { markType, nodeName, attributes } = item || {};
            if (markType !== 'rect' && nodeName !== g_1.Shape.TEXT)
                return;
            const key = nodeName === g_1.Shape.TEXT && (0, util_1.get)(attributes, 'isTreemapLabel') === true
                ? keyofLabel(item)
                : keyofRect(item);
            const node = (0, util_1.find)(originData, (d) => d.id === key);
            // Node height = 0 no children
            if ((0, util_1.get)(node, 'height')) {
                drillDownClick((0, util_1.get)(node, 'path'), (0, util_1.get)(node, 'depth'));
            }
        };
        // Add click drill interaction.
        plotArea.addEventListener('click', createDrillClick);
        // Change attributes keys.
        const changeStyleKey = (0, util_1.keys)(Object.assign(Object.assign({}, state.active), state.inactive));
        const createActive = () => {
            const elements = (0, utils_1.getElements)(plotArea);
            elements.forEach((element) => {
                const cursor = (0, util_1.get)(element, ['style', 'cursor']);
                const node = (0, util_1.find)(originData, (d) => d.id === (0, util_1.get)(element, ['__data__', 'key']));
                if (cursor !== 'pointer' && (node === null || node === void 0 ? void 0 : node.height)) {
                    element.style.cursor = 'pointer';
                    const originalAttrs = (0, util_1.pick)(element.attributes, changeStyleKey);
                    element.addEventListener('mouseenter', () => {
                        element.attr(state.active);
                    });
                    element.addEventListener('mouseleave', () => {
                        element.attr((0, util_1.deepMix)(originalAttrs, state.inactive));
                    });
                }
            });
        };
        createActive();
        // Animate elements update, Add active.
        plotArea.addEventListener('mousemove', createActive);
        return () => {
            textGroup.remove();
            plotArea.removeEventListener('click', createDrillClick);
            plotArea.removeEventListener('mousemove', createActive);
        };
    };
}
exports.TreemapDrillDown = TreemapDrillDown;
//# sourceMappingURL=treemapDrillDown.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"../runtime":1751263816081,"../utils/selection":1751263815883,"../utils/treeDataTransform":1751263816005,"./legendFilter":1751263816132,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816145, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementPointMove = void 0;
const g_1 = require("@antv/g");
const util_1 = require("@antv/util");
const helper_1 = require("../utils/helper");
const utils_1 = require("./utils");
const DEFAULT_STYLE = {
    pointR: 6,
    pointStrokeWidth: 1,
    pointStroke: '#888',
    pointActiveStroke: '#f5f5f5',
    pathStroke: '#888',
    pathLineDash: [3, 4],
    labelFontSize: 12,
    labelFill: '#888',
    labelStroke: '#fff',
    labelLineWidth: 1,
    labelY: -6,
    labelX: 2,
};
// point shape name.
const MOVE_POINT_NAME = 'movePoint';
// Element mouseenter change style.
const elementMouseenter = (e) => {
    const element = e.target;
    const { markType } = element;
    // Mark line.
    if (markType === 'line') {
        element.attr('_lineWidth', element.attr('lineWidth') || 1);
        element.attr('lineWidth', element.attr('_lineWidth') + 3);
    }
    // Mark interval.
    if (markType === 'interval') {
        element.attr('_opacity', element.attr('opacity') || 1);
        element.attr('opacity', 0.7 * element.attr('_opacity'));
    }
};
// Element mouseleave change style.
const elementMouseleave = (e) => {
    const element = e.target;
    const { markType } = element;
    // Mark line.
    if (markType === 'line') {
        element.attr('lineWidth', element.attr('_lineWidth'));
    }
    // Mark interval.
    if (markType === 'interval') {
        element.attr('opacity', element.attr('_opacity'));
    }
};
// Get the latest overall data based on the individual data changes.
const getNewData = (newChangeData, data, encode) => {
    return data.map((d) => {
        const isUpdate = ['x', 'color'].reduce((v, key) => {
            const field = encode[key];
            if (!field)
                return v;
            if (d[field] !== newChangeData[field])
                return false;
            return v;
        }, true);
        return isUpdate ? Object.assign(Object.assign({}, d), newChangeData) : d;
    });
};
// Find mark interval origin element data.
const getIntervalDataRatioTransformFn = (element) => {
    const y = (0, util_1.get)(element, ['__data__', 'y']);
    const y1 = (0, util_1.get)(element, ['__data__', 'y1']);
    const v = y1 - y;
    const { __data__: { data, encode, transform }, childNodes, } = element.parentNode;
    const isNormalizeY = (0, util_1.find)(transform, ({ type }) => type === 'normalizeY');
    const yField = (0, util_1.get)(encode, ['y', 'field']);
    const value = data[childNodes.indexOf(element)][yField];
    return (newValue, isTheta = false) => {
        if (isNormalizeY || isTheta) {
            return (newValue / (1 - newValue) / (v / (1 - v))) * value;
        }
        return newValue;
    };
};
// Find origin path data.
const getPathDataRatioTransformFn = (element, index) => {
    const v = (0, util_1.get)(element, ['__data__', 'seriesItems', index, '0', 'value']);
    const i = (0, util_1.get)(element, ['__data__', 'seriesIndex', index]);
    const { __data__: { data, encode, transform }, } = element.parentNode;
    const isNormalizeY = (0, util_1.find)(transform, ({ type }) => type === 'normalizeY');
    const yField = (0, util_1.get)(encode, ['y', 'field']);
    const value = data[i][yField];
    return (newValue) => {
        if (isNormalizeY) {
            if (v === 1) {
                return newValue;
            }
            return (newValue / (1 - newValue) / (v / (1 - v))) * value;
        }
        return newValue;
    };
};
// Point shape select change style.
const selectedPointsStyle = (pointsShape, selection, defaultStyle) => {
    pointsShape.forEach((shape, index) => {
        shape.attr('stroke', selection[1] === index
            ? defaultStyle['activeStroke']
            : defaultStyle['stroke']);
    });
};
// Create help show message shape.
const createHelpShape = (group, circle, pathStyle, labelStyle) => {
    const pathShape = new g_1.Path({
        style: pathStyle,
    });
    const labelShape = new g_1.Text({
        style: labelStyle,
    });
    circle.appendChild(labelShape);
    group.appendChild(pathShape);
    return [pathShape, labelShape];
};
// Get color scale type.
const getColorType = (scaleColor, color) => {
    const indexOf = (0, util_1.get)(scaleColor, ['options', 'range', 'indexOf']);
    if (!indexOf)
        return;
    const i = scaleColor.options.range.indexOf(color);
    return scaleColor.sortedDomain[i];
};
// Get the same direction new point.
const getSamePointPosition = (center, point, target) => {
    const oldR = (0, utils_1.getPointsR)(center, point);
    const newR = (0, utils_1.getPointsR)(center, target);
    const ratio = newR / oldR;
    const newX = center[0] + (point[0] - center[0]) * ratio;
    const newY = center[1] + (point[1] - center[1]) * ratio;
    return [newX, newY];
};
/**
 * ElementPointMove interaction.
 */
function ElementPointMove(elementPointMoveOptions = {}) {
    const { selection = [], precision = 2 } = elementPointMoveOptions, style = __rest(elementPointMoveOptions, ["selection", "precision"]);
    const defaultStyle = Object.assign(Object.assign({}, DEFAULT_STYLE), (style || {}));
    // Shape default style.
    const pathDefaultStyle = (0, helper_1.subObject)(defaultStyle, 'path');
    const labelDefaultStyle = (0, helper_1.subObject)(defaultStyle, 'label');
    const pointDefaultStyle = (0, helper_1.subObject)(defaultStyle, 'point');
    return (context, _, emitter) => {
        const { update, setState, container, view, options: { marks, coordinate: coordinateOptions }, } = context;
        const plotArea = (0, utils_1.selectPlotArea)(container);
        let elements = (0, utils_1.getElements)(plotArea);
        let newState;
        let newSelection = selection;
        const { transform = [], type: coordinateType } = coordinateOptions;
        const isTranspose = !!(0, util_1.find)(transform, ({ type }) => type === 'transpose');
        const isPolar = coordinateType === 'polar';
        const isTheta = coordinateType === 'theta';
        const isArea = !!(0, util_1.find)(elements, ({ markType }) => markType === 'area');
        if (isArea) {
            elements = elements.filter(({ markType }) => markType === 'area');
        }
        // Create points
        const pointsGroup = new g_1.Group({
            style: {
                // Tooltip point need down.
                zIndex: 2,
            },
        });
        plotArea.appendChild(pointsGroup);
        const selectedChange = () => {
            emitter.emit('element-point:select', {
                nativeEvent: true,
                data: {
                    selection: newSelection,
                },
            });
        };
        const dataChange = (changeData, data) => {
            emitter.emit('element-point:moved', {
                nativeEvent: true,
                data: {
                    changeData,
                    data,
                },
            });
        };
        // Element click change style.
        const elementClick = (e) => {
            const element = e.target;
            newSelection = [element.parentNode.childNodes.indexOf(element)];
            selectedChange();
            createPoints(element);
        };
        const elementSelect = (d) => {
            const { data: { selection }, nativeEvent, } = d;
            if (nativeEvent)
                return;
            newSelection = selection;
            const element = (0, util_1.get)(elements, [newSelection === null || newSelection === void 0 ? void 0 : newSelection[0]]);
            if (element) {
                createPoints(element);
            }
        };
        // Create select element points.
        const createPoints = (element) => {
            const { attributes, markType, __data__: data } = element;
            const { stroke: fill } = attributes;
            const { points, seriesTitle, color, title, seriesX, y1 } = data;
            // Transpose Currently only do mark interval;
            if (isTranspose && markType !== 'interval')
                return;
            const { scale, coordinate } = (newState === null || newState === void 0 ? void 0 : newState.view) || view;
            const { color: scaleColor, y: scaleY, x: scaleX } = scale;
            const center = coordinate.getCenter();
            pointsGroup.removeChildren();
            let downPoint;
            const updateView = (x, y, color, markTypes) => __awaiter(this, void 0, void 0, function* () {
                setState('elementPointMove', (viewOptions) => {
                    var _a;
                    // Update marks.
                    const newMarks = (((_a = newState === null || newState === void 0 ? void 0 : newState.options) === null || _a === void 0 ? void 0 : _a.marks) || marks).map((mark) => {
                        if (!markTypes.includes(mark.type))
                            return mark;
                        const { data, encode } = mark;
                        const encodeKeys = Object.keys(encode);
                        // Get change new one element data.
                        const newChangeData = encodeKeys.reduce((value, key) => {
                            const dataKey = encode[key];
                            if (key === 'x') {
                                value[dataKey] = x;
                            }
                            if (key === 'y') {
                                value[dataKey] = y;
                            }
                            if (key === 'color') {
                                value[dataKey] = color;
                            }
                            return value;
                        }, {});
                        // Get change new all data.
                        const newData = getNewData(newChangeData, data, encode);
                        dataChange(newChangeData, newData);
                        return (0, util_1.deepMix)({}, mark, {
                            data: newData,
                            // No need animate
                            animate: false,
                        });
                    });
                    return Object.assign(Object.assign({}, viewOptions), { marks: newMarks });
                });
                return yield update('elementPointMove');
            });
            if (['line', 'area'].includes(markType)) {
                points.forEach((p, index) => {
                    const title = scaleX.invert(seriesX[index]);
                    // Area points have bottom point.
                    if (!title)
                        return;
                    const circle = new g_1.Circle({
                        name: MOVE_POINT_NAME,
                        style: Object.assign({ cx: p[0], cy: p[1], fill }, pointDefaultStyle),
                    });
                    const ratioTransform = getPathDataRatioTransformFn(element, index);
                    circle.addEventListener('mousedown', (e) => {
                        const oldPoint = coordinate.output([seriesX[index], 0]);
                        const pathLength = seriesTitle === null || seriesTitle === void 0 ? void 0 : seriesTitle.length;
                        container.attr('cursor', 'move');
                        if (newSelection[1] !== index) {
                            newSelection[1] = index;
                            selectedChange();
                        }
                        selectedPointsStyle(pointsGroup.childNodes, newSelection, pointDefaultStyle);
                        const [pathShape, labelShape] = createHelpShape(pointsGroup, circle, pathDefaultStyle, labelDefaultStyle);
                        // Point move change text
                        const pointMousemove = (e) => {
                            const newCy = p[1] + e.clientY - downPoint[1];
                            // Area/Radar chart.
                            if (isArea) {
                                // Radar chart.
                                if (isPolar) {
                                    const newCx = p[0] + e.clientX - downPoint[0];
                                    const [newX, newY] = getSamePointPosition(center, oldPoint, [
                                        newCx,
                                        newCy,
                                    ]);
                                    const [, initY] = coordinate.output([1, scaleY.output(0)]);
                                    const [, y] = coordinate.invert([
                                        newX,
                                        initY - (points[index + pathLength][1] - newY),
                                    ]);
                                    const nextIndex = (index + 1) % pathLength;
                                    const lastIndex = (index - 1 + pathLength) % pathLength;
                                    const newPath = (0, utils_1.getPointsPath)([
                                        points[lastIndex],
                                        [newX, newY],
                                        seriesTitle[nextIndex] && points[nextIndex],
                                    ]);
                                    labelShape.attr('text', ratioTransform(scaleY.invert(y)).toFixed(precision));
                                    pathShape.attr('d', newPath);
                                    circle.attr('cx', newX);
                                    circle.attr('cy', newY);
                                }
                                else {
                                    // Area chart.
                                    const [, initY] = coordinate.output([1, scaleY.output(0)]);
                                    const [, y] = coordinate.invert([
                                        p[0],
                                        initY - (points[index + pathLength][1] - newCy),
                                    ]);
                                    const newPath = (0, utils_1.getPointsPath)([
                                        points[index - 1],
                                        [p[0], newCy],
                                        seriesTitle[index + 1] && points[index + 1],
                                    ]);
                                    labelShape.attr('text', ratioTransform(scaleY.invert(y)).toFixed(precision));
                                    pathShape.attr('d', newPath);
                                    circle.attr('cy', newCy);
                                }
                            }
                            else {
                                // Line chart.
                                const [, y] = coordinate.invert([p[0], newCy]);
                                const newPath = (0, utils_1.getPointsPath)([
                                    points[index - 1],
                                    [p[0], newCy],
                                    points[index + 1],
                                ]);
                                labelShape.attr('text', scaleY.invert(y).toFixed(precision));
                                pathShape.attr('d', newPath);
                                circle.attr('cy', newCy);
                            }
                        };
                        downPoint = [e.clientX, e.clientY];
                        window.addEventListener('mousemove', pointMousemove);
                        const mouseupFn = () => __awaiter(this, void 0, void 0, function* () {
                            container.attr('cursor', 'default');
                            window.removeEventListener('mousemove', pointMousemove);
                            container.removeEventListener('mouseup', mouseupFn);
                            if ((0, util_1.isUndefined)(labelShape.attr('text')))
                                return;
                            const y = Number(labelShape.attr('text'));
                            const colorType = getColorType(scaleColor, color);
                            newState = yield updateView(title, y, colorType, [
                                'line',
                                'area',
                            ]);
                            labelShape.remove();
                            pathShape.remove();
                            createPoints(element);
                        });
                        container.addEventListener('mouseup', mouseupFn);
                    });
                    pointsGroup.appendChild(circle);
                });
                selectedPointsStyle(pointsGroup.childNodes, newSelection, pointDefaultStyle);
            }
            else if (markType === 'interval') {
                // Column chart point.
                let circlePoint = [(points[0][0] + points[1][0]) / 2, points[0][1]];
                // Bar chart point.
                if (isTranspose) {
                    circlePoint = [points[0][0], (points[0][1] + points[1][1]) / 2];
                }
                else if (isTheta) {
                    // Pie chart point.
                    circlePoint = points[0];
                }
                const ratioTransform = getIntervalDataRatioTransformFn(element);
                const circle = new g_1.Circle({
                    name: MOVE_POINT_NAME,
                    style: Object.assign(Object.assign({ cx: circlePoint[0], cy: circlePoint[1], fill }, pointDefaultStyle), { stroke: pointDefaultStyle['activeStroke'] }),
                });
                circle.addEventListener('mousedown', (e) => {
                    container.attr('cursor', 'move');
                    const colorType = getColorType(scaleColor, color);
                    const [pathShape, labelShape] = createHelpShape(pointsGroup, circle, pathDefaultStyle, labelDefaultStyle);
                    // Point move change text
                    const pointMousemove = (e) => {
                        if (isTranspose) {
                            // Bar chart.
                            const newCx = circlePoint[0] + e.clientX - downPoint[0];
                            const [initX] = coordinate.output([
                                scaleY.output(0),
                                scaleY.output(0),
                            ]);
                            const [, x] = coordinate.invert([
                                initX + (newCx - points[2][0]),
                                circlePoint[1],
                            ]);
                            const newPath = (0, utils_1.getPointsPath)([
                                [newCx, points[0][1]],
                                [newCx, points[1][1]],
                                points[2],
                                points[3],
                            ], true);
                            labelShape.attr('text', ratioTransform(scaleY.invert(x)).toFixed(precision));
                            pathShape.attr('d', newPath);
                            circle.attr('cx', newCx);
                        }
                        else if (isTheta) {
                            // Pie chart.
                            const newCy = circlePoint[1] + e.clientY - downPoint[1];
                            const newCx = circlePoint[0] + e.clientX - downPoint[0];
                            const [newXOut, newYOut] = getSamePointPosition(center, [newCx, newCy], circlePoint);
                            const [newXIn, newYIn] = getSamePointPosition(center, [newCx, newCy], points[1]);
                            const lastPercent = coordinate.invert([newXOut, newYOut])[1];
                            const percent = y1 - lastPercent;
                            if (percent < 0)
                                return;
                            const newPath = (0, utils_1.getThetaPath)(center, [[newXOut, newYOut], [newXIn, newYIn], points[2], points[3]], percent > 0.5 ? 1 : 0);
                            labelShape.attr('text', ratioTransform(percent, true).toFixed(precision));
                            pathShape.attr('d', newPath);
                            circle.attr('cx', newXOut);
                            circle.attr('cy', newYOut);
                        }
                        else {
                            // Column chart.
                            const newCy = circlePoint[1] + e.clientY - downPoint[1];
                            const [, initY] = coordinate.output([1, scaleY.output(0)]);
                            const [, y] = coordinate.invert([
                                circlePoint[0],
                                initY - (points[2][1] - newCy),
                            ]);
                            const newPath = (0, utils_1.getPointsPath)([
                                [points[0][0], newCy],
                                [points[1][0], newCy],
                                points[2],
                                points[3],
                            ], true);
                            labelShape.attr('text', ratioTransform(scaleY.invert(y)).toFixed(precision));
                            pathShape.attr('d', newPath);
                            circle.attr('cy', newCy);
                        }
                    };
                    downPoint = [e.clientX, e.clientY];
                    window.addEventListener('mousemove', pointMousemove);
                    // Change mosueup change data and update 、clear shape.
                    const mouseupFn = () => __awaiter(this, void 0, void 0, function* () {
                        container.attr('cursor', 'default');
                        container.removeEventListener('mouseup', mouseupFn);
                        window.removeEventListener('mousemove', pointMousemove);
                        if ((0, util_1.isUndefined)(labelShape.attr('text')))
                            return;
                        const y = Number(labelShape.attr('text'));
                        newState = yield updateView(title, y, colorType, [markType]);
                        labelShape.remove();
                        pathShape.remove();
                        createPoints(element);
                    });
                    container.addEventListener('mouseup', mouseupFn);
                });
                pointsGroup.appendChild(circle);
            }
        };
        // Add EventListener.
        elements.forEach((element, index) => {
            if (newSelection[0] === index) {
                createPoints(element);
            }
            element.addEventListener('click', elementClick);
            element.addEventListener('mouseenter', elementMouseenter);
            element.addEventListener('mouseleave', elementMouseleave);
        });
        const rootClick = (e) => {
            const element = e === null || e === void 0 ? void 0 : e.target;
            if (!element ||
                (element.name !== MOVE_POINT_NAME && !elements.includes(element))) {
                newSelection = [];
                selectedChange();
                pointsGroup.removeChildren();
            }
        };
        emitter.on('element-point:select', elementSelect);
        emitter.on('element-point:unselect', rootClick);
        container.addEventListener('mousedown', rootClick);
        // Remove EventListener.
        return () => {
            pointsGroup.remove();
            emitter.off('element-point:select', elementSelect);
            emitter.off('element-point:unselect', rootClick);
            container.removeEventListener('mousedown', rootClick);
            elements.forEach((element) => {
                element.removeEventListener('click', elementClick);
                element.removeEventListener('mouseenter', elementMouseenter);
                element.removeEventListener('mouseleave', elementMouseleave);
            });
        };
    };
}
exports.ElementPointMove = ElementPointMove;
//# sourceMappingURL=elementPointMove.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829,"./utils":1751263816080}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816146, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.EMA = exports.Log = exports.Venn = exports.KDE = exports.Slice = exports.Join = exports.WordCloud = exports.Arc = exports.Sankey = exports.Tree = exports.Cluster = exports.Map = exports.Custom = exports.Inline = exports.SortBy = exports.Rename = exports.Pick = exports.Sort = exports.Filter = exports.Fold = exports.Fetch = void 0;
var fetch_1 = require("./fetch");
Object.defineProperty(exports, "Fetch", { enumerable: true, get: function () { return fetch_1.Fetch; } });
var fold_1 = require("./fold");
Object.defineProperty(exports, "Fold", { enumerable: true, get: function () { return fold_1.Fold; } });
var filter_1 = require("./filter");
Object.defineProperty(exports, "Filter", { enumerable: true, get: function () { return filter_1.Filter; } });
var sort_1 = require("./sort");
Object.defineProperty(exports, "Sort", { enumerable: true, get: function () { return sort_1.Sort; } });
var pick_1 = require("./pick");
Object.defineProperty(exports, "Pick", { enumerable: true, get: function () { return pick_1.Pick; } });
var rename_1 = require("./rename");
Object.defineProperty(exports, "Rename", { enumerable: true, get: function () { return rename_1.Rename; } });
var sortBy_1 = require("./sortBy");
Object.defineProperty(exports, "SortBy", { enumerable: true, get: function () { return sortBy_1.SortBy; } });
var inline_1 = require("./inline");
Object.defineProperty(exports, "Inline", { enumerable: true, get: function () { return inline_1.Inline; } });
var custom_1 = require("./custom");
Object.defineProperty(exports, "Custom", { enumerable: true, get: function () { return custom_1.Custom; } });
var map_1 = require("./map");
Object.defineProperty(exports, "Map", { enumerable: true, get: function () { return map_1.Map; } });
var cluster_1 = require("./cluster");
Object.defineProperty(exports, "Cluster", { enumerable: true, get: function () { return cluster_1.Cluster; } });
var tree_1 = require("./tree");
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return tree_1.Tree; } });
var sankey_1 = require("./sankey");
Object.defineProperty(exports, "Sankey", { enumerable: true, get: function () { return sankey_1.Sankey; } });
var arc_1 = require("./arc");
Object.defineProperty(exports, "Arc", { enumerable: true, get: function () { return arc_1.Arc; } });
var wordCloud_1 = require("./wordCloud");
Object.defineProperty(exports, "WordCloud", { enumerable: true, get: function () { return wordCloud_1.WordCloud; } });
var join_1 = require("./join");
Object.defineProperty(exports, "Join", { enumerable: true, get: function () { return join_1.Join; } });
var slice_1 = require("./slice");
Object.defineProperty(exports, "Slice", { enumerable: true, get: function () { return slice_1.Slice; } });
var kde_1 = require("./kde");
Object.defineProperty(exports, "KDE", { enumerable: true, get: function () { return kde_1.KDE; } });
var venn_1 = require("./venn");
Object.defineProperty(exports, "Venn", { enumerable: true, get: function () { return venn_1.Venn; } });
var log_1 = require("./log");
Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return log_1.Log; } });
var ema_1 = require("./ema");
Object.defineProperty(exports, "EMA", { enumerable: true, get: function () { return ema_1.EMA; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./fetch":1751263816147,"./fold":1751263816148,"./filter":1751263816149,"./sort":1751263816150,"./pick":1751263816151,"./rename":1751263816152,"./sortBy":1751263816153,"./inline":1751263816155,"./custom":1751263816156,"./map":1751263816157,"./cluster":1751263816012,"./tree":1751263816011,"./sankey":1751263815992,"./arc":1751263815999,"./wordCloud":1751263816158,"./join":1751263816161,"./slice":1751263816162,"./kde":1751263816163,"./venn":1751263816164,"./log":1751263816176,"./ema":1751263816177}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816147, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Fetch = void 0;
const d3_dsv_1 = require("@antv/vendor/d3-dsv");
const helper_1 = require("../utils/helper");
const Fetch = (options) => {
    const { value, format = value.split('.').pop(), delimiter = ',', autoType = true, } = options;
    return () => __awaiter(void 0, void 0, void 0, function* () {
        const response = yield fetch(value);
        if (format === 'csv') {
            // @see: https://github.com/d3/d3-dsv#dsv_parse
            const str = yield response.text();
            return (0, d3_dsv_1.dsvFormat)(delimiter).parse(str, autoType ? d3_dsv_1.autoType : helper_1.identity);
        }
        else if (format === 'json') {
            return yield response.json();
        }
        throw new Error(`Unknown format: ${format}.`);
    });
};
exports.Fetch = Fetch;
exports.Fetch.props = {};
//# sourceMappingURL=fetch.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816148, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Fold = exports.isEmpty = void 0;
function isEmpty(obj) {
    return !obj || Object.keys(obj).length === 0;
}
exports.isEmpty = isEmpty;
/**
 * Collapses (or “folds”) one or more data fields into two
 * properties: `key` (contains the original data field name)
 * and `value` (contains the original data value.)
 */
const Fold = (options) => {
    const { fields, key = 'key', value = 'value' } = options;
    return (data) => {
        if (isEmpty(fields))
            return data;
        return data.flatMap((d) => fields.map((f) => (Object.assign(Object.assign({}, d), { [key]: f, [value]: d[f] }))));
    };
};
exports.Fold = Fold;
exports.Fold.props = {};
//# sourceMappingURL=fold.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816149, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Filter = exports.defined = void 0;
function defined(d) {
    return d !== undefined && d !== null && !Number.isNaN(d);
}
exports.defined = defined;
/**
 * Filter data by specified fields and filter callback for each fields.
 * It saves datum with every fields defined by default.
 */
const Filter = (options) => {
    const { callback = defined } = options;
    return (data) => data.filter(callback);
};
exports.Filter = Filter;
exports.Filter.props = {};
//# sourceMappingURL=filter.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816150, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sort = exports.defined = void 0;
function defined(d) {
    return d !== undefined && d !== null && !Number.isNaN(d);
}
exports.defined = defined;
/**
 * Sort data similar with Array.prototypo.sort.
 */
const Sort = (options) => {
    const { callback } = options;
    return (data) => (Array.isArray(data) ? [...data].sort(callback) : data);
};
exports.Sort = Sort;
exports.Sort.props = {};
//# sourceMappingURL=sort.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816151, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Pick = void 0;
function pick(v, fields = []) {
    return fields.reduce((datum, field) => {
        // Pick the data deeply.
        if (field in v) {
            datum[field] = v[field];
        }
        return datum;
    }, {});
}
/**
 * Immutable data pick by specified fields.
 */
const Pick = (options) => {
    const { fields } = options;
    return (data) => data.map((d) => pick(d, fields));
};
exports.Pick = Pick;
exports.Pick.props = {};
//# sourceMappingURL=pick.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816152, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Rename = exports.isEmpty = void 0;
function isEmpty(obj) {
    return Object.keys(obj).length === 0;
}
exports.isEmpty = isEmpty;
/**
 * Immutable data rename by specified fields.
 */
const Rename = (options) => {
    return (data) => {
        if (!options || isEmpty(options))
            return data;
        const rename = (v) => Object.entries(v).reduce((datum, [key, value]) => ((datum[options[key] || key] = value), datum), {});
        return data.map(rename);
    };
};
exports.Rename = Rename;
exports.Rename.props = {};
//# sourceMappingURL=rename.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816153, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortBy = void 0;
const fields_1 = require("./utils/fields");
/**
 * Immutable data sort by specified fields.
 */
const SortBy = (options) => {
    const { fields: F = [] } = options;
    const normalizedF = (0, fields_1.normalizeFields)(F, true);
    return (data) => {
        const comparator = (a, b) => normalizedF.reduce((ret, [field, order = true]) => {
            if (ret !== 0) {
                return ret;
            }
            if (order) {
                return a[field] < b[field] ? -1 : +(a[field] !== b[field]);
            }
            else {
                return a[field] > b[field] ? -1 : +(a[field] !== b[field]);
            }
        }, 0);
        return [...data].sort(comparator);
    };
};
exports.SortBy = SortBy;
exports.SortBy.props = {};
//# sourceMappingURL=sortBy.js.map
}, function(modId) { var map = {"./utils/fields":1751263816154}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816154, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeFields = void 0;
/**
 *
 * @description Converts a random format array into a regular two-dimensional array
 * @example ['a', 'b', ['c', value]] => [['a', defaultValue], ['b', defaultValue], ['c', value]]
 */
function normalizeFields(fields, defaultValue) {
    return fields.map((d) => {
        if (Array.isArray(d)) {
            const [field, value = defaultValue] = d;
            return [field, value];
        }
        return [d, defaultValue];
    });
}
exports.normalizeFields = normalizeFields;
//# sourceMappingURL=fields.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816155, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Inline = void 0;
const Inline = (options) => {
    const { value } = options;
    return () => value;
};
exports.Inline = Inline;
exports.Inline.props = {};
//# sourceMappingURL=inline.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816156, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Custom = void 0;
const helper_1 = require("../utils/helper");
/**
 * Connector transfom by function.
 */
const Custom = (options) => {
    const { callback = helper_1.identity } = options;
    return (data) => callback(data);
};
exports.Custom = Custom;
exports.Custom.props = {};
//# sourceMappingURL=custom.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816157, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Map = void 0;
const helper_1 = require("../utils/helper");
/**
 * Map transform by function.
 */
const Map = (options) => {
    const { callback = helper_1.identity } = options;
    return (data) => (Array.isArray(data) ? data.map(callback) : data);
};
exports.Map = Map;
exports.Map.props = {};
//# sourceMappingURL=map.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816158, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WordCloud = exports.normalizeFontSize = exports.processImageMask = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const flow_1 = require("./utils/flow");
const d3_cloud_1 = require("./utils/d3-cloud");
const DEFAULT_OPTIONS = {
    fontSize: [20, 60],
    font: 'Impact',
    padding: 2,
    rotate: function () {
        return (~~(Math.random() * 6) - 3) * 30;
    },
};
/**
 * Process the image mask of wordCloud.
 * @param img
 * @returns
 */
function processImageMask(img) {
    return new Promise((res, rej) => {
        if (img instanceof HTMLImageElement) {
            res(img);
            return;
        }
        if (typeof img === 'string') {
            const image = new Image();
            image.crossOrigin = 'anonymous';
            image.src = img;
            image.onload = () => res(image);
            image.onerror = () => {
                console.error(`'image ${img} load failed !!!'`);
                rej();
            };
            return;
        }
        rej();
    });
}
exports.processImageMask = processImageMask;
/**
 * normalize fontSize range to d3-cloud fontSize function.
 * @param fontSize
 * @param range
 * @returns
 */
function normalizeFontSize(fontSize, range) {
    if (typeof fontSize === 'function')
        return fontSize;
    if (Array.isArray(fontSize)) {
        const [fMin, fMax] = fontSize;
        if (!range)
            return () => (fMax + fMin) / 2;
        const [min, max] = range;
        if (max === min)
            return () => (fMax + fMin) / 2;
        return ({ value }) => ((fMax - fMin) / (max - min)) * (value - min) + fMin;
    }
    return () => fontSize;
}
exports.normalizeFontSize = normalizeFontSize;
const WordCloud = (options, context) => {
    return (data) => __awaiter(void 0, void 0, void 0, function* () {
        const cloudOptions = Object.assign({}, DEFAULT_OPTIONS, options, {
            canvas: context.createCanvas,
        });
        const layout = (0, d3_cloud_1.tagCloud)();
        yield (0, flow_1.flow)(layout, cloudOptions)
            .set('fontSize', (v) => {
            const arr = data.map((d) => d.value);
            return normalizeFontSize(v, [(0, d3_array_1.min)(arr), (0, d3_array_1.max)(arr)]);
        })
            .set('font')
            .set('fontStyle')
            .set('fontWeight')
            .set('padding')
            .set('rotate')
            .set('size')
            .set('spiral')
            .set('timeInterval')
            .set('random')
            .set('text')
            .set('on')
            .set('canvas')
            .setAsync('imageMask', processImageMask, layout.createMask);
        layout.words([...data]);
        const result = layout.start();
        const [cw, ch] = cloudOptions.size;
        const defaultBounds = [
            { x: 0, y: 0 },
            { x: cw, y: ch },
        ];
        const { _bounds: bounds = defaultBounds, _tags, hasImage } = result;
        const tags = _tags.map((_a) => {
            var { x, y, font } = _a, rest = __rest(_a, ["x", "y", "font"]);
            return (Object.assign(Object.assign({}, rest), { x: x + cw / 2, y: y + ch / 2, fontFamily: font }));
        });
        // Append two data to replace the corner of top-left and bottom-right, avoid calculate the actual bounds will occur some error.
        const [{ x: tlx, y: tly }, { x: brx, y: bry }] = bounds;
        const invisibleText = { text: '', value: 0, opacity: 0, fontSize: 0 };
        tags.push(Object.assign(Object.assign({}, invisibleText), { x: hasImage ? 0 : tlx, y: hasImage ? 0 : tly }), Object.assign(Object.assign({}, invisibleText), { x: hasImage ? cw : brx, y: hasImage ? ch : bry }));
        return tags;
    });
};
exports.WordCloud = WordCloud;
exports.WordCloud.props = {};
//# sourceMappingURL=wordCloud.js.map
}, function(modId) { var map = {"./utils/flow":1751263816159,"./utils/d3-cloud":1751263816160}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816159, function(require, module, exports) {

var __awaiter = (this && this.__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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.flow = void 0;
/**
 * @todo Combine with the `Container` util
 */
function flow(target, source) {
    return {
        set(key, normalize, callback) {
            if (source[key] === undefined)
                return this;
            const value = normalize ? normalize.call(null, source[key]) : source[key];
            if (callback)
                callback.call(null, value);
            else if (typeof target[key] === 'function')
                target[key](value);
            else
                target[key] = value;
            return this;
        },
        setAsync(key, normalize, callback) {
            return __awaiter(this, void 0, void 0, function* () {
                if (source[key] === undefined)
                    return this;
                const value = normalize
                    ? yield normalize.call(null, source[key])
                    : source[key];
                if (callback)
                    callback.call(null, value);
                else if (typeof target[key] === 'function')
                    target[key](value);
                else
                    target[key] = value;
                return this;
            });
        },
    };
}
exports.flow = flow;
//# sourceMappingURL=flow.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816160, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.tagCloud = void 0;
const cloudRadians = Math.PI / 180, cw = (1 << 11) >> 5, ch = 1 << 11;
function cloudText(d) {
    return d.text;
}
function cloudFont() {
    return 'serif';
}
function cloudFontNormal() {
    return 'normal';
}
function cloudFontSize(d) {
    return d.value;
}
function cloudRotate() {
    return ~~(Math.random() * 2) * 90;
}
function cloudPadding() {
    return 1;
}
function cloudDispatch() {
    return;
}
// Fetches a monochrome sprite bitmap for the specified text.
// Load in batches for speed.
function cloudSprite(contextAndRatio, d, data, di) {
    if (d.sprite)
        return;
    const c = contextAndRatio.context, ratio = contextAndRatio.ratio;
    c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
    let x = 0, y = 0, maxh = 0;
    const n = data.length;
    --di;
    while (++di < n) {
        d = data[di];
        c.save();
        c.font =
            d.style +
                ' ' +
                d.weight +
                ' ' +
                ~~((d.size + 1) / ratio) +
                'px ' +
                d.font;
        let w = c.measureText(d.text + 'm').width * ratio, h = d.size << 1;
        if (d.rotate) {
            const sr = Math.sin(d.rotate * cloudRadians), cr = Math.cos(d.rotate * cloudRadians), wcr = w * cr, wsr = w * sr, hcr = h * cr, hsr = h * sr;
            w =
                ((Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5) << 5;
            h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
        }
        else {
            w = ((w + 0x1f) >> 5) << 5;
        }
        if (h > maxh)
            maxh = h;
        if (x + w >= cw << 5) {
            x = 0;
            y += maxh;
            maxh = 0;
        }
        if (y + h >= ch)
            break;
        c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
        if (d.rotate)
            c.rotate(d.rotate * cloudRadians);
        c.fillText(d.text, 0, 0);
        if (d.padding) {
            c.lineWidth = 2 * d.padding;
            c.strokeText(d.text, 0, 0);
        }
        c.restore();
        d.width = w;
        d.height = h;
        d.xoff = x;
        d.yoff = y;
        d.x1 = w >> 1;
        d.y1 = h >> 1;
        d.x0 = -d.x1;
        d.y0 = -d.y1;
        d.hasText = true;
        x += w;
    }
    const pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = [];
    while (--di >= 0) {
        d = data[di];
        if (!d.hasText)
            continue;
        const w = d.width, w32 = w >> 5;
        let h = d.y1 - d.y0;
        // Zero the buffer
        for (let i = 0; i < h * w32; i++)
            sprite[i] = 0;
        x = d.xoff;
        if (x == null)
            return;
        y = d.yoff;
        let seen = 0, seenRow = -1;
        for (let j = 0; j < h; j++) {
            for (let i = 0; i < w; i++) {
                const k = w32 * j + (i >> 5), m = pixels[((y + j) * (cw << 5) + (x + i)) << 2]
                    ? 1 << (31 - (i % 32))
                    : 0;
                sprite[k] |= m;
                seen |= m;
            }
            if (seen)
                seenRow = j;
            else {
                d.y0++;
                h--;
                j--;
                y++;
            }
        }
        d.y1 = d.y0 + seenRow;
        d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
    }
}
// Use mask-based collision detection.
function cloudCollide(tag, board, sw) {
    sw >>= 5;
    const sprite = tag.sprite, w = tag.width >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0;
    let x = (tag.y + tag.y0) * sw + (lx >> 5), last;
    for (let j = 0; j < h; j++) {
        last = 0;
        for (let i = 0; i <= w; i++) {
            if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) &
                board[x + i])
                return true;
        }
        x += sw;
    }
    return false;
}
function cloudBounds(bounds, d) {
    const b0 = bounds[0], b1 = bounds[1];
    if (d.x + d.x0 < b0.x)
        b0.x = d.x + d.x0;
    if (d.y + d.y0 < b0.y)
        b0.y = d.y + d.y0;
    if (d.x + d.x1 > b1.x)
        b1.x = d.x + d.x1;
    if (d.y + d.y1 > b1.y)
        b1.y = d.y + d.y1;
}
function collideRects(a, b) {
    return (a.x + a.x1 > b[0].x &&
        a.x + a.x0 < b[1].x &&
        a.y + a.y1 > b[0].y &&
        a.y + a.y0 < b[1].y);
}
function archimedeanSpiral(size) {
    const e = size[0] / size[1];
    return function (t) {
        return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)];
    };
}
function rectangularSpiral(size) {
    const dy = 4, dx = (dy * size[0]) / size[1];
    let x = 0, y = 0;
    return function (t) {
        const sign = t < 0 ? -1 : 1;
        // See triangular numbers: T_n = n * (n + 1) / 2.
        switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {
            case 0:
                x += dx;
                break;
            case 1:
                y += dy;
                break;
            case 2:
                x -= dx;
                break;
            default:
                y -= dy;
                break;
        }
        return [x, y];
    };
}
// TODO reuse arrays?
function zeroArray(n) {
    const a = [];
    let i = -1;
    while (++i < n)
        a[i] = 0;
    return a;
}
function cloudCanvas() {
    return document.createElement('canvas');
}
function functor(d) {
    return typeof d === 'function'
        ? d
        : function () {
            return d;
        };
}
const spirals = {
    archimedean: archimedeanSpiral,
    rectangular: rectangularSpiral,
};
function tagCloud() {
    let size = [256, 256], text = cloudText, font = cloudFont, fontSize = cloudFontSize, fontWeight = cloudFontNormal, rotate = cloudRotate, padding = cloudPadding, spiral = archimedeanSpiral, random = Math.random, event = cloudDispatch, words = [], timer = null, timeInterval = Infinity, canvas = cloudCanvas;
    const fontStyle = cloudFontNormal;
    const cloud = {};
    cloud.start = function () {
        const [width, height] = size;
        const contextAndRatio = getContext(canvas()), board = cloud.board ? cloud.board : zeroArray((size[0] >> 5) * size[1]), n = words.length, tags = [], data = words
            .map(function (d, i, data) {
            d.text = text.call(this, d, i, data);
            d.font = font.call(this, d, i, data);
            d.style = fontStyle.call(this, d, i, data);
            d.weight = fontWeight.call(this, d, i, data);
            d.rotate = rotate.call(this, d, i, data);
            d.size = ~~fontSize.call(this, d, i, data);
            d.padding = padding.call(this, d, i, data);
            return d;
        })
            .sort(function (a, b) {
            return b.size - a.size;
        });
        let i = -1, bounds = !cloud.board
            ? undefined
            : [
                {
                    x: 0,
                    y: 0,
                },
                {
                    x: width,
                    y: height,
                },
            ];
        if (timer)
            clearInterval(timer);
        timer = setInterval(step, 0);
        step();
        function step() {
            const start = Date.now();
            while (Date.now() - start < timeInterval && ++i < n) {
                const d = data[i];
                d.x = (width * (random() + 0.5)) >> 1;
                d.y = (height * (random() + 0.5)) >> 1;
                cloudSprite(contextAndRatio, d, data, i);
                if (d.hasText && place(board, d, bounds)) {
                    event.call(null, 'word', { cloud, word: d });
                    tags.push(d);
                    if (bounds) {
                        if (!cloud.hasImage) {
                            // update bounds if image mask not set
                            cloudBounds(bounds, d);
                        }
                    }
                    else {
                        bounds = [
                            { x: d.x + d.x0, y: d.y + d.y0 },
                            { x: d.x + d.x1, y: d.y + d.y1 },
                        ];
                    }
                    // Temporary hack
                    d.x -= size[0] >> 1;
                    d.y -= size[1] >> 1;
                }
            }
            cloud._tags = tags;
            cloud._bounds = bounds;
            if (i >= n) {
                cloud.stop();
                event.call(null, 'end', { cloud, words: tags, bounds });
            }
        }
        return cloud;
    };
    cloud.stop = function () {
        if (timer) {
            clearInterval(timer);
            timer = null;
        }
        return cloud;
    };
    function getContext(canvas) {
        canvas.width = canvas.height = 1;
        const ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2);
        canvas.width = (cw << 5) / ratio;
        canvas.height = ch / ratio;
        const context = canvas.getContext('2d');
        context.fillStyle = context.strokeStyle = 'red';
        context.textAlign = 'center';
        context.textBaseline = 'middle';
        return { context, ratio };
    }
    function place(board, tag, bounds) {
        // const perimeter = [{ x: 0, y: 0 }, { x: size[0], y: size[1] }],
        const startX = tag.x, startY = tag.y, maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), s = spiral(size), dt = random() < 0.5 ? 1 : -1;
        let dxdy, t = -dt, dx, dy;
        while ((dxdy = s((t += dt)))) {
            dx = ~~dxdy[0];
            dy = ~~dxdy[1];
            if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta)
                break;
            tag.x = startX + dx;
            tag.y = startY + dy;
            if (tag.x + tag.x0 < 0 ||
                tag.y + tag.y0 < 0 ||
                tag.x + tag.x1 > size[0] ||
                tag.y + tag.y1 > size[1])
                continue;
            // TODO only check for collisions within current bounds.
            if (!bounds || !cloudCollide(tag, board, size[0])) {
                if (!bounds || collideRects(tag, bounds)) {
                    const sprite = tag.sprite, w = tag.width >> 5, sw = size[0] >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0;
                    let last, x = (tag.y + tag.y0) * sw + (lx >> 5);
                    for (let j = 0; j < h; j++) {
                        last = 0;
                        for (let i = 0; i <= w; i++) {
                            board[x + i] |=
                                (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
                        }
                        x += sw;
                    }
                    delete tag.sprite;
                    return true;
                }
            }
        }
        return false;
    }
    cloud.createMask = (img) => {
        const can = document.createElement('canvas');
        const [width, height] = size;
        // 当 width 或 height 为 0 时，调用 cxt.getImageData 会报错
        if (!width || !height) {
            return;
        }
        const w32 = width >> 5;
        const board = zeroArray((width >> 5) * height);
        can.width = width;
        can.height = height;
        const cxt = can.getContext('2d');
        cxt.drawImage(img, 0, 0, img.width, img.height, 0, 0, width, height);
        const imageData = cxt.getImageData(0, 0, width, height).data;
        for (let j = 0; j < height; j++) {
            for (let i = 0; i < width; i++) {
                const k = w32 * j + (i >> 5);
                const tmp = (j * width + i) << 2;
                const flag = imageData[tmp] >= 250 &&
                    imageData[tmp + 1] >= 250 &&
                    imageData[tmp + 2] >= 250;
                const m = flag ? 1 << (31 - (i % 32)) : 0;
                board[k] |= m;
            }
        }
        cloud.board = board;
        cloud.hasImage = true;
    };
    cloud.timeInterval = function (_) {
        timeInterval = _ == null ? Infinity : _;
    };
    cloud.words = function (_) {
        words = _;
    };
    cloud.size = function (_ = []) {
        size = [+_[0], +_[1]];
    };
    cloud.text = function (_) {
        text = functor(_);
    };
    cloud.font = function (_) {
        font = functor(_);
    };
    cloud.fontWeight = function (_) {
        fontWeight = functor(_);
    };
    cloud.rotate = function (_) {
        rotate = functor(_);
    };
    cloud.canvas = function (_) {
        canvas = functor(_);
    };
    cloud.spiral = function (_) {
        spiral = spirals[_] || _;
    };
    cloud.fontSize = function (_) {
        fontSize = functor(_);
    };
    cloud.padding = function (_) {
        padding = functor(_);
    };
    cloud.random = function (_) {
        random = functor(_);
    };
    cloud.on = function (_) {
        event = functor(_);
    };
    return cloud;
}
exports.tagCloud = tagCloud;
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816161, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Join = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
function field(key) {
    return typeof key === 'string' ? (d) => d[key] : key;
}
/**
 * Join data with another dataset by SQL style.
 */
const Join = (options) => {
    // const { fromKey, from, key, unknown = NaN, ...rest } = options;
    const { join, on, select = [], as = select, unknown = NaN } = options;
    const [key, fromKey] = on;
    const fk = field(fromKey);
    const k = field(key);
    const keyData = (0, d3_array_1.rollup)(join, ([d]) => d, // Get the first matched.
    (d) => fk(d));
    return (data) => data.map((d) => {
        const source = keyData.get(k(d));
        return Object.assign(Object.assign({}, d), select.reduce((prev, key, idx) => ((prev[as[idx]] = source ? source[key] : unknown), prev), {}));
    });
};
exports.Join = Join;
exports.Join.props = {};
//# sourceMappingURL=join.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816162, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Slice = void 0;
/**
 * Slice data between `start` ~ `end`.
 * Same with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
 */
const Slice = (options) => {
    const { start, end } = options;
    return (data) => data.slice(start, end);
};
exports.Slice = Slice;
exports.Slice.props = {};
//# sourceMappingURL=slice.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816163, function(require, module, exports) {

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KDE = exports.defined = void 0;
const pdfast_1 = __importDefault(require("pdfast"));
const d3_array_1 = require("@antv/vendor/d3-array");
function defined(d) {
    return d !== undefined && d !== null && !Number.isNaN(d);
}
exports.defined = defined;
/**
 * Kernel Density Estimation base on [pdfast](https://www.npmjs.com/package/pdfast),
 * generating probability density function (pdf) using triangular kernel,
 * optimized to run in O(N + K).
 */
const KDE = (options) => {
    const { field, groupBy, as = ['y', 'size'], min, max, size = 10, width, } = options;
    const [yField, sizeField] = as;
    return (data) => {
        const gs = Array.from((0, d3_array_1.group)(data, (d) => groupBy.map((gb) => d[gb]).join('-')).values());
        return gs.map((g) => {
            const pdfResult = pdfast_1.default.create(g.map((i) => i[field]), {
                min,
                max,
                size,
                width,
            });
            const _y = pdfResult.map((result) => result.x);
            const _size = pdfResult.map((result) => result.y);
            return Object.assign(Object.assign({}, g[0]), { [yField]: _y, [sizeField]: _size });
        });
    };
};
exports.KDE = KDE;
exports.KDE.props = {};
//# sourceMappingURL=kde.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816164, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Venn = void 0;
const venn_1 = require("./utils/venn");
/**
 * Layout venn data, get the path string for each set.
 */
const Venn = (options) => {
    const { sets = 'sets', size = 'size', as = ['key', 'path'], padding = 0, } = options;
    const [key, path] = as;
    return (data) => {
        // Transform the data, venn layout use `sets` and `size` field.
        const vennData = data.map((d) => (Object.assign(Object.assign({}, d), { sets: d[sets], size: d[size], [key]: d.sets.join('&') })));
        // Sort data, avoid data occlusion.
        vennData.sort((a, b) => a.sets.length - b.sets.length);
        // Layout venn data.
        const solution = (0, venn_1.venn)(vennData);
        let circles;
        return vennData.map((datum) => {
            const setsValue = datum[sets];
            const pathFunc = ({ width, height }) => {
                circles = circles
                    ? circles
                    : (0, venn_1.scaleSolution)(solution, width, height, padding);
                const setCircles = setsValue.map((set) => circles[set]);
                let p = (0, venn_1.intersectionAreaPath)(setCircles);
                // Close the path for event picker.
                if (!/[zZ]$/.test(p))
                    p += ' Z';
                return p;
            };
            return Object.assign(Object.assign({}, datum), { [path]: pathFunc });
        });
    };
};
exports.Venn = Venn;
exports.Venn.props = {};
//# sourceMappingURL=venn.js.map
}, function(modId) { var map = {"./utils/venn":1751263816165}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816165, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.intersectionAreaPath = exports.venn = exports.scaleSolution = void 0;
/**
 * Code from https://github.com/benfred/venn.js/blob/master/src/.
 */
var layout_1 = require("./layout");
Object.defineProperty(exports, "scaleSolution", { enumerable: true, get: function () { return layout_1.scaleSolution; } });
Object.defineProperty(exports, "venn", { enumerable: true, get: function () { return layout_1.venn; } });
var diagram_1 = require("./diagram");
Object.defineProperty(exports, "intersectionAreaPath", { enumerable: true, get: function () { return diagram_1.intersectionAreaPath; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./layout":1751263816166,"./diagram":1751263816175}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816166, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.scaleSolution = exports.normalizeSolution = exports.disjointCluster = exports.lossFunction = exports.greedyLayout = exports.constrainedMDSLayout = exports.bestInitialLayout = exports.getDistanceMatrices = exports.distanceFromIntersectArea = exports.venn = void 0;
const fmin_1 = require("./fmin");
const circleintersection_1 = require("./circleintersection");
/** given a list of set objects, and their corresponding overlaps.
updates the (x, y, radius) attribute on each set such that their positions
roughly correspond to the desired overlaps */
function venn(areas, parameters) {
    parameters = parameters || {};
    parameters.maxIterations = parameters.maxIterations || 500;
    const initialLayout = parameters.initialLayout || bestInitialLayout;
    const loss = parameters.lossFunction || lossFunction;
    // add in missing pairwise areas as having 0 size
    areas = addMissingAreas(areas);
    // initial layout is done greedily
    const circles = initialLayout(areas, parameters);
    // transform x/y coordinates to a vector to optimize
    const initial = [], setids = [];
    let setid;
    for (setid in circles) {
        // eslint-disable-next-line
        if (circles.hasOwnProperty(setid)) {
            initial.push(circles[setid].x);
            initial.push(circles[setid].y);
            setids.push(setid);
        }
    }
    // optimize initial layout from our loss function
    const solution = (0, fmin_1.nelderMead)(function (values) {
        const current = {};
        for (let i = 0; i < setids.length; ++i) {
            const setid = setids[i];
            current[setid] = {
                x: values[2 * i],
                y: values[2 * i + 1],
                radius: circles[setid].radius,
            };
        }
        return loss(current, areas);
    }, initial, parameters);
    // transform solution vector back to x/y points
    const positions = solution.x;
    for (let i = 0; i < setids.length; ++i) {
        setid = setids[i];
        circles[setid].x = positions[2 * i];
        circles[setid].y = positions[2 * i + 1];
    }
    return circles;
}
exports.venn = venn;
const SMALL = 1e-10;
/** Returns the distance necessary for two circles of radius r1 + r2 to
have the overlap area 'overlap' */
function distanceFromIntersectArea(r1, r2, overlap) {
    // handle complete overlapped circles
    if (Math.min(r1, r2) * Math.min(r1, r2) * Math.PI <= overlap + SMALL) {
        return Math.abs(r1 - r2);
    }
    return (0, fmin_1.bisect)(function (distance) {
        return (0, circleintersection_1.circleOverlap)(r1, r2, distance) - overlap;
    }, 0, r1 + r2);
}
exports.distanceFromIntersectArea = distanceFromIntersectArea;
/** Missing pair-wise intersection area data can cause problems:
 treating as an unknown means that sets will be laid out overlapping,
 which isn't what people expect. To reflect that we want disjoint sets
 here, set the overlap to 0 for all missing pairwise set intersections */
function addMissingAreas(areas) {
    areas = areas.slice();
    // two circle intersections that aren't defined
    const ids = [], pairs = {};
    let i, j, a, b;
    for (i = 0; i < areas.length; ++i) {
        const area = areas[i];
        if (area.sets.length == 1) {
            ids.push(area.sets[0]);
        }
        else if (area.sets.length == 2) {
            a = area.sets[0];
            b = area.sets[1];
            // @ts-ignore
            pairs[[a, b]] = true;
            // @ts-ignore
            pairs[[b, a]] = true;
        }
    }
    ids.sort((a, b) => {
        return a > b ? 1 : -1;
    });
    for (i = 0; i < ids.length; ++i) {
        a = ids[i];
        for (j = i + 1; j < ids.length; ++j) {
            b = ids[j];
            // @ts-ignore
            if (!([a, b] in pairs)) {
                areas.push({ sets: [a, b], size: 0 });
            }
        }
    }
    return areas;
}
/// Returns two matrices, one of the euclidean distances between the sets
/// and the other indicating if there are subset or disjoint set relationships
function getDistanceMatrices(areas, sets, setids) {
    // initialize an empty distance matrix between all the points
    const distances = (0, fmin_1.zerosM)(sets.length, sets.length), constraints = (0, fmin_1.zerosM)(sets.length, sets.length);
    // compute required distances between all the sets such that
    // the areas match
    areas
        .filter(function (x) {
        return x.sets.length == 2;
    })
        .map(function (current) {
        const left = setids[current.sets[0]], right = setids[current.sets[1]], r1 = Math.sqrt(sets[left].size / Math.PI), r2 = Math.sqrt(sets[right].size / Math.PI), distance = distanceFromIntersectArea(r1, r2, current.size);
        distances[left][right] = distances[right][left] = distance;
        // also update constraints to indicate if its a subset or disjoint
        // relationship
        let c = 0;
        if (current.size + 1e-10 >= Math.min(sets[left].size, sets[right].size)) {
            c = 1;
        }
        else if (current.size <= 1e-10) {
            c = -1;
        }
        constraints[left][right] = constraints[right][left] = c;
    });
    return { distances: distances, constraints: constraints };
}
exports.getDistanceMatrices = getDistanceMatrices;
/// computes the gradient and loss simulatenously for our constrained MDS optimizer
function constrainedMDSGradient(x, fxprime, distances, constraints) {
    let loss = 0, i;
    for (i = 0; i < fxprime.length; ++i) {
        fxprime[i] = 0;
    }
    for (i = 0; i < distances.length; ++i) {
        const xi = x[2 * i], yi = x[2 * i + 1];
        for (let j = i + 1; j < distances.length; ++j) {
            const xj = x[2 * j], yj = x[2 * j + 1], dij = distances[i][j], constraint = constraints[i][j];
            const squaredDistance = (xj - xi) * (xj - xi) + (yj - yi) * (yj - yi), distance = Math.sqrt(squaredDistance), delta = squaredDistance - dij * dij;
            if ((constraint > 0 && distance <= dij) ||
                (constraint < 0 && distance >= dij)) {
                continue;
            }
            loss += 2 * delta * delta;
            fxprime[2 * i] += 4 * delta * (xi - xj);
            fxprime[2 * i + 1] += 4 * delta * (yi - yj);
            fxprime[2 * j] += 4 * delta * (xj - xi);
            fxprime[2 * j + 1] += 4 * delta * (yj - yi);
        }
    }
    return loss;
}
/// takes the best working variant of either constrained MDS or greedy
function bestInitialLayout(areas, params) {
    let initial = greedyLayout(areas, params);
    const loss = params.lossFunction || lossFunction;
    // greedylayout is sufficient for all 2/3 circle cases. try out
    // constrained MDS for higher order problems, take its output
    // if it outperforms. (greedy is aesthetically better on 2/3 circles
    // since it axis aligns)
    if (areas.length >= 8) {
        const constrained = constrainedMDSLayout(areas, params), constrainedLoss = loss(constrained, areas), greedyLoss = loss(initial, areas);
        if (constrainedLoss + 1e-8 < greedyLoss) {
            initial = constrained;
        }
    }
    return initial;
}
exports.bestInitialLayout = bestInitialLayout;
/// use the constrained MDS variant to generate an initial layout
function constrainedMDSLayout(areas, params) {
    params = params || {};
    const restarts = params.restarts || 10;
    // bidirectionally map sets to a rowid  (so we can create a matrix)
    const sets = [], setids = {};
    let i;
    for (i = 0; i < areas.length; ++i) {
        const area = areas[i];
        if (area.sets.length == 1) {
            setids[area.sets[0]] = sets.length;
            sets.push(area);
        }
    }
    const matrices = getDistanceMatrices(areas, sets, setids);
    let distances = matrices.distances;
    const constraints = matrices.constraints;
    // keep distances bounded, things get messed up otherwise.
    // TODO: proper preconditioner?
    const norm = (0, fmin_1.norm2)(distances.map(fmin_1.norm2)) / distances.length;
    distances = distances.map(function (row) {
        return row.map(function (value) {
            return value / norm;
        });
    });
    const obj = function (x, fxprime) {
        return constrainedMDSGradient(x, fxprime, distances, constraints);
    };
    let best, current;
    for (i = 0; i < restarts; ++i) {
        const initial = (0, fmin_1.zeros)(distances.length * 2).map(Math.random);
        current = (0, fmin_1.conjugateGradient)(obj, initial, params);
        if (!best || current.fx < best.fx) {
            best = current;
        }
    }
    const positions = best.x;
    // translate rows back to (x,y,radius) coordinates
    const circles = {};
    for (i = 0; i < sets.length; ++i) {
        const set = sets[i];
        circles[set.sets[0]] = {
            x: positions[2 * i] * norm,
            y: positions[2 * i + 1] * norm,
            radius: Math.sqrt(set.size / Math.PI),
        };
    }
    if (params.history) {
        for (i = 0; i < params.history.length; ++i) {
            (0, fmin_1.scale)(params.history[i].x, norm);
        }
    }
    return circles;
}
exports.constrainedMDSLayout = constrainedMDSLayout;
/** Lays out a Venn diagram greedily, going from most overlapped sets to
least overlapped, attempting to position each new set such that the
overlapping areas to already positioned sets are basically right */
function greedyLayout(areas, params) {
    const loss = params && params.lossFunction ? params.lossFunction : lossFunction;
    // define a circle for each set
    const circles = {}, setOverlaps = {};
    let set;
    for (let i = 0; i < areas.length; ++i) {
        const area = areas[i];
        if (area.sets.length == 1) {
            set = area.sets[0];
            circles[set] = {
                x: 1e10,
                y: 1e10,
                // rowid: circles.length, // fix to ->
                rowid: Object.keys(circles).length,
                size: area.size,
                radius: Math.sqrt(area.size / Math.PI),
            };
            setOverlaps[set] = [];
        }
    }
    areas = areas.filter(function (a) {
        return a.sets.length == 2;
    });
    // map each set to a list of all the other sets that overlap it
    for (let i = 0; i < areas.length; ++i) {
        const current = areas[i];
        // eslint-disable-next-line
        let weight = current.hasOwnProperty('weight') ? current.weight : 1.0;
        const left = current.sets[0], right = current.sets[1];
        // completely overlapped circles shouldn't be positioned early here
        if (current.size + SMALL >=
            Math.min(circles[left].size, circles[right].size)) {
            weight = 0;
        }
        setOverlaps[left].push({ set: right, size: current.size, weight: weight });
        setOverlaps[right].push({ set: left, size: current.size, weight: weight });
    }
    // get list of most overlapped sets
    const mostOverlapped = [];
    for (set in setOverlaps) {
        // eslint-disable-next-line
        if (setOverlaps.hasOwnProperty(set)) {
            let size = 0;
            for (let i = 0; i < setOverlaps[set].length; ++i) {
                size += setOverlaps[set][i].size * setOverlaps[set][i].weight;
            }
            mostOverlapped.push({ set: set, size: size });
        }
    }
    // sort by size desc
    function sortOrder(a, b) {
        return b.size - a.size;
    }
    mostOverlapped.sort(sortOrder);
    // keep track of what sets have been laid out
    const positioned = {};
    function isPositioned(element) {
        return element.set in positioned;
    }
    // adds a point to the output
    function positionSet(point, index) {
        circles[index].x = point.x;
        circles[index].y = point.y;
        positioned[index] = true;
    }
    // add most overlapped set at (0,0)
    positionSet({ x: 0, y: 0 }, mostOverlapped[0].set);
    // get distances between all points. TODO, necessary?
    // answer: probably not
    // var distances = venn.getDistanceMatrices(circles, areas).distances;
    for (let i = 1; i < mostOverlapped.length; ++i) {
        const setIndex = mostOverlapped[i].set, overlap = setOverlaps[setIndex].filter(isPositioned);
        set = circles[setIndex];
        overlap.sort(sortOrder);
        if (overlap.length === 0) {
            // this shouldn't happen anymore with addMissingAreas
            throw 'ERROR: missing pairwise overlap information';
        }
        const points = [];
        for (let j = 0; j < overlap.length; ++j) {
            // get appropriate distance from most overlapped already added set
            const p1 = circles[overlap[j].set], d1 = distanceFromIntersectArea(set.radius, p1.radius, overlap[j].size);
            // sample positions at 90 degrees for maximum aesthetics
            points.push({ x: p1.x + d1, y: p1.y });
            points.push({ x: p1.x - d1, y: p1.y });
            points.push({ y: p1.y + d1, x: p1.x });
            points.push({ y: p1.y - d1, x: p1.x });
            // if we have at least 2 overlaps, then figure out where the
            // set should be positioned analytically and try those too
            for (let k = j + 1; k < overlap.length; ++k) {
                const p2 = circles[overlap[k].set], d2 = distanceFromIntersectArea(set.radius, p2.radius, overlap[k].size);
                const extraPoints = (0, circleintersection_1.circleCircleIntersection)({ x: p1.x, y: p1.y, radius: d1 }, { x: p2.x, y: p2.y, radius: d2 });
                for (let l = 0; l < extraPoints.length; ++l) {
                    points.push(extraPoints[l]);
                }
            }
        }
        // we have some candidate positions for the set, examine loss
        // at each position to figure out where to put it at
        let bestLoss = 1e50, bestPoint = points[0];
        for (let j = 0; j < points.length; ++j) {
            circles[setIndex].x = points[j].x;
            circles[setIndex].y = points[j].y;
            const localLoss = loss(circles, areas);
            if (localLoss < bestLoss) {
                bestLoss = localLoss;
                bestPoint = points[j];
            }
        }
        positionSet(bestPoint, setIndex);
    }
    return circles;
}
exports.greedyLayout = greedyLayout;
/** Given a bunch of sets, and the desired overlaps between these sets - computes
the distance from the actual overlaps to the desired overlaps. Note that
this method ignores overlaps of more than 2 circles */
function lossFunction(sets, overlaps) {
    let output = 0;
    function getCircles(indices) {
        return indices.map(function (i) {
            return sets[i];
        });
    }
    for (let i = 0; i < overlaps.length; ++i) {
        const area = overlaps[i];
        let overlap;
        if (area.sets.length == 1) {
            continue;
        }
        else if (area.sets.length == 2) {
            const left = sets[area.sets[0]], right = sets[area.sets[1]];
            overlap = (0, circleintersection_1.circleOverlap)(left.radius, right.radius, (0, circleintersection_1.distance)(left, right));
        }
        else {
            overlap = (0, circleintersection_1.intersectionArea)(getCircles(area.sets));
        }
        // eslint-disable-next-line
        const weight = area.hasOwnProperty('weight') ? area.weight : 1.0;
        output += weight * (overlap - area.size) * (overlap - area.size);
    }
    return output;
}
exports.lossFunction = lossFunction;
// orientates a bunch of circles to point in orientation
function orientateCircles(circles, orientation, orientationOrder) {
    if (orientationOrder === null) {
        circles.sort(function (a, b) {
            return b.radius - a.radius;
        });
    }
    else {
        circles.sort(orientationOrder);
    }
    let i;
    // shift circles so largest circle is at (0, 0)
    if (circles.length > 0) {
        const largestX = circles[0].x, largestY = circles[0].y;
        for (i = 0; i < circles.length; ++i) {
            circles[i].x -= largestX;
            circles[i].y -= largestY;
        }
    }
    if (circles.length == 2) {
        // if the second circle is a subset of the first, arrange so that
        // it is off to one side. hack for https://github.com/benfred/venn.js/issues/120
        const dist = (0, circleintersection_1.distance)(circles[0], circles[1]);
        if (dist < Math.abs(circles[1].radius - circles[0].radius)) {
            circles[1].x =
                circles[0].x + circles[0].radius - circles[1].radius - 1e-10;
            circles[1].y = circles[0].y;
        }
    }
    // rotate circles so that second largest is at an angle of 'orientation'
    // from largest
    if (circles.length > 1) {
        const rotation = Math.atan2(circles[1].x, circles[1].y) - orientation;
        let x, y;
        const c = Math.cos(rotation), s = Math.sin(rotation);
        for (i = 0; i < circles.length; ++i) {
            x = circles[i].x;
            y = circles[i].y;
            circles[i].x = c * x - s * y;
            circles[i].y = s * x + c * y;
        }
    }
    // mirror solution if third solution is above plane specified by
    // first two circles
    if (circles.length > 2) {
        let angle = Math.atan2(circles[2].x, circles[2].y) - orientation;
        while (angle < 0) {
            angle += 2 * Math.PI;
        }
        while (angle > 2 * Math.PI) {
            angle -= 2 * Math.PI;
        }
        if (angle > Math.PI) {
            const slope = circles[1].y / (1e-10 + circles[1].x);
            for (i = 0; i < circles.length; ++i) {
                const d = (circles[i].x + slope * circles[i].y) / (1 + slope * slope);
                circles[i].x = 2 * d - circles[i].x;
                circles[i].y = 2 * d * slope - circles[i].y;
            }
        }
    }
}
function disjointCluster(circles) {
    // union-find clustering to get disjoint sets
    circles.map(function (circle) {
        circle.parent = circle;
    });
    // path compression step in union find
    function find(circle) {
        if (circle.parent !== circle) {
            circle.parent = find(circle.parent);
        }
        return circle.parent;
    }
    function union(x, y) {
        const xRoot = find(x), yRoot = find(y);
        xRoot.parent = yRoot;
    }
    // get the union of all overlapping sets
    for (let i = 0; i < circles.length; ++i) {
        for (let j = i + 1; j < circles.length; ++j) {
            const maxDistance = circles[i].radius + circles[j].radius;
            if ((0, circleintersection_1.distance)(circles[i], circles[j]) + 1e-10 < maxDistance) {
                union(circles[j], circles[i]);
            }
        }
    }
    // find all the disjoint clusters and group them together
    const disjointClusters = {};
    let setid;
    for (let i = 0; i < circles.length; ++i) {
        setid = find(circles[i]).parent.setid;
        if (!(setid in disjointClusters)) {
            disjointClusters[setid] = [];
        }
        disjointClusters[setid].push(circles[i]);
    }
    // cleanup bookkeeping
    circles.map(function (circle) {
        delete circle.parent;
    });
    // return in more usable form
    const ret = [];
    for (setid in disjointClusters) {
        // eslint-disable-next-line
        if (disjointClusters.hasOwnProperty(setid)) {
            ret.push(disjointClusters[setid]);
        }
    }
    return ret;
}
exports.disjointCluster = disjointCluster;
function getBoundingBox(circles) {
    const minMax = function (d) {
        const hi = Math.max.apply(null, circles.map(function (c) {
            return c[d] + c.radius;
        })), lo = Math.min.apply(null, circles.map(function (c) {
            return c[d] - c.radius;
        }));
        return { max: hi, min: lo };
    };
    return { xRange: minMax('x'), yRange: minMax('y') };
}
function normalizeSolution(solution, orientation, orientationOrder) {
    if (orientation === null) {
        orientation = Math.PI / 2;
    }
    // work with a list instead of a dictionary, and take a copy so we
    // don't mutate input
    let circles = [], i, setid;
    for (setid in solution) {
        // eslint-disable-next-line
        if (solution.hasOwnProperty(setid)) {
            const previous = solution[setid];
            circles.push({
                x: previous.x,
                y: previous.y,
                radius: previous.radius,
                setid: setid,
            });
        }
    }
    // get all the disjoint clusters
    const clusters = disjointCluster(circles);
    // orientate all disjoint sets, get sizes
    for (i = 0; i < clusters.length; ++i) {
        orientateCircles(clusters[i], orientation, orientationOrder);
        const bounds = getBoundingBox(clusters[i]);
        clusters[i].size =
            (bounds.xRange.max - bounds.xRange.min) *
                (bounds.yRange.max - bounds.yRange.min);
        clusters[i].bounds = bounds;
    }
    clusters.sort(function (a, b) {
        return b.size - a.size;
    });
    // orientate the largest at 0,0, and get the bounds
    circles = clusters[0];
    // @ts-ignore fixme 从逻辑上看似乎是不对的，后续看看
    let returnBounds = circles.bounds;
    const spacing = (returnBounds.xRange.max - returnBounds.xRange.min) / 50;
    function addCluster(cluster, right, bottom) {
        if (!cluster)
            return;
        const bounds = cluster.bounds;
        let xOffset, yOffset, centreing;
        if (right) {
            xOffset = returnBounds.xRange.max - bounds.xRange.min + spacing;
        }
        else {
            xOffset = returnBounds.xRange.max - bounds.xRange.max;
            centreing =
                (bounds.xRange.max - bounds.xRange.min) / 2 -
                    (returnBounds.xRange.max - returnBounds.xRange.min) / 2;
            if (centreing < 0)
                xOffset += centreing;
        }
        if (bottom) {
            yOffset = returnBounds.yRange.max - bounds.yRange.min + spacing;
        }
        else {
            yOffset = returnBounds.yRange.max - bounds.yRange.max;
            centreing =
                (bounds.yRange.max - bounds.yRange.min) / 2 -
                    (returnBounds.yRange.max - returnBounds.yRange.min) / 2;
            if (centreing < 0)
                yOffset += centreing;
        }
        for (let j = 0; j < cluster.length; ++j) {
            cluster[j].x += xOffset;
            cluster[j].y += yOffset;
            circles.push(cluster[j]);
        }
    }
    let index = 1;
    while (index < clusters.length) {
        addCluster(clusters[index], true, false);
        addCluster(clusters[index + 1], false, true);
        addCluster(clusters[index + 2], true, true);
        index += 3;
        // have one cluster (in top left). lay out next three relative
        // to it in a grid
        returnBounds = getBoundingBox(circles);
    }
    // convert back to solution form
    const ret = {};
    for (i = 0; i < circles.length; ++i) {
        ret[circles[i].setid] = circles[i];
    }
    return ret;
}
exports.normalizeSolution = normalizeSolution;
/** Scales a solution from venn.venn or venn.greedyLayout such that it fits in
a rectangle of width/height - with padding around the borders. also
centers the diagram in the available space at the same time */
function scaleSolution(solution, width, height, padding) {
    const circles = [], setids = [];
    for (const setid in solution) {
        // eslint-disable-next-line
        if (solution.hasOwnProperty(setid)) {
            setids.push(setid);
            circles.push(solution[setid]);
        }
    }
    width -= 2 * padding;
    height -= 2 * padding;
    const bounds = getBoundingBox(circles), xRange = bounds.xRange, yRange = bounds.yRange;
    if (xRange.max == xRange.min || yRange.max == yRange.min) {
        console.log('not scaling solution: zero size detected');
        return solution;
    }
    const xScaling = width / (xRange.max - xRange.min), yScaling = height / (yRange.max - yRange.min), scaling = Math.min(yScaling, xScaling), 
    // while we're at it, center the diagram too
    xOffset = (width - (xRange.max - xRange.min) * scaling) / 2, yOffset = (height - (yRange.max - yRange.min) * scaling) / 2;
    const scaled = {};
    for (let i = 0; i < circles.length; ++i) {
        const circle = circles[i];
        scaled[setids[i]] = {
            radius: scaling * circle.radius,
            x: padding + xOffset + (circle.x - xRange.min) * scaling,
            y: padding + yOffset + (circle.y - yRange.min) * scaling,
        };
    }
    return scaled;
}
exports.scaleSolution = scaleSolution;
//# sourceMappingURL=layout.js.map
}, function(modId) { var map = {"./fmin":1751263816167,"./circleintersection":1751263816174}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816167, function(require, module, exports) {

/**
 * Copyright 2016, Ben Frederickson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * * Neither the name of the author nor the names of contributors may be used to
 *   endorse or promote products derived from this software without specific prior
 *   written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.scale = exports.weightedSum = exports.norm2 = exports.zerosM = exports.zeros = exports.gradientDescentLineSearch = exports.gradientDescent = exports.conjugateGradientSolve = exports.conjugateGradient = exports.nelderMead = exports.bisect = void 0;
var bisect_1 = require("./bisect");
Object.defineProperty(exports, "bisect", { enumerable: true, get: function () { return bisect_1.bisect; } });
var nelderMead_1 = require("./nelderMead");
Object.defineProperty(exports, "nelderMead", { enumerable: true, get: function () { return nelderMead_1.nelderMead; } });
var conjugateGradient_1 = require("./conjugateGradient");
Object.defineProperty(exports, "conjugateGradient", { enumerable: true, get: function () { return conjugateGradient_1.conjugateGradient; } });
Object.defineProperty(exports, "conjugateGradientSolve", { enumerable: true, get: function () { return conjugateGradient_1.conjugateGradientSolve; } });
var gradientDescent_1 = require("./gradientDescent");
Object.defineProperty(exports, "gradientDescent", { enumerable: true, get: function () { return gradientDescent_1.gradientDescent; } });
Object.defineProperty(exports, "gradientDescentLineSearch", { enumerable: true, get: function () { return gradientDescent_1.gradientDescentLineSearch; } });
var blas1_1 = require("./blas1");
Object.defineProperty(exports, "zeros", { enumerable: true, get: function () { return blas1_1.zeros; } });
Object.defineProperty(exports, "zerosM", { enumerable: true, get: function () { return blas1_1.zerosM; } });
Object.defineProperty(exports, "norm2", { enumerable: true, get: function () { return blas1_1.norm2; } });
Object.defineProperty(exports, "weightedSum", { enumerable: true, get: function () { return blas1_1.weightedSum; } });
Object.defineProperty(exports, "scale", { enumerable: true, get: function () { return blas1_1.scale; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./bisect":1751263816168,"./nelderMead":1751263816169,"./conjugateGradient":1751263816171,"./gradientDescent":1751263816173,"./blas1":1751263816170}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816168, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.bisect = void 0;
/** finds the zeros of a function, given two starting points (which must
 * have opposite signs */
function bisect(f, a, b, parameters) {
    parameters = parameters || {};
    const maxIterations = parameters.maxIterations || 100;
    const tolerance = parameters.tolerance || 1e-10;
    const fA = f(a);
    const fB = f(b);
    let delta = b - a;
    if (fA * fB > 0) {
        throw 'Initial bisect points must have opposite signs';
    }
    if (fA === 0)
        return a;
    if (fB === 0)
        return b;
    for (let i = 0; i < maxIterations; ++i) {
        delta /= 2;
        const mid = a + delta;
        const fMid = f(mid);
        if (fMid * fA >= 0) {
            a = mid;
        }
        if (Math.abs(delta) < tolerance || fMid === 0) {
            return mid;
        }
    }
    return a + delta;
}
exports.bisect = bisect;
//# sourceMappingURL=bisect.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816169, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.nelderMead = void 0;
const blas1_1 = require("./blas1");
/** minimizes a function using the downhill simplex method */
function nelderMead(f, x0, parameters) {
    parameters = parameters || {};
    const maxIterations = parameters.maxIterations || x0.length * 200;
    const nonZeroDelta = parameters.nonZeroDelta || 1.05;
    const zeroDelta = parameters.zeroDelta || 0.001;
    const minErrorDelta = parameters.minErrorDelta || 1e-6;
    const minTolerance = parameters.minErrorDelta || 1e-5;
    const rho = parameters.rho !== undefined ? parameters.rho : 1;
    const chi = parameters.chi !== undefined ? parameters.chi : 2;
    const psi = parameters.psi !== undefined ? parameters.psi : -0.5;
    const sigma = parameters.sigma !== undefined ? parameters.sigma : 0.5;
    let maxDiff;
    // initialize simplex.
    const N = x0.length;
    const simplex = new Array(N + 1);
    simplex[0] = x0;
    simplex[0].fx = f(x0);
    simplex[0].id = 0;
    for (let i = 0; i < N; ++i) {
        const point = x0.slice();
        point[i] = point[i] ? point[i] * nonZeroDelta : zeroDelta;
        simplex[i + 1] = point;
        simplex[i + 1].fx = f(point);
        simplex[i + 1].id = i + 1;
    }
    function updateSimplex(value) {
        for (let i = 0; i < value.length; i++) {
            simplex[N][i] = value[i];
        }
        simplex[N].fx = value.fx;
    }
    const sortOrder = (a, b) => a.fx - b.fx;
    const centroid = x0.slice();
    const reflected = x0.slice();
    const contracted = x0.slice();
    const expanded = x0.slice();
    for (let iteration = 0; iteration < maxIterations; ++iteration) {
        simplex.sort(sortOrder);
        if (parameters.history) {
            // copy the simplex (since later iterations will mutate) and
            // sort it to have a consistent order between iterations
            const sortedSimplex = simplex.map((x) => {
                const state = x.slice();
                state.fx = x.fx;
                state.id = x.id;
                return state;
            });
            sortedSimplex.sort((a, b) => a.id - b.id);
            parameters.history.push({
                x: simplex[0].slice(),
                fx: simplex[0].fx,
                simplex: sortedSimplex,
            });
        }
        maxDiff = 0;
        for (let i = 0; i < N; ++i) {
            maxDiff = Math.max(maxDiff, Math.abs(simplex[0][i] - simplex[1][i]));
        }
        if (Math.abs(simplex[0].fx - simplex[N].fx) < minErrorDelta &&
            maxDiff < minTolerance) {
            break;
        }
        // compute the centroid of all but the worst point in the simplex
        for (let i = 0; i < N; ++i) {
            centroid[i] = 0;
            for (let j = 0; j < N; ++j) {
                centroid[i] += simplex[j][i];
            }
            centroid[i] /= N;
        }
        // reflect the worst point past the centroid  and compute loss at reflected
        // point
        const worst = simplex[N];
        (0, blas1_1.weightedSum)(reflected, 1 + rho, centroid, -rho, worst);
        reflected.fx = f(reflected);
        // if the reflected point is the best seen, then possibly expand
        if (reflected.fx < simplex[0].fx) {
            (0, blas1_1.weightedSum)(expanded, 1 + chi, centroid, -chi, worst);
            expanded.fx = f(expanded);
            if (expanded.fx < reflected.fx) {
                updateSimplex(expanded);
            }
            else {
                updateSimplex(reflected);
            }
        }
        // if the reflected point is worse than the second worst, we need to
        // contract
        else if (reflected.fx >= simplex[N - 1].fx) {
            let shouldReduce = false;
            if (reflected.fx > worst.fx) {
                // do an inside contraction
                (0, blas1_1.weightedSum)(contracted, 1 + psi, centroid, -psi, worst);
                contracted.fx = f(contracted);
                if (contracted.fx < worst.fx) {
                    updateSimplex(contracted);
                }
                else {
                    shouldReduce = true;
                }
            }
            else {
                // do an outside contraction
                (0, blas1_1.weightedSum)(contracted, 1 - psi * rho, centroid, psi * rho, worst);
                contracted.fx = f(contracted);
                if (contracted.fx < reflected.fx) {
                    updateSimplex(contracted);
                }
                else {
                    shouldReduce = true;
                }
            }
            if (shouldReduce) {
                // if we don't contract here, we're done
                if (sigma >= 1)
                    break;
                // do a reduction
                for (let i = 1; i < simplex.length; ++i) {
                    (0, blas1_1.weightedSum)(simplex[i], 1 - sigma, simplex[0], sigma, simplex[i]);
                    simplex[i].fx = f(simplex[i]);
                }
            }
        }
        else {
            updateSimplex(reflected);
        }
    }
    simplex.sort(sortOrder);
    return { fx: simplex[0].fx, x: simplex[0] };
}
exports.nelderMead = nelderMead;
//# sourceMappingURL=nelderMead.js.map
}, function(modId) { var map = {"./blas1":1751263816170}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816170, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.gemv = exports.weightedSum = exports.scale = exports.norm2 = exports.dot = exports.zerosM = exports.zeros = void 0;
// need some basic operations on vectors, rather than adding a dependency,
// just define here
function zeros(x) {
    const r = new Array(x);
    for (let i = 0; i < x; ++i) {
        r[i] = 0;
    }
    return r;
}
exports.zeros = zeros;
function zerosM(x, y) {
    return zeros(x).map(() => zeros(y));
}
exports.zerosM = zerosM;
function dot(a, b) {
    let ret = 0;
    for (let i = 0; i < a.length; ++i) {
        ret += a[i] * b[i];
    }
    return ret;
}
exports.dot = dot;
function norm2(a) {
    return Math.sqrt(dot(a, a));
}
exports.norm2 = norm2;
function scale(ret, value, c) {
    for (let i = 0; i < value.length; ++i) {
        ret[i] = value[i] * c;
    }
}
exports.scale = scale;
function weightedSum(ret, w1, v1, w2, v2) {
    for (let j = 0; j < ret.length; ++j) {
        ret[j] = w1 * v1[j] + w2 * v2[j];
    }
}
exports.weightedSum = weightedSum;
function gemv(output, A, x) {
    for (let i = 0; i < output.length; ++i) {
        output[i] = dot(A[i], x);
    }
}
exports.gemv = gemv;
//# sourceMappingURL=blas1.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816171, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.conjugateGradientSolve = exports.conjugateGradient = void 0;
const blas1_1 = require("./blas1");
const linesearch_1 = require("./linesearch");
function conjugateGradient(f, initial, params) {
    // allocate all memory up front here, keep out of the loop for perfomance
    // reasons
    let current = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    let next = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    const yk = initial.slice();
    let temp;
    let a = 1;
    params = params || {};
    const maxIterations = params.maxIterations || initial.length * 20;
    current.fx = f(current.x, current.fxprime);
    const pk = current.fxprime.slice();
    (0, blas1_1.scale)(pk, current.fxprime, -1);
    for (let i = 0; i < maxIterations; ++i) {
        a = (0, linesearch_1.wolfeLineSearch)(f, pk, current, next, a);
        // todo: history in wrong spot?
        if (params.history) {
            params.history.push({
                x: current.x.slice(),
                fx: current.fx,
                fxprime: current.fxprime.slice(),
                alpha: a,
            });
        }
        if (!a) {
            // faiiled to find point that satifies wolfe conditions.
            // reset direction for next iteration
            (0, blas1_1.scale)(pk, current.fxprime, -1);
        }
        else {
            // update direction using Polak–Ribiere CG method
            (0, blas1_1.weightedSum)(yk, 1, next.fxprime, -1, current.fxprime);
            const delta_k = (0, blas1_1.dot)(current.fxprime, current.fxprime);
            const beta_k = Math.max(0, (0, blas1_1.dot)(yk, next.fxprime) / delta_k);
            (0, blas1_1.weightedSum)(pk, beta_k, pk, -1, next.fxprime);
            temp = current;
            current = next;
            next = temp;
        }
        if ((0, blas1_1.norm2)(current.fxprime) <= 1e-5) {
            break;
        }
    }
    if (params.history) {
        params.history.push({
            x: current.x.slice(),
            fx: current.fx,
            fxprime: current.fxprime.slice(),
            alpha: a,
        });
    }
    return current;
}
exports.conjugateGradient = conjugateGradient;
/// Solves a system of lienar equations Ax =b for x
/// using the conjugate gradient method.
function conjugateGradientSolve(A, b, x, history) {
    const r = x.slice();
    const Ap = x.slice();
    let rsold;
    let rsnew;
    let alpha;
    // r = b - A*x
    (0, blas1_1.gemv)(Ap, A, x);
    (0, blas1_1.weightedSum)(r, 1, b, -1, Ap);
    const p = r.slice();
    rsold = (0, blas1_1.dot)(r, r);
    for (let i = 0; i < b.length; ++i) {
        (0, blas1_1.gemv)(Ap, A, p);
        alpha = rsold / (0, blas1_1.dot)(p, Ap);
        if (history) {
            history.push({ x: x.slice(), p: p.slice(), alpha: alpha });
        }
        //x=x+alpha*p;
        (0, blas1_1.weightedSum)(x, 1, x, alpha, p);
        // r=r-alpha*Ap;
        (0, blas1_1.weightedSum)(r, 1, r, -alpha, Ap);
        rsnew = (0, blas1_1.dot)(r, r);
        if (Math.sqrt(rsnew) <= 1e-10)
            break;
        // p=r+(rsnew/rsold)*p;
        (0, blas1_1.weightedSum)(p, 1, r, rsnew / rsold, p);
        rsold = rsnew;
    }
    if (history) {
        history.push({ x: x.slice(), p: p.slice(), alpha: alpha });
    }
    return x;
}
exports.conjugateGradientSolve = conjugateGradientSolve;
//# sourceMappingURL=conjugateGradient.js.map
}, function(modId) { var map = {"./blas1":1751263816170,"./linesearch":1751263816172}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816172, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.wolfeLineSearch = void 0;
const blas1_1 = require("./blas1");
/// searches along line 'pk' for a point that satifies the wolfe conditions
/// See 'Numerical Optimization' by Nocedal and Wright p59-60
/// f : objective function
/// pk : search direction
/// current: object containing current gradient/loss
/// next: output: contains next gradient/loss
/// returns a: step size taken
function wolfeLineSearch(f, pk, current, next, a, c1, c2) {
    const phi0 = current.fx;
    const phiPrime0 = (0, blas1_1.dot)(current.fxprime, pk);
    let phi = phi0;
    let phi_old = phi0;
    let phiPrime = phiPrime0;
    let a0 = 0;
    a = a || 1;
    c1 = c1 || 1e-6;
    c2 = c2 || 0.1;
    function zoom(a_lo, a_high, phi_lo) {
        for (let iteration = 0; iteration < 16; ++iteration) {
            a = (a_lo + a_high) / 2;
            (0, blas1_1.weightedSum)(next.x, 1.0, current.x, a, pk);
            phi = next.fx = f(next.x, next.fxprime);
            phiPrime = (0, blas1_1.dot)(next.fxprime, pk);
            if (phi > phi0 + c1 * a * phiPrime0 || phi >= phi_lo) {
                a_high = a;
            }
            else {
                if (Math.abs(phiPrime) <= -c2 * phiPrime0) {
                    return a;
                }
                if (phiPrime * (a_high - a_lo) >= 0) {
                    a_high = a_lo;
                }
                a_lo = a;
                phi_lo = phi;
            }
        }
        return 0;
    }
    for (let iteration = 0; iteration < 10; ++iteration) {
        (0, blas1_1.weightedSum)(next.x, 1.0, current.x, a, pk);
        phi = next.fx = f(next.x, next.fxprime);
        phiPrime = (0, blas1_1.dot)(next.fxprime, pk);
        if (phi > phi0 + c1 * a * phiPrime0 || (iteration && phi >= phi_old)) {
            return zoom(a0, a, phi_old);
        }
        if (Math.abs(phiPrime) <= -c2 * phiPrime0) {
            return a;
        }
        if (phiPrime >= 0) {
            return zoom(a, a0, phi);
        }
        phi_old = phi;
        a0 = a;
        a *= 2;
    }
    return a;
}
exports.wolfeLineSearch = wolfeLineSearch;
//# sourceMappingURL=linesearch.js.map
}, function(modId) { var map = {"./blas1":1751263816170}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816173, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.gradientDescentLineSearch = exports.gradientDescent = void 0;
const blas1_1 = require("./blas1");
const linesearch_1 = require("./linesearch");
function gradientDescent(f, initial, params) {
    params = params || {};
    const maxIterations = params.maxIterations || initial.length * 100;
    const learnRate = params.learnRate || 0.001;
    const current = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    for (let i = 0; i < maxIterations; ++i) {
        current.fx = f(current.x, current.fxprime);
        if (params.history) {
            params.history.push({
                x: current.x.slice(),
                fx: current.fx,
                fxprime: current.fxprime.slice(),
            });
        }
        (0, blas1_1.weightedSum)(current.x, 1, current.x, -learnRate, current.fxprime);
        if ((0, blas1_1.norm2)(current.fxprime) <= 1e-5) {
            break;
        }
    }
    return current;
}
exports.gradientDescent = gradientDescent;
function gradientDescentLineSearch(f, initial, params) {
    params = params || {};
    let current = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    let next = { x: initial.slice(), fx: 0, fxprime: initial.slice() };
    const maxIterations = params.maxIterations || initial.length * 100;
    let learnRate = params.learnRate || 1;
    const pk = initial.slice();
    const c1 = params.c1 || 1e-3;
    const c2 = params.c2 || 0.1;
    let temp;
    let functionCalls = [];
    if (params.history) {
        // wrap the function call to track linesearch samples
        const inner = f;
        f = (x, fxprime) => {
            functionCalls.push(x.slice());
            return inner(x, fxprime);
        };
    }
    current.fx = f(current.x, current.fxprime);
    for (let i = 0; i < maxIterations; ++i) {
        (0, blas1_1.scale)(pk, current.fxprime, -1);
        learnRate = (0, linesearch_1.wolfeLineSearch)(f, pk, current, next, learnRate, c1, c2);
        if (params.history) {
            params.history.push({
                x: current.x.slice(),
                fx: current.fx,
                fxprime: current.fxprime.slice(),
                functionCalls: functionCalls,
                learnRate: learnRate,
                alpha: learnRate,
            });
            functionCalls = [];
        }
        temp = current;
        current = next;
        next = temp;
        if (learnRate === 0 || (0, blas1_1.norm2)(current.fxprime) < 1e-5)
            break;
    }
    return current;
}
exports.gradientDescentLineSearch = gradientDescentLineSearch;
//# sourceMappingURL=gradientDescent.js.map
}, function(modId) { var map = {"./blas1":1751263816170,"./linesearch":1751263816172}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816174, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.getCenter = exports.circleCircleIntersection = exports.circleOverlap = exports.distance = exports.circleArea = exports.containedInCircles = exports.intersectionArea = void 0;
const SMALL = 1e-10;
/**
 * Returns the intersection area of a bunch of circles (where each circle
 * is an object having an x,y and radius property)
 */
function intersectionArea(circles, stats) {
    // Get all the intersection points of the circles
    const intersectionPoints = getIntersectionPoints(circles);
    // Filter out points that aren't included in all the circles
    const innerPoints = intersectionPoints.filter(function (p) {
        return containedInCircles(p, circles);
    });
    let arcArea = 0, polygonArea = 0, i;
    const arcs = [];
    // If we have intersection points that are within all the circles,
    // then figure out the area contained by them
    if (innerPoints.length > 1) {
        // Sort the points by angle from the center of the polygon, which lets
        // us just iterate over points to get the edges
        const center = getCenter(innerPoints);
        for (i = 0; i < innerPoints.length; ++i) {
            const p = innerPoints[i];
            p.angle = Math.atan2(p.x - center.x, p.y - center.y);
        }
        innerPoints.sort(function (a, b) {
            return b.angle - a.angle;
        });
        // Iterate over all points, get arc between the points
        // and update the areas
        let p2 = innerPoints[innerPoints.length - 1];
        for (i = 0; i < innerPoints.length; ++i) {
            const p1 = innerPoints[i];
            // Polygon area updates easily ...
            polygonArea += (p2.x + p1.x) * (p1.y - p2.y);
            // Updating the arc area is a little more involved
            const midPoint = { x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2 };
            let arc = null;
            for (let j = 0; j < p1.parentIndex.length; ++j) {
                if (p2.parentIndex.indexOf(p1.parentIndex[j]) > -1) {
                    // Figure out the angle halfway between the two points
                    // on the current circle
                    const circle = circles[p1.parentIndex[j]], a1 = Math.atan2(p1.x - circle.x, p1.y - circle.y), a2 = Math.atan2(p2.x - circle.x, p2.y - circle.y);
                    let angleDiff = a2 - a1;
                    if (angleDiff < 0) {
                        angleDiff += 2 * Math.PI;
                    }
                    // and use that angle to figure out the width of the
                    // arc
                    const a = a2 - angleDiff / 2;
                    let width = distance(midPoint, {
                        x: circle.x + circle.radius * Math.sin(a),
                        y: circle.y + circle.radius * Math.cos(a),
                    });
                    // Clamp the width to the largest is can actually be
                    // (sometimes slightly overflows because of FP errors)
                    if (width > circle.radius * 2) {
                        width = circle.radius * 2;
                    }
                    // Pick the circle whose arc has the smallest width
                    if (arc === null || arc.width > width) {
                        arc = { circle: circle, width: width, p1: p1, p2: p2 };
                    }
                }
            }
            if (arc !== null) {
                arcs.push(arc);
                arcArea += circleArea(arc.circle.radius, arc.width);
                p2 = p1;
            }
        }
    }
    else {
        // No intersection points, is either disjoint - or is completely
        // overlapped. figure out which by examining the smallest circle
        let smallest = circles[0];
        for (i = 1; i < circles.length; ++i) {
            if (circles[i].radius < smallest.radius) {
                smallest = circles[i];
            }
        }
        // Make sure the smallest circle is completely contained in all
        // the other circles
        let disjoint = false;
        for (i = 0; i < circles.length; ++i) {
            if (distance(circles[i], smallest) >
                Math.abs(smallest.radius - circles[i].radius)) {
                disjoint = true;
                break;
            }
        }
        if (disjoint) {
            arcArea = polygonArea = 0;
        }
        else {
            arcArea = smallest.radius * smallest.radius * Math.PI;
            arcs.push({
                circle: smallest,
                p1: { x: smallest.x, y: smallest.y + smallest.radius },
                p2: { x: smallest.x - SMALL, y: smallest.y + smallest.radius },
                width: smallest.radius * 2,
            });
        }
    }
    polygonArea /= 2;
    if (stats) {
        stats.area = arcArea + polygonArea;
        stats.arcArea = arcArea;
        stats.polygonArea = polygonArea;
        stats.arcs = arcs;
        stats.innerPoints = innerPoints;
        stats.intersectionPoints = intersectionPoints;
    }
    return arcArea + polygonArea;
}
exports.intersectionArea = intersectionArea;
/**
 * Returns whether a point is contained by all of a list of circles
 */
function containedInCircles(point, circles) {
    for (let i = 0; i < circles.length; ++i) {
        if (distance(point, circles[i]) > circles[i].radius + SMALL) {
            return false;
        }
    }
    return true;
}
exports.containedInCircles = containedInCircles;
/** Gets all intersection points between a bunch of circles */
function getIntersectionPoints(circles) {
    const ret = [];
    for (let i = 0; i < circles.length; ++i) {
        for (let j = i + 1; j < circles.length; ++j) {
            const intersect = circleCircleIntersection(circles[i], circles[j]);
            for (let k = 0; k < intersect.length; ++k) {
                const p = intersect[k];
                p.parentIndex = [i, j];
                ret.push(p);
            }
        }
    }
    return ret;
}
/** Circular segment area calculation. See http://mathworld.wolfram.com/CircularSegment.html */
function circleArea(r, width) {
    return (r * r * Math.acos(1 - width / r) -
        (r - width) * Math.sqrt(width * (2 * r - width)));
}
exports.circleArea = circleArea;
/** Euclidean distance between two points */
function distance(p1, p2) {
    return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
exports.distance = distance;
/** Returns the overlap area of two circles of radius r1 and r2 - that
have their centers separated by distance d. Simpler faster
circle intersection for only two circles */
function circleOverlap(r1, r2, d) {
    // no overlap
    if (d >= r1 + r2) {
        return 0;
    }
    // Completely overlapped
    if (d <= Math.abs(r1 - r2)) {
        return Math.PI * Math.min(r1, r2) * Math.min(r1, r2);
    }
    const w1 = r1 - (d * d - r2 * r2 + r1 * r1) / (2 * d), w2 = r2 - (d * d - r1 * r1 + r2 * r2) / (2 * d);
    return circleArea(r1, w1) + circleArea(r2, w2);
}
exports.circleOverlap = circleOverlap;
/** Given two circles (containing a x/y/radius attributes),
returns the intersecting points if possible.
note: doesn't handle cases where there are infinitely many
intersection points (circles are equivalent):, or only one intersection point*/
function circleCircleIntersection(p1, p2) {
    const d = distance(p1, p2), r1 = p1.radius, r2 = p2.radius;
    // If to far away, or self contained - can't be done
    if (d >= r1 + r2 || d <= Math.abs(r1 - r2)) {
        return [];
    }
    const a = (r1 * r1 - r2 * r2 + d * d) / (2 * d), h = Math.sqrt(r1 * r1 - a * a), x0 = p1.x + (a * (p2.x - p1.x)) / d, y0 = p1.y + (a * (p2.y - p1.y)) / d, rx = -(p2.y - p1.y) * (h / d), ry = -(p2.x - p1.x) * (h / d);
    return [
        { x: x0 + rx, y: y0 - ry },
        { x: x0 - rx, y: y0 + ry },
    ];
}
exports.circleCircleIntersection = circleCircleIntersection;
/** Returns the center of a bunch of points */
function getCenter(points) {
    const center = { x: 0, y: 0 };
    for (let i = 0; i < points.length; ++i) {
        center.x += points[i].x;
        center.y += points[i].y;
    }
    center.x /= points.length;
    center.y /= points.length;
    return center;
}
exports.getCenter = getCenter;
//# sourceMappingURL=circleintersection.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816175, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.intersectionAreaPath = void 0;
const circleintersection_1 = require("./circleintersection");
/**
 * 根据圆心(x, y) 半径 r 返回圆的绘制 path
 * @param x 圆心点 x
 * @param y 圆心点 y
 * @param r 圆的半径
 * @returns 圆的 path
 */
function circlePath(x, y, r) {
    const ret = [];
    // ret.push('\nM', x, y);
    // ret.push('\nm', -r, 0);
    // ret.push('\na', r, r, 0, 1, 0, r * 2, 0);
    // ret.push('\na', r, r, 0, 1, 0, -r * 2, 0);
    const x0 = x - r;
    const y0 = y;
    ret.push('M', x0, y0);
    ret.push('A', r, r, 0, 1, 0, x0 + 2 * r, y0);
    ret.push('A', r, r, 0, 1, 0, x0, y0);
    return ret.join(' ');
}
/** returns a svg path of the intersection area of a bunch of circles */
function intersectionAreaPath(circles) {
    const stats = {};
    (0, circleintersection_1.intersectionArea)(circles, stats);
    const arcs = stats.arcs;
    if (arcs.length === 0) {
        return 'M 0 0';
    }
    else if (arcs.length == 1) {
        const circle = arcs[0].circle;
        return circlePath(circle.x, circle.y, circle.radius);
    }
    else {
        // draw path around arcs
        const ret = ['\nM', arcs[0].p2.x, arcs[0].p2.y];
        for (let i = 0; i < arcs.length; ++i) {
            const arc = arcs[i], r = arc.circle.radius, wide = arc.width > r;
            ret.push('\nA', r, r, 0, wide ? 1 : 0, 1, arc.p1.x, arc.p1.y);
        }
        return ret.join(' ');
    }
}
exports.intersectionAreaPath = intersectionAreaPath;
//# sourceMappingURL=diagram.js.map
}, function(modId) { var map = {"./circleintersection":1751263816174}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816176, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Log = void 0;
/**
 * Console.log the data section for dev debugger.
 */
const Log = () => {
    return (data) => {
        console.log('G2 data section:', data);
        return data;
    };
};
exports.Log = Log;
exports.Log.props = {};
//# sourceMappingURL=log.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816177, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.EMA = exports.ema = void 0;
function ema(values, alpha) {
    if (alpha < 0 || alpha > 1) {
        throw new Error('alpha must be between 0 and 1.');
    }
    if (values.length === 0) {
        return [];
    }
    let last = values[0];
    const smoothed = [];
    for (const point of values) {
        if (point === null || point === undefined) {
            // 如果没有数据的话，使用最近的值
            smoothed.push(point);
            console.warn('EMA：The value is null or undefined', values);
            continue;
        }
        if (last === null || last === undefined) {
            last = point;
        }
        const smoothedVal = last * alpha + (1 - alpha) * point;
        smoothed.push(smoothedVal);
        last = smoothedVal;
    }
    return smoothed;
}
exports.ema = ema;
/**
 * https://en.wikipedia.org/wiki/Exponential_smoothing
 * @param options
 * @returns
 */
const EMA = (options) => {
    const { field = 'y', alpha = 0.6, as = field } = options;
    return (data) => {
        const values = data.map((d) => {
            return d[field];
        });
        const out = ema(values, alpha);
        return data.map((d, i) => {
            return Object.assign(Object.assign({}, d), { [as]: out[i] });
        });
    };
};
exports.EMA = EMA;
exports.EMA.props = {};
//# sourceMappingURL=ema.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816178, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ExceedAdjust = exports.OverflowHide = exports.ContrastReverse = exports.OverlapDodgeY = exports.OverlapHide = void 0;
var overlapHide_1 = require("./overlapHide");
Object.defineProperty(exports, "OverlapHide", { enumerable: true, get: function () { return overlapHide_1.OverlapHide; } });
var overlapDodgeY_1 = require("./overlapDodgeY");
Object.defineProperty(exports, "OverlapDodgeY", { enumerable: true, get: function () { return overlapDodgeY_1.OverlapDodgeY; } });
var contrastReverse_1 = require("./contrastReverse");
Object.defineProperty(exports, "ContrastReverse", { enumerable: true, get: function () { return contrastReverse_1.ContrastReverse; } });
var overflowHide_1 = require("./overflowHide");
Object.defineProperty(exports, "OverflowHide", { enumerable: true, get: function () { return overflowHide_1.OverflowHide; } });
var exceedAdjust_1 = require("./exceedAdjust");
Object.defineProperty(exports, "ExceedAdjust", { enumerable: true, get: function () { return exceedAdjust_1.ExceedAdjust; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./overlapHide":1751263816179,"./overlapDodgeY":1751263816181,"./contrastReverse":1751263816182,"./overflowHide":1751263816184,"./exceedAdjust":1751263816185}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816179, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.OverlapHide = void 0;
const bounds_1 = require("../utils/bounds");
const style_1 = require("../utils/style");
/**
 * Hide the label when overlap.
 */
const OverlapHide = (options) => {
    const { priority } = options;
    return (labels) => {
        const displayLabels = [];
        // When overlap, will hide the next label.
        if (priority)
            labels.sort(priority);
        labels.forEach((l) => {
            (0, style_1.show)(l);
            const b1 = l.getLocalBounds();
            const overlaping = displayLabels.some((dl) => (0, bounds_1.isOverlap)((0, bounds_1.parseAABB)(b1), (0, bounds_1.parseAABB)(dl.getLocalBounds())));
            if (overlaping)
                (0, style_1.hide)(l);
            else
                displayLabels.push(l);
        });
        return labels;
    };
};
exports.OverlapHide = OverlapHide;
//# sourceMappingURL=overlapHide.js.map
}, function(modId) { var map = {"../utils/bounds":1751263816180,"../utils/style":1751263816122}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816180, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.isOverlap = exports.isOverflow = exports.isInBounds = exports.parseAABB = void 0;
// There is a certain error in the calculation of text bounds.
const EPSILON = 1e-2;
function parseAABB(min2) {
    const { min, max } = min2;
    return [
        [min[0], min[1]],
        [max[0], max[1]],
    ];
}
exports.parseAABB = parseAABB;
/**
 * Whether the `point` in `bounds`.
 * @param point
 * @param bounds
 * @param threshold
 */
function isInBounds(point, bounds, threshold = EPSILON) {
    const [x, y] = point;
    const [min, max] = bounds;
    return (x >= min[0] - threshold &&
        x <= max[0] + threshold &&
        y >= min[1] - threshold &&
        y <= max[1] + threshold);
}
exports.isInBounds = isInBounds;
/**
 * Whether `b1` is overflow from `b2`.
 * @param b1
 * @param b2
 * @param threshold The threshold to determine whether the bounds is overflowed, default is 0.
 */
function isOverflow(b1, b2, threshold = EPSILON) {
    const [min, max] = b1;
    return !(isInBounds(min, b2, threshold) && isInBounds(max, b2, threshold));
}
exports.isOverflow = isOverflow;
/**
 * Whether `b1` is overlap with `b2`.
 * @param b1
 * @param b2
 * @returns
 */
function isOverlap(b1, b2) {
    const [min1, max1] = b1;
    const [min2, max2] = b2;
    return (min1[0] < max2[0] &&
        max1[0] > min2[0] &&
        min1[1] < max2[1] &&
        max1[1] > min2[1]);
}
exports.isOverlap = isOverlap;
//# sourceMappingURL=bounds.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816181, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.OverlapDodgeY = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
function isSegmentIntersect([a, b], [c, d]) {
    return d > a && b > c;
}
function useMap() {
    const map = new Map();
    const get = (key) => map.get(key);
    const set = (key, value) => map.set(key, value);
    return [get, set];
}
function getBoundsWithoutConnector(shape) {
    const node = shape.cloneNode(true);
    const connectorShape = node.getElementById('connector');
    connectorShape && node.removeChild(connectorShape);
    const { min, max } = node.getRenderBounds();
    node.destroy();
    return { min, max };
}
/**
 * An iterative dodge method avoids label overlap. (n * log(n))
 */
const OverlapDodgeY = (options) => {
    const { maxIterations = 10, maxError = 0.1, padding = 1 } = options;
    return (labels) => {
        const n = labels.length;
        if (n <= 1)
            return labels;
        // Index y, x0, x, height, by label.
        const [y0, setY0] = useMap();
        const [y, setY] = useMap();
        const [h, setH] = useMap();
        const [xx, setXX] = useMap();
        for (const label of labels) {
            const { min, max } = getBoundsWithoutConnector(label);
            const [x0, y0] = min;
            const [x1, y1] = max;
            setY0(label, y0);
            setY(label, y0);
            setH(label, y1 - y0);
            setXX(label, [x0, x1]);
        }
        // Offsets position Y.
        for (let iter = 0; iter < maxIterations; iter++) {
            labels.sort((a, b) => (0, d3_array_1.ascending)(y(a), y(b)));
            let error = 0;
            for (let i = 0; i < n - 1; i++) {
                const l0 = labels[i];
                let j = i + 1;
                let l1;
                // Find the next label overlapping with the current label in x direction.
                while ((l1 = labels[j]) && !isSegmentIntersect(xx(l0), xx(l1)))
                    j += 1;
                if (l1) {
                    const y0 = y(l0);
                    const h0 = h(l0);
                    const y1 = y(l1);
                    const delta = y1 - (y0 + h0);
                    if (delta < padding) {
                        const newDelta = (padding - delta) / 2;
                        error = Math.max(error, newDelta);
                        setY(l0, y0 - newDelta);
                        setY(l1, y1 + newDelta);
                    }
                }
            }
            if (error < maxError)
                break;
        }
        for (const label of labels) {
            label.style.y += y(label) - y0(label);
        }
        return labels;
    };
};
exports.OverlapDodgeY = OverlapDodgeY;
//# sourceMappingURL=overlapDodgeY.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816182, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ContrastReverse = void 0;
const d3_array_1 = require("@antv/vendor/d3-array");
const color_1 = require("../utils/color");
function getsRGB(s) {
    let c = s / 255;
    c = c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
    return c;
}
function getL(r, g, b) {
    return 0.2126 * getsRGB(r) + 0.7152 * getsRGB(g) + 0.0722 * getsRGB(b);
}
/**
 * Calculate the contrast. see https://webaim.org/resources/contrastchecker/
 * @param foreground
 * @param background
 */
function contrast(foreground, background) {
    if (!foreground || !background || foreground === background)
        return 1;
    const { r, g, b } = foreground;
    const { r: rb, g: gb, b: bb } = background;
    const L1 = getL(r, g, b);
    const L2 = getL(rb, gb, bb);
    return (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);
}
/**
 * Reverse color for max contrast.
 */
function mostContrast(color, palette) {
    const i = (0, d3_array_1.maxIndex)(palette, (c) => contrast(color, (0, color_1.parseToRGB)(c)));
    return palette[i];
}
/**
 * Reverse the label color when the contrast is lower then `threshold`.
 * The default value of `threshold` is 4.5.
 * More about contract, see https://webaim.org/resources/contrastchecker/
 */
const ContrastReverse = (options) => {
    const { threshold = 4.5, palette = ['#000', '#fff'] } = options;
    return (labels) => {
        labels.forEach((l) => {
            const background = l.attr('dependentElement').parsedStyle.fill;
            const foreground = l.parsedStyle.fill;
            const c = contrast(foreground, background);
            if (c < threshold)
                l.attr('fill', mostContrast(background, palette));
        });
        return labels;
    };
};
exports.ContrastReverse = ContrastReverse;
//# sourceMappingURL=contrastReverse.js.map
}, function(modId) { var map = {"../utils/color":1751263816183}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816183, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseToRGB = void 0;
const g_1 = require("@antv/g");
function parseToRGB(c) {
    if (typeof c === 'object')
        return c;
    return (0, g_1.parseColor)(c);
}
exports.parseToRGB = parseToRGB;
//# sourceMappingURL=color.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816184, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.OverflowHide = void 0;
const bounds_1 = require("../utils/bounds");
const style_1 = require("../utils/style");
/**
 * Hide the label when the label is overflowed from the element.
 */
const OverflowHide = () => {
    return (labels) => {
        labels.forEach((l) => {
            (0, style_1.show)(l);
            const bounds = l.attr('bounds');
            const b = l.getLocalBounds();
            const overflow = (0, bounds_1.isOverflow)((0, bounds_1.parseAABB)(b), bounds);
            if (overflow)
                (0, style_1.hide)(l);
        });
        return labels;
    };
};
exports.OverflowHide = OverflowHide;
//# sourceMappingURL=overflowHide.js.map
}, function(modId) { var map = {"../utils/bounds":1751263816180,"../utils/style":1751263816122}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816185, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.ExceedAdjust = void 0;
const style_1 = require("../utils/style");
const adjustPosition = (target, edge) => {
    const [[minEdgeX, minEdgeY], [maxEdgeX, maxEdgeY]] = edge;
    const [[minX, minY], [maxX, maxY]] = target;
    let changeX = 0, changeY = 0;
    // x-axis
    if (minX < minEdgeX) {
        changeX = minEdgeX - minX;
    }
    else if (maxX > maxEdgeX) {
        changeX = maxEdgeX - maxX;
    }
    // y-axis
    if (minY < minEdgeY) {
        changeY = minEdgeY - minY;
    }
    else if (maxY > maxEdgeY) {
        changeY = maxEdgeY - maxY;
    }
    return [changeX, changeY];
};
/**
 * adjust the label when exceed the plot
 */
const ExceedAdjust = () => {
    return (labels, { canvas, layout }) => {
        labels.forEach((l) => {
            (0, style_1.show)(l);
            const { max, min } = l.getRenderBounds();
            const [xMax, yMax] = max, [xMin, yMin] = min;
            const changeValue = adjustPosition([
                [xMin, yMin],
                [xMax, yMax],
            ], 
            // Prevent label overlap in multiple charts by calculating layouts separately to avoid collisions.
            [
                [layout.x, layout.y],
                [layout.x + layout.width, layout.y + layout.height],
            ]);
            // For label with connectorPoints
            if (l.style.connector && l.style.connectorPoints) {
                l.style.connectorPoints[0][0] -= changeValue[0];
                l.style.connectorPoints[0][1] -= changeValue[1];
            }
            l.style.x += changeValue[0];
            l.style.y += changeValue[1];
        });
        return labels;
    };
};
exports.ExceedAdjust = ExceedAdjust;
//# sourceMappingURL=exceedAdjust.js.map
}, function(modId) { var map = {"../utils/style":1751263816122}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816186, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.geolib = void 0;
const geoView_1 = require("../composition/geoView");
const geoPath_1 = require("../composition/geoPath");
function geolib() {
    return {
        'composition.geoView': geoView_1.GeoView,
        'composition.geoPath': geoPath_1.GeoPath,
    };
}
exports.geolib = geolib;
//# sourceMappingURL=geo.js.map
}, function(modId) { var map = {"../composition/geoView":1751263816111,"../composition/geoPath":1751263816110}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816187, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.graphlib = void 0;
const mark_1 = require("../mark");
const data_1 = require("../data");
function graphlib() {
    return {
        'data.arc': data_1.Arc,
        'data.cluster': data_1.Cluster,
        'mark.forceGraph': mark_1.ForceGraph,
        'mark.tree': mark_1.Tree,
        'mark.pack': mark_1.Pack,
        'mark.sankey': mark_1.Sankey,
        'mark.chord': mark_1.Chord,
        'mark.treemap': mark_1.Treemap,
    };
}
exports.graphlib = graphlib;
//# sourceMappingURL=graph.js.map
}, function(modId) { var map = {"../mark":1751263815821,"../data":1751263816146}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816188, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.plotlib = void 0;
const mark_1 = require("../mark");
const data_1 = require("../data");
function plotlib() {
    return {
        'data.venn': data_1.Venn,
        'mark.boxplot': mark_1.Boxplot,
        'mark.gauge': mark_1.Gauge,
        'mark.wordCloud': mark_1.WordCloud,
        'mark.liquid': mark_1.Liquid,
    };
}
exports.plotlib = plotlib;
//# sourceMappingURL=plot.js.map
}, function(modId) { var map = {"../mark":1751263815821,"../data":1751263816146}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816189, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.stdlib = void 0;
const core_1 = require("./core");
const geo_1 = require("./geo");
const graph_1 = require("./graph");
const plot_1 = require("./plot");
function stdlib() {
    return Object.assign(Object.assign(Object.assign(Object.assign({}, (0, geo_1.geolib)()), (0, graph_1.graphlib)()), (0, plot_1.plotlib)()), (0, core_1.corelib)());
}
exports.stdlib = stdlib;
//# sourceMappingURL=std.js.map
}, function(modId) { var map = {"./core":1751263815804,"./geo":1751263816186,"./graph":1751263816187,"./plot":1751263816188}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816190, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.litelib = void 0;
const coordinate_1 = require("../coordinate");
const encode_1 = require("../encode");
const mark_1 = require("../mark");
const palette_1 = require("../palette");
const scale_1 = require("../scale");
const theme_1 = require("../theme");
const component_1 = require("../component");
const animation_1 = require("../animation");
const interaction_1 = require("../interaction");
const composition_1 = require("../composition");
const shape_1 = require("../shape");
const data_1 = require("../data");
/**
 * In test stage, don't use it.
 */
function litelib() {
    return {
        'data.inline': data_1.Inline,
        'coordinate.cartesian': coordinate_1.Cartesian,
        'encode.constant': encode_1.Constant,
        'encode.field': encode_1.Field,
        'encode.transform': encode_1.Transform,
        'encode.column': encode_1.Column,
        'mark.interval': mark_1.Interval,
        'shape.label.label': shape_1.LabelShape,
        'palette.category10': palette_1.Category10,
        'palette.category20': palette_1.Category20,
        'scale.linear': scale_1.Linear,
        'scale.ordinal': scale_1.Ordinal,
        'scale.band': scale_1.Band,
        'scale.identity': scale_1.Identity,
        'scale.point': scale_1.Point,
        'scale.time': scale_1.Time,
        'scale.log': scale_1.Log,
        'scale.pow': scale_1.Pow,
        'scale.sqrt': scale_1.Sqrt,
        'scale.threshold': scale_1.Threshold,
        'scale.quantile': scale_1.Quantile,
        'scale.quantize': scale_1.Quantize,
        'scale.sequential': scale_1.Sequential,
        'scale.constant': scale_1.Constant,
        'theme.classic': theme_1.Classic,
        'component.axisX': component_1.AxisX,
        'component.axisY': component_1.AxisY,
        'component.axisRadar': component_1.AxisRadar,
        'component.axisLinear': component_1.AxisLinear,
        'component.axisArc': component_1.AxisArc,
        'component.legendCategory': component_1.LegendCategory,
        'component.legendContinuous': component_1.LegendContinuous,
        'component.legendContinuousBlock': component_1.LegendContinuousBlock,
        'component.legendContinuousBlockSize': component_1.LegendContinuousBlockSize,
        'component.legendContinuousSize': component_1.LegendContinuousSize,
        'component.legends': component_1.Legends,
        'component.title': component_1.TitleComponent,
        'component.sliderX': component_1.SliderX,
        'component.sliderY': component_1.SliderY,
        'component.scrollbarX': component_1.ScrollbarX,
        'component.scrollbarY': component_1.ScrollbarY,
        'animation.scaleInX': animation_1.ScaleInX,
        'animation.scaleOutX': animation_1.ScaleOutX,
        'animation.scaleInY': animation_1.ScaleInY,
        'animation.scaleOutY': animation_1.ScaleOutY,
        'animation.waveIn': animation_1.WaveIn,
        'animation.fadeIn': animation_1.FadeIn,
        'animation.fadeOut': animation_1.FadeOut,
        'animation.morphing': animation_1.Morphing,
        'interaction.tooltip': interaction_1.Tooltip,
        'interaction.legendFilter': interaction_1.LegendFilter,
        'interaction.legendHighlight': interaction_1.LegendHighlight,
        'interaction.sliderFilter': interaction_1.SliderFilter,
        'interaction.scrollbarFilter': interaction_1.ScrollbarFilter,
        'interaction.poptip': interaction_1.Poptip,
        'interaction.event': interaction_1.Event,
        'composition.mark': composition_1.Mark,
        'composition.view': composition_1.View,
    };
}
exports.litelib = litelib;
//# sourceMappingURL=lite.js.map
}, function(modId) { var map = {"../coordinate":1751263815805,"../encode":1751263815816,"../mark":1751263815821,"../palette":1751263816018,"../scale":1751263816021,"../theme":1751263816036,"../component":1751263816043,"../animation":1751263816063,"../interaction":1751263816078,"../composition":1751263816099,"../shape":1751263815879,"../data":1751263816146}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816191, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.extend = exports.Runtime = exports.register = exports.Chart = void 0;
var chart_1 = require("./chart");
Object.defineProperty(exports, "Chart", { enumerable: true, get: function () { return chart_1.Chart; } });
var library_1 = require("./library");
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return library_1.register; } });
var runtime_1 = require("./runtime");
Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return runtime_1.Runtime; } });
var extend_1 = require("./extend");
Object.defineProperty(exports, "extend", { enumerable: true, get: function () { return extend_1.extend; } });
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./chart":1751263816192,"./library":1751263816194,"./runtime":1751263816195,"./extend":1751263816193}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816192, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Chart = void 0;
const extend_1 = require("./extend");
const library_1 = require("./library");
const runtime_1 = require("./runtime");
exports.Chart = (0, extend_1.extend)(runtime_1.Runtime, library_1.library);
//# sourceMappingURL=chart.js.map
}, function(modId) { var map = {"./extend":1751263816193,"./library":1751263816194,"./runtime":1751263816195}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816193, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.extend = void 0;
function extend(Runtime, library) {
    class Chart extends Runtime {
        constructor(options) {
            super(Object.assign(Object.assign({}, options), { lib: library }));
        }
    }
    return Chart;
}
exports.extend = extend;
//# sourceMappingURL=extend.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816194, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.register = exports.library = void 0;
const marker_1 = require("../utils/marker");
exports.library = {};
// @todo Warn if override existing key.
function register(key, component) {
    if (key.startsWith('symbol.'))
        (0, marker_1.registerSymbol)(key.split('.').pop(), component);
    else
        Object.assign(exports.library, { [key]: component });
}
exports.register = register;
//# sourceMappingURL=library.js.map
}, function(modId) { var map = {"../utils/marker":1751263815899}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816195, function(require, module, exports) {

var __decorate = (this && this.__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;
};
var __rest = (this && this.__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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Runtime = exports.G2_CHART_KEY = void 0;
const g_1 = require("@antv/g");
const g_canvas_1 = require("@antv/g-canvas");
const g_plugin_dragndrop_1 = require("@antv/g-plugin-dragndrop");
const util_1 = require("@antv/util");
const event_emitter_1 = __importDefault(require("@antv/event-emitter"));
const d3_array_1 = require("@antv/vendor/d3-array");
const runtime_1 = require("../runtime");
const event_1 = require("../utils/event");
const tooltip_1 = require("../interaction/tooltip");
const utils_1 = require("../interaction/utils");
const utils_2 = require("./utils");
const composition_1 = require("./composition");
const define_1 = require("./define");
const mark_1 = require("./mark");
const library_1 = require("./library");
exports.G2_CHART_KEY = 'G2_CHART_KEY';
class Runtime extends composition_1.CompositionNode {
    constructor(options) {
        const { container, canvas, renderer, plugins, lib, createCanvas } = options, rest = __rest(options, ["container", "canvas", "renderer", "plugins", "lib", "createCanvas"]);
        super(rest, 'view');
        // Identifies whether bindAutoFit.
        this._hasBindAutoFit = false;
        this._rendering = false;
        this._trailing = false;
        this._trailingResolve = null;
        this._trailingReject = null;
        this._previousDefinedType = null;
        this._onResize = (0, util_1.debounce)(() => {
            this.forceFit();
        }, 300);
        this._renderer = renderer || new g_canvas_1.Renderer();
        this._plugins = plugins || [];
        this._container = (0, utils_2.normalizeContainer)(container);
        this._emitter = new event_emitter_1.default();
        this._context = {
            library: Object.assign(Object.assign({}, lib), library_1.library),
            emitter: this._emitter,
            canvas,
            createCanvas,
        };
        this._create();
    }
    render() {
        if (this._rendering)
            return this._addToTrailing();
        if (!this._context.canvas)
            this._createCanvas();
        this._bindAutoFit();
        this._rendering = true;
        // @fixme The cancel render is not marked, which will cause additional rendered event.
        // @ref src/runtime/render.ts
        const finished = new Promise((resolve, reject) => (0, runtime_1.render)(this._computedOptions(), this._context, this._createResolve(resolve), this._createReject(reject)));
        const [finished1, resolve, reject] = (0, utils_2.createEmptyPromise)();
        finished
            .then(resolve)
            .catch(reject)
            .then(() => this._renderTrailing());
        return finished1;
    }
    /**
     * @overload
     * @param {G2ViewTree} [options]
     * @returns {Runtime|Spec}
     */
    options(options) {
        if (arguments.length === 0)
            return (0, utils_2.optionsOf)(this);
        const { type } = options;
        if (type)
            this._previousDefinedType = type;
        (0, utils_2.updateRoot)(this, options, this._previousDefinedType, this._marks, this._compositions);
        return this;
    }
    getContainer() {
        return this._container;
    }
    getContext() {
        return this._context;
    }
    on(event, callback, once) {
        this._emitter.on(event, callback, once);
        return this;
    }
    once(event, callback) {
        this._emitter.once(event, callback);
        return this;
    }
    emit(event, ...args) {
        this._emitter.emit(event, ...args);
        return this;
    }
    off(event, callback) {
        this._emitter.off(event, callback);
        return this;
    }
    clear() {
        const options = this.options();
        this.emit(event_1.ChartEvent.BEFORE_CLEAR);
        this._reset();
        (0, runtime_1.destroy)(options, this._context, false);
        this.emit(event_1.ChartEvent.AFTER_CLEAR);
    }
    destroy() {
        const options = this.options();
        this.emit(event_1.ChartEvent.BEFORE_DESTROY);
        this._unbindAutoFit();
        this._reset();
        (0, runtime_1.destroy)(options, this._context, true);
        if (this._container[utils_2.REMOVE_FLAG])
            (0, utils_2.removeContainer)(this._container);
        this.emit(event_1.ChartEvent.AFTER_DESTROY);
    }
    forceFit() {
        // Don't fit if size do not change.
        this.options['autoFit'] = true;
        const { width, height } = (0, utils_2.sizeOf)(this.options(), this._container);
        if (width === this._width && height === this._height) {
            return Promise.resolve(this);
        }
        // Don't call changeSize to prevent update width and height of options.
        this.emit(event_1.ChartEvent.BEFORE_CHANGE_SIZE);
        const finished = this.render();
        finished.then(() => {
            this.emit(event_1.ChartEvent.AFTER_CHANGE_SIZE);
        });
        return finished;
    }
    changeSize(width, height) {
        if (width === this._width && height === this._height) {
            return Promise.resolve(this);
        }
        this.emit(event_1.ChartEvent.BEFORE_CHANGE_SIZE);
        this.attr('width', width);
        this.attr('height', height);
        const finished = this.render();
        finished.then(() => {
            this.emit(event_1.ChartEvent.AFTER_CHANGE_SIZE);
        });
        return finished;
    }
    getDataByXY(point, options = {}) {
        const { shared = false, series, facet = false, startX = 0, startY = 0, } = options;
        const { canvas, views } = this._context;
        const { document } = canvas;
        const { x, y } = point;
        // Temporarily do not handle the multi - view situation.
        const { coordinate, scale, markState, data: dataMap, key } = views[0];
        const elements = document.getElementsByClassName(runtime_1.ELEMENT_CLASS_NAME);
        const groupKey = shared ? (element) => element.__data__.x : (d) => d;
        const keyGroup = (0, d3_array_1.group)(elements, groupKey);
        const container = document.getElementsByClassName(runtime_1.VIEW_CLASS_NAME)[0];
        const root = (0, utils_1.selectPlotArea)(container);
        const hasSeriesInteraction = (markState) => {
            return Array.from(markState.values()).some((d) => {
                var _a, _b;
                return ((_a = d.interaction) === null || _a === void 0 ? void 0 : _a['seriesTooltip']) ||
                    ((_b = d.channels) === null || _b === void 0 ? void 0 : _b.some((c) => c.name === 'series' && c.values !== undefined));
            });
        };
        const isSeries = (0, tooltip_1.maybeValue)(series, hasSeriesInteraction(markState));
        const getElementData = (el) => (0, util_1.get)(el, '__data__.data', null);
        const getElementsData = (els) => els.map(getElementData);
        try {
            // For non-facet and series chart.
            if (isSeries &&
                hasSeriesInteraction(markState) &&
                !facet) {
                const { selectedData } = (0, tooltip_1.findSeriesElement)({
                    root,
                    event: { offsetX: x, offsetY: y },
                    elements,
                    coordinate,
                    scale,
                    startX,
                    startY,
                });
                const viewData = dataMap.get(`${key}-0`);
                return selectedData.map(({ index }) => viewData[index]);
            }
            // For single chart.
            const element = (0, tooltip_1.findSingleElement)({
                root,
                event: { offsetX: x, offsetY: y },
                elements,
                coordinate,
                scale,
                shared,
            });
            const k = groupKey(element);
            const groupElements = keyGroup.get(k);
            return groupElements ? getElementsData(groupElements) : [];
        }
        catch (e) {
            const topMostElement = canvas.document.elementFromPointSync(x, y);
            return topMostElement ? getElementData(topMostElement) : [];
        }
    }
    _create() {
        const { library } = this._context;
        // @todo After refactor component as mark, remove this.
        const isMark = (key) => key.startsWith('mark.') ||
            key === 'component.axisX' ||
            key === 'component.axisY' ||
            key === 'component.legends';
        const marks = [
            'mark.mark',
            ...Object.keys(library).filter(isMark),
        ];
        // Create mark generators.
        this._marks = {};
        for (const key of marks) {
            const name = key.split('.').pop();
            class Mark extends mark_1.MarkNode {
                constructor() {
                    super({}, name);
                }
            }
            this._marks[name] = Mark;
            this[name] = function (composite) {
                const node = this.append(Mark);
                if (name === 'mark')
                    node.type = composite;
                return node;
            };
        }
        // Create composition generators.
        const compositions = [
            'composition.view',
            ...Object.keys(library).filter((key) => key.startsWith('composition.') && key !== 'composition.mark'),
        ];
        this._compositions = Object.fromEntries(compositions.map((key) => {
            const name = key.split('.').pop();
            let Composition = class Composition extends composition_1.CompositionNode {
                constructor() {
                    super({}, name);
                }
            };
            Composition = __decorate([
                (0, define_1.defineProps)((0, define_1.nodeProps)(this._marks))
            ], Composition);
            return [name, Composition];
        }));
        for (const Ctor of Object.values(this._compositions)) {
            (0, define_1.defineProps)((0, define_1.nodeProps)(this._compositions))(Ctor);
        }
        for (const key of compositions) {
            const name = key.split('.').pop();
            this[name] = function () {
                const Composition = this._compositions[name];
                this.type = null;
                return this.append(Composition);
            };
        }
    }
    _reset() {
        const KEYS = ['theme', 'type', 'width', 'height', 'autoFit'];
        this.type = 'view';
        this.value = Object.fromEntries(Object.entries(this.value).filter(([key]) => key.startsWith('margin') ||
            key.startsWith('padding') ||
            key.startsWith('inset') ||
            KEYS.includes(key)));
        this.children = [];
    }
    _renderTrailing() {
        if (!this._trailing)
            return;
        this._trailing = false;
        this.render()
            .then(() => {
            const trailingResolve = this._trailingResolve.bind(this);
            this._trailingResolve = null;
            trailingResolve(this);
        })
            .catch((error) => {
            const trailingReject = this._trailingReject.bind(this);
            this._trailingReject = null;
            trailingReject(error);
        });
    }
    _createResolve(resolve) {
        return () => {
            this._rendering = false;
            resolve(this);
        };
    }
    _createReject(reject) {
        return (error) => {
            this._rendering = false;
            reject(error);
        };
    }
    // Update actual size and key.
    _computedOptions() {
        const options = this.options();
        const { key = exports.G2_CHART_KEY } = options;
        const { width, height, depth } = (0, utils_2.sizeOf)(options, this._container);
        this._width = width;
        this._height = height;
        this._key = key;
        return Object.assign(Object.assign({ key: this._key }, options), { width, height, depth });
    }
    // Create canvas if it does not exist.
    // DragAndDropPlugin is for interaction.
    // It is OK to register more than one time, G will handle this.
    _createCanvas() {
        const { width, height } = (0, utils_2.sizeOf)(this.options(), this._container);
        this._plugins.push(new g_plugin_dragndrop_1.Plugin());
        this._plugins.forEach((d) => this._renderer.registerPlugin(d));
        this._context.canvas = new g_1.Canvas({
            container: this._container,
            width,
            height,
            renderer: this._renderer,
        });
    }
    _addToTrailing() {
        var _a;
        // Resolve previous promise, and give up this task.
        (_a = this._trailingResolve) === null || _a === void 0 ? void 0 : _a.call(this, this);
        // Create new task.
        this._trailing = true;
        const promise = new Promise((resolve, reject) => {
            this._trailingResolve = resolve;
            this._trailingReject = reject;
        });
        return promise;
    }
    _bindAutoFit() {
        const options = this.options();
        const { autoFit } = options;
        if (this._hasBindAutoFit) {
            // If it was bind before, unbind it now.
            if (!autoFit)
                this._unbindAutoFit();
            return;
        }
        if (autoFit) {
            this._hasBindAutoFit = true;
            window.addEventListener('resize', this._onResize);
        }
    }
    _unbindAutoFit() {
        if (this._hasBindAutoFit) {
            this._hasBindAutoFit = false;
            window.removeEventListener('resize', this._onResize);
        }
    }
}
exports.Runtime = Runtime;
//# sourceMappingURL=runtime.js.map
}, function(modId) { var map = {"../runtime":1751263816081,"../utils/event":1751263816091,"../interaction/tooltip":1751263816131,"../interaction/utils":1751263816080,"./utils":1751263816196,"./composition":1751263816199,"./define":1751263816200,"./mark":1751263816202,"./library":1751263816194}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816196, function(require, module, exports) {

var __rest = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createEmptyPromise = exports.updateRoot = exports.optionsOf = exports.sizeOf = exports.valueOf = exports.normalizeRoot = exports.removeContainer = exports.normalizeContainer = exports.MIN_CHART_HEIGHT = exports.MIN_CHART_WIDTH = exports.CALLBACK_NODE = exports.REMOVE_FLAG = exports.VIEW_KEYS = void 0;
const util_1 = require("@antv/util");
const size_1 = require("../utils/size");
const helper_1 = require("../utils/helper");
const node_1 = require("./node");
// Keys can specified by new Chart({...}).
// Keys can bubble form mark-level options to view-level options.
exports.VIEW_KEYS = [
    'width',
    'height',
    'depth',
    'padding',
    'paddingLeft',
    'paddingRight',
    'paddingBottom',
    'paddingTop',
    'inset',
    'insetLeft',
    'insetRight',
    'insetTop',
    'insetBottom',
    'margin',
    'marginLeft',
    'marginRight',
    'marginTop',
    'marginBottom',
    'autoFit',
    'theme',
    'title',
    'interaction',
];
exports.REMOVE_FLAG = '__remove__';
exports.CALLBACK_NODE = '__callback__';
/** Minimum chart width */
exports.MIN_CHART_WIDTH = 1;
/** Minimum chart height */
exports.MIN_CHART_HEIGHT = 1;
function normalizeContainer(container) {
    if (container === undefined) {
        const container = document.createElement('div');
        container[exports.REMOVE_FLAG] = true;
        return container;
    }
    if (typeof container === 'string') {
        const node = document.getElementById(container);
        return node;
    }
    return container;
}
exports.normalizeContainer = normalizeContainer;
function removeContainer(container) {
    const parent = container.parentNode;
    if (parent) {
        parent.removeChild(container);
    }
}
exports.removeContainer = removeContainer;
function normalizeRoot(node) {
    if (node.type !== null)
        return node;
    const root = node.children[node.children.length - 1];
    for (const key of exports.VIEW_KEYS)
        root.attr(key, node.attr(key));
    return root;
}
exports.normalizeRoot = normalizeRoot;
function valueOf(node) {
    return Object.assign(Object.assign({}, node.value), { type: node.type });
}
exports.valueOf = valueOf;
function sizeOf(options, container) {
    const { width, height, autoFit, depth = 0 } = options;
    let effectiveWidth = 640;
    let effectiveHeight = 480;
    if (autoFit) {
        const { width: containerWidth, height: containerHeight } = (0, size_1.getContainerSize)(container);
        effectiveWidth = containerWidth || effectiveWidth;
        effectiveHeight = containerHeight || effectiveHeight;
    }
    effectiveWidth = width || effectiveWidth;
    effectiveHeight = height || effectiveHeight;
    return {
        width: Math.max((0, util_1.isNumber)(effectiveWidth) ? effectiveWidth : exports.MIN_CHART_WIDTH, exports.MIN_CHART_WIDTH),
        height: Math.max((0, util_1.isNumber)(effectiveHeight) ? effectiveHeight : exports.MIN_CHART_HEIGHT, exports.MIN_CHART_HEIGHT),
        depth,
    };
}
exports.sizeOf = sizeOf;
function optionsOf(node) {
    const root = normalizeRoot(node);
    const discovered = [root];
    const nodeValue = new Map();
    nodeValue.set(root, valueOf(root));
    while (discovered.length) {
        const node = discovered.pop();
        const value = nodeValue.get(node);
        const { children = [] } = node;
        for (const child of children) {
            if (child.type === exports.CALLBACK_NODE) {
                value.children = child.value;
            }
            else {
                const childValue = valueOf(child);
                const { children = [] } = value;
                children.push(childValue);
                discovered.push(child);
                nodeValue.set(child, childValue);
                value.children = children;
            }
        }
    }
    return nodeValue.get(root);
}
exports.optionsOf = optionsOf;
function isMark(type, mark) {
    if (typeof type === 'function')
        return true;
    return new Set(Object.keys(mark)).has(type);
}
function isComposition(type, composition) {
    return (typeof type !== 'function' && new Set(Object.keys(composition)).has(type));
}
function normalizeRootOptions(node, options, previousType, marks, composition) {
    const { type: oldType } = node;
    const { type = previousType || oldType } = options;
    if (isComposition(type, composition)) {
        for (const key of exports.VIEW_KEYS) {
            if (node.attr(key) !== undefined && options[key] === undefined) {
                options[key] = node.attr(key);
            }
        }
        return options;
    }
    if (isMark(type, marks)) {
        const view = { type: 'view' };
        const mark = Object.assign({}, options);
        for (const key of exports.VIEW_KEYS) {
            if (mark[key] !== undefined) {
                view[key] = mark[key];
                delete mark[key];
            }
        }
        return Object.assign(Object.assign({}, view), { children: [mark] });
    }
    return options;
}
function typeCtor(type, mark, composition) {
    if (typeof type === 'function')
        return mark.mark;
    const node = Object.assign(Object.assign({}, mark), composition);
    const ctor = node[type];
    if (!ctor)
        throw new Error(`Unknown mark: ${type}.`);
    return ctor;
}
// Create node from options.
function createNode(options, mark, composition) {
    if (typeof options === 'function') {
        const node = new node_1.Node();
        node.value = options;
        node.type = exports.CALLBACK_NODE;
        return node;
    }
    const { type, children } = options, value = __rest(options, ["type", "children"]);
    const Ctor = typeCtor(type, mark, composition);
    const node = new Ctor();
    node.value = value;
    // @ts-ignore
    node.type = type;
    return node;
}
// Update node by options.
function updateNode(node, newOptions) {
    const { type, children } = newOptions, value = __rest(newOptions, ["type", "children"]);
    if (node.type === type || type === undefined) {
        // Update node.
        (0, helper_1.deepAssign)(node.value, value);
    }
    else if (typeof type === 'string') {
        // Transform node.
        node.type = type;
        node.value = value;
    }
}
// Create a nested node tree from newOptions, and append it to the parent.
function appendNode(parent, newOptions, mark, composition) {
    if (!parent)
        return;
    const discovered = [[parent, newOptions]];
    while (discovered.length) {
        const [parent, nodeOptions] = discovered.shift();
        const node = createNode(nodeOptions, mark, composition);
        if (Array.isArray(parent.children))
            parent.push(node);
        const { children } = nodeOptions;
        if (Array.isArray(children)) {
            for (const child of children) {
                discovered.push([node, child]);
            }
        }
        else if (typeof children === 'function') {
            discovered.push([node, children]);
        }
    }
}
// Update node tree from options.
function updateRoot(node, options, definedType, mark, composition) {
    const rootOptions = normalizeRootOptions(node, options, definedType, mark, composition);
    const discovered = [[null, node, rootOptions]];
    while (discovered.length) {
        const [parent, oldNode, newNode] = discovered.shift();
        // If there is no oldNode, create a node tree directly.
        if (!oldNode) {
            appendNode(parent, newNode, mark, composition);
        }
        else if (!newNode) {
            oldNode.remove();
        }
        else {
            updateNode(oldNode, newNode);
            const { children: newChildren } = newNode;
            const { children: oldChildren } = oldNode;
            if (Array.isArray(newChildren) && Array.isArray(oldChildren)) {
                // Only update node specified in newChildren,
                // the extra oldChildren will remain still.
                const n = Math.max(newChildren.length, oldChildren.length);
                for (let i = 0; i < n; i++) {
                    const newChild = newChildren[i];
                    const oldChild = oldChildren[i];
                    discovered.push([oldNode, oldChild, newChild]);
                }
            }
            else if (typeof newChildren === 'function') {
                discovered.push([oldNode, null, newChildren]);
            }
        }
    }
}
exports.updateRoot = updateRoot;
function createEmptyPromise() {
    let reject;
    let resolve;
    const cloned = new Promise((res, rej) => {
        resolve = res;
        reject = rej;
    });
    return [cloned, resolve, reject];
}
exports.createEmptyPromise = createEmptyPromise;
//# sourceMappingURL=utils.js.map
}, function(modId) { var map = {"../utils/size":1751263816197,"../utils/helper":1751263815829,"./node":1751263816198}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816197, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.getBBoxSize = exports.getContainerSize = void 0;
const parseInt10 = (d) => (d ? parseInt(d) : 0);
/**
 * @description Get the element's bounding size.
 * @param container dom element.
 * @returns the element width and height
 */
function getContainerSize(container) {
    // size = width/height - padding.
    const style = getComputedStyle(container);
    const wrapperWidth = container.clientWidth || parseInt10(style.width);
    const wrapperHeight = container.clientHeight || parseInt10(style.height);
    const widthPadding = parseInt10(style.paddingLeft) + parseInt10(style.paddingRight);
    const heightPadding = parseInt10(style.paddingTop) + parseInt10(style.paddingBottom);
    return {
        width: wrapperWidth - widthPadding,
        height: wrapperHeight - heightPadding,
    };
}
exports.getContainerSize = getContainerSize;
/**
 * @description Calculate the real canvas size by view options.
 */
function getBBoxSize(options) {
    const { height, width, padding = 0, paddingLeft = padding, paddingRight = padding, paddingTop = padding, paddingBottom = padding, margin = 0, marginLeft = margin, marginRight = margin, marginTop = margin, marginBottom = margin, inset = 0, insetLeft = inset, insetRight = inset, insetTop = inset, insetBottom = inset, } = options;
    // @todo Add this padding to theme.
    // 30 is default size for padding, which defined in runtime.
    const maybeAuto = (padding) => (padding === 'auto' ? 20 : padding);
    const finalWidth = width -
        maybeAuto(paddingLeft) -
        maybeAuto(paddingRight) -
        marginLeft -
        marginRight -
        insetLeft -
        insetRight;
    const finalHeight = height -
        maybeAuto(paddingTop) -
        maybeAuto(paddingBottom) -
        marginTop -
        marginBottom -
        insetTop -
        insetBottom;
    return { width: finalWidth, height: finalHeight };
}
exports.getBBoxSize = getBBoxSize;
//# sourceMappingURL=size.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816198, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.Node = void 0;
/**
 * BFS nodes and execute callback.
 */
function bfs(node, callback) {
    const discovered = [node];
    while (discovered.length) {
        const currentNode = discovered.shift();
        callback && callback(currentNode);
        const children = currentNode.children || [];
        for (const child of children) {
            discovered.push(child);
        }
    }
}
/**
 * Hierarchy container.
 */
class Node {
    constructor(value = {}, type) {
        // The parent node.
        this.parentNode = null;
        // The children nodes.
        this.children = [];
        // The index of parent children.
        this.index = 0;
        this.type = type;
        this.value = value;
    }
    /**
     * Apply specified transform to current value. Mount the node
     * to replace the original one in the tree and then return it.
     */
    map(transform = (x) => x) {
        const newValue = transform(this.value);
        this.value = newValue;
        return this;
    }
    /**
     * Set or get the specified attribute. It the value is specified, update
     * the attribute of current value and return the node. Otherwise
     * return the the attribute of current value.
     */
    attr(key, value) {
        if (arguments.length === 1)
            return this.value[key];
        return this.map((v) => ((v[key] = value), v));
    }
    /**
     * Create a new node and append to children nodes.
     */
    append(Ctor) {
        const node = new Ctor({});
        node.children = [];
        this.push(node);
        return node;
    }
    push(node) {
        node.parentNode = this;
        node.index = this.children.length;
        this.children.push(node);
        return this;
    }
    /**
     * Remove current node from parentNode.
     */
    remove() {
        const parent = this.parentNode;
        if (parent) {
            const { children } = parent;
            const index = children.findIndex((item) => item === this);
            children.splice(index, 1);
        }
        return this;
    }
    getNodeByKey(key) {
        let targetNode = null;
        const callback = (node) => {
            if (key === node.attr('key')) {
                targetNode = node;
            }
        };
        bfs(this, callback);
        return targetNode;
    }
    getNodesByType(type) {
        const nodes = [];
        const callback = (node) => {
            if (type === node.type) {
                nodes.push(node);
            }
        };
        bfs(this, callback);
        return nodes;
    }
    getNodeByType(type) {
        let node = null;
        bfs(this, (current) => {
            if (node)
                return;
            if (type === current.type)
                node = current;
        });
        return node;
    }
    /**
     * Apply specified callback to the node value.
     */
    call(callback, ...params) {
        callback(this.map(), ...params);
        return this;
    }
    getRoot() {
        // Find the root chart and render.
        let root = this;
        while (root && root.parentNode) {
            root = root.parentNode;
        }
        return root;
    }
}
exports.Node = Node;
//# sourceMappingURL=node.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816199, function(require, module, exports) {

var __decorate = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompositionNode = void 0;
const style_1 = require("../utils/style");
const node_1 = require("./node");
const define_1 = require("./define");
const props_1 = require("./props");
let CompositionNode = class CompositionNode extends node_1.Node {
    /**
     * Change current node data and its children data.
     */
    changeData(data) {
        var _a;
        const chart = this.getRoot();
        if (!chart)
            return;
        this.attr('data', data);
        if ((_a = this.children) === null || _a === void 0 ? void 0 : _a.length) {
            this.children.forEach((child) => {
                child.attr('data', data);
            });
        }
        return chart === null || chart === void 0 ? void 0 : chart.render();
    }
    /**
     * Get view instance by key.
     */
    getView() {
        const chart = this.getRoot();
        const { views } = chart.getContext();
        if (!(views === null || views === void 0 ? void 0 : views.length))
            return undefined;
        return views.find((view) => view.key === this._key);
    }
    getScale() {
        var _a;
        return (_a = this.getView()) === null || _a === void 0 ? void 0 : _a.scale;
    }
    getScaleByChannel(channel) {
        const scale = this.getScale();
        if (scale)
            return scale[channel];
        return;
    }
    getCoordinate() {
        var _a;
        return (_a = this.getView()) === null || _a === void 0 ? void 0 : _a.coordinate;
    }
    getTheme() {
        var _a;
        return (_a = this.getView()) === null || _a === void 0 ? void 0 : _a.theme;
    }
    getGroup() {
        const key = this._key;
        if (!key)
            return undefined;
        const chart = this.getRoot();
        const chartGroup = chart.getContext().canvas.getRoot();
        return chartGroup.getElementById(key);
    }
    /**
     * Show the view.
     */
    show() {
        const group = this.getGroup();
        if (!group)
            return;
        !group.isVisible() && (0, style_1.show)(group);
    }
    /**
     * Hide the view.
     */
    hide() {
        const group = this.getGroup();
        if (!group)
            return;
        group.isVisible() && (0, style_1.hide)(group);
    }
};
CompositionNode = __decorate([
    (0, define_1.defineProps)(props_1.compositionProps)
], CompositionNode);
exports.CompositionNode = CompositionNode;
//# sourceMappingURL=composition.js.map
}, function(modId) { var map = {"../utils/style":1751263816122,"./node":1751263816198,"./define":1751263816200,"./props":1751263816201}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816200, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeProps = exports.defineProps = void 0;
const helper_1 = require("../utils/helper");
function defineValueProp(Node, name, { key = name }) {
    Node.prototype[name] = function (value) {
        if (arguments.length === 0)
            return this.attr(key);
        return this.attr(key, value);
    };
}
function defineArrayProp(Node, name, { key = name }) {
    Node.prototype[name] = function (value) {
        if (arguments.length === 0)
            return this.attr(key);
        if (Array.isArray(value))
            return this.attr(key, value);
        const array = [...(this.attr(key) || []), value];
        return this.attr(key, array);
    };
}
function defineObjectProp(Node, name, { key: k = name }) {
    Node.prototype[name] = function (key, value) {
        if (arguments.length === 0)
            return this.attr(k);
        if (arguments.length === 1 && typeof key !== 'string') {
            return this.attr(k, key);
        }
        const obj = this.attr(k) || {};
        obj[key] = arguments.length === 1 ? true : value;
        return this.attr(k, obj);
    };
}
function defineMixProp(Node, name, descriptor) {
    Node.prototype[name] = function (key) {
        if (arguments.length === 0)
            return this.attr(name);
        if (Array.isArray(key))
            return this.attr(name, { items: key });
        if ((0, helper_1.isStrictObject)(key) &&
            (key.title !== undefined || key.items !== undefined)) {
            return this.attr(name, key);
        }
        if (key === null || key === false)
            return this.attr(name, key);
        const obj = this.attr(name) || {};
        const { items = [] } = obj;
        items.push(key);
        obj.items = items;
        return this.attr(name, obj);
    };
}
function defineNodeProp(Node, name, { ctor }) {
    Node.prototype[name] = function (hocMark) {
        const node = this.append(ctor);
        if (name === 'mark') {
            node.type = hocMark;
        }
        return node;
    };
}
function defineContainerProp(Node, name, { ctor }) {
    Node.prototype[name] = function () {
        this.type = null;
        return this.append(ctor);
    };
}
/**
 * A decorator to define different type of attribute setter or
 * getter for current node.
 */
function defineProps(descriptors) {
    return (Node) => {
        for (const [name, descriptor] of Object.entries(descriptors)) {
            const { type } = descriptor;
            if (type === 'value')
                defineValueProp(Node, name, descriptor);
            else if (type === 'array')
                defineArrayProp(Node, name, descriptor);
            else if (type === 'object')
                defineObjectProp(Node, name, descriptor);
            else if (type === 'node')
                defineNodeProp(Node, name, descriptor);
            else if (type === 'container')
                defineContainerProp(Node, name, descriptor);
            else if (type === 'mix')
                defineMixProp(Node, name, descriptor);
        }
        return Node;
    };
}
exports.defineProps = defineProps;
function nodeProps(node) {
    return Object.fromEntries(Object.entries(node).map(([name, ctor]) => [name, { type: 'node', ctor }]));
}
exports.nodeProps = nodeProps;
//# sourceMappingURL=define.js.map
}, function(modId) { var map = {"../utils/helper":1751263815829}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816201, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
exports.compositionProps = exports.markProps = exports.commonProps = void 0;
exports.commonProps = {
    encode: { type: 'object' },
    scale: { type: 'object' },
    data: { type: 'value' },
    transform: { type: 'array' },
    style: { type: 'object' },
    animate: { type: 'object' },
    coordinate: { type: 'object' },
    interaction: { type: 'object' },
    label: { type: 'array', key: 'labels' },
    axis: { type: 'object' },
    legend: { type: 'object' },
    slider: { type: 'object' },
    scrollbar: { type: 'object' },
    state: { type: 'object' },
    layout: { type: 'object' },
    theme: { type: 'object' },
    title: { type: 'value' },
};
exports.markProps = Object.assign(Object.assign({}, exports.commonProps), { tooltip: { type: 'mix' }, viewStyle: { type: 'object' } });
exports.compositionProps = Object.assign(Object.assign({}, exports.commonProps), { labelTransform: { type: 'array' } });
//# sourceMappingURL=props.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816202, function(require, module, exports) {

var __decorate = (this && this.__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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkNode = void 0;
const node_1 = require("./node");
const define_1 = require("./define");
const props_1 = require("./props");
let MarkNode = class MarkNode extends node_1.Node {
    changeData(data) {
        const chart = this.getRoot();
        if (!chart)
            return;
        this.attr('data', data);
        return chart === null || chart === void 0 ? void 0 : chart.render();
    }
    /**
     * Get mark from chart views.
     */
    getMark() {
        var _a;
        const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
        if (!chartView)
            return undefined;
        const { markState } = chartView;
        const markKey = Array.from(markState.keys()).find((item) => item.key === this.attr('key'));
        return markState.get(markKey);
    }
    /**
     * Get all scales instance.
     */
    getScale() {
        var _a;
        const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
        if (!chartView)
            return undefined;
        return chartView === null || chartView === void 0 ? void 0 : chartView.scale;
    }
    /**
     * Get the scale instance by channel.
     */
    getScaleByChannel(channel) {
        var _a, _b;
        const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
        if (!chartView)
            return undefined;
        return (_b = chartView === null || chartView === void 0 ? void 0 : chartView.scale) === null || _b === void 0 ? void 0 : _b[channel];
    }
    /**
     * Get canvas group.
     */
    getGroup() {
        const key = this.attr('key');
        if (!key)
            return undefined;
        const chart = this.getRoot();
        const chartGroup = chart.getContext().canvas.getRoot();
        return chartGroup.getElementById(key);
    }
};
MarkNode = __decorate([
    (0, define_1.defineProps)(props_1.markProps)
], MarkNode);
exports.MarkNode = MarkNode;
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {"./node":1751263816198,"./define":1751263816200,"./props":1751263816201}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816203, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassicDark = exports.Classic = exports.Academy = exports.Dark = exports.Light = exports.LinearAxis = exports.selectPlotArea = exports.selectG2Elements = exports.seriesOf = exports.dataOf = exports.Selection = exports.select = exports.ChartEvent = exports.extend = exports.Runtime = exports.register = exports.MASK_CLASS_NAME = exports.AREA_CLASS_NAME = exports.LABEL_CLASS_NAME = exports.COMPONENT_CLASS_NAME = exports.PLOT_CLASS_NAME = exports.VIEW_CLASS_NAME = exports.ELEMENT_CLASS_NAME = exports.LABEL_LAYER_CLASS_NAME = exports.MAIN_LAYER_CLASS_NAME = exports.renderToMountedElement = exports.render = void 0;
var runtime_1 = require("./runtime");
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return runtime_1.render; } });
Object.defineProperty(exports, "renderToMountedElement", { enumerable: true, get: function () { return runtime_1.renderToMountedElement; } });
Object.defineProperty(exports, "MAIN_LAYER_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.MAIN_LAYER_CLASS_NAME; } });
Object.defineProperty(exports, "LABEL_LAYER_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.LABEL_LAYER_CLASS_NAME; } });
Object.defineProperty(exports, "ELEMENT_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.ELEMENT_CLASS_NAME; } });
Object.defineProperty(exports, "VIEW_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.VIEW_CLASS_NAME; } });
Object.defineProperty(exports, "PLOT_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.PLOT_CLASS_NAME; } });
Object.defineProperty(exports, "COMPONENT_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.COMPONENT_CLASS_NAME; } });
Object.defineProperty(exports, "LABEL_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.LABEL_CLASS_NAME; } });
Object.defineProperty(exports, "AREA_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.AREA_CLASS_NAME; } });
Object.defineProperty(exports, "MASK_CLASS_NAME", { enumerable: true, get: function () { return runtime_1.MASK_CLASS_NAME; } });
var api_1 = require("./api");
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return api_1.register; } });
Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return api_1.Runtime; } });
Object.defineProperty(exports, "extend", { enumerable: true, get: function () { return api_1.extend; } });
var event_1 = require("./utils/event");
Object.defineProperty(exports, "ChartEvent", { enumerable: true, get: function () { return event_1.ChartEvent; } });
__exportStar(require("./spec"), exports);
var selection_1 = require("./utils/selection");
Object.defineProperty(exports, "select", { enumerable: true, get: function () { return selection_1.select; } });
Object.defineProperty(exports, "Selection", { enumerable: true, get: function () { return selection_1.Selection; } });
var helper_1 = require("./utils/helper");
Object.defineProperty(exports, "dataOf", { enumerable: true, get: function () { return helper_1.dataOf; } });
Object.defineProperty(exports, "seriesOf", { enumerable: true, get: function () { return helper_1.seriesOf; } });
var utils_1 = require("./interaction/utils");
Object.defineProperty(exports, "selectG2Elements", { enumerable: true, get: function () { return utils_1.selectG2Elements; } });
Object.defineProperty(exports, "selectPlotArea", { enumerable: true, get: function () { return utils_1.selectPlotArea; } });
__exportStar(require("./transform"), exports);
var axis_1 = require("./component/axis");
Object.defineProperty(exports, "LinearAxis", { enumerable: true, get: function () { return axis_1.LinearAxis; } });
var theme_1 = require("./theme");
Object.defineProperty(exports, "Light", { enumerable: true, get: function () { return theme_1.Light; } });
Object.defineProperty(exports, "Dark", { enumerable: true, get: function () { return theme_1.Dark; } });
Object.defineProperty(exports, "Academy", { enumerable: true, get: function () { return theme_1.Academy; } });
Object.defineProperty(exports, "Classic", { enumerable: true, get: function () { return theme_1.Classic; } });
Object.defineProperty(exports, "ClassicDark", { enumerable: true, get: function () { return theme_1.ClassicDark; } });
//# sourceMappingURL=exports.js.map
}, function(modId) { var map = {"./runtime":1751263816081,"./api":1751263816191,"./utils/event":1751263816091,"./spec":1751263816204,"./utils/selection":1751263815883,"./utils/helper":1751263815829,"./interaction/utils":1751263816080,"./transform":1751263815823,"./component/axis":1751263816044,"./theme":1751263816036}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816204, function(require, module, exports) {

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./animate"), exports);
__exportStar(require("./component"), exports);
__exportStar(require("./composition"), exports);
__exportStar(require("./coordinate"), exports);
__exportStar(require("./coordinateTransform"), exports);
__exportStar(require("./data"), exports);
__exportStar(require("./dataTransform"), exports);
__exportStar(require("./encode"), exports);
__exportStar(require("./interaction"), exports);
__exportStar(require("./labelTransform"), exports);
__exportStar(require("./mark"), exports);
__exportStar(require("./scale"), exports);
__exportStar(require("./palette"), exports);
__exportStar(require("./theme"), exports);
__exportStar(require("./transform"), exports);
//# sourceMappingURL=index.js.map
}, function(modId) { var map = {"./animate":1751263816205,"./component":1751263816206,"./composition":1751263816207,"./coordinate":1751263816208,"./coordinateTransform":1751263816209,"./data":1751263816210,"./dataTransform":1751263816211,"./encode":1751263816212,"./interaction":1751263816213,"./labelTransform":1751263816214,"./mark":1751263816215,"./scale":1751263816216,"./palette":1751263816217,"./theme":1751263816218,"./transform":1751263816219}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816205, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=animate.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816206, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=component.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816207, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=composition.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816208, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=coordinate.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816209, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=coordinateTransform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816210, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816211, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=dataTransform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816212, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=encode.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816213, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interaction.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816214, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=labelTransform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816215, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=mark.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816216, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=scale.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816217, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=palette.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816218, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=theme.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1751263816219, function(require, module, exports) {

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=transform.js.map
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1751263815802);
})()
//miniprogram-npm-outsideDeps=["@antv/util","@antv/vendor/d3-array","@antv/scale","@antv/vendor/d3-shape","@antv/g","@antv/vendor/d3-path","@antv/component","flru","@antv/vendor/d3-hierarchy","@antv/vendor/d3-force","@antv/vendor/d3-format","@antv/g-canvas","@antv/g-plugin-dragndrop","@antv/event-emitter","@antv/expr","@antv/coord","@antv/vendor/d3-geo","@antv/vendor/d3-scale-chromatic","@antv/vendor/d3-dsv","pdfast"]
//# sourceMappingURL=index.js.map