import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import List from "./List.js";
import { useDevice } from "./hooks/useDevice.js";
import React, { useMemo } from "react";
//#region src/components/list/ResponsiveWrapper.tsx
const _excluded = ["responsive", "children"];
/**
* ResponsiveWrapper 响应式包装器组件
* 根据不同设备类型自动选择合适的配置
*/
const ResponsiveWrapper = (props) => {
	const { responsive, children } = props, listProps = _objectWithoutProperties(props, _excluded);
	const deviceInfo = useDevice();
	console.log("deviceInfo", deviceInfo);
	const finalProps = useMemo(() => {
		if (!responsive) {
			const classNames = [listProps.className, `list-device-${deviceInfo.type}`].filter(Boolean).join(" ");
			return _objectSpread2(_objectSpread2({}, listProps), {}, { className: classNames });
		}
		const { pc, pad, mobile } = responsive;
		let deviceSpecificProps = {};
		switch (deviceInfo.type) {
			case "mobile":
				deviceSpecificProps = mobile || {};
				break;
			case "pad":
				deviceSpecificProps = pad || {};
				break;
			case "pc":
				deviceSpecificProps = pc || {};
				break;
			default: deviceSpecificProps = {};
		}
		const mergedProps = _objectSpread2(_objectSpread2({}, listProps), deviceSpecificProps);
		const classNames = [mergedProps.className, `list-device-${deviceInfo.type}`].filter(Boolean).join(" ");
		return _objectSpread2(_objectSpread2({}, mergedProps), {}, { className: classNames });
	}, [
		responsive,
		deviceInfo.type,
		listProps
	]);
	const optimizedProps = useMemo(() => {
		const props = _objectSpread2({}, finalProps);
		switch (deviceInfo.type) {
			case "mobile":
				var _props$columns, _props$columnGap, _props$rowGap, _props$defaultPageSiz;
				return _objectSpread2(_objectSpread2({}, props), {}, {
					layoutDirection: props.layoutDirection || "vertical",
					columns: (_props$columns = props.columns) !== null && _props$columns !== void 0 ? _props$columns : 1,
					columnGap: (_props$columnGap = props.columnGap) !== null && _props$columnGap !== void 0 ? _props$columnGap : 8,
					rowGap: (_props$rowGap = props.rowGap) !== null && _props$rowGap !== void 0 ? _props$rowGap : 8,
					paginationType: props.paginationType || "scroll",
					defaultPageSize: (_props$defaultPageSiz = props.defaultPageSize) !== null && _props$defaultPageSiz !== void 0 ? _props$defaultPageSiz : 10
				});
			case "pad":
				var _props$columns2, _props$columnGap2, _props$rowGap2, _props$defaultPageSiz2;
				return _objectSpread2(_objectSpread2({}, props), {}, {
					columns: (_props$columns2 = props.columns) !== null && _props$columns2 !== void 0 ? _props$columns2 : 2,
					columnGap: (_props$columnGap2 = props.columnGap) !== null && _props$columnGap2 !== void 0 ? _props$columnGap2 : 12,
					rowGap: (_props$rowGap2 = props.rowGap) !== null && _props$rowGap2 !== void 0 ? _props$rowGap2 : 12,
					paginationType: props.paginationType || "more",
					defaultPageSize: (_props$defaultPageSiz2 = props.defaultPageSize) !== null && _props$defaultPageSiz2 !== void 0 ? _props$defaultPageSiz2 : 12
				});
			case "pc":
				var _props$columns3, _props$columnGap3, _props$rowGap3, _props$defaultPageSiz3;
				return _objectSpread2(_objectSpread2({}, props), {}, {
					columns: (_props$columns3 = props.columns) !== null && _props$columns3 !== void 0 ? _props$columns3 : 3,
					columnGap: (_props$columnGap3 = props.columnGap) !== null && _props$columnGap3 !== void 0 ? _props$columnGap3 : 16,
					rowGap: (_props$rowGap3 = props.rowGap) !== null && _props$rowGap3 !== void 0 ? _props$rowGap3 : 16,
					paginationType: props.paginationType || "pager",
					defaultPageSize: (_props$defaultPageSiz3 = props.defaultPageSize) !== null && _props$defaultPageSiz3 !== void 0 ? _props$defaultPageSiz3 : 15
				});
			default: return props;
		}
	}, [finalProps, deviceInfo.type]);
	return /* @__PURE__ */ React.createElement(List, optimizedProps, children);
};
//#endregion
export { ResponsiveWrapper as default };
