"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 legacy_controls_exports = {};
__export(legacy_controls_exports, {
  resolveLegacyDescriptorProp: () => resolveLegacyDescriptorProp
});
module.exports = __toCommonJS(legacy_controls_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_hooks = require("../../components/hooks");
var import_responsive_style = require("../../components/utils/responsive-style");
var import_components = require("./components");
var import_use_style = require("./use-style");
var import_prop_controllers = require("@makeswift/prop-controllers");
var import_useResponsiveLengthPropControllerData = require("../../components/hooks/useResponsiveLengthPropControllerData");
var import_useNumberPropControllerData = require("../../components/hooks/useNumberPropControllerData");
var import_useResponsiveColorPropControllerData = require("../../components/hooks/useResponsiveColorPropControllerData");
var import_useTextStylePropControllerData = require("../../components/hooks/useTextStylePropControllerData");
var import_useNavigationLinksPropControllerData = require("../../components/hooks/useNavigationLinksPropControllerData");
var import_useTextAreaPropControllerData = require("../../components/hooks/useTextAreaPropControllerData");
var import_usePropValue = require("../../components/hooks/usePropValue");
var import_useGapYPropControllerData = require("../../components/hooks/useGapYPropControllerData");
var import_useElementIDPropControllerData = require("../../components/hooks/useElementIDPropControllerData");
var import_useTableFormFieldsPropControllerData = require("../../components/hooks/useTableFormFieldsPropControllerData");
var import_useGridPropControllerData = require("../../components/hooks/useGridPropControllerData");
var import_useImagePropControllerData = require("../../components/hooks/useImagePropControllerData");
var import_useImagesPropControllerData = require("../../components/hooks/useImagesPropControllerData");
var import_useBackgroundsPropControllerData = require("../../components/hooks/useBackgroundsPropControllerData");
var import_useTextInputPropControllerData = require("../../components/hooks/useTextInputPropControllerData");
function useWidthStyle(data, descriptor) {
  const value = (0, import_prop_controllers.getWidthPropControllerDataResponsiveLengthData)(data);
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsiveWidth)(value, descriptor.options.defaultValue));
}
function usePaddingStyle(data) {
  const value = (0, import_prop_controllers.getPaddingPropControllerDataResponsivePaddingData)(data);
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsivePadding)(value));
}
function useMarginStyle(data) {
  const value = (0, import_prop_controllers.getMarginPropControllerDataResponsiveMarginData)(data);
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsiveMargin)(value));
}
function useBorderRadiusStyle(data) {
  const value = (0, import_prop_controllers.getBorderRadiusPropControllerDataResponsiveBorderRadiusData)(data);
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsiveBorderRadius)(value));
}
function useShadowsStyle(data) {
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsiveShadow)((0, import_hooks.useBoxShadow)(data) ?? void 0));
}
function useBorderStyle(data) {
  const value = (0, import_prop_controllers.getBorderPropControllerDataResponsiveBorderData)(data);
  const borderData = (0, import_hooks.useBorder)(value);
  return (0, import_use_style.useStyle)((0, import_responsive_style.useResponsiveBorder)(borderData ?? void 0));
}
function resolveLegacyDescriptorProp(descriptor, propName, propData, props, renderFn) {
  switch (descriptor.type) {
    case import_prop_controllers.Types.Width:
      switch (descriptor.options.format) {
        case import_prop_controllers.WidthPropControllerFormat.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
            import_components.RenderHook,
            {
              hook: useWidthStyle,
              parameters: [propData, descriptor],
              children: (value) => renderFn({ ...props, [propName]: value })
            },
            descriptor.type
          );
        case import_prop_controllers.WidthPropControllerFormat.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getWidthPropControllerDataResponsiveLengthData)(propData)
          });
      }
    case import_prop_controllers.Types.Padding:
      switch (descriptor.options.format) {
        case import_prop_controllers.PaddingPropControllerFormat.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: usePaddingStyle, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
        case import_prop_controllers.PaddingPropControllerFormat.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getPaddingPropControllerDataResponsivePaddingData)(propData)
          });
      }
    case import_prop_controllers.Types.Margin:
      switch (descriptor.options.format) {
        case import_prop_controllers.MarginPropControllerFormat.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: useMarginStyle, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
        case import_prop_controllers.MarginPropControllerFormat.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getMarginPropControllerDataResponsiveMarginData)(propData)
          });
      }
    case import_prop_controllers.Types.BorderRadius:
      switch (descriptor.options.format) {
        case import_prop_controllers.BorderRadiusPropControllerFormat.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: useBorderRadiusStyle, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
        case import_prop_controllers.BorderRadiusPropControllerFormat.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getBorderRadiusPropControllerDataResponsiveBorderRadiusData)(propData)
          });
      }
    case import_prop_controllers.Types.Backgrounds:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useBackgroundsPropControllerData.useBackgroundsPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.Image:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_useImagePropControllerData.useImagePropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.Images:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useImagesPropControllerData.useImagesPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.Number:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useNumberPropControllerData.useNumberPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.ResponsiveNumber:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: (data) => (0, import_usePropValue.usePropValue)(import_prop_controllers.ResponsiveNumber, data),
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.ResponsiveIconRadioGroup:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: (data) => (0, import_usePropValue.usePropValue)(import_prop_controllers.ResponsiveIconRadioGroup, data),
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.ResponsiveSelect:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: (data) => (0, import_usePropValue.usePropValue)(import_prop_controllers.ResponsiveSelect, data),
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.ResponsiveOpacity:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: (data) => (0, import_usePropValue.usePropValue)(import_prop_controllers.ResponsiveOpacity, data),
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.ResponsiveLength:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useResponsiveLengthPropControllerData.useResponsiveLengthPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.Shadows:
      switch (descriptor.options.format) {
        case import_prop_controllers.Shadows.Format.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: useShadowsStyle, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
        case import_prop_controllers.Shadows.Format.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getShadowsPropControllerDataResponsiveShadowsData)(propData)
          });
      }
    case import_prop_controllers.Types.Border:
      switch (descriptor.options.format) {
        case import_prop_controllers.BorderPropControllerFormat.ClassName:
          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: useBorderStyle, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
        case import_prop_controllers.BorderPropControllerFormat.ResponsiveValue:
        default:
          return renderFn({
            ...props,
            [propName]: (0, import_prop_controllers.getBorderPropControllerDataResponsiveBorderData)(propData)
          });
      }
    case import_prop_controllers.Types.ResponsiveColor:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useResponsiveColorPropControllerData.useResponsiveColorPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.Link:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_hooks.useLinkPropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.Checkbox:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_hooks.useCheckboxPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.Date:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_hooks.useDatePropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.Font:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_hooks.useFontPropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.Video:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_hooks.useVideoPropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.Table:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_hooks.useTablePropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.TextStyle:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useTextStylePropControllerData.useTextStylePropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.NavigationLinks:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useNavigationLinksPropControllerData.useNavigationLinksPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.TextInput:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useTextInputPropControllerData.useTextInputPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.TextArea:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useTextAreaPropControllerData.useTextAreaPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.GapX:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: (data) => (0, import_usePropValue.usePropValue)(import_prop_controllers.GapX, data),
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.GapY:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_useGapYPropControllerData.useGapYPropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    case import_prop_controllers.Types.ElementID:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useElementIDPropControllerData.useElementIDPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.TableFormFields:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_components.RenderHook,
        {
          hook: import_useTableFormFieldsPropControllerData.useTableFormFieldsPropControllerData,
          parameters: [propData],
          children: (value) => renderFn({ ...props, [propName]: value })
        },
        descriptor.type
      );
    case import_prop_controllers.Types.SocialLinks:
      return renderFn({
        ...props,
        [propName]: (0, import_prop_controllers.getSocialLinksPropControllerDataSocialLinksData)(propData)
      });
    case import_prop_controllers.Types.Grid:
      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.RenderHook, { hook: import_useGridPropControllerData.useGridPropControllerData, parameters: [propData], children: (value) => renderFn({ ...props, [propName]: value }) }, descriptor.type);
    default:
      return renderFn({ ...props, [propName]: propData });
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  resolveLegacyDescriptorProp
});
//# sourceMappingURL=legacy-controls.js.map