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";
/** 强制单列布局的 viewport 阈值（手机竖屏 / 窄侧栏） */ var SINGLE_COLUMN_BREAKPOINT = 480;
var genStyle = function genStyle(token) {
    var _obj;
    return _define_property({}, token.componentCls, // 窄屏（手机竖屏 / 窄侧栏）强制单列，避免 < 480px 仍勉强塞两列导致文字被挤断
    _define_property({
        display: 'flex',
        flexDirection: 'column',
        gap: token.paddingSM,
        width: '100%',
        '&-header': {
            display: 'flex',
            alignItems: 'center',
            gap: token.paddingSM,
            padding: "".concat(token.paddingXS, "px 0"),
            flexWrap: 'wrap'
        },
        '&-title': {
            fontSize: token.fontSizeLG,
            fontWeight: token.fontWeightStrong,
            color: token.colorTextHeading,
            margin: 0,
            lineHeight: token.lineHeightHeading4
        },
        '&-toolbar': {
            marginInlineStart: 'auto',
            display: 'flex',
            gap: token.paddingXS,
            alignItems: 'center',
            flexWrap: 'wrap'
        },
        '&-grid': {
            display: 'grid',
            gap: token.padding,
            width: '100%'
        },
        '&-item': {
            display: 'flex',
            flexDirection: 'column',
            gap: token.paddingXS,
            padding: token.padding,
            backgroundColor: token.colorBgContainer,
            border: "1px solid ".concat(token.colorBorderSecondary),
            borderRadius: token.borderRadiusLG,
            // 仅在指针设备上启用 hover 过渡，避免 touch 设备 first-tap 残留 hover 态
            transition: "border-color ".concat(token.motionDurationMid, " ").concat(token.motionEaseOut, ", box-shadow ").concat(token.motionDurationMid, " ").concat(token.motionEaseOut),
            // 防止子元素溢出导致整张卡片在 grid 里被撑宽
            minWidth: 0
        },
        '&-item-title': {
            fontSize: token.fontSizeLG,
            fontWeight: token.fontWeightStrong,
            color: token.colorTextHeading,
            lineHeight: token.lineHeightHeading4,
            margin: 0,
            wordBreak: 'break-word'
        },
        '&-item-url': {
            fontSize: token.fontSizeSM,
            color: token.colorTextDescription,
            lineHeight: token.lineHeightSM,
            // 单行 + 省略，原 URL 通过 title attribute 浮窗展示
            overflow: 'hidden',
            textOverflow: 'ellipsis',
            whiteSpace: 'nowrap'
        },
        '&-item-link': {
            color: token.colorLink,
            textDecoration: 'none',
            // 触摸目标至少 24px 高，达到 WCAG 2.2 AA Target Size (Minimum) 2.5.8 (24×24 px)
            display: 'inline-block',
            minHeight: 24,
            lineHeight: '24px',
            maxWidth: '100%',
            overflow: 'hidden',
            textOverflow: 'ellipsis',
            whiteSpace: 'nowrap',
            verticalAlign: 'bottom',
            '&:active': {
                color: token.colorLinkActive
            }
        },
        // 仅在指针设备上启用 hover 态，避免移动端 first-tap 残留
        '@media (hover: hover)': (_obj = {}, _define_property(_obj, "".concat(token.componentCls, "-item:hover"), {
            borderColor: token.colorPrimaryBorderHover,
            boxShadow: token.boxShadowTertiary
        }), _define_property(_obj, "".concat(token.componentCls, "-item-link:hover"), {
            color: token.colorLinkHover,
            textDecoration: 'underline'
        }), _obj),
        '&-item-desc': {
            fontSize: token.fontSize,
            color: token.colorText,
            lineHeight: token.lineHeight,
            margin: 0,
            whiteSpace: 'pre-wrap',
            wordBreak: 'break-word'
        },
        '&-item-tags': {
            display: 'flex',
            flexWrap: 'wrap',
            gap: token.paddingXXS,
            marginTop: 'auto'
        },
        '&-tag': {
            display: 'inline-flex',
            alignItems: 'center',
            // 用 padding 控制实际高度，避免在手机端因 fontSize × line-height 超出固定 height 被截
            padding: "".concat(token.paddingXXS, "px ").concat(token.paddingXS, "px"),
            borderRadius: token.borderRadiusSM,
            backgroundColor: token.colorFillSecondary,
            color: token.colorTextSecondary,
            fontSize: token.fontSizeSM,
            lineHeight: token.lineHeightSM,
            whiteSpace: 'nowrap',
            maxWidth: '100%',
            overflow: 'hidden',
            textOverflow: 'ellipsis'
        },
        '&-empty': {
            padding: token.paddingLG,
            color: token.colorTextDescription,
            textAlign: 'center'
        }
    }, "@media (max-width: ".concat(SINGLE_COLUMN_BREAKPOINT, "px)"), {
        '&-grid': {
            gridTemplateColumns: '1fr !important'
        },
        '&-header': {
            gap: token.paddingXS
        },
        '&-item': {
            padding: token.paddingSM
        }
    }));
};
export var useStyle = function useStyle(prefixCls) {
    return useEditorStyleRegister('DocCards', function(token) {
        var componentToken = _object_spread_props(_object_spread({}, token), {
            componentCls: ".".concat(prefixCls)
        });
        return [
            genStyle(componentToken)
        ];
    });
};
