System.register(["__unresolved_0", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8"], function (_export, _context) {
  "use strict";

  var _req, _req2, _req3, _req4, _req5, _req6, _req7, _req8, _loader, _cjsExports, __cjsMetaURL;

  _export("default", void 0);

  return {
    setters: [function (_unresolved_) {
      _req = _unresolved_.__cjsMetaURL;
    }, function (_unresolved_2) {
      _req2 = _unresolved_2.__cjsMetaURL;
    }, function (_unresolved_3) {
      _req3 = _unresolved_3.__cjsMetaURL;
    }, function (_unresolved_4) {
      _req4 = _unresolved_4.__cjsMetaURL;
    }, function (_unresolved_5) {
      _req5 = _unresolved_5.__cjsMetaURL;
    }, function (_unresolved_6) {
      _req6 = _unresolved_6.__cjsMetaURL;
    }, function (_unresolved_7) {
      _req7 = _unresolved_7.__cjsMetaURL;
    }, function (_unresolved_8) {
      _req8 = _unresolved_8.__cjsMetaURL;
    }, function (_unresolved_9) {
      _loader = _unresolved_9.default;
    }],
    execute: function () {
      _loader.define(_context.meta.url, function (exports, _require, module, __filename, __dirname) {
        var require = _loader.createRequireWithReqMap({
          "../internals/global": _req,
          "../internals/function-bind-context": _req2,
          "../internals/object-get-own-property-descriptor": _req3,
          "../internals/task": _req4,
          "../internals/engine-is-ios": _req5,
          "../internals/engine-is-ios-pebble": _req6,
          "../internals/engine-is-webos-webkit": _req7,
          "../internals/engine-is-node": _req8
        }, _require);

        (function () {
          var global = require('../internals/global');

          var bind = require('../internals/function-bind-context');

          var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;

          var macrotask = require('../internals/task').set;

          var IS_IOS = require('../internals/engine-is-ios');

          var IS_IOS_PEBBLE = require('../internals/engine-is-ios-pebble');

          var IS_WEBOS_WEBKIT = require('../internals/engine-is-webos-webkit');

          var IS_NODE = require('../internals/engine-is-node');

          var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
          var document = global.document;
          var process = global.process;
          var Promise = global.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`

          var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
          var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
          var flush, head, last, notify, toggle, node, promise, then; // modern engines have queueMicrotask method

          if (!queueMicrotask) {
            flush = function flush() {
              var parent, fn;
              if (IS_NODE && (parent = process.domain)) parent.exit();

              while (head) {
                fn = head.fn;
                head = head.next;

                try {
                  fn();
                } catch (error) {
                  if (head) notify();else last = undefined;
                  throw error;
                }
              }

              last = undefined;
              if (parent) parent.enter();
            }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
            // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898


            if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
              toggle = true;
              node = document.createTextNode('');
              new MutationObserver(flush).observe(node, {
                characterData: true
              });

              notify = function notify() {
                node.data = toggle = !toggle;
              }; // environments with maybe non-completely correct, but existent Promise

            } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
              // Promise.resolve without an argument throws an error in LG WebOS 2
              promise = Promise.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug

              promise.constructor = Promise;
              then = bind(promise.then, promise);

              notify = function notify() {
                then(flush);
              }; // Node.js without promises

            } else if (IS_NODE) {
              notify = function notify() {
                process.nextTick(flush);
              }; // for other environments - macrotask based on:
              // - setImmediate
              // - MessageChannel
              // - window.postMessag
              // - onreadystatechange
              // - setTimeout

            } else {
              // strange IE + webpack dev server bug - use .bind(global)
              macrotask = bind(macrotask, global);

              notify = function notify() {
                macrotask(flush);
              };
            }
          }

          module.exports = queueMicrotask || function (fn) {
            var task = {
              fn: fn,
              next: undefined
            };
            if (last) last.next = task;

            if (!head) {
              head = task;
              notify();
            }

            last = task;
          };
        })();

        _export("default", _cjsExports = module.exports);
      });

      _export("__cjsMetaURL", __cjsMetaURL = _context.meta.url);
    }
  };
});
//# sourceMappingURL=microtask.js.map