{"id":"../node_modules/intl-relativeformat/lib/core.js","dependencies":[{"name":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/package.json","includedInParent":true,"mtime":1533713806935},{"name":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/package.json","includedInParent":true,"mtime":1534141269544},{"name":"intl-messageformat","loc":{"line":10,"column":35},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-messageformat/index.js"},{"name":"./diff","loc":{"line":10,"column":79},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/diff.js"},{"name":"./es5","loc":{"line":10,"column":110},"parent":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/core.js","resolved":"/home/ikr/prj/stc-b2b/react-period-of-stay-input/node_modules/intl-relativeformat/lib/es5.js"}],"generated":{"js":"/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\n\n/* jslint esnext: true */\n\n\"use strict\";\nvar intl$messageformat$$ = require(\"intl-messageformat\"), src$diff$$ = require(\"./diff\"), src$es5$$ = require(\"./es5\");\nexports[\"default\"] = RelativeFormat;\n\n// -----------------------------------------------------------------------------\n\nvar FIELDS = [\n    'second', 'second-short',\n    'minute', 'minute-short',\n    'hour', 'hour-short',\n    'day', 'day-short',\n    'month', 'month-short',\n    'year', 'year-short'\n];\nvar STYLES = ['best fit', 'numeric'];\n\n// -- RelativeFormat -----------------------------------------------------------\n\nfunction RelativeFormat(locales, options) {\n    options = options || {};\n\n    // Make a copy of `locales` if it's an array, so that it doesn't change\n    // since it's used lazily.\n    if (src$es5$$.isArray(locales)) {\n        locales = locales.concat();\n    }\n\n    src$es5$$.defineProperty(this, '_locale', {value: this._resolveLocale(locales)});\n    src$es5$$.defineProperty(this, '_options', {value: {\n        style: this._resolveStyle(options.style),\n        units: this._isValidUnits(options.units) && options.units\n    }});\n\n    src$es5$$.defineProperty(this, '_locales', {value: locales});\n    src$es5$$.defineProperty(this, '_fields', {value: this._findFields(this._locale)});\n    src$es5$$.defineProperty(this, '_messages', {value: src$es5$$.objCreate(null)});\n\n    // \"Bind\" `format()` method to `this` so it can be passed by reference like\n    // the other `Intl` APIs.\n    var relativeFormat = this;\n    this.format = function format(date, options) {\n        return relativeFormat._format(date, options);\n    };\n}\n\n// Define internal private properties for dealing with locale data.\nsrc$es5$$.defineProperty(RelativeFormat, '__localeData__', {value: src$es5$$.objCreate(null)});\nsrc$es5$$.defineProperty(RelativeFormat, '__addLocaleData', {value: function (data) {\n    if (!(data && data.locale)) {\n        throw new Error(\n            'Locale data provided to IntlRelativeFormat is missing a ' +\n            '`locale` property value'\n        );\n    }\n\n    RelativeFormat.__localeData__[data.locale.toLowerCase()] = data;\n\n    // Add data to IntlMessageFormat.\n    intl$messageformat$$[\"default\"].__addLocaleData(data);\n}});\n\n// Define public `defaultLocale` property which can be set by the developer, or\n// it will be set when the first RelativeFormat instance is created by\n// leveraging the resolved locale from `Intl`.\nsrc$es5$$.defineProperty(RelativeFormat, 'defaultLocale', {\n    enumerable: true,\n    writable  : true,\n    value     : undefined\n});\n\n// Define public `thresholds` property which can be set by the developer, and\n// defaults to relative time thresholds from moment.js.\nsrc$es5$$.defineProperty(RelativeFormat, 'thresholds', {\n    enumerable: true,\n\n    value: {\n        second: 45, 'second-short': 45,  // seconds to minute\n        minute: 45, 'minute-short': 45, // minutes to hour\n        hour  : 22, 'hour-short': 22, // hours to day\n        day   : 26, 'day-short': 26, // days to month\n        month : 11, 'month-short': 11 // months to year\n    }\n});\n\nRelativeFormat.prototype.resolvedOptions = function () {\n    return {\n        locale: this._locale,\n        style : this._options.style,\n        units : this._options.units\n    };\n};\n\nRelativeFormat.prototype._compileMessage = function (units) {\n    // `this._locales` is the original set of locales the user specified to the\n    // constructor, while `this._locale` is the resolved root locale.\n    var locales        = this._locales;\n    var resolvedLocale = this._locale;\n\n    var field        = this._fields[units];\n    var relativeTime = field.relativeTime;\n    var future       = '';\n    var past         = '';\n    var i;\n\n    for (i in relativeTime.future) {\n        if (relativeTime.future.hasOwnProperty(i)) {\n            future += ' ' + i + ' {' +\n                relativeTime.future[i].replace('{0}', '#') + '}';\n        }\n    }\n\n    for (i in relativeTime.past) {\n        if (relativeTime.past.hasOwnProperty(i)) {\n            past += ' ' + i + ' {' +\n                relativeTime.past[i].replace('{0}', '#') + '}';\n        }\n    }\n\n    var message = '{when, select, future {{0, plural, ' + future + '}}' +\n                                 'past {{0, plural, ' + past + '}}}';\n\n    // Create the synthetic IntlMessageFormat instance using the original\n    // locales value specified by the user when constructing the the parent\n    // IntlRelativeFormat instance.\n    return new intl$messageformat$$[\"default\"](message, locales);\n};\n\nRelativeFormat.prototype._getMessage = function (units) {\n    var messages = this._messages;\n\n    // Create a new synthetic message based on the locale data from CLDR.\n    if (!messages[units]) {\n        messages[units] = this._compileMessage(units);\n    }\n\n    return messages[units];\n};\n\nRelativeFormat.prototype._getRelativeUnits = function (diff, units) {\n    var field = this._fields[units];\n\n    if (field.relative) {\n        return field.relative[diff];\n    }\n};\n\nRelativeFormat.prototype._findFields = function (locale) {\n    var localeData = RelativeFormat.__localeData__;\n    var data       = localeData[locale.toLowerCase()];\n\n    // The locale data is de-duplicated, so we have to traverse the locale's\n    // hierarchy until we find `fields` to return.\n    while (data) {\n        if (data.fields) {\n            return data.fields;\n        }\n\n        data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];\n    }\n\n    throw new Error(\n        'Locale data added to IntlRelativeFormat is missing `fields` for :' +\n        locale\n    );\n};\n\nRelativeFormat.prototype._format = function (date, options) {\n    var now = options && options.now !== undefined ? options.now : src$es5$$.dateNow();\n\n    if (date === undefined) {\n        date = now;\n    }\n\n    // Determine if the `date` and optional `now` values are valid, and throw a\n    // similar error to what `Intl.DateTimeFormat#format()` would throw.\n    if (!isFinite(now)) {\n        throw new RangeError(\n            'The `now` option provided to IntlRelativeFormat#format() is not ' +\n            'in valid range.'\n        );\n    }\n\n    if (!isFinite(date)) {\n        throw new RangeError(\n            'The date value provided to IntlRelativeFormat#format() is not ' +\n            'in valid range.'\n        );\n    }\n\n    var diffReport  = src$diff$$[\"default\"](now, date);\n    var units       = this._options.units || this._selectUnits(diffReport);\n    var diffInUnits = diffReport[units];\n\n    if (this._options.style !== 'numeric') {\n        var relativeUnits = this._getRelativeUnits(diffInUnits, units);\n        if (relativeUnits) {\n            return relativeUnits;\n        }\n    }\n\n    return this._getMessage(units).format({\n        '0' : Math.abs(diffInUnits),\n        when: diffInUnits < 0 ? 'past' : 'future'\n    });\n};\n\nRelativeFormat.prototype._isValidUnits = function (units) {\n    if (!units || src$es5$$.arrIndexOf.call(FIELDS, units) >= 0) {\n        return true;\n    }\n\n    if (typeof units === 'string') {\n        var suggestion = /s$/.test(units) && units.substr(0, units.length - 1);\n        if (suggestion && src$es5$$.arrIndexOf.call(FIELDS, suggestion) >= 0) {\n            throw new Error(\n                '\"' + units + '\" is not a valid IntlRelativeFormat `units` ' +\n                'value, did you mean: ' + suggestion\n            );\n        }\n    }\n\n    throw new Error(\n        '\"' + units + '\" is not a valid IntlRelativeFormat `units` value, it ' +\n        'must be one of: \"' + FIELDS.join('\", \"') + '\"'\n    );\n};\n\nRelativeFormat.prototype._resolveLocale = function (locales) {\n    if (typeof locales === 'string') {\n        locales = [locales];\n    }\n\n    // Create a copy of the array so we can push on the default locale.\n    locales = (locales || []).concat(RelativeFormat.defaultLocale);\n\n    var localeData = RelativeFormat.__localeData__;\n    var i, len, localeParts, data;\n\n    // Using the set of locales + the default locale, we look for the first one\n    // which that has been registered. When data does not exist for a locale, we\n    // traverse its ancestors to find something that's been registered within\n    // its hierarchy of locales. Since we lack the proper `parentLocale` data\n    // here, we must take a naive approach to traversal.\n    for (i = 0, len = locales.length; i < len; i += 1) {\n        localeParts = locales[i].toLowerCase().split('-');\n\n        while (localeParts.length) {\n            data = localeData[localeParts.join('-')];\n            if (data) {\n                // Return the normalized locale string; e.g., we return \"en-US\",\n                // instead of \"en-us\".\n                return data.locale;\n            }\n\n            localeParts.pop();\n        }\n    }\n\n    var defaultLocale = locales.pop();\n    throw new Error(\n        'No locale data has been added to IntlRelativeFormat for: ' +\n        locales.join(', ') + ', or the default locale: ' + defaultLocale\n    );\n};\n\nRelativeFormat.prototype._resolveStyle = function (style) {\n    // Default to \"best fit\" style.\n    if (!style) {\n        return STYLES[0];\n    }\n\n    if (src$es5$$.arrIndexOf.call(STYLES, style) >= 0) {\n        return style;\n    }\n\n    throw new Error(\n        '\"' + style + '\" is not a valid IntlRelativeFormat `style` value, it ' +\n        'must be one of: \"' + STYLES.join('\", \"') + '\"'\n    );\n};\n\nRelativeFormat.prototype._selectUnits = function (diffReport) {\n    var i, l, units;\n    var fields = FIELDS.filter(function(field) {\n        return field.indexOf('-short') < 1;\n    });\n\n    for (i = 0, l = fields.length; i < l; i += 1) {\n        units = fields[i];\n\n        if (Math.abs(diffReport[units]) < RelativeFormat.thresholds[units]) {\n            break;\n        }\n    }\n\n    return units;\n};\n\n//# sourceMappingURL=core.js.map","map":null},"hash":"5fc0593316408c64639721e940562adc","cacheData":{"env":{}}}