'use strict';

var canUseDom = require('./canUseDom.cjs');

const canUseDocElement = () => canUseDom.canUseDom() && window.document.documentElement;
function isStyleNameSupport(styleName) {
  if (canUseDom.canUseDom() && window.document.documentElement) {
    const styleNameList = Array.isArray(styleName) ? styleName : [styleName];
    const { documentElement } = window.document;
    return styleNameList.some((name) => name in documentElement.style);
  }
  return false;
}
function isStyleValueSupport(styleName, value) {
  if (!isStyleNameSupport(styleName))
    return false;
  const ele = document.createElement("div");
  const origin = ele.style[styleName];
  ele.style[styleName] = value;
  return ele.style[styleName] !== origin;
}
function isStyleSupport(styleName, styleValue) {
  if (!Array.isArray(styleName) && styleValue !== void 0)
    return isStyleValueSupport(styleName, styleValue);
  return isStyleNameSupport(styleName);
}
let flexGapSupported;
function detectFlexGapSupported() {
  if (!canUseDocElement())
    return false;
  if (flexGapSupported !== void 0)
    return flexGapSupported;
  const flex = document.createElement("div");
  flex.style.display = "flex";
  flex.style.flexDirection = "column";
  flex.style.rowGap = "1px";
  flex.appendChild(document.createElement("div"));
  flex.appendChild(document.createElement("div"));
  document.body.appendChild(flex);
  flexGapSupported = flex.scrollHeight === 1;
  document.body.removeChild(flex);
  return flexGapSupported;
}

exports.canUseDocElement = canUseDocElement;
exports.detectFlexGapSupported = detectFlexGapSupported;
exports.isStyleSupport = isStyleSupport;
//# sourceMappingURL=styleChecker.cjs.map
