UNPKG

verificator

Version:

Client and server-side validation JavaScript library

5,911 lines 214 kB
/**
* verificator v1.0.0-beta.7
* (c) 2018 Nikita Stenin
* @license MIT
*/
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
    typeof define === 'function' && define.amd ? define(['exports'], factory) :
    (factory((global.Verificator = {})));
}(this, (function (exports) { 'use strict';

    var prefix = '@@verificator';
    var SET_DATA = prefix + '/SET_DATA';
    var SET_RULES = prefix + '/SET_RULES';
    var START_VALIDATE = prefix + '/START_VALIDATE';
    var STOP_VALIDATE = prefix + '/STOP_VALIDATE';
    var ADD_ERROR = prefix + '/ADD_ERROR';
    var REMOVE_ERROR = prefix + '/REMOVE_ERROR';
    var CLEAR_ERRORS = prefix + '/CLEAR_ERRORS';

    var isObjectLike = function isObjectLike(value) {
        return typeof value === 'object' && value !== null;
    };

    var toString = function toString(value) {
        return Object.prototype.toString.call(value);
    };
    var isPlainObject = function isPlainObject(value) {
        if (!isObjectLike(value) || toString(value) !== '[object Object]') {
            return false;
        }
        if (Object.getPrototypeOf(value) === null) {
            return true;
        }
        var proto = value;
        while (Object.getPrototypeOf(proto) !== null) {
            proto = Object.getPrototypeOf(proto);
        }
        return Object.getPrototypeOf(value) === proto;
    };

    var DEPENDENT_RULES = ['required_with', 'required_with_all', 'required_without', 'required_without_all', 'required_if', 'required_unless', 'confirmed', 'same', 'different', 'before', 'after', 'before_or_equal', 'after_or_equal'];
    var DEFAULT_LOCALE = {
        messages: {},
        attributes: {}
    };
    var REGEXP_IS_UINT = /^(?:0|[1-9]\d*)$/;
    var URL_PROTOCOLS = ['aaa', 'aaas', 'about', 'acap', 'acct', 'acr', 'adiumxtra', 'afp', 'afs', 'aim', 'apt', 'attachment', 'aw', 'barion', 'beshare', 'bitcoin', 'blob', 'bolo', 'callto', 'cap', 'chrome', 'chrome-extension', 'cid', 'coap', 'coaps', 'com-eventbrite-attendee', 'content', 'crid', 'cvs', 'data', 'dav', 'dict', 'dlna-playcontainer', 'dlna-playsingle', 'dns', 'dntp', 'dtn', 'dvb', 'ed2k', 'example', 'facetime', 'fax', 'feed', 'feedready', 'file', 'filesystem', 'finger', 'fish', 'ftp', 'geo', 'gg', 'git', 'gizmoproject', 'go', 'gopher', 'gtalk', 'h323', 'ham', 'hcp', 'http', 'https', 'iax', 'icap', 'icon', 'im', 'imap', 'info', 'iotdisco', 'ipn', 'ipp', 'ipps', 'irc', 'irc6', 'ircs', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'itms', 'jabber', 'jar', 'jms', 'keyparc', 'lastfm', 'ldap', 'ldaps', 'magnet', 'mailserver', 'mailto', 'maps', 'market', 'message', 'mid', 'mms', 'modem', 'ms-help', 'ms-settings', 'ms-settings-airplanemode', 'ms-settings-bluetooth', 'ms-settings-camera', 'ms-settings-cellular', 'ms-settings-cloudstorage', 'ms-settings-emailandaccounts', 'ms-settings-language', 'ms-settings-location', 'ms-settings-lock', 'ms-settings-nfctransactions', 'ms-settings-notifications', 'ms-settings-power', 'ms-settings-privacy', 'ms-settings-proximity', 'ms-settings-screenrotation', 'ms-settings-wifi', 'ms-settings-workplace', 'msnim', 'msrp', 'msrps', 'mtqp', 'mumble', 'mupdate', 'mvn', 'news', 'nfs', 'ni', 'nih', 'nntp', 'notes', 'oid', 'opaquelocktoken', 'pack', 'palm', 'paparazzi', 'pkcs11', 'platform', 'pop', 'pres', 'prospero', 'proxy', 'psyc', 'query', 'redis', 'rediss', 'reload', 'res', 'resource', 'rmi', 'rsync', 'rtmfp', 'rtmp', 'rtsp', 'rtsps', 'rtspu', 'secondlife', 'service', 'session', 'sftp', 'sgn', 'shttp', 'sieve', 'sip', 'sips', 'skype', 'smb', 'sms', 'smtp', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'soldat', 'spotify', 'ssh', 'steam', 'stun', 'stuns', 'submit', 'svn', 'tag', 'teamspeak', 'tel', 'teliaeid', 'telnet', 'tftp', 'things', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'udp', 'unreal', 'urn', 'ut2004', 'vemmi', 'ventrilo', 'videotex', 'view-source', 'wais', 'webcal', 'ws', 'wss', 'wtai', 'wyciwyg', 'xcon', 'xcon-userid', 'xfire', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'xri', 'ymsgr', 'z39.50', 'z39.50r', 'z39.50s'];
    var ALPHA = {
        en: /^[A-Z]*$/i,
        cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,
        da: /^[A-ZÆØÅ]*$/i,
        de: /^[A-ZÄÖÜß]*$/i,
        es: /^[A-ZÁÉÍÑÓÚÜ]*$/i,
        fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,
        lt: /^[A-ZĄČĘĖĮŠŲŪŽ]*$/i,
        nl: /^[A-ZÉËÏÓÖÜ]*$/i,
        hu: /^[A-ZÁÉÍÓÖŐÚÜŰ]*$/i,
        pl: /^[A-ZĄĆĘŚŁŃÓŻŹ]*$/i,
        pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,
        ru: /^[А-ЯЁ]*$/i,
        sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,
        sr: /^[A-ZČĆŽŠĐ]*$/i,
        tr: /^[A-ZÇĞİıÖŞÜ]*$/i,
        uk: /^[А-ЩЬЮЯЄІЇҐ]*$/i,
        ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/
    };
    var ALPHA_NUMERIC = {
        en: /^[0-9A-Z]*$/i,
        cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,
        da: /^[0-9A-ZÆØÅ]$/i,
        de: /^[0-9A-ZÄÖÜß]*$/i,
        es: /^[0-9A-ZÁÉÍÑÓÚÜ]*$/i,
        fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,
        lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ]*$/i,
        hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]*$/i,
        nl: /^[0-9A-ZÉËÏÓÖÜ]*$/i,
        pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]*$/i,
        pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,
        ru: /^[0-9А-ЯЁ]*$/i,
        sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,
        sr: /^[0-9A-ZČĆŽŠĐ]*$/i,
        tr: /^[0-9A-ZÇĞİıÖŞÜ]*$/i,
        uk: /^[0-9А-ЩЬЮЯЄІЇҐ]*$/i,
        ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/
    };
    var ALPHA_DASH = {
        en: /^[0-9A-Z_-]*$/i,
        cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ_-]*$/i,
        da: /^[0-9A-ZÆØÅ_-]*$/i,
        de: /^[0-9A-ZÄÖÜß_-]*$/i,
        es: /^[0-9A-ZÁÉÍÑÓÚÜ_-]*$/i,
        fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ_-]*$/i,
        lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ_-]*$/i,
        nl: /^[0-9A-ZÉËÏÓÖÜ_-]*$/i,
        hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ_-]*$/i,
        pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ_-]*$/i,
        pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ_-]*$/i,
        ru: /^[0-9А-ЯЁ_-]*$/i,
        sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ_-]*$/i,
        sr: /^[0-9A-ZČĆŽŠĐ_-]*$/i,
        tr: /^[0-9A-ZÇĞİıÖŞÜ_-]*$/i,
        uk: /^[0-9А-ЩЬЮЯЄІЇҐ_-]*$/i,
        ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ_-]*$/
    };

    var isObject = function isObject(value) {
        var type = typeof value;
        return value != null && (type === 'object' || type === 'function');
    };

    var set = function set(object, keyPath, value) {
        var path = keyPath.split('.');
        var length = path.length;
        var lastIndex = length - 1;
        var index = -1;
        var nested = object;
        while (nested != null && ++index < length) {
            var key = path[index];
            var newValue = value;
            if (index !== lastIndex) {
                var objValue = nested[key];
                newValue = isObject(objValue) ? objValue : REGEXP_IS_UINT.test(path[index + 1]) ? [] : {};
            }
            nested[key] = newValue;
            nested = nested[key];
        }
        return object;
    };

    var normalizeData = function normalizeData(data) {
        if (!isPlainObject(data) && !Array.isArray(data)) {
            return data;
        }
        var newData = void 0;
        if (Array.isArray(data)) {
            newData = data.map(normalizeData);
        } else {
            newData = {};
            Object.keys(data).forEach(function (key) {
                set(newData, key, normalizeData(data[key]));
            });
        }
        return newData;
    };
    var setData = function setData(data) {
        return {
            type: SET_DATA,
            payload: { data: normalizeData(data) }
        };
    };

    var addError = function addError(key, message) {
        return {
            type: ADD_ERROR,
            payload: { key: key, message: message }
        };
    };
    var removeError = function removeError(key) {
        return {
            type: REMOVE_ERROR,
            payload: { key: key }
        };
    };
    var clearErrors = function clearErrors() {
        return {
            type: CLEAR_ERRORS
        };
    };

    var get = function get(object, key, defaultValue) {
        if (object == null) {
            return defaultValue;
        }
        var path = key.split('.');
        var index = 0;
        var length = path.length;
        while (object != null && index < length) {
            object = object[path[index++]];
        }
        var result = index && index === length ? object : undefined;
        return result === undefined ? defaultValue : result;
    };

    var parseParameters = function parseParameters(rule, parameter) {
        if (Array.isArray(parameter)) {
            return parameter;
        }
        if (rule.toLowerCase() === 'regex') {
            return [parameter];
        }
        return parameter.split(',');
    };
    var parseRule = function parseRule(rule) {
        if (Array.isArray(rule)) {
            return {
                name: rule[0].trim(),
                parameters: rule.slice(1)
            };
        }
        var name = rule.indexOf(':') > -1 ? rule.substr(0, rule.indexOf(':')) : rule;
        var parameter = rule.indexOf(':') > -1 ? rule.substr(rule.indexOf(':') + 1) : [];
        var parameters = parseParameters(name, parameter);
        return {
            name: name.trim(),
            parameters: parameters
        };
    };
    var parseRules = function parseRules(rules) {
        if (typeof rules === 'string') {
            rules = rules.split('|');
        }
        return rules.filter(function (rule) {
            return (Array.isArray(rule) || typeof rule === 'string') && rule.length;
        }).map(parseRule);
    };
    var setRules = function setRules(data, initialRules) {
        var _rules = {};
        var _attributes = {};
        function explodeRules(attribute, rule) {
            if (attribute.indexOf('*') > -1) {
                var path = attribute.substr(0, attribute.indexOf('*') - 1);
                var value = get(data, path);
                if (value) {
                    if (Array.isArray(value)) {
                        value.forEach(function (v, i) {
                            explodeRules(attribute.replace('*', String(i)), rule);
                        });
                    } else if (isPlainObject(value)) {
                        Object.keys(value).forEach(function (key) {
                            explodeRules(attribute.replace('*', key), rule);
                        });
                    }
                }
            } else {
                var name = rule[0],
                    rules = rule[1];

                _rules[attribute] = parseRules(rules);
                if (name.indexOf('*') > -1) {
                    _attributes[name] = _attributes[name] || [];
                    _attributes[name].push(attribute);
                }
            }
        }
        Object.keys(initialRules).forEach(function (attribute) {
            explodeRules(attribute, [attribute, initialRules[attribute]]);
        });
        return {
            type: SET_RULES,
            payload: {
                initialRules: initialRules,
                rules: _rules,
                implicitAttributes: _attributes
            }
        };
    };

    var startValidate = function startValidate(attribute) {
        return {
            type: START_VALIDATE,
            payload: { attribute: attribute }
        };
    };
    var stopValidate = function stopValidate(attribute) {
        return {
            type: STOP_VALIDATE,
            payload: { attribute: attribute }
        };
    };

    var validate = function validate(attribute, value, parameters, validator) {
        if (value == null) {
            return false;
        } else if (typeof value === 'string' && value.trim() === '') {
            return false;
        } else if (Array.isArray(value) && value.length < 1) {
            return false;
        }
        return true;
    };

    var validate$1 = function validate$$1(attribute, value, parameters, validator) {
        var acceptable = ['yes', 'on', '1', 1, true, 'true'];
        return validate(attribute, value, parameters, validator) && acceptable.indexOf(value) > -1;
    };

    function requireParameterCount(count, parameters, rule) {
        if (parameters.length < count) {
            throw new Error("Validation rule " + rule + " requires at least " + count + " parameters.");
        }
    }

    function unwrapExports (x) {
    	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
    }

    function createCommonjsModule(fn, module) {
    	return module = { exports: {} }, fn(module, module.exports), module.exports;
    }

    var toDate_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = toDate;
      var MILLISECONDS_IN_HOUR = 3600000;
      var MILLISECONDS_IN_MINUTE = 60000;
      var DEFAULT_ADDITIONAL_DIGITS = 2;

      var patterns = {
        dateTimeDelimeter: /[T ]/,
        plainTime: /:/,

        // year tokens
        YY: /^(\d{2})$/,
        YYY: [/^([+-]\d{2})$/, // 0 additional digits
        /^([+-]\d{3})$/, // 1 additional digit
        /^([+-]\d{4})$/ // 2 additional digits
        ],
        YYYY: /^(\d{4})/,
        YYYYY: [/^([+-]\d{4})/, // 0 additional digits
        /^([+-]\d{5})/, // 1 additional digit
        /^([+-]\d{6})/ // 2 additional digits
        ],

        // date tokens
        MM: /^-(\d{2})$/,
        DDD: /^-?(\d{3})$/,
        MMDD: /^-?(\d{2})-?(\d{2})$/,
        Www: /^-?W(\d{2})$/,
        WwwD: /^-?W(\d{2})-?(\d{1})$/,

        HH: /^(\d{2}([.,]\d*)?)$/,
        HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
        HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,

        // timezone tokens
        timezone: /([Z+-].*)$/,
        timezoneZ: /^(Z)$/,
        timezoneHH: /^([+-])(\d{2})$/,
        timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
      };

      /**
       * @name toDate
       * @category Common Helpers
       * @summary Convert the given argument to an instance of Date.
       *
       * @description
       * Convert the given argument to an instance of Date.
       *
       * If the argument is an instance of Date, the function returns its clone.
       *
       * If the argument is a number, it is treated as a timestamp.
       *
       * If an argument is a string, the function tries to parse it.
       * Function accepts complete ISO 8601 formats as well as partial implementations.
       * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
       *
       * If the argument is null, it is treated as an invalid date.
       *
       * If all above fails, the function passes the given argument to Date constructor.
       *
       * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
       * All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.
       *
       * @param {*} argument - the value to convert
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
       * @returns {Date} the parsed date in the local time zone
       * @throws {TypeError} 1 argument required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // Convert string '2014-02-11T11:30:30' to date:
       * var result = toDate('2014-02-11T11:30:30')
       * //=> Tue Feb 11 2014 11:30:30
       *
       * @example
       * // Convert string '+02014101' to date,
       * // if the additional number of digits in the extended year format is 1:
       * var result = toDate('+02014101', {additionalDigits: 1})
       * //=> Fri Apr 11 2014 00:00:00
       */
      function toDate(argument, dirtyOptions) {
        if (arguments.length < 1) {
          throw new TypeError('1 argument required, but only ' + arguments.length + ' present');
        }

        if (argument === null) {
          return new Date(NaN);
        }

        var options = dirtyOptions || {};

        var additionalDigits = options.additionalDigits === undefined ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits);
        if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
          throw new RangeError('additionalDigits must be 0, 1 or 2');
        }

        // Clone the date
        if (argument instanceof Date) {
          // Prevent the date to lose the milliseconds when passed to new Date() in IE10
          return new Date(argument.getTime());
        } else if (typeof argument !== 'string') {
          return new Date(argument);
        }

        var dateStrings = splitDateString(argument);

        var parseYearResult = parseYear(dateStrings.date, additionalDigits);
        var year = parseYearResult.year;
        var restDateString = parseYearResult.restDateString;

        var date = parseDate(restDateString, year);

        if (date) {
          var timestamp = date.getTime();
          var time = 0;
          var offset;

          if (dateStrings.time) {
            time = parseTime(dateStrings.time);
          }

          if (dateStrings.timezone) {
            offset = parseTimezone(dateStrings.timezone);
          } else {
            // get offset accurate to hour in timezones that change offset
            offset = new Date(timestamp + time).getTimezoneOffset();
            offset = new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset();
          }

          return new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE);
        } else {
          return new Date(argument);
        }
      }

      function splitDateString(dateString) {
        var dateStrings = {};
        var array = dateString.split(patterns.dateTimeDelimeter);
        var timeString;

        if (patterns.plainTime.test(array[0])) {
          dateStrings.date = null;
          timeString = array[0];
        } else {
          dateStrings.date = array[0];
          timeString = array[1];
        }

        if (timeString) {
          var token = patterns.timezone.exec(timeString);
          if (token) {
            dateStrings.time = timeString.replace(token[1], '');
            dateStrings.timezone = token[1];
          } else {
            dateStrings.time = timeString;
          }
        }

        return dateStrings;
      }

      function parseYear(dateString, additionalDigits) {
        var patternYYY = patterns.YYY[additionalDigits];
        var patternYYYYY = patterns.YYYYY[additionalDigits];

        var token;

        // YYYY or ±YYYYY
        token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);
        if (token) {
          var yearString = token[1];
          return {
            year: parseInt(yearString, 10),
            restDateString: dateString.slice(yearString.length)
          };
        }

        // YY or ±YYY
        token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);
        if (token) {
          var centuryString = token[1];
          return {
            year: parseInt(centuryString, 10) * 100,
            restDateString: dateString.slice(centuryString.length)
          };
        }

        // Invalid ISO-formatted year
        return {
          year: null
        };
      }

      function parseDate(dateString, year) {
        // Invalid ISO-formatted year
        if (year === null) {
          return null;
        }

        var token;
        var date;
        var month;
        var week;

        // YYYY
        if (dateString.length === 0) {
          date = new Date(0);
          date.setUTCFullYear(year);
          return date;
        }

        // YYYY-MM
        token = patterns.MM.exec(dateString);
        if (token) {
          date = new Date(0);
          month = parseInt(token[1], 10) - 1;
          date.setUTCFullYear(year, month);
          return date;
        }

        // YYYY-DDD or YYYYDDD
        token = patterns.DDD.exec(dateString);
        if (token) {
          date = new Date(0);
          var dayOfYear = parseInt(token[1], 10);
          date.setUTCFullYear(year, 0, dayOfYear);
          return date;
        }

        // YYYY-MM-DD or YYYYMMDD
        token = patterns.MMDD.exec(dateString);
        if (token) {
          date = new Date(0);
          month = parseInt(token[1], 10) - 1;
          var day = parseInt(token[2], 10);
          date.setUTCFullYear(year, month, day);
          return date;
        }

        // YYYY-Www or YYYYWww
        token = patterns.Www.exec(dateString);
        if (token) {
          week = parseInt(token[1], 10) - 1;
          return dayOfISOYear(year, week);
        }

        // YYYY-Www-D or YYYYWwwD
        token = patterns.WwwD.exec(dateString);
        if (token) {
          week = parseInt(token[1], 10) - 1;
          var dayOfWeek = parseInt(token[2], 10) - 1;
          return dayOfISOYear(year, week, dayOfWeek);
        }

        // Invalid ISO-formatted date
        return null;
      }

      function parseTime(timeString) {
        var token;
        var hours;
        var minutes;

        // hh
        token = patterns.HH.exec(timeString);
        if (token) {
          hours = parseFloat(token[1].replace(',', '.'));
          return hours % 24 * MILLISECONDS_IN_HOUR;
        }

        // hh:mm or hhmm
        token = patterns.HHMM.exec(timeString);
        if (token) {
          hours = parseInt(token[1], 10);
          minutes = parseFloat(token[2].replace(',', '.'));
          return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;
        }

        // hh:mm:ss or hhmmss
        token = patterns.HHMMSS.exec(timeString);
        if (token) {
          hours = parseInt(token[1], 10);
          minutes = parseInt(token[2], 10);
          var seconds = parseFloat(token[3].replace(',', '.'));
          return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000;
        }

        // Invalid ISO-formatted time
        return null;
      }

      function parseTimezone(timezoneString) {
        var token;
        var absoluteOffset;

        // Z
        token = patterns.timezoneZ.exec(timezoneString);
        if (token) {
          return 0;
        }

        // ±hh
        token = patterns.timezoneHH.exec(timezoneString);
        if (token) {
          absoluteOffset = parseInt(token[2], 10) * 60;
          return token[1] === '+' ? -absoluteOffset : absoluteOffset;
        }

        // ±hh:mm or ±hhmm
        token = patterns.timezoneHHMM.exec(timezoneString);
        if (token) {
          absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10);
          return token[1] === '+' ? -absoluteOffset : absoluteOffset;
        }

        return 0;
      }

      function dayOfISOYear(isoYear, week, day) {
        week = week || 0;
        day = day || 0;
        var date = new Date(0);
        date.setUTCFullYear(isoYear, 0, 4);
        var fourthOfJanuaryDay = date.getUTCDay() || 7;
        var diff = week * 7 + day + 1 - fourthOfJanuaryDay;
        date.setUTCDate(date.getUTCDate() + diff);
        return date;
      }
      module.exports = exports['default'];
    });

    var toDate = unwrapExports(toDate_1);

    var addMilliseconds_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = addMilliseconds;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /**
       * @name addMilliseconds
       * @category Millisecond Helpers
       * @summary Add the specified number of milliseconds to the given date.
       *
       * @description
       * Add the specified number of milliseconds to the given date.
       *
       * @param {Date|String|Number} date - the date to be changed
       * @param {Number} amount - the amount of milliseconds to be added
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @returns {Date} the new date with the milliseconds added
       * @throws {TypeError} 2 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
       * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
       * //=> Thu Jul 10 2014 12:45:30.750
       */
      function addMilliseconds(dirtyDate, dirtyAmount, dirtyOptions) {
        if (arguments.length < 2) {
          throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
        }

        var timestamp = (0, _index2['default'])(dirtyDate, dirtyOptions).getTime();
        var amount = Number(dirtyAmount);
        return new Date(timestamp + amount);
      }
      module.exports = exports['default'];
    });

    unwrapExports(addMilliseconds_1);

    var addMinutes_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = addMinutes;

      var _index2 = _interopRequireDefault(addMilliseconds_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var MILLISECONDS_IN_MINUTE = 60000;

      /**
       * @name addMinutes
       * @category Minute Helpers
       * @summary Add the specified number of minutes to the given date.
       *
       * @description
       * Add the specified number of minutes to the given date.
       *
       * @param {Date|String|Number} date - the date to be changed
       * @param {Number} amount - the amount of minutes to be added
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @returns {Date} the new date with the minutes added
       * @throws {TypeError} 2 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // Add 30 minutes to 10 July 2014 12:00:00:
       * var result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
       * //=> Thu Jul 10 2014 12:30:00
       */
      function addMinutes(dirtyDate, dirtyAmount, dirtyOptions) {
        if (arguments.length < 2) {
          throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
        }

        var amount = Number(dirtyAmount);
        return (0, _index2['default'])(dirtyDate, amount * MILLISECONDS_IN_MINUTE, dirtyOptions);
      }
      module.exports = exports['default'];
    });

    unwrapExports(addMinutes_1);

    var subMinutes_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = subMinutes;

      var _index2 = _interopRequireDefault(addMinutes_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /**
       * @name subMinutes
       * @category Minute Helpers
       * @summary Subtract the specified number of minutes from the given date.
       *
       * @description
       * Subtract the specified number of minutes from the given date.
       *
       * @param {Date|String|Number} date - the date to be changed
       * @param {Number} amount - the amount of minutes to be subtracted
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @returns {Date} the new date with the mintues subtracted
       * @throws {TypeError} 2 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // Subtract 30 minutes from 10 July 2014 12:00:00:
       * var result = subMinutes(new Date(2014, 6, 10, 12, 0), 30)
       * //=> Thu Jul 10 2014 11:30:00
       */
      function subMinutes(dirtyDate, dirtyAmount, dirtyOptions) {
        if (arguments.length < 2) {
          throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
        }

        var amount = Number(dirtyAmount);
        return (0, _index2['default'])(dirtyDate, -amount, dirtyOptions);
      }
      module.exports = exports['default'];
    });

    unwrapExports(subMinutes_1);

    var formatDistance_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = formatDistance;
      var formatDistanceLocale = {
        lessThanXSeconds: {
          one: 'less than a second',
          other: 'less than {{count}} seconds'
        },

        xSeconds: {
          one: '1 second',
          other: '{{count}} seconds'
        },

        halfAMinute: 'half a minute',

        lessThanXMinutes: {
          one: 'less than a minute',
          other: 'less than {{count}} minutes'
        },

        xMinutes: {
          one: '1 minute',
          other: '{{count}} minutes'
        },

        aboutXHours: {
          one: 'about 1 hour',
          other: 'about {{count}} hours'
        },

        xHours: {
          one: '1 hour',
          other: '{{count}} hours'
        },

        xDays: {
          one: '1 day',
          other: '{{count}} days'
        },

        aboutXMonths: {
          one: 'about 1 month',
          other: 'about {{count}} months'
        },

        xMonths: {
          one: '1 month',
          other: '{{count}} months'
        },

        aboutXYears: {
          one: 'about 1 year',
          other: 'about {{count}} years'
        },

        xYears: {
          one: '1 year',
          other: '{{count}} years'
        },

        overXYears: {
          one: 'over 1 year',
          other: 'over {{count}} years'
        },

        almostXYears: {
          one: 'almost 1 year',
          other: 'almost {{count}} years'
        }
      };

      function formatDistance(token, count, options) {
        options = options || {};

        var result;
        if (typeof formatDistanceLocale[token] === 'string') {
          result = formatDistanceLocale[token];
        } else if (count === 1) {
          result = formatDistanceLocale[token].one;
        } else {
          result = formatDistanceLocale[token].other.replace('{{count}}', count);
        }

        if (options.addSuffix) {
          if (options.comparison > 0) {
            return 'in ' + result;
          } else {
            return result + ' ago';
          }
        }

        return result;
      }
      module.exports = exports['default'];
    });

    unwrapExports(formatDistance_1);

    var buildFormatLongFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildFormatLongFn;
      var tokensToBeShortedPattern = /MMMM|MM|DD|dddd/g;

      function buildShortLongFormat(format) {
        return format.replace(tokensToBeShortedPattern, function (token) {
          return token.slice(1);
        });
      }

      /**
       * @name buildFormatLongFn
       * @category Locale Helpers
       * @summary Build `formatLong` property for locale used by `format`, `formatRelative` and `parse` functions.
       *
       * @description
       * Build `formatLong` property for locale used by `format`, `formatRelative` and `parse` functions.
       * Returns a function which takes one of the following tokens as the argument:
       * `'LTS'`, `'LT'`, `'L'`, `'LL'`, `'LLL'`, `'l'`, `'ll'`, `'lll'`, `'llll'`
       * and returns a long format string written as `format` token strings.
       * See [format]{@link https://date-fns.org/docs/format}
       *
       * `'l'`, `'ll'`, `'lll'` and `'llll'` formats are built automatically
       * by shortening some of the tokens from corresponding unshortened formats
       * (e.g., if `LL` is `'MMMM DD YYYY'` then `ll` will be `MMM D YYYY`)
       *
       * @param {Object} obj - the object with long formats written as `format` token strings
       * @param {String} obj.LT - time format: hours and minutes
       * @param {String} obj.LTS - time format: hours, minutes and seconds
       * @param {String} obj.L - short date format: numeric day, month and year
       * @param {String} [obj.l] - short date format: numeric day, month and year (shortened)
       * @param {String} obj.LL - long date format: day, month in words, and year
       * @param {String} [obj.ll] - long date format: day, month in words, and year (shortened)
       * @param {String} obj.LLL - long date and time format
       * @param {String} [obj.lll] - long date and time format (shortened)
       * @param {String} obj.LLLL - long date, time and weekday format
       * @param {String} [obj.llll] - long date, time and weekday format (shortened)
       * @returns {Function} `formatLong` property of the locale
       *
       * @example
       * // For `en-US` locale:
       * locale.formatLong = buildFormatLongFn({
       *   LT: 'h:mm aa',
       *   LTS: 'h:mm:ss aa',
       *   L: 'MM/DD/YYYY',
       *   LL: 'MMMM D YYYY',
       *   LLL: 'MMMM D YYYY h:mm aa',
       *   LLLL: 'dddd, MMMM D YYYY h:mm aa'
       * })
       */
      function buildFormatLongFn(obj) {
        var formatLongLocale = {
          LTS: obj.LTS,
          LT: obj.LT,
          L: obj.L,
          LL: obj.LL,
          LLL: obj.LLL,
          LLLL: obj.LLLL,
          l: obj.l || buildShortLongFormat(obj.L),
          ll: obj.ll || buildShortLongFormat(obj.LL),
          lll: obj.lll || buildShortLongFormat(obj.LLL),
          llll: obj.llll || buildShortLongFormat(obj.LLLL)
        };

        return function (token) {
          return formatLongLocale[token];
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildFormatLongFn_1);

    var formatLong_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(buildFormatLongFn_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var formatLong = (0, _index2['default'])({
        LT: 'h:mm aa',
        LTS: 'h:mm:ss aa',
        L: 'MM/DD/YYYY',
        LL: 'MMMM D YYYY',
        LLL: 'MMMM D YYYY h:mm aa',
        LLLL: 'dddd, MMMM D YYYY h:mm aa'
      });

      exports['default'] = formatLong;
      module.exports = exports['default'];
    });

    unwrapExports(formatLong_1);

    var formatRelative_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = formatRelative;
      var formatRelativeLocale = {
        lastWeek: '[last] dddd [at] LT',
        yesterday: '[yesterday at] LT',
        today: '[today at] LT',
        tomorrow: '[tomorrow at] LT',
        nextWeek: 'dddd [at] LT',
        other: 'L'
      };

      function formatRelative(token, date, baseDate, options) {
        return formatRelativeLocale[token];
      }
      module.exports = exports['default'];
    });

    unwrapExports(formatRelative_1);

    var buildLocalizeFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildLocalizeFn;
      /**
       * @name buildLocalizeFn
       * @category Locale Helpers
       * @summary Build `localize.weekday`, `localize.month` and `localize.timeOfDay` properties for the locale.
       *
       * @description
       * Build `localize.weekday`, `localize.month` and `localize.timeOfDay` properties for the locale
       * used by `format` function.
       * If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
       *
       * `localize.weekday` function takes the weekday index as argument (0 - Sunday).
       * `localize.month` takes the month index (0 - January).
       * `localize.timeOfDay` takes the hours. Use `indexCallback` to convert them to an array index (see example).
       *
       * @param {Object} values - the object with arrays of values
       * @param {String} defaultType - the default type for the localize function
       * @param {Function} [indexCallback] - the callback which takes the resulting function argument
       *   and converts it into value array index
       * @returns {Function} the resulting function
       *
       * @example
       * var timeOfDayValues = {
       *   uppercase: ['AM', 'PM'],
       *   lowercase: ['am', 'pm'],
       *   long: ['a.m.', 'p.m.']
       * }
       * locale.localize.timeOfDay = buildLocalizeFn(timeOfDayValues, 'long', function (hours) {
       *   // 0 is a.m. array index, 1 is p.m. array index
       *   return (hours / 12) >= 1 ? 1 : 0
       * })
       * locale.localize.timeOfDay(16, {type: 'uppercase'}) //=> 'PM'
       * locale.localize.timeOfDay(5) //=> 'a.m.'
       */
      function buildLocalizeFn(values, defaultType, indexCallback) {
        return function (dirtyIndex, dirtyOptions) {
          var options = dirtyOptions || {};
          var type = options.type ? String(options.type) : defaultType;
          var valuesArray = values[type] || values[defaultType];
          var index = indexCallback ? indexCallback(Number(dirtyIndex)) : Number(dirtyIndex);
          return valuesArray[index];
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildLocalizeFn_1);

    var buildLocalizeArrayFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildLocalizeArrayFn;
      /**
       * @name buildLocalizeArrayFn
       * @category Locale Helpers
       * @summary Build `localize.weekdays`, `localize.months` and `localize.timesOfDay` properties for the locale.
       *
       * @description
       * Build `localize.weekdays`, `localize.months` and `localize.timesOfDay` properties for the locale.
       * If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
       *
       * @param {Object} values - the object with arrays of values
       * @param {String} defaultType - the default type for the localize function
       * @returns {Function} the resulting function
       *
       * @example
       * var weekdayValues = {
       *   narrow: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
       *   short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
       *   long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
       * }
       * locale.localize.weekdays = buildLocalizeArrayFn(weekdayValues, 'long')
       * locale.localize.weekdays({type: 'narrow'}) //=> ['Su', 'Mo', ...]
       * locale.localize.weekdays() //=> ['Sunday', 'Monday', ...]
       */
      function buildLocalizeArrayFn(values, defaultType) {
        return function (dirtyOptions) {
          var options = dirtyOptions || {};
          var type = options.type ? String(options.type) : defaultType;
          return values[type] || values[defaultType];
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildLocalizeArrayFn_1);

    var localize_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(buildLocalizeFn_1);

      var _index4 = _interopRequireDefault(buildLocalizeArrayFn_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // Note: in English, the names of days of the week and months are capitalized.
      // If you are making a new locale based on this one, check if the same is true for the language you're working on.
      // Generally, formatted dates should look like they are in the middle of a sentence,
      // e.g. in Spanish language the weekdays and months should be in the lowercase.
      var weekdayValues = {
        narrow: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
        short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
        long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
      };

      var monthValues = {
        short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        long: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      };

      // `timeOfDay` is used to designate which part of the day it is, when used with 12-hour clock.
      // Use the system which is used the most commonly in the locale.
      // For example, if the country doesn't use a.m./p.m., you can use `night`/`morning`/`afternoon`/`evening`:
      //
      //   var timeOfDayValues = {
      //     any: ['in the night', 'in the morning', 'in the afternoon', 'in the evening']
      //   }
      //
      // And later:
      //
      //   var localize = {
      //     // The callback takes the hours as the argument and returns the array index
      //     timeOfDay: buildLocalizeFn(timeOfDayValues, 'any', function (hours) {
      //       if (hours >= 17) {
      //         return 3
      //       } else if (hours >= 12) {
      //         return 2
      //       } else if (hours >= 4) {
      //         return 1
      //       } else {
      //         return 0
      //       }
      //     }),
      //     timesOfDay: buildLocalizeArrayFn(timeOfDayValues, 'any')
      //   }
      var timeOfDayValues = {
        uppercase: ['AM', 'PM'],
        lowercase: ['am', 'pm'],
        long: ['a.m.', 'p.m.']
      };

      function ordinalNumber(dirtyNumber, dirtyOptions) {
        var number = Number(dirtyNumber);

        // If ordinal numbers depend on context, for example,
        // if they are different for different grammatical genders,
        // use `options.unit`:
        //
        //   var options = dirtyOptions || {}
        //   var unit = String(options.unit)
        //
        // where `unit` can be 'month', 'quarter', 'week', 'isoWeek', 'dayOfYear',
        // 'dayOfMonth' or 'dayOfWeek'

        var rem100 = number % 100;
        if (rem100 > 20 || rem100 < 10) {
          switch (rem100 % 10) {
            case 1:
              return number + 'st';
            case 2:
              return number + 'nd';
            case 3:
              return number + 'rd';
          }
        }
        return number + 'th';
      }

      var localize = {
        ordinalNumber: ordinalNumber,
        weekday: (0, _index2['default'])(weekdayValues, 'long'),
        weekdays: (0, _index4['default'])(weekdayValues, 'long'),
        month: (0, _index2['default'])(monthValues, 'long'),
        months: (0, _index4['default'])(monthValues, 'long'),
        timeOfDay: (0, _index2['default'])(timeOfDayValues, 'long', function (hours) {
          return hours / 12 >= 1 ? 1 : 0;
        }),
        timesOfDay: (0, _index4['default'])(timeOfDayValues, 'long')
      };

      exports['default'] = localize;
      module.exports = exports['default'];
    });

    unwrapExports(localize_1);

    var buildMatchFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildMatchFn;
      /**
       * @name buildMatchFn
       * @category Locale Helpers
       * @summary Build `match.weekdays`, `match.months` and `match.timesOfDay` properties for the locale.
       *
       * @description
       * Build `match.weekdays`, `match.months` and `match.timesOfDay` properties for the locale used by `parse` function.
       * If no `type` is supplied to the options of the resulting function, `defaultType` will be used (see example).
       * The result of the match function will be passed into corresponding parser function
       * (`match.weekday`, `match.month` or `match.timeOfDay` respectively. See `buildParseFn`).
       *
       * @param {Object} values - the object with RegExps
       * @param {String} defaultType - the default type for the match function
       * @returns {Function} the resulting function
       *
       * @example
       * var matchWeekdaysPatterns = {
       *   narrow: /^(su|mo|tu|we|th|fr|sa)/i,
       *   short: /^(sun|mon|tue|wed|thu|fri|sat)/i,
       *   long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
       * }
       * locale.match.weekdays = buildMatchFn(matchWeekdaysPatterns, 'long')
       * locale.match.weekdays('Sunday', {type: 'narrow'}) //=> ['Su', 'Su', ...]
       * locale.match.weekdays('Sunday') //=> ['Sunday', 'Sunday', ...]
       */
      function buildMatchFn(patterns, defaultType) {
        return function (dirtyString, dirtyOptions) {
          var options = dirtyOptions || {};
          var type = options.type ? String(options.type) : defaultType;
          var pattern = patterns[type] || patterns[defaultType];
          var string = String(dirtyString);
          return string.match(pattern);
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildMatchFn_1);

    var buildParseFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildParseFn;
      /**
       * @name buildParseFn
       * @category Locale Helpers
       * @summary Build `match.weekday`, `match.month` and `match.timeOfDay` properties for the locale.
       *
       * @description
       * Build `match.weekday`, `match.month` and `match.timeOfDay` properties for the locale used by `parse` function.
       * The argument of the resulting function is the result of the corresponding match function
       * (`match.weekdays`, `match.months` or `match.timesOfDay` respectively. See `buildMatchFn`).
       *
       * @param {Object} values - the object with arrays of RegExps
       * @param {String} defaultType - the default type for the parser function
       * @returns {Function} the resulting function
       *
       * @example
       * var parseWeekdayPatterns = {
       *   any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
       * }
       * locale.match.weekday = buildParseFn(matchWeekdaysPatterns, 'long')
       * var matchResult = locale.match.weekdays('Friday')
       * locale.match.weekday(matchResult) //=> 5
       */
      function buildParseFn(patterns, defaultType) {
        return function (matchResult, dirtyOptions) {
          var options = dirtyOptions || {};
          var type = options.type ? String(options.type) : defaultType;
          var patternsArray = patterns[type] || patterns[defaultType];
          var string = matchResult[1];

          return patternsArray.findIndex(function (pattern) {
            return pattern.test(string);
          });
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildParseFn_1);

    var buildMatchPatternFn_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = buildMatchPatternFn;
      /**
       * @name buildMatchPatternFn
       * @category Locale Helpers
       * @summary Build match function from a single RegExp.
       *
       * @description
       * Build match function from a single RegExp.
       * Usually used for building `match.ordinalNumbers` property of the locale.
       *
       * @param {Object} pattern - the RegExp
       * @returns {Function} the resulting function
       *
       * @example
       * locale.match.ordinalNumbers = buildMatchPatternFn(/^(\d+)(th|st|nd|rd)?/i)
       * locale.match.ordinalNumbers('3rd') //=> ['3rd', '3', 'rd', ...]
       */
      function buildMatchPatternFn(pattern) {
        return function (dirtyString) {
          var string = String(dirtyString);
          return string.match(pattern);
        };
      }
      module.exports = exports["default"];
    });

    unwrapExports(buildMatchPatternFn_1);

    var parseDecimal_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = parseDecimal;
      /**
       * @name parseDecimal
       * @category Locale Helpers
       * @summary Parses the match result into decimal number.
       *
       * @description
       * Parses the match result into decimal number.
       * Uses the string matched with the first set of parentheses of match RegExp.
       *
       * @param {Array} matchResult - the object returned by matching function
       * @returns {Number} the parsed value
       *
       * @example
       * locale.match = {
       *   ordinalNumbers: (dirtyString) {
       *     return String(dirtyString).match(/^(\d+)(th|st|nd|rd)?/i)
       *   },
       *   ordinalNumber: parseDecimal
       * }
       */
      function parseDecimal(matchResult) {
        return parseInt(matchResult[1], 10);
      }
      module.exports = exports["default"];
    });

    unwrapExports(parseDecimal_1);

    var match_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(buildMatchFn_1);

      var _index4 = _interopRequireDefault(buildParseFn_1);

      var _index6 = _interopRequireDefault(buildMatchPatternFn_1);

      var _index8 = _interopRequireDefault(parseDecimal_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var matchOrdinalNumbersPattern = /^(\d+)(th|st|nd|rd)?/i;

      var matchWeekdaysPatterns = {
        narrow: /^(su|mo|tu|we|th|fr|sa)/i,
        short: /^(sun|mon|tue|wed|thu|fri|sat)/i,
        long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
      };

      var parseWeekdayPatterns = {
        any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
      };

      var matchMonthsPatterns = {
        short: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
        long: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
      };

      var parseMonthPatterns = {
        any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
      };

      // `timeOfDay` is used to designate which part of the day it is, when used with 12-hour clock.
      // Use the system which is used the most commonly in the locale.
      // For example, if the country doesn't use a.m./p.m., you can use `night`/`morning`/`afternoon`/`evening`:
      //
      //   var matchTimesOfDayPatterns = {
      //     long: /^((in the)? (night|morning|afternoon|evening?))/i
      //   }
      //
      //   var parseTimeOfDayPatterns = {
      //     any: [/(night|morning)/i, /(afternoon|evening)/i]
      //   }
      var matchTimesOfDayPatterns = {
        short: /^(am|pm)/i,
        long: /^([ap]\.?\s?m\.?)/i
      };

      var parseTimeOfDayPatterns = {
        any: [/^a/i, /^p/i]
      };

      var match = {
        ordinalNumbers: (0, _index6['default'])(matchOrdinalNumbersPattern),
        ordinalNumber: _index8['default'],
        weekdays: (0, _index2['default'])(matchWeekdaysPatterns, 'long'),
        weekday: (0, _index4['default'])(parseWeekdayPatterns, 'any'),
        months: (0, _index2['default'])(matchMonthsPatterns, 'long'),
        month: (0, _index4['default'])(parseMonthPatterns, 'any'),
        timesOfDay: (0, _index2['default'])(matchTimesOfDayPatterns, 'long'),
        timeOfDay: (0, _index4['default'])(parseTimeOfDayPatterns, 'any')
      };

      exports['default'] = match;
      module.exports = exports['default'];
    });

    unwrapExports(match_1);

    var enUS = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(formatDistance_1);

      var _index4 = _interopRequireDefault(formatLong_1);

      var _index6 = _interopRequireDefault(formatRelative_1);

      var _index8 = _interopRequireDefault(localize_1);

      var _index10 = _interopRequireDefault(match_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /**
       * @type {Locale}
       * @category Locales
       * @summary English locale (United States).
       * @language English
       * @iso-639-2 eng
       */
      var locale = {
        formatDistance: _index2['default'],
        formatLong: _index4['default'],
        formatRelative: _index6['default'],
        localize: _index8['default'],
        match: _index10['default'],
        options: {
          weekStartsOn: 0 /* Sunday */
          , firstWeekContainsDate: 1
        }
      };

      exports['default'] = locale;
      module.exports = exports['default'];
    });

    unwrapExports(enUS);

    var parsers_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      var patterns = {
        'M': /^(1[0-2]|0?\d)/, // 0 to 12
        'D': /^(3[0-1]|[0-2]?\d)/, // 0 to 31
        'DDD': /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, // 0 to 366
        'W': /^(5[0-3]|[0-4]?\d)/, // 0 to 53
        'YYYY': /^(\d{1,4})/, // 0 to 9999
        'H': /^(2[0-3]|[0-1]?\d)/, // 0 to 23
        'm': /^([0-5]?\d)/, // 0 to 59
        'Z': /^([+-])(\d{2}):(\d{2})/,
        'ZZ': /^([+-])(\d{2})(\d{2})/,
        singleDigit: /^(\d)/,
        twoDigits: /^(\d{2})/,
        threeDigits: /^(\d{3})/,
        fourDigits: /^(\d{4})/,
        anyDigits: /^(\d+)/
      };

      function parseDecimal(matchResult) {
        return parseInt(matchResult[1], 10);
      }

      var parsers = {
        // Year: 00, 01, ..., 99
        'YY': {
          unit: 'twoDigitYear',
          match: patterns.twoDigits,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult);
          }
        },

        // Year: 1900, 1901, ..., 2099
        'YYYY': {
          unit: 'year',
          match: patterns.YYYY,
          parse: parseDecimal
        },

        // ISO week-numbering year: 00, 01, ..., 99
        'GG': {
          unit: 'isoYear',
          match: patterns.twoDigits,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) + 1900;
          }
        },

        // ISO week-numbering year: 1900, 1901, ..., 2099
        'GGGG': {
          unit: 'isoYear',
          match: patterns.YYYY,
          parse: parseDecimal
        },

        // Quarter: 1, 2, 3, 4
        'Q': {
          unit: 'quarter',
          match: patterns.singleDigit,
          parse: parseDecimal
        },

        // Ordinal quarter
        'Qo': {
          unit: 'quarter',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'quarter' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'quarter' });
          }
        },

        // Month: 1, 2, ..., 12
        'M': {
          unit: 'month',
          match: patterns.M,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) - 1;
          }
        },

        // Ordinal month
        'Mo': {
          unit: 'month',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'month' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'month' }) - 1;
          }
        },

        // Month: 01, 02, ..., 12
        'MM': {
          unit: 'month',
          match: patterns.twoDigits,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) - 1;
          }
        },

        // Month: Jan, Feb, ..., Dec
        'MMM': {
          unit: 'month',
          match: function match(string, options) {
            return options.locale.match.months(string, { type: 'short' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.month(matchResult, { type: 'short' });
          }
        },

        // Month: January, February, ..., December
        'MMMM': {
          unit: 'month',
          match: function match(string, options) {
            return options.locale.match.months(string, { type: 'long' }) || options.locale.match.months(string, { type: 'short' });
          },
          parse: function parse(matchResult, options) {
            var parseResult = options.locale.match.month(matchResult, { type: 'long' });

            if (parseResult == null) {
              parseResult = options.locale.match.month(matchResult, { type: 'short' });
            }

            return parseResult;
          }
        },

        // ISO week: 1, 2, ..., 53
        'W': {
          unit: 'isoWeek',
          match: patterns.W,
          parse: parseDecimal
        },

        // Ordinal ISO week
        'Wo': {
          unit: 'isoWeek',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'isoWeek' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'isoWeek' });
          }
        },

        // ISO week: 01, 02, ..., 53
        'WW': {
          unit: 'isoWeek',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // Day of week: 0, 1, ..., 6
        'd': {
          unit: 'dayOfWeek',
          match: patterns.singleDigit,
          parse: parseDecimal
        },

        // Ordinal day of week
        'do': {
          unit: 'dayOfWeek',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'dayOfWeek' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'dayOfWeek' });
          }
        },

        // Day of week: Su, Mo, ..., Sa
        'dd': {
          unit: 'dayOfWeek',
          match: function match(string, options) {
            return options.locale.match.weekdays(string, { type: 'narrow' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.weekday(matchResult, { type: 'narrow' });
          }
        },

        // Day of week: Sun, Mon, ..., Sat
        'ddd': {
          unit: 'dayOfWeek',
          match: function match(string, options) {
            return options.locale.match.weekdays(string, { type: 'short' }) || options.locale.match.weekdays(string, { type: 'narrow' });
          },
          parse: function parse(matchResult, options) {
            var parseResult = options.locale.match.weekday(matchResult, { type: 'short' });

            if (parseResult == null) {
              parseResult = options.locale.match.weekday(matchResult, { type: 'narrow' });
            }

            return parseResult;
          }
        },

        // Day of week: Sunday, Monday, ..., Saturday
        'dddd': {
          unit: 'dayOfWeek',
          match: function match(string, options) {
            return options.locale.match.weekdays(string, { type: 'long' }) || options.locale.match.weekdays(string, { type: 'short' }) || options.locale.match.weekdays(string, { type: 'narrow' });
          },
          parse: function parse(matchResult, options) {
            var parseResult = options.locale.match.weekday(matchResult, { type: 'long' });

            if (parseResult == null) {
              parseResult = options.locale.match.weekday(matchResult, { type: 'short' });

              if (parseResult == null) {
                parseResult = options.locale.match.weekday(matchResult, { type: 'narrow' });
              }
            }

            return parseResult;
          }
        },

        // Day of ISO week: 1, 2, ..., 7
        'E': {
          unit: 'dayOfISOWeek',
          match: patterns.singleDigit,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult);
          }
        },

        // Day of month: 1, 2, ..., 31
        'D': {
          unit: 'dayOfMonth',
          match: patterns.D,
          parse: parseDecimal
        },

        // Ordinal day of month
        'Do': {
          unit: 'dayOfMonth',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'dayOfMonth' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'dayOfMonth' });
          }
        },

        // Day of month: 01, 02, ..., 31
        'DD': {
          unit: 'dayOfMonth',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // Day of year: 1, 2, ..., 366
        'DDD': {
          unit: 'dayOfYear',
          match: patterns.DDD,
          parse: parseDecimal
        },

        // Ordinal day of year
        'DDDo': {
          unit: 'dayOfYear',
          match: function match(string, options) {
            return options.locale.match.ordinalNumbers(string, { unit: 'dayOfYear' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.ordinalNumber(matchResult, { unit: 'dayOfYear' });
          }
        },

        // Day of year: 001, 002, ..., 366
        'DDDD': {
          unit: 'dayOfYear',
          match: patterns.threeDigits,
          parse: parseDecimal
        },

        // AM, PM
        'A': {
          unit: 'timeOfDay',
          match: function match(string, options) {
            return options.locale.match.timesOfDay(string, { type: 'short' });
          },
          parse: function parse(matchResult, options) {
            return options.locale.match.timeOfDay(matchResult, { type: 'short' });
          }
        },

        // a.m., p.m.
        'aa': {
          unit: 'timeOfDay',
          match: function match(string, options) {
            return options.locale.match.timesOfDay(string, { type: 'long' }) || options.locale.match.timesOfDay(string, { type: 'short' });
          },
          parse: function parse(matchResult, options) {
            var parseResult = options.locale.match.timeOfDay(matchResult, { type: 'long' });

            if (parseResult == null) {
              parseResult = options.locale.match.timeOfDay(matchResult, { type: 'short' });
            }

            return parseResult;
          }
        },

        // Hour: 0, 1, ... 23
        'H': {
          unit: 'hours',
          match: patterns.H,
          parse: parseDecimal
        },

        // Hour: 00, 01, ..., 23
        'HH': {
          unit: 'hours',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // Hour: 1, 2, ..., 12
        'h': {
          unit: 'timeOfDayHours',
          match: patterns.M,
          parse: parseDecimal
        },

        // Hour: 01, 02, ..., 12
        'hh': {
          unit: 'timeOfDayHours',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // Minute: 0, 1, ..., 59
        'm': {
          unit: 'minutes',
          match: patterns.m,
          parse: parseDecimal
        },

        // Minute: 00, 01, ..., 59
        'mm': {
          unit: 'minutes',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // Second: 0, 1, ..., 59
        's': {
          unit: 'seconds',
          match: patterns.m,
          parse: parseDecimal
        },

        // Second: 00, 01, ..., 59
        'ss': {
          unit: 'seconds',
          match: patterns.twoDigits,
          parse: parseDecimal
        },

        // 1/10 of second: 0, 1, ..., 9
        'S': {
          unit: 'milliseconds',
          match: patterns.singleDigit,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) * 100;
          }
        },

        // 1/100 of second: 00, 01, ..., 99
        'SS': {
          unit: 'milliseconds',
          match: patterns.twoDigits,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) * 10;
          }
        },

        // Millisecond: 000, 001, ..., 999
        'SSS': {
          unit: 'milliseconds',
          match: patterns.threeDigits,
          parse: parseDecimal
        },

        // Timezone: -01:00, +00:00, ... +12:00
        'Z': {
          unit: 'timezone',
          match: patterns.Z,
          parse: function parse(matchResult) {
            var sign = matchResult[1];
            var hours = parseInt(matchResult[2], 10);
            var minutes = parseInt(matchResult[3], 10);
            var absoluteOffset = hours * 60 + minutes;
            return sign === '+' ? absoluteOffset : -absoluteOffset;
          }
        },

        // Timezone: -0100, +0000, ... +1200
        'ZZ': {
          unit: 'timezone',
          match: patterns.ZZ,
          parse: function parse(matchResult) {
            var sign = matchResult[1];
            var hours = parseInt(matchResult[2], 10);
            var minutes = parseInt(matchResult[3], 10);
            var absoluteOffset = hours * 60 + minutes;
            return sign === '+' ? absoluteOffset : -absoluteOffset;
          }
        },

        // Seconds timestamp: 512969520
        'X': {
          unit: 'timestamp',
          match: patterns.anyDigits,
          parse: function parse(matchResult) {
            return parseDecimal(matchResult) * 1000;
          }
        },

        // Milliseconds timestamp: 512969520900
        'x': {
          unit: 'timestamp',
          match: patterns.anyDigits,
          parse: parseDecimal
        }
      };

      parsers['a'] = parsers['A'];

      exports['default'] = parsers;
      module.exports = exports['default'];
    });

    unwrapExports(parsers_1);

    var setUTCDay_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = setUTCDay;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {
        var options = dirtyOptions || {};
        var locale = options.locale;
        var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
        var defaultWeekStartsOn = localeWeekStartsOn === undefined ? 0 : Number(localeWeekStartsOn);
        var weekStartsOn = options.weekStartsOn === undefined ? defaultWeekStartsOn : Number(options.weekStartsOn);

        // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
        if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
          throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
        }

        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var day = Number(dirtyDay);

        var currentDay = date.getUTCDay();

        var remainder = day % 7;
        var dayIndex = (remainder + 7) % 7;

        var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;

        date.setUTCDate(date.getUTCDate() + diff);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(setUTCDay_1);

    var setUTCISODay_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = setUTCISODay;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function setUTCISODay(dirtyDate, dirtyDay, dirtyOptions) {
        var day = Number(dirtyDay);

        if (day % 7 === 0) {
          day = day - 7;
        }

        var weekStartsOn = 1;
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var currentDay = date.getUTCDay();

        var remainder = day % 7;
        var dayIndex = (remainder + 7) % 7;

        var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;

        date.setUTCDate(date.getUTCDate() + diff);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(setUTCISODay_1);

    var startOfUTCISOWeek_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = startOfUTCISOWeek;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function startOfUTCISOWeek(dirtyDate, dirtyOptions) {
        var weekStartsOn = 1;

        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var day = date.getUTCDay();
        var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;

        date.setUTCDate(date.getUTCDate() - diff);
        date.setUTCHours(0, 0, 0, 0);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(startOfUTCISOWeek_1);

    var getUTCISOWeekYear_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = getUTCISOWeekYear;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(startOfUTCISOWeek_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function getUTCISOWeekYear(dirtyDate, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var year = date.getUTCFullYear();

        var fourthOfJanuaryOfNextYear = new Date(0);
        fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
        fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
        var startOfNextYear = (0, _index4['default'])(fourthOfJanuaryOfNextYear, dirtyOptions);

        var fourthOfJanuaryOfThisYear = new Date(0);
        fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
        fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
        var startOfThisYear = (0, _index4['default'])(fourthOfJanuaryOfThisYear, dirtyOptions);

        if (date.getTime() >= startOfNextYear.getTime()) {
          return year + 1;
        } else if (date.getTime() >= startOfThisYear.getTime()) {
          return year;
        } else {
          return year - 1;
        }
      }
      module.exports = exports['default'];
    });

    unwrapExports(getUTCISOWeekYear_1);

    var startOfUTCISOWeekYear_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = startOfUTCISOWeekYear;

      var _index2 = _interopRequireDefault(getUTCISOWeekYear_1);

      var _index4 = _interopRequireDefault(startOfUTCISOWeek_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function startOfUTCISOWeekYear(dirtyDate, dirtyOptions) {
        var year = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var fourthOfJanuary = new Date(0);
        fourthOfJanuary.setUTCFullYear(year, 0, 4);
        fourthOfJanuary.setUTCHours(0, 0, 0, 0);
        var date = (0, _index4['default'])(fourthOfJanuary, dirtyOptions);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(startOfUTCISOWeekYear_1);

    var getUTCISOWeek_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = getUTCISOWeek;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(startOfUTCISOWeek_1);

      var _index6 = _interopRequireDefault(startOfUTCISOWeekYear_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var MILLISECONDS_IN_WEEK = 604800000;

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function getUTCISOWeek(dirtyDate, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var diff = (0, _index4['default'])(date, dirtyOptions).getTime() - (0, _index6['default'])(date, dirtyOptions).getTime();

        // Round the number of days to the nearest integer
        // because the number of milliseconds in a week is not constant
        // (e.g. it's different in the week of the daylight saving time clock shift)
        return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
      }
      module.exports = exports['default'];
    });

    unwrapExports(getUTCISOWeek_1);

    var setUTCISOWeek_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = setUTCISOWeek;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(getUTCISOWeek_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function setUTCISOWeek(dirtyDate, dirtyISOWeek, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var isoWeek = Number(dirtyISOWeek);
        var diff = (0, _index4['default'])(date, dirtyOptions) - isoWeek;
        date.setUTCDate(date.getUTCDate() - diff * 7);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(setUTCISOWeek_1);

    var setUTCISOWeekYear_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = setUTCISOWeekYear;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(startOfUTCISOWeekYear_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var MILLISECONDS_IN_DAY = 86400000;

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function setUTCISOWeekYear(dirtyDate, dirtyISOYear, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var isoYear = Number(dirtyISOYear);
        var dateStartOfYear = (0, _index4['default'])(date, dirtyOptions);
        var diff = Math.floor((date.getTime() - dateStartOfYear.getTime()) / MILLISECONDS_IN_DAY);
        var fourthOfJanuary = new Date(0);
        fourthOfJanuary.setUTCFullYear(isoYear, 0, 4);
        fourthOfJanuary.setUTCHours(0, 0, 0, 0);
        date = (0, _index4['default'])(fourthOfJanuary, dirtyOptions);
        date.setUTCDate(date.getUTCDate() + diff);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(setUTCISOWeekYear_1);

    var units_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(setUTCDay_1);

      var _index4 = _interopRequireDefault(setUTCISODay_1);

      var _index6 = _interopRequireDefault(setUTCISOWeek_1);

      var _index8 = _interopRequireDefault(setUTCISOWeekYear_1);

      var _index10 = _interopRequireDefault(startOfUTCISOWeek_1);

      var _index12 = _interopRequireDefault(startOfUTCISOWeekYear_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var MILLISECONDS_IN_MINUTE = 60000;

      function setTimeOfDay(hours, timeOfDay) {
        var isAM = timeOfDay === 0;

        if (isAM) {
          if (hours === 12) {
            return 0;
          }
        } else {
          if (hours !== 12) {
            return 12 + hours;
          }
        }

        return hours;
      }

      var units = {
        twoDigitYear: {
          priority: 10,
          set: function set(dateValues, value) {
            var century = Math.floor(dateValues.date.getUTCFullYear() / 100);
            var year = century * 100 + value;
            dateValues.date.setUTCFullYear(year, 0, 1);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        year: {
          priority: 10,
          set: function set(dateValues, value) {
            dateValues.date.setUTCFullYear(value, 0, 1);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        isoYear: {
          priority: 10,
          set: function set(dateValues, value, options) {
            dateValues.date = (0, _index12['default'])((0, _index8['default'])(dateValues.date, value, options), options);
            return dateValues;
          }
        },

        quarter: {
          priority: 20,
          set: function set(dateValues, value) {
            dateValues.date.setUTCMonth((value - 1) * 3, 1);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        month: {
          priority: 30,
          set: function set(dateValues, value) {
            dateValues.date.setUTCMonth(value, 1);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        isoWeek: {
          priority: 40,
          set: function set(dateValues, value, options) {
            dateValues.date = (0, _index10['default'])((0, _index6['default'])(dateValues.date, value, options), options);
            return dateValues;
          }
        },

        dayOfWeek: {
          priority: 50,
          set: function set(dateValues, value, options) {
            dateValues.date = (0, _index2['default'])(dateValues.date, value, options);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        dayOfISOWeek: {
          priority: 50,
          set: function set(dateValues, value, options) {
            dateValues.date = (0, _index4['default'])(dateValues.date, value, options);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        dayOfMonth: {
          priority: 50,
          set: function set(dateValues, value) {
            dateValues.date.setUTCDate(value);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        dayOfYear: {
          priority: 50,
          set: function set(dateValues, value) {
            dateValues.date.setUTCMonth(0, value);
            dateValues.date.setUTCHours(0, 0, 0, 0);
            return dateValues;
          }
        },

        timeOfDay: {
          priority: 60,
          set: function set(dateValues, value, options) {
            dateValues.timeOfDay = value;
            return dateValues;
          }
        },

        hours: {
          priority: 70,
          set: function set(dateValues, value, options) {
            dateValues.date.setUTCHours(value, 0, 0, 0);
            return dateValues;
          }
        },

        timeOfDayHours: {
          priority: 70,
          set: function set(dateValues, value, options) {
            var timeOfDay = dateValues.timeOfDay;
            if (timeOfDay != null) {
              value = setTimeOfDay(value, timeOfDay);
            }
            dateValues.date.setUTCHours(value, 0, 0, 0);
            return dateValues;
          }
        },

        minutes: {
          priority: 80,
          set: function set(dateValues, value) {
            dateValues.date.setUTCMinutes(value, 0, 0);
            return dateValues;
          }
        },

        seconds: {
          priority: 90,
          set: function set(dateValues, value) {
            dateValues.date.setUTCSeconds(value, 0);
            return dateValues;
          }
        },

        milliseconds: {
          priority: 100,
          set: function set(dateValues, value) {
            dateValues.date.setUTCMilliseconds(value);
            return dateValues;
          }
        },

        timezone: {
          priority: 110,
          set: function set(dateValues, value) {
            dateValues.date = new Date(dateValues.date.getTime() - value * MILLISECONDS_IN_MINUTE);
            return dateValues;
          }
        },

        timestamp: {
          priority: 120,
          set: function set(dateValues, value) {
            dateValues.date = new Date(value);
            return dateValues;
          }
        }
      };

      exports['default'] = units;
      module.exports = exports['default'];
    });

    unwrapExports(units_1);

    var cloneObject_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports["default"] = cloneObject;
      function cloneObject(dirtyObject) {
        dirtyObject = dirtyObject || {};
        var object = {};

        for (var property in dirtyObject) {
          if (dirtyObject.hasOwnProperty(property)) {
            object[property] = dirtyObject[property];
          }
        }

        return object;
      }
      module.exports = exports["default"];
    });

    unwrapExports(cloneObject_1);

    var parse_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = parse;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(subMinutes_1);

      var _index6 = _interopRequireDefault(enUS);

      var _index8 = _interopRequireDefault(parsers_1);

      var _index10 = _interopRequireDefault(units_1);

      var _index12 = _interopRequireDefault(cloneObject_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var TIMEZONE_UNIT_PRIORITY = 110;
      var MILLISECONDS_IN_MINUTE = 60000;

      var longFormattingTokensRegExp = /(\[[^[]*])|(\\)?(LTS|LT|LLLL|LLL|LL|L|llll|lll|ll|l)/g;
      var defaultParsingTokensRegExp = /(\[[^[]*])|(\\)?(x|ss|s|mm|m|hh|h|do|dddd|ddd|dd|d|aa|a|ZZ|Z|YYYY|YY|X|Wo|WW|W|SSS|SS|S|Qo|Q|Mo|MMMM|MMM|MM|M|HH|H|GGGG|GG|E|Do|DDDo|DDDD|DDD|DD|D|A|.)/g;

      /**
       * @name parse
       * @category Common Helpers
       * @summary Parse the date.
       *
       * @description
       * Return the date parsed from string using the given format.
       *
       * Accepted format tokens:
       * | Unit                    | Priority | Token | Input examples                   |
       * |-------------------------|----------|-------|----------------------------------|
       * | Year                    | 10       | YY    | 00, 01, ..., 99                  |
       * |                         |          | YYYY  | 1900, 1901, ..., 2099            |
       * | ISO week-numbering year | 10       | GG    | 00, 01, ..., 99                  |
       * |                         |          | GGGG  | 1900, 1901, ..., 2099            |
       * | Quarter                 | 20       | Q     | 1, 2, 3, 4                       |
       * |                         |          | Qo    | 1st, 2nd, 3rd, 4th               |
       * | Month                   | 30       | M     | 1, 2, ..., 12                    |
       * |                         |          | Mo    | 1st, 2nd, ..., 12th              |
       * |                         |          | MM    | 01, 02, ..., 12                  |
       * |                         |          | MMM   | Jan, Feb, ..., Dec               |
       * |                         |          | MMMM  | January, February, ..., December |
       * | ISO week                | 40       | W     | 1, 2, ..., 53                    |
       * |                         |          | Wo    | 1st, 2nd, ..., 53rd              |
       * |                         |          | WW    | 01, 02, ..., 53                  |
       * | Day of week             | 50       | d     | 0, 1, ..., 6                     |
       * |                         |          | do    | 0th, 1st, ..., 6th               |
       * |                         |          | dd    | Su, Mo, ..., Sa                  |
       * |                         |          | ddd   | Sun, Mon, ..., Sat               |
       * |                         |          | dddd  | Sunday, Monday, ..., Saturday    |
       * | Day of ISO week         | 50       | E     | 1, 2, ..., 7                     |
       * | Day of month            | 50       | D     | 1, 2, ..., 31                    |
       * |                         |          | Do    | 1st, 2nd, ..., 31st              |
       * |                         |          | DD    | 01, 02, ..., 31                  |
       * | Day of year             | 50       | DDD   | 1, 2, ..., 366                   |
       * |                         |          | DDDo  | 1st, 2nd, ..., 366th             |
       * |                         |          | DDDD  | 001, 002, ..., 366               |
       * | Time of day             | 60       | A     | AM, PM                           |
       * |                         |          | a     | am, pm                           |
       * |                         |          | aa    | a.m., p.m.                       |
       * | Hour                    | 70       | H     | 0, 1, ... 23                     |
       * |                         |          | HH    | 00, 01, ... 23                   |
       * | Time of day hour        | 70       | h     | 1, 2, ..., 12                    |
       * |                         |          | hh    | 01, 02, ..., 12                  |
       * | Minute                  | 80       | m     | 0, 1, ..., 59                    |
       * |                         |          | mm    | 00, 01, ..., 59                  |
       * | Second                  | 90       | s     | 0, 1, ..., 59                    |
       * |                         |          | ss    | 00, 01, ..., 59                  |
       * | 1/10 of second          | 100      | S     | 0, 1, ..., 9                     |
       * | 1/100 of second         | 100      | SS    | 00, 01, ..., 99                  |
       * | Millisecond             | 100      | SSS   | 000, 001, ..., 999               |
       * | Timezone                | 110      | Z     | -01:00, +00:00, ... +12:00       |
       * |                         |          | ZZ    | -0100, +0000, ..., +1200         |
       * | Seconds timestamp       | 120      | X     | 512969520                        |
       * | Milliseconds timestamp  | 120      | x     | 512969520900                     |
       *
       * Values will be assigned to the date in the ascending order of its unit's priority.
       * Units of an equal priority overwrite each other in the order of appearance.
       *
       * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
       * the values will be taken from 3rd argument `baseDate` which works as a context of parsing.
       *
       * `baseDate` must be passed for correct work of the function.
       * If you're not sure which `baseDate` to supply, create a new instance of Date:
       * `parse('02/11/2014', 'MM/DD/YYYY', new Date())`
       * In this case parsing will be done in the context of the current date.
       * If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`,
       * then `Invalid Date` will be returned.
       *
       * Also, `parse` unfolds long formats like those in [format]{@link https://date-fns.org/docs/format}:
       * | Token | Input examples                 |
       * |-------|--------------------------------|
       * | LT    | 05:30 a.m.                     |
       * | LTS   | 05:30:15 a.m.                  |
       * | L     | 07/02/1995                     |
       * | l     | 7/2/1995                       |
       * | LL    | July 2 1995                    |
       * | ll    | Jul 2 1995                     |
       * | LLL   | July 2 1995 05:30 a.m.         |
       * | lll   | Jul 2 1995 05:30 a.m.          |
       * | LLLL  | Sunday, July 2 1995 05:30 a.m. |
       * | llll  | Sun, Jul 2 1995 05:30 a.m.     |
       *
       * The characters wrapped in square brackets in the format string are escaped.
       *
       * The result may vary by locale.
       *
       * If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned.
       *
       * If parsing failed, `Invalid Date` will be returned.
       * Invalid Date is a Date, whose time value is NaN.
       * Time value of Date: http://es5.github.io/#x15.9.1.1
       *
       * @param {String} dateString - the string to parse
       * @param {String} formatString - the string of tokens
       * @param {Date|String|Number} baseDate - the date to took the missing higher priority values from
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
       * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
       * @returns {Date} the parsed date
       * @throws {TypeError} 3 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
       * @throws {RangeError} `options.locale` must contain `match` property
       * @throws {RangeError} `options.locale` must contain `formatLong` property
       *
       * @example
       * // Parse 11 February 2014 from middle-endian format:
       * var result = parse(
       *   '02/11/2014',
       *   'MM/DD/YYYY',
       *   new Date()
       * )
       * //=> Tue Feb 11 2014 00:00:00
       *
       * @example
       * // Parse 28th of February in English locale in the context of 2010 year:
       * import eoLocale from 'date-fns/locale/eo'
       * var result = parse(
       *   '28-a de februaro',
       *   'Do [de] MMMM',
       *   new Date(2010, 0, 1)
       *   {locale: eoLocale}
       * )
       * //=> Sun Feb 28 2010 00:00:00
       */
      function parse(dirtyDateString, dirtyFormatString, dirtyBaseDate, dirtyOptions) {
        if (arguments.length < 3) {
          throw new TypeError('3 arguments required, but only ' + arguments.length + ' present');
        }

        var dateString = String(dirtyDateString);
        var options = dirtyOptions || {};

        var weekStartsOn = options.weekStartsOn === undefined ? 0 : Number(options.weekStartsOn);

        // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
        if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
          throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
        }

        var locale = options.locale || _index6['default'];
        var localeParsers = locale.parsers || {};
        var localeUnits = locale.units || {};

        if (!locale.match) {
          throw new RangeError('locale must contain match property');
        }

        if (!locale.formatLong) {
          throw new RangeError('locale must contain formatLong property');
        }

        var formatString = String(dirtyFormatString).replace(longFormattingTokensRegExp, function (substring) {
          if (substring[0] === '[') {
            return substring;
          }

          if (substring[0] === '\\') {
            return cleanEscapedString(substring);
          }

          return locale.formatLong(substring);
        });

        if (formatString === '') {
          if (dateString === '') {
            return (0, _index2['default'])(dirtyBaseDate, options);
          } else {
            return new Date(NaN);
          }
        }

        var subFnOptions = (0, _index12['default'])(options);
        subFnOptions.locale = locale;

        var tokens = formatString.match(locale.parsingTokensRegExp || defaultParsingTokensRegExp);
        var tokensLength = tokens.length;

        // If timezone isn't specified, it will be set to the system timezone
        var setters = [{
          priority: TIMEZONE_UNIT_PRIORITY,
          set: dateToSystemTimezone,
          index: 0
        }];

        var i;
        for (i = 0; i < tokensLength; i++) {
          var token = tokens[i];
          var parser = localeParsers[token] || _index8['default'][token];
          if (parser) {
            var matchResult;

            if (parser.match instanceof RegExp) {
              matchResult = parser.match.exec(dateString);
            } else {
              matchResult = parser.match(dateString, subFnOptions);
            }

            if (!matchResult) {
              return new Date(NaN);
            }

            var unitName = parser.unit;
            var unit = localeUnits[unitName] || _index10['default'][unitName];

            setters.push({
              priority: unit.priority,
              set: unit.set,
              value: parser.parse(matchResult, subFnOptions),
              index: setters.length
            });

            var substring = matchResult[0];
            dateString = dateString.slice(substring.length);
          } else {
            var head = tokens[i].match(/^\[.*]$/) ? tokens[i].replace(/^\[|]$/g, '') : tokens[i];
            if (dateString.indexOf(head) === 0) {
              dateString = dateString.slice(head.length);
            } else {
              return new Date(NaN);
            }
          }
        }

        var uniquePrioritySetters = setters.map(function (setter) {
          return setter.priority;
        }).sort(function (a, b) {
          return a - b;
        }).filter(function (priority, index, array) {
          return array.indexOf(priority) === index;
        }).map(function (priority) {
          return setters.filter(function (setter) {
            return setter.priority === priority;
          }).reverse();
        }).map(function (setterArray) {
          return setterArray[0];
        });

        var date = (0, _index2['default'])(dirtyBaseDate, options);

        if (isNaN(date)) {
          return new Date(NaN);
        }

        // Convert the date in system timezone to the same date in UTC+00:00 timezone.
        // This ensures that when UTC functions will be implemented, locales will be compatible with them.
        // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37
        var utcDate = (0, _index4['default'])(date, date.getTimezoneOffset());

        var dateValues = { date: utcDate };

        var settersLength = uniquePrioritySetters.length;
        for (i = 0; i < settersLength; i++) {
          var setter = uniquePrioritySetters[i];
          dateValues = setter.set(dateValues, setter.value, subFnOptions);
        }

        return dateValues.date;
      }

      function dateToSystemTimezone(dateValues) {
        var date = dateValues.date;
        var time = date.getTime();

        // Get the system timezone offset at (moment of time - offset)
        var offset = date.getTimezoneOffset();

        // Get the system timezone offset at the exact moment of time
        offset = new Date(time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset();

        // Convert date in timezone "UTC+00:00" to the system timezone
        dateValues.date = new Date(time + offset * MILLISECONDS_IN_MINUTE);

        return dateValues;
      }

      function cleanEscapedString(input) {
        if (input.match(/\[[\s\S]/)) {
          return input.replace(/^\[|]$/g, '');
        }
        return input.replace(/\\/g, '');
      }
      module.exports = exports['default'];
    });

    var parseDate = unwrapExports(parse_1);

    var getDateFormat = function getDateFormat(attribute, validator) {
        var rule = validator.getRule(attribute, 'date_format');
        if (rule) {
            var _rule$parameters = rule.parameters,
                format = _rule$parameters[0];

            return typeof format === 'string' && format ? format : null;
        }
        return null;
    };

    var parseTime = function parseTime(value) {
        var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();

        if (typeof value === 'string' && /^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/.test(value)) {
            var y = String(date.getFullYear());
            var m = String(date.getMonth() + 1);
            var d = String(date.getDate());
            m = Number(m) < 10 ? '0' + m : '' + m;
            d = Number(d) < 10 ? '0' + d : '' + d;
            return new Date(y + '-' + m + '-' + d + 'T' + value);
        }
        return value;
    };

    var compare = function compare(first, second, operator) {
        switch (operator) {
            case '<':
                return first < second;
            case '>':
                return first > second;
            case '<=':
                return first <= second;
            case '>=':
                return first >= second;
            case '=':
                return first === second;
            default:
                throw new TypeError();
        }
    };

    var compareDates = function compareDates(attribute, value, _ref, operator, validator) {
        var date = _ref[0];

        if (value instanceof Date || typeof value === 'string' || typeof value === 'number') {
            var now = new Date();
            var format = getDateFormat(attribute, validator);
            date = validator.getValue(date) || date;
            var first = format ? parseDate(String(value), String(format), now) : toDate(parseTime(value, now));
            var second = format ? parseDate(String(date), String(format), now) : toDate(parseTime(date, now));
            return compare(Number(first), Number(second), operator);
        }
        return false;
    };

    var validate$2 = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'after_or_equal');
        return compareDates(attribute, value, parameters, '>=', validator);
    };

    var validate$3 = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'after');
        return compareDates(attribute, value, parameters, '>', validator);
    };

    var validate$4 = function validate(attribute, value, _ref, validator) {
        var locale = _ref[0];

        // Match at least one locale.
        if (!locale) {
            return Object.keys(ALPHA_DASH).some(function (loc) {
                return ALPHA_DASH[loc].test(value);
            });
        }
        return (ALPHA_DASH[locale] || ALPHA_DASH.en).test(value);
    };

    var validate$5 = function validate(attribute, value, _ref, validator) {
        var locale = _ref[0];

        // Match at least one locale.
        if (!locale) {
            return Object.keys(ALPHA_NUMERIC).some(function (loc) {
                return ALPHA_NUMERIC[loc].test(value);
            });
        }
        return (ALPHA_NUMERIC[locale] || ALPHA_NUMERIC.en).test(value);
    };

    var validate$6 = function validate(attribute, value, _ref, validator) {
        var locale = _ref[0];

        // Match at least one locale.
        if (!locale) {
            return Object.keys(ALPHA).some(function (loc) {
                return ALPHA[loc].test(value);
            });
        }
        return (ALPHA[locale] || ALPHA.en).test(value);
    };

    var validate$7 = function validate(attribute, value, parameters, validator) {
        return Array.isArray(value);
    };

    var validate$8 = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'before_or_equal');
        return compareDates(attribute, value, parameters, '<=', validator);
    };

    var validate$9 = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'before');
        return compareDates(attribute, value, parameters, '<', validator);
    };

    var isNumeric = function isNumeric(value) {
        var type = typeof value;
        return (type === 'number' || type === 'string') && !isNaN(Number(value) - parseFloat(String(value)));
    };

    var getSize = function getSize(attribute, value, validator) {
        var hasNumeric = validator.hasRule(attribute, ['numeric', 'integer']);
        if (isNumeric(value) && hasNumeric) {
            return Number(value);
        } else if (Array.isArray(value)) {
            return value.length;
        }
        return String(value).length;
    };

    var validate$a = function validate(attribute, value, parameters, validator) {
        requireParameterCount(2, parameters, 'between');
        var min = parameters[0],
            max = parameters[1];

        var size = getSize(attribute, value, validator);
        return size >= Number(min) && size <= Number(max);
    };

    var validate$b = function validate(attribute, value, parameters, validator) {
        var acceptable = [true, false, 0, 1, '0', '1'];
        return acceptable.indexOf(value) > -1;
    };

    var validate$c = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'same');
        var other = parameters[0];

        return value === validator.getValue(other);
    };

    var validate$d = function validate(attribute, value, parameters, validator) {
        return validate$c(attribute, value, [attribute + '_confirmation'], validator);
    };

    var validate$e = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'date_equals');
        return compareDates(attribute, value, parameters, '=', validator);
    };

    var isValid_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isValid;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /**
       * @name isValid
       * @category Common Helpers
       * @summary Is the given date valid?
       *
       * @description
       * Returns false if argument is Invalid Date and true otherwise.
       * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * Invalid Date is a Date, whose time value is NaN.
       *
       * Time value of Date: http://es5.github.io/#x15.9.1.1
       *
       * @param {*} date - the date to check
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @returns {Boolean} the date is valid
       * @throws {TypeError} 1 argument required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // For the valid date:
       * var result = isValid(new Date(2014, 1, 31))
       * //=> true
       *
       * @example
       * // For the value, convertable into a date:
       * var result = isValid('2014-02-31')
       * //=> true
       *
       * @example
       * // For the invalid date:
       * var result = isValid(new Date(''))
       * //=> false
       */
      function isValid(dirtyDate, dirtyOptions) {
        if (arguments.length < 1) {
          throw new TypeError('1 argument required, but only ' + arguments.length + ' present');
        }

        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        return !isNaN(date);
      }
      module.exports = exports['default'];
    });

    var isValid = unwrapExports(isValid_1);

    var getUTCDayOfYear_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = getUTCDayOfYear;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var MILLISECONDS_IN_DAY = 86400000;

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function getUTCDayOfYear(dirtyDate, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var timestamp = date.getTime();
        date.setUTCMonth(0, 1);
        date.setUTCHours(0, 0, 0, 0);
        var startOfYearTimestamp = date.getTime();
        var difference = timestamp - startOfYearTimestamp;
        return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
      }
      module.exports = exports['default'];
    });

    unwrapExports(getUTCDayOfYear_1);

    var formatters_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _index2 = _interopRequireDefault(getUTCDayOfYear_1);

      var _index4 = _interopRequireDefault(getUTCISOWeek_1);

      var _index6 = _interopRequireDefault(getUTCISOWeekYear_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var formatters = {
        // Month: 1, 2, ..., 12
        'M': function M(date) {
          return date.getUTCMonth() + 1;
        },

        // Month: 1st, 2nd, ..., 12th
        'Mo': function Mo(date, options) {
          var month = date.getUTCMonth() + 1;
          return options.locale.localize.ordinalNumber(month, { unit: 'month' });
        },

        // Month: 01, 02, ..., 12
        'MM': function MM(date) {
          return addLeadingZeros(date.getUTCMonth() + 1, 2);
        },

        // Month: Jan, Feb, ..., Dec
        'MMM': function MMM(date, options) {
          return options.locale.localize.month(date.getUTCMonth(), { type: 'short' });
        },

        // Month: January, February, ..., December
        'MMMM': function MMMM(date, options) {
          return options.locale.localize.month(date.getUTCMonth(), { type: 'long' });
        },

        // Quarter: 1, 2, 3, 4
        'Q': function Q(date) {
          return Math.ceil((date.getUTCMonth() + 1) / 3);
        },

        // Quarter: 1st, 2nd, 3rd, 4th
        'Qo': function Qo(date, options) {
          var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
          return options.locale.localize.ordinalNumber(quarter, { unit: 'quarter' });
        },

        // Day of month: 1, 2, ..., 31
        'D': function D(date) {
          return date.getUTCDate();
        },

        // Day of month: 1st, 2nd, ..., 31st
        'Do': function Do(date, options) {
          return options.locale.localize.ordinalNumber(date.getUTCDate(), { unit: 'dayOfMonth' });
        },

        // Day of month: 01, 02, ..., 31
        'DD': function DD(date) {
          return addLeadingZeros(date.getUTCDate(), 2);
        },

        // Day of year: 1, 2, ..., 366
        'DDD': function DDD(date) {
          return (0, _index2['default'])(date);
        },

        // Day of year: 1st, 2nd, ..., 366th
        'DDDo': function DDDo(date, options) {
          return options.locale.localize.ordinalNumber((0, _index2['default'])(date), { unit: 'dayOfYear' });
        },

        // Day of year: 001, 002, ..., 366
        'DDDD': function DDDD(date) {
          return addLeadingZeros((0, _index2['default'])(date), 3);
        },

        // Day of week: Su, Mo, ..., Sa
        'dd': function dd(date, options) {
          return options.locale.localize.weekday(date.getUTCDay(), { type: 'narrow' });
        },

        // Day of week: Sun, Mon, ..., Sat
        'ddd': function ddd(date, options) {
          return options.locale.localize.weekday(date.getUTCDay(), { type: 'short' });
        },

        // Day of week: Sunday, Monday, ..., Saturday
        'dddd': function dddd(date, options) {
          return options.locale.localize.weekday(date.getUTCDay(), { type: 'long' });
        },

        // Day of week: 0, 1, ..., 6
        'd': function d(date) {
          return date.getUTCDay();
        },

        // Day of week: 0th, 1st, 2nd, ..., 6th
        'do': function _do(date, options) {
          return options.locale.localize.ordinalNumber(date.getUTCDay(), { unit: 'dayOfWeek' });
        },

        // Day of ISO week: 1, 2, ..., 7
        'E': function E(date) {
          return date.getUTCDay() || 7;
        },

        // ISO week: 1, 2, ..., 53
        'W': function W(date) {
          return (0, _index4['default'])(date);
        },

        // ISO week: 1st, 2nd, ..., 53th
        'Wo': function Wo(date, options) {
          return options.locale.localize.ordinalNumber((0, _index4['default'])(date), { unit: 'isoWeek' });
        },

        // ISO week: 01, 02, ..., 53
        'WW': function WW(date) {
          return addLeadingZeros((0, _index4['default'])(date), 2);
        },

        // Year: 00, 01, ..., 99
        'YY': function YY(date) {
          return addLeadingZeros(date.getUTCFullYear(), 4).substr(2);
        },

        // Year: 1900, 1901, ..., 2099
        'YYYY': function YYYY(date) {
          return addLeadingZeros(date.getUTCFullYear(), 4);
        },

        // ISO week-numbering year: 00, 01, ..., 99
        'GG': function GG(date) {
          return String((0, _index6['default'])(date)).substr(2);
        },

        // ISO week-numbering year: 1900, 1901, ..., 2099
        'GGGG': function GGGG(date) {
          return (0, _index6['default'])(date);
        },

        // Hour: 0, 1, ... 23
        'H': function H(date) {
          return date.getUTCHours();
        },

        // Hour: 00, 01, ..., 23
        'HH': function HH(date) {
          return addLeadingZeros(date.getUTCHours(), 2);
        },

        // Hour: 1, 2, ..., 12
        'h': function h(date) {
          var hours = date.getUTCHours();
          if (hours === 0) {
            return 12;
          } else if (hours > 12) {
            return hours % 12;
          } else {
            return hours;
          }
        },

        // Hour: 01, 02, ..., 12
        'hh': function hh(date) {
          return addLeadingZeros(formatters['h'](date), 2);
        },

        // Minute: 0, 1, ..., 59
        'm': function m(date) {
          return date.getUTCMinutes();
        },

        // Minute: 00, 01, ..., 59
        'mm': function mm(date) {
          return addLeadingZeros(date.getUTCMinutes(), 2);
        },

        // Second: 0, 1, ..., 59
        's': function s(date) {
          return date.getUTCSeconds();
        },

        // Second: 00, 01, ..., 59
        'ss': function ss(date) {
          return addLeadingZeros(date.getUTCSeconds(), 2);
        },

        // 1/10 of second: 0, 1, ..., 9
        'S': function S(date) {
          return Math.floor(date.getUTCMilliseconds() / 100);
        },

        // 1/100 of second: 00, 01, ..., 99
        'SS': function SS(date) {
          return addLeadingZeros(Math.floor(date.getUTCMilliseconds() / 10), 2);
        },

        // Millisecond: 000, 001, ..., 999
        'SSS': function SSS(date) {
          return addLeadingZeros(date.getUTCMilliseconds(), 3);
        },

        // Timezone: -01:00, +00:00, ... +12:00
        'Z': function Z(date, options) {
          var originalDate = options._originalDate || date;
          return formatTimezone(originalDate.getTimezoneOffset(), ':');
        },

        // Timezone: -0100, +0000, ... +1200
        'ZZ': function ZZ(date, options) {
          var originalDate = options._originalDate || date;
          return formatTimezone(originalDate.getTimezoneOffset());
        },

        // Seconds timestamp: 512969520
        'X': function X(date, options) {
          var originalDate = options._originalDate || date;
          return Math.floor(originalDate.getTime() / 1000);
        },

        // Milliseconds timestamp: 512969520900
        'x': function x(date, options) {
          var originalDate = options._originalDate || date;
          return originalDate.getTime();
        },

        // AM, PM
        'A': function A(date, options) {
          return options.locale.localize.timeOfDay(date.getUTCHours(), { type: 'uppercase' });
        },

        // am, pm
        'a': function a(date, options) {
          return options.locale.localize.timeOfDay(date.getUTCHours(), { type: 'lowercase' });
        },

        // a.m., p.m.
        'aa': function aa(date, options) {
          return options.locale.localize.timeOfDay(date.getUTCHours(), { type: 'long' });
        }
      };

      function formatTimezone(offset, delimeter) {
        delimeter = delimeter || '';
        var sign = offset > 0 ? '-' : '+';
        var absOffset = Math.abs(offset);
        var hours = Math.floor(absOffset / 60);
        var minutes = absOffset % 60;
        return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2);
      }

      function addLeadingZeros(number, targetLength) {
        var output = Math.abs(number).toString();
        while (output.length < targetLength) {
          output = '0' + output;
        }
        return output;
      }

      exports['default'] = formatters;
      module.exports = exports['default'];
    });

    unwrapExports(formatters_1);

    var addUTCMinutes_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = addUTCMinutes;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      // This function will be a part of public API when UTC function will be implemented.
      // See issue: https://github.com/date-fns/date-fns/issues/376
      function addUTCMinutes(dirtyDate, dirtyAmount, dirtyOptions) {
        var date = (0, _index2['default'])(dirtyDate, dirtyOptions);
        var amount = Number(dirtyAmount);
        date.setUTCMinutes(date.getUTCMinutes() + amount);
        return date;
      }
      module.exports = exports['default'];
    });

    unwrapExports(addUTCMinutes_1);

    var format_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = format;

      var _index2 = _interopRequireDefault(toDate_1);

      var _index4 = _interopRequireDefault(isValid_1);

      var _index6 = _interopRequireDefault(enUS);

      var _index8 = _interopRequireDefault(formatters_1);

      var _index10 = _interopRequireDefault(cloneObject_1);

      var _index12 = _interopRequireDefault(addUTCMinutes_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var longFormattingTokensRegExp = /(\[[^[]*])|(\\)?(LTS|LT|LLLL|LLL|LL|L|llll|lll|ll|l)/g;
      var defaultFormattingTokensRegExp = /(\[[^[]*])|(\\)?(x|ss|s|mm|m|hh|h|do|dddd|ddd|dd|d|aa|a|ZZ|Z|YYYY|YY|X|Wo|WW|W|SSS|SS|S|Qo|Q|Mo|MMMM|MMM|MM|M|HH|H|GGGG|GG|E|Do|DDDo|DDDD|DDD|DD|D|A|.)/g;

      /**
       * @name format
       * @category Common Helpers
       * @summary Format the date.
       *
       * @description
       * Return the formatted date string in the given format.
       *
       * Accepted tokens:
       * | Unit                    | Token | Result examples                  |
       * |-------------------------|-------|----------------------------------|
       * | Month                   | M     | 1, 2, ..., 12                    |
       * |                         | Mo    | 1st, 2nd, ..., 12th              |
       * |                         | MM    | 01, 02, ..., 12                  |
       * |                         | MMM   | Jan, Feb, ..., Dec               |
       * |                         | MMMM  | January, February, ..., December |
       * | Quarter                 | Q     | 1, 2, 3, 4                       |
       * |                         | Qo    | 1st, 2nd, 3rd, 4th               |
       * | Day of month            | D     | 1, 2, ..., 31                    |
       * |                         | Do    | 1st, 2nd, ..., 31st              |
       * |                         | DD    | 01, 02, ..., 31                  |
       * | Day of year             | DDD   | 1, 2, ..., 366                   |
       * |                         | DDDo  | 1st, 2nd, ..., 366th             |
       * |                         | DDDD  | 001, 002, ..., 366               |
       * | Day of week             | d     | 0, 1, ..., 6                     |
       * |                         | do    | 0th, 1st, ..., 6th               |
       * |                         | dd    | Su, Mo, ..., Sa                  |
       * |                         | ddd   | Sun, Mon, ..., Sat               |
       * |                         | dddd  | Sunday, Monday, ..., Saturday    |
       * | Day of ISO week         | E     | 1, 2, ..., 7                     |
       * | ISO week                | W     | 1, 2, ..., 53                    |
       * |                         | Wo    | 1st, 2nd, ..., 53rd              |
       * |                         | WW    | 01, 02, ..., 53                  |
       * | Year                    | YY    | 00, 01, ..., 99                  |
       * |                         | YYYY  | 1900, 1901, ..., 2099            |
       * | ISO week-numbering year | GG    | 00, 01, ..., 99                  |
       * |                         | GGGG  | 1900, 1901, ..., 2099            |
       * | AM/PM                   | A     | AM, PM                           |
       * |                         | a     | am, pm                           |
       * |                         | aa    | a.m., p.m.                       |
       * | Hour                    | H     | 0, 1, ... 23                     |
       * |                         | HH    | 00, 01, ... 23                   |
       * |                         | h     | 1, 2, ..., 12                    |
       * |                         | hh    | 01, 02, ..., 12                  |
       * | Minute                  | m     | 0, 1, ..., 59                    |
       * |                         | mm    | 00, 01, ..., 59                  |
       * | Second                  | s     | 0, 1, ..., 59                    |
       * |                         | ss    | 00, 01, ..., 59                  |
       * | 1/10 of second          | S     | 0, 1, ..., 9                     |
       * | 1/100 of second         | SS    | 00, 01, ..., 99                  |
       * | Millisecond             | SSS   | 000, 001, ..., 999               |
       * | Timezone                | Z     | -01:00, +00:00, ... +12:00       |
       * |                         | ZZ    | -0100, +0000, ..., +1200         |
       * | Seconds timestamp       | X     | 512969520                        |
       * | Milliseconds timestamp  | x     | 512969520900                     |
       * | Long format             | LT    | 05:30 a.m.                       |
       * |                         | LTS   | 05:30:15 a.m.                    |
       * |                         | L     | 07/02/1995                       |
       * |                         | l     | 7/2/1995                         |
       * |                         | LL    | July 2 1995                      |
       * |                         | ll    | Jul 2 1995                       |
       * |                         | LLL   | July 2 1995 05:30 a.m.           |
       * |                         | lll   | Jul 2 1995 05:30 a.m.            |
       * |                         | LLLL  | Sunday, July 2 1995 05:30 a.m.   |
       * |                         | llll  | Sun, Jul 2 1995 05:30 a.m.       |
       *
       * The characters wrapped in square brackets are escaped.
       *
       * The result may vary by locale.
       *
       * @param {Date|String|Number} date - the original date
       * @param {String} format - the string of tokens
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
       * @returns {String} the formatted date string
       * @throws {TypeError} 2 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       * @throws {RangeError} `options.locale` must contain `localize` property
       * @throws {RangeError} `options.locale` must contain `formatLong` property
       *
       * @example
       * // Represent 11 February 2014 in middle-endian format:
       * var result = format(
       *   new Date(2014, 1, 11),
       *   'MM/DD/YYYY'
       * )
       * //=> '02/11/2014'
       *
       * @example
       * // Represent 2 July 2014 in Esperanto:
       * import { eoLocale } from 'date-fns/locale/eo'
       * var result = format(
       *   new Date(2014, 6, 2),
       *   'Do [de] MMMM YYYY',
       *   {locale: eoLocale}
       * )
       * //=> '2-a de julio 2014'
       */
      function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
        if (arguments.length < 2) {
          throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
        }

        var formatStr = String(dirtyFormatStr);
        var options = dirtyOptions || {};

        var locale = options.locale || _index6['default'];

        if (!locale.localize) {
          throw new RangeError('locale must contain localize property');
        }

        if (!locale.formatLong) {
          throw new RangeError('locale must contain formatLong property');
        }

        var localeFormatters = locale.formatters || {};
        var formattingTokensRegExp = locale.formattingTokensRegExp || defaultFormattingTokensRegExp;
        var formatLong = locale.formatLong;

        var originalDate = (0, _index2['default'])(dirtyDate, options);

        if (!(0, _index4['default'])(originalDate, options)) {
          return 'Invalid Date';
        }

        // Convert the date in system timezone to the same date in UTC+00:00 timezone.
        // This ensures that when UTC functions will be implemented, locales will be compatible with them.
        // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
        var timezoneOffset = originalDate.getTimezoneOffset();
        var utcDate = (0, _index12['default'])(originalDate, -timezoneOffset, options);

        var formatterOptions = (0, _index10['default'])(options);
        formatterOptions.locale = locale;
        formatterOptions.formatters = _index8['default'];

        // When UTC functions will be implemented, options._originalDate will likely be a part of public API.
        // Right now, please don't use it in locales. If you have to use an original date,
        // please restore it from `date`, adding a timezone offset to it.
        formatterOptions._originalDate = originalDate;

        var result = formatStr.replace(longFormattingTokensRegExp, function (substring) {
          if (substring[0] === '[') {
            return substring;
          }

          if (substring[0] === '\\') {
            return cleanEscapedString(substring);
          }

          return formatLong(substring);
        }).replace(formattingTokensRegExp, function (substring) {
          var formatter = localeFormatters[substring] || _index8['default'][substring];

          if (formatter) {
            return formatter(utcDate, formatterOptions);
          } else {
            return cleanEscapedString(substring);
          }
        });

        return result;
      }

      function cleanEscapedString(input) {
        if (input.match(/\[[\s\S]/)) {
          return input.replace(/^\[|]$/g, '');
        }
        return input.replace(/\\/g, '');
      }
      module.exports = exports['default'];
    });

    var formatDate = unwrapExports(format_1);

    var isEqual_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isEqual;

      var _index2 = _interopRequireDefault(toDate_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /**
       * @name isEqual
       * @category Common Helpers
       * @summary Are the given dates equal?
       *
       * @description
       * Are the given dates equal?
       *
       * @param {Date|String|Number} dateLeft - the first date to compare
       * @param {Date|String|Number} dateRight - the second date to compare
       * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}
       * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
       * @returns {Boolean} the dates are equal
       * @throws {TypeError} 2 arguments required
       * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
       *
       * @example
       * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
       * var result = isEqual(
       *   new Date(2014, 6, 2, 6, 30, 45, 0)
       *   new Date(2014, 6, 2, 6, 30, 45, 500)
       * )
       * //=> false
       */
      function isEqual(dirtyLeftDate, dirtyRightDate, dirtyOptions) {
        if (arguments.length < 2) {
          throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');
        }

        var dateLeft = (0, _index2['default'])(dirtyLeftDate, dirtyOptions);
        var dateRight = (0, _index2['default'])(dirtyRightDate, dirtyOptions);
        return dateLeft.getTime() === dateRight.getTime();
      }
      module.exports = exports['default'];
    });

    var isEqual = unwrapExports(isEqual_1);

    var validate$f = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'date_format');
        if (typeof value !== 'string' && typeof value !== 'number') {
            return false;
        }
        var format = parameters[0];

        var date = parseDate(String(value), String(format), new Date());
        return date && (formatDate(date, format) === value || isEqual(formatDate(date, format), value));
    };

    var validate$g = function validate(attribute, value, parameters, validator) {
        if (value instanceof Date && !isNaN(Number(value))) {
            return true;
        }
        if (typeof value !== 'string' && typeof value !== 'number') {
            return false;
        }
        var date = new Date(value);
        return !isNaN(Number(date)) || isValid(value);
    };

    var validate$h = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'different');
        for (var _iterator = parameters, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
            var _ref;

            if (_isArray) {
                if (_i >= _iterator.length) break;
                _ref = _iterator[_i++];
            } else {
                _i = _iterator.next();
                if (_i.done) break;
                _ref = _i.value;
            }

            var parameter = _ref;

            var other = validator.getValue(parameter);
            if (other == null || value === other) {
                return false;
            }
        }
        return true;
    };

    var validate$i = function validate(attribute, value, parameters, validator) {
        requireParameterCount(2, parameters, 'digits_between');
        var min = parameters[0],
            max = parameters[1];

        var str = String(value);
        return (/^[0-9]*$/.test(str) && str.length >= Number(min) && str.length <= Number(max)
        );
    };

    var validate$j = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'digits');
        var length = parameters[0];

        var str = String(value);
        return (/^[0-9]*$/.test(str) && str.length === Number(length)
        );
    };

    var escape = function escape(str) {
        return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
    };

    var flatten = function flatten(object) {
        if (!isPlainObject(object) && !Array.isArray(object)) {
            return object;
        }
        var result = {};
        for (var _iterator = Object.keys(object), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
            var _ref;

            if (_isArray) {
                if (_i >= _iterator.length) break;
                _ref = _iterator[_i++];
            } else {
                _i = _iterator.next();
                if (_i.done) break;
                _ref = _i.value;
            }

            var key = _ref;

            if (isPlainObject(object[key]) || Array.isArray(object[key])) {
                var keys = Object.keys(object[key]);
                if (keys.length) {
                    var flatData = flatten(object[key]);
                    for (var _iterator2 = Object.keys(flatData), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
                        var _ref2;

                        if (_isArray2) {
                            if (_i2 >= _iterator2.length) break;
                            _ref2 = _iterator2[_i2++];
                        } else {
                            _i2 = _iterator2.next();
                            if (_i2.done) break;
                            _ref2 = _i2.value;
                        }

                        var kkey = _ref2;

                        result[key + '.' + kkey] = flatData[kkey];
                    }
                    continue;
                }
            }
            result[key] = object[key];
        }
        return result;
    };

    var is = function is(patterns, value) {
        patterns = Array.isArray(patterns) ? patterns : [patterns];
        patterns = patterns.filter(Boolean);
        if (patterns.length === 0) {
            return false;
        }
        for (var _iterator = patterns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
            var _ref;

            if (_isArray) {
                if (_i >= _iterator.length) break;
                _ref = _iterator[_i++];
            } else {
                _i = _iterator.next();
                if (_i.done) break;
                _ref = _i.value;
            }

            var pattern = _ref;

            if (pattern === value) {
                return true;
            }
            var regex = new RegExp('^' + escape(pattern).replace(/\\\*/g, '.*') + '$', 'u');
            if (regex.test(value)) {
                return true;
            }
        }
        return false;
    };

    var validate$k = function validate(attribute, value, parameters, validator) {
        var data = [];
        var attributeName = validator.getPrimaryAttribute(attribute);
        var path = attributeName.split('*')[0].replace(/^\.|\.$/g, '') || null;
        var attributeData = flatten(validator.getValue(path));
        var attributeNameRegex = new RegExp('^' + escape(attributeName).replace(/\\\*/g, '([^\.]+)'), 'u');
        Object.keys(attributeData).forEach(function (k) {
            var key = path + '.' + k;
            if (key !== attribute && attributeNameRegex.test(key)) {
                data.push(attributeData[k]);
            }
        });
        if (parameters.indexOf('ignore_case') > -1) {
            var regex = new RegExp('' + escape(value), 'iu');
            return data.filter(function (val) {
                return regex.test(val);
            }).length === 0;
        }
        return data.indexOf(value) === -1;
    };

    var assertString_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = assertString;
      function assertString(input) {
        var isString = typeof input === 'string' || input instanceof String;

        if (!isString) {
          throw new TypeError('This library (validator.js) validates strings only');
        }
      }
      module.exports = exports['default'];
    });

    unwrapExports(assertString_1);

    var merge_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = merge;
      function merge() {
        var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        var defaults = arguments[1];

        for (var key in defaults) {
          if (typeof obj[key] === 'undefined') {
            obj[key] = defaults[key];
          }
        }
        return obj;
      }
      module.exports = exports['default'];
    });

    unwrapExports(merge_1);

    var isByteLength_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });

      var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
        return typeof obj;
      } : function (obj) {
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      };

      exports['default'] = isByteLength;

      var _assertString2 = _interopRequireDefault(assertString_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      /* eslint-disable prefer-rest-params */
      function isByteLength(str, options) {
        (0, _assertString2['default'])(str);
        var min = void 0;
        var max = void 0;
        if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
          min = options.min || 0;
          max = options.max;
        } else {
          // backwards compatibility: isByteLength(str, min [, max])
          min = arguments[1];
          max = arguments[2];
        }
        var len = encodeURI(str).split(/%..|./).length - 1;
        return len >= min && (typeof max === 'undefined' || len <= max);
      }
      module.exports = exports['default'];
    });

    unwrapExports(isByteLength_1);

    var isFQDN_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isFQDN;

      var _assertString2 = _interopRequireDefault(assertString_1);

      var _merge2 = _interopRequireDefault(merge_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var default_fqdn_options = {
        require_tld: true,
        allow_underscores: false,
        allow_trailing_dot: false
      };

      function isFQDN(str, options) {
        (0, _assertString2['default'])(str);
        options = (0, _merge2['default'])(options, default_fqdn_options);

        /* Remove the optional trailing dot before checking validity */
        if (options.allow_trailing_dot && str[str.length - 1] === '.') {
          str = str.substring(0, str.length - 1);
        }
        var parts = str.split('.');
        for (var i = 0; i < parts.length; i++) {
          if (parts[i].length > 63) {
            return false;
          }
        }
        if (options.require_tld) {
          var tld = parts.pop();
          if (!parts.length || !/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
            return false;
          }
          // disallow spaces
          if (/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(tld)) {
            return false;
          }
        }
        for (var part, _i = 0; _i < parts.length; _i++) {
          part = parts[_i];
          if (options.allow_underscores) {
            part = part.replace(/_/g, '');
          }
          if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
            return false;
          }
          // disallow full-width chars
          if (/[\uff01-\uff5e]/.test(part)) {
            return false;
          }
          if (part[0] === '-' || part[part.length - 1] === '-') {
            return false;
          }
        }
        return true;
      }
      module.exports = exports['default'];
    });

    unwrapExports(isFQDN_1);

    var isEmail_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isEmail;

      var _assertString2 = _interopRequireDefault(assertString_1);

      var _merge2 = _interopRequireDefault(merge_1);

      var _isByteLength2 = _interopRequireDefault(isByteLength_1);

      var _isFQDN2 = _interopRequireDefault(isFQDN_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var default_email_options = {
        allow_display_name: false,
        require_display_name: false,
        allow_utf8_local_part: true,
        require_tld: true
      };

      /* eslint-disable max-len */
      /* eslint-disable no-control-regex */
      var displayName = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\,\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i;
      var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
      var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
      var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
      var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
      /* eslint-enable max-len */
      /* eslint-enable no-control-regex */

      function isEmail(str, options) {
        (0, _assertString2['default'])(str);
        options = (0, _merge2['default'])(options, default_email_options);

        if (options.require_display_name || options.allow_display_name) {
          var display_email = str.match(displayName);
          if (display_email) {
            str = display_email[1];
          } else if (options.require_display_name) {
            return false;
          }
        }

        var parts = str.split('@');
        var domain = parts.pop();
        var user = parts.join('@');

        var lower_domain = domain.toLowerCase();

        if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {
          /*
            Previously we removed dots for gmail addresses before validating.
            This was removed because it allows `multiple..dots@gmail.com`
            to be reported as valid, but it is not.
            Gmail only normalizes single dots, removing them from here is pointless,
            should be done in normalizeEmail
          */
          user = user.toLowerCase();
        }

        if (!(0, _isByteLength2['default'])(user, { max: 64 }) || !(0, _isByteLength2['default'])(domain, { max: 254 })) {
          return false;
        }

        if (!(0, _isFQDN2['default'])(domain, { require_tld: options.require_tld })) {
          return false;
        }

        if (user[0] === '"') {
          user = user.slice(1, user.length - 1);
          return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
        }

        var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;

        var user_parts = user.split('.');
        for (var i = 0; i < user_parts.length; i++) {
          if (!pattern.test(user_parts[i])) {
            return false;
          }
        }

        return true;
      }
      module.exports = exports['default'];
    });

    var isEmail = unwrapExports(isEmail_1);

    var validate$l = function validate(attribute, value, parameters, validator) {
        return isEmail(String(value));
    };

    var validate$m = function validate$$1(attribute, value, parameters, validator) {
        if (validator.getValue(attribute, '__MISSING__') !== '__MISSING__') {
            return validate(attribute, value, [], validator);
        }
        return true;
    };

    var validate$n = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'in_array');
        var path = parameters[0];

        var otherValues = [];
        var explicitPath = path.split('*')[0].replace(/^\.|\.$/g, '') || null;
        var attributeData = flatten(validator.getValue(explicitPath));
        var regex = new RegExp('^' + escape(path).replace(/\\\*/g, '([^\.]+)'));
        Object.keys(attributeData).forEach(function (key) {
            if (regex.exec(explicitPath + '.' + key)) {
                otherValues.push(attributeData[key]);
            }
        });
        return otherValues.indexOf(value) > -1;
    };

    var validate$o = function validate(attribute, value, parameters, validator) {
        return (/^-?[0-9]+$/.test(String(value))
        );
    };

    var validate$p = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'in');
        if (Array.isArray(value) && validator.hasRule(attribute, 'array')) {
            for (var _iterator = value, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
                var _ref;

                if (_isArray) {
                    if (_i >= _iterator.length) break;
                    _ref = _iterator[_i++];
                } else {
                    _i = _iterator.next();
                    if (_i.done) break;
                    _ref = _i.value;
                }

                var element = _ref;

                if (Array.isArray(element)) {
                    return false;
                }
            }
            return value.filter(function (v) {
                return parameters.indexOf(v) === -1;
            }).length === 0;
        }
        return !Array.isArray(value) && parameters.indexOf(String(value)) > -1;
    };

    var isIP_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isIP;

      var _assertString2 = _interopRequireDefault(assertString_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
      var ipv6Block = /^[0-9A-F]{1,4}$/i;

      function isIP(str) {
        var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

        (0, _assertString2['default'])(str);
        version = String(version);
        if (!version) {
          return isIP(str, 4) || isIP(str, 6);
        } else if (version === '4') {
          if (!ipv4Maybe.test(str)) {
            return false;
          }
          var parts = str.split('.').sort(function (a, b) {
            return a - b;
          });
          return parts[3] <= 255;
        } else if (version === '6') {
          var blocks = str.split(':');
          var foundOmissionBlock = false; // marker to indicate ::

          // At least some OS accept the last 32 bits of an IPv6 address
          // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says
          // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,
          // and '::a.b.c.d' is deprecated, but also valid.
          var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);
          var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;

          if (blocks.length > expectedNumberOfBlocks) {
            return false;
          }
          // initial or final ::
          if (str === '::') {
            return true;
          } else if (str.substr(0, 2) === '::') {
            blocks.shift();
            blocks.shift();
            foundOmissionBlock = true;
          } else if (str.substr(str.length - 2) === '::') {
            blocks.pop();
            blocks.pop();
            foundOmissionBlock = true;
          }

          for (var i = 0; i < blocks.length; ++i) {
            // test for a :: which can not be at the string start/end
            // since those cases have been handled above
            if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {
              if (foundOmissionBlock) {
                return false; // multiple :: in address
              }
              foundOmissionBlock = true;
            } else if (foundIPv4TransitionBlock && i === blocks.length - 1) ; else if (!ipv6Block.test(blocks[i])) {
              return false;
            }
          }
          if (foundOmissionBlock) {
            return blocks.length >= 1;
          }
          return blocks.length === expectedNumberOfBlocks;
        }
        return false;
      }
      module.exports = exports['default'];
    });

    var isIP = unwrapExports(isIP_1);

    var validate$q = function validate(attribute, value, parameters, validator) {
        return isIP(value);
    };

    var validate$r = function validate(attribute, value, parameters, validator) {
        return isIP(value, 4);
    };

    var validate$s = function validate(attribute, value, parameters, validator) {
        return isIP(value, 6);
    };

    var validate$t = function validate(attribute, value, parameters, validator) {
        if (!/boolean|number|string/.test(typeof value)) {
            return false;
        }
        try {
            var json = JSON.parse(value);
            return (/boolean|number|object/.test(typeof json)
            );
        } catch (e) {
            return false;
        }
    };

    var validate$u = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'max');
        var max = parameters[0];

        return getSize(attribute, value, validator) <= Number(max);
    };

    var validate$v = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'min');
        var min = parameters[0];

        return getSize(attribute, value, validator) >= Number(min);
    };

    var validate$w = function validate(attribute, value, parameters, validator) {
        return !validate$p(attribute, value, parameters, validator);
    };

    var validate$x = function validate(attribute, value, parameters, validator) {
        return true;
    };

    var validate$y = function validate(attribute, value, parameters, validator) {
        return isNumeric(value);
    };

    var validate$z = function validate(attribute, value, parameters, validator) {
        var val = validator.getValue(attribute, '__MISSING__');
        return val !== '__MISSING__';
    };

    var validate$A = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'regex');
        var regex = parameters[0];

        return new RegExp(regex).test(String(value));
    };

    var validate$B = function validate$$1(attribute, value, parameters, validator) {
        requireParameterCount(2, parameters, 'required_if');
        var other = validator.getValue(parameters[0]);
        var values = parameters.slice(1);
        if (typeof other === 'boolean') {
            values = values.map(function (val) {
                return val === 'true' ? true : val === 'false' ? false : val;
            });
        }
        if (values.indexOf(other) > -1) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var validate$C = function validate$$1(attribute, value, parameters, validator) {
        requireParameterCount(2, parameters, 'required_unless');
        var data = validator.getValue(parameters[0]);
        var values = parameters.slice(1);
        if (values.indexOf(data) === -1) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var anyFailingRequired = function anyFailingRequired(attributes, validator) {
        for (var _iterator = attributes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
            var _ref;

            if (_isArray) {
                if (_i >= _iterator.length) break;
                _ref = _iterator[_i++];
            } else {
                _i = _iterator.next();
                if (_i.done) break;
                _ref = _i.value;
            }

            var key = _ref;

            if (!validate(key, validator.getValue(key), [], validator)) {
                return true;
            }
        }
        return false;
    };
    var allFailingRequired = function allFailingRequired(attributes, validator) {
        for (var _iterator2 = attributes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
            var _ref2;

            if (_isArray2) {
                if (_i2 >= _iterator2.length) break;
                _ref2 = _iterator2[_i2++];
            } else {
                _i2 = _iterator2.next();
                if (_i2.done) break;
                _ref2 = _i2.value;
            }

            var key = _ref2;

            if (validate(key, validator.getValue(key), [], validator)) {
                return false;
            }
        }
        return true;
    };

    var validate$D = function validate$$1(attribute, value, parameters, validator) {
        if (!anyFailingRequired(parameters, validator)) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var validate$E = function validate$$1(attribute, value, parameters, validator) {
        if (allFailingRequired(parameters, validator)) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var validate$F = function validate$$1(attribute, value, parameters, validator) {
        if (anyFailingRequired(parameters, validator)) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var validate$G = function validate$$1(attribute, value, parameters, validator) {
        if (!allFailingRequired(parameters, validator)) {
            return validate(attribute, value, parameters, validator);
        }
        return true;
    };

    var validate$H = function validate(attribute, value, parameters, validator) {
        requireParameterCount(1, parameters, 'size');
        var size = parameters[0];

        var type = typeof value;
        if (['number', 'string'].indexOf(type) === -1 && !Array.isArray(value)) {
            return false;
        }
        return getSize(attribute, value, validator) === Number(size);
    };

    var validate$I = function validate(attribute, value, parameters, validator) {
        return true;
    };

    var validate$J = function validate(attribute, value, parameters, validator) {
        return typeof value === 'string';
    };

    var isURL_1 = createCommonjsModule(function (module, exports) {

      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      exports['default'] = isURL;

      var _assertString2 = _interopRequireDefault(assertString_1);

      var _isFQDN2 = _interopRequireDefault(isFQDN_1);

      var _isIP2 = _interopRequireDefault(isIP_1);

      var _merge2 = _interopRequireDefault(merge_1);

      function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : { 'default': obj };
      }

      var default_url_options = {
        protocols: ['http', 'https', 'ftp'],
        require_tld: true,
        require_protocol: false,
        require_host: true,
        require_valid_protocol: true,
        allow_underscores: false,
        allow_trailing_dot: false,
        allow_protocol_relative_urls: false
      };

      var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;

      function isRegExp(obj) {
        return Object.prototype.toString.call(obj) === '[object RegExp]';
      }

      function checkHost(host, matches) {
        for (var i = 0; i < matches.length; i++) {
          var match = matches[i];
          if (host === match || isRegExp(match) && match.test(host)) {
            return true;
          }
        }
        return false;
      }

      function isURL(url, options) {
        (0, _assertString2['default'])(url);
        if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
          return false;
        }
        if (url.indexOf('mailto:') === 0) {
          return false;
        }
        options = (0, _merge2['default'])(options, default_url_options);
        var protocol = void 0,
            auth = void 0,
            host = void 0,
            hostname = void 0,
            port = void 0,
            port_str = void 0,
            split = void 0,
            ipv6 = void 0;

        split = url.split('#');
        url = split.shift();

        split = url.split('?');
        url = split.shift();

        split = url.split('://');
        if (split.length > 1) {
          protocol = split.shift();
          if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
            return false;
          }
        } else if (options.require_protocol) {
          return false;
        } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {
          split[0] = url.substr(2);
        }
        url = split.join('://');

        if (url === '') {
          return false;
        }

        split = url.split('/');
        url = split.shift();

        if (url === '' && !options.require_host) {
          return true;
        }

        split = url.split('@');
        if (split.length > 1) {
          auth = split.shift();
          if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
            return false;
          }
        }
        hostname = split.join('@');

        port_str = null;
        ipv6 = null;
        var ipv6_match = hostname.match(wrapped_ipv6);
        if (ipv6_match) {
          host = '';
          ipv6 = ipv6_match[1];
          port_str = ipv6_match[2] || null;
        } else {
          split = hostname.split(':');
          host = split.shift();
          if (split.length) {
            port_str = split.join(':');
          }
        }

        if (port_str !== null) {
          port = parseInt(port_str, 10);
          if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
            return false;
          }
        }

        if (!(0, _isIP2['default'])(host) && !(0, _isFQDN2['default'])(host, options) && (!ipv6 || !(0, _isIP2['default'])(ipv6, 6))) {
          return false;
        }

        host = host || ipv6;

        if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {
          return false;
        }
        if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
          return false;
        }

        return true;
      }
      module.exports = exports['default'];
    });

    var isURL = unwrapExports(isURL_1);

    var validate$K = function validate(attribute, value, _ref, validator) {
        var _ref$ = _ref[0],
            requireProtocol = _ref$ === undefined ? true : _ref$;

        if (typeof value !== 'string') {
            return false;
        }
        var options = {
            protocols: URL_PROTOCOLS,
            require_host: true,
            require_protocol: [true, 1, '1'].indexOf(requireProtocol) > -1
        };
        return isURL(value, options);
    };

    var rules = {
        accepted: validate$1,
        after_or_equal: validate$2,
        after: validate$3,
        alpha_dash: validate$4,
        alpha_num: validate$5,
        alpha: validate$6,
        array: validate$7,
        before_or_equal: validate$8,
        before: validate$9,
        between: validate$a,
        boolean: validate$b,
        confirmed: validate$d,
        date_equals: validate$e,
        date_format: validate$f,
        date: validate$g,
        different: validate$h,
        digits_between: validate$i,
        digits: validate$j,
        distinct: validate$k,
        email: validate$l,
        filled: validate$m,
        in_array: validate$n,
        integer: validate$o,
        'in': validate$p,
        ip: validate$q,
        ipv4: validate$r,
        ipv6: validate$s,
        json: validate$t,
        max: validate$u,
        min: validate$v,
        not_in: validate$w,
        nullable: validate$x,
        numeric: validate$y,
        present: validate$z,
        regex: validate$A,
        required_if: validate$B,
        required: validate,
        required_unless: validate$C,
        required_with_all: validate$D,
        required_without_all: validate$E,
        required_without: validate$F,
        required_with: validate$G,
        same: validate$c,
        size: validate$H,
        sometimes: validate$I,
        string: validate$J,
        url: validate$K
    };

    var index$u = /*#__PURE__*/Object.freeze({
        default: rules
    });

    var isMergeableObject = function isMergeableObject(value) {
    	return isNonNullObject(value) && !isSpecial(value);
    };

    function isNonNullObject(value) {
    	return !!value && typeof value === 'object';
    }

    function isSpecial(value) {
    	var stringValue = Object.prototype.toString.call(value);

    	return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value);
    }

    // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
    var canUseSymbol = typeof Symbol === 'function' && Symbol['for'];
    var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol['for']('react.element') : 0xeac7;

    function isReactElement(value) {
    	return value.$$typeof === REACT_ELEMENT_TYPE;
    }

    function emptyTarget(val) {
    	return Array.isArray(val) ? [] : {};
    }

    function cloneUnlessOtherwiseSpecified(value, options) {
    	return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
    }

    function defaultArrayMerge(target, source, options) {
    	return target.concat(source).map(function (element) {
    		return cloneUnlessOtherwiseSpecified(element, options);
    	});
    }

    function mergeObject(target, source, options) {
    	var destination = {};
    	if (options.isMergeableObject(target)) {
    		Object.keys(target).forEach(function (key) {
    			destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
    		});
    	}
    	Object.keys(source).forEach(function (key) {
    		if (!options.isMergeableObject(source[key]) || !target[key]) {
    			destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
    		} else {
    			destination[key] = deepmerge(target[key], source[key], options);
    		}
    	});
    	return destination;
    }

    function deepmerge(target, source, options) {
    	options = options || {};
    	options.arrayMerge = options.arrayMerge || defaultArrayMerge;
    	options.isMergeableObject = options.isMergeableObject || isMergeableObject;

    	var sourceIsArray = Array.isArray(source);
    	var targetIsArray = Array.isArray(target);
    	var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;

    	if (!sourceAndTargetTypesMatch) {
    		return cloneUnlessOtherwiseSpecified(source, options);
    	} else if (sourceIsArray) {
    		return options.arrayMerge(target, source, options);
    	} else {
    		return mergeObject(target, source, options);
    	}
    }

    deepmerge.all = function deepmergeAll(array, options) {
    	if (!Array.isArray(array)) {
    		throw new Error('first argument should be an array');
    	}

    	return array.reduce(function (prev, next) {
    		return deepmerge(prev, next, options);
    	}, {});
    };

    var deepmerge_1 = deepmerge;

    function symbolObservablePonyfill(root) {
    	var result;
    	var Symbol = root.Symbol;

    	if (typeof Symbol === 'function') {
    		if (Symbol.observable) {
    			result = Symbol.observable;
    		} else {
    			result = Symbol('observable');
    			Symbol.observable = result;
    		}
    	} else {
    		result = '@@observable';
    	}

    	return result;
    }

    /* global window */

    var root;

    if (typeof self !== 'undefined') {
      root = self;
    } else if (typeof window !== 'undefined') {
      root = window;
    } else if (typeof global !== 'undefined') {
      root = global;
    } else if (typeof module !== 'undefined') {
      root = module;
    } else {
      root = Function('return this')();
    }

    var result = symbolObservablePonyfill(root);

    /**
     * These are private action types reserved by Redux.
     * For any unknown actions, you must return the current state.
     * If the current state is undefined, you must return the initial state.
     * Do not reference these action types directly in your code.
     */
    var ActionTypes = {
      INIT: '@@redux/INIT' + Math.random().toString(36).substring(7).split('').join('.'),
      REPLACE: '@@redux/REPLACE' + Math.random().toString(36).substring(7).split('').join('.')
    };

    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
      return typeof obj;
    } : function (obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };

    var _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];

        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }

      return target;
    };

    /**
     * @param {any} obj The object to inspect.
     * @returns {boolean} True if the argument appears to be a plain object.
     */
    function isPlainObject$1(obj) {
      if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || obj === null) return false;

      var proto = obj;
      while (Object.getPrototypeOf(proto) !== null) {
        proto = Object.getPrototypeOf(proto);
      }

      return Object.getPrototypeOf(obj) === proto;
    }

    /**
     * Creates a Redux store that holds the state tree.
     * The only way to change the data in the store is to call `dispatch()` on it.
     *
     * There should only be a single store in your app. To specify how different
     * parts of the state tree respond to actions, you may combine several reducers
     * into a single reducer function by using `combineReducers`.
     *
     * @param {Function} reducer A function that returns the next state tree, given
     * the current state tree and the action to handle.
     *
     * @param {any} [preloadedState] The initial state. You may optionally specify it
     * to hydrate the state from the server in universal apps, or to restore a
     * previously serialized user session.
     * If you use `combineReducers` to produce the root reducer function, this must be
     * an object with the same shape as `combineReducers` keys.
     *
     * @param {Function} [enhancer] The store enhancer. You may optionally specify it
     * to enhance the store with third-party capabilities such as middleware,
     * time travel, persistence, etc. The only store enhancer that ships with Redux
     * is `applyMiddleware()`.
     *
     * @returns {Store} A Redux store that lets you read the state, dispatch actions
     * and subscribe to changes.
     */
    function createStore(reducer, preloadedState, enhancer) {
      var _ref2;

      if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
        enhancer = preloadedState;
        preloadedState = undefined;
      }

      if (typeof enhancer !== 'undefined') {
        if (typeof enhancer !== 'function') {
          throw new Error('Expected the enhancer to be a function.');
        }

        return enhancer(createStore)(reducer, preloadedState);
      }

      if (typeof reducer !== 'function') {
        throw new Error('Expected the reducer to be a function.');
      }

      var currentReducer = reducer;
      var currentState = preloadedState;
      var currentListeners = [];
      var nextListeners = currentListeners;
      var isDispatching = false;

      function ensureCanMutateNextListeners() {
        if (nextListeners === currentListeners) {
          nextListeners = currentListeners.slice();
        }
      }

      /**
       * Reads the state tree managed by the store.
       *
       * @returns {any} The current state tree of your application.
       */
      function getState() {
        if (isDispatching) {
          throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
        }

        return currentState;
      }

      /**
       * Adds a change listener. It will be called any time an action is dispatched,
       * and some part of the state tree may potentially have changed. You may then
       * call `getState()` to read the current state tree inside the callback.
       *
       * You may call `dispatch()` from a change listener, with the following
       * caveats:
       *
       * 1. The subscriptions are snapshotted just before every `dispatch()` call.
       * If you subscribe or unsubscribe while the listeners are being invoked, this
       * will not have any effect on the `dispatch()` that is currently in progress.
       * However, the next `dispatch()` call, whether nested or not, will use a more
       * recent snapshot of the subscription list.
       *
       * 2. The listener should not expect to see all state changes, as the state
       * might have been updated multiple times during a nested `dispatch()` before
       * the listener is called. It is, however, guaranteed that all subscribers
       * registered before the `dispatch()` started will be called with the latest
       * state by the time it exits.
       *
       * @param {Function} listener A callback to be invoked on every dispatch.
       * @returns {Function} A function to remove this change listener.
       */
      function subscribe(listener) {
        if (typeof listener !== 'function') {
          throw new Error('Expected the listener to be a function.');
        }

        if (isDispatching) {
          throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
        }

        var isSubscribed = true;

        ensureCanMutateNextListeners();
        nextListeners.push(listener);

        return function unsubscribe() {
          if (!isSubscribed) {
            return;
          }

          if (isDispatching) {
            throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
          }

          isSubscribed = false;

          ensureCanMutateNextListeners();
          var index = nextListeners.indexOf(listener);
          nextListeners.splice(index, 1);
        };
      }

      /**
       * Dispatches an action. It is the only way to trigger a state change.
       *
       * The `reducer` function, used to create the store, will be called with the
       * current state tree and the given `action`. Its return value will
       * be considered the **next** state of the tree, and the change listeners
       * will be notified.
       *
       * The base implementation only supports plain object actions. If you want to
       * dispatch a Promise, an Observable, a thunk, or something else, you need to
       * wrap your store creating function into the corresponding middleware. For
       * example, see the documentation for the `redux-thunk` package. Even the
       * middleware will eventually dispatch plain object actions using this method.
       *
       * @param {Object} action A plain object representing “what changed”. It is
       * a good idea to keep actions serializable so you can record and replay user
       * sessions, or use the time travelling `redux-devtools`. An action must have
       * a `type` property which may not be `undefined`. It is a good idea to use
       * string constants for action types.
       *
       * @returns {Object} For convenience, the same action object you dispatched.
       *
       * Note that, if you use a custom middleware, it may wrap `dispatch()` to
       * return something else (for example, a Promise you can await).
       */
      function dispatch(action) {
        if (!isPlainObject$1(action)) {
          throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
        }

        if (typeof action.type === 'undefined') {
          throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
        }

        if (isDispatching) {
          throw new Error('Reducers may not dispatch actions.');
        }

        try {
          isDispatching = true;
          currentState = currentReducer(currentState, action);
        } finally {
          isDispatching = false;
        }

        var listeners = currentListeners = nextListeners;
        for (var i = 0; i < listeners.length; i++) {
          var listener = listeners[i];
          listener();
        }

        return action;
      }

      /**
       * Replaces the reducer currently used by the store to calculate the state.
       *
       * You might need this if your app implements code splitting and you want to
       * load some of the reducers dynamically. You might also need this if you
       * implement a hot reloading mechanism for Redux.
       *
       * @param {Function} nextReducer The reducer for the store to use instead.
       * @returns {void}
       */
      function replaceReducer(nextReducer) {
        if (typeof nextReducer !== 'function') {
          throw new Error('Expected the nextReducer to be a function.');
        }

        currentReducer = nextReducer;
        dispatch({ type: ActionTypes.REPLACE });
      }

      /**
       * Interoperability point for observable/reactive libraries.
       * @returns {observable} A minimal observable of state changes.
       * For more information, see the observable proposal:
       * https://github.com/tc39/proposal-observable
       */
      function observable() {
        var _ref;

        var outerSubscribe = subscribe;
        return _ref = {
          /**
           * The minimal observable subscription method.
           * @param {Object} observer Any object that can be used as an observer.
           * The observer object should have a `next` method.
           * @returns {subscription} An object with an `unsubscribe` method that can
           * be used to unsubscribe the observable from the store, and prevent further
           * emission of values from the observable.
           */
          subscribe: function subscribe(observer) {
            if ((typeof observer === 'undefined' ? 'undefined' : _typeof(observer)) !== 'object' || observer === null) {
              throw new TypeError('Expected the observer to be an object.');
            }

            function observeState() {
              if (observer.next) {
                observer.next(getState());
              }
            }

            observeState();
            var unsubscribe = outerSubscribe(observeState);
            return { unsubscribe: unsubscribe };
          }
        }, _ref[result] = function () {
          return this;
        }, _ref;
      }

      // When a store is created, an "INIT" action is dispatched so that every
      // reducer returns their initial state. This effectively populates
      // the initial state tree.
      dispatch({ type: ActionTypes.INIT });

      return _ref2 = {
        dispatch: dispatch,
        subscribe: subscribe,
        getState: getState,
        replaceReducer: replaceReducer
      }, _ref2[result] = observable, _ref2;
    }

    /**
     * Prints a warning in the console if it exists.
     *
     * @param {String} message The warning message.
     * @returns {void}
     */
    function warning(message) {
      /* eslint-disable no-console */
      if (typeof console !== 'undefined' && typeof console.error === 'function') {
        console.error(message);
      }
      /* eslint-enable no-console */
      try {
        // This error was thrown as a convenience so that if you enable
        // "break on all exceptions" in your console,
        // it would pause the execution at this line.
        throw new Error(message);
      } catch (e) {} // eslint-disable-line no-empty
    }

    function getUndefinedStateErrorMessage(key, action) {
      var actionType = action && action.type;
      var actionDescription = actionType && 'action "' + String(actionType) + '"' || 'an action';

      return 'Given ' + actionDescription + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.';
    }

    function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
      var reducerKeys = Object.keys(reducers);
      var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';

      if (reducerKeys.length === 0) {
        return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
      }

      if (!isPlainObject$1(inputState)) {
        return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
      }

      var unexpectedKeys = Object.keys(inputState).filter(function (key) {
        return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
      });

      unexpectedKeys.forEach(function (key) {
        unexpectedKeyCache[key] = true;
      });

      if (action && action.type === ActionTypes.REPLACE) return;

      if (unexpectedKeys.length > 0) {
        return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
      }
    }

    function assertReducerShape(reducers) {
      Object.keys(reducers).forEach(function (key) {
        var reducer = reducers[key];
        var initialState = reducer(undefined, { type: ActionTypes.INIT });

        if (typeof initialState === 'undefined') {
          throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.');
        }

        var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
        if (typeof reducer(undefined, { type: type }) === 'undefined') {
          throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.');
        }
      });
    }

    /**
     * Turns an object whose values are different reducer functions, into a single
     * reducer function. It will call every child reducer, and gather their results
     * into a single state object, whose keys correspond to the keys of the passed
     * reducer functions.
     *
     * @param {Object} reducers An object whose values correspond to different
     * reducer functions that need to be combined into one. One handy way to obtain
     * it is to use ES6 `import * as reducers` syntax. The reducers may never return
     * undefined for any action. Instead, they should return their initial state
     * if the state passed to them was undefined, and the current state for any
     * unrecognized action.
     *
     * @returns {Function} A reducer function that invokes every reducer inside the
     * passed object, and builds a state object with the same shape.
     */
    function combineReducers(reducers) {
      var reducerKeys = Object.keys(reducers);
      var finalReducers = {};
      for (var i = 0; i < reducerKeys.length; i++) {
        var key = reducerKeys[i];

        {
          if (typeof reducers[key] === 'undefined') {
            warning('No reducer provided for key "' + key + '"');
          }
        }

        if (typeof reducers[key] === 'function') {
          finalReducers[key] = reducers[key];
        }
      }
      var finalReducerKeys = Object.keys(finalReducers);

      var unexpectedKeyCache = void 0;
      {
        unexpectedKeyCache = {};
      }

      var shapeAssertionError = void 0;
      try {
        assertReducerShape(finalReducers);
      } catch (e) {
        shapeAssertionError = e;
      }

      return function combination() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        var action = arguments[1];

        if (shapeAssertionError) {
          throw shapeAssertionError;
        }

        {
          var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
          if (warningMessage) {
            warning(warningMessage);
          }
        }

        var hasChanged = false;
        var nextState = {};
        for (var _i = 0; _i < finalReducerKeys.length; _i++) {
          var _key = finalReducerKeys[_i];
          var reducer = finalReducers[_key];
          var previousStateForKey = state[_key];
          var nextStateForKey = reducer(previousStateForKey, action);
          if (typeof nextStateForKey === 'undefined') {
            var errorMessage = getUndefinedStateErrorMessage(_key, action);
            throw new Error(errorMessage);
          }
          nextState[_key] = nextStateForKey;
          hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
        }
        return hasChanged ? nextState : state;
      };
    }

    /**
     * Composes single-argument functions from right to left. The rightmost
     * function can take multiple arguments as it provides the signature for
     * the resulting composite function.
     *
     * @param {...Function} funcs The functions to compose.
     * @returns {Function} A function obtained by composing the argument functions
     * from right to left. For example, compose(f, g, h) is identical to doing
     * (...args) => f(g(h(...args))).
     */

    function compose() {
      for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
        funcs[_key] = arguments[_key];
      }

      if (funcs.length === 0) {
        return function (arg) {
          return arg;
        };
      }

      if (funcs.length === 1) {
        return funcs[0];
      }

      return funcs.reduce(function (a, b) {
        return function () {
          return a(b.apply(undefined, arguments));
        };
      });
    }

    /**
     * Creates a store enhancer that applies middleware to the dispatch method
     * of the Redux store. This is handy for a variety of tasks, such as expressing
     * asynchronous actions in a concise manner, or logging every action payload.
     *
     * See `redux-thunk` package as an example of the Redux middleware.
     *
     * Because middleware is potentially asynchronous, this should be the first
     * store enhancer in the composition chain.
     *
     * Note that each middleware will be given the `dispatch` and `getState` functions
     * as named arguments.
     *
     * @param {...Function} middlewares The middleware chain to be applied.
     * @returns {Function} A store enhancer applying the middleware.
     */
    function applyMiddleware() {
      for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
        middlewares[_key] = arguments[_key];
      }

      return function (createStore) {
        return function () {
          for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
            args[_key2] = arguments[_key2];
          }

          var store = createStore.apply(undefined, args);
          var _dispatch = function dispatch() {
            throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
          };

          var middlewareAPI = {
            getState: store.getState,
            dispatch: function dispatch() {
              return _dispatch.apply(undefined, arguments);
            }
          };
          var chain = middlewares.map(function (middleware) {
            return middleware(middlewareAPI);
          });
          _dispatch = compose.apply(undefined, chain)(store.dispatch);

          return _extends({}, store, {
            dispatch: _dispatch
          });
        };
      };
    }

    /*
     * This is a dummy function to check if the function name has been altered by minification.
     * If the function has been minified and NODE_ENV !== 'production', warn the user.
     */
    function isCrushed() {}

    if (typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
      warning("You are currently using minified code outside of NODE_ENV === 'production'. " + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
    }

    var initialState = {};
    var reducer = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
        var action = arguments[1];
        var type = action.type;

        if (type === SET_DATA) {
            var data = action.payload.data;

            return Object.assign({}, data);
        }
        return state;
    };

    var initialState$1 = {};
    var reducer$1 = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$1;
        var action = arguments[1];
        var type = action.type;

        if (type === ADD_ERROR) {
            var _action$payload = action.payload,
                key = _action$payload.key,
                message = _action$payload.message;

            var errors = state[key] || [];
            if (errors.indexOf(message) === -1) {
                var _Object$assign;

                return Object.assign({}, state, (_Object$assign = {}, _Object$assign[key] = [].concat(errors, [message]), _Object$assign));
            }
        } else if (type === REMOVE_ERROR) {
            var _key = action.payload.key;

            if (_key in state) {
                var _Object$assign2;

                return Object.assign({}, state, (_Object$assign2 = {}, _Object$assign2[_key] = [], _Object$assign2));
            }
        } else if (type === CLEAR_ERRORS) {
            return {};
        }
        return state;
    };

    var initialState$2 = {};
    var reducer$2 = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$2;
        var action = arguments[1];
        var type = action.type;

        if (type === SET_RULES) {
            var implicitAttributes = action.payload.implicitAttributes;

            return Object.assign({}, implicitAttributes);
        }
        return state;
    };

    var initialState$3 = {};
    var reducer$3 = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$3;
        var action = arguments[1];
        var type = action.type;

        if (type === SET_RULES) {
            var initialRules = action.payload.initialRules;

            return Object.assign({}, initialRules);
        }
        return state;
    };

    var initialState$4 = {};
    var reducer$4 = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$4;
        var action = arguments[1];
        var type = action.type;

        if (type === SET_RULES) {
            var rules = action.payload.rules;

            return Object.assign({}, rules);
        }
        return state;
    };

    var initialState$5 = {};
    var reducer$5 = function reducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$5;
        var action = arguments[1];
        var type = action.type;

        if (type === START_VALIDATE) {
            var _Object$assign;

            var attribute = action.payload.attribute;
            return Object.assign({}, state, (_Object$assign = {}, _Object$assign[attribute] = true, _Object$assign));
        } else if (type === STOP_VALIDATE) {
            var _Object$assign2;

            var _attribute = action.payload.attribute;
            return Object.assign({}, state, (_Object$assign2 = {}, _Object$assign2[_attribute] = false, _Object$assign2));
        }
        return state;
    };

    var rootReducer = combineReducers({
        data: reducer,
        errors: reducer$1,
        implicitAttributes: reducer$2,
        initialRules: reducer$3,
        rules: reducer$4,
        validating: reducer$5
    });

    var classCallCheck = function (instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    };

    var createClass = function () {
      function defineProperties(target, props) {
        for (var i = 0; i < props.length; i++) {
          var descriptor = props[i];
          descriptor.enumerable = descriptor.enumerable || false;
          descriptor.configurable = true;
          if ("value" in descriptor) descriptor.writable = true;
          Object.defineProperty(target, descriptor.key, descriptor);
        }
      }

      return function (Constructor, protoProps, staticProps) {
        if (protoProps) defineProperties(Constructor.prototype, protoProps);
        if (staticProps) defineProperties(Constructor, staticProps);
        return Constructor;
      };
    }();

    var ErrorBag = function () {
        function ErrorBag(store) {
            classCallCheck(this, ErrorBag);

            this._store = store;
        }

        ErrorBag.prototype.add = function add(key, message) {
            this._store.dispatch(addError(key, message));
            return this;
        };

        ErrorBag.prototype.remove = function remove(key) {
            this._store.dispatch(removeError(key));
            return this;
        };

        ErrorBag.prototype.clear = function clear() {
            this._store.dispatch(clearErrors());
            return this;
        };

        ErrorBag.prototype.first = function first(key) {
            var _get = this.get(key),
                messages = _get[0];

            return messages;
        };

        ErrorBag.prototype.has = function has(key) {
            return this.get(key).length > 0;
        };

        ErrorBag.prototype.get = function get(key) {
            var _store$getState = this._store.getState(),
                errors = _store$getState.errors;

            if (key in errors) {
                return errors[key];
            }
            return [];
        };

        ErrorBag.prototype.all = function all() {
            var _this = this;

            var _store$getState2 = this._store.getState(),
                errors = _store$getState2.errors;

            return Object.keys(errors).reduce(function (value, key) {
                return value.concat(_this.get(key));
            }, []);
        };

        ErrorBag.prototype.any = function any() {
            return this.count() > 0;
        };

        ErrorBag.prototype.count = function count() {
            var _store$getState3 = this._store.getState(),
                errors = _store$getState3.errors;

            return Object.keys(errors).reduce(function (value, key) {
                return value + errors[key].length;
            }, 0);
        };

        return ErrorBag;
    }();

    var Translator = function () {
        function Translator(locale, validator) {
            classCallCheck(this, Translator);

            this._validator = validator;
            this.setLocale(locale);
            this.setCustomMessages(locale.customMessages || {});
            this.setCustomAttributes(locale.customAttributes || {});
        }

        Translator.prototype.setLocale = function setLocale(locale) {
            this._messages = flatten(locale.messages);
            this._attributes = locale.attributes || {};
            return this;
        };

        Translator.prototype.getAttribute = function getAttribute(attribute) {
            var _attributes = this._attributes,
                _customAttributes = this._customAttributes;

            if (attribute in _customAttributes) {
                return _customAttributes[attribute];
            }
            if (attribute in _attributes) {
                return _attributes[attribute];
            }
            return null;
        };

        Translator.prototype.getMessage = function getMessage(rule, attribute, value, parameters) {
            var _messages = this._messages,
                _customMessages = this._customMessages;

            var rawAttribute = attribute;
            attribute = this._getDisplayableAttribute(attribute);
            parameters = this._getDisplayableParameters(rule, parameters);
            var _arr = [_customMessages, _messages];
            for (var _i = 0; _i < _arr.length; _i++) {
                var source = _arr[_i];
                var message = this._findMessage(source, rawAttribute, { rule: rule, attribute: attribute, value: value, parameters: parameters });
                if (message !== null) {
                    return message;
                }
            }
            return 'Invalid value for field "' + attribute + '"';
        };

        Translator.prototype.setCustomMessages = function setCustomMessages(messages) {
            this._customMessages = flatten(messages || {});
            return this;
        };

        Translator.prototype.addCustomMessages = function addCustomMessages(messages) {
            this._customMessages = Object.assign({}, this._customMessages, flatten(messages || {}));
            return this;
        };

        Translator.prototype.setCustomAttributes = function setCustomAttributes(attributes) {
            this._customAttributes = attributes || {};
            return this;
        };

        Translator.prototype.addCustomAttributes = function addCustomAttributes(attributes) {
            this._customAttributes = Object.assign({}, this._customAttributes, attributes || {});
            return this;
        };

        Translator.prototype._findMessage = function _findMessage(source, attribute, parameters) {
            var type = this._getAttributeType(attribute);
            var keys = [attribute + '.' + parameters.rule + ':' + type, attribute + '.' + parameters.rule, parameters.rule + ':' + type, parameters.rule];
            for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
                var _ref;

                if (_isArray) {
                    if (_i2 >= _iterator.length) break;
                    _ref = _iterator[_i2++];
                } else {
                    _i2 = _iterator.next();
                    if (_i2.done) break;
                    _ref = _i2.value;
                }

                var key = _ref;

                for (var _iterator2 = Object.keys(source), _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
                    var _ref2;

                    if (_isArray2) {
                        if (_i3 >= _iterator2.length) break;
                        _ref2 = _iterator2[_i3++];
                    } else {
                        _i3 = _iterator2.next();
                        if (_i3.done) break;
                        _ref2 = _i3.value;
                    }

                    var sourceKey = _ref2;

                    if (is(sourceKey, key)) {
                        var message = source[sourceKey];
                        if (typeof message === 'string') {
                            return message;
                        }
                        if (typeof message === 'function') {
                            return message(parameters);
                        }
                        return null;
                    }
                }
            }
            return null;
        };

        Translator.prototype._getDisplayableAttribute = function _getDisplayableAttribute(attribute) {
            var implicitAttributes = this._validator.getImplicitAttributes();
            var primaryAttribute = this._validator.getPrimaryAttribute(attribute);
            var expectedAttributes = attribute !== primaryAttribute ? [attribute, primaryAttribute] : [attribute];
            for (var _iterator3 = expectedAttributes, _isArray3 = Array.isArray(_iterator3), _i4 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
                var _ref3;

                if (_isArray3) {
                    if (_i4 >= _iterator3.length) break;
                    _ref3 = _iterator3[_i4++];
                } else {
                    _i4 = _iterator3.next();
                    if (_i4.done) break;
                    _ref3 = _i4.value;
                }

                var name = _ref3;

                var line = this.getAttribute(name);
                if (line !== null) {
                    return line;
                }
            }
            if (primaryAttribute in implicitAttributes) {
                return attribute;
            }
            return attribute.toLowerCase().replace(/_/g, ' ');
        };

        Translator.prototype._getDisplayableParameters = function _getDisplayableParameters(rule, parameters) {
            var _this = this;

            if (DEPENDENT_RULES.indexOf(rule) > -1) {
                return parameters.map(function (parameter) {
                    return _this._getDisplayableAttribute(parameter);
                });
            }
            return parameters;
        };

        Translator.prototype._getAttributeType = function _getAttributeType(attribute) {
            if (this._validator.hasRule(attribute, ['numeric', 'integer'])) {
                return 'numeric';
            } else if (this._validator.hasRule(attribute, ['array'])) {
                return 'array';
            }
            return 'string';
        };

        return Translator;
    }();

    var RULES = rules;
    var LOCALE = DEFAULT_LOCALE;

    var Validator = function () {
        function Validator(data, rules$$1) {
            var _this = this;

            var customLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
            classCallCheck(this, Validator);

            this._listeners = [];
            this._rules = {};
            this._store = createStore(rootReducer, applyMiddleware(function (store) {
                return function (next) {
                    return function (action) {
                        var result = next(action);
                        _this._listeners.forEach(function (listener) {
                            return listener(action.type);
                        });
                        return result;
                    };
                };
            }));
            this._store.dispatch(setData(data || {}));
            this.setRules(rules$$1);
            this._errors = new ErrorBag(this._store);
            this._translator = new Translator(Object.assign({}, LOCALE, { customMessages: customLocale.messages || {}, customAttributes: customLocale.attributes || {} }), this);
        }

        Validator.useLocale = function useLocale(locale) {
            LOCALE = locale || DEFAULT_LOCALE;
        };

        Validator.extend = function extend(name, validate) {
            if (typeof validate !== 'function') {
                throw new TypeError('The rule [' + name + '] must be a function');
            }
            RULES[name] = validate;
        };

        Validator.prototype.isValidating = function isValidating(attribute) {
            var _store$getState = this._store.getState(),
                validating = _store$getState.validating;

            if (attribute) {
                return Boolean(validating[attribute]);
            }
            return Object.keys(validating).some(function (key) {
                return validating[key];
            });
        };

        Validator.prototype.validateAll = function validateAll() {
            var _store$getState2 = this._store.getState(),
                rules$$1 = _store$getState2.rules;

            var attributes = Object.keys(rules$$1);
            this.errors.clear();
            var promises = [];
            for (var _iterator = attributes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
                var _ref;

                if (_isArray) {
                    if (_i >= _iterator.length) break;
                    _ref = _iterator[_i++];
                } else {
                    _i = _iterator.next();
                    if (_i.done) break;
                    _ref = _i.value;
                }

                var attribute = _ref;

                promises.push(this.validate(attribute));
            }
            return Promise.all(promises).then(function (results) {
                return results.every(function (result) {
                    return result;
                });
            });
        };

        Validator.prototype.validate = function validate(attribute) {
            var _this2 = this;

            if (this.isValidating(attribute) || !this._passesOptionalCheck(attribute)) {
                return Promise.resolve(true);
            }
            this._store.dispatch(startValidate(attribute));
            if (this._errors.has(attribute)) {
                this._errors.remove(attribute);
            }

            var _store$getState3 = this._store.getState(),
                rules$$1 = _store$getState3.rules;

            var queue = [];
            for (var _iterator2 = rules$$1[attribute], _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
                var _ref2;

                if (_isArray2) {
                    if (_i2 >= _iterator2.length) break;
                    _ref2 = _iterator2[_i2++];
                } else {
                    _i2 = _iterator2.next();
                    if (_i2.done) break;
                    _ref2 = _i2.value;
                }

                var rule = _ref2;

                queue.push(function (a, r) {
                    return function (result) {
                        if (result === true) {
                            return _this2._validateRule(a, r);
                        }
                        return result;
                    };
                }(attribute, rule));
            }
            return queue.reduce(function (promise, queueFn) {
                return promise.then(queueFn);
            }, Promise.resolve(true)).then(function (result) {
                _this2._store.dispatch(stopValidate(attribute));
                return result;
            })['catch'](function (e) {
                _this2._store.dispatch(stopValidate(attribute));
                return e;
            });
        };

        Validator.prototype.setData = function setData$$1(data) {
            var _store$getState4 = this._store.getState(),
                initialRules = _store$getState4.initialRules;

            this._store.dispatch(setData(data || {}));
            this.setRules(initialRules);
            return this;
        };

        Validator.prototype.getData = function getData() {
            var _store$getState5 = this._store.getState(),
                data = _store$getState5.data;

            return data;
        };

        Validator.prototype.getValue = function getValue(attribute, defaultValue) {
            var _store$getState6 = this._store.getState(),
                data = _store$getState6.data;

            return get(data, attribute, defaultValue);
        };

        Validator.prototype.setRules = function setRules$$1(rules$$1) {
            var _store$getState7 = this._store.getState(),
                data = _store$getState7.data;

            this._store.dispatch(setRules(data, rules$$1 || {}));
            return this;
        };

        Validator.prototype.addRules = function addRules(rules$$1) {
            var _store$getState8 = this._store.getState(),
                initialRules = _store$getState8.initialRules;

            this.setRules(deepmerge_1(initialRules, rules$$1));
            return this;
        };

        Validator.prototype.getRules = function getRules() {
            var _store$getState9 = this._store.getState(),
                rules$$1 = _store$getState9.rules;

            return rules$$1;
        };

        Validator.prototype.getPrimaryAttribute = function getPrimaryAttribute(attribute) {
            var _store$getState10 = this._store.getState(),
                implicitAttributes = _store$getState10.implicitAttributes;

            for (var _iterator3 = Object.keys(implicitAttributes), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
                var _ref3;

                if (_isArray3) {
                    if (_i3 >= _iterator3.length) break;
                    _ref3 = _iterator3[_i3++];
                } else {
                    _i3 = _iterator3.next();
                    if (_i3.done) break;
                    _ref3 = _i3.value;
                }

                var unparsed = _ref3;

                if (implicitAttributes[unparsed].indexOf(attribute) > -1) {
                    return unparsed;
                }
            }
            return attribute;
        };

        Validator.prototype.subscribe = function subscribe(listener) {
            var _this3 = this;

            if (typeof listener !== 'function') {
                throw new Error('Expected listener to be a function.');
            }
            var isListener = true;
            this._listeners.push(listener);
            return function () {
                if (isListener === false) {
                    return;
                }
                isListener = false;
                var index = _this3._listeners.indexOf(listener);
                _this3._listeners.splice(index, 1);
            };
        };

        Validator.prototype.getRule = function getRule(attribute, target) {
            var _store$getState11 = this._store.getState(),
                rules$$1 = _store$getState11.rules;

            if (!(attribute in rules$$1)) {
                return null;
            }
            if (typeof target === 'string') {
                target = [target];
            }
            for (var _iterator4 = rules$$1[attribute], _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
                var _ref4;

                if (_isArray4) {
                    if (_i4 >= _iterator4.length) break;
                    _ref4 = _iterator4[_i4++];
                } else {
                    _i4 = _iterator4.next();
                    if (_i4.done) break;
                    _ref4 = _i4.value;
                }

                var rule = _ref4;
                var name = rule.name;

                if (target.indexOf(name) > -1) {
                    return rule;
                }
            }
            return null;
        };

        Validator.prototype.hasRule = function hasRule(attribute, target) {
            return this.getRule(attribute, target) !== null;
        };

        Validator.prototype.extend = function extend(name, validate) {
            if (typeof validate !== 'function') {
                throw new TypeError('The rule [' + name + '] must be a function');
            }
            this._rules[name] = validate;
            return this;
        };

        Validator.prototype.getImplicitAttributes = function getImplicitAttributes() {
            var _store$getState12 = this._store.getState(),
                implicitAttributes = _store$getState12.implicitAttributes;

            return implicitAttributes;
        };

        Validator.prototype.setCustomMessages = function setCustomMessages(messages) {
            this._translator.setCustomMessages(messages);
            return this;
        };

        Validator.prototype.addCustomMessages = function addCustomMessages(messages) {
            this._translator.addCustomMessages(messages);
            return this;
        };

        Validator.prototype.setAttributeNames = function setAttributeNames(attributes) {
            this._translator.setCustomAttributes(attributes);
            return this;
        };

        Validator.prototype.addAttributeNames = function addAttributeNames(attributes) {
            this._translator.addCustomAttributes(attributes);
            return this;
        };

        Validator.prototype._validateRule = function _validateRule(attribute, rule) {
            var _this4 = this;

            var value = this.getValue(attribute);
            var name = rule.name;

            var parameters = this._replaceAsterisksInParameters(rule, attribute);
            var validate = this._rules[name] || RULES[name];
            if (validate) {
                return Promise.resolve(validate(attribute, value, parameters, this)).then(function (result) {
                    if (result === false) {
                        var message = _this4._translator.getMessage(name, attribute, value, parameters);
                        _this4._errors.add(attribute, message);
                    }
                    return result;
                });
            }
            return Promise.reject(new Error('The rule [' + name + '] does not exist'));
        };

        Validator.prototype._passesOptionalCheck = function _passesOptionalCheck(attribute) {
            if (!this.hasRule(attribute, 'sometimes')) {
                return true;
            }
            return this.getValue(attribute, '__MISSING__') !== '__MISSING__';
        };

        Validator.prototype._replaceAsterisksInParameters = function _replaceAsterisksInParameters(rule, attribute) {
            var name = rule.name,
                parameters = rule.parameters;

            if (DEPENDENT_RULES.indexOf(name) === -1) {
                return parameters;
            }
            var pattern = escape(this.getPrimaryAttribute(attribute)).replace(/\\\*/g, '([^\.]+)');
            var regex = new RegExp('^' + pattern);
            var match = regex.exec(attribute);
            if (match) {
                match.shift();
                var keys = match.slice(0);
                return parameters.map(function (field) {
                    if (typeof field === 'string') {
                        keys.forEach(function (key) {
                            field = field.replace('*', key);
                        });
                    }
                    return field;
                });
            }
            return parameters;
        };

        createClass(Validator, [{
            key: 'errors',
            get: function get$$1() {
                return this._errors;
            }
        }]);
        return Validator;
    }();

    exports.Validator = Validator;
    exports.rules = index$u;

    Object.defineProperty(exports, '__esModule', { value: true });

})));