var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/pro/Selector/hooks/usePresetProps.ts
var usePresetProps_exports = {};
__export(usePresetProps_exports, {
  default: () => usePresetProps_default
});
module.exports = __toCommonJS(usePresetProps_exports);
var import_react = require("react");
var VARIANT_MAP = {
  ["default"]: ["1", "2", "3", "4"],
  ["select"]: ["1"],
  ["card"]: ["1", "2", "3", "4", "5"],
  ["media"]: ["1", "2"]
};
var EMPTY_CONFIG = {};
var RESPONSIVE_PRESETS = {
  /** 响应式布局 - 最小宽度 210px，最多 5 列 */
  responsive210: {
    breakpoints: {
      0: { columns: 1, gap: 16 },
      420: { columns: 2, gap: 16 },
      630: { columns: 3, gap: 16 },
      841: { columns: 4, gap: 16 },
      1367: { columns: 5, gap: 16 }
    }
  },
  /** 响应式布局 - 最小宽度 330px，最多 4 列 */
  responsive330: {
    breakpoints: {
      0: { columns: 1, gap: 16 },
      660: { columns: 2, gap: 16 },
      995: { columns: 3, gap: 16 },
      1367: { columns: 4, gap: 16 }
    }
  }
};
var PRESET_LAYOUTS = {
  /** 自动宽度布局 - 内容自适应 */
  autoFlex: {
    className: "pisell-pro-selector_layout-auto-flex"
  },
  /** 响应式布局 - 最小宽度 210px，最多 5 列 */
  responsive210: {
    responsive: RESPONSIVE_PRESETS.responsive210
  },
  /** 响应式布局 - 最小宽度 330px，最多 4 列 */
  responsive330: {
    responsive: RESPONSIVE_PRESETS.responsive330
  }
};
var VARIANT_PRESET_MAP = {
  default: {
    "1": "column",
    "2": "autoFlex",
    "3": "column",
    "4": "autoFlex"
  },
  card: {
    "1": "responsive210",
    "2": "responsive210",
    "3": "column",
    "4": "responsive330",
    "5": "column"
  },
  media: {
    "1": "autoFlex",
    "2": "autoFlex"
  }
};
var usePresetProps = ({
  layout,
  mode = "single",
  preset,
  itemLayout = "horizontal",
  variant = "default",
  indicatorProps
}) => {
  return (0, import_react.useMemo)(() => {
    let layoutConfig = null;
    if (variant === "select" || !(preset == null ? void 0 : preset.variant)) {
      layoutConfig = layout || null;
    } else {
      let baseLayoutConfig = null;
      let validVariants = VARIANT_MAP[variant] || [];
      let presetVariant = validVariants.includes(preset == null ? void 0 : preset.variant) ? preset == null ? void 0 : preset.variant : "1";
      const presetLayoutInfo = VARIANT_PRESET_MAP[variant];
      if (presetLayoutInfo) {
        const layoutType = presetLayoutInfo[presetVariant];
        if (layoutType) {
          const _config = PRESET_LAYOUTS[layoutType];
          if (_config) {
            baseLayoutConfig = _config;
          } else {
            baseLayoutConfig = EMPTY_CONFIG;
          }
        } else {
          baseLayoutConfig = EMPTY_CONFIG;
        }
      } else {
        baseLayoutConfig = EMPTY_CONFIG;
      }
      if (layout) {
        layoutConfig = {
          ...baseLayoutConfig,
          ...layout
        };
      } else {
        layoutConfig = baseLayoutConfig;
      }
    }
    let computedIndicatorProps = {};
    const shouldUseFilled = variant === "media" || variant === "card" && (preset == null ? void 0 : preset.variant) === "2";
    if (shouldUseFilled) {
      computedIndicatorProps = {
        variant: "filled",
        size: "small"
      };
    }
    if (indicatorProps) {
      computedIndicatorProps = {
        ...computedIndicatorProps,
        ...indicatorProps
      };
    }
    return {
      layout: layoutConfig,
      indicatorProps: computedIndicatorProps
    };
  }, [
    JSON.stringify(preset),
    itemLayout,
    variant,
    layout,
    mode,
    JSON.stringify(indicatorProps)
  ]);
};
var usePresetProps_default = usePresetProps;
