"use strict";
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 () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SvgIcon = void 0;
const React = __importStar(require("react"));
const iconSvs_1 = require("./iconSvs");
/**
 * 通用 SVG 图标组件
 * 基于 iconSvs.ts 中的配置渲染图标
 *
 * @example
 * ```tsx
 * <SvgIcon name="table" size={16} />
 * <SvgIcon name="eye" size={24} color="#333" />
 * ```
 */
const SvgIcon = ({ name, size = 16, className, style, color }) => {
    var _a, _b;
    const config = iconSvs_1.ICON_CONFIGS[name];
    if (!config) {
        return null;
    }
    const viewBox = config.viewBox || '0 0 16 16';
    const hasClipPath = !!config.clipPathId;
    const isAiSparkle = name === 'aiSparkle';
    const isSmartUpdate = name === 'smartUpdate';
    return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, fill: "none", viewBox: viewBox, className: className, style: { color: color || 'currentColor', ...style } },
        isAiSparkle && (React.createElement("defs", null,
            React.createElement("linearGradient", { x1: "0.035", y1: "0.035", x2: "0.995", y2: "0.931", id: "ai-sparkle-gradient" },
                React.createElement("stop", { offset: "0%", stopColor: "#A93AFF", stopOpacity: "1" }),
                React.createElement("stop", { offset: "100%", stopColor: "#586EFF", stopOpacity: "1" })))),
        isSmartUpdate && (React.createElement("defs", null,
            React.createElement("linearGradient", { x1: "0", y1: "0", x2: "1.147", y2: "0.786", id: "smart-update-gradient" },
                React.createElement("stop", { offset: "20.7%", stopColor: "#AD8DFF", stopOpacity: "1" }),
                React.createElement("stop", { offset: "97.1%", stopColor: "#A17DFF", stopOpacity: "1" })))),
        hasClipPath && (React.createElement("defs", null,
            React.createElement("clipPath", { id: config.clipPathId },
                React.createElement("rect", { width: ((_a = config.clipPathSize) === null || _a === void 0 ? void 0 : _a.width) || 16, height: ((_b = config.clipPathSize) === null || _b === void 0 ? void 0 : _b.height) || 16, rx: "0" })))),
        hasClipPath ? (React.createElement("g", { clipPath: `url(#${config.clipPathId})` }, renderPaths(config, isAiSparkle))) : (renderPaths(config, isAiSparkle))));
};
exports.SvgIcon = SvgIcon;
/**
 * 渲染 path 元素
 */
function renderPaths(config, isGradient) {
    return config.paths.map((pathConfig) => (React.createElement("path", { key: pathConfig.d.slice(0, 50), d: pathConfig.d, fill: pathConfig.fill || (isGradient ? 'url(#ai-sparkle-gradient)' : 'currentColor'), fillRule: pathConfig.fillRule || 'evenodd', fillOpacity: pathConfig.fillOpacity })));
}
exports.SvgIcon.displayName = 'SvgIcon';
