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

  var _req, _req2, _req3, _req4, _req5, _req6, _req7, _req8, _req9, _req10, _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) {
      _req9 = _unresolved_9.__cjsMetaURL;
    }, function (_unresolved_10) {
      _req10 = _unresolved_10.__cjsMetaURL;
    }, function (_unresolved_11) {
      _loader = _unresolved_11.default;
    }],
    execute: function () {
      _loader.define(_context.meta.url, function (exports, _require, module, __filename, __dirname) {
        let require = _loader.createRequireWithReqMap({
          "../internals/global": _req,
          "../internals/function-uncurry-this": _req2,
          "../internals/fails": _req3,
          "../internals/a-callable": _req4,
          "../internals/array-sort": _req5,
          "../internals/array-buffer-view-core": _req6,
          "../internals/engine-ff-version": _req7,
          "../internals/engine-is-ie-or-edge": _req8,
          "../internals/engine-v8-version": _req9,
          "../internals/engine-webkit-version": _req10
        }, _require);

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

          var uncurryThis = require('../internals/function-uncurry-this');

          var fails = require('../internals/fails');

          var aCallable = require('../internals/a-callable');

          var internalSort = require('../internals/array-sort');

          var ArrayBufferViewCore = require('../internals/array-buffer-view-core');

          var FF = require('../internals/engine-ff-version');

          var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');

          var V8 = require('../internals/engine-v8-version');

          var WEBKIT = require('../internals/engine-webkit-version');

          var Array = global.Array;
          var aTypedArray = ArrayBufferViewCore.aTypedArray;
          var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
          var Uint16Array = global.Uint16Array;
          var un$Sort = Uint16Array && uncurryThis(Uint16Array.prototype.sort); // WebKit

          var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails(function () {
            un$Sort(new Uint16Array(2), null);
          }) && fails(function () {
            un$Sort(new Uint16Array(2), {});
          }));
          var STABLE_SORT = !!un$Sort && !fails(function () {
            // feature detection can be too slow, so check engines versions
            if (V8) return V8 < 74;
            if (FF) return FF < 67;
            if (IE_OR_EDGE) return true;
            if (WEBKIT) return WEBKIT < 602;
            var array = new Uint16Array(516);
            var expected = Array(516);
            var index, mod;

            for (index = 0; index < 516; index++) {
              mod = index % 4;
              array[index] = 515 - index;
              expected[index] = index - 2 * mod + 3;
            }

            un$Sort(array, function (a, b) {
              return (a / 4 | 0) - (b / 4 | 0);
            });

            for (index = 0; index < 516; index++) {
              if (array[index] !== expected[index]) return true;
            }
          });

          var getSortCompare = function (comparefn) {
            return function (x, y) {
              if (comparefn !== undefined) return +comparefn(x, y) || 0; // eslint-disable-next-line no-self-compare -- NaN check

              if (y !== y) return -1; // eslint-disable-next-line no-self-compare -- NaN check

              if (x !== x) return 1;
              if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
              return x > y;
            };
          }; // `%TypedArray%.prototype.sort` method
          // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort


          exportTypedArrayMethod('sort', function sort(comparefn) {
            if (comparefn !== undefined) aCallable(comparefn);
            if (STABLE_SORT) return un$Sort(this, comparefn);
            return internalSort(aTypedArray(this), getSortCompare(comparefn));
          }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
        })();

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

      _export("__cjsMetaURL", __cjsMetaURL = _context.meta.url);
    }
  };
});
//# sourceMappingURL=es.typed-array.sort.js.map