"use strict";
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);
var useBoxShadow_exports = {};
__export(useBoxShadow_exports, {
  useBoxShadow: () => useBoxShadow
});
module.exports = __toCommonJS(useBoxShadow_exports);
var import_isNonNullable = require("../utils/isNonNullable");
var import_makeswift_api = require("../../runtimes/react/hooks/makeswift-api");
var import_prop_controllers = require("@makeswift/prop-controllers");
const ShadowDefaultValue = {
  inset: false,
  offsetX: 0,
  offsetY: 2,
  blurRadius: 4,
  spreadRadius: 0,
  color: null
};
function useBoxShadow(data) {
  const swatchIds = (0, import_prop_controllers.getShadowsPropControllerDataSwatchIds)(data);
  const swatches = (0, import_makeswift_api.useSwatches)(swatchIds);
  const responsiveShadowsData = (0, import_prop_controllers.getShadowsPropControllerDataResponsiveShadowsData)(data);
  if (responsiveShadowsData == null)
    return null;
  return responsiveShadowsData.map(({ value: shadows, ...restOfValue }) => ({
    ...restOfValue,
    value: shadows.map(
      ({
        payload: { color, inset, offsetX, offsetY, blurRadius, spreadRadius },
        ...restOfShadow
      }) => ({
        ...restOfShadow,
        payload: {
          color: color != null ? {
            swatch: swatches.filter(import_isNonNullable.isNonNullable).find((s) => s && s.id === color.swatchId),
            alpha: color.alpha
          } : null,
          inset: inset ?? ShadowDefaultValue.inset,
          offsetX: offsetX ?? ShadowDefaultValue.offsetX,
          offsetY: offsetY ?? ShadowDefaultValue.offsetY,
          blurRadius: blurRadius ?? ShadowDefaultValue.blurRadius,
          spreadRadius: spreadRadius ?? ShadowDefaultValue.spreadRadius
        }
      })
    )
  }));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  useBoxShadow
});
//# sourceMappingURL=useBoxShadow.js.map