"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/block-editor/src/components/global-styles/dimensions-panel.js
var dimensions_panel_exports = {};
__export(dimensions_panel_exports, {
  default: () => DimensionsPanel,
  useHasDimensionsPanel: () => useHasDimensionsPanel
});
module.exports = __toCommonJS(dimensions_panel_exports);
var import_clsx = __toESM(require("clsx"));
var import_i18n = require("@wordpress/i18n");
var import_components = require("@wordpress/components");
var import_icons = require("@wordpress/icons");
var import_element = require("@wordpress/element");
var import_global_styles_engine = require("@wordpress/global-styles-engine");
var import_utils = require("./utils.cjs");
var import_spacing_sizes_control = __toESM(require("../spacing-sizes-control/index.cjs"));
var import_dimension_control = __toESM(require("../dimension-control/index.cjs"));
var import_child_layout_control = __toESM(require("../child-layout-control/index.cjs"));
var import_aspect_ratio_tool = __toESM(require("../dimensions-tool/aspect-ratio-tool.cjs"));
var import_utils2 = require("../../hooks/utils.cjs");
var import_object = require("../../utils/object.cjs");
var import_block_style_state = require("../../hooks/block-style-state.cjs");
var import_jsx_runtime = require("react/jsx-runtime");
var AXIAL_SIDES = ["horizontal", "vertical"];
function useHasDimensionsPanel(settings, styleState = import_block_style_state.DEFAULT_BLOCK_STYLE_STATE) {
  return hasContentSize(settings) || hasWideSize(settings) || hasPadding(settings) || hasMargin(settings) || hasGap(settings) || hasHeight(settings) || hasMinHeight(settings) || hasMinWidth(settings) || hasWidth(settings) || hasAspectRatio(settings, styleState) || hasChildLayout(settings, styleState);
}
function hasContentSize(settings) {
  return settings?.layout?.contentSize;
}
function hasWideSize(settings) {
  return settings?.layout?.wideSize;
}
function hasPadding(settings) {
  return settings?.spacing?.padding;
}
function hasMargin(settings) {
  return settings?.spacing?.margin;
}
function hasGap(settings) {
  return settings?.spacing?.blockGap;
}
function hasHeight(settings) {
  return settings?.dimensions?.height;
}
function hasMinHeight(settings) {
  return settings?.dimensions?.minHeight;
}
function hasMinWidth(settings) {
  return settings?.dimensions?.minWidth;
}
function hasWidth(settings) {
  return settings?.dimensions?.width;
}
function hasAspectRatio(settings, styleState = import_block_style_state.DEFAULT_BLOCK_STYLE_STATE) {
  return !(0, import_block_style_state.hasPseudoBlockStyleState)(styleState) && settings?.dimensions?.aspectRatio;
}
function hasChildLayout(settings, styleState = import_block_style_state.DEFAULT_BLOCK_STYLE_STATE) {
  if ((0, import_block_style_state.hasPseudoBlockStyleState)(styleState)) {
    return false;
  }
  const {
    type: parentLayoutType = "default",
    default: { type: defaultParentLayoutType = "default" } = {},
    allowSizingOnChildren = false
  } = settings?.parentLayout ?? {};
  const support = (defaultParentLayoutType === "flex" || parentLayoutType === "flex" || defaultParentLayoutType === "grid" || parentLayoutType === "grid") && allowSizingOnChildren;
  return !!settings?.layout && support;
}
function hasSpacingPresets(settings) {
  const { defaultSpacingSizes, spacingSizes } = settings?.spacing || {};
  return defaultSpacingSizes !== false && spacingSizes?.default?.length > 0 || spacingSizes?.theme?.length > 0 || spacingSizes?.custom?.length > 0;
}
function filterValuesBySides(values, sides) {
  if (!sides || !values) {
    return values;
  }
  const filteredValues = {};
  sides.forEach((side) => {
    if (side === "vertical") {
      filteredValues.top = values.top;
      filteredValues.bottom = values.bottom;
    }
    if (side === "horizontal") {
      filteredValues.left = values.left;
      filteredValues.right = values.right;
    }
    filteredValues[side] = values?.[side];
  });
  return filteredValues;
}
function splitStyleValue(value) {
  if (value && typeof value === "string") {
    return {
      top: value,
      right: value,
      bottom: value,
      left: value
    };
  }
  return value;
}
function splitGapValue(value, isAxialGap) {
  if (!value) {
    return value;
  }
  if (typeof value === "string") {
    return isAxialGap ? { top: value, right: value, bottom: value, left: value } : { top: value };
  }
  return {
    ...value,
    right: value?.left,
    bottom: value?.top
  };
}
function DimensionsToolsPanel({
  resetAllFilter,
  onChange,
  value,
  panelId,
  children
}) {
  const dropdownMenuProps = (0, import_utils.useToolsPanelDropdownMenuProps)();
  const resetAll = () => {
    const updatedValue = resetAllFilter(value);
    onChange(updatedValue);
  };
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.__experimentalToolsPanel,
    {
      label: (0, import_i18n.__)("Dimensions"),
      resetAll,
      panelId,
      dropdownMenuProps,
      children
    }
  );
}
var DEFAULT_CONTROLS = {
  contentSize: true,
  wideSize: true,
  padding: true,
  margin: true,
  blockGap: true,
  height: true,
  minHeight: true,
  minWidth: true,
  width: true,
  aspectRatio: true,
  childLayout: true
};
function DimensionsPanel({
  as: Wrapper = DimensionsToolsPanel,
  value,
  onChange,
  inheritedValue = value,
  settings,
  panelId,
  defaultControls = DEFAULT_CONTROLS,
  onVisualize = () => {
  },
  // Special case because the layout controls are not part of the dimensions panel
  // in global styles but not in block inspector.
  includeLayoutControls = false,
  styleState = import_block_style_state.DEFAULT_BLOCK_STYLE_STATE
}) {
  const { dimensions, spacing } = settings;
  const decodeValue = (rawValue) => {
    if (rawValue && typeof rawValue === "object") {
      return Object.keys(rawValue).reduce((acc, key) => {
        acc[key] = (0, import_global_styles_engine.getValueFromVariable)(
          { settings: { dimensions, spacing } },
          "",
          rawValue[key]
        );
        return acc;
      }, {});
    }
    return (0, import_global_styles_engine.getValueFromVariable)(
      { settings: { dimensions, spacing } },
      "",
      rawValue
    );
  };
  const showSpacingPresetsControl = hasSpacingPresets(settings);
  const units = (0, import_components.__experimentalUseCustomUnits)({
    availableUnits: settings?.spacing?.units || [
      "%",
      "px",
      "em",
      "rem",
      "vw"
    ]
  });
  const minimumMargin = -Infinity;
  const [minMarginValue, setMinMarginValue] = (0, import_element.useState)(minimumMargin);
  const resetAllFilter = (0, import_element.useCallback)((previousValue) => {
    return {
      ...previousValue,
      layout: (0, import_utils2.cleanEmptyObject)({
        ...previousValue?.layout,
        contentSize: void 0,
        wideSize: void 0,
        selfStretch: void 0,
        flexSize: void 0,
        columnStart: void 0,
        rowStart: void 0,
        columnSpan: void 0,
        rowSpan: void 0
      }),
      spacing: {
        ...previousValue?.spacing,
        padding: void 0,
        margin: void 0,
        blockGap: void 0
      },
      dimensions: {
        ...previousValue?.dimensions,
        height: void 0,
        minHeight: void 0,
        minWidth: void 0,
        aspectRatio: void 0,
        width: void 0
      }
    };
  }, []);
  const showContentSizeControl = hasContentSize(settings) && includeLayoutControls;
  const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize);
  const setContentSizeValue = (newValue) => {
    onChange(
      (0, import_object.setImmutably)(
        value,
        ["layout", "contentSize"],
        newValue || void 0
      )
    );
  };
  const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize;
  const resetContentSizeValue = () => setContentSizeValue(void 0);
  const showWideSizeControl = hasWideSize(settings) && includeLayoutControls;
  const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize);
  const setWideSizeValue = (newValue) => {
    onChange(
      (0, import_object.setImmutably)(
        value,
        ["layout", "wideSize"],
        newValue || void 0
      )
    );
  };
  const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize;
  const resetWideSizeValue = () => setWideSizeValue(void 0);
  const showPaddingControl = hasPadding(settings);
  const rawPadding = decodeValue(inheritedValue?.spacing?.padding);
  const paddingValues = splitStyleValue(rawPadding);
  const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides;
  const isAxialPadding = paddingSides && paddingSides.some((side) => AXIAL_SIDES.includes(side));
  const setPaddingValues = (newPaddingValues) => {
    const padding = filterValuesBySides(newPaddingValues, paddingSides);
    onChange((0, import_object.setImmutably)(value, ["spacing", "padding"], padding));
  };
  const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length;
  const resetPaddingValue = () => setPaddingValues(void 0);
  const onMouseOverPadding = () => onVisualize("padding");
  const showMarginControl = hasMargin(settings);
  const rawMargin = decodeValue(inheritedValue?.spacing?.margin);
  const marginValues = splitStyleValue(rawMargin);
  const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides;
  const isAxialMargin = marginSides && marginSides.some((side) => AXIAL_SIDES.includes(side));
  const setMarginValues = (newMarginValues) => {
    const margin = filterValuesBySides(newMarginValues, marginSides);
    onChange((0, import_object.setImmutably)(value, ["spacing", "margin"], margin));
  };
  const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length;
  const resetMarginValue = () => setMarginValues(void 0);
  const onMouseOverMargin = () => onVisualize("margin");
  const showGapControl = hasGap(settings);
  const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides;
  const isAxialGap = gapSides && gapSides.some((side) => AXIAL_SIDES.includes(side));
  const gapValue = decodeValue(inheritedValue?.spacing?.blockGap);
  const gapValues = splitGapValue(gapValue, isAxialGap);
  const setGapValue = (newGapValue) => {
    onChange(
      (0, import_object.setImmutably)(value, ["spacing", "blockGap"], newGapValue)
    );
  };
  const setGapValues = (nextBoxGapValue) => {
    if (!nextBoxGapValue) {
      setGapValue(null);
    }
    if (!isAxialGap && nextBoxGapValue?.hasOwnProperty("top")) {
      setGapValue(nextBoxGapValue.top);
    } else {
      setGapValue({
        top: nextBoxGapValue?.top,
        left: nextBoxGapValue?.left
      });
    }
  };
  const resetGapValue = () => setGapValue(void 0);
  const hasGapValue = () => !!value?.spacing?.blockGap;
  const showMinHeightControl = hasMinHeight(settings);
  const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight);
  const setMinHeightValue = (newValue) => {
    const tempValue = (0, import_object.setImmutably)(
      value,
      ["dimensions", "minHeight"],
      newValue
    );
    onChange(
      (0, import_object.setImmutably)(
        tempValue,
        ["dimensions", "aspectRatio"],
        void 0
      )
    );
  };
  const resetMinHeightValue = () => {
    setMinHeightValue(void 0);
  };
  const hasMinHeightValue = () => !!value?.dimensions?.minHeight;
  const showHeightControl = hasHeight(settings);
  const heightValue = decodeValue(inheritedValue?.dimensions?.height);
  const setHeightValue = (newValue) => {
    const tempValue = (0, import_object.setImmutably)(
      value,
      ["dimensions", "height"],
      newValue
    );
    onChange(
      (0, import_object.setImmutably)(
        tempValue,
        ["dimensions", "aspectRatio"],
        void 0
      )
    );
  };
  const resetHeightValue = () => {
    setHeightValue(void 0);
  };
  const hasHeightValue = () => !!value?.dimensions?.height;
  const showMinWidthControl = hasMinWidth(settings);
  const minWidthValue = decodeValue(inheritedValue?.dimensions?.minWidth);
  const setMinWidthValue = (newValue) => {
    onChange(
      (0, import_object.setImmutably)(value, ["dimensions", "minWidth"], newValue)
    );
  };
  const resetMinWidthValue = () => {
    setMinWidthValue(void 0);
  };
  const hasMinWidthValue = () => !!value?.dimensions?.minWidth;
  const showWidthControl = hasWidth(settings);
  const widthValue = decodeValue(inheritedValue?.dimensions?.width);
  const setWidthValue = (newValue) => {
    onChange((0, import_object.setImmutably)(value, ["dimensions", "width"], newValue));
  };
  const resetWidthValue = () => {
    setWidthValue(void 0);
  };
  const hasWidthValue = () => !!value?.dimensions?.width;
  const showAspectRatioControl = hasAspectRatio(settings, styleState);
  const aspectRatioValue = decodeValue(
    inheritedValue?.dimensions?.aspectRatio
  );
  const setAspectRatioValue = (newValue) => {
    const tempValue = (0, import_object.setImmutably)(
      value,
      ["dimensions", "aspectRatio"],
      newValue
    );
    onChange(
      (0, import_object.setImmutably)(tempValue, ["dimensions", "minHeight"], void 0)
    );
  };
  const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio;
  const showChildLayoutControl = hasChildLayout(settings, styleState);
  const childLayout = inheritedValue?.layout;
  const setChildLayout = (newChildLayout) => {
    onChange({
      ...value,
      layout: {
        ...value?.layout,
        ...newChildLayout
      }
    });
  };
  const onMouseLeaveControls = () => onVisualize(false);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
    Wrapper,
    {
      resetAllFilter,
      value,
      onChange,
      panelId,
      children: [
        (showContentSizeControl || showWideSizeControl) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "span-columns", children: (0, import_i18n.__)("Set the width of the main content area.") }),
        showContentSizeControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            label: (0, import_i18n.__)("Content width"),
            hasValue: hasUserSetContentSizeValue,
            onDeselect: resetContentSizeValue,
            isShownByDefault: defaultControls.contentSize ?? DEFAULT_CONTROLS.contentSize,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_components.__experimentalUnitControl,
              {
                __next40pxDefaultSize: true,
                label: (0, import_i18n.__)("Content width"),
                labelPosition: "top",
                value: contentSizeValue || "",
                onChange: (nextContentSize) => {
                  setContentSizeValue(nextContentSize);
                },
                units,
                prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.alignNone }) })
              }
            )
          }
        ),
        showWideSizeControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            label: (0, import_i18n.__)("Wide width"),
            hasValue: hasUserSetWideSizeValue,
            onDeselect: resetWideSizeValue,
            isShownByDefault: defaultControls.wideSize ?? DEFAULT_CONTROLS.wideSize,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_components.__experimentalUnitControl,
              {
                __next40pxDefaultSize: true,
                label: (0, import_i18n.__)("Wide width"),
                labelPosition: "top",
                value: wideSizeValue || "",
                onChange: (nextWideSize) => {
                  setWideSizeValue(nextWideSize);
                },
                units,
                prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.stretchWide }) })
              }
            )
          }
        ),
        showPaddingControl && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasPaddingValue,
            label: (0, import_i18n.__)("Padding"),
            onDeselect: resetPaddingValue,
            isShownByDefault: defaultControls.padding ?? DEFAULT_CONTROLS.padding,
            className: (0, import_clsx.default)({
              "tools-panel-item-spacing": showSpacingPresetsControl
            }),
            panelId,
            children: [
              !showSpacingPresetsControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_components.BoxControl,
                {
                  values: paddingValues,
                  onChange: setPaddingValues,
                  label: (0, import_i18n.__)("Padding"),
                  sides: paddingSides,
                  units,
                  allowReset: false,
                  splitOnAxis: isAxialPadding,
                  inputProps: {
                    onMouseOver: onMouseOverPadding,
                    onMouseOut: onMouseLeaveControls
                  }
                }
              ),
              showSpacingPresetsControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_spacing_sizes_control.default,
                {
                  values: paddingValues,
                  onChange: setPaddingValues,
                  label: (0, import_i18n.__)("Padding"),
                  sides: paddingSides,
                  units,
                  allowReset: false,
                  onMouseOver: onMouseOverPadding,
                  onMouseOut: onMouseLeaveControls
                }
              )
            ]
          }
        ),
        showMarginControl && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasMarginValue,
            label: (0, import_i18n.__)("Margin"),
            onDeselect: resetMarginValue,
            isShownByDefault: defaultControls.margin ?? DEFAULT_CONTROLS.margin,
            className: (0, import_clsx.default)({
              "tools-panel-item-spacing": showSpacingPresetsControl
            }),
            panelId,
            children: [
              !showSpacingPresetsControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_components.BoxControl,
                {
                  values: marginValues,
                  onChange: setMarginValues,
                  inputProps: {
                    min: minMarginValue,
                    onDragStart: () => {
                      setMinMarginValue(0);
                    },
                    onDragEnd: () => {
                      setMinMarginValue(minimumMargin);
                    },
                    onMouseOver: onMouseOverMargin,
                    onMouseOut: onMouseLeaveControls
                  },
                  label: (0, import_i18n.__)("Margin"),
                  sides: marginSides,
                  units,
                  allowReset: false,
                  splitOnAxis: isAxialMargin
                }
              ),
              showSpacingPresetsControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_spacing_sizes_control.default,
                {
                  values: marginValues,
                  onChange: setMarginValues,
                  minimumCustomValue: -Infinity,
                  label: (0, import_i18n.__)("Margin"),
                  sides: marginSides,
                  units,
                  allowReset: false,
                  onMouseOver: onMouseOverMargin,
                  onMouseOut: onMouseLeaveControls
                }
              )
            ]
          }
        ),
        showGapControl && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasGapValue,
            label: (0, import_i18n.__)("Block spacing"),
            onDeselect: resetGapValue,
            isShownByDefault: defaultControls.blockGap ?? DEFAULT_CONTROLS.blockGap,
            className: (0, import_clsx.default)({
              "tools-panel-item-spacing": showSpacingPresetsControl,
              "single-column": (
                // If UnitControl is used, should be single-column.
                !showSpacingPresetsControl && !isAxialGap
              )
            }),
            panelId,
            children: [
              !showSpacingPresetsControl && (isAxialGap ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_components.BoxControl,
                {
                  label: (0, import_i18n.__)("Block spacing"),
                  min: 0,
                  onChange: setGapValues,
                  units,
                  sides: gapSides,
                  values: gapValues,
                  allowReset: false,
                  splitOnAxis: isAxialGap
                }
              ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_components.__experimentalUnitControl,
                {
                  __next40pxDefaultSize: true,
                  label: (0, import_i18n.__)("Block spacing"),
                  min: 0,
                  onChange: setGapValue,
                  units,
                  value: gapValue
                }
              )),
              showSpacingPresetsControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
                import_spacing_sizes_control.default,
                {
                  label: (0, import_i18n.__)("Block spacing"),
                  min: 0,
                  onChange: setGapValues,
                  showSideInLabel: false,
                  sides: isAxialGap ? gapSides : ["top"],
                  values: gapValues,
                  allowReset: false
                }
              )
            ]
          }
        ),
        showChildLayoutControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_child_layout_control.default,
          {
            value: childLayout,
            onChange: setChildLayout,
            parentLayout: settings?.parentLayout,
            panelId,
            showGridSpanDefaults: !(0, import_block_style_state.hasViewportBlockStyleState)(styleState),
            isShownByDefault: defaultControls.childLayout ?? DEFAULT_CONTROLS.childLayout
          }
        ),
        showMinHeightControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasMinHeightValue,
            label: (0, import_i18n.__)("Minimum height"),
            onDeselect: resetMinHeightValue,
            isShownByDefault: defaultControls.minHeight ?? DEFAULT_CONTROLS.minHeight,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_dimension_control.default,
              {
                label: (0, import_i18n.__)("Minimum height"),
                value: minHeightValue,
                onChange: setMinHeightValue,
                dimensionSizes: dimensions?.dimensionSizes
              }
            )
          }
        ),
        showMinWidthControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasMinWidthValue,
            label: (0, import_i18n.__)("Minimum width"),
            onDeselect: resetMinWidthValue,
            isShownByDefault: defaultControls.minWidth ?? DEFAULT_CONTROLS.minWidth,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_dimension_control.default,
              {
                label: (0, import_i18n.__)("Minimum width"),
                value: minWidthValue,
                onChange: setMinWidthValue,
                dimensionSizes: dimensions?.dimensionSizes
              }
            )
          }
        ),
        showHeightControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasHeightValue,
            label: (0, import_i18n.__)("Height"),
            onDeselect: resetHeightValue,
            isShownByDefault: defaultControls.height ?? DEFAULT_CONTROLS.height,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_dimension_control.default,
              {
                label: (0, import_i18n.__)("Height"),
                value: heightValue,
                onChange: setHeightValue,
                dimensionSizes: dimensions?.dimensionSizes
              }
            )
          }
        ),
        showWidthControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_components.__experimentalToolsPanelItem,
          {
            hasValue: hasWidthValue,
            label: (0, import_i18n.__)("Width"),
            onDeselect: resetWidthValue,
            isShownByDefault: defaultControls.width ?? DEFAULT_CONTROLS.width,
            panelId,
            children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
              import_dimension_control.default,
              {
                label: (0, import_i18n.__)("Width"),
                value: widthValue,
                onChange: setWidthValue,
                dimensionSizes: dimensions?.dimensionSizes
              }
            )
          }
        ),
        showAspectRatioControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_aspect_ratio_tool.default,
          {
            hasValue: hasAspectRatioValue,
            value: aspectRatioValue,
            onChange: setAspectRatioValue,
            panelId,
            isShownByDefault: defaultControls.aspectRatio ?? DEFAULT_CONTROLS.aspectRatio
          }
        )
      ]
    }
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  useHasDimensionsPanel
});
//# sourceMappingURL=dimensions-panel.cjs.map
