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";
var SUBTLE_BORDER = '1px solid var(--color-gray-border-light)';
/**
 * 生成代码编辑器面板的通用样式（HTML / JSON 共用）
 */ var genEditorPanelStyle = function genEditorPanelStyle(cls) {
    var _obj;
    return _obj = {}, _define_property(_obj, cls, {
        flex: 1,
        display: 'flex',
        flexDirection: 'column',
        gap: '8px',
        padding: '12px',
        background: 'var(--color-gray-bg-page-light)',
        border: SUBTLE_BORDER,
        borderRadius: '8px'
    }), _define_property(_obj, "".concat(cls, "-header"), {
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'space-between'
    }), _define_property(_obj, "".concat(cls, "-header h3"), {
        margin: 0,
        fontSize: 'var(--font-size-base)',
        fontWeight: 600,
        color: 'var(--color-gray-text-default)'
    }), _define_property(_obj, "".concat(cls, "-header button"), {
        display: 'flex',
        alignItems: 'center',
        gap: '4px',
        padding: '3px 8px',
        fontSize: 'var(--font-size-sm)',
        color: 'var(--color-gray-text-secondary)'
    }), _define_property(_obj, "".concat(cls, "-content"), {
        flex: 1,
        minHeight: 0,
        position: 'relative'
    }), _define_property(_obj, "".concat(cls, "-content .ace_editor"), {
        height: '100% !important',
        fontSize: 'var(--font-size-base)'
    }), _obj;
};
var genStyle = function genStyle(token) {
    var componentCls = token.componentCls;
    var _obj, _obj1, _obj2;
    return _object_spread_props(_object_spread((_obj = {}, _define_property(_obj, componentCls, {
        display: 'flex',
        flexDirection: 'column',
        background: 'var(--color-gray-bg-card-white)',
        borderRadius: '8px',
        overflow: 'hidden',
        fontFamily: 'inherit'
    }), _define_property(_obj, "".concat(componentCls, "-container"), {
        display: 'flex',
        flex: 1,
        gap: '4px',
        background: 'var(--color-gray-bg-page-light)',
        minHeight: 0
    }), _define_property(_obj, "".concat(componentCls, "-left"), {
        display: 'flex',
        flexDirection: 'column',
        flex: 1,
        minWidth: 0
    }), _define_property(_obj, "".concat(componentCls, "-right"), {
        flex: 1,
        minWidth: 0,
        display: 'flex',
        flexDirection: 'column',
        gap: '4px',
        padding: '4px',
        borderRadius: '8px',
        background: 'var(--color-gray-control-fill-secondary)',
        overflow: 'auto'
    }), _obj), genEditorPanelStyle("".concat(componentCls, "-html")), genEditorPanelStyle("".concat(componentCls, "-json"))), (_obj2 = {}, // 预览区域样式
    _define_property(_obj2, "".concat(componentCls, "-preview"), {
        flex: 1,
        display: 'flex',
        flexDirection: 'column',
        minHeight: 0,
        border: SUBTLE_BORDER,
        borderRadius: '8px',
        background: 'var(--color-gray-bg-card-white)',
        boxShadow: 'var(--shadow-border-base)'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-header"), {
        padding: '12px',
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'space-between'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-header h3"), {
        margin: 0,
        fontSize: 'var(--font-size-base)',
        fontWeight: 600,
        color: 'var(--color-gray-text-default)'
    }), _define_property(_obj2, "".concat(componentCls, "-error"), {
        background: 'var(--color-red-bg-page-light)',
        border: '1px solid var(--color-red-border-light)',
        borderRadius: '4px',
        padding: '8px 12px',
        fontSize: 'var(--font-size-sm)',
        color: 'var(--color-red-text-default)',
        maxWidth: '300px',
        wordBreak: 'break-word'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content"), {
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'center',
        flex: 1,
        padding: '16px',
        overflow: 'auto',
        background: 'var(--color-gray-bg-card-white)',
        borderRadius: '0 0 8px 8px'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content-empty"), {
        display: 'flex',
        flexDirection: 'column',
        gap: '8px',
        alignItems: 'center'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content-empty p"), {
        fontSize: 'var(--font-size-base)',
        textAlign: 'center',
        color: 'var(--color-gray-text-light)'
    }), _define_property(_obj2, "".concat(componentCls, "-fallback"), {
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        justifyContent: 'center',
        height: '100%',
        color: 'var(--color-gray-text-secondary)',
        textAlign: 'center'
    }), _define_property(_obj2, "".concat(componentCls, "-fallback p"), {
        margin: '4px 0',
        fontSize: 'var(--font-size-base)'
    }), _define_property(_obj2, // 响应式设计
    '@media (max-width: 768px)', (_obj1 = {}, _define_property(_obj1, "".concat(componentCls, "-container"), {
        flexDirection: 'column'
    }), _define_property(_obj1, "".concat(componentCls, "-left"), {
        borderRight: 'none',
        borderBottom: '1px solid var(--color-gray-border-light)'
    }), _define_property(_obj1, "".concat(componentCls, "-html, ").concat(componentCls, "-json"), {
        minHeight: '200px'
    }), _obj1)), // 滚动条样式
    _define_property(_obj2, "".concat(componentCls, "-preview-content::-webkit-scrollbar"), {
        width: '6px'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content::-webkit-scrollbar-track"), {
        background: 'var(--color-gray-control-fill-secondary)',
        borderRadius: '3px'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content::-webkit-scrollbar-thumb"), {
        background: 'var(--color-gray-text-light)',
        borderRadius: '3px'
    }), _define_property(_obj2, "".concat(componentCls, "-preview-content::-webkit-scrollbar-thumb:hover"), {
        background: 'var(--color-gray-text-secondary)'
    }), // 编辑器主题适配
    _define_property(_obj2, "".concat(componentCls, " .ace_editor"), {
        borderRadius: '8px',
        background: 'var(--color-gray-bg-page-light)',
        color: 'var(--color-gray-text-default)'
    }), _define_property(_obj2, "".concat(componentCls, " .ace_editor.ace_dark"), {
        background: 'var(--color-gray-bg-page-dark)',
        color: 'var(--color-gray-text-light)'
    }), // 加载状态
    _define_property(_obj2, "".concat(componentCls, "-loading"), {
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        height: '100%',
        color: 'var(--color-gray-text-secondary)'
    }), _define_property(_obj2, "".concat(componentCls, "-loading::after"), {
        content: "''",
        width: '20px',
        height: '20px',
        border: '2px solid var(--color-gray-border-light)',
        borderTop: '2px solid var(--color-primary-control-fill-primary)',
        borderRadius: '50%',
        animationName: 'spin',
        animationDuration: '1s',
        animationTimingFunction: 'linear',
        animationIterationCount: 'infinite',
        marginLeft: '8px'
    }), _obj2));
};
export function useStyle(prefixCls) {
    return useEditorStyleRegister('SchemaEditor', function(token) {
        var schemaEditorToken = _object_spread_props(_object_spread({}, token), {
            componentCls: ".".concat(prefixCls)
        });
        return [
            genStyle(schemaEditorToken)
        ];
    });
}
