/*! bxs-vue-ui v3.3.0 */
'use strict';

var entryVirtual = require('./entry-virtual.js');
var normalizeComponent = require('./normalize-component.js');

var slice = [].slice;
var MSIE = /MSIE .\./.test(normalizeComponent.userAgent); // <- dirty ie9- check

var wrap = function (scheduler) {
  return function (handler, timeout /* , ...arguments */) {
    var boundArgs = arguments.length > 2;
    var args = boundArgs ? slice.call(arguments, 2) : undefined;
    return scheduler(boundArgs ? function () {
      // eslint-disable-next-line no-new-func
      (typeof handler == 'function' ? handler : Function(handler)).apply(this, args);
    } : handler, timeout);
  };
};

// ie9- setTimeout & setInterval additional parameters fix
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
entryVirtual.$({ global: true, bind: true, forced: MSIE }, {
  // `setTimeout` method
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
  setTimeout: wrap(entryVirtual.global.setTimeout),
  // `setInterval` method
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
  setInterval: wrap(entryVirtual.global.setInterval)
});

var setTimeout = entryVirtual.path.setTimeout;

var setTimeout$1 = setTimeout;

exports._setTimeout = setTimeout$1;
