'use strict';var regexpExecAbstract=require('./regexp-exec-abstract-9fcb71e6.js'),normalizeComponent=require('./normalize-component-a3a558e7.js'),wellKnownSymbol=require('./well-known-symbol-f1447879.js');var fixRegExpWellKnownSymbolLogic = regexpExecAbstract.f;
var anObject = normalizeComponent.a;
var toLength = wellKnownSymbol.a;
var requireObjectCoercible = wellKnownSymbol.r;
var advanceStringIndex = regexpExecAbstract.a;
var regExpExec = regexpExecAbstract.r;

// @@match logic
fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  return [
    // `String.prototype.match` method
    // https://tc39.es/ecma262/#sec-string.prototype.match
    function match(regexp) {
      var O = requireObjectCoercible(this);
      var matcher = regexp == undefined ? undefined : regexp[MATCH];
      return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
    },
    // `RegExp.prototype[@@match]` method
    // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
    function (regexp) {
      var res = maybeCallNative(nativeMatch, regexp, this);
      if (res.done) return res.value;

      var rx = anObject(regexp);
      var S = String(this);

      if (!rx.global) return regExpExec(rx, S);

      var fullUnicode = rx.unicode;
      rx.lastIndex = 0;
      var A = [];
      var n = 0;
      var result;
      while ((result = regExpExec(rx, S)) !== null) {
        var matchStr = String(result[0]);
        A[n] = matchStr;
        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
        n++;
      }
      return n === 0 ? null : A;
    }
  ];
});