function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
import { useEditorStyleRegister } from "../../../Hooks/useStyle";
import { sharedButtonVariants } from "../sharedStyle";
var ICON_SIZE = 16;
var ICON_SIZE_SM = 14;
var ICON_SIZE_XS = 14;
var genStyle = function genStyle(token) {
    return _define_property({}, token.componentCls, _object_spread_props(_object_spread({
        // 基础按钮样式
        display: 'inline-flex',
        height: 'var(--height-control-base)',
        alignItems: 'center',
        justifyContent: 'center',
        gap: 8,
        border: 'none',
        borderRadius: 'var(--radius-control-base, 6px)',
        cursor: 'pointer',
        fontFamily: 'var(--font-family-base, var(--font-family-text, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif))',
        fontSize: 'var(--font-size-base, 14px)',
        fontWeight: 'var(--font-weight-medium, 500)',
        lineHeight: 'var(--line-height-base, 1.5)',
        textAlign: 'center',
        textDecoration: 'none',
        transition: 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)',
        userSelect: 'none',
        outline: 'none',
        position: 'relative',
        overflow: 'hidden',
        // 统一 icon 尺寸（适配 antd Button 图标容器）- base
        '&-button .ant-btn-icon': {
            fontSize: ICON_SIZE,
            lineHeight: 1
        },
        '&-button .ant-btn-icon > *': {
            width: ICON_SIZE,
            height: ICON_SIZE
        },
        // 尺寸变体
        '&-button-sm': {
            width: 'var(--height-control-sm)',
            height: 'var(--height-control-sm)',
            lineHeight: 'var(--height-control-sm)',
            borderRadius: 'var(--radius-control-sm)'
        },
        '&-button-sm .ant-btn-icon': {
            fontSize: ICON_SIZE_SM
        },
        '&-button-sm .ant-btn-icon > *': {
            width: ICON_SIZE_SM,
            height: ICON_SIZE_SM
        },
        // 提升优先级以覆盖 antd 的 icon-only 尺寸（包括 outlined 变体）
        '&-button&-button-sm.ant-btn.ant-btn-icon-only': {
            width: 'var(--height-control-sm)',
            height: 'var(--height-control-sm)',
            lineHeight: 'var(--height-control-sm)',
            borderRadius: 'var(--radius-control-sm)'
        },
        '&-button&-button-sm.ant-btn.ant-btn-variant-outlined.ant-btn-icon-only': {
            width: 'var(--height-control-sm)',
            height: 'var(--height-control-sm)',
            lineHeight: 'var(--height-control-sm)',
            borderRadius: 'var(--radius-control-sm)'
        },
        '&-button&-button-sm.ant-btn.ant-btn-icon-only .ant-btn-icon': {
            fontSize: ICON_SIZE_SM
        },
        '&-button&-button-sm.ant-btn.ant-btn-icon-only .ant-btn-icon > *': {
            width: ICON_SIZE_SM,
            height: ICON_SIZE_SM
        },
        '&-button-xs': {
            width: 'var(--height-control-xs)',
            height: 'var(--height-control-xs)',
            lineHeight: 'var(--height-control-xs)',
            borderRadius: 'var(--radius-control-xs)'
        },
        '&-button-xs .ant-btn-icon': {
            fontSize: ICON_SIZE_XS
        },
        '&-button-xs .ant-btn-icon > *': {
            width: ICON_SIZE_XS,
            height: ICON_SIZE_XS
        },
        '&-button&-button-xs.ant-btn.ant-btn-icon-only': {
            width: 'var(--height-control-xs)',
            height: 'var(--height-control-xs)',
            lineHeight: 'var(--height-control-xs)',
            borderRadius: 'var(--radius-control-xs)'
        },
        '&-button&-button-xs.ant-btn.ant-btn-variant-outlined.ant-btn-icon-only': {
            width: 'var(--height-control-xs)',
            height: 'var(--height-control-xs)',
            lineHeight: 'var(--height-control-xs)',
            borderRadius: 'var(--radius-control-xs)'
        },
        '&-button&-button-xs.ant-btn.ant-btn-icon-only .ant-btn-icon': {
            fontSize: ICON_SIZE_XS
        },
        '&-button&-button-xs.ant-btn.ant-btn-icon-only .ant-btn-icon > *': {
            width: ICON_SIZE_XS,
            height: ICON_SIZE_XS
        },
        // Elevated 悬浮版本 - 默认/hover/active
        '&-button-elevated': {
            borderRadius: 'var(--radius-control-base)',
            background: 'var(--color-gray-bg-card-white)',
            boxShadow: 'var(--shadow-border-base)',
            color: 'var(--color-gray-text-secondary)',
            '&:hover:not(&-button-disabled):not(&-button-loading):not([disabled])': {
                background: 'var(--color-gray-bg-card-white)',
                boxShadow: 'var(--shadow-control-lg)'
            },
            '&:active:not(&-button-disabled):not(&-button-loading):not([disabled])': {
                background: 'var(--color-primary-control-fill-secondary)',
                boxShadow: 'var(--shadow-border-base)',
                color: 'var(--color-gray-text-secondary)'
            }
        },
        // 提升 hover/active 选择器优先级以覆盖 antd 的 icon-only 悬浮样式
        '&-button&-button-elevated.ant-btn.ant-btn-icon-only:not(.ant-btn-disabled):not([disabled]):hover': {
            background: 'var(--color-gray-bg-card-white)',
            boxShadow: 'var(--shadow-control-lg)'
        },
        '&-button&-button-elevated.ant-btn.ant-btn-icon-only:not(.ant-btn-disabled):not([disabled]):active': {
            background: 'var(--color-primary-control-fill-secondary)',
            boxShadow: 'var(--shadow-border-base)',
            color: 'var(--color-gray-text-secondary)'
        },
        // Elevated 悬浮版本 - disabled
        '&-button-elevated&-button-disabled, &-button-elevated[disabled]': {
            background: 'var(--color-gray-bg-card-white)',
            boxShadow: 'var(--shadow-control-base)',
            color: 'var(--color-gray-text-disabled)'
        },
        // Elevated 悬浮版本 - loading
        '&-button-elevated&-button-loading': {
            background: 'var(--color-gray-bg-card-white)',
            boxShadow: 'var(--shadow-control-base)',
            color: 'var(--color-gray-text-disabled)'
        }
    }, sharedButtonVariants), {
        // 加载状态
        '&-loading': {
            cursor: 'not-allowed',
            pointerEvents: 'none',
            '&:hover': {
                transform: 'none !important'
            },
            '&:active': {
                transform: 'none !important'
            }
        },
        // 图标样式
        '&-icon': {
            display: 'inline-flex',
            alignItems: 'center',
            justifyContent: 'center',
            fontSize: 'inherit',
            lineHeight: 1
        },
        // 文字样式
        '&-text': {
            display: 'inline-block',
            whiteSpace: 'nowrap',
            overflow: 'hidden',
            textOverflow: 'ellipsis'
        }
    }));
};
export function useStyle(prefixCls) {
    return useEditorStyleRegister('icon-button', function(token) {
        var buttonToken = _object_spread_props(_object_spread({}, token), {
            componentCls: ".".concat(prefixCls)
        });
        return [
            genStyle(buttonToken)
        ];
    });
}
