import { get, find } from 'lodash';
import { v as i18n, bJ as PTD_VISUAL, bK as LTD_VISUAL, bL as POITD_VISUAL, bn as BY_COUNT, G as GEO_TYPES, B as GeometryType, bG as HEAT_VISUAL, bH as GRID_HEAT_VISUAL, bI as HEXAGON_HEAT_VISUAL, bt as TYPE_VISUAL, bu as NUMBER_VISUAL, bM as FLOW_VISUAL, h as __spreadArray, i as __read } from './MapEditView-24782753.js';

var i18nCards = i18n.mapEdit.cards;
var getCurrentVisualConfig = function (props) {
    var _a, _b, _c;
    var currentVisual = props.currentVisual, card = props.card, packageInfo = props.packageInfo;
    var getCol = packageInfo.getCol, geometryType = packageInfo.geometryType;
    var _d = currentVisual || {}, id = _d.id, fieldId = _d.fieldId;
    var uuid = card.uuid;
    var field = getCol({ uuid: uuid, fieldId: fieldId });
    var visual = get(card, id);
    var current = find(visual, { fieldId: fieldId });
    if (id === null || id === void 0 ? void 0 : id.startsWith(PTD_VISUAL)) {
        current = (_a = card.polygon3DVisual) === null || _a === void 0 ? void 0 : _a.find(function (i) { return i.id === id; });
    }
    if (id === null || id === void 0 ? void 0 : id.startsWith(LTD_VISUAL)) {
        current = (_b = card.line3DVisual) === null || _b === void 0 ? void 0 : _b.find(function (i) { return i.id === id; });
    }
    if (id === null || id === void 0 ? void 0 : id.startsWith(POITD_VISUAL)) {
        current = (_c = card.point3DVisual) === null || _c === void 0 ? void 0 : _c.find(function (i) { return i.id === id; });
    }
    if (fieldId === BY_COUNT) {
        field = i18nCards.point;
    }
    var isHeat = id === HEAT_VISUAL || id === GRID_HEAT_VISUAL || id === HEXAGON_HEAT_VISUAL;
    var isCurrentHeatVisual = id === HEAT_VISUAL;
    var isCurrentGridHeatVisual = id === GRID_HEAT_VISUAL;
    var isCurrentHexagonHeatVisual = id === HEXAGON_HEAT_VISUAL;
    var isCurrentTypeVisual = id === TYPE_VISUAL;
    var isCurrentNumberVisual = id === NUMBER_VISUAL;
    var isFlow = id === FLOW_VISUAL;
    var isPolygon3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(PTD_VISUAL);
    var isLine3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(LTD_VISUAL);
    var isPoint3DVisual = id === null || id === void 0 ? void 0 : id.startsWith(POITD_VISUAL);
    var isPointToPoint = geometryType === GEO_TYPES[GeometryType.pointToPoint];
    var isPoint = geometryType === GEO_TYPES[GeometryType.point];
    var isPolygon = geometryType === GEO_TYPES[GeometryType.polygon];
    var isLine = geometryType === GEO_TYPES[GeometryType.line];
    var type = {
        isHeat: isHeat,
        isCurrentHeatVisual: isCurrentHeatVisual,
        isCurrentGridHeatVisual: isCurrentGridHeatVisual,
        isCurrentHexagonHeatVisual: isCurrentHexagonHeatVisual,
        isCurrentTypeVisual: isCurrentTypeVisual,
        isCurrentNumberVisual: isCurrentNumberVisual,
        isFlow: isFlow,
        isPolygon3DVisual: isPolygon3DVisual,
        isLine3DVisual: isLine3DVisual,
        isPoint3DVisual: isPoint3DVisual,
        isPointToPoint: isPointToPoint,
        isPoint: isPoint,
        isPolygon: isPolygon,
        isLine: isLine,
    };
    return [current, id, field, fieldId, type];
};

var getCardIconInfo = function (props) {
    var getIconColorPref = props.getIconColorPref, getIconUrl = props.getIconUrl, iconCache = props.iconCache, customIconPrefInfo = props.customIconPrefInfo, defaultIcon = props.defaultIcon;
    return {
        defaultIcon: defaultIcon,
        iconList: __spreadArray(__spreadArray([], __read(iconCache.customIconList.map(function (i) { return ({
            // label: getIconLabel(i),
            name: i,
            url: getIconUrl(i),
            originalColor: getIconColorPref(i),
        }); })), false), __read(iconCache.defaultIconList.map(function (i) { return ({
            // label: getIconLabel(i),
            name: i,
            url: getIconUrl(i),
            originalColor: getIconColorPref(i),
        }); })), false),
        customIconPrefInfo: customIconPrefInfo,
    };
};

export { getCurrentVisualConfig as a, getCardIconInfo as g };
