"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);

// packages/style-engine/src/styles/background/index.ts
var background_exports = {};
__export(background_exports, {
  default: () => background_default
});
module.exports = __toCommonJS(background_exports);
var import_utils = require("../utils.cjs");
var backgroundImage = {
  name: "backgroundImage",
  generate: (style, options) => {
    const _backgroundImage = style?.background?.backgroundImage;
    if (typeof _backgroundImage === "object" && _backgroundImage?.url) {
      return [
        {
          selector: options.selector,
          key: "backgroundImage",
          // Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
          value: `url( '${encodeURI(
            (0, import_utils.safeDecodeURI)(_backgroundImage.url)
          )}' )`
        }
      ];
    }
    return (0, import_utils.generateRule)(
      style,
      options,
      ["background", "backgroundImage"],
      "backgroundImage"
    );
  }
};
var backgroundPosition = {
  name: "backgroundPosition",
  generate: (style, options) => {
    return (0, import_utils.generateRule)(
      style,
      options,
      ["background", "backgroundPosition"],
      "backgroundPosition"
    );
  }
};
var backgroundRepeat = {
  name: "backgroundRepeat",
  generate: (style, options) => {
    return (0, import_utils.generateRule)(
      style,
      options,
      ["background", "backgroundRepeat"],
      "backgroundRepeat"
    );
  }
};
var backgroundSize = {
  name: "backgroundSize",
  generate: (style, options) => {
    return (0, import_utils.generateRule)(
      style,
      options,
      ["background", "backgroundSize"],
      "backgroundSize"
    );
  }
};
var backgroundAttachment = {
  name: "backgroundAttachment",
  generate: (style, options) => {
    return (0, import_utils.generateRule)(
      style,
      options,
      ["background", "backgroundAttachment"],
      "backgroundAttachment"
    );
  }
};
var background_default = [
  backgroundImage,
  backgroundPosition,
  backgroundRepeat,
  backgroundSize,
  backgroundAttachment
];
//# sourceMappingURL=index.cjs.map
