"use strict";
const canUseDOM = require("./canUseDOM.js");
var prev = (/* @__PURE__ */ new Date()).getTime();
function fallback(fn) {
  var curr = (/* @__PURE__ */ new Date()).getTime();
  var ms = Math.max(0, 16 - (curr - prev));
  var handle = setTimeout(fn, ms);
  prev = curr;
  return handle;
}
var vendors = ["", "webkit", "moz", "o", "ms"];
var rafImpl = fallback;
var getKey = function getKey2(vendor, k) {
  return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + "AnimationFrame";
};
if (canUseDOM.default) {
  vendors.some(function(vendor) {
    var rafMethod = getKey(vendor, "request");
    if (rafMethod in window) {
      getKey(vendor, "cancel");
      rafImpl = function rafImpl2(cb) {
        return window[rafMethod](cb);
      };
    }
    return !!rafImpl;
  });
}
