diff --git a/Makefile b/Makefile index 08446fa3f..e78c23d93 100644 --- a/Makefile +++ b/Makefile @@ -119,7 +119,7 @@ gems: .bundle .PHONY: clean clean: - rm -rf node_modules .bundle + rm -rf node_modules .bundle stamp-npm rm dist/*.min.js rm css/theme.min.css rm css/converse.min.css diff --git a/dist/converse-muc-embedded.js b/dist/converse-muc-embedded.js index 8880e0edf..5f60e21c1 100644 --- a/dist/converse-muc-embedded.js +++ b/dist/converse-muc-embedded.js @@ -7,16 +7,7 @@ /* jshint ignore:start */ (function (root, factory) { - if (typeof define === 'function' && define.amd) { - //Allow using this built library as an AMD module - //in another project. That other project will only - //see this AMD call, not the internal modules in - //the closure below. - define([], factory); - } else { - //Browser globals case. - root.converse = factory(); - } + root.converse = factory(); }(this, function () { //almond, and your modules will be inlined here /* jshint ignore:end */ @@ -23151,7 +23142,7 @@ return parser; })(this); //! moment.js -//! version : 2.18.1 +//! version : 2.19.4 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com @@ -23185,12 +23176,17 @@ function isObject(input) { } function isObjectEmpty(obj) { - var k; - for (k in obj) { - // even if its not own property I'd still call it non-empty - return false; + if (Object.getOwnPropertyNames) { + return (Object.getOwnPropertyNames(obj).length === 0); + } else { + var k; + for (k in obj) { + if (obj.hasOwnProperty(k)) { + return false; + } + } + return true; } - return true; } function isUndefined(input) { @@ -23284,12 +23280,10 @@ if (Array.prototype.some) { }; } -var some$1 = some; - function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m); - var parsedParts = some$1.call(flags.parsedDateParts, function (i) { + var parsedParts = some.call(flags.parsedDateParts, function (i) { return i != null; }); var isNowValid = !isNaN(m._d.getTime()) && @@ -23297,6 +23291,7 @@ function isValid(m) { !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && + !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && @@ -23562,8 +23557,6 @@ if (Object.keys) { }; } -var keys$1 = keys; - var defaultCalendar = { sameDay : '[Today at] LT', nextDay : '[Tomorrow at] LT', @@ -23689,56 +23682,6 @@ function getPrioritizedUnits(unitsObj) { return units; } -function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - set$1(this, unit, value); - hooks.updateOffset(this, keepTime); - return this; - } else { - return get(this, unit); - } - }; -} - -function get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; -} - -function set$1 (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } -} - -// MOMENTS - -function stringGet (units) { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](); - } - return this; -} - - -function stringSet (units, value) { - if (typeof units === 'object') { - units = normalizeObjectUnits(units); - var prioritized = getPrioritizedUnits(units); - for (var i = 0; i < prioritized.length; i++) { - this[prioritized[i].unit](units[prioritized[i].unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; -} - function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, @@ -23859,7 +23802,7 @@ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 // any word (or two) characters or numbers including two/three word month in arabic. // includes scottish gaelic two word and hyphenated months -var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; +var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; var regexes = {}; @@ -23929,6 +23872,131 @@ var MILLISECOND = 6; var WEEK = 7; var WEEKDAY = 8; +// FORMATTING + +addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? '' + y : '+' + y; +}); + +addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; +}); + +addFormatToken(0, ['YYYY', 4], 0, 'year'); +addFormatToken(0, ['YYYYY', 5], 0, 'year'); +addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + +// ALIASES + +addUnitAlias('year', 'y'); + +// PRIORITIES + +addUnitPriority('year', 1); + +// PARSING + +addRegexToken('Y', matchSigned); +addRegexToken('YY', match1to2, match2); +addRegexToken('YYYY', match1to4, match4); +addRegexToken('YYYYY', match1to6, match6); +addRegexToken('YYYYYY', match1to6, match6); + +addParseToken(['YYYYY', 'YYYYYY'], YEAR); +addParseToken('YYYY', function (input, array) { + array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); +}); +addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); +}); +addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); +}); + +// HELPERS + +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} + +function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +} + +// HOOKS + +hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); +}; + +// MOMENTS + +var getSetYear = makeGetSet('FullYear', true); + +function getIsLeapYear () { + return isLeapYear(this.year()); +} + +function makeGetSet (unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; +} + +function get (mom, unit) { + return mom.isValid() ? + mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; +} + +function set$1 (mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); + } + else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } +} + +// MOMENTS + +function stringGet (units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; +} + + +function stringSet (units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units); + for (var i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; +} + +function mod(n, x) { + return ((n % x) + x) % x; +} + var indexOf; if (Array.prototype.indexOf) { @@ -23946,10 +24014,13 @@ if (Array.prototype.indexOf) { }; } -var indexOf$1 = indexOf; - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); } // FORMATTING @@ -24038,26 +24109,26 @@ function handleStrictParse(monthName, format, strict) { if (strict) { if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); + ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { - ii = indexOf$1.call(this._longMonthsParse, llc); + ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); + ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._longMonthsParse, llc); + ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { - ii = indexOf$1.call(this._longMonthsParse, llc); + ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._shortMonthsParse, llc); + ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } @@ -24216,72 +24287,6 @@ function computeMonthsParse () { this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); } -// FORMATTING - -addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; -}); - -addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; -}); - -addFormatToken(0, ['YYYY', 4], 0, 'year'); -addFormatToken(0, ['YYYYY', 5], 0, 'year'); -addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - -// ALIASES - -addUnitAlias('year', 'y'); - -// PRIORITIES - -addUnitPriority('year', 1); - -// PARSING - -addRegexToken('Y', matchSigned); -addRegexToken('YY', match1to2, match2); -addRegexToken('YYYY', match1to4, match4); -addRegexToken('YYYYY', match1to6, match6); -addRegexToken('YYYYYY', match1to6, match6); - -addParseToken(['YYYYY', 'YYYYYY'], YEAR); -addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); -}); -addParseToken('YY', function (input, array) { - array[YEAR] = hooks.parseTwoDigitYear(input); -}); -addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); -}); - -// HELPERS - -function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; -} - -function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -} - -// HOOKS - -hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); -}; - -// MOMENTS - -var getSetYear = makeGetSet('FullYear', true); - -function getIsLeapYear () { - return isLeapYear(this.year()); -} - function createDate (y, m, d, h, M, s, ms) { // can't just apply() to create a date: // https://stackoverflow.com/q/181348 @@ -24549,48 +24554,48 @@ function handleStrictParse$1(weekdayName, format, strict) { if (strict) { if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); + ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); + ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); + ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); + ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); + ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._minWeekdaysParse, llc); + ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); + ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._weekdaysParse, llc); + ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._minWeekdaysParse, llc); + ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); + ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._weekdaysParse, llc); + ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); + ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } @@ -24979,11 +24984,10 @@ function loadLocale(name) { module && module.exports) { try { oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales + var aliasedRequire = require; + aliasedRequire('./locale/' + name); getSetGlobalLocale(oldLocale); - } catch (e) { } + } catch (e) {} } return locales[name]; } @@ -25059,10 +25063,11 @@ function defineLocale (name, config) { function updateLocale(name, config) { if (config != null) { - var locale, parentConfig = baseConfig; + var locale, tmpLocale, parentConfig = baseConfig; // MERGE - if (locales[name] != null) { - parentConfig = locales[name]._config; + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); locale = new Locale(config); @@ -25109,7 +25114,7 @@ function getLocale (key) { } function listLocales() { - return keys$1(locales); + return keys(locales); } function checkOverflow (m) { @@ -25142,6 +25147,156 @@ function checkOverflow (m) { return m; } +// Pick the first defined of two or three arguments. +function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; +} + +function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; +} + +// convert an array to a date. +// the array should mirror the parameters below +// note: all values past the year are optional and will default to the lowest possible value. +// [year, month, day , hour, minute, second, millisecond] +function configFromArray (config) { + var i, date, input = [], currentDate, expectedWeekday, yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if (config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); + + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { + getParsingFlags(config).weekdayMismatch = true; + } +} + +function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + var curWeek = weekOfYear(createLocal(), dow, doy); + + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to begining of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } +} + // iso 8601 regex // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; @@ -25233,70 +25388,94 @@ function configFromISO(config) { } // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 -var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/; +var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; + +function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10) + ]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; +} + +function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim(); +} + +function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; +} + +var obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; + +function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10); + var m = hm % 100, h = (hm - m) / 100; + return h * 60 + m; + } +} // date and time from ref 2822 format function configFromRFC2822(config) { - var string, match, dayFormat, - dateFormat, timeFormat, tzFormat; - var timezones = { - ' GMT': ' +0000', - ' EDT': ' -0400', - ' EST': ' -0500', - ' CDT': ' -0500', - ' CST': ' -0600', - ' MDT': ' -0600', - ' MST': ' -0700', - ' PDT': ' -0700', - ' PST': ' -0800' - }; - var military = 'YXWVUTSRQPONZABCDEFGHIKLM'; - var timezone, timezoneIndex; - - string = config._i - .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace - .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space - .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces - match = basicRfcRegex.exec(string); - + var match = rfc2822.exec(preprocessRFC2822(config._i)); if (match) { - dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : ''; - dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY '); - timeFormat = 'HH:mm' + (match[4] ? ':ss' : ''); - - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. - if (match[1]) { // day of week given - var momentDate = new Date(match[2]); - var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()]; - - if (match[1].substr(0,3) !== momentDay) { - getParsingFlags(config).weekdayMismatch = true; - config._isValid = false; - return; - } + var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); + if (!checkWeekday(match[1], parsedArray, config)) { + return; } - switch (match[5].length) { - case 2: // military - if (timezoneIndex === 0) { - timezone = ' +0000'; - } else { - timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; - timezone = ((timezoneIndex < 0) ? ' -' : ' +') + - (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; - } - break; - case 4: // Zone - timezone = timezones[match[5]]; - break; - default: // UT or +/-9999 - timezone = timezones[' GMT']; - } - match[5] = timezone; - config._i = match.splice(1).join(''); - tzFormat = ' ZZ'; - config._f = dayFormat + dateFormat + timeFormat + tzFormat; - configFromStringAndFormat(config); + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; @@ -25340,149 +25519,6 @@ hooks.createFromInputFallback = deprecate( } ); -// Pick the first defined of two or three arguments. -function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; -} - -function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; -} - -// convert an array to a date. -// the array should mirror the parameters below -// note: all values past the year are optional and will default to the lowest possible value. -// [year, month, day , hour, minute, second, millisecond] -function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear != null) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } -} - -function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - var curWeek = weekOfYear(createLocal(), dow, doy); - - weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); - - // Default to current week. - week = defaults(w.w, curWeek.week); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } -} - // constant that refers to the ISO standard hooks.ISO_8601 = function () {}; @@ -25807,7 +25843,7 @@ var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'se function isDurationValid(m) { for (var key in m) { - if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { + if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { return false; } } @@ -25858,7 +25894,7 @@ function Duration (duration) { // day when working around DST, we need to store them separately this._days = +days + weeks * 7; - // It is impossible translate months into days without knowing + // It is impossible to translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = +months + @@ -26105,12 +26141,12 @@ function isUtc () { } // ASP.NET json date format regex -var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; +var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere // and further modified to allow for strings containing both week and day -var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; +var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration (input, key) { var duration = input, @@ -26144,7 +26180,7 @@ function createDuration (input, key) { ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; + sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), @@ -26247,14 +26283,14 @@ function addSubtract (mom, duration, isAdding, updateOffset) { updateOffset = updateOffset == null ? true : updateOffset; - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); } if (days) { set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } - if (months) { - setMonth(mom, get(mom, 'Month') + months * isAdding); + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days || months); @@ -26364,22 +26400,18 @@ function diff (input, units, asFloat) { units = normalizeUnits(units); - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; + switch (units) { + case 'year': output = monthDiff(this, that) / 12; break; + case 'month': output = monthDiff(this, that); break; + case 'quarter': output = monthDiff(this, that) / 3; break; + case 'second': output = (this - that) / 1e3; break; // 1000 + case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 + case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 + case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst + case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: output = this - that; } + return asFloat ? output : absFloor(output); } @@ -26779,7 +26811,7 @@ addRegexToken('Do', function (isStrict, locale) { addParseToken(['D', 'DD'], DATE); addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); + array[DATE] = toInt(input.match(match1to2)[0]); }); // MOMENTS @@ -27357,6 +27389,10 @@ var asWeeks = makeAs('w'); var asMonths = makeAs('M'); var asYears = makeAs('y'); +function clone$1 () { + return createDuration(this); +} + function get$2 (units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; @@ -27466,6 +27502,10 @@ function humanize (withSuffix) { var abs$1 = Math.abs; +function sign(x) { + return ((x > 0) - (x < 0)) || +x; +} + function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours @@ -27500,7 +27540,7 @@ function toISOString$1() { var D = days; var h = hours; var m = minutes; - var s = seconds; + var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; var total = this.asSeconds(); if (!total) { @@ -27509,15 +27549,19 @@ function toISOString$1() { return 'P0D'; } - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + + var totalSign = total < 0 ? '-' : ''; + var ymSign = sign(this._months) !== sign(total) ? '-' : ''; + var daysSign = sign(this._days) !== sign(total) ? '-' : ''; + var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return totalSign + 'P' + + (Y ? ymSign + Y + 'Y' : '') + + (M ? ymSign + M + 'M' : '') + + (D ? daysSign + D + 'D' : '') + ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); + (h ? hmsSign + h + 'H' : '') + + (m ? hmsSign + m + 'M' : '') + + (s ? hmsSign + s + 'S' : ''); } var proto$2 = Duration.prototype; @@ -27537,6 +27581,7 @@ proto$2.asMonths = asMonths; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; +proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; @@ -27578,7 +27623,7 @@ addParseToken('x', function (input, array, config) { // Side effect imports -hooks.version = '2.18.1'; +hooks.version = '2.19.4'; setHookCallback(createLocal); @@ -27605,7 +27650,7 @@ hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; -hooks.relativeTimeRounding = getSetRelativeTimeRounding; +hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; @@ -27690,6 +27735,149 @@ return af; }))); +//! moment.js locale configuration +//! locale : Arabic [ar] +//! author : Abdel Said: https://github.com/abdelsaid +//! author : Ahmed Elkhatib +//! author : forabi https://github.com/forabi + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define('moment/locale/ar',['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + +var symbolMap = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠' +}; +var numberMap = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0' +}; +var pluralForm = function (n) { + return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; +}; +var plurals = { + s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], + m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], + h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], + d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], + M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], + y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] +}; +var pluralize = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm(number), + str = plurals[u][pluralForm(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; +}; +var months = [ + 'كانون الثاني يناير', + 'شباط فبراير', + 'آذار مارس', + 'نيسان أبريل', + 'أيار مايو', + 'حزيران يونيو', + 'تموز يوليو', + 'آب أغسطس', + 'أيلول سبتمبر', + 'تشرين الأول أكتوبر', + 'تشرين الثاني نوفمبر', + 'كانون الأول ديسمبر' +]; + +var ar = moment.defineLocale('ar', { + months : months, + monthsShort : months, + weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact : true, + longDateFormat : { + LT : 'HH:mm', + LTS : 'HH:mm:ss', + L : 'D/\u200FM/\u200FYYYY', + LL : 'D MMMM YYYY', + LLL : 'D MMMM YYYY HH:mm', + LLLL : 'dddd D MMMM YYYY HH:mm' + }, + meridiemParse: /ص|م/, + isPM : function (input) { + return 'م' === input; + }, + meridiem : function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar : { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L' + }, + relativeTime : { + future : 'بعد %s', + past : 'منذ %s', + s : pluralize('s'), + m : pluralize('m'), + mm : pluralize('m'), + h : pluralize('h'), + hh : pluralize('h'), + d : pluralize('d'), + dd : pluralize('d'), + M : pluralize('M'), + MM : pluralize('M'), + y : pluralize('y'), + yy : pluralize('y') + }, + preparse: function (string) { + return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap[match]; + }).replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap[match]; + }).replace(/,/g, '،'); + }, + week : { + dow : 6, // Saturday is the first day of the week. + doy : 12 // The week that contains Jan 1st is the first week of the year. + } +}); + +return ar; + +}))); + //! moment.js locale configuration //! locale : Bulgarian [bg] //! author : Krasen Borisov : https://github.com/kraz @@ -27803,17 +27991,17 @@ var ca = moment.defineLocale('ca', { monthsParseExact : true, weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), + weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'), weekdaysParseExact : true, longDateFormat : { LT : 'H:mm', LTS : 'H:mm:ss', L : 'DD/MM/YYYY', - LL : '[el] D MMMM [de] YYYY', + LL : 'D MMMM [de] YYYY', ll : 'D MMM YYYY', - LLL : '[el] D MMMM [de] YYYY [a les] H:mm', + LLL : 'D MMMM [de] YYYY [a les] H:mm', lll : 'D MMM YYYY, H:mm', - LLLL : '[el] dddd D MMMM [de] YYYY [a les] H:mm', + LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm', llll : 'ddd D MMM YYYY, H:mm' }, calendar : { @@ -27900,7 +28088,7 @@ function processRelativeTime(number, withoutSuffix, key, isFuture) { var de = moment.defineLocale('de', { months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), + monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), monthsParseExact : true, weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), @@ -27964,6 +28152,9 @@ return de; var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'); var monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); +var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; +var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + var es = moment.defineLocale('es', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), monthsShort : function (m, format) { @@ -27975,7 +28166,13 @@ var es = moment.defineLocale('es', { return monthsShortDot[m.month()]; } }, - monthsParseExact : true, + monthsRegex : monthsRegex, + monthsShortRegex : monthsRegex, + monthsStrictRegex : /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex : /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse : monthsParse, + longMonthsParse : monthsParse, + shortMonthsParse : monthsParse, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), @@ -28231,8 +28428,7 @@ return he; var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); function translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; + var num = number; switch (key) { case 's': return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; @@ -28669,7 +28865,7 @@ var nl = moment.defineLocale('nl', { weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'), + weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'), weekdaysParseExact : true, longDateFormat : { LT : 'HH:mm', @@ -28781,7 +28977,24 @@ var pl = moment.defineLocale('pl', { calendar : { sameDay: '[Dziś o] LT', nextDay: '[Jutro o] LT', - nextWeek: '[W] dddd [o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[W niedzielę o] LT'; + + case 2: + return '[We wtorek o] LT'; + + case 3: + return '[W środę o] LT'; + + case 6: + return '[W sobotę o] LT'; + + default: + return '[W] dddd [o] LT'; + } + }, lastDay: '[Wczoraj o] LT', lastWeek: function () { switch (this.day()) { @@ -28837,8 +29050,8 @@ return pl; var ptBr = moment.defineLocale('pt-br', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), + months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'), + monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), @@ -28867,6 +29080,7 @@ var ptBr = moment.defineLocale('pt-br', { future : 'em %s', past : '%s atrás', s : 'poucos segundos', + ss : '%d segundos', m : 'um minuto', mm : '%d minutos', h : 'uma hora', @@ -29062,7 +29276,7 @@ var ru = moment.defineLocale('ru', { }, week : { dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. + doy : 4 // The week that contains Jan 4th is the first week of the year. } }); @@ -29121,9 +29335,9 @@ var tr = moment.defineLocale('tr', { calendar : { sameDay : '[bugün saat] LT', nextDay : '[yarın saat] LT', - nextWeek : '[haftaya] dddd [saat] LT', + nextWeek : '[gelecek] dddd [saat] LT', lastDay : '[dün] LT', - lastWeek : '[geçen hafta] dddd [saat] LT', + lastWeek : '[geçen] dddd [saat] LT', sameElse : 'L' }, relativeTime : { @@ -29530,6 +29744,8 @@ return zhTw; }))); + + // Converse.js (A browser based XMPP chat client) // http://conversejs.org // @@ -29541,8 +29757,8 @@ return zhTw; /*global define */ (function (root, factory) { - define('i18n',["es6-promise", "jed", "lodash.noconflict", "moment", 'moment/locale/af', 'moment/locale/bg', 'moment/locale/ca', 'moment/locale/de', 'moment/locale/es', 'moment/locale/fr', 'moment/locale/he', 'moment/locale/hu', 'moment/locale/id', 'moment/locale/it', 'moment/locale/ja', 'moment/locale/nb', 'moment/locale/nl', 'moment/locale/pl', 'moment/locale/pt-br', 'moment/locale/ru', 'moment/locale/tr', 'moment/locale/uk', 'moment/locale/zh-cn', 'moment/locale/zh-tw'], factory); -})(this, function (Promise, Jed, _, moment) { + define('i18n',["es6-promise", "jed", "lodash.noconflict", "moment", 'moment/locale/af', 'moment/locale/ar', 'moment/locale/bg', 'moment/locale/ca', 'moment/locale/de', 'moment/locale/es', 'moment/locale/fr', 'moment/locale/he', 'moment/locale/hu', 'moment/locale/id', 'moment/locale/it', 'moment/locale/ja', 'moment/locale/nb', 'moment/locale/nl', 'moment/locale/pl', 'moment/locale/pt-br', 'moment/locale/ru', 'moment/locale/tr', 'moment/locale/uk', 'moment/locale/zh-cn', 'moment/locale/zh-tw'], factory); +})(void 0, function (Promise, Jed, _, moment) { 'use strict'; function detectLocale(library_check) { @@ -36016,6 +36232,8 @@ require(["strophe-polyfill"]); })); /* jshint ignore:end */ ; + + function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } // Converse.js (A browser based XMPP chat client) @@ -36030,7 +36248,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat /*global define, escape, window */ (function (root, factory) { define('utils',["sizzle", "es6-promise", "lodash.noconflict", "strophe"], factory); -})(this, function (sizzle, Promise, _, Strophe) { +})(void 0, function (sizzle, Promise, _, Strophe) { "use strict"; var b64_sha1 = Strophe.SHA1.b64_sha1; @@ -36171,6 +36389,16 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return el; }; + u.ancestor = function (el, selector) { + var parent = el; + + while (!_.isNil(parent) && !sizzle.matchesSelector(parent, selector)) { + parent = parent.parentElement; + } + + return parent; + }; + u.nextUntil = function (el, selector) { var include_self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; @@ -39419,6 +39647,8 @@ Backbone.sync = function(method, model, options) { return Backbone.BrowserStorage; })); + + // Converse.js (A browser based XMPP chat client) // http://conversejs.org // @@ -39429,7 +39659,7 @@ return Backbone.BrowserStorage; /*global Backbone, define, window, JSON */ (function (root, factory) { define('converse-core',["sizzle", "es6-promise", "lodash.noconflict", "lodash.fp", "polyfill", "i18n", "utils", "moment", "strophe", "pluggable", "backbone.noconflict", "backbone.nativeview", "backbone.browserStorage"], factory); -})(this, function (sizzle, Promise, _, f, polyfill, i18n, u, moment, Strophe, pluggable, Backbone) { +})(void 0, function (sizzle, Promise, _, f, polyfill, i18n, u, moment, Strophe, pluggable, Backbone) { /* Cannot use this due to Safari bug. * See https://github.com/jcbrand/converse.js/issues/196 */ @@ -39475,9 +39705,10 @@ return Backbone.BrowserStorage; 'promises': {} }; - _.extend(_converse, Backbone.Events); + _.extend(_converse, Backbone.Events); // Core plugins are whitelisted automatically - _converse.core_plugins = ['converse-bookmarks', 'converse-chatboxes', 'converse-chatview', 'converse-controlbox', 'converse-core', 'converse-disco', 'converse-dragresize', 'converse-fullscreen', 'converse-headline', 'converse-mam', 'converse-minimize', 'converse-muc', 'converse-muc-embedded', 'converse-notification', 'converse-otr', 'converse-ping', 'converse-profile', 'converse-register', 'converse-roomslist', 'converse-rosterview', 'converse-singleton', 'converse-spoilers', 'converse-vcard']; // Make converse pluggable + + _converse.core_plugins = ['converse-bookmarks', 'converse-chatboxes', 'converse-chatview', 'converse-controlbox', 'converse-core', 'converse-disco', 'converse-dragresize', 'converse-dropdown', 'converse-fullscreen', 'converse-headline', 'converse-mam', 'converse-minimize', 'converse-modal', 'converse-muc', 'converse-muc-embedded', 'converse-muc-views', 'converse-notification', 'converse-otr', 'converse-ping', 'converse-profile', 'converse-register', 'converse-roomslist', 'converse-rosterview', 'converse-singleton', 'converse-spoilers', 'converse-vcard']; // Make converse pluggable pluggable.enable(_converse, '_converse', 'pluggable'); // Module-level constants @@ -39707,7 +39938,7 @@ return Backbone.BrowserStorage; jid: undefined, keepalive: true, locales_url: 'locale/{{{locale}}}/LC_MESSAGES/converse.json', - locales: ['af', 'bg', 'ca', 'de', 'es', 'en', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'nb', 'nl', 'pl', 'pt_BR', 'ru', 'tr', 'uk', 'zh_CN', 'zh_TW'], + locales: ['af', 'ar', 'bg', 'ca', 'de', 'es', 'en', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'nb', 'nl', 'pl', 'pt_BR', 'ru', 'tr', 'uk', 'zh_CN', 'zh_TW'], message_carbons: true, message_storage: 'session', password: undefined, @@ -39726,9 +39957,7 @@ return Backbone.BrowserStorage; view_mode: 'overlayed', // Choices are 'overlayed', 'fullscreen', 'mobile' websocket_url: undefined, - whitelisted_plugins: [], - xhr_custom_status: false, - xhr_custom_status_url: '' + whitelisted_plugins: [] }; _.assignIn(this, this.default_settings); // Allow only whitelisted configuration attributes to be overwritten @@ -39808,7 +40037,7 @@ return Backbone.BrowserStorage; _converse.auto_changed_status = false; // XXX: we should really remember the original state here, and // then set it back to that... - _converse.xmppstatus.setStatus(_converse.default_state); + _converse.xmppstatus.set('status', _converse.default_state); } }; @@ -39822,7 +40051,7 @@ return Backbone.BrowserStorage; return; } - var stat = _converse.xmppstatus.getStatus(); + var stat = _converse.xmppstatus.get('status'); _converse.idle_seconds++; @@ -39833,11 +40062,11 @@ return Backbone.BrowserStorage; if (_converse.auto_away > 0 && _converse.idle_seconds > _converse.auto_away && stat !== 'away' && stat !== 'xa' && stat !== 'dnd') { _converse.auto_changed_status = true; - _converse.xmppstatus.setStatus('away'); + _converse.xmppstatus.set('status', 'away'); } else if (_converse.auto_xa > 0 && _converse.idle_seconds > _converse.auto_xa && stat !== 'xa' && stat !== 'dnd') { _converse.auto_changed_status = true; - _converse.xmppstatus.setStatus('xa'); + _converse.xmppstatus.set('status', 'xa'); } }; @@ -40052,9 +40281,14 @@ return Backbone.BrowserStorage; } }; - this.initStatus = function () { - return new Promise(function (resolve, reject) { - var promise = new u.getResolveablePromise(); + this.initStatus = function (reconnecting) { + // If there's no xmppstatus obj, then we were never connected to + // begin with, so we set reconnecting to false. + reconnecting = _.isUndefined(_converse.xmppstatus) ? false : reconnecting; + + if (reconnecting) { + _converse.onStatusInitialized(reconnecting); + } else { _this.xmppstatus = new _this.XMPPStatus(); var id = b64_sha1("converse.xmppstatus-".concat(_converse.bare_jid)); _this.xmppstatus.id = id; // Appears to be necessary for backbone.browserStorage @@ -40062,12 +40296,10 @@ return Backbone.BrowserStorage; _this.xmppstatus.browserStorage = new Backbone.BrowserStorage[_converse.storage](id); _this.xmppstatus.fetch({ - success: resolve, - error: resolve + success: _.partial(_converse.onStatusInitialized, reconnecting), + error: _.partial(_converse.onStatusInitialized, reconnecting) }); - - _converse.emit('statusInitialized'); - }); + } }; this.initSession = function () { @@ -40280,6 +40512,8 @@ return Backbone.BrowserStorage; * populating the roster etc.) necessary once the connection has * been established. */ + _converse.emit('statusInitialized'); + if (reconnecting) { // No need to recreate the roster, otherwise we lose our // cached data. However we still emit an event, to give @@ -40298,10 +40532,14 @@ return Backbone.BrowserStorage; _converse.registerPresenceHandler(); - if (!reconnecting) { + if (reconnecting) { + _converse.emit('reconnected'); + } else { init_promise.resolve(); _converse.emit('initialized'); + + _converse.emit('connected'); } }; @@ -40316,29 +40554,16 @@ return Backbone.BrowserStorage; /* Called as soon as a new connection has been established, either * by logging in or by attaching to an existing BOSH session. */ - // Solves problem of returned PubSub BOSH response not received - // by browser. - _converse.connection.flush(); + _converse.connection.flush(); // Solves problem of returned PubSub BOSH response not received by browser + _converse.setUserJid(); _converse.initSession(); - _converse.enableCarbons(); // If there's no xmppstatus obj, then we were never connected to - // begin with, so we set reconnecting to false. + _converse.enableCarbons(); - - reconnecting = _.isUndefined(_converse.xmppstatus) ? false : reconnecting; - - if (reconnecting) { - _converse.onStatusInitialized(true); - - _converse.emit('reconnected'); - } else { - _converse.initStatus().then(_.partial(_converse.onStatusInitialized, false), _.partial(_converse.onStatusInitialized, false)).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)); - - _converse.emit('connected'); - } + _converse.initStatus(reconnecting); }; this.RosterContact = Backbone.Model.extend({ @@ -41013,20 +41238,29 @@ return Backbone.BrowserStorage; }); this.connfeedback = new this.ConnectionFeedback(); this.XMPPStatus = Backbone.Model.extend({ + defaults: function defaults() { + return { + "status": _converse.default_state, + "jid": _converse.bare_jid, + "vcard_updated": null + }; + }, initialize: function initialize() { var _this8 = this; - this.set({ - 'status': this.getStatus() - }); - this.on('change', function (item) { - if (_.has(item.changed, 'status')) { - _converse.emit('statusChanged', _this8.get('status')); - } + this.on('change:status', function (item) { + var status = _this8.get('status'); - if (_.has(item.changed, 'status_message')) { - _converse.emit('statusMessageChanged', _this8.get('status_message')); - } + _this8.sendPresence(status); + + _converse.emit('statusChanged', status); + }); + this.on('change:status_message', function () { + var status_message = _this8.get('status_message'); + + _this8.sendPresence(_this8.get('status'), status_message); + + _converse.emit('statusMessageChanged', status_message); }); }, constructPresence: function constructPresence(type, status_message) { @@ -41058,36 +41292,6 @@ return Backbone.BrowserStorage; }, sendPresence: function sendPresence(type, status_message) { _converse.connection.send(this.constructPresence(type, status_message)); - }, - setStatus: function setStatus(value) { - this.sendPresence(value); - this.save({ - 'status': value - }); - }, - getStatus: function getStatus() { - return this.get('status') || _converse.default_state; - }, - setStatusMessage: function setStatusMessage(status_message) { - this.sendPresence(this.getStatus(), status_message); - this.save({ - 'status_message': status_message - }); - - if (this.xhr_custom_status) { - var xhr = new XMLHttpRequest(); - xhr.open('POST', this.xhr_custom_status_url, true); - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); - xhr.send({ - 'msg': status_message - }); - } - - var prev_status = this.get('status_message'); - - if (prev_status === status_message) { - this.trigger("update-status-ui", this); - } } }); @@ -41499,23 +41703,17 @@ return Backbone.BrowserStorage; }, 'contacts': { 'get': function get(jids) { - var _transform = function _transform(jid) { - var contact = _converse.roster.get(Strophe.getBareJidFromJid(jid)); - - if (contact) { - return contact.attributes; - } - - return null; + var _getter = function _getter(jid) { + return _converse.roster.get(Strophe.getBareJidFromJid(jid)) || null; }; if (_.isUndefined(jids)) { jids = _converse.roster.pluck('jid'); } else if (_.isString(jids)) { - return _transform(jids); + return _getter(jids); } - return _.map(jids, _transform); + return _.map(jids, _getter); }, 'add': function add(jid, name) { if (!_.isString(jid) || !_.includes(jid, '@')) { @@ -41602,727 +41800,1782 @@ return Backbone.BrowserStorage; return window.converse; }); //# sourceMappingURL=converse-core.js.map; -/*! - * Backbone.Overview - * - * Copyright (c) 2018, JC Brand - * Licensed under the Mozilla Public License (MPL) - */ +// Native Javascript for Bootstrap 4 v2.0.21 | © dnp_theme | MIT-License (function (root, factory) { if (typeof define === 'function' && define.amd) { - define('backbone.overview',["underscore", "backbone"], factory); + // AMD support: + define('bootstrap',[], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like: + module.exports = factory(); } else { - // RequireJS isn't being used. - // Assume underscore and backbone are loaded in