"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const layout$1 = require("../../util/layout.js");
const format = require("../../util/format.js");
const Rect = require("../../../../../../zrender@5.4.4/node_modules/zrender/lib/graphic/shape/Rect.js");
function layout(group, componentModel, api) {
  var boxLayoutParams = componentModel.getBoxLayoutParams();
  var padding = componentModel.get("padding");
  var viewportSize = {
    width: api.getWidth(),
    height: api.getHeight()
  };
  var rect = layout$1.getLayoutRect(boxLayoutParams, viewportSize, padding);
  layout$1.box(componentModel.get("orient"), group, componentModel.get("itemGap"), rect.width, rect.height);
  layout$1.positionElement(group, boxLayoutParams, viewportSize, padding);
}
function makeBackground(rect, componentModel) {
  var padding = format.normalizeCssArray(componentModel.get("padding"));
  var style = componentModel.getItemStyle(["color", "opacity"]);
  style.fill = componentModel.get("backgroundColor");
  rect = new Rect.default({
    shape: {
      x: rect.x - padding[3],
      y: rect.y - padding[0],
      width: rect.width + padding[1] + padding[3],
      height: rect.height + padding[0] + padding[2],
      r: componentModel.get("borderRadius")
    },
    style,
    silent: true,
    z2: -1
  });
  return rect;
}
exports.layout = layout;
exports.makeBackground = makeBackground;
