"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const isBezierDefinition = require("./dist-es-utils-is-bezier-definition.cjs");
const linearEasing = require("./dist-es-utils-supports-linear-easing.cjs");
const linear = require("./dist-es-animation-waapi-utils-linear.cjs");
function isWaapiSupportedEasing(easing) {
  return Boolean(typeof easing === "function" && linearEasing.supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || linearEasing.supportsLinearEasing()) || isBezierDefinition.isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
}
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
const supportedWaapiEasing = {
  linear: "linear",
  ease: "ease",
  easeIn: "ease-in",
  easeOut: "ease-out",
  easeInOut: "ease-in-out",
  circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
  circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
  backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
  backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
};
function mapEasingToNativeEasing(easing, duration) {
  if (!easing) {
    return void 0;
  } else if (typeof easing === "function" && linearEasing.supportsLinearEasing()) {
    return linear.generateLinearEasing(easing, duration);
  } else if (isBezierDefinition.isBezierDefinition(easing)) {
    return cubicBezierAsString(easing);
  } else if (Array.isArray(easing)) {
    return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
  } else {
    return supportedWaapiEasing[easing];
  }
}
exports.cubicBezierAsString = cubicBezierAsString;
exports.isWaapiSupportedEasing = isWaapiSupportedEasing;
exports.mapEasingToNativeEasing = mapEasingToNativeEasing;
exports.supportedWaapiEasing = supportedWaapiEasing;
//# sourceMappingURL=dist-es-animation-waapi-utils-easing.cjs.map
