diff --git a/.eslintignore b/.eslintignore index 5c4b73d8a682..162cc816ea80 100644 --- a/.eslintignore +++ b/.eslintignore @@ -12,3 +12,4 @@ docs/assets/** web/gtm.js **/.expo/** src/libs/SearchParser/searchParser.js +help/_scripts/** diff --git a/.github/ISSUE_TEMPLATE/Standard.md b/.github/ISSUE_TEMPLATE/Standard.md index 663c6004a534..fa50d48b341b 100644 --- a/.github/ISSUE_TEMPLATE/Standard.md +++ b/.github/ISSUE_TEMPLATE/Standard.md @@ -10,6 +10,7 @@ ___ **Version Number:** **Reproducible in staging?:** **Reproducible in production?:** +**If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:** **If this was caught during regression testing, add the test name, ID and link from TestRail:** **Email or phone of affected tester (no customers):** **Logs:** https://stackoverflow.com/c/expensify/questions/4856 @@ -34,9 +35,11 @@ Can the user still use Expensify without this being fixed? Have you informed the Check off any platforms that are affected by this issue ---> Which of our officially supported platforms is this issue occurring on? -- [ ] Android: Native +- [ ] Android: Standalone +- [ ] Android: HybridApp - [ ] Android: mWeb Chrome -- [ ] iOS: Native +- [ ] iOS: Standalone +- [ ] iOS: HybridApp - [ ] iOS: mWeb Safari - [ ] MacOS: Chrome / Safari - [ ] MacOS: Desktop diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts b/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts index 1964b143146d..69a4a9f8511f 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts @@ -1,5 +1,5 @@ import * as core from '@actions/core'; -import format from 'date-fns/format'; +import {format} from 'date-fns/format'; import fs from 'fs'; import CONST from '@github/libs/CONST'; import GithubUtils from '@github/libs/GithubUtils'; diff --git a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js index 1b7cccb730ff..58b743ca9058 100644 --- a/.github/actions/javascript/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/javascript/createOrUpdateStagingDeploy/index.js @@ -6439,5371 +6439,2616 @@ function removeHook(state, name, method) { /***/ }), -/***/ 8620: -/***/ ((module, exports) => { +/***/ 8932: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = addLeadingZeros; -function addLeadingZeros(number, targetLength) { - var sign = number < 0 ? '-' : ''; - var output = Math.abs(number).toString(); - while (output.length < targetLength) { - output = '0' + output; - } - return sign + output; -} -module.exports = exports.default; +Object.defineProperty(exports, "__esModule", ({ value: true })); -/***/ }), +class Deprecation extends Error { + constructor(message) { + super(message); // Maintains proper stack trace (only available on V8) -/***/ 618: -/***/ ((module, exports, __nccwpck_require__) => { + /* istanbul ignore next */ -"use strict"; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + this.name = 'Deprecation'; + } + +} + +exports.Deprecation = Deprecation; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(1773)); -var _default = _index.default; -exports["default"] = _default; -module.exports = exports.default; /***/ }), -/***/ 9307: +/***/ 3287: /***/ ((__unused_webpack_module, exports) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.getDefaultOptions = getDefaultOptions; -exports.setDefaultOptions = setDefaultOptions; -var defaultOptions = {}; -function getDefaultOptions() { - return defaultOptions; +Object.defineProperty(exports, "__esModule", ({ value: true })); + +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +function isObject(o) { + return Object.prototype.toString.call(o) === '[object Object]'; } -function setDefaultOptions(newOptions) { - defaultOptions = newOptions; + +function isPlainObject(o) { + var ctor,prot; + + if (isObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (ctor === undefined) return true; + + // If has modified prototype + prot = ctor.prototype; + if (isObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; } +exports.isPlainObject = isPlainObject; + + /***/ }), -/***/ 9257: +/***/ 467: /***/ ((module, exports, __nccwpck_require__) => { "use strict"; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(2966)); -var _index2 = _interopRequireDefault(__nccwpck_require__(8493)); -var _index3 = _interopRequireDefault(__nccwpck_require__(7170)); -var _index4 = _interopRequireDefault(__nccwpck_require__(8761)); -var _index5 = _interopRequireDefault(__nccwpck_require__(8050)); -var _index6 = _interopRequireDefault(__nccwpck_require__(8620)); -var _index7 = _interopRequireDefault(__nccwpck_require__(289)); -var dayPeriodEnum = { - am: 'am', - pm: 'pm', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' -}; -/* - * | | Unit | | Unit | - * |-----|--------------------------------|-----|--------------------------------| - * | a | AM, PM | A* | Milliseconds in day | - * | b | AM, PM, noon, midnight | B | Flexible day period | - * | c | Stand-alone local day of week | C* | Localized hour w/ day period | - * | d | Day of month | D | Day of year | - * | e | Local day of week | E | Day of week | - * | f | | F* | Day of week in month | - * | g* | Modified Julian day | G | Era | - * | h | Hour [1-12] | H | Hour [0-23] | - * | i! | ISO day of week | I! | ISO week of year | - * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | - * | k | Hour [1-24] | K | Hour [0-11] | - * | l* | (deprecated) | L | Stand-alone month | - * | m | Minute | M | Month | - * | n | | N | | - * | o! | Ordinal number modifier | O | Timezone (GMT) | - * | p! | Long localized time | P! | Long localized date | - * | q | Stand-alone quarter | Q | Quarter | - * | r* | Related Gregorian year | R! | ISO week-numbering year | - * | s | Second | S | Fraction of second | - * | t! | Seconds timestamp | T! | Milliseconds timestamp | - * | u | Extended year | U* | Cyclic year | - * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | - * | w | Local week of year | W* | Week of month | - * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | - * | y | Year (abs) | Y | Local week-numbering year | - * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | - * - * Letters marked by * are not implemented but reserved by Unicode standard. - * - * Letters marked by ! are non-standard, but implemented by date-fns: - * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) - * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, - * i.e. 7 for Sunday, 1 for Monday, etc. - * - `I` is ISO week of year, as opposed to `w` which is local week of year. - * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. - * `R` is supposed to be used in conjunction with `I` and `i` - * for universal ISO week-numbering date, whereas - * `Y` is supposed to be used in conjunction with `w` and `e` - * for week-numbering date specific to the locale. - * - `P` is long localized date format - * - `p` is long localized time format - */ +Object.defineProperty(exports, "__esModule", ({ value: true })); -var formatters = { - // Era - G: function G(date, token, localize) { - var era = date.getUTCFullYear() > 0 ? 1 : 0; - switch (token) { - // AD, BC - case 'G': - case 'GG': - case 'GGG': - return localize.era(era, { - width: 'abbreviated' - }); - // A, B - case 'GGGGG': - return localize.era(era, { - width: 'narrow' - }); - // Anno Domini, Before Christ - case 'GGGG': - default: - return localize.era(era, { - width: 'wide' - }); - } - }, - // Year - y: function y(date, token, localize) { - // Ordinal number - if (token === 'yo') { - var signedYear = date.getUTCFullYear(); - // Returns 1 for 1 BC (which is year 0 in JavaScript) - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return localize.ordinalNumber(year, { - unit: 'year' - }); - } - return _index7.default.y(date, token); - }, - // Local week-numbering year - Y: function Y(date, token, localize, options) { - var signedWeekYear = (0, _index5.default)(date, options); - // Returns 1 for 1 BC (which is year 0 in JavaScript) - var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - // Two digit year - if (token === 'YY') { - var twoDigitYear = weekYear % 100; - return (0, _index6.default)(twoDigitYear, 2); - } +var Stream = _interopDefault(__nccwpck_require__(2781)); +var http = _interopDefault(__nccwpck_require__(3685)); +var Url = _interopDefault(__nccwpck_require__(7310)); +var whatwgUrl = _interopDefault(__nccwpck_require__(3323)); +var https = _interopDefault(__nccwpck_require__(5687)); +var zlib = _interopDefault(__nccwpck_require__(9796)); - // Ordinal number - if (token === 'Yo') { - return localize.ordinalNumber(weekYear, { - unit: 'year' - }); - } +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - // Padding - return (0, _index6.default)(weekYear, token.length); - }, - // ISO week-numbering year - R: function R(date, token) { - var isoWeekYear = (0, _index3.default)(date); +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; - // Padding - return (0, _index6.default)(isoWeekYear, token.length); - }, - // Extended year. This is a single number designating the year of this calendar system. - // The main difference between `y` and `u` localizers are B.C. years: - // | Year | `y` | `u` | - // |------|-----|-----| - // | AC 1 | 1 | 1 | - // | BC 1 | 1 | 0 | - // | BC 2 | 2 | -1 | - // Also `yy` always returns the last two digits of a year, - // while `uu` pads single digit years to 2 characters and returns other years unchanged. - u: function u(date, token) { - var year = date.getUTCFullYear(); - return (0, _index6.default)(year, token.length); - }, - // Quarter - Q: function Q(date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - switch (token) { - // 1, 2, 3, 4 - case 'Q': - return String(quarter); - // 01, 02, 03, 04 - case 'QQ': - return (0, _index6.default)(quarter, 2); - // 1st, 2nd, 3rd, 4th - case 'Qo': - return localize.ordinalNumber(quarter, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - case 'QQQ': - return localize.quarter(quarter, { - width: 'abbreviated', - context: 'formatting' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - case 'QQQQQ': - return localize.quarter(quarter, { - width: 'narrow', - context: 'formatting' - }); - // 1st quarter, 2nd quarter, ... - case 'QQQQ': - default: - return localize.quarter(quarter, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone quarter - q: function q(date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - switch (token) { - // 1, 2, 3, 4 - case 'q': - return String(quarter); - // 01, 02, 03, 04 - case 'qq': - return (0, _index6.default)(quarter, 2); - // 1st, 2nd, 3rd, 4th - case 'qo': - return localize.ordinalNumber(quarter, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - case 'qqq': - return localize.quarter(quarter, { - width: 'abbreviated', - context: 'standalone' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - case 'qqqqq': - return localize.quarter(quarter, { - width: 'narrow', - context: 'standalone' - }); - // 1st quarter, 2nd quarter, ... - case 'qqqq': - default: - return localize.quarter(quarter, { - width: 'wide', - context: 'standalone' - }); - } - }, - // Month - M: function M(date, token, localize) { - var month = date.getUTCMonth(); - switch (token) { - case 'M': - case 'MM': - return _index7.default.M(date, token); - // 1st, 2nd, ..., 12th - case 'Mo': - return localize.ordinalNumber(month + 1, { - unit: 'month' - }); - // Jan, Feb, ..., Dec - case 'MMM': - return localize.month(month, { - width: 'abbreviated', - context: 'formatting' - }); - // J, F, ..., D - case 'MMMMM': - return localize.month(month, { - width: 'narrow', - context: 'formatting' - }); - // January, February, ..., December - case 'MMMM': - default: - return localize.month(month, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone month - L: function L(date, token, localize) { - var month = date.getUTCMonth(); - switch (token) { - // 1, 2, ..., 12 - case 'L': - return String(month + 1); - // 01, 02, ..., 12 - case 'LL': - return (0, _index6.default)(month + 1, 2); - // 1st, 2nd, ..., 12th - case 'Lo': - return localize.ordinalNumber(month + 1, { - unit: 'month' - }); - // Jan, Feb, ..., Dec - case 'LLL': - return localize.month(month, { - width: 'abbreviated', - context: 'standalone' - }); - // J, F, ..., D - case 'LLLLL': - return localize.month(month, { - width: 'narrow', - context: 'standalone' - }); - // January, February, ..., December - case 'LLLL': - default: - return localize.month(month, { - width: 'wide', - context: 'standalone' - }); - } - }, - // Local week of year - w: function w(date, token, localize, options) { - var week = (0, _index4.default)(date, options); - if (token === 'wo') { - return localize.ordinalNumber(week, { - unit: 'week' - }); - } - return (0, _index6.default)(week, token.length); - }, - // ISO week of year - I: function I(date, token, localize) { - var isoWeek = (0, _index2.default)(date); - if (token === 'Io') { - return localize.ordinalNumber(isoWeek, { - unit: 'week' - }); - } - return (0, _index6.default)(isoWeek, token.length); - }, - // Day of the month - d: function d(date, token, localize) { - if (token === 'do') { - return localize.ordinalNumber(date.getUTCDate(), { - unit: 'date' - }); - } - return _index7.default.d(date, token); - }, - // Day of year - D: function D(date, token, localize) { - var dayOfYear = (0, _index.default)(date); - if (token === 'Do') { - return localize.ordinalNumber(dayOfYear, { - unit: 'dayOfYear' - }); - } - return (0, _index6.default)(dayOfYear, token.length); - }, - // Day of week - E: function E(date, token, localize) { - var dayOfWeek = date.getUTCDay(); - switch (token) { - // Tue - case 'E': - case 'EE': - case 'EEE': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - case 'EEEEE': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - case 'EEEEEE': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - case 'EEEE': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Local day of week - e: function e(date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - switch (token) { - // Numerical value (Nth day of week with current locale or weekStartsOn) - case 'e': - return String(localDayOfWeek); - // Padded numerical value - case 'ee': - return (0, _index6.default)(localDayOfWeek, 2); - // 1st, 2nd, ..., 7th - case 'eo': - return localize.ordinalNumber(localDayOfWeek, { - unit: 'day' - }); - case 'eee': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - case 'eeeee': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - case 'eeeeee': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - case 'eeee': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone local day of week - c: function c(date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - switch (token) { - // Numerical value (same as in `e`) - case 'c': - return String(localDayOfWeek); - // Padded numerical value - case 'cc': - return (0, _index6.default)(localDayOfWeek, token.length); - // 1st, 2nd, ..., 7th - case 'co': - return localize.ordinalNumber(localDayOfWeek, { - unit: 'day' - }); - case 'ccc': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'standalone' - }); - // T - case 'ccccc': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'standalone' - }); - // Tu - case 'cccccc': - return localize.day(dayOfWeek, { - width: 'short', - context: 'standalone' - }); - // Tuesday - case 'cccc': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'standalone' - }); - } - }, - // ISO day of week - i: function i(date, token, localize) { - var dayOfWeek = date.getUTCDay(); - var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; - switch (token) { - // 2 - case 'i': - return String(isoDayOfWeek); - // 02 - case 'ii': - return (0, _index6.default)(isoDayOfWeek, token.length); - // 2nd - case 'io': - return localize.ordinalNumber(isoDayOfWeek, { - unit: 'day' - }); - // Tue - case 'iii': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - case 'iiiii': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - case 'iiiiii': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - case 'iiii': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // AM or PM - a: function a(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; - switch (token) { - case 'a': - case 'aa': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - case 'aaa': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }).toLowerCase(); - case 'aaaaa': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - case 'aaaa': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // AM, PM, midnight, noon - b: function b(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - if (hours === 12) { - dayPeriodEnumValue = dayPeriodEnum.noon; - } else if (hours === 0) { - dayPeriodEnumValue = dayPeriodEnum.midnight; - } else { - dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; - } - switch (token) { - case 'b': - case 'bb': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - case 'bbb': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }).toLowerCase(); - case 'bbbbb': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - case 'bbbb': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // in the morning, in the afternoon, in the evening, at night - B: function B(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - if (hours >= 17) { - dayPeriodEnumValue = dayPeriodEnum.evening; - } else if (hours >= 12) { - dayPeriodEnumValue = dayPeriodEnum.afternoon; - } else if (hours >= 4) { - dayPeriodEnumValue = dayPeriodEnum.morning; - } else { - dayPeriodEnumValue = dayPeriodEnum.night; - } - switch (token) { - case 'B': - case 'BB': - case 'BBB': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - case 'BBBBB': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - case 'BBBB': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Hour [1-12] - h: function h(date, token, localize) { - if (token === 'ho') { - var hours = date.getUTCHours() % 12; - if (hours === 0) hours = 12; - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - return _index7.default.h(date, token); - }, - // Hour [0-23] - H: function H(date, token, localize) { - if (token === 'Ho') { - return localize.ordinalNumber(date.getUTCHours(), { - unit: 'hour' - }); - } - return _index7.default.H(date, token); - }, - // Hour [0-11] - K: function K(date, token, localize) { - var hours = date.getUTCHours() % 12; - if (token === 'Ko') { - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - return (0, _index6.default)(hours, token.length); - }, - // Hour [1-24] - k: function k(date, token, localize) { - var hours = date.getUTCHours(); - if (hours === 0) hours = 24; - if (token === 'ko') { - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - return (0, _index6.default)(hours, token.length); - }, - // Minute - m: function m(date, token, localize) { - if (token === 'mo') { - return localize.ordinalNumber(date.getUTCMinutes(), { - unit: 'minute' - }); - } - return _index7.default.m(date, token); - }, - // Second - s: function s(date, token, localize) { - if (token === 'so') { - return localize.ordinalNumber(date.getUTCSeconds(), { - unit: 'second' - }); - } - return _index7.default.s(date, token); - }, - // Fraction of second - S: function S(date, token) { - return _index7.default.S(date, token); - }, - // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) - X: function X(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - if (timezoneOffset === 0) { - return 'Z'; - } - switch (token) { - // Hours and optional minutes - case 'X': - return formatTimezoneWithOptionalMinutes(timezoneOffset); - - // Hours, minutes and optional seconds without `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `XX` - case 'XXXX': - case 'XX': - // Hours and minutes without `:` delimiter - return formatTimezone(timezoneOffset); - - // Hours, minutes and optional seconds with `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `XXX` - case 'XXXXX': - case 'XXX': // Hours and minutes with `:` delimiter - default: - return formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) - x: function x(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - // Hours and optional minutes - case 'x': - return formatTimezoneWithOptionalMinutes(timezoneOffset); - - // Hours, minutes and optional seconds without `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `xx` - case 'xxxx': - case 'xx': - // Hours and minutes without `:` delimiter - return formatTimezone(timezoneOffset); - - // Hours, minutes and optional seconds with `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `xxx` - case 'xxxxx': - case 'xxx': // Hours and minutes with `:` delimiter - default: - return formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (GMT) - O: function O(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - // Short - case 'O': - case 'OO': - case 'OOO': - return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); - // Long - case 'OOOO': - default: - return 'GMT' + formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (specific non-location) - z: function z(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - // Short - case 'z': - case 'zz': - case 'zzz': - return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); - // Long - case 'zzzz': - default: - return 'GMT' + formatTimezone(timezoneOffset, ':'); - } - }, - // Seconds timestamp - t: function t(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = Math.floor(originalDate.getTime() / 1000); - return (0, _index6.default)(timestamp, token.length); - }, - // Milliseconds timestamp - T: function T(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = originalDate.getTime(); - return (0, _index6.default)(timestamp, token.length); - } -}; -function formatTimezoneShort(offset, dirtyDelimiter) { - var sign = offset > 0 ? '-' : '+'; - var absOffset = Math.abs(offset); - var hours = Math.floor(absOffset / 60); - var minutes = absOffset % 60; - if (minutes === 0) { - return sign + String(hours); - } - var delimiter = dirtyDelimiter || ''; - return sign + String(hours) + delimiter + (0, _index6.default)(minutes, 2); -} -function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { - if (offset % 60 === 0) { - var sign = offset > 0 ? '-' : '+'; - return sign + (0, _index6.default)(Math.abs(offset) / 60, 2); - } - return formatTimezone(offset, dirtyDelimiter); -} -function formatTimezone(offset, dirtyDelimiter) { - var delimiter = dirtyDelimiter || ''; - var sign = offset > 0 ? '-' : '+'; - var absOffset = Math.abs(offset); - var hours = (0, _index6.default)(Math.floor(absOffset / 60), 2); - var minutes = (0, _index6.default)(absOffset % 60, 2); - return sign + hours + delimiter + minutes; -} -var _default = formatters; -exports["default"] = _default; -module.exports = exports.default; - -/***/ }), +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); -/***/ 289: -/***/ ((module, exports, __nccwpck_require__) => { +class Blob { + constructor() { + this[TYPE] = ''; -"use strict"; + const blobParts = arguments[0]; + const options = arguments[1]; + const buffers = []; + let size = 0; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(8620)); -/* - * | | Unit | | Unit | - * |-----|--------------------------------|-----|--------------------------------| - * | a | AM, PM | A* | | - * | d | Day of month | D | | - * | h | Hour [1-12] | H | Hour [0-23] | - * | m | Minute | M | Month | - * | s | Second | S | Fraction of second | - * | y | Year (abs) | Y | | - * - * Letters marked by * are not implemented but reserved by Unicode standard. - */ - -var formatters = { - // Year - y: function y(date, token) { - // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens - // | Year | y | yy | yyy | yyyy | yyyyy | - // |----------|-------|----|-------|-------|-------| - // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | - // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | - // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | - // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | - // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | - - var signedYear = date.getUTCFullYear(); - // Returns 1 for 1 BC (which is year 0 in JavaScript) - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return (0, _index.default)(token === 'yy' ? year % 100 : year, token.length); - }, - // Month - M: function M(date, token) { - var month = date.getUTCMonth(); - return token === 'M' ? String(month + 1) : (0, _index.default)(month + 1, 2); - }, - // Day of the month - d: function d(date, token) { - return (0, _index.default)(date.getUTCDate(), token.length); - }, - // AM or PM - a: function a(date, token) { - var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am'; - switch (token) { - case 'a': - case 'aa': - return dayPeriodEnumValue.toUpperCase(); - case 'aaa': - return dayPeriodEnumValue; - case 'aaaaa': - return dayPeriodEnumValue[0]; - case 'aaaa': - default: - return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.'; - } - }, - // Hour [1-12] - h: function h(date, token) { - return (0, _index.default)(date.getUTCHours() % 12 || 12, token.length); - }, - // Hour [0-23] - H: function H(date, token) { - return (0, _index.default)(date.getUTCHours(), token.length); - }, - // Minute - m: function m(date, token) { - return (0, _index.default)(date.getUTCMinutes(), token.length); - }, - // Second - s: function s(date, token) { - return (0, _index.default)(date.getUTCSeconds(), token.length); - }, - // Fraction of second - S: function S(date, token) { - var numberOfDigits = token.length; - var milliseconds = date.getUTCMilliseconds(); - var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); - return (0, _index.default)(fractionalSeconds, token.length); - } -}; -var _default = formatters; -exports["default"] = _default; -module.exports = exports.default; - -/***/ }), - -/***/ 8387: -/***/ ((module, exports) => { - -"use strict"; + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + this[BUFFER] = Buffer.concat(buffers); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var dateLongFormatter = function dateLongFormatter(pattern, formatLong) { - switch (pattern) { - case 'P': - return formatLong.date({ - width: 'short' - }); - case 'PP': - return formatLong.date({ - width: 'medium' - }); - case 'PPP': - return formatLong.date({ - width: 'long' - }); - case 'PPPP': - default: - return formatLong.date({ - width: 'full' - }); - } -}; -var timeLongFormatter = function timeLongFormatter(pattern, formatLong) { - switch (pattern) { - case 'p': - return formatLong.time({ - width: 'short' - }); - case 'pp': - return formatLong.time({ - width: 'medium' - }); - case 'ppp': - return formatLong.time({ - width: 'long' - }); - case 'pppp': - default: - return formatLong.time({ - width: 'full' - }); - } -}; -var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) { - var matchResult = pattern.match(/(P+)(p+)?/) || []; - var datePattern = matchResult[1]; - var timePattern = matchResult[2]; - if (!timePattern) { - return dateLongFormatter(pattern, formatLong); - } - var dateTimeFormat; - switch (datePattern) { - case 'P': - dateTimeFormat = formatLong.dateTime({ - width: 'short' - }); - break; - case 'PP': - dateTimeFormat = formatLong.dateTime({ - width: 'medium' - }); - break; - case 'PPP': - dateTimeFormat = formatLong.dateTime({ - width: 'long' - }); - break; - case 'PPPP': - default: - dateTimeFormat = formatLong.dateTime({ - width: 'full' - }); - break; - } - return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong)); -}; -var longFormatters = { - p: timeLongFormatter, - P: dateTimeLongFormatter -}; -var _default = longFormatters; -exports["default"] = _default; -module.exports = exports.default; + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; -/***/ }), + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); -/***/ 7032: -/***/ ((module, exports) => { + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} -"use strict"; +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getTimezoneOffsetInMilliseconds; /** - * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. - * They usually appear for dates that denote time before the timezones were introduced - * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 - * and GMT+01:00:00 after that date) - * - * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, - * which would lead to incorrect calculations. + * fetch-error.js * - * This function returns the timezone offset in milliseconds that takes seconds in account. + * FetchError interface for operational errors */ -function getTimezoneOffsetInMilliseconds(date) { - var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())); - utcDate.setUTCFullYear(date.getFullYear()); - return date.getTime() - utcDate.getTime(); -} -module.exports = exports.default; - -/***/ }), - -/***/ 2966: -/***/ ((module, exports, __nccwpck_require__) => { - -"use strict"; +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getUTCDayOfYear; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -var MILLISECONDS_IN_DAY = 86400000; -function getUTCDayOfYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - 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; + this.message = message; + this.type = type; -/***/ }), + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } -/***/ 8493: -/***/ ((module, exports, __nccwpck_require__) => { + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} -"use strict"; +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; +let convert; +try { + convert = (__nccwpck_require__(3975).convert); +} catch (e) {} -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getUTCISOWeek; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(3061)); -var _index3 = _interopRequireDefault(__nccwpck_require__(1478)); -var _index4 = _interopRequireDefault(__nccwpck_require__(2063)); -var MILLISECONDS_IN_WEEK = 604800000; -function getUTCISOWeek(dirtyDate) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index2.default)(date).getTime() - (0, _index3.default)(date).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; +const INTERNALS = Symbol('Body internals'); -/***/ }), +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; -/***/ 7170: -/***/ ((module, exports, __nccwpck_require__) => { +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; -"use strict"; + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getUTCISOWeekYear; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -var _index3 = _interopRequireDefault(__nccwpck_require__(3061)); -function getUTCISOWeekYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getUTCFullYear(); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = (0, _index3.default)(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = new Date(0); - fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = (0, _index3.default)(fourthOfJanuaryOfThisYear); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} -module.exports = exports.default; + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; -/***/ }), + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} -/***/ 8761: -/***/ ((module, exports, __nccwpck_require__) => { +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, -"use strict"; + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getUTCWeek; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2258)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2629)); -var _index4 = _interopRequireDefault(__nccwpck_require__(2063)); -var MILLISECONDS_IN_WEEK = 604800000; -function getUTCWeek(dirtyDate, options) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index2.default)(date, options).getTime() - (0, _index3.default)(date, options).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; + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, -/***/ }), + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; -/***/ 8050: -/***/ ((module, exports, __nccwpck_require__) => { + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, -"use strict"; + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = getUTCWeekYear; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2258)); -var _index4 = _interopRequireDefault(__nccwpck_require__(1985)); -var _index5 = __nccwpck_require__(9307); -function getUTCWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getUTCFullYear(); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - - // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - var firstWeekOfNextYear = new Date(0); - firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = (0, _index3.default)(firstWeekOfNextYear, options); - var firstWeekOfThisYear = new Date(0); - firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = (0, _index3.default)(firstWeekOfThisYear, options); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} -module.exports = exports.default; + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; -/***/ }), + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; -/***/ 2509: -/***/ ((__unused_webpack_module, exports) => { +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); -"use strict"; +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.isProtectedDayOfYearToken = isProtectedDayOfYearToken; -exports.isProtectedWeekYearToken = isProtectedWeekYearToken; -exports.throwProtectedError = throwProtectedError; -var protectedDayOfYearTokens = ['D', 'DD']; -var protectedWeekYearTokens = ['YY', 'YYYY']; -function isProtectedDayOfYearToken(token) { - return protectedDayOfYearTokens.indexOf(token) !== -1; -} -function isProtectedWeekYearToken(token) { - return protectedWeekYearTokens.indexOf(token) !== -1; -} -function throwProtectedError(token, format, input) { - if (token === 'YYYY') { - throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === 'YY') { - throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === 'D') { - throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === 'DD') { - throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } -} + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } -/***/ }), + this[INTERNALS].disturbed = true; -/***/ 2063: -/***/ ((module, exports) => { + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } -"use strict"; + let body = this.body; + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = requiredArgs; -function requiredArgs(required, args) { - if (args.length < required) { - throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present'); - } -} -module.exports = exports.default; + // body is blob + if (isBlob(body)) { + body = body.stream(); + } -/***/ }), + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } -/***/ 3061: -/***/ ((module, exports, __nccwpck_require__) => { + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } -"use strict"; + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + return new Body.Promise(function (resolve, reject) { + let resTimeout; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = startOfUTCISOWeek; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -function startOfUTCISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - var weekStartsOn = 1; - var date = (0, _index.default)(dirtyDate); - 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; + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } -/***/ }), + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); -/***/ 1478: -/***/ ((module, exports, __nccwpck_require__) => { + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } -"use strict"; + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + accumBytes += chunk.length; + accum.push(chunk); + }); -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = startOfUTCISOWeekYear; -var _index = _interopRequireDefault(__nccwpck_require__(7170)); -var _index2 = _interopRequireDefault(__nccwpck_require__(3061)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2063)); -function startOfUTCISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var year = (0, _index.default)(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setUTCFullYear(year, 0, 4); - fourthOfJanuary.setUTCHours(0, 0, 0, 0); - var date = (0, _index2.default)(fourthOfJanuary); - return date; -} -module.exports = exports.default; + body.on('end', function () { + if (abort) { + return; + } -/***/ }), + clearTimeout(resTimeout); -/***/ 2258: -/***/ ((module, exports, __nccwpck_require__) => { + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} -"use strict"; +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = startOfUTCWeek; -var _index = _interopRequireDefault(__nccwpck_require__(6477)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -var _index3 = _interopRequireDefault(__nccwpck_require__(1985)); -var _index4 = __nccwpck_require__(9307); -function startOfUTCWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(1, arguments); - var defaultOptions = (0, _index4.getDefaultOptions)(); - var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - - // 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, _index.default)(dirtyDate); - 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; + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } -/***/ }), + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); -/***/ 2629: -/***/ ((module, exports, __nccwpck_require__) => { + // html5 + if (!res && str) { + res = / { + // prevent decode issues when sites use incorrect encoding + // ref: https://hsivonen.fi/encoding-menu/ + if (charset === 'gb2312' || charset === 'gbk') { + charset = 'gb18030'; + } + } -"use strict"; + // turn raw buffers into a single utf-8 buffer + return convert(buffer, 'UTF-8', charset).toString(); +} +/** + * Detect a URLSearchParams object + * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143 + * + * @param Object obj Object to detect by type or brand + * @return String + */ +function isURLSearchParams(obj) { + // Duck-typing as a necessary condition. + if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') { + return false; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = toInteger; -function toInteger(dirtyNumber) { - if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { - return NaN; - } - var number = Number(dirtyNumber); - if (isNaN(number)) { - return number; - } - return number < 0 ? Math.ceil(number) : Math.floor(number); + // Brand-checking and more duck-typing as optional condition. + return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function'; } -module.exports = exports.default; -/***/ }), +/** + * Check if `obj` is a W3C `Blob` object (which `File` inherits from) + * @param {*} obj + * @return {boolean} + */ +function isBlob(obj) { + return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]); +} -/***/ 524: -/***/ ((module, exports, __nccwpck_require__) => { +/** + * Clone body given Res/Req instance + * + * @param Mixed instance Response or Request instance + * @return Mixed + */ +function clone(instance) { + let p1, p2; + let body = instance.body; -"use strict"; + // don't allow cloning a used body + if (instance.bodyUsed) { + throw new Error('cannot clone body after it is used'); + } + + // check that body is a stream and not form-data object + // note: we can't clone the form-data object without having it as a dependency + if (body instanceof Stream && typeof body.getBoundary !== 'function') { + // tee instance body + p1 = new PassThrough(); + p2 = new PassThrough(); + body.pipe(p1); + body.pipe(p2); + // set instance body to teed body and return the other teed body + instance[INTERNALS].body = p1; + body = p2; + } + return body; +} -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = addMilliseconds; -var _index = _interopRequireDefault(__nccwpck_require__(1985)); -var _index2 = _interopRequireDefault(__nccwpck_require__(6477)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2063)); /** - * @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. + * Performs the operation "extract a `Content-Type` value from |object|" as + * specified in the specification: + * https://fetch.spec.whatwg.org/#concept-bodyinit-extract * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`. - * @returns {Date} the new date with the milliseconds added - * @throws {TypeError} 2 arguments required + * This function assumes that instance.body is present. * - * @example - * // Add 750 milliseconds to 10 July 2014 12:45:30.000: - * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750) - * //=> Thu Jul 10 2014 12:45:30.750 + * @param Mixed instance Any options.body input */ -function addMilliseconds(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var timestamp = (0, _index2.default)(dirtyDate).getTime(); - var amount = (0, _index.default)(dirtyAmount); - return new Date(timestamp + amount); +function extractContentType(body) { + if (body === null) { + // body is null + return null; + } else if (typeof body === 'string') { + // body is string + return 'text/plain;charset=UTF-8'; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + return 'application/x-www-form-urlencoded;charset=UTF-8'; + } else if (isBlob(body)) { + // body is blob + return body.type || null; + } else if (Buffer.isBuffer(body)) { + // body is buffer + return null; + } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + return null; + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + return null; + } else if (typeof body.getBoundary === 'function') { + // detect form data input from form-data module + return `multipart/form-data;boundary=${body.getBoundary()}`; + } else if (body instanceof Stream) { + // body is stream + // can't really do much about this + return null; + } else { + // Body constructor defaults other things to string + return 'text/plain;charset=UTF-8'; + } } -module.exports = exports.default; - -/***/ }), - -/***/ 2168: -/***/ ((module, exports, __nccwpck_require__) => { - -"use strict"; +/** + * The Fetch Standard treats this as if "total bytes" is a property on the body. + * For us, we have to explicitly get it with a function. + * + * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes + * + * @param Body instance Instance of Body + * @return Number? Number of bytes, or null if not possible + */ +function getTotalBytes(instance) { + const body = instance.body; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = format; -var _index = _interopRequireDefault(__nccwpck_require__(9920)); -var _index2 = _interopRequireDefault(__nccwpck_require__(7923)); -var _index3 = _interopRequireDefault(__nccwpck_require__(6477)); -var _index4 = _interopRequireDefault(__nccwpck_require__(9257)); -var _index5 = _interopRequireDefault(__nccwpck_require__(8387)); -var _index6 = _interopRequireDefault(__nccwpck_require__(7032)); -var _index7 = __nccwpck_require__(2509); -var _index8 = _interopRequireDefault(__nccwpck_require__(1985)); -var _index9 = _interopRequireDefault(__nccwpck_require__(2063)); -var _index10 = __nccwpck_require__(9307); -var _index11 = _interopRequireDefault(__nccwpck_require__(618)); -// This RegExp consists of three parts separated by `|`: -// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token -// (one of the certain letters followed by `o`) -// - (\w)\1* matches any sequences of the same letter -// - '' matches two quote characters in a row -// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), -// except a single quote symbol, which ends the sequence. -// Two quote characters do not end the sequence. -// If there is no matching single quote -// then the sequence will continue until the end of the string. -// - . matches any single character unmatched by previous parts of the RegExps -var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; -// This RegExp catches symbols escaped by quotes, and also -// sequences of symbols P, p, and the combinations like `PPPPPPPppppp` -var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; -var escapedStringRegExp = /^'([^]*?)'?$/; -var doubleQuoteRegExp = /''/g; -var unescapedLatinCharacterRegExp = /[a-zA-Z]/; + if (body === null) { + // body is null + return 0; + } else if (isBlob(body)) { + return body.size; + } else if (Buffer.isBuffer(body)) { + // body is buffer + return body.length; + } else if (body && typeof body.getLengthSync === 'function') { + // detect form data input from form-data module + if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x + body.hasKnownLength && body.hasKnownLength()) { + // 2.x + return body.getLengthSync(); + } + return null; + } else { + // body is stream + return null; + } +} /** - * @name format - * @category Common Helpers - * @summary Format the date. - * - * @description - * Return the formatted date string in the given format. The result may vary by locale. - * - * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries. - * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * - * The characters wrapped between two single quotes characters (') are escaped. - * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. - * (see the last example) + * Write a Body to a Node.js WritableStream (e.g. http.Request) object. * - * Format of the string is based on Unicode Technical Standard #35: - * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table - * with a few additions (see note 7 below the table). - * - * Accepted patterns: - * | Unit | Pattern | Result examples | Notes | - * |---------------------------------|---------|-----------------------------------|-------| - * | Era | G..GGG | AD, BC | | - * | | GGGG | Anno Domini, Before Christ | 2 | - * | | GGGGG | A, B | | - * | Calendar year | y | 44, 1, 1900, 2017 | 5 | - * | | yo | 44th, 1st, 0th, 17th | 5,7 | - * | | yy | 44, 01, 00, 17 | 5 | - * | | yyy | 044, 001, 1900, 2017 | 5 | - * | | yyyy | 0044, 0001, 1900, 2017 | 5 | - * | | yyyyy | ... | 3,5 | - * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | - * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | - * | | YY | 44, 01, 00, 17 | 5,8 | - * | | YYY | 044, 001, 1900, 2017 | 5 | - * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | - * | | YYYYY | ... | 3,5 | - * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | - * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | - * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | - * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | - * | | RRRRR | ... | 3,5,7 | - * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | - * | | uu | -43, 01, 1900, 2017 | 5 | - * | | uuu | -043, 001, 1900, 2017 | 5 | - * | | uuuu | -0043, 0001, 1900, 2017 | 5 | - * | | uuuuu | ... | 3,5 | - * | Quarter (formatting) | Q | 1, 2, 3, 4 | | - * | | Qo | 1st, 2nd, 3rd, 4th | 7 | - * | | QQ | 01, 02, 03, 04 | | - * | | QQQ | Q1, Q2, Q3, Q4 | | - * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | - * | | QQQQQ | 1, 2, 3, 4 | 4 | - * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | - * | | qo | 1st, 2nd, 3rd, 4th | 7 | - * | | qq | 01, 02, 03, 04 | | - * | | qqq | Q1, Q2, Q3, Q4 | | - * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | - * | | qqqqq | 1, 2, 3, 4 | 4 | - * | Month (formatting) | M | 1, 2, ..., 12 | | - * | | Mo | 1st, 2nd, ..., 12th | 7 | - * | | MM | 01, 02, ..., 12 | | - * | | MMM | Jan, Feb, ..., Dec | | - * | | MMMM | January, February, ..., December | 2 | - * | | MMMMM | J, F, ..., D | | - * | Month (stand-alone) | L | 1, 2, ..., 12 | | - * | | Lo | 1st, 2nd, ..., 12th | 7 | - * | | LL | 01, 02, ..., 12 | | - * | | LLL | Jan, Feb, ..., Dec | | - * | | LLLL | January, February, ..., December | 2 | - * | | LLLLL | J, F, ..., D | | - * | Local week of year | w | 1, 2, ..., 53 | | - * | | wo | 1st, 2nd, ..., 53th | 7 | - * | | ww | 01, 02, ..., 53 | | - * | ISO week of year | I | 1, 2, ..., 53 | 7 | - * | | Io | 1st, 2nd, ..., 53th | 7 | - * | | II | 01, 02, ..., 53 | 7 | - * | Day of month | d | 1, 2, ..., 31 | | - * | | do | 1st, 2nd, ..., 31st | 7 | - * | | dd | 01, 02, ..., 31 | | - * | Day of year | D | 1, 2, ..., 365, 366 | 9 | - * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | - * | | DD | 01, 02, ..., 365, 366 | 9 | - * | | DDD | 001, 002, ..., 365, 366 | | - * | | DDDD | ... | 3 | - * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | | - * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | - * | | EEEEE | M, T, W, T, F, S, S | | - * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | | - * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | - * | | io | 1st, 2nd, ..., 7th | 7 | - * | | ii | 01, 02, ..., 07 | 7 | - * | | iii | Mon, Tue, Wed, ..., Sun | 7 | - * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | - * | | iiiii | M, T, W, T, F, S, S | 7 | - * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 | - * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | - * | | eo | 2nd, 3rd, ..., 1st | 7 | - * | | ee | 02, 03, ..., 01 | | - * | | eee | Mon, Tue, Wed, ..., Sun | | - * | | eeee | Monday, Tuesday, ..., Sunday | 2 | - * | | eeeee | M, T, W, T, F, S, S | | - * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | | - * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | - * | | co | 2nd, 3rd, ..., 1st | 7 | - * | | cc | 02, 03, ..., 01 | | - * | | ccc | Mon, Tue, Wed, ..., Sun | | - * | | cccc | Monday, Tuesday, ..., Sunday | 2 | - * | | ccccc | M, T, W, T, F, S, S | | - * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | | - * | AM, PM | a..aa | AM, PM | | - * | | aaa | am, pm | | - * | | aaaa | a.m., p.m. | 2 | - * | | aaaaa | a, p | | - * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | | - * | | bbb | am, pm, noon, midnight | | - * | | bbbb | a.m., p.m., noon, midnight | 2 | - * | | bbbbb | a, p, n, mi | | - * | Flexible day period | B..BBB | at night, in the morning, ... | | - * | | BBBB | at night, in the morning, ... | 2 | - * | | BBBBB | at night, in the morning, ... | | - * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | - * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | - * | | hh | 01, 02, ..., 11, 12 | | - * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | - * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | - * | | HH | 00, 01, 02, ..., 23 | | - * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | - * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | - * | | KK | 01, 02, ..., 11, 00 | | - * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | - * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | - * | | kk | 24, 01, 02, ..., 23 | | - * | Minute | m | 0, 1, ..., 59 | | - * | | mo | 0th, 1st, ..., 59th | 7 | - * | | mm | 00, 01, ..., 59 | | - * | Second | s | 0, 1, ..., 59 | | - * | | so | 0th, 1st, ..., 59th | 7 | - * | | ss | 00, 01, ..., 59 | | - * | Fraction of second | S | 0, 1, ..., 9 | | - * | | SS | 00, 01, ..., 99 | | - * | | SSS | 000, 001, ..., 999 | | - * | | SSSS | ... | 3 | - * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | - * | | XX | -0800, +0530, Z | | - * | | XXX | -08:00, +05:30, Z | | - * | | XXXX | -0800, +0530, Z, +123456 | 2 | - * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | - * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | - * | | xx | -0800, +0530, +0000 | | - * | | xxx | -08:00, +05:30, +00:00 | 2 | - * | | xxxx | -0800, +0530, +0000, +123456 | | - * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | - * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | - * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | - * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | - * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | - * | Seconds timestamp | t | 512969520 | 7 | - * | | tt | ... | 3,7 | - * | Milliseconds timestamp | T | 512969520900 | 7 | - * | | TT | ... | 3,7 | - * | Long localized date | P | 04/29/1453 | 7 | - * | | PP | Apr 29, 1453 | 7 | - * | | PPP | April 29th, 1453 | 7 | - * | | PPPP | Friday, April 29th, 1453 | 2,7 | - * | Long localized time | p | 12:00 AM | 7 | - * | | pp | 12:00:00 AM | 7 | - * | | ppp | 12:00:00 AM GMT+2 | 7 | - * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | - * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 | - * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 | - * | | PPPppp | April 29th, 1453 at ... | 7 | - * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 | - * Notes: - * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale - * are the same as "stand-alone" units, but are different in some languages. - * "Formatting" units are declined according to the rules of the language - * in the context of a date. "Stand-alone" units are always nominative singular: - * - * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` - * - * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` - * - * 2. Any sequence of the identical letters is a pattern, unless it is escaped by - * the single quote characters (see below). - * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) - * the output will be the same as default pattern for this unit, usually - * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units - * are marked with "2" in the last column of the table. - * - * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` - * - * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` - * - * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` - * - * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` - * - * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` - * - * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). - * The output will be padded with zeros to match the length of the pattern. - * - * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` - * - * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. - * These tokens represent the shortest form of the quarter. - * - * 5. The main difference between `y` and `u` patterns are B.C. years: - * - * | Year | `y` | `u` | - * |------|-----|-----| - * | AC 1 | 1 | 1 | - * | BC 1 | 1 | 0 | - * | BC 2 | 2 | -1 | - * - * Also `yy` always returns the last two digits of a year, - * while `uu` pads single digit years to 2 characters and returns other years unchanged: - * - * | Year | `yy` | `uu` | - * |------|------|------| - * | 1 | 01 | 01 | - * | 14 | 14 | 14 | - * | 376 | 76 | 376 | - * | 1453 | 53 | 1453 | - * - * The same difference is true for local and ISO week-numbering years (`Y` and `R`), - * except local week-numbering years are dependent on `options.weekStartsOn` - * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear} - * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}). - * - * 6. Specific non-location timezones are currently unavailable in `date-fns`, - * so right now these tokens fall back to GMT timezones. - * - * 7. These patterns are not in the Unicode Technical Standard #35: - * - `i`: ISO day of week - * - `I`: ISO week of year - * - `R`: ISO week-numbering year - * - `t`: seconds timestamp - * - `T`: milliseconds timestamp - * - `o`: ordinal number modifier - * - `P`: long localized date - * - `p`: long localized time - * - * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years. - * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * - * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month. - * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * - * @param {Date|Number} date - the original date - * @param {String} format - the string of tokens - * @param {Object} [options] - an object with options. - * @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) - * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is - * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`; - * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`; - * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @returns {String} the formatted date string - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `date` must not be Invalid Date - * @throws {RangeError} `options.locale` must contain `localize` property - * @throws {RangeError} `options.locale` must contain `formatLong` property - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md - * @throws {RangeError} format string contains an unescaped latin alphabet character - * - * @example - * // Represent 11 February 2014 in middle-endian format: - * const 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' - * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { - * locale: eoLocale - * }) - * //=> '2-a de julio 2014' - * - * @example - * // Escape string by single quote characters: - * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") - * //=> "3 o'clock" + * @param Body instance Instance of Body + * @return Void */ +function writeToStream(dest, instance) { + const body = instance.body; -function format(dirtyDate, dirtyFormatStr, options) { - var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4; - (0, _index9.default)(2, arguments); - var formatStr = String(dirtyFormatStr); - var defaultOptions = (0, _index10.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index11.default; - var firstWeekContainsDate = (0, _index8.default)((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); - - // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - var weekStartsOn = (0, _index8.default)((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); - // 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'); - } - if (!locale.localize) { - throw new RangeError('locale must contain localize property'); - } - if (!locale.formatLong) { - throw new RangeError('locale must contain formatLong property'); - } - var originalDate = (0, _index3.default)(dirtyDate); - if (!(0, _index.default)(originalDate)) { - throw new RangeError('Invalid time value'); - } - - // 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 = (0, _index6.default)(originalDate); - var utcDate = (0, _index2.default)(originalDate, timezoneOffset); - var formatterOptions = { - firstWeekContainsDate: firstWeekContainsDate, - weekStartsOn: weekStartsOn, - locale: locale, - _originalDate: originalDate - }; - var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) { - var firstCharacter = substring[0]; - if (firstCharacter === 'p' || firstCharacter === 'P') { - var longFormatter = _index5.default[firstCharacter]; - return longFormatter(substring, locale.formatLong); - } - return substring; - }).join('').match(formattingTokensRegExp).map(function (substring) { - // Replace two single quote characters with one single quote character - if (substring === "''") { - return "'"; - } - var firstCharacter = substring[0]; - if (firstCharacter === "'") { - return cleanEscapedString(substring); - } - var formatter = _index4.default[firstCharacter]; - if (formatter) { - if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && (0, _index7.isProtectedWeekYearToken)(substring)) { - (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate)); - } - if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, _index7.isProtectedDayOfYearToken)(substring)) { - (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate)); - } - return formatter(utcDate, substring, locale.localize, formatterOptions); - } - if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`'); - } - return substring; - }).join(''); - return result; -} -function cleanEscapedString(input) { - var matched = input.match(escapedStringRegExp); - if (!matched) { - return input; - } - return matched[1].replace(doubleQuoteRegExp, "'"); + if (body === null) { + // body is null + dest.end(); + } else if (isBlob(body)) { + body.stream().pipe(dest); + } else if (Buffer.isBuffer(body)) { + // body is buffer + dest.write(body); + dest.end(); + } else { + // body is stream + body.pipe(dest); + } } -module.exports = exports.default; - -/***/ }), - -/***/ 6801: -/***/ ((module, exports, __nccwpck_require__) => { - -"use strict"; +// expose Promise +Body.Promise = global.Promise; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = isDate; -var _typeof2 = _interopRequireDefault(__nccwpck_require__(5605)); -var _index = _interopRequireDefault(__nccwpck_require__(2063)); /** - * @name isDate - * @category Common Helpers - * @summary Is the given value a date? - * - * @description - * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. - * - * @param {*} value - the value to check - * @returns {boolean} true if the given value is a date - * @throws {TypeError} 1 arguments required - * - * @example - * // For a valid date: - * const result = isDate(new Date()) - * //=> true - * - * @example - * // For an invalid date: - * const result = isDate(new Date(NaN)) - * //=> true - * - * @example - * // For some value: - * const result = isDate('2014-02-31') - * //=> false + * headers.js * - * @example - * // For an object: - * const result = isDate({}) - * //=> false + * Headers class offers convenient helpers */ -function isDate(value) { - (0, _index.default)(1, arguments); - return value instanceof Date || (0, _typeof2.default)(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]'; -} -module.exports = exports.default; - -/***/ }), -/***/ 9920: -/***/ ((module, exports, __nccwpck_require__) => { +const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/; +const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/; -"use strict"; +function validateName(name) { + name = `${name}`; + if (invalidTokenRegex.test(name) || name === '') { + throw new TypeError(`${name} is not a legal HTTP header name`); + } +} +function validateValue(value) { + value = `${value}`; + if (invalidHeaderCharRegex.test(value)) { + throw new TypeError(`${value} is not a legal HTTP header value`); + } +} -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = isValid; -var _index = _interopRequireDefault(__nccwpck_require__(6801)); -var _index2 = _interopRequireDefault(__nccwpck_require__(6477)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2063)); /** - * @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 - * @returns {Boolean} the date is valid - * @throws {TypeError} 1 argument required - * - * @example - * // For the valid date: - * const result = isValid(new Date(2014, 1, 31)) - * //=> true + * Find the key in the map object given a header name. * - * @example - * // For the value, convertable into a date: - * const result = isValid(1393804800000) - * //=> true + * Returns undefined if not found. * - * @example - * // For the invalid date: - * const result = isValid(new Date('')) - * //=> false + * @param String name Header name + * @return String|Undefined */ -function isValid(dirtyDate) { - (0, _index3.default)(1, arguments); - if (!(0, _index.default)(dirtyDate) && typeof dirtyDate !== 'number') { - return false; - } - var date = (0, _index2.default)(dirtyDate); - return !isNaN(Number(date)); +function find(map, name) { + name = name.toLowerCase(); + for (const key in map) { + if (key.toLowerCase() === name) { + return key; + } + } + return undefined; } -module.exports = exports.default; -/***/ }), +const MAP = Symbol('map'); +class Headers { + /** + * Headers class + * + * @param Object headers Response headers + * @return Void + */ + constructor() { + let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; -/***/ 1244: -/***/ ((module, exports) => { + this[MAP] = Object.create(null); -"use strict"; + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = buildFormatLongFn; -function buildFormatLongFn(args) { - return function () { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - // TODO: Remove String() - var width = options.width ? String(options.width) : args.defaultWidth; - var format = args.formats[width] || args.formats[args.defaultWidth]; - return format; - }; -} -module.exports = exports.default; + return; + } -/***/ }), + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } -/***/ 3647: -/***/ ((module, exports) => { + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } -"use strict"; + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = buildLocalizeFn; -function buildLocalizeFn(args) { - return function (dirtyIndex, options) { - var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone'; - var valuesArray; - if (context === 'formatting' && args.formattingValues) { - var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; - var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; - valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; - } else { - var _defaultWidth = args.defaultWidth; - var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; - valuesArray = args.values[_width] || args.values[_defaultWidth]; - } - var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it! - return valuesArray[index]; - }; -} -module.exports = exports.default; + return this[MAP][key].join(', '); + } -/***/ }), + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; -/***/ 4029: -/***/ ((module, exports) => { + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; -"use strict"; + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = buildMatchFn; -function buildMatchFn(args) { - return function (string) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var width = options.width; - var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; - var matchResult = string.match(matchPattern); - if (!matchResult) { - return null; - } - var matchedString = matchResult[0]; - var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; - var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) { - return pattern.test(matchedString); - }) : findKey(parsePatterns, function (pattern) { - return pattern.test(matchedString); - }); - var value; - value = args.valueCallback ? args.valueCallback(key) : key; - value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); - return { - value: value, - rest: rest - }; - }; -} -function findKey(object, predicate) { - for (var key in object) { - if (object.hasOwnProperty(key) && predicate(object[key])) { - return key; - } - } - return undefined; -} -function findIndex(array, predicate) { - for (var key = 0; key < array.length; key++) { - if (predicate(array[key])) { - return key; - } - } - return undefined; -} -module.exports = exports.default; - -/***/ }), - -/***/ 3364: -/***/ ((module, exports) => { + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } -"use strict"; + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = buildMatchPatternFn; -function buildMatchPatternFn(args) { - return function (string) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var matchResult = string.match(args.matchPattern); - if (!matchResult) return null; - var matchedString = matchResult[0]; - var parseResult = string.match(args.parsePattern); - if (!parseResult) return null; - var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; - value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); - return { - value: value, - rest: rest - }; - }; -} -module.exports = exports.default; + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } -/***/ }), + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } -/***/ 4846: -/***/ ((module, exports) => { + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } -"use strict"; + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -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' - }, - aboutXWeeks: { - one: 'about 1 week', - other: 'about {{count}} weeks' - }, - xWeeks: { - one: '1 week', - other: '{{count}} weeks' - }, - 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' - } -}; -var formatDistance = function formatDistance(token, count, options) { - var result; - var tokenValue = formatDistanceLocale[token]; - if (typeof tokenValue === 'string') { - result = tokenValue; - } else if (count === 1) { - result = tokenValue.one; - } else { - result = tokenValue.other.replace('{{count}}', count.toString()); - } - if (options !== null && options !== void 0 && options.addSuffix) { - if (options.comparison && options.comparison > 0) { - return 'in ' + result; - } else { - return result + ' ago'; - } - } - return result; -}; -var _default = formatDistance; -exports["default"] = _default; -module.exports = exports.default; +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); -/***/ }), +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; -/***/ 368: -/***/ ((module, exports, __nccwpck_require__) => { + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} -"use strict"; +const INTERNAL = Symbol('internal'); +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(1244)); -var dateFormats = { - full: 'EEEE, MMMM do, y', - long: 'MMMM do, y', - medium: 'MMM d, y', - short: 'MM/dd/yyyy' -}; -var timeFormats = { - full: 'h:mm:ss a zzzz', - long: 'h:mm:ss a z', - medium: 'h:mm:ss a', - short: 'h:mm a' -}; -var dateTimeFormats = { - full: "{{date}} 'at' {{time}}", - long: "{{date}} 'at' {{time}}", - medium: '{{date}}, {{time}}', - short: '{{date}}, {{time}}' -}; -var formatLong = { - date: (0, _index.default)({ - formats: dateFormats, - defaultWidth: 'full' - }), - time: (0, _index.default)({ - formats: timeFormats, - defaultWidth: 'full' - }), - dateTime: (0, _index.default)({ - formats: dateTimeFormats, - defaultWidth: 'full' - }) -}; -var _default = formatLong; -exports["default"] = _default; -module.exports = exports.default; +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } -/***/ }), + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; -/***/ 2430: -/***/ ((module, exports) => { + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } -"use strict"; + this[INTERNAL].index = index + 1; + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var formatRelativeLocale = { - lastWeek: "'last' eeee 'at' p", - yesterday: "'yesterday at' p", - today: "'today at' p", - tomorrow: "'tomorrow at' p", - nextWeek: "eeee 'at' p", - other: 'P' -}; -var formatRelative = function formatRelative(token, _date, _baseDate, _options) { - return formatRelativeLocale[token]; -}; -var _default = formatRelative; -exports["default"] = _default; -module.exports = exports.default; - -/***/ }), - -/***/ 5474: -/***/ ((module, exports, __nccwpck_require__) => { - -"use strict"; - +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(3647)); -var eraValues = { - narrow: ['B', 'A'], - abbreviated: ['BC', 'AD'], - wide: ['Before Christ', 'Anno Domini'] -}; -var quarterValues = { - narrow: ['1', '2', '3', '4'], - abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'], - wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] -}; +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); -// 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 monthValues = { - narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], - abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] -}; -var dayValues = { - narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'], - short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] -}; -var dayPeriodValues = { - narrow: { - am: 'a', - pm: 'p', - midnight: 'mi', - noon: 'n', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - }, - abbreviated: { - am: 'AM', - pm: 'PM', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - }, - wide: { - am: 'a.m.', - pm: 'p.m.', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - } -}; -var formattingDayPeriodValues = { - narrow: { - am: 'a', - pm: 'p', - midnight: 'mi', - noon: 'n', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - }, - abbreviated: { - am: 'AM', - pm: 'PM', - midnight: 'midnight', - noon: 'noon', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - }, - wide: { - am: 'a.m.', - pm: 'p.m.', - midnight: 'midnight', - noon: 'noon', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - } -}; -var ordinalNumber = function ordinalNumber(dirtyNumber, _options) { - var number = Number(dirtyNumber); + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } - // If ordinal numbers depend on context, for example, - // if they are different for different grammatical genders, - // use `options.unit`. - // - // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', - // 'day', 'hour', 'minute', 'second'. + return obj; +} - 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, - era: (0, _index.default)({ - values: eraValues, - defaultWidth: 'wide' - }), - quarter: (0, _index.default)({ - values: quarterValues, - defaultWidth: 'wide', - argumentCallback: function argumentCallback(quarter) { - return quarter - 1; - } - }), - month: (0, _index.default)({ - values: monthValues, - defaultWidth: 'wide' - }), - day: (0, _index.default)({ - values: dayValues, - defaultWidth: 'wide' - }), - dayPeriod: (0, _index.default)({ - values: dayPeriodValues, - defaultWidth: 'wide', - formattingValues: formattingDayPeriodValues, - defaultFormattingWidth: 'wide' - }) -}; -var _default = localize; -exports["default"] = _default; -module.exports = exports.default; +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} -/***/ }), +const INTERNALS$1 = Symbol('Response internals'); -/***/ 1338: -/***/ ((module, exports, __nccwpck_require__) => { +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; -"use strict"; +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + Body.call(this, body, opts); -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(4029)); -var _index2 = _interopRequireDefault(__nccwpck_require__(3364)); -var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; -var parseOrdinalNumberPattern = /\d+/i; -var matchEraPatterns = { - narrow: /^(b|a)/i, - abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, - wide: /^(before christ|before common era|anno domini|common era)/i -}; -var parseEraPatterns = { - any: [/^b/i, /^(a|c)/i] -}; -var matchQuarterPatterns = { - narrow: /^[1234]/i, - abbreviated: /^q[1234]/i, - wide: /^[1234](th|st|nd|rd)? quarter/i -}; -var parseQuarterPatterns = { - any: [/1/i, /2/i, /3/i, /4/i] -}; -var matchMonthPatterns = { - narrow: /^[jfmasond]/i, - abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, - wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i -}; -var parseMonthPatterns = { - narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], - 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] -}; -var matchDayPatterns = { - narrow: /^[smtwf]/i, - short: /^(su|mo|tu|we|th|fr|sa)/i, - abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, - wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i -}; -var parseDayPatterns = { - narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], - any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] -}; -var matchDayPeriodPatterns = { - narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, - any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i -}; -var parseDayPeriodPatterns = { - any: { - am: /^a/i, - pm: /^p/i, - midnight: /^mi/i, - noon: /^no/i, - morning: /morning/i, - afternoon: /afternoon/i, - evening: /evening/i, - night: /night/i - } -}; -var match = { - ordinalNumber: (0, _index2.default)({ - matchPattern: matchOrdinalNumberPattern, - parsePattern: parseOrdinalNumberPattern, - valueCallback: function valueCallback(value) { - return parseInt(value, 10); - } - }), - era: (0, _index.default)({ - matchPatterns: matchEraPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseEraPatterns, - defaultParseWidth: 'any' - }), - quarter: (0, _index.default)({ - matchPatterns: matchQuarterPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseQuarterPatterns, - defaultParseWidth: 'any', - valueCallback: function valueCallback(index) { - return index + 1; - } - }), - month: (0, _index.default)({ - matchPatterns: matchMonthPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseMonthPatterns, - defaultParseWidth: 'any' - }), - day: (0, _index.default)({ - matchPatterns: matchDayPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseDayPatterns, - defaultParseWidth: 'any' - }), - dayPeriod: (0, _index.default)({ - matchPatterns: matchDayPeriodPatterns, - defaultMatchWidth: 'any', - parsePatterns: parseDayPeriodPatterns, - defaultParseWidth: 'any' - }) -}; -var _default = match; -exports["default"] = _default; -module.exports = exports.default; + const status = opts.status || 200; + const headers = new Headers(opts.headers); -/***/ }), + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } -/***/ 1773: -/***/ ((module, exports, __nccwpck_require__) => { + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } -"use strict"; + get url() { + return this[INTERNALS$1].url || ''; + } + get status() { + return this[INTERNALS$1].status; + } -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _index = _interopRequireDefault(__nccwpck_require__(4846)); -var _index2 = _interopRequireDefault(__nccwpck_require__(368)); -var _index3 = _interopRequireDefault(__nccwpck_require__(2430)); -var _index4 = _interopRequireDefault(__nccwpck_require__(5474)); -var _index5 = _interopRequireDefault(__nccwpck_require__(1338)); -/** - * @type {Locale} - * @category Locales - * @summary English locale (United States). - * @language English - * @iso-639-2 eng - * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp} - * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss} - */ -var locale = { - code: 'en-US', - formatDistance: _index.default, - formatLong: _index2.default, - formatRelative: _index3.default, - localize: _index4.default, - match: _index5.default, - options: { - weekStartsOn: 0 /* Sunday */, - firstWeekContainsDate: 1 - } -}; -var _default = locale; -exports["default"] = _default; -module.exports = exports.default; + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } -/***/ }), + get redirected() { + return this[INTERNALS$1].counter > 0; + } -/***/ 7923: -/***/ ((module, exports, __nccwpck_require__) => { + get statusText() { + return this[INTERNALS$1].statusText; + } -"use strict"; + get headers() { + return this[INTERNALS$1].headers; + } - -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = subMilliseconds; -var _index = _interopRequireDefault(__nccwpck_require__(524)); -var _index2 = _interopRequireDefault(__nccwpck_require__(2063)); -var _index3 = _interopRequireDefault(__nccwpck_require__(1985)); -/** - * @name subMilliseconds - * @category Millisecond Helpers - * @summary Subtract the specified number of milliseconds from the given date. - * - * @description - * Subtract the specified number of milliseconds from the given date. - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`. - * @returns {Date} the new date with the milliseconds subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000: - * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750) - * //=> Thu Jul 10 2014 12:45:29.250 - */ -function subMilliseconds(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } } -module.exports = exports.default; -/***/ }), +Body.mixIn(Response.prototype); -/***/ 6477: -/***/ ((module, exports, __nccwpck_require__) => { +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); -"use strict"; +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); +const INTERNALS$2 = Symbol('Request internals'); +const URL = Url.URL || whatwgUrl.URL; + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; -var _interopRequireDefault = (__nccwpck_require__(3286)["default"]); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = toDate; -var _typeof2 = _interopRequireDefault(__nccwpck_require__(5605)); -var _index = _interopRequireDefault(__nccwpck_require__(2063)); /** - * @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 the argument is none of the above, the function returns Invalid Date. - * - * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. - * - * @param {Date|Number} argument - the value to convert - * @returns {Date} the parsed date in the local time zone - * @throws {TypeError} 1 argument required - * - * @example - * // Clone the date: - * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) - * //=> Tue Feb 11 2014 11:30:30 + * Wrapper around `new URL` to handle arbitrary URLs * - * @example - * // Convert the timestamp to date: - * const result = toDate(1392098430000) - * //=> Tue Feb 11 2014 11:30:30 + * @param {string} urlStr + * @return {void} + */ +function parseURL(urlStr) { + /* + Check whether the URL is absolute or not + Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 + Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 */ -function toDate(argument) { - (0, _index.default)(1, arguments); - var argStr = Object.prototype.toString.call(argument); + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { + urlStr = new URL(urlStr).toString(); + } - // Clone the date - if (argument instanceof Date || (0, _typeof2.default)(argument) === 'object' && argStr === '[object Date]') { - // Prevent the date to lose the milliseconds when passed to new Date() in IE10 - return new Date(argument.getTime()); - } else if (typeof argument === 'number' || argStr === '[object Number]') { - return new Date(argument); - } else { - if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') { - // eslint-disable-next-line no-console - console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); - // eslint-disable-next-line no-console - console.warn(new Error().stack); - } - return new Date(NaN); - } + // Fallback to old implementation for arbitrary URLs + return parse_url(urlStr); } -module.exports = exports.default; - -/***/ }), - -/***/ 8932: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; -Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} -class Deprecation extends Error { - constructor(message) { - super(message); // Maintains proper stack trace (only available on V8) +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} - /* istanbul ignore next */ +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } + let parsedURL; - this.name = 'Deprecation'; - } + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parseURL(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parseURL(`${input}`); + } + input = {}; + } else { + parsedURL = parseURL(input.url); + } -} + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); -exports.Deprecation = Deprecation; + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; -/***/ }), + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); -/***/ 3287: -/***/ ((__unused_webpack_module, exports) => { + const headers = new Headers(init.headers || input.headers || {}); -"use strict"; + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; -Object.defineProperty(exports, "__esModule", ({ value: true })); + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } -/*! - * is-plain-object - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; -function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; -} + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } -function isPlainObject(o) { - var ctor,prot; + get method() { + return this[INTERNALS$2].method; + } - if (isObject(o) === false) return false; + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } - // If has modified constructor - ctor = o.constructor; - if (ctor === undefined) return true; + get headers() { + return this[INTERNALS$2].headers; + } - // If has modified prototype - prot = ctor.prototype; - if (isObject(prot) === false) return false; + get redirect() { + return this[INTERNALS$2].redirect; + } - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) { - return false; - } + get signal() { + return this[INTERNALS$2].signal; + } - // Most likely a plain Object - return true; + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } } -exports.isPlainObject = isPlainObject; - - -/***/ }), - -/***/ 467: -/***/ ((module, exports, __nccwpck_require__) => { +Body.mixIn(Request.prototype); -"use strict"; +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); -Object.defineProperty(exports, "__esModule", ({ value: true })); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var Stream = _interopDefault(__nccwpck_require__(2781)); -var http = _interopDefault(__nccwpck_require__(3685)); -var Url = _interopDefault(__nccwpck_require__(7310)); -var whatwgUrl = _interopDefault(__nccwpck_require__(3323)); -var https = _interopDefault(__nccwpck_require__(5687)); -var zlib = _interopDefault(__nccwpck_require__(9796)); - -// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js - -// fix for "Readable" isn't a named export issue -const Readable = Stream.Readable; - -const BUFFER = Symbol('buffer'); -const TYPE = Symbol('type'); - -class Blob { - constructor() { - this[TYPE] = ''; - - const blobParts = arguments[0]; - const options = arguments[1]; - - const buffers = []; - let size = 0; +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); - if (blobParts) { - const a = blobParts; - const length = Number(a.length); - for (let i = 0; i < length; i++) { - const element = a[i]; - let buffer; - if (element instanceof Buffer) { - buffer = element; - } else if (ArrayBuffer.isView(element)) { - buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); - } else if (element instanceof ArrayBuffer) { - buffer = Buffer.from(element); - } else if (element instanceof Blob) { - buffer = element[BUFFER]; - } else { - buffer = Buffer.from(typeof element === 'string' ? element : String(element)); - } - size += buffer.length; - buffers.push(buffer); - } - } + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } - this[BUFFER] = Buffer.concat(buffers); + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } - let type = options && options.type !== undefined && String(options.type).toLowerCase(); - if (type && !/[^\u0020-\u007E]/.test(type)) { - this[TYPE] = type; - } + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); } - get size() { - return this[BUFFER].length; + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); } - get type() { - return this[TYPE]; + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; } - text() { - return Promise.resolve(this[BUFFER].toString()); + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } } - arrayBuffer() { - const buf = this[BUFFER]; - const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - return Promise.resolve(ab); + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); } - stream() { - const readable = new Readable(); - readable._read = function () {}; - readable.push(this[BUFFER]); - readable.push(null); - return readable; + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); } - toString() { - return '[object Blob]'; + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); } - slice() { - const size = this.size; - const start = arguments[0]; - const end = arguments[1]; - let relativeStart, relativeEnd; - if (start === undefined) { - relativeStart = 0; - } else if (start < 0) { - relativeStart = Math.max(size + start, 0); - } else { - relativeStart = Math.min(start, size); - } - if (end === undefined) { - relativeEnd = size; - } else if (end < 0) { - relativeEnd = Math.max(size + end, 0); - } else { - relativeEnd = Math.min(end, size); - } - const span = Math.max(relativeEnd - relativeStart, 0); + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } - const buffer = this[BUFFER]; - const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); - const blob = new Blob([], { type: arguments[2] }); - blob[BUFFER] = slicedBuffer; - return blob; + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); } -} -Object.defineProperties(Blob.prototype, { - size: { enumerable: true }, - type: { enumerable: true }, - slice: { enumerable: true } -}); + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js -Object.defineProperty(Blob.prototype, Symbol.toStringTag, { - value: 'Blob', - writable: false, - enumerable: false, - configurable: true -}); + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} /** - * fetch-error.js + * abort-error.js * - * FetchError interface for operational errors + * AbortError interface for cancelled requests */ /** - * Create FetchError instance + * Create AbortError instance * * @param String message Error message for human - * @param String type Error type for machine - * @param String systemError For Node.js system error - * @return FetchError + * @return AbortError */ -function FetchError(message, type, systemError) { +function AbortError(message) { Error.call(this, message); + this.type = 'aborted'; this.message = message; - this.type = type; - - // when err.type is `system`, err.code contains system error code - if (systemError) { - this.code = this.errno = systemError.code; - } // hide custom error implementation details from end-users Error.captureStackTrace(this, this.constructor); } -FetchError.prototype = Object.create(Error.prototype); -FetchError.prototype.constructor = FetchError; -FetchError.prototype.name = 'FetchError'; +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; -let convert; -try { - convert = (__nccwpck_require__(3975).convert); -} catch (e) {} +const URL$1 = Url.URL || whatwgUrl.URL; -const INTERNALS = Symbol('Body internals'); +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; -// fix an issue where "PassThrough" isn't a named export for node <10 -const PassThrough = Stream.PassThrough; +const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { + const orig = new URL$1(original).hostname; + const dest = new URL$1(destination).hostname; + + return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); +}; /** - * Body mixin - * - * Ref: https://fetch.spec.whatwg.org/#body + * Fetch function * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise */ -function Body(body) { - var _this = this; +function fetch(url, opts) { - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - _ref$size = _ref.size; + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } - let size = _ref$size === undefined ? 0 : _ref$size; - var _ref$timeout = _ref.timeout; - let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + Body.Promise = fetch.Promise; - if (body == null) { - // body is undefined or null - body = null; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - body = Buffer.from(body.toString()); - } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - body = Buffer.from(body); - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); - } else if (body instanceof Stream) ; else { - // none of the above - // coerce to string then buffer - body = Buffer.from(String(body)); - } - this[INTERNALS] = { - body, - disturbed: false, - error: null - }; - this.size = size; - this.timeout = timeout; - - if (body instanceof Stream) { - body.on('error', function (err) { - const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); - _this[INTERNALS].error = error; - }); - } -} - -Body.prototype = { - get body() { - return this[INTERNALS].body; - }, - - get bodyUsed() { - return this[INTERNALS].disturbed; - }, - - /** - * Decode response as ArrayBuffer - * - * @return Promise - */ - arrayBuffer() { - return consumeBody.call(this).then(function (buf) { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - }); - }, + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); - /** - * Return raw response as Blob - * - * @return Promise - */ - blob() { - let ct = this.headers && this.headers.get('content-type') || ''; - return consumeBody.call(this).then(function (buf) { - return Object.assign( - // Prevent copying - new Blob([], { - type: ct.toLowerCase() - }), { - [BUFFER]: buf - }); - }); - }, + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; - /** - * Decode response as json - * - * @return Promise - */ - json() { - var _this2 = this; + let response = null; - return consumeBody.call(this).then(function (buffer) { - try { - return JSON.parse(buffer.toString()); - } catch (err) { - return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + request.body.destroy(error); } - }); - }, - - /** - * Decode response as text - * - * @return Promise - */ - text() { - return consumeBody.call(this).then(function (buffer) { - return buffer.toString(); - }); - }, + if (!response || !response.body) return; + response.body.emit('error', error); + }; - /** - * Decode response as buffer (non-spec api) - * - * @return Promise - */ - buffer() { - return consumeBody.call(this); - }, + if (signal && signal.aborted) { + abort(); + return; + } - /** - * Decode response as text, while automatically detecting the encoding and - * trying to decode to UTF-8 (non-spec api) - * - * @return Promise - */ - textConverted() { - var _this3 = this; + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; - return consumeBody.call(this).then(function (buffer) { - return convertBody(buffer, _this3.headers); - }); - } -}; + // send request + const req = send(options); + let reqTimeout; -// In browsers, all properties are enumerable. -Object.defineProperties(Body.prototype, { - body: { enumerable: true }, - bodyUsed: { enumerable: true }, - arrayBuffer: { enumerable: true }, - blob: { enumerable: true }, - json: { enumerable: true }, - text: { enumerable: true } -}); + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } -Body.mixIn = function (proto) { - for (const name of Object.getOwnPropertyNames(Body.prototype)) { - // istanbul ignore else: future proof - if (!(name in proto)) { - const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); - Object.defineProperty(proto, name, desc); + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); } - } -}; -/** - * Consume and convert an entire Body to a Buffer. - * - * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body - * - * @return Promise - */ -function consumeBody() { - var _this4 = this; + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } - if (this[INTERNALS].disturbed) { - return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); - } + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + finalize(); + }); - this[INTERNALS].disturbed = true; + req.on('response', function (res) { + clearTimeout(reqTimeout); - if (this[INTERNALS].error) { - return Body.Promise.reject(this[INTERNALS].error); - } + const headers = createHeadersLenient(res.headers); - let body = this.body; + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); - // body is null - if (body === null) { - return Body.Promise.resolve(Buffer.alloc(0)); - } + // HTTP fetch step 5.3 + let locationURL = null; + try { + locationURL = location === null ? null : new URL$1(location, request.url).toString(); + } catch (err) { + // error here can only be invalid URL in Location: header + // do not throw when options.redirect == manual + // let the user extract the errorneous redirect URL + if (request.redirect !== 'manual') { + reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); + finalize(); + return; + } + } - // body is blob - if (isBlob(body)) { - body = body.stream(); - } + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } - // body is buffer - if (Buffer.isBuffer(body)) { - return Body.Promise.resolve(body); - } + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } - // istanbul ignore if: should never happen - if (!(body instanceof Stream)) { - return Body.Promise.resolve(Buffer.alloc(0)); - } + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; - // body is stream - // get ready to actually consume the body - let accum = []; - let accumBytes = 0; - let abort = false; + if (!isDomainOrSubdomain(request.url, locationURL)) { + for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { + requestOpts.headers.delete(name); + } + } - return new Body.Promise(function (resolve, reject) { - let resTimeout; + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } - // allow timeout on slow response body - if (_this4.timeout) { - resTimeout = setTimeout(function () { - abort = true; - reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); - }, _this4.timeout); - } + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } - // handle stream errors - body.on('error', function (err) { - if (err.name === 'AbortError') { - // if the request was aborted, reject with this Error - abort = true; - reject(err); - } else { - // other errors, such as incorrect content-encoding - reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } } - }); - body.on('data', function (chunk) { - if (abort || chunk === null) { - return; - } + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); - if (_this4.size && accumBytes + chunk.length > _this4.size) { - abort = true; - reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); return; } - accumBytes += chunk.length; - accum.push(chunk); - }); + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; - body.on('end', function () { - if (abort) { + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); return; } - clearTimeout(resTimeout); + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + return; + } - try { - resolve(Buffer.concat(accum, accumBytes)); - } catch (err) { - // handle streams that have accumulated too much data (issue #414) - reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); }); + + writeToStream(req, request); }); } - /** - * Detect buffer encoding and convert to target encoding - * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * Redirect code matching * - * @param Buffer buffer Incoming buffer - * @param String encoding Target encoding - * @return String + * @param Number code Status code + * @return Boolean */ -function convertBody(buffer, headers) { - if (typeof convert !== 'function') { - throw new Error('The package `encoding` must be installed to use the textConverted() function'); - } +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; - const ct = headers.get('content-type'); - let charset = 'utf-8'; - let res, str; +// expose Promise +fetch.Promise = global.Promise; - // header - if (ct) { - res = /charset=([^;]*)/i.exec(ct); - } +module.exports = exports = fetch; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports["default"] = exports; +exports.Headers = Headers; +exports.Request = Request; +exports.Response = Response; +exports.FetchError = FetchError; - // no charset in content type, peek at response body for at most 1024 bytes - str = buffer.slice(0, 1024).toString(); - // html5 - if (!res && str) { - res = / { - if (res) { - res = /charset=(.*)/i.exec(res.pop()); - } - } +"use strict"; - // xml - if (!res && str) { - res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str); - } - // found charset - if (res) { - charset = res.pop(); +var punycode = __nccwpck_require__(5477); +var mappingTable = __nccwpck_require__(1907); - // prevent decode issues when sites use incorrect encoding - // ref: https://hsivonen.fi/encoding-menu/ - if (charset === 'gb2312' || charset === 'gbk') { - charset = 'gb18030'; - } - } +var PROCESSING_OPTIONS = { + TRANSITIONAL: 0, + NONTRANSITIONAL: 1 +}; - // turn raw buffers into a single utf-8 buffer - return convert(buffer, 'UTF-8', charset).toString(); +function normalize(str) { // fix bug in v8 + return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); } -/** - * Detect a URLSearchParams object - * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143 - * - * @param Object obj Object to detect by type or brand - * @return String - */ -function isURLSearchParams(obj) { - // Duck-typing as a necessary condition. - if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') { - return false; - } +function findStatus(val) { + var start = 0; + var end = mappingTable.length - 1; - // Brand-checking and more duck-typing as optional condition. - return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function'; -} + while (start <= end) { + var mid = Math.floor((start + end) / 2); -/** - * Check if `obj` is a W3C `Blob` object (which `File` inherits from) - * @param {*} obj - * @return {boolean} - */ -function isBlob(obj) { - return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]); + var target = mappingTable[mid]; + if (target[0][0] <= val && target[0][1] >= val) { + return target; + } else if (target[0][0] > val) { + end = mid - 1; + } else { + start = mid + 1; + } + } + + return null; } -/** - * Clone body given Res/Req instance - * - * @param Mixed instance Response or Request instance - * @return Mixed - */ -function clone(instance) { - let p1, p2; - let body = instance.body; +var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - // don't allow cloning a used body - if (instance.bodyUsed) { - throw new Error('cannot clone body after it is used'); - } +function countSymbols(string) { + return string + // replace every surrogate pair with a BMP symbol + .replace(regexAstralSymbols, '_') + // then get the length + .length; +} - // check that body is a stream and not form-data object - // note: we can't clone the form-data object without having it as a dependency - if (body instanceof Stream && typeof body.getBoundary !== 'function') { - // tee instance body - p1 = new PassThrough(); - p2 = new PassThrough(); - body.pipe(p1); - body.pipe(p2); - // set instance body to teed body and return the other teed body - instance[INTERNALS].body = p1; - body = p2; - } +function mapChars(domain_name, useSTD3, processing_option) { + var hasError = false; + var processed = ""; - return body; -} + var len = countSymbols(domain_name); + for (var i = 0; i < len; ++i) { + var codePoint = domain_name.codePointAt(i); + var status = findStatus(codePoint); -/** - * Performs the operation "extract a `Content-Type` value from |object|" as - * specified in the specification: - * https://fetch.spec.whatwg.org/#concept-bodyinit-extract - * - * This function assumes that instance.body is present. - * - * @param Mixed instance Any options.body input - */ -function extractContentType(body) { - if (body === null) { - // body is null - return null; - } else if (typeof body === 'string') { - // body is string - return 'text/plain;charset=UTF-8'; - } else if (isURLSearchParams(body)) { - // body is a URLSearchParams - return 'application/x-www-form-urlencoded;charset=UTF-8'; - } else if (isBlob(body)) { - // body is blob - return body.type || null; - } else if (Buffer.isBuffer(body)) { - // body is buffer - return null; - } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { - // body is ArrayBuffer - return null; - } else if (ArrayBuffer.isView(body)) { - // body is ArrayBufferView - return null; - } else if (typeof body.getBoundary === 'function') { - // detect form data input from form-data module - return `multipart/form-data;boundary=${body.getBoundary()}`; - } else if (body instanceof Stream) { - // body is stream - // can't really do much about this - return null; - } else { - // Body constructor defaults other things to string - return 'text/plain;charset=UTF-8'; - } + switch (status[1]) { + case "disallowed": + hasError = true; + processed += String.fromCodePoint(codePoint); + break; + case "ignored": + break; + case "mapped": + processed += String.fromCodePoint.apply(String, status[2]); + break; + case "deviation": + if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { + processed += String.fromCodePoint.apply(String, status[2]); + } else { + processed += String.fromCodePoint(codePoint); + } + break; + case "valid": + processed += String.fromCodePoint(codePoint); + break; + case "disallowed_STD3_mapped": + if (useSTD3) { + hasError = true; + processed += String.fromCodePoint(codePoint); + } else { + processed += String.fromCodePoint.apply(String, status[2]); + } + break; + case "disallowed_STD3_valid": + if (useSTD3) { + hasError = true; + } + + processed += String.fromCodePoint(codePoint); + break; + } + } + + return { + string: processed, + error: hasError + }; } -/** - * The Fetch Standard treats this as if "total bytes" is a property on the body. - * For us, we have to explicitly get it with a function. - * - * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes - * - * @param Body instance Instance of Body - * @return Number? Number of bytes, or null if not possible - */ -function getTotalBytes(instance) { - const body = instance.body; +var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; +function validateLabel(label, processing_option) { + if (label.substr(0, 4) === "xn--") { + label = punycode.toUnicode(label); + processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; + } - if (body === null) { - // body is null - return 0; - } else if (isBlob(body)) { - return body.size; - } else if (Buffer.isBuffer(body)) { - // body is buffer - return body.length; - } else if (body && typeof body.getLengthSync === 'function') { - // detect form data input from form-data module - if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x - body.hasKnownLength && body.hasKnownLength()) { - // 2.x - return body.getLengthSync(); - } - return null; - } else { - // body is stream - return null; - } -} + var error = false; -/** - * Write a Body to a Node.js WritableStream (e.g. http.Request) object. - * - * @param Body instance Instance of Body - * @return Void - */ -function writeToStream(dest, instance) { - const body = instance.body; + if (normalize(label) !== label || + (label[3] === "-" && label[4] === "-") || + label[0] === "-" || label[label.length - 1] === "-" || + label.indexOf(".") !== -1 || + label.search(combiningMarksRegex) === 0) { + error = true; + } + var len = countSymbols(label); + for (var i = 0; i < len; ++i) { + var status = findStatus(label.codePointAt(i)); + if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || + (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && + status[1] !== "valid" && status[1] !== "deviation")) { + error = true; + break; + } + } - if (body === null) { - // body is null - dest.end(); - } else if (isBlob(body)) { - body.stream().pipe(dest); - } else if (Buffer.isBuffer(body)) { - // body is buffer - dest.write(body); - dest.end(); - } else { - // body is stream - body.pipe(dest); - } + return { + label: label, + error: error + }; } -// expose Promise -Body.Promise = global.Promise; - -/** - * headers.js - * - * Headers class offers convenient helpers - */ +function processing(domain_name, useSTD3, processing_option) { + var result = mapChars(domain_name, useSTD3, processing_option); + result.string = normalize(result.string); -const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/; -const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/; + var labels = result.string.split("."); + for (var i = 0; i < labels.length; ++i) { + try { + var validation = validateLabel(labels[i]); + labels[i] = validation.label; + result.error = result.error || validation.error; + } catch(e) { + result.error = true; + } + } -function validateName(name) { - name = `${name}`; - if (invalidTokenRegex.test(name) || name === '') { - throw new TypeError(`${name} is not a legal HTTP header name`); - } + return { + string: labels.join("."), + error: result.error + }; } -function validateValue(value) { - value = `${value}`; - if (invalidHeaderCharRegex.test(value)) { - throw new TypeError(`${value} is not a legal HTTP header value`); - } -} +module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { + var result = processing(domain_name, useSTD3, processing_option); + var labels = result.string.split("."); + labels = labels.map(function(l) { + try { + return punycode.toASCII(l); + } catch(e) { + result.error = true; + return l; + } + }); -/** - * Find the key in the map object given a header name. - * - * Returns undefined if not found. - * - * @param String name Header name - * @return String|Undefined - */ -function find(map, name) { - name = name.toLowerCase(); - for (const key in map) { - if (key.toLowerCase() === name) { - return key; - } - } - return undefined; -} + if (verifyDnsLength) { + var total = labels.slice(0, labels.length - 1).join(".").length; + if (total.length > 253 || total.length === 0) { + result.error = true; + } -const MAP = Symbol('map'); -class Headers { - /** - * Headers class - * - * @param Object headers Response headers - * @return Void - */ - constructor() { - let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; + for (var i=0; i < labels.length; ++i) { + if (labels.length > 63 || labels.length === 0) { + result.error = true; + break; + } + } + } - this[MAP] = Object.create(null); + if (result.error) return null; + return labels.join("."); +}; - if (init instanceof Headers) { - const rawHeaders = init.raw(); - const headerNames = Object.keys(rawHeaders); +module.exports.toUnicode = function(domain_name, useSTD3) { + var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); - for (const headerName of headerNames) { - for (const value of rawHeaders[headerName]) { - this.append(headerName, value); - } - } + return { + domain: result.string, + error: result.error + }; +}; - return; - } +module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; - // We don't worry about converting prop to ByteString here as append() - // will handle it. - if (init == null) ; else if (typeof init === 'object') { - const method = init[Symbol.iterator]; - if (method != null) { - if (typeof method !== 'function') { - throw new TypeError('Header pairs must be iterable'); - } - // sequence> - // Note: per spec we have to first exhaust the lists then process them - const pairs = []; - for (const pair of init) { - if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { - throw new TypeError('Each header pair must be iterable'); - } - pairs.push(Array.from(pair)); - } +/***/ }), - for (const pair of pairs) { - if (pair.length !== 2) { - throw new TypeError('Each header pair must be a name/value tuple'); - } - this.append(pair[0], pair[1]); - } - } else { - // record - for (const key of Object.keys(init)) { - const value = init[key]; - this.append(key, value); - } - } - } else { - throw new TypeError('Provided initializer must be an object'); - } - } +/***/ 5871: +/***/ ((module) => { - /** - * Return combined header value given name - * - * @param String name Header name - * @return Mixed - */ - get(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key === undefined) { - return null; - } +"use strict"; - return this[MAP][key].join(', '); - } - /** - * Iterate over all headers - * - * @param Function callback Executed for each item with parameters (value, name, thisArg) - * @param Boolean thisArg `this` context for callback function - * @return Void - */ - forEach(callback) { - let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; +var conversions = {}; +module.exports = conversions; - let pairs = getHeaders(this); - let i = 0; - while (i < pairs.length) { - var _pairs$i = pairs[i]; - const name = _pairs$i[0], - value = _pairs$i[1]; +function sign(x) { + return x < 0 ? -1 : 1; +} - callback.call(thisArg, value, name, this); - pairs = getHeaders(this); - i++; - } - } +function evenRound(x) { + // Round x to the nearest integer, choosing the even integer if it lies halfway between two. + if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) + return Math.floor(x); + } else { + return Math.round(x); + } +} - /** - * Overwrite header values given name - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - set(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - this[MAP][key !== undefined ? key : name] = [value]; - } +function createNumberConversion(bitLength, typeOpts) { + if (!typeOpts.unsigned) { + --bitLength; + } + const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); + const upperBound = Math.pow(2, bitLength) - 1; - /** - * Append a value onto existing header - * - * @param String name Header name - * @param String value Header value - * @return Void - */ - append(name, value) { - name = `${name}`; - value = `${value}`; - validateName(name); - validateValue(value); - const key = find(this[MAP], name); - if (key !== undefined) { - this[MAP][key].push(value); - } else { - this[MAP][name] = [value]; - } - } + const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); + const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); - /** - * Check for header name existence - * - * @param String name Header name - * @return Boolean - */ - has(name) { - name = `${name}`; - validateName(name); - return find(this[MAP], name) !== undefined; - } + return function(V, opts) { + if (!opts) opts = {}; - /** - * Delete all header values given name - * - * @param String name Header name - * @return Void - */ - delete(name) { - name = `${name}`; - validateName(name); - const key = find(this[MAP], name); - if (key !== undefined) { - delete this[MAP][key]; - } - } + let x = +V; - /** - * Return raw headers (non-spec api) - * - * @return Object - */ - raw() { - return this[MAP]; - } + if (opts.enforceRange) { + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite number"); + } - /** - * Get an iterator on keys. - * - * @return Iterator - */ - keys() { - return createHeadersIterator(this, 'key'); - } + x = sign(x) * Math.floor(Math.abs(x)); + if (x < lowerBound || x > upperBound) { + throw new TypeError("Argument is not in byte range"); + } - /** - * Get an iterator on values. - * - * @return Iterator - */ - values() { - return createHeadersIterator(this, 'value'); - } + return x; + } - /** - * Get an iterator on entries. - * - * This is the default iterator of the Headers object. - * - * @return Iterator - */ - [Symbol.iterator]() { - return createHeadersIterator(this, 'key+value'); - } -} -Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - -Object.defineProperty(Headers.prototype, Symbol.toStringTag, { - value: 'Headers', - writable: false, - enumerable: false, - configurable: true -}); + if (!isNaN(x) && opts.clamp) { + x = evenRound(x); -Object.defineProperties(Headers.prototype, { - get: { enumerable: true }, - forEach: { enumerable: true }, - set: { enumerable: true }, - append: { enumerable: true }, - has: { enumerable: true }, - delete: { enumerable: true }, - keys: { enumerable: true }, - values: { enumerable: true }, - entries: { enumerable: true } -}); + if (x < lowerBound) x = lowerBound; + if (x > upperBound) x = upperBound; + return x; + } -function getHeaders(headers) { - let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + if (!Number.isFinite(x) || x === 0) { + return 0; + } - const keys = Object.keys(headers[MAP]).sort(); - return keys.map(kind === 'key' ? function (k) { - return k.toLowerCase(); - } : kind === 'value' ? function (k) { - return headers[MAP][k].join(', '); - } : function (k) { - return [k.toLowerCase(), headers[MAP][k].join(', ')]; - }); -} + x = sign(x) * Math.floor(Math.abs(x)); + x = x % moduloVal; -const INTERNAL = Symbol('internal'); + if (!typeOpts.unsigned && x >= moduloBound) { + return x - moduloVal; + } else if (typeOpts.unsigned) { + if (x < 0) { + x += moduloVal; + } else if (x === -0) { // don't return negative zero + return 0; + } + } -function createHeadersIterator(target, kind) { - const iterator = Object.create(HeadersIteratorPrototype); - iterator[INTERNAL] = { - target, - kind, - index: 0 - }; - return iterator; + return x; + } } -const HeadersIteratorPrototype = Object.setPrototypeOf({ - next() { - // istanbul ignore if - if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { - throw new TypeError('Value of `this` is not a HeadersIterator'); - } +conversions["void"] = function () { + return undefined; +}; - var _INTERNAL = this[INTERNAL]; - const target = _INTERNAL.target, - kind = _INTERNAL.kind, - index = _INTERNAL.index; +conversions["boolean"] = function (val) { + return !!val; +}; - const values = getHeaders(target, kind); - const len = values.length; - if (index >= len) { - return { - value: undefined, - done: true - }; - } +conversions["byte"] = createNumberConversion(8, { unsigned: false }); +conversions["octet"] = createNumberConversion(8, { unsigned: true }); - this[INTERNAL].index = index + 1; +conversions["short"] = createNumberConversion(16, { unsigned: false }); +conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); - return { - value: values[index], - done: false - }; - } -}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); +conversions["long"] = createNumberConversion(32, { unsigned: false }); +conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); -Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { - value: 'HeadersIterator', - writable: false, - enumerable: false, - configurable: true -}); +conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); +conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); -/** - * Export the Headers object in a form that Node.js can consume. - * - * @param Headers headers - * @return Object - */ -function exportNodeCompatibleHeaders(headers) { - const obj = Object.assign({ __proto__: null }, headers[MAP]); +conversions["double"] = function (V) { + const x = +V; - // http.request() only supports string as Host header. This hack makes - // specifying custom Host header possible. - const hostHeaderKey = find(headers[MAP], 'Host'); - if (hostHeaderKey !== undefined) { - obj[hostHeaderKey] = obj[hostHeaderKey][0]; - } + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite floating-point value"); + } - return obj; -} + return x; +}; -/** - * Create a Headers object from an object of headers, ignoring those that do - * not conform to HTTP grammar productions. - * - * @param Object obj Object of headers - * @return Headers - */ -function createHeadersLenient(obj) { - const headers = new Headers(); - for (const name of Object.keys(obj)) { - if (invalidTokenRegex.test(name)) { - continue; - } - if (Array.isArray(obj[name])) { - for (const val of obj[name]) { - if (invalidHeaderCharRegex.test(val)) { - continue; - } - if (headers[MAP][name] === undefined) { - headers[MAP][name] = [val]; - } else { - headers[MAP][name].push(val); - } - } - } else if (!invalidHeaderCharRegex.test(obj[name])) { - headers[MAP][name] = [obj[name]]; - } - } - return headers; -} +conversions["unrestricted double"] = function (V) { + const x = +V; -const INTERNALS$1 = Symbol('Response internals'); + if (isNaN(x)) { + throw new TypeError("Argument is NaN"); + } -// fix an issue where "STATUS_CODES" aren't a named export for node <10 -const STATUS_CODES = http.STATUS_CODES; + return x; +}; -/** - * Response class - * - * @param Stream body Readable stream - * @param Object opts Response options - * @return Void - */ -class Response { - constructor() { - let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; +// not quite valid, but good enough for JS +conversions["float"] = conversions["double"]; +conversions["unrestricted float"] = conversions["unrestricted double"]; - Body.call(this, body, opts); +conversions["DOMString"] = function (V, opts) { + if (!opts) opts = {}; - const status = opts.status || 200; - const headers = new Headers(opts.headers); + if (opts.treatNullAsEmptyString && V === null) { + return ""; + } - if (body != null && !headers.has('Content-Type')) { - const contentType = extractContentType(body); - if (contentType) { - headers.append('Content-Type', contentType); - } - } + return String(V); +}; - this[INTERNALS$1] = { - url: opts.url, - status, - statusText: opts.statusText || STATUS_CODES[status], - headers, - counter: opts.counter - }; - } +conversions["ByteString"] = function (V, opts) { + const x = String(V); + let c = undefined; + for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { + if (c > 255) { + throw new TypeError("Argument is not a valid bytestring"); + } + } - get url() { - return this[INTERNALS$1].url || ''; - } + return x; +}; - get status() { - return this[INTERNALS$1].status; - } +conversions["USVString"] = function (V) { + const S = String(V); + const n = S.length; + const U = []; + for (let i = 0; i < n; ++i) { + const c = S.charCodeAt(i); + if (c < 0xD800 || c > 0xDFFF) { + U.push(String.fromCodePoint(c)); + } else if (0xDC00 <= c && c <= 0xDFFF) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + if (i === n - 1) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + const d = S.charCodeAt(i + 1); + if (0xDC00 <= d && d <= 0xDFFF) { + const a = c & 0x3FF; + const b = d & 0x3FF; + U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); + ++i; + } else { + U.push(String.fromCodePoint(0xFFFD)); + } + } + } + } - /** - * Convenience property representing if the request ended normally - */ - get ok() { - return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; - } + return U.join(''); +}; - get redirected() { - return this[INTERNALS$1].counter > 0; - } +conversions["Date"] = function (V, opts) { + if (!(V instanceof Date)) { + throw new TypeError("Argument is not a Date object"); + } + if (isNaN(V)) { + return undefined; + } - get statusText() { - return this[INTERNALS$1].statusText; - } + return V; +}; - get headers() { - return this[INTERNALS$1].headers; - } +conversions["RegExp"] = function (V, opts) { + if (!(V instanceof RegExp)) { + V = new RegExp(V); + } - /** - * Clone this response - * - * @return Response - */ - clone() { - return new Response(clone(this), { - url: this.url, - status: this.status, - statusText: this.statusText, - headers: this.headers, - ok: this.ok, - redirected: this.redirected - }); - } -} + return V; +}; -Body.mixIn(Response.prototype); -Object.defineProperties(Response.prototype, { - url: { enumerable: true }, - status: { enumerable: true }, - ok: { enumerable: true }, - redirected: { enumerable: true }, - statusText: { enumerable: true }, - headers: { enumerable: true }, - clone: { enumerable: true } -}); +/***/ }), -Object.defineProperty(Response.prototype, Symbol.toStringTag, { - value: 'Response', - writable: false, - enumerable: false, - configurable: true -}); +/***/ 8262: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -const INTERNALS$2 = Symbol('Request internals'); -const URL = Url.URL || whatwgUrl.URL; +"use strict"; -// fix an issue where "format", "parse" aren't a named export for node <10 -const parse_url = Url.parse; -const format_url = Url.format; +const usm = __nccwpck_require__(33); -/** - * Wrapper around `new URL` to handle arbitrary URLs - * - * @param {string} urlStr - * @return {void} - */ -function parseURL(urlStr) { - /* - Check whether the URL is absolute or not - Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 - Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 - */ - if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { - urlStr = new URL(urlStr).toString(); - } +exports.implementation = class URLImpl { + constructor(constructorArgs) { + const url = constructorArgs[0]; + const base = constructorArgs[1]; - // Fallback to old implementation for arbitrary URLs - return parse_url(urlStr); -} + let parsedBase = null; + if (base !== undefined) { + parsedBase = usm.basicURLParse(base); + if (parsedBase === "failure") { + throw new TypeError("Invalid base URL"); + } + } -const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } -/** - * Check if a value is an instance of Request. - * - * @param Mixed input - * @return Boolean - */ -function isRequest(input) { - return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; -} + this._url = parsedURL; -function isAbortSignal(signal) { - const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); - return !!(proto && proto.constructor.name === 'AbortSignal'); -} + // TODO: query stuff + } -/** - * Request class - * - * @param Mixed input Url or Request instance - * @param Object init Custom options - * @return Void - */ -class Request { - constructor(input) { - let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + get href() { + return usm.serializeURL(this._url); + } - let parsedURL; + set href(v) { + const parsedURL = usm.basicURLParse(v); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } - // normalize input - if (!isRequest(input)) { - if (input && input.href) { - // in order to support Node.js' Url objects; though WHATWG's URL objects - // will fall into this branch also (since their `toString()` will return - // `href` property anyway) - parsedURL = parseURL(input.href); - } else { - // coerce input to a string before attempting to parse - parsedURL = parseURL(`${input}`); - } - input = {}; - } else { - parsedURL = parseURL(input.url); - } + this._url = parsedURL; + } - let method = init.method || input.method || 'GET'; - method = method.toUpperCase(); + get origin() { + return usm.serializeURLOrigin(this._url); + } - if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { - throw new TypeError('Request with GET/HEAD method cannot have body'); - } + get protocol() { + return this._url.scheme + ":"; + } - let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + set protocol(v) { + usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); + } - Body.call(this, inputBody, { - timeout: init.timeout || input.timeout || 0, - size: init.size || input.size || 0 - }); + get username() { + return this._url.username; + } - const headers = new Headers(init.headers || input.headers || {}); + set username(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } - if (inputBody != null && !headers.has('Content-Type')) { - const contentType = extractContentType(inputBody); - if (contentType) { - headers.append('Content-Type', contentType); - } - } + usm.setTheUsername(this._url, v); + } - let signal = isRequest(input) ? input.signal : null; - if ('signal' in init) signal = init.signal; + get password() { + return this._url.password; + } - if (signal != null && !isAbortSignal(signal)) { - throw new TypeError('Expected signal to be an instanceof AbortSignal'); - } + set password(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } - this[INTERNALS$2] = { - method, - redirect: init.redirect || input.redirect || 'follow', - headers, - parsedURL, - signal - }; + usm.setThePassword(this._url, v); + } - // node-fetch-only options - this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; - this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; - this.counter = init.counter || input.counter || 0; - this.agent = init.agent || input.agent; - } + get host() { + const url = this._url; - get method() { - return this[INTERNALS$2].method; - } + if (url.host === null) { + return ""; + } - get url() { - return format_url(this[INTERNALS$2].parsedURL); - } + if (url.port === null) { + return usm.serializeHost(url.host); + } - get headers() { - return this[INTERNALS$2].headers; - } + return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); + } - get redirect() { - return this[INTERNALS$2].redirect; - } + set host(v) { + if (this._url.cannotBeABaseURL) { + return; + } - get signal() { - return this[INTERNALS$2].signal; - } + usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); + } - /** - * Clone this request - * - * @return Request - */ - clone() { - return new Request(this); - } -} - -Body.mixIn(Request.prototype); + get hostname() { + if (this._url.host === null) { + return ""; + } -Object.defineProperty(Request.prototype, Symbol.toStringTag, { - value: 'Request', - writable: false, - enumerable: false, - configurable: true -}); + return usm.serializeHost(this._url.host); + } -Object.defineProperties(Request.prototype, { - method: { enumerable: true }, - url: { enumerable: true }, - headers: { enumerable: true }, - redirect: { enumerable: true }, - clone: { enumerable: true }, - signal: { enumerable: true } -}); + set hostname(v) { + if (this._url.cannotBeABaseURL) { + return; + } -/** - * Convert a Request to Node.js http request options. - * - * @param Request A Request instance - * @return Object The options object to be passed to http.request - */ -function getNodeRequestOptions(request) { - const parsedURL = request[INTERNALS$2].parsedURL; - const headers = new Headers(request[INTERNALS$2].headers); + usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + } - // fetch step 1.3 - if (!headers.has('Accept')) { - headers.set('Accept', '*/*'); - } + get port() { + if (this._url.port === null) { + return ""; + } - // Basic fetch - if (!parsedURL.protocol || !parsedURL.hostname) { - throw new TypeError('Only absolute URLs are supported'); - } + return usm.serializeInteger(this._url.port); + } - if (!/^https?:$/.test(parsedURL.protocol)) { - throw new TypeError('Only HTTP(S) protocols are supported'); - } + set port(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } - if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { - throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); - } + if (v === "") { + this._url.port = null; + } else { + usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); + } + } - // HTTP-network-or-cache fetch steps 2.4-2.7 - let contentLengthValue = null; - if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { - contentLengthValue = '0'; - } - if (request.body != null) { - const totalBytes = getTotalBytes(request); - if (typeof totalBytes === 'number') { - contentLengthValue = String(totalBytes); - } - } - if (contentLengthValue) { - headers.set('Content-Length', contentLengthValue); - } + get pathname() { + if (this._url.cannotBeABaseURL) { + return this._url.path[0]; + } - // HTTP-network-or-cache fetch step 2.11 - if (!headers.has('User-Agent')) { - headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); - } + if (this._url.path.length === 0) { + return ""; + } - // HTTP-network-or-cache fetch step 2.15 - if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); - } + return "/" + this._url.path.join("/"); + } - let agent = request.agent; - if (typeof agent === 'function') { - agent = agent(parsedURL); - } + set pathname(v) { + if (this._url.cannotBeABaseURL) { + return; + } - if (!headers.has('Connection') && !agent) { - headers.set('Connection', 'close'); - } + this._url.path = []; + usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); + } - // HTTP-network fetch step 4.2 - // chunked encoding is handled by Node.js + get search() { + if (this._url.query === null || this._url.query === "") { + return ""; + } - return Object.assign({}, parsedURL, { - method: request.method, - headers: exportNodeCompatibleHeaders(headers), - agent - }); -} + return "?" + this._url.query; + } -/** - * abort-error.js - * - * AbortError interface for cancelled requests - */ + set search(v) { + // TODO: query stuff -/** - * Create AbortError instance - * - * @param String message Error message for human - * @return AbortError - */ -function AbortError(message) { - Error.call(this, message); + const url = this._url; - this.type = 'aborted'; - this.message = message; + if (v === "") { + url.query = null; + return; + } - // hide custom error implementation details from end-users - Error.captureStackTrace(this, this.constructor); -} + const input = v[0] === "?" ? v.substring(1) : v; + url.query = ""; + usm.basicURLParse(input, { url, stateOverride: "query" }); + } -AbortError.prototype = Object.create(Error.prototype); -AbortError.prototype.constructor = AbortError; -AbortError.prototype.name = 'AbortError'; + get hash() { + if (this._url.fragment === null || this._url.fragment === "") { + return ""; + } -const URL$1 = Url.URL || whatwgUrl.URL; + return "#" + this._url.fragment; + } -// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 -const PassThrough$1 = Stream.PassThrough; + set hash(v) { + if (v === "") { + this._url.fragment = null; + return; + } -const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { - const orig = new URL$1(original).hostname; - const dest = new URL$1(destination).hostname; + const input = v[0] === "#" ? v.substring(1) : v; + this._url.fragment = ""; + usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); + } - return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); + toJSON() { + return this.href; + } }; -/** - * Fetch function - * - * @param Mixed url Absolute url or Request instance - * @param Object opts Fetch options - * @return Promise - */ -function fetch(url, opts) { - - // allow custom promise - if (!fetch.Promise) { - throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); - } - - Body.Promise = fetch.Promise; - // wrap http.request into fetch - return new fetch.Promise(function (resolve, reject) { - // build request object - const request = new Request(url, opts); - const options = getNodeRequestOptions(request); +/***/ }), - const send = (options.protocol === 'https:' ? https : http).request; - const signal = request.signal; +/***/ 653: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - let response = null; +"use strict"; - const abort = function abort() { - let error = new AbortError('The user aborted a request.'); - reject(error); - if (request.body && request.body instanceof Stream.Readable) { - request.body.destroy(error); - } - if (!response || !response.body) return; - response.body.emit('error', error); - }; - if (signal && signal.aborted) { - abort(); - return; - } +const conversions = __nccwpck_require__(5871); +const utils = __nccwpck_require__(276); +const Impl = __nccwpck_require__(8262); - const abortAndFinalize = function abortAndFinalize() { - abort(); - finalize(); - }; +const impl = utils.implSymbol; - // send request - const req = send(options); - let reqTimeout; +function URL(url) { + if (!this || this[impl] || !(this instanceof URL)) { + throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); + } + if (arguments.length < 1) { + throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); + } + const args = []; + for (let i = 0; i < arguments.length && i < 2; ++i) { + args[i] = arguments[i]; + } + args[0] = conversions["USVString"](args[0]); + if (args[1] !== undefined) { + args[1] = conversions["USVString"](args[1]); + } - if (signal) { - signal.addEventListener('abort', abortAndFinalize); - } + module.exports.setup(this, args); +} - function finalize() { - req.abort(); - if (signal) signal.removeEventListener('abort', abortAndFinalize); - clearTimeout(reqTimeout); - } - - if (request.timeout) { - req.once('socket', function (socket) { - reqTimeout = setTimeout(function () { - reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); - finalize(); - }, request.timeout); - }); - } +URL.prototype.toJSON = function toJSON() { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + const args = []; + for (let i = 0; i < arguments.length && i < 0; ++i) { + args[i] = arguments[i]; + } + return this[impl].toJSON.apply(this[impl], args); +}; +Object.defineProperty(URL.prototype, "href", { + get() { + return this[impl].href; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].href = V; + }, + enumerable: true, + configurable: true +}); - req.on('error', function (err) { - reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); - finalize(); - }); +URL.prototype.toString = function () { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + return this.href; +}; - req.on('response', function (res) { - clearTimeout(reqTimeout); +Object.defineProperty(URL.prototype, "origin", { + get() { + return this[impl].origin; + }, + enumerable: true, + configurable: true +}); - const headers = createHeadersLenient(res.headers); +Object.defineProperty(URL.prototype, "protocol", { + get() { + return this[impl].protocol; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].protocol = V; + }, + enumerable: true, + configurable: true +}); - // HTTP fetch step 5 - if (fetch.isRedirect(res.statusCode)) { - // HTTP fetch step 5.2 - const location = headers.get('Location'); +Object.defineProperty(URL.prototype, "username", { + get() { + return this[impl].username; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].username = V; + }, + enumerable: true, + configurable: true +}); - // HTTP fetch step 5.3 - let locationURL = null; - try { - locationURL = location === null ? null : new URL$1(location, request.url).toString(); - } catch (err) { - // error here can only be invalid URL in Location: header - // do not throw when options.redirect == manual - // let the user extract the errorneous redirect URL - if (request.redirect !== 'manual') { - reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); - finalize(); - return; - } - } +Object.defineProperty(URL.prototype, "password", { + get() { + return this[impl].password; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].password = V; + }, + enumerable: true, + configurable: true +}); - // HTTP fetch step 5.5 - switch (request.redirect) { - case 'error': - reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); - finalize(); - return; - case 'manual': - // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. - if (locationURL !== null) { - // handle corrupted header - try { - headers.set('Location', locationURL); - } catch (err) { - // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request - reject(err); - } - } - break; - case 'follow': - // HTTP-redirect fetch step 2 - if (locationURL === null) { - break; - } +Object.defineProperty(URL.prototype, "host", { + get() { + return this[impl].host; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].host = V; + }, + enumerable: true, + configurable: true +}); - // HTTP-redirect fetch step 5 - if (request.counter >= request.follow) { - reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); - finalize(); - return; - } +Object.defineProperty(URL.prototype, "hostname", { + get() { + return this[impl].hostname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hostname = V; + }, + enumerable: true, + configurable: true +}); - // HTTP-redirect fetch step 6 (counter increment) - // Create a new Request object. - const requestOpts = { - headers: new Headers(request.headers), - follow: request.follow, - counter: request.counter + 1, - agent: request.agent, - compress: request.compress, - method: request.method, - body: request.body, - signal: request.signal, - timeout: request.timeout, - size: request.size - }; +Object.defineProperty(URL.prototype, "port", { + get() { + return this[impl].port; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].port = V; + }, + enumerable: true, + configurable: true +}); - if (!isDomainOrSubdomain(request.url, locationURL)) { - for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { - requestOpts.headers.delete(name); - } - } +Object.defineProperty(URL.prototype, "pathname", { + get() { + return this[impl].pathname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].pathname = V; + }, + enumerable: true, + configurable: true +}); - // HTTP-redirect fetch step 9 - if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { - reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); - finalize(); - return; - } +Object.defineProperty(URL.prototype, "search", { + get() { + return this[impl].search; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].search = V; + }, + enumerable: true, + configurable: true +}); - // HTTP-redirect fetch step 11 - if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { - requestOpts.method = 'GET'; - requestOpts.body = undefined; - requestOpts.headers.delete('content-length'); - } +Object.defineProperty(URL.prototype, "hash", { + get() { + return this[impl].hash; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hash = V; + }, + enumerable: true, + configurable: true +}); - // HTTP-redirect fetch step 15 - resolve(fetch(new Request(locationURL, requestOpts))); - finalize(); - return; - } - } - // prepare response - res.once('end', function () { - if (signal) signal.removeEventListener('abort', abortAndFinalize); - }); - let body = res.pipe(new PassThrough$1()); +module.exports = { + is(obj) { + return !!obj && obj[impl] instanceof Impl.implementation; + }, + create(constructorArgs, privateData) { + let obj = Object.create(URL.prototype); + this.setup(obj, constructorArgs, privateData); + return obj; + }, + setup(obj, constructorArgs, privateData) { + if (!privateData) privateData = {}; + privateData.wrapper = obj; - const response_options = { - url: request.url, - status: res.statusCode, - statusText: res.statusMessage, - headers: headers, - size: request.size, - timeout: request.timeout, - counter: request.counter - }; - - // HTTP-network fetch step 12.1.1.3 - const codings = headers.get('Content-Encoding'); - - // HTTP-network fetch step 12.1.1.4: handle content codings - - // in following scenarios we ignore compression support - // 1. compression support is disabled - // 2. HEAD request - // 3. no Content-Encoding header - // 4. no content response (204) - // 5. content not modified response (304) - if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { - response = new Response(body, response_options); - resolve(response); - return; - } - - // For Node v6+ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - const zlibOptions = { - flush: zlib.Z_SYNC_FLUSH, - finishFlush: zlib.Z_SYNC_FLUSH - }; - - // for gzip - if (codings == 'gzip' || codings == 'x-gzip') { - body = body.pipe(zlib.createGunzip(zlibOptions)); - response = new Response(body, response_options); - resolve(response); - return; - } - - // for deflate - if (codings == 'deflate' || codings == 'x-deflate') { - // handle the infamous raw deflate response from old servers - // a hack for old IIS and Apache servers - const raw = res.pipe(new PassThrough$1()); - raw.once('data', function (chunk) { - // see http://stackoverflow.com/questions/37519828 - if ((chunk[0] & 0x0F) === 0x08) { - body = body.pipe(zlib.createInflate()); - } else { - body = body.pipe(zlib.createInflateRaw()); - } - response = new Response(body, response_options); - resolve(response); - }); - return; - } - - // for br - if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { - body = body.pipe(zlib.createBrotliDecompress()); - response = new Response(body, response_options); - resolve(response); - return; - } - - // otherwise, use response as-is - response = new Response(body, response_options); - resolve(response); - }); - - writeToStream(req, request); - }); -} -/** - * Redirect code matching - * - * @param Number code Status code - * @return Boolean - */ -fetch.isRedirect = function (code) { - return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; + obj[impl] = new Impl.implementation(constructorArgs, privateData); + obj[impl][utils.wrapperSymbol] = obj; + }, + interface: URL, + expose: { + Window: { URL: URL }, + Worker: { URL: URL } + } }; -// expose Promise -fetch.Promise = global.Promise; - -module.exports = exports = fetch; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports["default"] = exports; -exports.Headers = Headers; -exports.Request = Request; -exports.Response = Response; -exports.FetchError = FetchError; /***/ }), -/***/ 2299: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 3323: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var punycode = __nccwpck_require__(5477); -var mappingTable = __nccwpck_require__(1907); - -var PROCESSING_OPTIONS = { - TRANSITIONAL: 0, - NONTRANSITIONAL: 1 -}; - -function normalize(str) { // fix bug in v8 - return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); -} - -function findStatus(val) { - var start = 0; - var end = mappingTable.length - 1; - - while (start <= end) { - var mid = Math.floor((start + end) / 2); - - var target = mappingTable[mid]; - if (target[0][0] <= val && target[0][1] >= val) { - return target; - } else if (target[0][0] > val) { - end = mid - 1; - } else { - start = mid + 1; - } - } - - return null; -} - -var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - -function countSymbols(string) { - return string - // replace every surrogate pair with a BMP symbol - .replace(regexAstralSymbols, '_') - // then get the length - .length; -} - -function mapChars(domain_name, useSTD3, processing_option) { - var hasError = false; - var processed = ""; - - var len = countSymbols(domain_name); - for (var i = 0; i < len; ++i) { - var codePoint = domain_name.codePointAt(i); - var status = findStatus(codePoint); - - switch (status[1]) { - case "disallowed": - hasError = true; - processed += String.fromCodePoint(codePoint); - break; - case "ignored": - break; - case "mapped": - processed += String.fromCodePoint.apply(String, status[2]); - break; - case "deviation": - if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { - processed += String.fromCodePoint.apply(String, status[2]); - } else { - processed += String.fromCodePoint(codePoint); - } - break; - case "valid": - processed += String.fromCodePoint(codePoint); - break; - case "disallowed_STD3_mapped": - if (useSTD3) { - hasError = true; - processed += String.fromCodePoint(codePoint); - } else { - processed += String.fromCodePoint.apply(String, status[2]); - } - break; - case "disallowed_STD3_valid": - if (useSTD3) { - hasError = true; - } - - processed += String.fromCodePoint(codePoint); - break; - } - } - - return { - string: processed, - error: hasError - }; -} - -var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; - -function validateLabel(label, processing_option) { - if (label.substr(0, 4) === "xn--") { - label = punycode.toUnicode(label); - processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; - } - - var error = false; - - if (normalize(label) !== label || - (label[3] === "-" && label[4] === "-") || - label[0] === "-" || label[label.length - 1] === "-" || - label.indexOf(".") !== -1 || - label.search(combiningMarksRegex) === 0) { - error = true; - } +exports.URL = __nccwpck_require__(653)["interface"]; +exports.serializeURL = __nccwpck_require__(33).serializeURL; +exports.serializeURLOrigin = __nccwpck_require__(33).serializeURLOrigin; +exports.basicURLParse = __nccwpck_require__(33).basicURLParse; +exports.setTheUsername = __nccwpck_require__(33).setTheUsername; +exports.setThePassword = __nccwpck_require__(33).setThePassword; +exports.serializeHost = __nccwpck_require__(33).serializeHost; +exports.serializeInteger = __nccwpck_require__(33).serializeInteger; +exports.parseURL = __nccwpck_require__(33).parseURL; - var len = countSymbols(label); - for (var i = 0; i < len; ++i) { - var status = findStatus(label.codePointAt(i)); - if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || - (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && - status[1] !== "valid" && status[1] !== "deviation")) { - error = true; - break; - } - } - return { - label: label, - error: error - }; -} +/***/ }), -function processing(domain_name, useSTD3, processing_option) { - var result = mapChars(domain_name, useSTD3, processing_option); - result.string = normalize(result.string); - - var labels = result.string.split("."); - for (var i = 0; i < labels.length; ++i) { - try { - var validation = validateLabel(labels[i]); - labels[i] = validation.label; - result.error = result.error || validation.error; - } catch(e) { - result.error = true; - } - } - - return { - string: labels.join("."), - error: result.error - }; -} - -module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { - var result = processing(domain_name, useSTD3, processing_option); - var labels = result.string.split("."); - labels = labels.map(function(l) { - try { - return punycode.toASCII(l); - } catch(e) { - result.error = true; - return l; - } - }); - - if (verifyDnsLength) { - var total = labels.slice(0, labels.length - 1).join(".").length; - if (total.length > 253 || total.length === 0) { - result.error = true; - } - - for (var i=0; i < labels.length; ++i) { - if (labels.length > 63 || labels.length === 0) { - result.error = true; - break; - } - } - } - - if (result.error) return null; - return labels.join("."); -}; - -module.exports.toUnicode = function(domain_name, useSTD3) { - var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); - - return { - domain: result.string, - error: result.error - }; -}; - -module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; - - -/***/ }), - -/***/ 5871: -/***/ ((module) => { - -"use strict"; - - -var conversions = {}; -module.exports = conversions; - -function sign(x) { - return x < 0 ? -1 : 1; -} - -function evenRound(x) { - // Round x to the nearest integer, choosing the even integer if it lies halfway between two. - if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) - return Math.floor(x); - } else { - return Math.round(x); - } -} - -function createNumberConversion(bitLength, typeOpts) { - if (!typeOpts.unsigned) { - --bitLength; - } - const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); - const upperBound = Math.pow(2, bitLength) - 1; - - const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); - const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); - - return function(V, opts) { - if (!opts) opts = {}; - - let x = +V; - - if (opts.enforceRange) { - if (!Number.isFinite(x)) { - throw new TypeError("Argument is not a finite number"); - } - - x = sign(x) * Math.floor(Math.abs(x)); - if (x < lowerBound || x > upperBound) { - throw new TypeError("Argument is not in byte range"); - } - - return x; - } - - if (!isNaN(x) && opts.clamp) { - x = evenRound(x); - - if (x < lowerBound) x = lowerBound; - if (x > upperBound) x = upperBound; - return x; - } - - if (!Number.isFinite(x) || x === 0) { - return 0; - } - - x = sign(x) * Math.floor(Math.abs(x)); - x = x % moduloVal; - - if (!typeOpts.unsigned && x >= moduloBound) { - return x - moduloVal; - } else if (typeOpts.unsigned) { - if (x < 0) { - x += moduloVal; - } else if (x === -0) { // don't return negative zero - return 0; - } - } - - return x; - } -} - -conversions["void"] = function () { - return undefined; -}; - -conversions["boolean"] = function (val) { - return !!val; -}; - -conversions["byte"] = createNumberConversion(8, { unsigned: false }); -conversions["octet"] = createNumberConversion(8, { unsigned: true }); - -conversions["short"] = createNumberConversion(16, { unsigned: false }); -conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); - -conversions["long"] = createNumberConversion(32, { unsigned: false }); -conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); - -conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); -conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); - -conversions["double"] = function (V) { - const x = +V; - - if (!Number.isFinite(x)) { - throw new TypeError("Argument is not a finite floating-point value"); - } - - return x; -}; - -conversions["unrestricted double"] = function (V) { - const x = +V; - - if (isNaN(x)) { - throw new TypeError("Argument is NaN"); - } - - return x; -}; - -// not quite valid, but good enough for JS -conversions["float"] = conversions["double"]; -conversions["unrestricted float"] = conversions["unrestricted double"]; - -conversions["DOMString"] = function (V, opts) { - if (!opts) opts = {}; - - if (opts.treatNullAsEmptyString && V === null) { - return ""; - } - - return String(V); -}; - -conversions["ByteString"] = function (V, opts) { - const x = String(V); - let c = undefined; - for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { - if (c > 255) { - throw new TypeError("Argument is not a valid bytestring"); - } - } - - return x; -}; - -conversions["USVString"] = function (V) { - const S = String(V); - const n = S.length; - const U = []; - for (let i = 0; i < n; ++i) { - const c = S.charCodeAt(i); - if (c < 0xD800 || c > 0xDFFF) { - U.push(String.fromCodePoint(c)); - } else if (0xDC00 <= c && c <= 0xDFFF) { - U.push(String.fromCodePoint(0xFFFD)); - } else { - if (i === n - 1) { - U.push(String.fromCodePoint(0xFFFD)); - } else { - const d = S.charCodeAt(i + 1); - if (0xDC00 <= d && d <= 0xDFFF) { - const a = c & 0x3FF; - const b = d & 0x3FF; - U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); - ++i; - } else { - U.push(String.fromCodePoint(0xFFFD)); - } - } - } - } - - return U.join(''); -}; - -conversions["Date"] = function (V, opts) { - if (!(V instanceof Date)) { - throw new TypeError("Argument is not a Date object"); - } - if (isNaN(V)) { - return undefined; - } - - return V; -}; - -conversions["RegExp"] = function (V, opts) { - if (!(V instanceof RegExp)) { - V = new RegExp(V); - } - - return V; -}; - - -/***/ }), - -/***/ 8262: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -const usm = __nccwpck_require__(33); - -exports.implementation = class URLImpl { - constructor(constructorArgs) { - const url = constructorArgs[0]; - const base = constructorArgs[1]; - - let parsedBase = null; - if (base !== undefined) { - parsedBase = usm.basicURLParse(base); - if (parsedBase === "failure") { - throw new TypeError("Invalid base URL"); - } - } - - const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); - if (parsedURL === "failure") { - throw new TypeError("Invalid URL"); - } - - this._url = parsedURL; - - // TODO: query stuff - } - - get href() { - return usm.serializeURL(this._url); - } - - set href(v) { - const parsedURL = usm.basicURLParse(v); - if (parsedURL === "failure") { - throw new TypeError("Invalid URL"); - } - - this._url = parsedURL; - } - - get origin() { - return usm.serializeURLOrigin(this._url); - } - - get protocol() { - return this._url.scheme + ":"; - } - - set protocol(v) { - usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); - } - - get username() { - return this._url.username; - } - - set username(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } - - usm.setTheUsername(this._url, v); - } - - get password() { - return this._url.password; - } - - set password(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } - - usm.setThePassword(this._url, v); - } - - get host() { - const url = this._url; - - if (url.host === null) { - return ""; - } - - if (url.port === null) { - return usm.serializeHost(url.host); - } - - return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); - } - - set host(v) { - if (this._url.cannotBeABaseURL) { - return; - } - - usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); - } - - get hostname() { - if (this._url.host === null) { - return ""; - } - - return usm.serializeHost(this._url.host); - } - - set hostname(v) { - if (this._url.cannotBeABaseURL) { - return; - } - - usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); - } - - get port() { - if (this._url.port === null) { - return ""; - } - - return usm.serializeInteger(this._url.port); - } - - set port(v) { - if (usm.cannotHaveAUsernamePasswordPort(this._url)) { - return; - } - - if (v === "") { - this._url.port = null; - } else { - usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); - } - } - - get pathname() { - if (this._url.cannotBeABaseURL) { - return this._url.path[0]; - } - - if (this._url.path.length === 0) { - return ""; - } - - return "/" + this._url.path.join("/"); - } - - set pathname(v) { - if (this._url.cannotBeABaseURL) { - return; - } - - this._url.path = []; - usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); - } - - get search() { - if (this._url.query === null || this._url.query === "") { - return ""; - } - - return "?" + this._url.query; - } - - set search(v) { - // TODO: query stuff - - const url = this._url; - - if (v === "") { - url.query = null; - return; - } - - const input = v[0] === "?" ? v.substring(1) : v; - url.query = ""; - usm.basicURLParse(input, { url, stateOverride: "query" }); - } - - get hash() { - if (this._url.fragment === null || this._url.fragment === "") { - return ""; - } - - return "#" + this._url.fragment; - } - - set hash(v) { - if (v === "") { - this._url.fragment = null; - return; - } - - const input = v[0] === "#" ? v.substring(1) : v; - this._url.fragment = ""; - usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); - } - - toJSON() { - return this.href; - } -}; - - -/***/ }), - -/***/ 653: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const conversions = __nccwpck_require__(5871); -const utils = __nccwpck_require__(276); -const Impl = __nccwpck_require__(8262); - -const impl = utils.implSymbol; - -function URL(url) { - if (!this || this[impl] || !(this instanceof URL)) { - throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); - } - if (arguments.length < 1) { - throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); - } - const args = []; - for (let i = 0; i < arguments.length && i < 2; ++i) { - args[i] = arguments[i]; - } - args[0] = conversions["USVString"](args[0]); - if (args[1] !== undefined) { - args[1] = conversions["USVString"](args[1]); - } - - module.exports.setup(this, args); -} - -URL.prototype.toJSON = function toJSON() { - if (!this || !module.exports.is(this)) { - throw new TypeError("Illegal invocation"); - } - const args = []; - for (let i = 0; i < arguments.length && i < 0; ++i) { - args[i] = arguments[i]; - } - return this[impl].toJSON.apply(this[impl], args); -}; -Object.defineProperty(URL.prototype, "href", { - get() { - return this[impl].href; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].href = V; - }, - enumerable: true, - configurable: true -}); - -URL.prototype.toString = function () { - if (!this || !module.exports.is(this)) { - throw new TypeError("Illegal invocation"); - } - return this.href; -}; - -Object.defineProperty(URL.prototype, "origin", { - get() { - return this[impl].origin; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "protocol", { - get() { - return this[impl].protocol; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].protocol = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "username", { - get() { - return this[impl].username; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].username = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "password", { - get() { - return this[impl].password; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].password = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "host", { - get() { - return this[impl].host; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].host = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "hostname", { - get() { - return this[impl].hostname; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].hostname = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "port", { - get() { - return this[impl].port; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].port = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "pathname", { - get() { - return this[impl].pathname; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].pathname = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "search", { - get() { - return this[impl].search; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].search = V; - }, - enumerable: true, - configurable: true -}); - -Object.defineProperty(URL.prototype, "hash", { - get() { - return this[impl].hash; - }, - set(V) { - V = conversions["USVString"](V); - this[impl].hash = V; - }, - enumerable: true, - configurable: true -}); - - -module.exports = { - is(obj) { - return !!obj && obj[impl] instanceof Impl.implementation; - }, - create(constructorArgs, privateData) { - let obj = Object.create(URL.prototype); - this.setup(obj, constructorArgs, privateData); - return obj; - }, - setup(obj, constructorArgs, privateData) { - if (!privateData) privateData = {}; - privateData.wrapper = obj; - - obj[impl] = new Impl.implementation(constructorArgs, privateData); - obj[impl][utils.wrapperSymbol] = obj; - }, - interface: URL, - expose: { - Window: { URL: URL }, - Worker: { URL: URL } - } -}; - - - -/***/ }), - -/***/ 3323: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -exports.URL = __nccwpck_require__(653)["interface"]; -exports.serializeURL = __nccwpck_require__(33).serializeURL; -exports.serializeURLOrigin = __nccwpck_require__(33).serializeURLOrigin; -exports.basicURLParse = __nccwpck_require__(33).basicURLParse; -exports.setTheUsername = __nccwpck_require__(33).setTheUsername; -exports.setThePassword = __nccwpck_require__(33).setThePassword; -exports.serializeHost = __nccwpck_require__(33).serializeHost; -exports.serializeInteger = __nccwpck_require__(33).serializeInteger; -exports.parseURL = __nccwpck_require__(33).parseURL; - - -/***/ }), - -/***/ 33: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 33: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; @@ -13107,390 +10352,961 @@ module.exports.parseURL = function (input, options) { /***/ }), -/***/ 276: -/***/ ((module) => { +/***/ 276: +/***/ ((module) => { + +"use strict"; + + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); + } +}; + +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; +}; + +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + + + +/***/ }), + +/***/ 1223: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var wrappy = __nccwpck_require__(2940) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} + + +/***/ }), + +/***/ 4294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(4219); + + +/***/ }), + +/***/ 4219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +var net = __nccwpck_require__(1808); +var tls = __nccwpck_require__(4404); +var http = __nccwpck_require__(3685); +var https = __nccwpck_require__(5687); +var events = __nccwpck_require__(2361); +var assert = __nccwpck_require__(9491); +var util = __nccwpck_require__(3837); + + +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} + + +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; + + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; + } + } + socket.destroy(); + self.removeSocket(socket); + }); +} +util.inherits(TunnelingAgent, events.EventEmitter); + +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; + } + + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); + + function onFree() { + self.emit('free', socket, options); + } + + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); + } + }); +}; + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); + + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; + } + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); + } + + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); + + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); + } + + function onError(cause) { + connectReq.removeAllListeners(); + + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + } +}; + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; + } + this.sockets.splice(pos, 1); + + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); + } +}; + +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); + + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); +} + + +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; + } + return host; // for v0.11 or later +} + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } + } + } + } + return target; +} + + +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); + } + console.error.apply(console, args); + } +} else { + debug = function() {}; +} +exports.debug = debug; // for test + + +/***/ }), + +/***/ 5030: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function getUserAgent() { + if (typeof navigator === "object" && "userAgent" in navigator) { + return navigator.userAgent; + } + + if (typeof process === "object" && "version" in process) { + return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; + } + + return ""; +} + +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 5840: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); + +var _v = _interopRequireDefault(__nccwpck_require__(8628)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); + +var _nil = _interopRequireDefault(__nccwpck_require__(5332)); + +var _version = _interopRequireDefault(__nccwpck_require__(1595)); + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/***/ }), + +/***/ 4569: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports["default"] = _default; + +/***/ }), + +/***/ 5332: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports.mixin = function mixin(target, source) { - const keys = Object.getOwnPropertyNames(source); - for (let i = 0; i < keys.length; ++i) { - Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports["default"] = _default; + +/***/ }), + +/***/ 2746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); } -}; -module.exports.wrapperSymbol = Symbol("wrapper"); -module.exports.implSymbol = Symbol("impl"); + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ -module.exports.wrapperForImpl = function (impl) { - return impl[module.exports.wrapperSymbol]; -}; + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ -module.exports.implForWrapper = function (wrapper) { - return wrapper[module.exports.implSymbol]; -}; + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} +var _default = parse; +exports["default"] = _default; /***/ }), -/***/ 1223: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 814: +/***/ ((__unused_webpack_module, exports) => { -var wrappy = __nccwpck_require__(2940) -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) +"use strict"; -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports["default"] = _default; + +/***/ }), + +/***/ 807: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = rng; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} + +/***/ }), + +/***/ 5274: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports["default"] = _default; + +/***/ }), + +/***/ 8950: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports["default"] = _default; + +/***/ }), + +/***/ 8628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) -/***/ }), + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression -/***/ 4294: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval -module.exports = __nccwpck_require__(4219); + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested -/***/ }), -/***/ 4219: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } -"use strict"; + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + msecs += 12219292800000; // `time_low` -var net = __nccwpck_require__(1808); -var tls = __nccwpck_require__(4404); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var events = __nccwpck_require__(2361); -var assert = __nccwpck_require__(9491); -var util = __nccwpck_require__(3837); + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + b[i++] = clockseq & 0xff; // `node` -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; + return buf || (0, _stringify.default)(b); } +var _default = v1; +exports["default"] = _default; -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; +/***/ }), - self.on('free', function onFree(socket, host, port, localAddress) { - var options = toOptions(host, port, localAddress); - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === options.host && pending.port === options.port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); +/***/ 6409: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { - var self = this; - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); +"use strict"; - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push(options); - return; - } - // If we are under maxSockets create a new one. - self.createSocket(options, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; - function onFree() { - self.emit('free', socket, options); - } +var _v = _interopRequireDefault(__nccwpck_require__(5998)); - function onCloseOrRemove(err) { - self.removeSocket(socket); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; +var _md = _interopRequireDefault(__nccwpck_require__(4569)); -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false, - headers: { - host: options.host + ':' + options.port - } - }); - if (options.localAddress) { - connectOptions.localAddress = options.localAddress; - } - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports["default"] = _default; - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); +/***/ }), - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } +/***/ 5998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } +"use strict"; - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - if (res.statusCode !== 200) { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - socket.destroy(); - var error = new Error('tunneling socket could not be established, ' + - 'statusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - if (head.length > 0) { - debug('got illegal response body from proxy'); - socket.destroy(); - var error = new Error('got illegal response body from proxy'); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - return cb(socket); - } +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = _default; +exports.URL = exports.DNS = void 0; + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); - function onError(cause) { - connectReq.removeAllListeners(); +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; + const bytes = []; -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - var hostHeader = options.request.getHeader('host'); - var tlsOptions = mergeOptions({}, self.options, { - socket: socket, - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host - }); + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, tlsOptions); - self.sockets[self.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); - }); + return bytes; } +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; -function toOptions(host, port, localAddress) { - if (typeof host === 'string') { // since v0.10 - return { - host: host, - port: port, - localAddress: localAddress - }; - } - return host; // for v0.11 or later -} +function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); } - } - return target; -} + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} /***/ }), -/***/ 5030: -/***/ ((__unused_webpack_module, exports) => { +/***/ 5122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; -function getUserAgent() { - if (typeof navigator === "object" && "userAgent" in navigator) { - return navigator.userAgent; - } +var _rng = _interopRequireDefault(__nccwpck_require__(807)); - if (typeof process === "object" && "version" in process) { - return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; } - return ""; + return (0, _stringify.default)(rnds); } -exports.getUserAgent = getUserAgent; -//# sourceMappingURL=index.js.map - +var _default = v4; +exports["default"] = _default; /***/ }), -/***/ 5840: +/***/ 9120: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -13499,84 +11315,45 @@ exports.getUserAgent = getUserAgent; Object.defineProperty(exports, "__esModule", ({ value: true })); -Object.defineProperty(exports, "v1", ({ - enumerable: true, - get: function () { - return _v.default; - } -})); -Object.defineProperty(exports, "v3", ({ - enumerable: true, - get: function () { - return _v2.default; - } -})); -Object.defineProperty(exports, "v4", ({ - enumerable: true, - get: function () { - return _v3.default; - } -})); -Object.defineProperty(exports, "v5", ({ - enumerable: true, - get: function () { - return _v4.default; - } -})); -Object.defineProperty(exports, "NIL", ({ - enumerable: true, - get: function () { - return _nil.default; - } -})); -Object.defineProperty(exports, "version", ({ - enumerable: true, - get: function () { - return _version.default; - } -})); -Object.defineProperty(exports, "validate", ({ - enumerable: true, - get: function () { - return _validate.default; - } -})); -Object.defineProperty(exports, "stringify", ({ - enumerable: true, - get: function () { - return _stringify.default; - } -})); -Object.defineProperty(exports, "parse", ({ - enumerable: true, - get: function () { - return _parse.default; - } -})); +exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(8628)); +var _v = _interopRequireDefault(__nccwpck_require__(5998)); -var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); +var _sha = _interopRequireDefault(__nccwpck_require__(5274)); -var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports["default"] = _default; -var _nil = _interopRequireDefault(__nccwpck_require__(5332)); +/***/ }), -var _version = _interopRequireDefault(__nccwpck_require__(1595)); +/***/ 6900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var _validate = _interopRequireDefault(__nccwpck_require__(6900)); +"use strict"; -var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); -var _parse = _interopRequireDefault(__nccwpck_require__(2746)); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _regex = _interopRequireDefault(__nccwpck_require__(814)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports["default"] = _default; + /***/ }), -/***/ 4569: +/***/ 1595: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -13587,1821 +11364,4743 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); } - return _crypto.default.createHash('md5').update(bytes).digest(); + return parseInt(uuid.substr(14, 1), 16); } -var _default = md5; +var _default = version; exports["default"] = _default; /***/ }), -/***/ 5332: +/***/ 2940: +/***/ ((module) => { + +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} + + +/***/ }), + +/***/ 566: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const core = __importStar(__nccwpck_require__(2186)); +const format_1 = __nccwpck_require__(2464); +const fs_1 = __importDefault(__nccwpck_require__(7147)); +const CONST_1 = __importDefault(__nccwpck_require__(9873)); +const GithubUtils_1 = __importDefault(__nccwpck_require__(9296)); +const GitUtils_1 = __importDefault(__nccwpck_require__(1547)); +async function run() { + // Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time + const packageJson = JSON.parse(fs_1.default.readFileSync('package.json', 'utf8')); + const newVersionTag = packageJson.version; + try { + // Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers + const { data: recentDeployChecklists } = await GithubUtils_1.default.octokit.issues.listForRepo({ + log: console, + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + labels: CONST_1.default.LABELS.STAGING_DEPLOY, + state: 'all', + }); + // Look at the state of the most recent StagingDeployCash, + // if it is open then we'll update the existing one, otherwise, we'll create a new one. + const mostRecentChecklist = recentDeployChecklists.at(0); + if (!mostRecentChecklist) { + throw new Error('Could not find the most recent checklist'); + } + const shouldCreateNewDeployChecklist = mostRecentChecklist.state !== 'open'; + const previousChecklist = shouldCreateNewDeployChecklist ? mostRecentChecklist : recentDeployChecklists.at(1); + if (shouldCreateNewDeployChecklist) { + console.log('Latest StagingDeployCash is closed, creating a new one.', mostRecentChecklist); + } + else { + console.log('Latest StagingDeployCash is open, updating it instead of creating a new one.', 'Current:', mostRecentChecklist, 'Previous:', previousChecklist); + } + if (!previousChecklist) { + throw new Error('Could not find the previous checklist'); + } + // Parse the data from the previous and current checklists into the format used to generate the checklist + const previousChecklistData = GithubUtils_1.default.getStagingDeployCashData(previousChecklist); + const currentChecklistData = shouldCreateNewDeployChecklist ? undefined : GithubUtils_1.default.getStagingDeployCashData(mostRecentChecklist); + // Find the list of PRs merged between the current checklist and the previous checklist + const mergedPRs = await GitUtils_1.default.getPullRequestsMergedBetween(previousChecklistData.tag ?? '', newVersionTag); + // Next, we generate the checklist body + let checklistBody = ''; + let checklistAssignees = []; + if (shouldCreateNewDeployChecklist) { + const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag, mergedPRs.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value))); + if (stagingDeployCashBodyAndAssignees) { + checklistBody = stagingDeployCashBodyAndAssignees.issueBody; + checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean); + } + } + else { + // Generate the updated PR list, preserving the previous state of `isVerified` for existing PRs + const PRList = mergedPRs.map((prNum) => { + const indexOfPRInCurrentChecklist = currentChecklistData?.PRList.findIndex((pr) => pr.number === prNum) ?? -1; + const isVerified = indexOfPRInCurrentChecklist >= 0 ? currentChecklistData?.PRList[indexOfPRInCurrentChecklist].isVerified : false; + return { + number: prNum, + url: GithubUtils_1.default.getPullRequestURLFromNumber(prNum), + isVerified, + }; + }); + // Generate the deploy blocker list, preserving the previous state of `isResolved` + const { data: openDeployBlockers } = await GithubUtils_1.default.octokit.issues.listForRepo({ + log: console, + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + labels: CONST_1.default.LABELS.DEPLOY_BLOCKER, + }); + // First, make sure we include all current deploy blockers + const deployBlockers = openDeployBlockers.map((deployBlocker) => { + const indexInCurrentChecklist = currentChecklistData?.deployBlockers.findIndex((item) => item.number === deployBlocker.number) ?? -1; + const isResolved = indexInCurrentChecklist >= 0 ? currentChecklistData?.deployBlockers[indexInCurrentChecklist].isResolved : false; + return { + number: deployBlocker.number, + url: deployBlocker.html_url, + isResolved, + }; + }); + // Then make sure we include any demoted or closed blockers as well, and just check them off automatically + currentChecklistData?.deployBlockers.forEach((deployBlocker) => { + const isResolved = deployBlockers.findIndex((openBlocker) => openBlocker.number === deployBlocker.number) < 0; + deployBlockers.push({ + ...deployBlocker, + isResolved, + }); + }); + const didVersionChange = newVersionTag !== currentChecklistData?.tag; + const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag, PRList.map((pr) => pr.url), PRList.filter((pr) => pr.isVerified).map((pr) => pr.url), deployBlockers.map((blocker) => blocker.url), deployBlockers.filter((blocker) => blocker.isResolved).map((blocker) => blocker.url), currentChecklistData?.internalQAPRList.filter((pr) => pr.isResolved).map((pr) => pr.url), didVersionChange ? false : currentChecklistData.isTimingDashboardChecked, didVersionChange ? false : currentChecklistData.isFirebaseChecked, didVersionChange ? false : currentChecklistData.isGHStatusChecked); + if (stagingDeployCashBodyAndAssignees) { + checklistBody = stagingDeployCashBodyAndAssignees.issueBody; + checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean); + } + } + // Finally, create or update the checklist + const defaultPayload = { + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + body: checklistBody, + }; + if (shouldCreateNewDeployChecklist) { + const { data: newChecklist } = await GithubUtils_1.default.octokit.issues.create({ + ...defaultPayload, + title: `Deploy Checklist: New Expensify ${(0, format_1.format)(new Date(), CONST_1.default.DATE_FORMAT_STRING)}`, + labels: [CONST_1.default.LABELS.STAGING_DEPLOY], + assignees: [CONST_1.default.APPLAUSE_BOT].concat(checklistAssignees), + }); + console.log(`Successfully created new StagingDeployCash! 🎉 ${newChecklist.html_url}`); + return newChecklist; + } + const { data: updatedChecklist } = await GithubUtils_1.default.octokit.issues.update({ + ...defaultPayload, + // eslint-disable-next-line @typescript-eslint/naming-convention + issue_number: currentChecklistData?.number ?? 0, + }); + console.log(`Successfully updated StagingDeployCash! 🎉 ${updatedChecklist.html_url}`); + return updatedChecklist; + } + catch (err) { + console.error('An unknown error occurred!', err); + core.setFailed(err); + } +} +if (require.main === require.cache[eval('__filename')]) { + run(); +} +exports["default"] = run; + + +/***/ }), + +/***/ 9873: /***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const GITHUB_BASE_URL_REGEX = new RegExp('https?://(?:github\\.com|api\\.github\\.com)'); +const GIT_CONST = { + GITHUB_OWNER: 'Expensify', + APP_REPO: 'App', +}; +const CONST = { + ...GIT_CONST, + APPLAUSE_BOT: 'applausebot', + OS_BOTIFY: 'OSBotify', + LABELS: { + STAGING_DEPLOY: 'StagingDeployCash', + DEPLOY_BLOCKER: 'DeployBlockerCash', + INTERNAL_QA: 'InternalQA', + HELP_WANTED: 'Help Wanted', + CP_STAGING: 'CP Staging', + }, + ACTIONS: { + CREATED: 'created', + EDIT: 'edited', + }, + EVENTS: { + ISSUE_COMMENT: 'issue_comment', + }, + OPENAI_ROLES: { + USER: 'user', + ASSISTANT: 'assistant', + }, + PROPOSAL_KEYWORD: 'Proposal', + OPENAI_THREAD_COMPLETED: 'completed', + DATE_FORMAT_STRING: 'yyyy-MM-dd', + PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/pull/([0-9]+).*`), + ISSUE_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/issues/([0-9]+).*`), + ISSUE_OR_PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/(?:pull|issues)/([0-9]+).*`), + POLL_RATE: 10000, + APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`, + APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`, + NO_ACTION: 'NO_ACTION', + OPENAI_POLL_RATE: 1500, + OPENAI_POLL_TIMEOUT: 90000, +}; +exports["default"] = CONST; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports["default"] = _default; /***/ }), -/***/ 2746: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 1547: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ - value: true +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; })); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__nccwpck_require__(6900)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function parse(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } - - let v; - const arr = new Uint8Array(16); // Parse ########-....-....-....-............ - - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ - - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ - - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ - - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) - - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const child_process_1 = __nccwpck_require__(2081); +const CONST_1 = __importDefault(__nccwpck_require__(9873)); +const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(3902)); +const VersionUpdater = __importStar(__nccwpck_require__(8982)); +/** + * Check if a tag exists locally or in the remote. + */ +function tagExists(tag) { + try { + // Check if the tag exists locally + (0, child_process_1.execSync)(`git show-ref --tags ${tag}`, { stdio: 'ignore' }); + return true; // Tag exists locally + } + catch (error) { + // Tag does not exist locally, check in remote + let shouldRetry = true; + let needsRepack = false; + let doesTagExist = false; + while (shouldRetry) { + try { + if (needsRepack) { + // We have seen some scenarios where this fixes the git fetch. + // Why? Who knows... https://github.com/Expensify/App/pull/31459 + (0, child_process_1.execSync)('git repack -d', { stdio: 'inherit' }); + } + (0, child_process_1.execSync)(`git ls-remote --exit-code --tags origin ${tag}`, { stdio: 'ignore' }); + doesTagExist = true; + shouldRetry = false; + } + catch (e) { + if (!needsRepack) { + console.log('Attempting to repack and retry...'); + needsRepack = true; + } + else { + console.error("Repack didn't help, giving up..."); + shouldRetry = false; + } + } + } + return doesTagExist; + } +} +/** + * This essentially just calls getPreviousVersion in a loop, until it finds a version for which a tag exists. + * It's useful if we manually perform a version bump, because in that case a tag may not exist for the previous version. + * + * @param tag the current tag + * @param level the Semver level to step backward by + */ +function getPreviousExistingTag(tag, level) { + let previousVersion = VersionUpdater.getPreviousVersion(tag, level); + let tagExistsForPreviousVersion = false; + while (!tagExistsForPreviousVersion) { + if (tagExists(previousVersion)) { + tagExistsForPreviousVersion = true; + break; + } + console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`); + previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level); + } + return previousVersion; +} +/** + * @param [shallowExcludeTag] When fetching the given tag, exclude all history reachable by the shallowExcludeTag (used to make fetch much faster) + */ +function fetchTag(tag, shallowExcludeTag = '') { + let shouldRetry = true; + let needsRepack = false; + while (shouldRetry) { + try { + let command = ''; + if (needsRepack) { + // We have seen some scenarios where this fixes the git fetch. + // Why? Who knows... https://github.com/Expensify/App/pull/31459 + command = 'git repack -d'; + console.log(`Running command: ${command}`); + (0, child_process_1.execSync)(command); + } + command = `git fetch origin tag ${tag} --no-tags`; + // Note that this condition is only ever NOT true in the 1.0.0-0 edge case + if (shallowExcludeTag && shallowExcludeTag !== tag) { + command += ` --shallow-exclude=${shallowExcludeTag}`; + } + console.log(`Running command: ${command}`); + (0, child_process_1.execSync)(command); + shouldRetry = false; + } + catch (e) { + console.error(e); + if (!needsRepack) { + console.log('Attempting to repack and retry...'); + needsRepack = true; + } + else { + console.error("Repack didn't help, giving up..."); + shouldRetry = false; + } + } + } +} +/** + * Get merge logs between two tags (inclusive) as a JavaScript object. + */ +function getCommitHistoryAsJSON(fromTag, toTag) { + // Fetch tags, excluding commits reachable from the previous patch version (i.e: previous checklist), so that we don't have to fetch the full history + const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH); + fetchTag(fromTag, previousPatchVersion); + fetchTag(toTag, previousPatchVersion); + console.log('Getting pull requests merged between the following tags:', fromTag, toTag); + return new Promise((resolve, reject) => { + let stdout = ''; + let stderr = ''; + const args = ['log', '--format={"commit": "%H", "authorName": "%an", "subject": "%s"},', `${fromTag}...${toTag}`]; + console.log(`Running command: git ${args.join(' ')}`); + const spawnedProcess = (0, child_process_1.spawn)('git', args); + spawnedProcess.on('message', console.log); + spawnedProcess.stdout.on('data', (chunk) => { + console.log(chunk.toString()); + stdout += chunk.toString(); + }); + spawnedProcess.stderr.on('data', (chunk) => { + console.error(chunk.toString()); + stderr += chunk.toString(); + }); + spawnedProcess.on('close', (code) => { + if (code !== 0) { + console.log('code: ', code); + return reject(new Error(`${stderr}`)); + } + resolve(stdout); + }); + spawnedProcess.on('error', (err) => reject(err)); + }).then((stdout) => { + // Sanitize just the text within commit subjects as that's the only potentially un-parseable text. + const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, (subject) => (0, sanitizeStringForJSONParse_1.default)(subject)); + // Then remove newlines, format as JSON and convert to a proper JS object + const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]'); + return JSON.parse(json); + }); +} +/** + * Parse merged PRs, excluding those from irrelevant branches. + */ +function getValidMergedPRs(commits) { + const mergedPRs = new Set(); + commits.forEach((commit) => { + const author = commit.authorName; + if (author === CONST_1.default.OS_BOTIFY) { + return; + } + const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/); + if (!Array.isArray(match) || match.length < 2) { + return; + } + const pr = Number.parseInt(match[1], 10); + if (mergedPRs.has(pr)) { + // If a PR shows up in the log twice, that means that the PR was deployed in the previous checklist. + // That also means that we don't want to include it in the current checklist, so we remove it now. + mergedPRs.delete(pr); + return; + } + mergedPRs.add(pr); + }); + return Array.from(mergedPRs); +} +/** + * Takes in two git tags and returns a list of PR numbers of all PRs merged between those two tags + */ +async function getPullRequestsMergedBetween(fromTag, toTag) { + console.log(`Looking for commits made between ${fromTag} and ${toTag}...`); + const commitList = await getCommitHistoryAsJSON(fromTag, toTag); + console.log(`Commits made between ${fromTag} and ${toTag}:`, commitList); + // Find which commit messages correspond to merged PR's + const pullRequestNumbers = getValidMergedPRs(commitList).sort((a, b) => a - b); + console.log(`List of pull requests merged between ${fromTag} and ${toTag}`, pullRequestNumbers); + return pullRequestNumbers; } +exports["default"] = { + getPreviousExistingTag, + getValidMergedPRs, + getPullRequestsMergedBetween, +}; -var _default = parse; -exports["default"] = _default; - -/***/ }), - -/***/ 814: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -exports["default"] = _default; - -/***/ }), - -/***/ 807: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = rng; - -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate - -let poolPtr = rnds8Pool.length; - -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - _crypto.default.randomFillSync(rnds8Pool); - - poolPtr = 0; - } - - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} /***/ }), -/***/ 5274: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 9296: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ - value: true +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; })); -exports["default"] = void 0; - -var _crypto = _interopRequireDefault(__nccwpck_require__(6113)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); - } - - return _crypto.default.createHash('sha1').update(bytes).digest(); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ +const core = __importStar(__nccwpck_require__(2186)); +const utils_1 = __nccwpck_require__(3030); +const plugin_paginate_rest_1 = __nccwpck_require__(4193); +const plugin_throttling_1 = __nccwpck_require__(9968); +const EmptyObject_1 = __nccwpck_require__(8227); +const arrayDifference_1 = __importDefault(__nccwpck_require__(7034)); +const CONST_1 = __importDefault(__nccwpck_require__(9873)); +class GithubUtils { + static internalOctokit; + /** + * Initialize internal octokit. + * NOTE: When using GithubUtils in CI, you don't need to call this manually. + */ + static initOctokitWithToken(token) { + const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); + // Save a copy of octokit used in this class + this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { + throttle: { + retryAfterBaseValue: 2000, + onRateLimit: (retryAfter, options) => { + console.warn(`Request quota exhausted for request ${options.method} ${options.url}`); + // Retry five times when hitting a rate limit error, then give up + if (options.request.retryCount <= 5) { + console.log(`Retrying after ${retryAfter} seconds!`); + return true; + } + }, + onAbuseLimit: (retryAfter, options) => { + // does not retry, only logs a warning + console.warn(`Abuse detected for request ${options.method} ${options.url}`); + }, + }, + })); + } + /** + * Default initialize method assuming running in CI, getting the token from an input. + * + * @private + */ + static initOctokit() { + const token = core.getInput('GITHUB_TOKEN', { required: true }); + this.initOctokitWithToken(token); + } + /** + * Either give an existing instance of Octokit rest or create a new one + * + * @readonly + * @static + */ + static get octokit() { + if (!this.internalOctokit) { + this.initOctokit(); + } + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style + return this.internalOctokit.rest; + } + /** + * Get the graphql instance from internal octokit. + * @readonly + * @static + */ + static get graphql() { + if (!this.internalOctokit) { + this.initOctokit(); + } + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style + return this.internalOctokit.graphql; + } + /** + * Either give an existing instance of Octokit paginate or create a new one + * + * @readonly + * @static + */ + static get paginate() { + if (!this.internalOctokit) { + this.initOctokit(); + } + // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style + return this.internalOctokit.paginate; + } + /** + * Finds one open `StagingDeployCash` issue via GitHub octokit library. + */ + static getStagingDeployCash() { + return this.octokit.issues + .listForRepo({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + labels: CONST_1.default.LABELS.STAGING_DEPLOY, + state: 'open', + }) + .then(({ data }) => { + if (!data.length) { + throw new Error(`Unable to find ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); + } + if (data.length > 1) { + throw new Error(`Found more than one ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); + } + const issue = data.at(0); + if (!issue) { + throw new Error(`Found an undefined ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); + } + return this.getStagingDeployCashData(issue); + }); + } + /** + * Takes in a GitHub issue object and returns the data we want. + */ + static getStagingDeployCashData(issue) { + try { + const versionRegex = new RegExp('([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9]+))?', 'g'); + const tag = issue.body?.match(versionRegex)?.[0].replace(/`/g, ''); + return { + title: issue.title, + url: issue.url, + number: this.getIssueOrPullRequestNumberFromURL(issue.url), + labels: issue.labels, + PRList: this.getStagingDeployCashPRList(issue), + deployBlockers: this.getStagingDeployCashDeployBlockers(issue), + internalQAPRList: this.getStagingDeployCashInternalQA(issue), + isTimingDashboardChecked: issue.body ? /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body) : false, + isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false, + isGHStatusChecked: issue.body ? /-\s\[x]\sI checked \[GitHub Status]/.test(issue.body) : false, + tag, + }; + } + catch (exception) { + throw new Error(`Unable to find ${CONST_1.default.LABELS.STAGING_DEPLOY} issue with correct data.`); + } + } + /** + * Parse the PRList and Internal QA section of the StagingDeployCash issue body. + * + * @private + */ + static getStagingDeployCashPRList(issue) { + let PRListSection = issue.body?.match(/pull requests:\*\*\r?\n((?:-.*\r?\n)+)\r?\n\r?\n?/) ?? null; + if (PRListSection?.length !== 2) { + // No PRs, return an empty array + console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...'); + return []; + } + PRListSection = PRListSection[1]; + const PRList = [...PRListSection.matchAll(new RegExp(`- \\[([ x])] (${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ + url: match[2], + number: Number.parseInt(match[3], 10), + isVerified: match[1] === 'x', + })); + return PRList.sort((a, b) => a.number - b.number); + } + /** + * Parse DeployBlocker section of the StagingDeployCash issue body. + * + * @private + */ + static getStagingDeployCashDeployBlockers(issue) { + let deployBlockerSection = issue.body?.match(/Deploy Blockers:\*\*\r?\n((?:-.*\r?\n)+)/) ?? null; + if (deployBlockerSection?.length !== 2) { + return []; + } + deployBlockerSection = deployBlockerSection[1]; + const deployBlockers = [...deployBlockerSection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ + url: match[2], + number: Number.parseInt(match[3], 10), + isResolved: match[1] === 'x', + })); + return deployBlockers.sort((a, b) => a.number - b.number); + } + /** + * Parse InternalQA section of the StagingDeployCash issue body. + * + * @private + */ + static getStagingDeployCashInternalQA(issue) { + let internalQASection = issue.body?.match(/Internal QA:\*\*\r?\n((?:- \[[ x]].*\r?\n)+)/) ?? null; + if (internalQASection?.length !== 2) { + return []; + } + internalQASection = internalQASection[1]; + const internalQAPRs = [...internalQASection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ + url: match[2].split('-').at(0)?.trim() ?? '', + number: Number.parseInt(match[3], 10), + isResolved: match[1] === 'x', + })); + return internalQAPRs.sort((a, b) => a.number - b.number); + } + /** + * Generate the issue body and assignees for a StagingDeployCash. + */ + static generateStagingDeployCashBodyAndAssignees(tag, PRList, verifiedPRList = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isTimingDashboardChecked = false, isFirebaseChecked = false, isGHStatusChecked = false) { + return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr))) + .then((data) => { + const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, EmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : []; + return Promise.all(internalQAPRs.map((pr) => this.getPullRequestMergerLogin(pr.number).then((mergerLogin) => ({ url: pr.html_url, mergerLogin })))).then((results) => { + // The format of this map is following: + // { + // 'https://github.com/Expensify/App/pull/9641': 'PauloGasparSv', + // 'https://github.com/Expensify/App/pull/9642': 'mountiny' + // } + const internalQAPRMap = results.reduce((acc, { url, mergerLogin }) => { + acc[url] = mergerLogin; + return acc; + }, {}); + console.log('Found the following Internal QA PRs:', internalQAPRMap); + const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : []; + console.log('Found the following NO QA PRs:', noQAPRs); + const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])]; + const sortedPRList = [...new Set((0, arrayDifference_1.default)(PRList, Object.keys(internalQAPRMap)))].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b)); + const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b)); + // Tag version and comparison URL + // eslint-disable-next-line max-len + let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/App/compare/production...staging\r\n`; + // PR list + if (sortedPRList.length > 0) { + issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; + sortedPRList.forEach((URL) => { + issueBody += verifiedOrNoQAPRs.includes(URL) ? '- [x]' : '- [ ]'; + issueBody += ` ${URL}\r\n`; + }); + issueBody += '\r\n\r\n'; + } + // Internal QA PR list + if (!(0, EmptyObject_1.isEmptyObject)(internalQAPRMap)) { + console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs); + issueBody += '**Internal QA:**\r\n'; + Object.keys(internalQAPRMap).forEach((URL) => { + const merger = internalQAPRMap[URL]; + const mergerMention = `@${merger}`; + issueBody += `${resolvedInternalQAPRs.includes(URL) ? '- [x]' : '- [ ]'} `; + issueBody += `${URL}`; + issueBody += ` - ${mergerMention}`; + issueBody += '\r\n'; + }); + issueBody += '\r\n\r\n'; + } + // Deploy blockers + if (deployBlockers.length > 0) { + issueBody += '**Deploy Blockers:**\r\n'; + sortedDeployBlockers.forEach((URL) => { + issueBody += resolvedDeployBlockers.includes(URL) ? '- [x] ' : '- [ ] '; + issueBody += URL; + issueBody += '\r\n'; + }); + issueBody += '\r\n\r\n'; + } + issueBody += '**Deployer verifications:**'; + // eslint-disable-next-line max-len + issueBody += `\r\n- [${isTimingDashboardChecked ? 'x' : ' '}] I checked the [App Timing Dashboard](https://graphs.expensify.com/grafana/d/yj2EobAGz/app-timing?orgId=1) and verified this release does not cause a noticeable performance regression.`; + // eslint-disable-next-line max-len + issueBody += `\r\n- [${isFirebaseChecked ? 'x' : ' '}] I checked [Firebase Crashlytics](https://console.firebase.google.com/u/0/project/expensify-chat/crashlytics/app/android:com.expensify.chat/issues?state=open&time=last-seven-days&tag=all) and verified that this release does not introduce any new crashes. More detailed instructions on this verification can be found [here](https://stackoverflowteams.com/c/expensify/questions/15095/15096).`; + // eslint-disable-next-line max-len + issueBody += `\r\n- [${isGHStatusChecked ? 'x' : ' '}] I checked [GitHub Status](https://www.githubstatus.com/) and verified there is no reported incident with Actions.`; + issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n'; + const issueAssignees = [...new Set(Object.values(internalQAPRMap))]; + const issue = { issueBody, issueAssignees }; + return issue; + }); + }) + .catch((err) => console.warn('Error generating StagingDeployCash issue body! Continuing...', err)); + } + /** + * Fetch all pull requests given a list of PR numbers. + */ + static fetchAllPullRequests(pullRequestNumbers) { + const oldestPR = pullRequestNumbers.sort((a, b) => a - b).at(0); + return this.paginate(this.octokit.pulls.list, { + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + state: 'all', + sort: 'created', + direction: 'desc', + per_page: 100, + }, ({ data }, done) => { + if (data.find((pr) => pr.number === oldestPR)) { + done(); + } + return data; + }) + .then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number))) + .catch((err) => console.error('Failed to get PR list', err)); + } + static getPullRequestMergerLogin(pullRequestNumber) { + return this.octokit.pulls + .get({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + pull_number: pullRequestNumber, + }) + .then(({ data: pullRequest }) => pullRequest.merged_by?.login); + } + static getPullRequestBody(pullRequestNumber) { + return this.octokit.pulls + .get({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + pull_number: pullRequestNumber, + }) + .then(({ data: pullRequestComment }) => pullRequestComment.body); + } + static getAllReviewComments(pullRequestNumber) { + return this.paginate(this.octokit.pulls.listReviews, { + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + pull_number: pullRequestNumber, + per_page: 100, + }, (response) => response.data.map((review) => review.body)); + } + static getAllComments(issueNumber) { + return this.paginate(this.octokit.issues.listComments, { + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + issue_number: issueNumber, + per_page: 100, + }, (response) => response.data.map((comment) => comment.body)); + } + /** + * Create comment on pull request + */ + static createComment(repo, number, messageBody) { + console.log(`Writing comment on #${number}`); + return this.octokit.issues.createComment({ + owner: CONST_1.default.GITHUB_OWNER, + repo, + issue_number: number, + body: messageBody, + }); + } + /** + * Get the most recent workflow run for the given New Expensify workflow. + */ + static getLatestWorkflowRunID(workflow) { + console.log(`Fetching New Expensify workflow runs for ${workflow}...`); + return this.octokit.actions + .listWorkflowRuns({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + workflow_id: workflow, + }) + .then((response) => response.data.workflow_runs.at(0)?.id ?? -1); + } + /** + * Generate the URL of an New Expensify pull request given the PR number. + */ + static getPullRequestURLFromNumber(value) { + return `${CONST_1.default.APP_REPO_URL}/pull/${value}`; + } + /** + * Parse the pull request number from a URL. + * + * @throws {Error} If the URL is not a valid Github Pull Request. + */ + static getPullRequestNumberFromURL(URL) { + const matches = URL.match(CONST_1.default.PULL_REQUEST_REGEX); + if (!Array.isArray(matches) || matches.length !== 2) { + throw new Error(`Provided URL ${URL} is not a Github Pull Request!`); + } + return Number.parseInt(matches[1], 10); + } + /** + * Parse the issue number from a URL. + * + * @throws {Error} If the URL is not a valid Github Issue. + */ + static getIssueNumberFromURL(URL) { + const matches = URL.match(CONST_1.default.ISSUE_REGEX); + if (!Array.isArray(matches) || matches.length !== 2) { + throw new Error(`Provided URL ${URL} is not a Github Issue!`); + } + return Number.parseInt(matches[1], 10); + } + /** + * Parse the issue or pull request number from a URL. + * + * @throws {Error} If the URL is not a valid Github Issue or Pull Request. + */ + static getIssueOrPullRequestNumberFromURL(URL) { + const matches = URL.match(CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX); + if (!Array.isArray(matches) || matches.length !== 2) { + throw new Error(`Provided URL ${URL} is not a valid Github Issue or Pull Request!`); + } + return Number.parseInt(matches[1], 10); + } + /** + * Return the login of the actor who closed an issue or PR. If the issue is not closed, return an empty string. + */ + static getActorWhoClosedIssue(issueNumber) { + return this.paginate(this.octokit.issues.listEvents, { + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + issue_number: issueNumber, + per_page: 100, + }) + .then((events) => events.filter((event) => event.event === 'closed')) + .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); + } + /** + * Returns a single artifact by name. If none is found, it returns undefined. + */ + static getArtifactByName(artifactName) { + return this.octokit.actions + .listArtifactsForRepo({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + per_page: 1, + name: artifactName, + }) + .then((response) => response.data.artifacts.at(0)); + } + /** + * Given an artifact ID, returns the download URL to a zip file containing the artifact. + */ + static getArtifactDownloadURL(artifactId) { + return this.octokit.actions + .downloadArtifact({ + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, + artifact_id: artifactId, + archive_format: 'zip', + }) + .then((response) => response.url); + } } +exports["default"] = GithubUtils; -var _default = sha1; -exports["default"] = _default; /***/ }), -/***/ 8950: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 3902: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__nccwpck_require__(6900)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +/* eslint-disable @typescript-eslint/naming-convention */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +const replacer = (str) => ({ + '\\': '\\\\', + '\t': '\\t', + '\n': '\\n', + '\r': '\\r', + '\f': '\\f', + '"': '\\"', +}[str] ?? ''); /** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + * Replace any characters in the string that will break JSON.parse for our Git Log output + * + * Solution partly taken from SO user Gabriel Rodríguez Flores 🙇 + * https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading */ -const byteToHex = []; - -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).substr(1)); -} - -function stringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!(0, _validate.default)(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} +const sanitizeStringForJSONParse = (inputString) => { + if (typeof inputString !== 'string') { + throw new TypeError('Input must me of type String'); + } + // Replace any newlines and escape backslashes + return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer); +}; +exports["default"] = sanitizeStringForJSONParse; -var _default = stringify; -exports["default"] = _default; /***/ }), -/***/ 8628: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 8982: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _rng = _interopRequireDefault(__nccwpck_require__(807)); - -var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html -let _nodeId; - -let _clockseq; // Previous uuid creation time - - -let _lastMSecs = 0; -let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details - -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || _rng.default)(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getPreviousVersion = exports.incrementPatch = exports.incrementMinor = exports.SEMANTIC_VERSION_LEVELS = exports.MAX_INCREMENTS = exports.incrementVersion = exports.getVersionStringFromNumber = exports.getVersionNumberFromString = exports.isValidSemverLevel = void 0; +const SEMANTIC_VERSION_LEVELS = { + MAJOR: 'MAJOR', + MINOR: 'MINOR', + PATCH: 'PATCH', + BUILD: 'BUILD', +}; +exports.SEMANTIC_VERSION_LEVELS = SEMANTIC_VERSION_LEVELS; +const MAX_INCREMENTS = 99; +exports.MAX_INCREMENTS = MAX_INCREMENTS; +function isValidSemverLevel(str) { + return Object.keys(SEMANTIC_VERSION_LEVELS).includes(str); +} +exports.isValidSemverLevel = isValidSemverLevel; +/** + * Transforms a versions string into a number + */ +const getVersionNumberFromString = (versionString) => { + const [version, build] = versionString.split('-'); + const [major, minor, patch] = version.split('.').map((n) => Number(n)); + return [major, minor, patch, Number.isInteger(Number(build)) ? Number(build) : 0]; +}; +exports.getVersionNumberFromString = getVersionNumberFromString; +/** + * Transforms version numbers components into a version string + */ +const getVersionStringFromNumber = (major, minor, patch, build = 0) => `${major}.${minor}.${patch}-${build}`; +exports.getVersionStringFromNumber = getVersionStringFromNumber; +/** + * Increments a minor version + */ +const incrementMinor = (major, minor) => { + if (minor < MAX_INCREMENTS) { + return getVersionStringFromNumber(major, minor + 1, 0, 0); } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + return getVersionStringFromNumber(major + 1, 0, 0, 0); +}; +exports.incrementMinor = incrementMinor; +/** + * Increments a Patch version + */ +const incrementPatch = (major, minor, patch) => { + if (patch < MAX_INCREMENTS) { + return getVersionStringFromNumber(major, minor, patch + 1, 0); } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf || (0, _stringify.default)(b); + return incrementMinor(major, minor); +}; +exports.incrementPatch = incrementPatch; +/** + * Increments a build version + */ +const incrementVersion = (version, level) => { + const [major, minor, patch, build] = getVersionNumberFromString(version); + // Majors will always be incremented + if (level === SEMANTIC_VERSION_LEVELS.MAJOR) { + return getVersionStringFromNumber(major + 1, 0, 0, 0); + } + if (level === SEMANTIC_VERSION_LEVELS.MINOR) { + return incrementMinor(major, minor); + } + if (level === SEMANTIC_VERSION_LEVELS.PATCH) { + return incrementPatch(major, minor, patch); + } + if (build < MAX_INCREMENTS) { + return getVersionStringFromNumber(major, minor, patch, build + 1); + } + return incrementPatch(major, minor, patch); +}; +exports.incrementVersion = incrementVersion; +function getPreviousVersion(currentVersion, level) { + const [major, minor, patch, build] = getVersionNumberFromString(currentVersion); + if (level === SEMANTIC_VERSION_LEVELS.MAJOR) { + if (major === 1) { + return getVersionStringFromNumber(1, 0, 0, 0); + } + return getVersionStringFromNumber(major - 1, 0, 0, 0); + } + if (level === SEMANTIC_VERSION_LEVELS.MINOR) { + if (minor === 0) { + return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MAJOR); + } + return getVersionStringFromNumber(major, minor - 1, 0, 0); + } + if (level === SEMANTIC_VERSION_LEVELS.PATCH) { + if (patch === 0) { + return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MINOR); + } + return getVersionStringFromNumber(major, minor, patch - 1, 0); + } + if (build === 0) { + return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.PATCH); + } + return getVersionStringFromNumber(major, minor, patch, build - 1); } +exports.getPreviousVersion = getPreviousVersion; -var _default = v1; -exports["default"] = _default; /***/ }), -/***/ 6409: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 8227: +/***/ ((__unused_webpack_module, exports) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isEmptyObject = void 0; +function isEmptyObject(obj) { + return Object.keys(obj ?? {}).length === 0; +} +exports.isEmptyObject = isEmptyObject; -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _v = _interopRequireDefault(__nccwpck_require__(5998)); - -var _md = _interopRequireDefault(__nccwpck_require__(4569)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const v3 = (0, _v.default)('v3', 0x30, _md.default); -var _default = v3; -exports["default"] = _default; /***/ }), -/***/ 5998: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 7034: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = _default; -exports.URL = exports.DNS = void 0; - -var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); - -var _parse = _interopRequireDefault(__nccwpck_require__(2746)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape - - const bytes = []; - - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - - return bytes; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * This function is an equivalent of _.difference, it takes two arrays and returns the difference between them. + * It returns an array of items that are in the first array but not in the second array. + */ +function arrayDifference(array1, array2) { + return [array1, array2].reduce((a, b) => a.filter((c) => !b.includes(c))); } +exports["default"] = arrayDifference; -const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -exports.DNS = DNS; -const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -exports.URL = URL; - -function _default(name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === 'string') { - value = stringToBytes(value); - } - - if (typeof namespace === 'string') { - namespace = (0, _parse.default)(namespace); - } - - if (namespace.length !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` - - - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - return buf; - } +/***/ }), - return (0, _stringify.default)(bytes); - } // Function#name is not settable on some platforms (#270) +/***/ 9491: +/***/ ((module) => { +"use strict"; +module.exports = require("assert"); - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support +/***/ }), +/***/ 2081: +/***/ ((module) => { - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} +"use strict"; +module.exports = require("child_process"); /***/ }), -/***/ 5122: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 6113: +/***/ ((module) => { "use strict"; +module.exports = require("crypto"); +/***/ }), -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _rng = _interopRequireDefault(__nccwpck_require__(807)); - -var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); +/***/ 3975: +/***/ ((module) => { -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +"use strict"; +module.exports = require("encoding"); -function v4(options, buf, offset) { - options = options || {}; +/***/ }), - const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` +/***/ 2361: +/***/ ((module) => { +"use strict"; +module.exports = require("events"); - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided +/***/ }), - if (buf) { - offset = offset || 0; +/***/ 7147: +/***/ ((module) => { - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } +"use strict"; +module.exports = require("fs"); - return buf; - } +/***/ }), - return (0, _stringify.default)(rnds); -} +/***/ 3685: +/***/ ((module) => { -var _default = v4; -exports["default"] = _default; +"use strict"; +module.exports = require("http"); /***/ }), -/***/ 9120: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 5687: +/***/ ((module) => { "use strict"; +module.exports = require("https"); +/***/ }), -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; +/***/ 1808: +/***/ ((module) => { -var _v = _interopRequireDefault(__nccwpck_require__(5998)); +"use strict"; +module.exports = require("net"); -var _sha = _interopRequireDefault(__nccwpck_require__(5274)); +/***/ }), -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/***/ 2037: +/***/ ((module) => { -const v5 = (0, _v.default)('v5', 0x50, _sha.default); -var _default = v5; -exports["default"] = _default; +"use strict"; +module.exports = require("os"); /***/ }), -/***/ 6900: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 1017: +/***/ ((module) => { "use strict"; +module.exports = require("path"); +/***/ }), -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; +/***/ 5477: +/***/ ((module) => { -var _regex = _interopRequireDefault(__nccwpck_require__(814)); +"use strict"; +module.exports = require("punycode"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/***/ }), -function validate(uuid) { - return typeof uuid === 'string' && _regex.default.test(uuid); -} +/***/ 2781: +/***/ ((module) => { -var _default = validate; -exports["default"] = _default; +"use strict"; +module.exports = require("stream"); /***/ }), -/***/ 1595: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 4404: +/***/ ((module) => { "use strict"; +module.exports = require("tls"); +/***/ }), -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__nccwpck_require__(6900)); +/***/ 7310: +/***/ ((module) => { -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +"use strict"; +module.exports = require("url"); -function version(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } +/***/ }), - return parseInt(uuid.substr(14, 1), 16); -} +/***/ 3837: +/***/ ((module) => { -var _default = version; -exports["default"] = _default; +"use strict"; +module.exports = require("util"); /***/ }), -/***/ 2940: +/***/ 9796: /***/ ((module) => { -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) +"use strict"; +module.exports = require("zlib"); - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') +/***/ }), - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) +/***/ 6411: +/***/ ((__unused_webpack_module, exports) => { - return wrapper +"use strict"; - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } +exports.addLeadingZeros = addLeadingZeros; +function addLeadingZeros(number, targetLength) { + const sign = number < 0 ? "-" : ""; + const output = Math.abs(number).toString().padStart(targetLength, "0"); + return sign + output; } /***/ }), -/***/ 566: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 7479: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +Object.defineProperty(exports, "defaultLocale", ({ + enumerable: true, + get: function () { + return _index.enUS; + }, })); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const core = __importStar(__nccwpck_require__(2186)); -const format_1 = __importDefault(__nccwpck_require__(2168)); -const fs_1 = __importDefault(__nccwpck_require__(7147)); -const CONST_1 = __importDefault(__nccwpck_require__(9873)); -const GithubUtils_1 = __importDefault(__nccwpck_require__(9296)); -const GitUtils_1 = __importDefault(__nccwpck_require__(1547)); -async function run() { - // Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time - const packageJson = JSON.parse(fs_1.default.readFileSync('package.json', 'utf8')); - const newVersionTag = packageJson.version; - try { - // Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers - const { data: recentDeployChecklists } = await GithubUtils_1.default.octokit.issues.listForRepo({ - log: console, - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - labels: CONST_1.default.LABELS.STAGING_DEPLOY, - state: 'all', - }); - // Look at the state of the most recent StagingDeployCash, - // if it is open then we'll update the existing one, otherwise, we'll create a new one. - const mostRecentChecklist = recentDeployChecklists.at(0); - if (!mostRecentChecklist) { - throw new Error('Could not find the most recent checklist'); - } - const shouldCreateNewDeployChecklist = mostRecentChecklist.state !== 'open'; - const previousChecklist = shouldCreateNewDeployChecklist ? mostRecentChecklist : recentDeployChecklists.at(1); - if (shouldCreateNewDeployChecklist) { - console.log('Latest StagingDeployCash is closed, creating a new one.', mostRecentChecklist); - } - else { - console.log('Latest StagingDeployCash is open, updating it instead of creating a new one.', 'Current:', mostRecentChecklist, 'Previous:', previousChecklist); - } - if (!previousChecklist) { - throw new Error('Could not find the previous checklist'); - } - // Parse the data from the previous and current checklists into the format used to generate the checklist - const previousChecklistData = GithubUtils_1.default.getStagingDeployCashData(previousChecklist); - const currentChecklistData = shouldCreateNewDeployChecklist ? undefined : GithubUtils_1.default.getStagingDeployCashData(mostRecentChecklist); - // Find the list of PRs merged between the current checklist and the previous checklist - const mergedPRs = await GitUtils_1.default.getPullRequestsMergedBetween(previousChecklistData.tag ?? '', newVersionTag); - // Next, we generate the checklist body - let checklistBody = ''; - let checklistAssignees = []; - if (shouldCreateNewDeployChecklist) { - const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag, mergedPRs.map((value) => GithubUtils_1.default.getPullRequestURLFromNumber(value))); - if (stagingDeployCashBodyAndAssignees) { - checklistBody = stagingDeployCashBodyAndAssignees.issueBody; - checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean); - } - } - else { - // Generate the updated PR list, preserving the previous state of `isVerified` for existing PRs - const PRList = mergedPRs.map((prNum) => { - const indexOfPRInCurrentChecklist = currentChecklistData?.PRList.findIndex((pr) => pr.number === prNum) ?? -1; - const isVerified = indexOfPRInCurrentChecklist >= 0 ? currentChecklistData?.PRList[indexOfPRInCurrentChecklist].isVerified : false; - return { - number: prNum, - url: GithubUtils_1.default.getPullRequestURLFromNumber(prNum), - isVerified, - }; - }); - // Generate the deploy blocker list, preserving the previous state of `isResolved` - const { data: openDeployBlockers } = await GithubUtils_1.default.octokit.issues.listForRepo({ - log: console, - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - labels: CONST_1.default.LABELS.DEPLOY_BLOCKER, - }); - // First, make sure we include all current deploy blockers - const deployBlockers = openDeployBlockers.map((deployBlocker) => { - const indexInCurrentChecklist = currentChecklistData?.deployBlockers.findIndex((item) => item.number === deployBlocker.number) ?? -1; - const isResolved = indexInCurrentChecklist >= 0 ? currentChecklistData?.deployBlockers[indexInCurrentChecklist].isResolved : false; - return { - number: deployBlocker.number, - url: deployBlocker.html_url, - isResolved, - }; - }); - // Then make sure we include any demoted or closed blockers as well, and just check them off automatically - currentChecklistData?.deployBlockers.forEach((deployBlocker) => { - const isResolved = deployBlockers.findIndex((openBlocker) => openBlocker.number === deployBlocker.number) < 0; - deployBlockers.push({ - ...deployBlocker, - isResolved, - }); - }); - const didVersionChange = newVersionTag !== currentChecklistData?.tag; - const stagingDeployCashBodyAndAssignees = await GithubUtils_1.default.generateStagingDeployCashBodyAndAssignees(newVersionTag, PRList.map((pr) => pr.url), PRList.filter((pr) => pr.isVerified).map((pr) => pr.url), deployBlockers.map((blocker) => blocker.url), deployBlockers.filter((blocker) => blocker.isResolved).map((blocker) => blocker.url), currentChecklistData?.internalQAPRList.filter((pr) => pr.isResolved).map((pr) => pr.url), didVersionChange ? false : currentChecklistData.isTimingDashboardChecked, didVersionChange ? false : currentChecklistData.isFirebaseChecked, didVersionChange ? false : currentChecklistData.isGHStatusChecked); - if (stagingDeployCashBodyAndAssignees) { - checklistBody = stagingDeployCashBodyAndAssignees.issueBody; - checklistAssignees = stagingDeployCashBodyAndAssignees.issueAssignees.filter(Boolean); - } - } - // Finally, create or update the checklist - const defaultPayload = { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - body: checklistBody, - }; - if (shouldCreateNewDeployChecklist) { - const { data: newChecklist } = await GithubUtils_1.default.octokit.issues.create({ - ...defaultPayload, - title: `Deploy Checklist: New Expensify ${(0, format_1.default)(new Date(), CONST_1.default.DATE_FORMAT_STRING)}`, - labels: [CONST_1.default.LABELS.STAGING_DEPLOY], - assignees: [CONST_1.default.APPLAUSE_BOT].concat(checklistAssignees), - }); - console.log(`Successfully created new StagingDeployCash! 🎉 ${newChecklist.html_url}`); - return newChecklist; - } - const { data: updatedChecklist } = await GithubUtils_1.default.octokit.issues.update({ - ...defaultPayload, - // eslint-disable-next-line @typescript-eslint/naming-convention - issue_number: currentChecklistData?.number ?? 0, - }); - console.log(`Successfully updated StagingDeployCash! 🎉 ${updatedChecklist.html_url}`); - return updatedChecklist; - } - catch (err) { - console.error('An unknown error occurred!', err); - core.setFailed(err); - } -} -if (require.main === require.cache[eval('__filename')]) { - run(); -} -exports["default"] = run; +var _index = __nccwpck_require__(9425); /***/ }), -/***/ 9873: +/***/ 5586: /***/ ((__unused_webpack_module, exports) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const GITHUB_BASE_URL_REGEX = new RegExp('https?://(?:github\\.com|api\\.github\\.com)'); -const GIT_CONST = { - GITHUB_OWNER: 'Expensify', - APP_REPO: 'App', -}; -const CONST = { - ...GIT_CONST, - APPLAUSE_BOT: 'applausebot', - OS_BOTIFY: 'OSBotify', - LABELS: { - STAGING_DEPLOY: 'StagingDeployCash', - DEPLOY_BLOCKER: 'DeployBlockerCash', - INTERNAL_QA: 'InternalQA', - HELP_WANTED: 'Help Wanted', - CP_STAGING: 'CP Staging', - }, - ACTIONS: { - CREATED: 'created', - EDIT: 'edited', - }, - EVENTS: { - ISSUE_COMMENT: 'issue_comment', - }, - OPENAI_ROLES: { - USER: 'user', - ASSISTANT: 'assistant', - }, - PROPOSAL_KEYWORD: 'Proposal', - OPENAI_THREAD_COMPLETED: 'completed', - DATE_FORMAT_STRING: 'yyyy-MM-dd', - PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/pull/([0-9]+).*`), - ISSUE_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/issues/([0-9]+).*`), - ISSUE_OR_PULL_REQUEST_REGEX: new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/(?:pull|issues)/([0-9]+).*`), - POLL_RATE: 10000, - APP_REPO_URL: `https://github.com/${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}`, - APP_REPO_GIT_URL: `git@github.com:${GIT_CONST.GITHUB_OWNER}/${GIT_CONST.APP_REPO}.git`, - NO_ACTION: 'NO_ACTION', - OPENAI_POLL_RATE: 1500, - OPENAI_POLL_TIMEOUT: 90000, -}; -exports["default"] = CONST; +exports.getDefaultOptions = getDefaultOptions; +exports.setDefaultOptions = setDefaultOptions; + +let defaultOptions = {}; + +function getDefaultOptions() { + return defaultOptions; +} + +function setDefaultOptions(newOptions) { + defaultOptions = newOptions; +} /***/ }), -/***/ 1547: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 6615: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; +exports.formatters = void 0; +var _index = __nccwpck_require__(1412); +var _index2 = __nccwpck_require__(6703); +var _index3 = __nccwpck_require__(7131); +var _index4 = __nccwpck_require__(3080); +var _index5 = __nccwpck_require__(9116); + +var _index6 = __nccwpck_require__(6411); +var _index7 = __nccwpck_require__(8914); + +const dayPeriodEnum = { + am: "am", + pm: "pm", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night", }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const child_process_1 = __nccwpck_require__(2081); -const CONST_1 = __importDefault(__nccwpck_require__(9873)); -const sanitizeStringForJSONParse_1 = __importDefault(__nccwpck_require__(3902)); -const VersionUpdater = __importStar(__nccwpck_require__(8982)); -/** - * Check if a tag exists locally or in the remote. + +/* + * | | Unit | | Unit | + * |-----|--------------------------------|-----|--------------------------------| + * | a | AM, PM | A* | Milliseconds in day | + * | b | AM, PM, noon, midnight | B | Flexible day period | + * | c | Stand-alone local day of week | C* | Localized hour w/ day period | + * | d | Day of month | D | Day of year | + * | e | Local day of week | E | Day of week | + * | f | | F* | Day of week in month | + * | g* | Modified Julian day | G | Era | + * | h | Hour [1-12] | H | Hour [0-23] | + * | i! | ISO day of week | I! | ISO week of year | + * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | + * | k | Hour [1-24] | K | Hour [0-11] | + * | l* | (deprecated) | L | Stand-alone month | + * | m | Minute | M | Month | + * | n | | N | | + * | o! | Ordinal number modifier | O | Timezone (GMT) | + * | p! | Long localized time | P! | Long localized date | + * | q | Stand-alone quarter | Q | Quarter | + * | r* | Related Gregorian year | R! | ISO week-numbering year | + * | s | Second | S | Fraction of second | + * | t! | Seconds timestamp | T! | Milliseconds timestamp | + * | u | Extended year | U* | Cyclic year | + * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | + * | w | Local week of year | W* | Week of month | + * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | + * | y | Year (abs) | Y | Local week-numbering year | + * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | + * + * Letters marked by * are not implemented but reserved by Unicode standard. + * + * Letters marked by ! are non-standard, but implemented by date-fns: + * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) + * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, + * i.e. 7 for Sunday, 1 for Monday, etc. + * - `I` is ISO week of year, as opposed to `w` which is local week of year. + * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. + * `R` is supposed to be used in conjunction with `I` and `i` + * for universal ISO week-numbering date, whereas + * `Y` is supposed to be used in conjunction with `w` and `e` + * for week-numbering date specific to the locale. + * - `P` is long localized date format + * - `p` is long localized time format */ -function tagExists(tag) { - try { - // Check if the tag exists locally - (0, child_process_1.execSync)(`git show-ref --tags ${tag}`, { stdio: 'ignore' }); - return true; // Tag exists locally + +const formatters = (exports.formatters = { + // Era + G: function (date, token, localize) { + const era = date.getFullYear() > 0 ? 1 : 0; + switch (token) { + // AD, BC + case "G": + case "GG": + case "GGG": + return localize.era(era, { width: "abbreviated" }); + // A, B + case "GGGGG": + return localize.era(era, { width: "narrow" }); + // Anno Domini, Before Christ + case "GGGG": + default: + return localize.era(era, { width: "wide" }); } - catch (error) { - // Tag does not exist locally, check in remote - let shouldRetry = true; - let needsRepack = false; - let doesTagExist = false; - while (shouldRetry) { - try { - if (needsRepack) { - // We have seen some scenarios where this fixes the git fetch. - // Why? Who knows... https://github.com/Expensify/App/pull/31459 - (0, child_process_1.execSync)('git repack -d', { stdio: 'inherit' }); - } - (0, child_process_1.execSync)(`git ls-remote --exit-code --tags origin ${tag}`, { stdio: 'ignore' }); - doesTagExist = true; - shouldRetry = false; - } - catch (e) { - if (!needsRepack) { - console.log('Attempting to repack and retry...'); - needsRepack = true; - } - else { - console.error("Repack didn't help, giving up..."); - shouldRetry = false; - } - } - } - return doesTagExist; + }, + + // Year + y: function (date, token, localize) { + // Ordinal number + if (token === "yo") { + const signedYear = date.getFullYear(); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + const year = signedYear > 0 ? signedYear : 1 - signedYear; + return localize.ordinalNumber(year, { unit: "year" }); } -} -/** - * This essentially just calls getPreviousVersion in a loop, until it finds a version for which a tag exists. - * It's useful if we manually perform a version bump, because in that case a tag may not exist for the previous version. - * - * @param tag the current tag - * @param level the Semver level to step backward by - */ -function getPreviousExistingTag(tag, level) { - let previousVersion = VersionUpdater.getPreviousVersion(tag, level); - let tagExistsForPreviousVersion = false; - while (!tagExistsForPreviousVersion) { - if (tagExists(previousVersion)) { - tagExistsForPreviousVersion = true; - break; - } - console.log(`Tag for previous version ${previousVersion} does not exist. Checking for an older version...`); - previousVersion = VersionUpdater.getPreviousVersion(previousVersion, level); + + return _index7.lightFormatters.y(date, token); + }, + + // Local week-numbering year + Y: function (date, token, localize, options) { + const signedWeekYear = (0, _index5.getWeekYear)(date, options); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; + + // Two digit year + if (token === "YY") { + const twoDigitYear = weekYear % 100; + return (0, _index6.addLeadingZeros)(twoDigitYear, 2); } - return previousVersion; -} -/** - * @param [shallowExcludeTag] When fetching the given tag, exclude all history reachable by the shallowExcludeTag (used to make fetch much faster) - */ -function fetchTag(tag, shallowExcludeTag = '') { - let shouldRetry = true; - let needsRepack = false; - while (shouldRetry) { - try { - let command = ''; - if (needsRepack) { - // We have seen some scenarios where this fixes the git fetch. - // Why? Who knows... https://github.com/Expensify/App/pull/31459 - command = 'git repack -d'; - console.log(`Running command: ${command}`); - (0, child_process_1.execSync)(command); - } - command = `git fetch origin tag ${tag} --no-tags`; - // Note that this condition is only ever NOT true in the 1.0.0-0 edge case - if (shallowExcludeTag && shallowExcludeTag !== tag) { - command += ` --shallow-exclude=${shallowExcludeTag}`; - } - console.log(`Running command: ${command}`); - (0, child_process_1.execSync)(command); - shouldRetry = false; - } - catch (e) { - console.error(e); - if (!needsRepack) { - console.log('Attempting to repack and retry...'); - needsRepack = true; - } - else { - console.error("Repack didn't help, giving up..."); - shouldRetry = false; - } - } + + // Ordinal number + if (token === "Yo") { + return localize.ordinalNumber(weekYear, { unit: "year" }); + } + + // Padding + return (0, _index6.addLeadingZeros)(weekYear, token.length); + }, + + // ISO week-numbering year + R: function (date, token) { + const isoWeekYear = (0, _index3.getISOWeekYear)(date); + + // Padding + return (0, _index6.addLeadingZeros)(isoWeekYear, token.length); + }, + + // Extended year. This is a single number designating the year of this calendar system. + // The main difference between `y` and `u` localizers are B.C. years: + // | Year | `y` | `u` | + // |------|-----|-----| + // | AC 1 | 1 | 1 | + // | BC 1 | 1 | 0 | + // | BC 2 | 2 | -1 | + // Also `yy` always returns the last two digits of a year, + // while `uu` pads single digit years to 2 characters and returns other years unchanged. + u: function (date, token) { + const year = date.getFullYear(); + return (0, _index6.addLeadingZeros)(year, token.length); + }, + + // Quarter + Q: function (date, token, localize) { + const quarter = Math.ceil((date.getMonth() + 1) / 3); + switch (token) { + // 1, 2, 3, 4 + case "Q": + return String(quarter); + // 01, 02, 03, 04 + case "QQ": + return (0, _index6.addLeadingZeros)(quarter, 2); + // 1st, 2nd, 3rd, 4th + case "Qo": + return localize.ordinalNumber(quarter, { unit: "quarter" }); + // Q1, Q2, Q3, Q4 + case "QQQ": + return localize.quarter(quarter, { + width: "abbreviated", + context: "formatting", + }); + // 1, 2, 3, 4 (narrow quarter; could be not numerical) + case "QQQQQ": + return localize.quarter(quarter, { + width: "narrow", + context: "formatting", + }); + // 1st quarter, 2nd quarter, ... + case "QQQQ": + default: + return localize.quarter(quarter, { + width: "wide", + context: "formatting", + }); + } + }, + + // Stand-alone quarter + q: function (date, token, localize) { + const quarter = Math.ceil((date.getMonth() + 1) / 3); + switch (token) { + // 1, 2, 3, 4 + case "q": + return String(quarter); + // 01, 02, 03, 04 + case "qq": + return (0, _index6.addLeadingZeros)(quarter, 2); + // 1st, 2nd, 3rd, 4th + case "qo": + return localize.ordinalNumber(quarter, { unit: "quarter" }); + // Q1, Q2, Q3, Q4 + case "qqq": + return localize.quarter(quarter, { + width: "abbreviated", + context: "standalone", + }); + // 1, 2, 3, 4 (narrow quarter; could be not numerical) + case "qqqqq": + return localize.quarter(quarter, { + width: "narrow", + context: "standalone", + }); + // 1st quarter, 2nd quarter, ... + case "qqqq": + default: + return localize.quarter(quarter, { + width: "wide", + context: "standalone", + }); } -} -/** - * Get merge logs between two tags (inclusive) as a JavaScript object. - */ -function getCommitHistoryAsJSON(fromTag, toTag) { - // Fetch tags, excluding commits reachable from the previous patch version (i.e: previous checklist), so that we don't have to fetch the full history - const previousPatchVersion = getPreviousExistingTag(fromTag, VersionUpdater.SEMANTIC_VERSION_LEVELS.PATCH); - fetchTag(fromTag, previousPatchVersion); - fetchTag(toTag, previousPatchVersion); - console.log('Getting pull requests merged between the following tags:', fromTag, toTag); - return new Promise((resolve, reject) => { - let stdout = ''; - let stderr = ''; - const args = ['log', '--format={"commit": "%H", "authorName": "%an", "subject": "%s"},', `${fromTag}...${toTag}`]; - console.log(`Running command: git ${args.join(' ')}`); - const spawnedProcess = (0, child_process_1.spawn)('git', args); - spawnedProcess.on('message', console.log); - spawnedProcess.stdout.on('data', (chunk) => { - console.log(chunk.toString()); - stdout += chunk.toString(); + }, + + // Month + M: function (date, token, localize) { + const month = date.getMonth(); + switch (token) { + case "M": + case "MM": + return _index7.lightFormatters.M(date, token); + // 1st, 2nd, ..., 12th + case "Mo": + return localize.ordinalNumber(month + 1, { unit: "month" }); + // Jan, Feb, ..., Dec + case "MMM": + return localize.month(month, { + width: "abbreviated", + context: "formatting", }); - spawnedProcess.stderr.on('data', (chunk) => { - console.error(chunk.toString()); - stderr += chunk.toString(); + // J, F, ..., D + case "MMMMM": + return localize.month(month, { + width: "narrow", + context: "formatting", }); - spawnedProcess.on('close', (code) => { - if (code !== 0) { - console.log('code: ', code); - return reject(new Error(`${stderr}`)); - } - resolve(stdout); + // January, February, ..., December + case "MMMM": + default: + return localize.month(month, { width: "wide", context: "formatting" }); + } + }, + + // Stand-alone month + L: function (date, token, localize) { + const month = date.getMonth(); + switch (token) { + // 1, 2, ..., 12 + case "L": + return String(month + 1); + // 01, 02, ..., 12 + case "LL": + return (0, _index6.addLeadingZeros)(month + 1, 2); + // 1st, 2nd, ..., 12th + case "Lo": + return localize.ordinalNumber(month + 1, { unit: "month" }); + // Jan, Feb, ..., Dec + case "LLL": + return localize.month(month, { + width: "abbreviated", + context: "standalone", }); - spawnedProcess.on('error', (err) => reject(err)); - }).then((stdout) => { - // Sanitize just the text within commit subjects as that's the only potentially un-parseable text. - const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, (subject) => (0, sanitizeStringForJSONParse_1.default)(subject)); - // Then remove newlines, format as JSON and convert to a proper JS object - const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]'); - return JSON.parse(json); - }); -} -/** - * Parse merged PRs, excluding those from irrelevant branches. - */ -function getValidMergedPRs(commits) { - const mergedPRs = new Set(); - commits.forEach((commit) => { - const author = commit.authorName; - if (author === CONST_1.default.OS_BOTIFY) { - return; - } - const match = commit.subject.match(/Merge pull request #(\d+) from (?!Expensify\/.*-cherry-pick-staging)/); - if (!Array.isArray(match) || match.length < 2) { - return; - } - const pr = Number.parseInt(match[1], 10); - if (mergedPRs.has(pr)) { - // If a PR shows up in the log twice, that means that the PR was deployed in the previous checklist. - // That also means that we don't want to include it in the current checklist, so we remove it now. - mergedPRs.delete(pr); - return; - } - mergedPRs.add(pr); - }); - return Array.from(mergedPRs); -} -/** - * Takes in two git tags and returns a list of PR numbers of all PRs merged between those two tags - */ -async function getPullRequestsMergedBetween(fromTag, toTag) { - console.log(`Looking for commits made between ${fromTag} and ${toTag}...`); - const commitList = await getCommitHistoryAsJSON(fromTag, toTag); - console.log(`Commits made between ${fromTag} and ${toTag}:`, commitList); - // Find which commit messages correspond to merged PR's - const pullRequestNumbers = getValidMergedPRs(commitList).sort((a, b) => a - b); - console.log(`List of pull requests merged between ${fromTag} and ${toTag}`, pullRequestNumbers); - return pullRequestNumbers; -} -exports["default"] = { - getPreviousExistingTag, - getValidMergedPRs, - getPullRequestsMergedBetween, -}; + // J, F, ..., D + case "LLLLL": + return localize.month(month, { + width: "narrow", + context: "standalone", + }); + // January, February, ..., December + case "LLLL": + default: + return localize.month(month, { width: "wide", context: "standalone" }); + } + }, + // Local week of year + w: function (date, token, localize, options) { + const week = (0, _index4.getWeek)(date, options); -/***/ }), + if (token === "wo") { + return localize.ordinalNumber(week, { unit: "week" }); + } -/***/ 9296: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + return (0, _index6.addLeadingZeros)(week, token.length); + }, -"use strict"; + // ISO week of year + I: function (date, token, localize) { + const isoWeek = (0, _index2.getISOWeek)(date); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -/* eslint-disable @typescript-eslint/naming-convention, import/no-import-module-exports */ -const core = __importStar(__nccwpck_require__(2186)); -const utils_1 = __nccwpck_require__(3030); -const plugin_paginate_rest_1 = __nccwpck_require__(4193); -const plugin_throttling_1 = __nccwpck_require__(9968); -const EmptyObject_1 = __nccwpck_require__(8227); -const arrayDifference_1 = __importDefault(__nccwpck_require__(7034)); -const CONST_1 = __importDefault(__nccwpck_require__(9873)); -class GithubUtils { - static internalOctokit; - /** - * Initialize internal octokit. - * NOTE: When using GithubUtils in CI, you don't need to call this manually. - */ - static initOctokitWithToken(token) { - const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest); - // Save a copy of octokit used in this class - this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, { - throttle: { - retryAfterBaseValue: 2000, - onRateLimit: (retryAfter, options) => { - console.warn(`Request quota exhausted for request ${options.method} ${options.url}`); - // Retry five times when hitting a rate limit error, then give up - if (options.request.retryCount <= 5) { - console.log(`Retrying after ${retryAfter} seconds!`); - return true; - } - }, - onAbuseLimit: (retryAfter, options) => { - // does not retry, only logs a warning - console.warn(`Abuse detected for request ${options.method} ${options.url}`); - }, - }, - })); + if (token === "Io") { + return localize.ordinalNumber(isoWeek, { unit: "week" }); } - /** - * Default initialize method assuming running in CI, getting the token from an input. - * - * @private - */ - static initOctokit() { - const token = core.getInput('GITHUB_TOKEN', { required: true }); - this.initOctokitWithToken(token); + + return (0, _index6.addLeadingZeros)(isoWeek, token.length); + }, + + // Day of the month + d: function (date, token, localize) { + if (token === "do") { + return localize.ordinalNumber(date.getDate(), { unit: "date" }); } - /** - * Either give an existing instance of Octokit rest or create a new one - * - * @readonly - * @static - */ - static get octokit() { - if (!this.internalOctokit) { - this.initOctokit(); - } - // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style - return this.internalOctokit.rest; + + return _index7.lightFormatters.d(date, token); + }, + + // Day of year + D: function (date, token, localize) { + const dayOfYear = (0, _index.getDayOfYear)(date); + + if (token === "Do") { + return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); } - /** - * Get the graphql instance from internal octokit. - * @readonly - * @static - */ - static get graphql() { - if (!this.internalOctokit) { - this.initOctokit(); - } - // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style - return this.internalOctokit.graphql; + + return (0, _index6.addLeadingZeros)(dayOfYear, token.length); + }, + + // Day of week + E: function (date, token, localize) { + const dayOfWeek = date.getDay(); + switch (token) { + // Tue + case "E": + case "EE": + case "EEE": + return localize.day(dayOfWeek, { + width: "abbreviated", + context: "formatting", + }); + // T + case "EEEEE": + return localize.day(dayOfWeek, { + width: "narrow", + context: "formatting", + }); + // Tu + case "EEEEEE": + return localize.day(dayOfWeek, { + width: "short", + context: "formatting", + }); + // Tuesday + case "EEEE": + default: + return localize.day(dayOfWeek, { + width: "wide", + context: "formatting", + }); } - /** - * Either give an existing instance of Octokit paginate or create a new one - * - * @readonly - * @static - */ - static get paginate() { - if (!this.internalOctokit) { - this.initOctokit(); - } - // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style - return this.internalOctokit.paginate; + }, + + // Local day of week + e: function (date, token, localize, options) { + const dayOfWeek = date.getDay(); + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + // Numerical value (Nth day of week with current locale or weekStartsOn) + case "e": + return String(localDayOfWeek); + // Padded numerical value + case "ee": + return (0, _index6.addLeadingZeros)(localDayOfWeek, 2); + // 1st, 2nd, ..., 7th + case "eo": + return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); + case "eee": + return localize.day(dayOfWeek, { + width: "abbreviated", + context: "formatting", + }); + // T + case "eeeee": + return localize.day(dayOfWeek, { + width: "narrow", + context: "formatting", + }); + // Tu + case "eeeeee": + return localize.day(dayOfWeek, { + width: "short", + context: "formatting", + }); + // Tuesday + case "eeee": + default: + return localize.day(dayOfWeek, { + width: "wide", + context: "formatting", + }); } - /** - * Finds one open `StagingDeployCash` issue via GitHub octokit library. - */ - static getStagingDeployCash() { - return this.octokit.issues - .listForRepo({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - labels: CONST_1.default.LABELS.STAGING_DEPLOY, - state: 'open', - }) - .then(({ data }) => { - if (!data.length) { - throw new Error(`Unable to find ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); - } - if (data.length > 1) { - throw new Error(`Found more than one ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); - } - const issue = data.at(0); - if (!issue) { - throw new Error(`Found an undefined ${CONST_1.default.LABELS.STAGING_DEPLOY} issue.`); - } - return this.getStagingDeployCashData(issue); + }, + + // Stand-alone local day of week + c: function (date, token, localize, options) { + const dayOfWeek = date.getDay(); + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + // Numerical value (same as in `e`) + case "c": + return String(localDayOfWeek); + // Padded numerical value + case "cc": + return (0, _index6.addLeadingZeros)(localDayOfWeek, token.length); + // 1st, 2nd, ..., 7th + case "co": + return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); + case "ccc": + return localize.day(dayOfWeek, { + width: "abbreviated", + context: "standalone", + }); + // T + case "ccccc": + return localize.day(dayOfWeek, { + width: "narrow", + context: "standalone", + }); + // Tu + case "cccccc": + return localize.day(dayOfWeek, { + width: "short", + context: "standalone", + }); + // Tuesday + case "cccc": + default: + return localize.day(dayOfWeek, { + width: "wide", + context: "standalone", }); } - /** - * Takes in a GitHub issue object and returns the data we want. - */ - static getStagingDeployCashData(issue) { - try { - const versionRegex = new RegExp('([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9]+))?', 'g'); - const tag = issue.body?.match(versionRegex)?.[0].replace(/`/g, ''); - return { - title: issue.title, - url: issue.url, - number: this.getIssueOrPullRequestNumberFromURL(issue.url), - labels: issue.labels, - PRList: this.getStagingDeployCashPRList(issue), - deployBlockers: this.getStagingDeployCashDeployBlockers(issue), - internalQAPRList: this.getStagingDeployCashInternalQA(issue), - isTimingDashboardChecked: issue.body ? /-\s\[x]\sI checked the \[App Timing Dashboard]/.test(issue.body) : false, - isFirebaseChecked: issue.body ? /-\s\[x]\sI checked \[Firebase Crashlytics]/.test(issue.body) : false, - isGHStatusChecked: issue.body ? /-\s\[x]\sI checked \[GitHub Status]/.test(issue.body) : false, - tag, - }; - } - catch (exception) { - throw new Error(`Unable to find ${CONST_1.default.LABELS.STAGING_DEPLOY} issue with correct data.`); - } + }, + + // ISO day of week + i: function (date, token, localize) { + const dayOfWeek = date.getDay(); + const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; + switch (token) { + // 2 + case "i": + return String(isoDayOfWeek); + // 02 + case "ii": + return (0, _index6.addLeadingZeros)(isoDayOfWeek, token.length); + // 2nd + case "io": + return localize.ordinalNumber(isoDayOfWeek, { unit: "day" }); + // Tue + case "iii": + return localize.day(dayOfWeek, { + width: "abbreviated", + context: "formatting", + }); + // T + case "iiiii": + return localize.day(dayOfWeek, { + width: "narrow", + context: "formatting", + }); + // Tu + case "iiiiii": + return localize.day(dayOfWeek, { + width: "short", + context: "formatting", + }); + // Tuesday + case "iiii": + default: + return localize.day(dayOfWeek, { + width: "wide", + context: "formatting", + }); } - /** - * Parse the PRList and Internal QA section of the StagingDeployCash issue body. - * - * @private - */ - static getStagingDeployCashPRList(issue) { - let PRListSection = issue.body?.match(/pull requests:\*\*\r?\n((?:-.*\r?\n)+)\r?\n\r?\n?/) ?? null; - if (PRListSection?.length !== 2) { - // No PRs, return an empty array - console.log('Hmmm...The open StagingDeployCash does not list any pull requests, continuing...'); - return []; - } - PRListSection = PRListSection[1]; - const PRList = [...PRListSection.matchAll(new RegExp(`- \\[([ x])] (${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ - url: match[2], - number: Number.parseInt(match[3], 10), - isVerified: match[1] === 'x', - })); - return PRList.sort((a, b) => a.number - b.number); + }, + + // AM or PM + a: function (date, token, localize) { + const hours = date.getHours(); + const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; + + switch (token) { + case "a": + case "aa": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting", + }); + case "aaa": + return localize + .dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting", + }) + .toLowerCase(); + case "aaaaa": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting", + }); + case "aaaa": + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting", + }); } - /** - * Parse DeployBlocker section of the StagingDeployCash issue body. - * - * @private - */ - static getStagingDeployCashDeployBlockers(issue) { - let deployBlockerSection = issue.body?.match(/Deploy Blockers:\*\*\r?\n((?:-.*\r?\n)+)/) ?? null; - if (deployBlockerSection?.length !== 2) { - return []; - } - deployBlockerSection = deployBlockerSection[1]; - const deployBlockers = [...deployBlockerSection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ - url: match[2], - number: Number.parseInt(match[3], 10), - isResolved: match[1] === 'x', - })); - return deployBlockers.sort((a, b) => a.number - b.number); + }, + + // AM, PM, midnight, noon + b: function (date, token, localize) { + const hours = date.getHours(); + let dayPeriodEnumValue; + if (hours === 12) { + dayPeriodEnumValue = dayPeriodEnum.noon; + } else if (hours === 0) { + dayPeriodEnumValue = dayPeriodEnum.midnight; + } else { + dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; } - /** - * Parse InternalQA section of the StagingDeployCash issue body. - * - * @private - */ - static getStagingDeployCashInternalQA(issue) { - let internalQASection = issue.body?.match(/Internal QA:\*\*\r?\n((?:- \[[ x]].*\r?\n)+)/) ?? null; - if (internalQASection?.length !== 2) { - return []; - } - internalQASection = internalQASection[1]; - const internalQAPRs = [...internalQASection.matchAll(new RegExp(`- \\[([ x])]\\s(${CONST_1.default.PULL_REQUEST_REGEX.source})`, 'g'))].map((match) => ({ - url: match[2].split('-').at(0)?.trim() ?? '', - number: Number.parseInt(match[3], 10), - isResolved: match[1] === 'x', - })); - return internalQAPRs.sort((a, b) => a.number - b.number); + + switch (token) { + case "b": + case "bb": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting", + }); + case "bbb": + return localize + .dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting", + }) + .toLowerCase(); + case "bbbbb": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting", + }); + case "bbbb": + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting", + }); } - /** - * Generate the issue body and assignees for a StagingDeployCash. - */ - static generateStagingDeployCashBodyAndAssignees(tag, PRList, verifiedPRList = [], deployBlockers = [], resolvedDeployBlockers = [], resolvedInternalQAPRs = [], isTimingDashboardChecked = false, isFirebaseChecked = false, isGHStatusChecked = false) { - return this.fetchAllPullRequests(PRList.map((pr) => this.getPullRequestNumberFromURL(pr))) - .then((data) => { - const internalQAPRs = Array.isArray(data) ? data.filter((pr) => !(0, EmptyObject_1.isEmptyObject)(pr.labels.find((item) => item.name === CONST_1.default.LABELS.INTERNAL_QA))) : []; - return Promise.all(internalQAPRs.map((pr) => this.getPullRequestMergerLogin(pr.number).then((mergerLogin) => ({ url: pr.html_url, mergerLogin })))).then((results) => { - // The format of this map is following: - // { - // 'https://github.com/Expensify/App/pull/9641': 'PauloGasparSv', - // 'https://github.com/Expensify/App/pull/9642': 'mountiny' - // } - const internalQAPRMap = results.reduce((acc, { url, mergerLogin }) => { - acc[url] = mergerLogin; - return acc; - }, {}); - console.log('Found the following Internal QA PRs:', internalQAPRMap); - const noQAPRs = Array.isArray(data) ? data.filter((PR) => /\[No\s?QA]/i.test(PR.title)).map((item) => item.html_url) : []; - console.log('Found the following NO QA PRs:', noQAPRs); - const verifiedOrNoQAPRs = [...new Set([...verifiedPRList, ...noQAPRs])]; - const sortedPRList = [...new Set((0, arrayDifference_1.default)(PRList, Object.keys(internalQAPRMap)))].sort((a, b) => GithubUtils.getPullRequestNumberFromURL(a) - GithubUtils.getPullRequestNumberFromURL(b)); - const sortedDeployBlockers = [...new Set(deployBlockers)].sort((a, b) => GithubUtils.getIssueOrPullRequestNumberFromURL(a) - GithubUtils.getIssueOrPullRequestNumberFromURL(b)); - // Tag version and comparison URL - // eslint-disable-next-line max-len - let issueBody = `**Release Version:** \`${tag}\`\r\n**Compare Changes:** https://github.com/Expensify/App/compare/production...staging\r\n`; - // PR list - if (sortedPRList.length > 0) { - issueBody += '\r\n**This release contains changes from the following pull requests:**\r\n'; - sortedPRList.forEach((URL) => { - issueBody += verifiedOrNoQAPRs.includes(URL) ? '- [x]' : '- [ ]'; - issueBody += ` ${URL}\r\n`; - }); - issueBody += '\r\n\r\n'; - } - // Internal QA PR list - if (!(0, EmptyObject_1.isEmptyObject)(internalQAPRMap)) { - console.log('Found the following verified Internal QA PRs:', resolvedInternalQAPRs); - issueBody += '**Internal QA:**\r\n'; - Object.keys(internalQAPRMap).forEach((URL) => { - const merger = internalQAPRMap[URL]; - const mergerMention = `@${merger}`; - issueBody += `${resolvedInternalQAPRs.includes(URL) ? '- [x]' : '- [ ]'} `; - issueBody += `${URL}`; - issueBody += ` - ${mergerMention}`; - issueBody += '\r\n'; - }); - issueBody += '\r\n\r\n'; - } - // Deploy blockers - if (deployBlockers.length > 0) { - issueBody += '**Deploy Blockers:**\r\n'; - sortedDeployBlockers.forEach((URL) => { - issueBody += resolvedDeployBlockers.includes(URL) ? '- [x] ' : '- [ ] '; - issueBody += URL; - issueBody += '\r\n'; - }); - issueBody += '\r\n\r\n'; - } - issueBody += '**Deployer verifications:**'; - // eslint-disable-next-line max-len - issueBody += `\r\n- [${isTimingDashboardChecked ? 'x' : ' '}] I checked the [App Timing Dashboard](https://graphs.expensify.com/grafana/d/yj2EobAGz/app-timing?orgId=1) and verified this release does not cause a noticeable performance regression.`; - // eslint-disable-next-line max-len - issueBody += `\r\n- [${isFirebaseChecked ? 'x' : ' '}] I checked [Firebase Crashlytics](https://console.firebase.google.com/u/0/project/expensify-chat/crashlytics/app/android:com.expensify.chat/issues?state=open&time=last-seven-days&tag=all) and verified that this release does not introduce any new crashes. More detailed instructions on this verification can be found [here](https://stackoverflowteams.com/c/expensify/questions/15095/15096).`; - // eslint-disable-next-line max-len - issueBody += `\r\n- [${isGHStatusChecked ? 'x' : ' '}] I checked [GitHub Status](https://www.githubstatus.com/) and verified there is no reported incident with Actions.`; - issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n'; - const issueAssignees = [...new Set(Object.values(internalQAPRMap))]; - const issue = { issueBody, issueAssignees }; - return issue; - }); - }) - .catch((err) => console.warn('Error generating StagingDeployCash issue body! Continuing...', err)); + }, + + // in the morning, in the afternoon, in the evening, at night + B: function (date, token, localize) { + const hours = date.getHours(); + let dayPeriodEnumValue; + if (hours >= 17) { + dayPeriodEnumValue = dayPeriodEnum.evening; + } else if (hours >= 12) { + dayPeriodEnumValue = dayPeriodEnum.afternoon; + } else if (hours >= 4) { + dayPeriodEnumValue = dayPeriodEnum.morning; + } else { + dayPeriodEnumValue = dayPeriodEnum.night; } - /** - * Fetch all pull requests given a list of PR numbers. - */ - static fetchAllPullRequests(pullRequestNumbers) { - const oldestPR = pullRequestNumbers.sort((a, b) => a - b).at(0); - return this.paginate(this.octokit.pulls.list, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - state: 'all', - sort: 'created', - direction: 'desc', - per_page: 100, - }, ({ data }, done) => { - if (data.find((pr) => pr.number === oldestPR)) { - done(); - } - return data; - }) - .then((prList) => prList.filter((pr) => pullRequestNumbers.includes(pr.number))) - .catch((err) => console.error('Failed to get PR list', err)); + + switch (token) { + case "B": + case "BB": + case "BBB": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "abbreviated", + context: "formatting", + }); + case "BBBBB": + return localize.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting", + }); + case "BBBB": + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting", + }); } - static getPullRequestMergerLogin(pullRequestNumber) { - return this.octokit.pulls - .get({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - pull_number: pullRequestNumber, - }) - .then(({ data: pullRequest }) => pullRequest.merged_by?.login); + }, + + // Hour [1-12] + h: function (date, token, localize) { + if (token === "ho") { + let hours = date.getHours() % 12; + if (hours === 0) hours = 12; + return localize.ordinalNumber(hours, { unit: "hour" }); } - static getPullRequestBody(pullRequestNumber) { - return this.octokit.pulls - .get({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - pull_number: pullRequestNumber, - }) - .then(({ data: pullRequestComment }) => pullRequestComment.body); + + return _index7.lightFormatters.h(date, token); + }, + + // Hour [0-23] + H: function (date, token, localize) { + if (token === "Ho") { + return localize.ordinalNumber(date.getHours(), { unit: "hour" }); } - static getAllReviewComments(pullRequestNumber) { - return this.paginate(this.octokit.pulls.listReviews, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - pull_number: pullRequestNumber, - per_page: 100, - }, (response) => response.data.map((review) => review.body)); + + return _index7.lightFormatters.H(date, token); + }, + + // Hour [0-11] + K: function (date, token, localize) { + const hours = date.getHours() % 12; + + if (token === "Ko") { + return localize.ordinalNumber(hours, { unit: "hour" }); } - static getAllComments(issueNumber) { - return this.paginate(this.octokit.issues.listComments, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - issue_number: issueNumber, - per_page: 100, - }, (response) => response.data.map((comment) => comment.body)); + + return (0, _index6.addLeadingZeros)(hours, token.length); + }, + + // Hour [1-24] + k: function (date, token, localize) { + let hours = date.getHours(); + if (hours === 0) hours = 24; + + if (token === "ko") { + return localize.ordinalNumber(hours, { unit: "hour" }); } - /** - * Create comment on pull request - */ - static createComment(repo, number, messageBody) { - console.log(`Writing comment on #${number}`); - return this.octokit.issues.createComment({ - owner: CONST_1.default.GITHUB_OWNER, - repo, - issue_number: number, - body: messageBody, - }); + + return (0, _index6.addLeadingZeros)(hours, token.length); + }, + + // Minute + m: function (date, token, localize) { + if (token === "mo") { + return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); } - /** - * Get the most recent workflow run for the given New Expensify workflow. - */ - static getLatestWorkflowRunID(workflow) { - console.log(`Fetching New Expensify workflow runs for ${workflow}...`); - return this.octokit.actions - .listWorkflowRuns({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - workflow_id: workflow, - }) - .then((response) => response.data.workflow_runs.at(0)?.id ?? -1); + + return _index7.lightFormatters.m(date, token); + }, + + // Second + s: function (date, token, localize) { + if (token === "so") { + return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); } - /** - * Generate the URL of an New Expensify pull request given the PR number. - */ - static getPullRequestURLFromNumber(value) { - return `${CONST_1.default.APP_REPO_URL}/pull/${value}`; + + return _index7.lightFormatters.s(date, token); + }, + + // Fraction of second + S: function (date, token) { + return _index7.lightFormatters.S(date, token); + }, + + // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) + X: function (date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + + if (timezoneOffset === 0) { + return "Z"; } - /** - * Parse the pull request number from a URL. - * - * @throws {Error} If the URL is not a valid Github Pull Request. - */ - static getPullRequestNumberFromURL(URL) { - const matches = URL.match(CONST_1.default.PULL_REQUEST_REGEX); - if (!Array.isArray(matches) || matches.length !== 2) { - throw new Error(`Provided URL ${URL} is not a Github Pull Request!`); - } - return Number.parseInt(matches[1], 10); + + switch (token) { + // Hours and optional minutes + case "X": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + + // Hours, minutes and optional seconds without `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `XX` + case "XXXX": + case "XX": // Hours and minutes without `:` delimiter + return formatTimezone(timezoneOffset); + + // Hours, minutes and optional seconds with `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `XXX` + case "XXXXX": + case "XXX": // Hours and minutes with `:` delimiter + default: + return formatTimezone(timezoneOffset, ":"); } - /** - * Parse the issue number from a URL. - * - * @throws {Error} If the URL is not a valid Github Issue. - */ - static getIssueNumberFromURL(URL) { - const matches = URL.match(CONST_1.default.ISSUE_REGEX); - if (!Array.isArray(matches) || matches.length !== 2) { - throw new Error(`Provided URL ${URL} is not a Github Issue!`); - } - return Number.parseInt(matches[1], 10); + }, + + // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) + x: function (date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + + switch (token) { + // Hours and optional minutes + case "x": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + + // Hours, minutes and optional seconds without `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `xx` + case "xxxx": + case "xx": // Hours and minutes without `:` delimiter + return formatTimezone(timezoneOffset); + + // Hours, minutes and optional seconds with `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `xxx` + case "xxxxx": + case "xxx": // Hours and minutes with `:` delimiter + default: + return formatTimezone(timezoneOffset, ":"); + } + }, + + // Timezone (GMT) + O: function (date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + + switch (token) { + // Short + case "O": + case "OO": + case "OOO": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + // Long + case "OOOO": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); + } + }, + + // Timezone (specific non-location) + z: function (date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + + switch (token) { + // Short + case "z": + case "zz": + case "zzz": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + // Long + case "zzzz": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); + } + }, + + // Seconds timestamp + t: function (date, token, _localize) { + const timestamp = Math.trunc(+date / 1000); + return (0, _index6.addLeadingZeros)(timestamp, token.length); + }, + + // Milliseconds timestamp + T: function (date, token, _localize) { + return (0, _index6.addLeadingZeros)(+date, token.length); + }, +}); + +function formatTimezoneShort(offset, delimiter = "") { + const sign = offset > 0 ? "-" : "+"; + const absOffset = Math.abs(offset); + const hours = Math.trunc(absOffset / 60); + const minutes = absOffset % 60; + if (minutes === 0) { + return sign + String(hours); + } + return ( + sign + String(hours) + delimiter + (0, _index6.addLeadingZeros)(minutes, 2) + ); +} + +function formatTimezoneWithOptionalMinutes(offset, delimiter) { + if (offset % 60 === 0) { + const sign = offset > 0 ? "-" : "+"; + return sign + (0, _index6.addLeadingZeros)(Math.abs(offset) / 60, 2); + } + return formatTimezone(offset, delimiter); +} + +function formatTimezone(offset, delimiter = "") { + const sign = offset > 0 ? "-" : "+"; + const absOffset = Math.abs(offset); + const hours = (0, _index6.addLeadingZeros)(Math.trunc(absOffset / 60), 2); + const minutes = (0, _index6.addLeadingZeros)(absOffset % 60, 2); + return sign + hours + delimiter + minutes; +} + + +/***/ }), + +/***/ 8914: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.lightFormatters = void 0; +var _index = __nccwpck_require__(6411); + +/* + * | | Unit | | Unit | + * |-----|--------------------------------|-----|--------------------------------| + * | a | AM, PM | A* | | + * | d | Day of month | D | | + * | h | Hour [1-12] | H | Hour [0-23] | + * | m | Minute | M | Month | + * | s | Second | S | Fraction of second | + * | y | Year (abs) | Y | | + * + * Letters marked by * are not implemented but reserved by Unicode standard. + */ + +const lightFormatters = (exports.lightFormatters = { + // Year + y(date, token) { + // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens + // | Year | y | yy | yyy | yyyy | yyyyy | + // |----------|-------|----|-------|-------|-------| + // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | + // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | + // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | + // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | + // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | + + const signedYear = date.getFullYear(); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + const year = signedYear > 0 ? signedYear : 1 - signedYear; + return (0, _index.addLeadingZeros)( + token === "yy" ? year % 100 : year, + token.length, + ); + }, + + // Month + M(date, token) { + const month = date.getMonth(); + return token === "M" + ? String(month + 1) + : (0, _index.addLeadingZeros)(month + 1, 2); + }, + + // Day of the month + d(date, token) { + return (0, _index.addLeadingZeros)(date.getDate(), token.length); + }, + + // AM or PM + a(date, token) { + const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; + + switch (token) { + case "a": + case "aa": + return dayPeriodEnumValue.toUpperCase(); + case "aaa": + return dayPeriodEnumValue; + case "aaaaa": + return dayPeriodEnumValue[0]; + case "aaaa": + default: + return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; } - /** - * Parse the issue or pull request number from a URL. - * - * @throws {Error} If the URL is not a valid Github Issue or Pull Request. - */ - static getIssueOrPullRequestNumberFromURL(URL) { - const matches = URL.match(CONST_1.default.ISSUE_OR_PULL_REQUEST_REGEX); - if (!Array.isArray(matches) || matches.length !== 2) { - throw new Error(`Provided URL ${URL} is not a valid Github Issue or Pull Request!`); - } - return Number.parseInt(matches[1], 10); + }, + + // Hour [1-12] + h(date, token) { + return (0, _index.addLeadingZeros)( + date.getHours() % 12 || 12, + token.length, + ); + }, + + // Hour [0-23] + H(date, token) { + return (0, _index.addLeadingZeros)(date.getHours(), token.length); + }, + + // Minute + m(date, token) { + return (0, _index.addLeadingZeros)(date.getMinutes(), token.length); + }, + + // Second + s(date, token) { + return (0, _index.addLeadingZeros)(date.getSeconds(), token.length); + }, + + // Fraction of second + S(date, token) { + const numberOfDigits = token.length; + const milliseconds = date.getMilliseconds(); + const fractionalSeconds = Math.trunc( + milliseconds * Math.pow(10, numberOfDigits - 3), + ); + return (0, _index.addLeadingZeros)(fractionalSeconds, token.length); + }, +}); + + +/***/ }), + +/***/ 6376: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.longFormatters = void 0; + +const dateLongFormatter = (pattern, formatLong) => { + switch (pattern) { + case "P": + return formatLong.date({ width: "short" }); + case "PP": + return formatLong.date({ width: "medium" }); + case "PPP": + return formatLong.date({ width: "long" }); + case "PPPP": + default: + return formatLong.date({ width: "full" }); + } +}; + +const timeLongFormatter = (pattern, formatLong) => { + switch (pattern) { + case "p": + return formatLong.time({ width: "short" }); + case "pp": + return formatLong.time({ width: "medium" }); + case "ppp": + return formatLong.time({ width: "long" }); + case "pppp": + default: + return formatLong.time({ width: "full" }); + } +}; + +const dateTimeLongFormatter = (pattern, formatLong) => { + const matchResult = pattern.match(/(P+)(p+)?/) || []; + const datePattern = matchResult[1]; + const timePattern = matchResult[2]; + + if (!timePattern) { + return dateLongFormatter(pattern, formatLong); + } + + let dateTimeFormat; + + switch (datePattern) { + case "P": + dateTimeFormat = formatLong.dateTime({ width: "short" }); + break; + case "PP": + dateTimeFormat = formatLong.dateTime({ width: "medium" }); + break; + case "PPP": + dateTimeFormat = formatLong.dateTime({ width: "long" }); + break; + case "PPPP": + default: + dateTimeFormat = formatLong.dateTime({ width: "full" }); + break; + } + + return dateTimeFormat + .replace("{{date}}", dateLongFormatter(datePattern, formatLong)) + .replace("{{time}}", timeLongFormatter(timePattern, formatLong)); +}; + +const longFormatters = (exports.longFormatters = { + p: timeLongFormatter, + P: dateTimeLongFormatter, +}); + + +/***/ }), + +/***/ 1546: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds; +var _index = __nccwpck_require__(6439); + +/** + * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. + * They usually appear for dates that denote time before the timezones were introduced + * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 + * and GMT+01:00:00 after that date) + * + * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, + * which would lead to incorrect calculations. + * + * This function returns the timezone offset in milliseconds that takes seconds in account. + */ +function getTimezoneOffsetInMilliseconds(date) { + const _date = (0, _index.toDate)(date); + const utcDate = new Date( + Date.UTC( + _date.getFullYear(), + _date.getMonth(), + _date.getDate(), + _date.getHours(), + _date.getMinutes(), + _date.getSeconds(), + _date.getMilliseconds(), + ), + ); + utcDate.setUTCFullYear(_date.getFullYear()); + return +date - +utcDate; +} + + +/***/ }), + +/***/ 8897: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.normalizeDates = normalizeDates; +var _index = __nccwpck_require__(926); + +function normalizeDates(context, ...dates) { + const normalize = _index.constructFrom.bind( + null, + context || dates.find((date) => typeof date === "object"), + ); + return dates.map(normalize); +} + + +/***/ }), + +/***/ 3554: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.isProtectedDayOfYearToken = isProtectedDayOfYearToken; +exports.isProtectedWeekYearToken = isProtectedWeekYearToken; +exports.warnOrThrowProtectedError = warnOrThrowProtectedError; +const dayOfYearTokenRE = /^D+$/; +const weekYearTokenRE = /^Y+$/; + +const throwTokens = ["D", "DD", "YY", "YYYY"]; + +function isProtectedDayOfYearToken(token) { + return dayOfYearTokenRE.test(token); +} + +function isProtectedWeekYearToken(token) { + return weekYearTokenRE.test(token); +} + +function warnOrThrowProtectedError(token, format, input) { + const _message = message(token, format, input); + console.warn(_message); + if (throwTokens.includes(token)) throw new RangeError(_message); +} + +function message(token, format, input) { + const subject = token[0] === "Y" ? "years" : "days of the month"; + return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; +} + + +/***/ }), + +/***/ 4278: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.secondsInYear = + exports.secondsInWeek = + exports.secondsInQuarter = + exports.secondsInMonth = + exports.secondsInMinute = + exports.secondsInHour = + exports.secondsInDay = + exports.quartersInYear = + exports.monthsInYear = + exports.monthsInQuarter = + exports.minutesInYear = + exports.minutesInMonth = + exports.minutesInHour = + exports.minutesInDay = + exports.minTime = + exports.millisecondsInWeek = + exports.millisecondsInSecond = + exports.millisecondsInMinute = + exports.millisecondsInHour = + exports.millisecondsInDay = + exports.maxTime = + exports.daysInYear = + exports.daysInWeek = + exports.constructFromSymbol = + void 0; /** + * @module constants + * @summary Useful constants + * @description + * Collection of useful date constants. + * + * The constants could be imported from `date-fns/constants`: + * + * ```ts + * import { maxTime, minTime } from "date-fns/constants"; + * + * function isAllowedTime(time) { + * return time <= maxTime && time >= minTime; + * } + * ``` + */ + +/** + * @constant + * @name daysInWeek + * @summary Days in 1 week. + */ +const daysInWeek = (exports.daysInWeek = 7); + +/** + * @constant + * @name daysInYear + * @summary Days in 1 year. + * + * @description + * How many days in a year. + * + * One years equals 365.2425 days according to the formula: + * + * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400. + * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days + */ +const daysInYear = (exports.daysInYear = 365.2425); + +/** + * @constant + * @name maxTime + * @summary Maximum allowed time. + * + * @example + * import { maxTime } from "date-fns/constants"; + * + * const isValid = 8640000000000001 <= maxTime; + * //=> false + * + * new Date(8640000000000001); + * //=> Invalid Date + */ +const maxTime = (exports.maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000); + +/** + * @constant + * @name minTime + * @summary Minimum allowed time. + * + * @example + * import { minTime } from "date-fns/constants"; + * + * const isValid = -8640000000000001 >= minTime; + * //=> false + * + * new Date(-8640000000000001) + * //=> Invalid Date + */ +const minTime = (exports.minTime = -maxTime); + +/** + * @constant + * @name millisecondsInWeek + * @summary Milliseconds in 1 week. + */ +const millisecondsInWeek = (exports.millisecondsInWeek = 604800000); + +/** + * @constant + * @name millisecondsInDay + * @summary Milliseconds in 1 day. + */ +const millisecondsInDay = (exports.millisecondsInDay = 86400000); + +/** + * @constant + * @name millisecondsInMinute + * @summary Milliseconds in 1 minute + */ +const millisecondsInMinute = (exports.millisecondsInMinute = 60000); + +/** + * @constant + * @name millisecondsInHour + * @summary Milliseconds in 1 hour + */ +const millisecondsInHour = (exports.millisecondsInHour = 3600000); + +/** + * @constant + * @name millisecondsInSecond + * @summary Milliseconds in 1 second + */ +const millisecondsInSecond = (exports.millisecondsInSecond = 1000); + +/** + * @constant + * @name minutesInYear + * @summary Minutes in 1 year. + */ +const minutesInYear = (exports.minutesInYear = 525600); + +/** + * @constant + * @name minutesInMonth + * @summary Minutes in 1 month. + */ +const minutesInMonth = (exports.minutesInMonth = 43200); + +/** + * @constant + * @name minutesInDay + * @summary Minutes in 1 day. + */ +const minutesInDay = (exports.minutesInDay = 1440); + +/** + * @constant + * @name minutesInHour + * @summary Minutes in 1 hour. + */ +const minutesInHour = (exports.minutesInHour = 60); + +/** + * @constant + * @name monthsInQuarter + * @summary Months in 1 quarter. + */ +const monthsInQuarter = (exports.monthsInQuarter = 3); + +/** + * @constant + * @name monthsInYear + * @summary Months in 1 year. + */ +const monthsInYear = (exports.monthsInYear = 12); + +/** + * @constant + * @name quartersInYear + * @summary Quarters in 1 year + */ +const quartersInYear = (exports.quartersInYear = 4); + +/** + * @constant + * @name secondsInHour + * @summary Seconds in 1 hour. + */ +const secondsInHour = (exports.secondsInHour = 3600); + +/** + * @constant + * @name secondsInMinute + * @summary Seconds in 1 minute. + */ +const secondsInMinute = (exports.secondsInMinute = 60); + +/** + * @constant + * @name secondsInDay + * @summary Seconds in 1 day. + */ +const secondsInDay = (exports.secondsInDay = secondsInHour * 24); + +/** + * @constant + * @name secondsInWeek + * @summary Seconds in 1 week. + */ +const secondsInWeek = (exports.secondsInWeek = secondsInDay * 7); + +/** + * @constant + * @name secondsInYear + * @summary Seconds in 1 year. + */ +const secondsInYear = (exports.secondsInYear = secondsInDay * daysInYear); + +/** + * @constant + * @name secondsInMonth + * @summary Seconds in 1 month + */ +const secondsInMonth = (exports.secondsInMonth = secondsInYear / 12); + +/** + * @constant + * @name secondsInQuarter + * @summary Seconds in 1 quarter. + */ +const secondsInQuarter = (exports.secondsInQuarter = secondsInMonth * 3); + +/** + * @constant + * @name constructFromSymbol + * @summary Symbol enabling Date extensions to inherit properties from the reference date. + * + * The symbol is used to enable the `constructFrom` function to construct a date + * using a reference date and a value. It allows to transfer extra properties + * from the reference date to the new date. It's useful for extensions like + * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as + * a constructor argument. + */ +const constructFromSymbol = (exports.constructFromSymbol = + Symbol.for("constructDateFrom")); + + +/***/ }), + +/***/ 926: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.constructFrom = constructFrom; +var _index = __nccwpck_require__(4278); + +/** + * @name constructFrom + * @category Generic Helpers + * @summary Constructs a date using the reference date and the value + * + * @description + * The function constructs a new date using the constructor from the reference + * date and the given value. It helps to build generic functions that accept + * date extensions. + * + * It defaults to `Date` if the passed reference date is a number or a string. + * + * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]` + * enabling to transfer extra properties from the reference date to the new date. + * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) + * that accept a time zone as a constructor argument. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * + * @param date - The reference date to take constructor from + * @param value - The value to create the date + * + * @returns Date initialized using the given date and value + * + * @example + * import { constructFrom } from "date-fns"; + * + * // A function that clones a date preserving the original type + * function cloneDate(date: DateType): DateType { + * return constructFrom( + * date, // Use constructor from the given date + * date.getTime() // Use the date value to create a new date + * ); + * } + */ +function constructFrom(date, value) { + if (typeof date === "function") return date(value); + + if (date && typeof date === "object" && _index.constructFromSymbol in date) + return date[_index.constructFromSymbol](value); + + if (date instanceof Date) return new date.constructor(value); + + return new Date(value); +} + + +/***/ }), + +/***/ 5671: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.differenceInCalendarDays = differenceInCalendarDays; +var _index = __nccwpck_require__(1546); +var _index2 = __nccwpck_require__(8897); +var _index3 = __nccwpck_require__(4278); +var _index4 = __nccwpck_require__(5951); + +/** + * The {@link differenceInCalendarDays} function options. + */ + +/** + * @name differenceInCalendarDays + * @category Day Helpers + * @summary Get the number of calendar days between the given dates. + * + * @description + * Get the number of calendar days between the given dates. This means that the times are removed + * from the dates and then the difference in days is calculated. + * + * @param laterDate - The later date + * @param earlierDate - The earlier date + * @param options - The options object + * + * @returns The number of calendar days + * + * @example + * // How many calendar days are between + * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? + * const result = differenceInCalendarDays( + * new Date(2012, 6, 2, 0, 0), + * new Date(2011, 6, 2, 23, 0) + * ) + * //=> 366 + * // How many calendar days are between + * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? + * const result = differenceInCalendarDays( + * new Date(2011, 6, 3, 0, 1), + * new Date(2011, 6, 2, 23, 59) + * ) + * //=> 1 + */ +function differenceInCalendarDays(laterDate, earlierDate, options) { + const [laterDate_, earlierDate_] = (0, _index2.normalizeDates)( + options?.in, + laterDate, + earlierDate, + ); + + const laterStartOfDay = (0, _index4.startOfDay)(laterDate_); + const earlierStartOfDay = (0, _index4.startOfDay)(earlierDate_); + + const laterTimestamp = + +laterStartOfDay - + (0, _index.getTimezoneOffsetInMilliseconds)(laterStartOfDay); + const earlierTimestamp = + +earlierStartOfDay - + (0, _index.getTimezoneOffsetInMilliseconds)(earlierStartOfDay); + + // Round the number of days to the nearest integer because the number of + // milliseconds in a day is not constant (e.g. it's different in the week of + // the daylight saving time clock shift). + return Math.round( + (laterTimestamp - earlierTimestamp) / _index3.millisecondsInDay, + ); +} + + +/***/ }), + +/***/ 2464: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.format = exports.formatDate = format; +Object.defineProperty(exports, "formatters", ({ + enumerable: true, + get: function () { + return _index3.formatters; + }, +})); +Object.defineProperty(exports, "longFormatters", ({ + enumerable: true, + get: function () { + return _index4.longFormatters; + }, +})); +var _index = __nccwpck_require__(7479); +var _index2 = __nccwpck_require__(5586); +var _index3 = __nccwpck_require__(6615); +var _index4 = __nccwpck_require__(6376); +var _index5 = __nccwpck_require__(3554); + +var _index6 = __nccwpck_require__(6142); +var _index7 = __nccwpck_require__(6439); + +// Rexports of internal for libraries to use. +// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874 + +// This RegExp consists of three parts separated by `|`: +// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token +// (one of the certain letters followed by `o`) +// - (\w)\1* matches any sequences of the same letter +// - '' matches two quote characters in a row +// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), +// except a single quote symbol, which ends the sequence. +// Two quote characters do not end the sequence. +// If there is no matching single quote +// then the sequence will continue until the end of the string. +// - . matches any single character unmatched by previous parts of the RegExps +const formattingTokensRegExp = + /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; + +// This RegExp catches symbols escaped by quotes, and also +// sequences of symbols P, p, and the combinations like `PPPPPPPppppp` +const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; + +const escapedStringRegExp = /^'([^]*?)'?$/; +const doubleQuoteRegExp = /''/g; +const unescapedLatinCharacterRegExp = /[a-zA-Z]/; + +/** + * The {@link format} function options. + */ + +/** + * @name format + * @alias formatDate + * @category Common Helpers + * @summary Format the date. + * + * @description + * Return the formatted date string in the given format. The result may vary by locale. + * + * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries. + * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * + * The characters wrapped between two single quotes characters (') are escaped. + * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. + * (see the last example) + * + * Format of the string is based on Unicode Technical Standard #35: + * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table + * with a few additions (see note 7 below the table). + * + * Accepted patterns: + * | Unit | Pattern | Result examples | Notes | + * |---------------------------------|---------|-----------------------------------|-------| + * | Era | G..GGG | AD, BC | | + * | | GGGG | Anno Domini, Before Christ | 2 | + * | | GGGGG | A, B | | + * | Calendar year | y | 44, 1, 1900, 2017 | 5 | + * | | yo | 44th, 1st, 0th, 17th | 5,7 | + * | | yy | 44, 01, 00, 17 | 5 | + * | | yyy | 044, 001, 1900, 2017 | 5 | + * | | yyyy | 0044, 0001, 1900, 2017 | 5 | + * | | yyyyy | ... | 3,5 | + * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | + * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | + * | | YY | 44, 01, 00, 17 | 5,8 | + * | | YYY | 044, 001, 1900, 2017 | 5 | + * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | + * | | YYYYY | ... | 3,5 | + * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | + * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | + * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | + * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | + * | | RRRRR | ... | 3,5,7 | + * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | + * | | uu | -43, 01, 1900, 2017 | 5 | + * | | uuu | -043, 001, 1900, 2017 | 5 | + * | | uuuu | -0043, 0001, 1900, 2017 | 5 | + * | | uuuuu | ... | 3,5 | + * | Quarter (formatting) | Q | 1, 2, 3, 4 | | + * | | Qo | 1st, 2nd, 3rd, 4th | 7 | + * | | QQ | 01, 02, 03, 04 | | + * | | QQQ | Q1, Q2, Q3, Q4 | | + * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | + * | | QQQQQ | 1, 2, 3, 4 | 4 | + * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | + * | | qo | 1st, 2nd, 3rd, 4th | 7 | + * | | qq | 01, 02, 03, 04 | | + * | | qqq | Q1, Q2, Q3, Q4 | | + * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | + * | | qqqqq | 1, 2, 3, 4 | 4 | + * | Month (formatting) | M | 1, 2, ..., 12 | | + * | | Mo | 1st, 2nd, ..., 12th | 7 | + * | | MM | 01, 02, ..., 12 | | + * | | MMM | Jan, Feb, ..., Dec | | + * | | MMMM | January, February, ..., December | 2 | + * | | MMMMM | J, F, ..., D | | + * | Month (stand-alone) | L | 1, 2, ..., 12 | | + * | | Lo | 1st, 2nd, ..., 12th | 7 | + * | | LL | 01, 02, ..., 12 | | + * | | LLL | Jan, Feb, ..., Dec | | + * | | LLLL | January, February, ..., December | 2 | + * | | LLLLL | J, F, ..., D | | + * | Local week of year | w | 1, 2, ..., 53 | | + * | | wo | 1st, 2nd, ..., 53th | 7 | + * | | ww | 01, 02, ..., 53 | | + * | ISO week of year | I | 1, 2, ..., 53 | 7 | + * | | Io | 1st, 2nd, ..., 53th | 7 | + * | | II | 01, 02, ..., 53 | 7 | + * | Day of month | d | 1, 2, ..., 31 | | + * | | do | 1st, 2nd, ..., 31st | 7 | + * | | dd | 01, 02, ..., 31 | | + * | Day of year | D | 1, 2, ..., 365, 366 | 9 | + * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | + * | | DD | 01, 02, ..., 365, 366 | 9 | + * | | DDD | 001, 002, ..., 365, 366 | | + * | | DDDD | ... | 3 | + * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | | + * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | + * | | EEEEE | M, T, W, T, F, S, S | | + * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | | + * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | + * | | io | 1st, 2nd, ..., 7th | 7 | + * | | ii | 01, 02, ..., 07 | 7 | + * | | iii | Mon, Tue, Wed, ..., Sun | 7 | + * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | + * | | iiiii | M, T, W, T, F, S, S | 7 | + * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 | + * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | + * | | eo | 2nd, 3rd, ..., 1st | 7 | + * | | ee | 02, 03, ..., 01 | | + * | | eee | Mon, Tue, Wed, ..., Sun | | + * | | eeee | Monday, Tuesday, ..., Sunday | 2 | + * | | eeeee | M, T, W, T, F, S, S | | + * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | | + * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | + * | | co | 2nd, 3rd, ..., 1st | 7 | + * | | cc | 02, 03, ..., 01 | | + * | | ccc | Mon, Tue, Wed, ..., Sun | | + * | | cccc | Monday, Tuesday, ..., Sunday | 2 | + * | | ccccc | M, T, W, T, F, S, S | | + * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | | + * | AM, PM | a..aa | AM, PM | | + * | | aaa | am, pm | | + * | | aaaa | a.m., p.m. | 2 | + * | | aaaaa | a, p | | + * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | | + * | | bbb | am, pm, noon, midnight | | + * | | bbbb | a.m., p.m., noon, midnight | 2 | + * | | bbbbb | a, p, n, mi | | + * | Flexible day period | B..BBB | at night, in the morning, ... | | + * | | BBBB | at night, in the morning, ... | 2 | + * | | BBBBB | at night, in the morning, ... | | + * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | + * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | + * | | hh | 01, 02, ..., 11, 12 | | + * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | + * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | + * | | HH | 00, 01, 02, ..., 23 | | + * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | + * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | + * | | KK | 01, 02, ..., 11, 00 | | + * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | + * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | + * | | kk | 24, 01, 02, ..., 23 | | + * | Minute | m | 0, 1, ..., 59 | | + * | | mo | 0th, 1st, ..., 59th | 7 | + * | | mm | 00, 01, ..., 59 | | + * | Second | s | 0, 1, ..., 59 | | + * | | so | 0th, 1st, ..., 59th | 7 | + * | | ss | 00, 01, ..., 59 | | + * | Fraction of second | S | 0, 1, ..., 9 | | + * | | SS | 00, 01, ..., 99 | | + * | | SSS | 000, 001, ..., 999 | | + * | | SSSS | ... | 3 | + * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | + * | | XX | -0800, +0530, Z | | + * | | XXX | -08:00, +05:30, Z | | + * | | XXXX | -0800, +0530, Z, +123456 | 2 | + * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | + * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | + * | | xx | -0800, +0530, +0000 | | + * | | xxx | -08:00, +05:30, +00:00 | 2 | + * | | xxxx | -0800, +0530, +0000, +123456 | | + * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | + * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | + * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | + * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | + * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | + * | Seconds timestamp | t | 512969520 | 7 | + * | | tt | ... | 3,7 | + * | Milliseconds timestamp | T | 512969520900 | 7 | + * | | TT | ... | 3,7 | + * | Long localized date | P | 04/29/1453 | 7 | + * | | PP | Apr 29, 1453 | 7 | + * | | PPP | April 29th, 1453 | 7 | + * | | PPPP | Friday, April 29th, 1453 | 2,7 | + * | Long localized time | p | 12:00 AM | 7 | + * | | pp | 12:00:00 AM | 7 | + * | | ppp | 12:00:00 AM GMT+2 | 7 | + * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | + * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 | + * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 | + * | | PPPppp | April 29th, 1453 at ... | 7 | + * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 | + * Notes: + * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale + * are the same as "stand-alone" units, but are different in some languages. + * "Formatting" units are declined according to the rules of the language + * in the context of a date. "Stand-alone" units are always nominative singular: + * + * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` + * + * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` + * + * 2. Any sequence of the identical letters is a pattern, unless it is escaped by + * the single quote characters (see below). + * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) + * the output will be the same as default pattern for this unit, usually + * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units + * are marked with "2" in the last column of the table. + * + * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` + * + * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` + * + * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` + * + * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` + * + * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` + * + * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). + * The output will be padded with zeros to match the length of the pattern. + * + * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` + * + * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. + * These tokens represent the shortest form of the quarter. + * + * 5. The main difference between `y` and `u` patterns are B.C. years: + * + * | Year | `y` | `u` | + * |------|-----|-----| + * | AC 1 | 1 | 1 | + * | BC 1 | 1 | 0 | + * | BC 2 | 2 | -1 | + * + * Also `yy` always returns the last two digits of a year, + * while `uu` pads single digit years to 2 characters and returns other years unchanged: + * + * | Year | `yy` | `uu` | + * |------|------|------| + * | 1 | 01 | 01 | + * | 14 | 14 | 14 | + * | 376 | 76 | 376 | + * | 1453 | 53 | 1453 | + * + * The same difference is true for local and ISO week-numbering years (`Y` and `R`), + * except local week-numbering years are dependent on `options.weekStartsOn` + * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear) + * and [getWeekYear](https://date-fns.org/docs/getWeekYear)). + * + * 6. Specific non-location timezones are currently unavailable in `date-fns`, + * so right now these tokens fall back to GMT timezones. + * + * 7. These patterns are not in the Unicode Technical Standard #35: + * - `i`: ISO day of week + * - `I`: ISO week of year + * - `R`: ISO week-numbering year + * - `t`: seconds timestamp + * - `T`: milliseconds timestamp + * - `o`: ordinal number modifier + * - `P`: long localized date + * - `p`: long localized time + * + * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years. + * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * + * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month. + * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * + * @param date - The original date + * @param format - The string of tokens + * @param options - An object with options + * + * @returns The formatted date string + * + * @throws `date` must not be Invalid Date + * @throws `options.locale` must contain `localize` property + * @throws `options.locale` must contain `formatLong` property + * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md + * @throws format string contains an unescaped latin alphabet character + * + * @example + * // Represent 11 February 2014 in middle-endian format: + * const 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' + * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { + * locale: eoLocale + * }) + * //=> '2-a de julio 2014' + * + * @example + * // Escape string by single quote characters: + * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") + * //=> "3 o'clock" + */ +function format(date, formatStr, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const locale = + options?.locale ?? defaultOptions.locale ?? _index.defaultLocale; + + const firstWeekContainsDate = + options?.firstWeekContainsDate ?? + options?.locale?.options?.firstWeekContainsDate ?? + defaultOptions.firstWeekContainsDate ?? + defaultOptions.locale?.options?.firstWeekContainsDate ?? + 1; + + const weekStartsOn = + options?.weekStartsOn ?? + options?.locale?.options?.weekStartsOn ?? + defaultOptions.weekStartsOn ?? + defaultOptions.locale?.options?.weekStartsOn ?? + 0; + + const originalDate = (0, _index7.toDate)(date, options?.in); + + if (!(0, _index6.isValid)(originalDate)) { + throw new RangeError("Invalid time value"); + } + + let parts = formatStr + .match(longFormattingTokensRegExp) + .map((substring) => { + const firstCharacter = substring[0]; + if (firstCharacter === "p" || firstCharacter === "P") { + const longFormatter = _index4.longFormatters[firstCharacter]; + return longFormatter(substring, locale.formatLong); + } + return substring; + }) + .join("") + .match(formattingTokensRegExp) + .map((substring) => { + // Replace two single quote characters with one single quote character + if (substring === "''") { + return { isToken: false, value: "'" }; + } + + const firstCharacter = substring[0]; + if (firstCharacter === "'") { + return { isToken: false, value: cleanEscapedString(substring) }; + } + + if (_index3.formatters[firstCharacter]) { + return { isToken: true, value: substring }; + } + + if (firstCharacter.match(unescapedLatinCharacterRegExp)) { + throw new RangeError( + "Format string contains an unescaped latin alphabet character `" + + firstCharacter + + "`", + ); + } + + return { isToken: false, value: substring }; + }); + + // invoke localize preprocessor (only for french locales at the moment) + if (locale.localize.preprocessor) { + parts = locale.localize.preprocessor(originalDate, parts); + } + + const formatterOptions = { + firstWeekContainsDate, + weekStartsOn, + locale, + }; + + return parts + .map((part) => { + if (!part.isToken) return part.value; + + const token = part.value; + + if ( + (!options?.useAdditionalWeekYearTokens && + (0, _index5.isProtectedWeekYearToken)(token)) || + (!options?.useAdditionalDayOfYearTokens && + (0, _index5.isProtectedDayOfYearToken)(token)) + ) { + (0, _index5.warnOrThrowProtectedError)(token, formatStr, String(date)); + } + + const formatter = _index3.formatters[token[0]]; + return formatter(originalDate, token, locale.localize, formatterOptions); + }) + .join(""); +} + +function cleanEscapedString(input) { + const matched = input.match(escapedStringRegExp); + + if (!matched) { + return input; + } + + return matched[1].replace(doubleQuoteRegExp, "'"); +} + + +/***/ }), + +/***/ 1412: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getDayOfYear = getDayOfYear; +var _index = __nccwpck_require__(5671); +var _index2 = __nccwpck_require__(8537); +var _index3 = __nccwpck_require__(6439); + +/** + * The {@link getDayOfYear} function options. + */ + +/** + * @name getDayOfYear + * @category Day Helpers + * @summary Get the day of the year of the given date. + * + * @description + * Get the day of the year of the given date. + * + * @param date - The given date + * @param options - The options + * + * @returns The day of year + * + * @example + * // Which day of the year is 2 July 2014? + * const result = getDayOfYear(new Date(2014, 6, 2)) + * //=> 183 + */ +function getDayOfYear(date, options) { + const _date = (0, _index3.toDate)(date, options?.in); + const diff = (0, _index.differenceInCalendarDays)( + _date, + (0, _index2.startOfYear)(_date), + ); + const dayOfYear = diff + 1; + return dayOfYear; +} + + +/***/ }), + +/***/ 6703: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getISOWeek = getISOWeek; +var _index = __nccwpck_require__(4278); +var _index2 = __nccwpck_require__(8516); +var _index3 = __nccwpck_require__(5437); +var _index4 = __nccwpck_require__(6439); + +/** + * The {@link getISOWeek} function options. + */ + +/** + * @name getISOWeek + * @category ISO Week Helpers + * @summary Get the ISO week of the given date. + * + * @description + * Get the ISO week of the given date. + * + * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date + * + * @param date - The given date + * @param options - The options + * + * @returns The ISO week + * + * @example + * // Which week of the ISO-week numbering year is 2 January 2005? + * const result = getISOWeek(new Date(2005, 0, 2)) + * //=> 53 + */ +function getISOWeek(date, options) { + const _date = (0, _index4.toDate)(date, options?.in); + const diff = + +(0, _index2.startOfISOWeek)(_date) - + +(0, _index3.startOfISOWeekYear)(_date); + + // Round the number of weeks 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 / _index.millisecondsInWeek) + 1; +} + + +/***/ }), + +/***/ 7131: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getISOWeekYear = getISOWeekYear; +var _index = __nccwpck_require__(926); +var _index2 = __nccwpck_require__(8516); +var _index3 = __nccwpck_require__(6439); + +/** + * The {@link getISOWeekYear} function options. + */ + +/** + * @name getISOWeekYear + * @category ISO Week-Numbering Year Helpers + * @summary Get the ISO week-numbering year of the given date. + * + * @description + * Get the ISO week-numbering year of the given date, + * which always starts 3 days before the year's first Thursday. + * + * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date + * + * @param date - The given date + * + * @returns The ISO week-numbering year + * + * @example + * // Which ISO-week numbering year is 2 January 2005? + * const result = getISOWeekYear(new Date(2005, 0, 2)) + * //=> 2004 + */ +function getISOWeekYear(date, options) { + const _date = (0, _index3.toDate)(date, options?.in); + const year = _date.getFullYear(); + + const fourthOfJanuaryOfNextYear = (0, _index.constructFrom)(_date, 0); + fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); + fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); + const startOfNextYear = (0, _index2.startOfISOWeek)( + fourthOfJanuaryOfNextYear, + ); + + const fourthOfJanuaryOfThisYear = (0, _index.constructFrom)(_date, 0); + fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); + fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); + const startOfThisYear = (0, _index2.startOfISOWeek)( + fourthOfJanuaryOfThisYear, + ); + + if (_date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (_date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; + } +} + + +/***/ }), + +/***/ 3080: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getWeek = getWeek; +var _index = __nccwpck_require__(4278); +var _index2 = __nccwpck_require__(1284); +var _index3 = __nccwpck_require__(5129); +var _index4 = __nccwpck_require__(6439); + +/** + * The {@link getWeek} function options. + */ + +/** + * @name getWeek + * @category Week Helpers + * @summary Get the local week index of the given date. + * + * @description + * Get the local week index of the given date. + * The exact calculation depends on the values of + * `options.weekStartsOn` (which is the index of the first day of the week) + * and `options.firstWeekContainsDate` (which is the day of January, which is always in + * the first week of the week-numbering year) + * + * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system + * + * @param date - The given date + * @param options - An object with options + * + * @returns The week + * + * @example + * // Which week of the local week numbering year is 2 January 2005 with default options? + * const result = getWeek(new Date(2005, 0, 2)) + * //=> 2 + * + * @example + * // Which week of the local week numbering year is 2 January 2005, + * // if Monday is the first day of the week, + * // and the first week of the year always contains 4 January? + * const result = getWeek(new Date(2005, 0, 2), { + * weekStartsOn: 1, + * firstWeekContainsDate: 4 + * }) + * //=> 53 + */ +function getWeek(date, options) { + const _date = (0, _index4.toDate)(date, options?.in); + const diff = + +(0, _index2.startOfWeek)(_date, options) - + +(0, _index3.startOfWeekYear)(_date, options); + + // Round the number of weeks 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 / _index.millisecondsInWeek) + 1; +} + + +/***/ }), + +/***/ 9116: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.getWeekYear = getWeekYear; +var _index = __nccwpck_require__(5586); +var _index2 = __nccwpck_require__(926); +var _index3 = __nccwpck_require__(1284); +var _index4 = __nccwpck_require__(6439); + +/** + * The {@link getWeekYear} function options. + */ + +/** + * @name getWeekYear + * @category Week-Numbering Year Helpers + * @summary Get the local week-numbering year of the given date. + * + * @description + * Get the local week-numbering year of the given date. + * The exact calculation depends on the values of + * `options.weekStartsOn` (which is the index of the first day of the week) + * and `options.firstWeekContainsDate` (which is the day of January, which is always in + * the first week of the week-numbering year) + * + * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system + * + * @param date - The given date + * @param options - An object with options. + * + * @returns The local week-numbering year + * + * @example + * // Which week numbering year is 26 December 2004 with the default settings? + * const result = getWeekYear(new Date(2004, 11, 26)) + * //=> 2005 + * + * @example + * // Which week numbering year is 26 December 2004 if week starts on Saturday? + * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 }) + * //=> 2004 + * + * @example + * // Which week numbering year is 26 December 2004 if the first week contains 4 January? + * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 }) + * //=> 2004 + */ +function getWeekYear(date, options) { + const _date = (0, _index4.toDate)(date, options?.in); + const year = _date.getFullYear(); + + const defaultOptions = (0, _index.getDefaultOptions)(); + const firstWeekContainsDate = + options?.firstWeekContainsDate ?? + options?.locale?.options?.firstWeekContainsDate ?? + defaultOptions.firstWeekContainsDate ?? + defaultOptions.locale?.options?.firstWeekContainsDate ?? + 1; + + const firstWeekOfNextYear = (0, _index2.constructFrom)( + options?.in || date, + 0, + ); + firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); + firstWeekOfNextYear.setHours(0, 0, 0, 0); + const startOfNextYear = (0, _index3.startOfWeek)( + firstWeekOfNextYear, + options, + ); + + const firstWeekOfThisYear = (0, _index2.constructFrom)( + options?.in || date, + 0, + ); + firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); + firstWeekOfThisYear.setHours(0, 0, 0, 0); + const startOfThisYear = (0, _index3.startOfWeek)( + firstWeekOfThisYear, + options, + ); + + if (+_date >= +startOfNextYear) { + return year + 1; + } else if (+_date >= +startOfThisYear) { + return year; + } else { + return year - 1; + } +} + + +/***/ }), + +/***/ 1652: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.isDate = isDate; /** + * @name isDate + * @category Common Helpers + * @summary Is the given value a date? + * + * @description + * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. + * + * @param value - The value to check + * + * @returns True if the given value is a date + * + * @example + * // For a valid date: + * const result = isDate(new Date()) + * //=> true + * + * @example + * // For an invalid date: + * const result = isDate(new Date(NaN)) + * //=> true + * + * @example + * // For some value: + * const result = isDate('2014-02-31') + * //=> false + * + * @example + * // For an object: + * const result = isDate({}) + * //=> false + */ +function isDate(value) { + return ( + value instanceof Date || + (typeof value === "object" && + Object.prototype.toString.call(value) === "[object Date]") + ); +} + + +/***/ }), + +/***/ 6142: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.isValid = isValid; +var _index = __nccwpck_require__(1652); +var _index2 = __nccwpck_require__(6439); + +/** + * @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](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 + * + * @returns The date is valid + * + * @example + * // For the valid date: + * const result = isValid(new Date(2014, 1, 31)) + * //=> true + * + * @example + * // For the value, convertible into a date: + * const result = isValid(1393804800000) + * //=> true + * + * @example + * // For the invalid date: + * const result = isValid(new Date('')) + * //=> false + */ +function isValid(date) { + return !( + (!(0, _index.isDate)(date) && typeof date !== "number") || + isNaN(+(0, _index2.toDate)(date)) + ); +} + + +/***/ }), + +/***/ 9566: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.buildFormatLongFn = buildFormatLongFn; + +function buildFormatLongFn(args) { + return (options = {}) => { + // TODO: Remove String() + const width = options.width ? String(options.width) : args.defaultWidth; + const format = args.formats[width] || args.formats[args.defaultWidth]; + return format; + }; +} + + +/***/ }), + +/***/ 4177: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.buildLocalizeFn = buildLocalizeFn; + +/** + * The localize function argument callback which allows to convert raw value to + * the actual type. + * + * @param value - The value to convert + * + * @returns The converted value + */ + +/** + * The map of localized values for each width. + */ + +/** + * The index type of the locale unit value. It types conversion of units of + * values that don't start at 0 (i.e. quarters). + */ + +/** + * Converts the unit value to the tuple of values. + */ + +/** + * The tuple of localized era values. The first element represents BC, + * the second element represents AD. + */ + +/** + * The tuple of localized quarter values. The first element represents Q1. + */ + +/** + * The tuple of localized day values. The first element represents Sunday. + */ + +/** + * The tuple of localized month values. The first element represents January. + */ + +function buildLocalizeFn(args) { + return (value, options) => { + const context = options?.context ? String(options.context) : "standalone"; + + let valuesArray; + if (context === "formatting" && args.formattingValues) { + const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; + const width = options?.width ? String(options.width) : defaultWidth; + + valuesArray = + args.formattingValues[width] || args.formattingValues[defaultWidth]; + } else { + const defaultWidth = args.defaultWidth; + const width = options?.width ? String(options.width) : args.defaultWidth; + + valuesArray = args.values[width] || args.values[defaultWidth]; } - /** - * Return the login of the actor who closed an issue or PR. If the issue is not closed, return an empty string. - */ - static getActorWhoClosedIssue(issueNumber) { - return this.paginate(this.octokit.issues.listEvents, { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - issue_number: issueNumber, - per_page: 100, - }) - .then((events) => events.filter((event) => event.event === 'closed')) - .then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? ''); + const index = args.argumentCallback ? args.argumentCallback(value) : value; + + // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it! + return valuesArray[index]; + }; +} + + +/***/ }), + +/***/ 3277: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.buildMatchFn = buildMatchFn; + +function buildMatchFn(args) { + return (string, options = {}) => { + const width = options.width; + + const matchPattern = + (width && args.matchPatterns[width]) || + args.matchPatterns[args.defaultMatchWidth]; + const matchResult = string.match(matchPattern); + + if (!matchResult) { + return null; } - /** - * Returns a single artifact by name. If none is found, it returns undefined. - */ - static getArtifactByName(artifactName) { - return this.octokit.actions - .listArtifactsForRepo({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - per_page: 1, - name: artifactName, - }) - .then((response) => response.data.artifacts.at(0)); + const matchedString = matchResult[0]; + + const parsePatterns = + (width && args.parsePatterns[width]) || + args.parsePatterns[args.defaultParseWidth]; + + const key = Array.isArray(parsePatterns) + ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) + : // [TODO] -- I challenge you to fix the type + findKey(parsePatterns, (pattern) => pattern.test(matchedString)); + + let value; + + value = args.valueCallback ? args.valueCallback(key) : key; + value = options.valueCallback + ? // [TODO] -- I challenge you to fix the type + options.valueCallback(value) + : value; + + const rest = string.slice(matchedString.length); + + return { value, rest }; + }; +} + +function findKey(object, predicate) { + for (const key in object) { + if ( + Object.prototype.hasOwnProperty.call(object, key) && + predicate(object[key]) + ) { + return key; } - /** - * Given an artifact ID, returns the download URL to a zip file containing the artifact. - */ - static getArtifactDownloadURL(artifactId) { - return this.octokit.actions - .downloadArtifact({ - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, - artifact_id: artifactId, - archive_format: 'zip', - }) - .then((response) => response.url); + } + return undefined; +} + +function findIndex(array, predicate) { + for (let key = 0; key < array.length; key++) { + if (predicate(array[key])) { + return key; } + } + return undefined; } -exports["default"] = GithubUtils; -/***/ }), +/***/ }), + +/***/ 8009: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.buildMatchPatternFn = buildMatchPatternFn; + +function buildMatchPatternFn(args) { + return (string, options = {}) => { + const matchResult = string.match(args.matchPattern); + if (!matchResult) return null; + const matchedString = matchResult[0]; + + const parseResult = string.match(args.parsePattern); + if (!parseResult) return null; + let value = args.valueCallback + ? args.valueCallback(parseResult[0]) + : parseResult[0]; + + // [TODO] I challenge you to fix the type + value = options.valueCallback ? options.valueCallback(value) : value; + + const rest = string.slice(matchedString.length); + + return { value, rest }; + }; +} + + +/***/ }), + +/***/ 9425: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.enUS = void 0; +var _index = __nccwpck_require__(5436); +var _index2 = __nccwpck_require__(5217); +var _index3 = __nccwpck_require__(1566); +var _index4 = __nccwpck_require__(2720); +var _index5 = __nccwpck_require__(6686); + +/** + * @category Locales + * @summary English locale (United States). + * @language English + * @iso-639-2 eng + * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp) + * @author Lesha Koss [@leshakoss](https://github.com/leshakoss) + */ +const enUS = (exports.enUS = { + code: "en-US", + formatDistance: _index.formatDistance, + formatLong: _index2.formatLong, + formatRelative: _index3.formatRelative, + localize: _index4.localize, + match: _index5.match, + options: { + weekStartsOn: 0 /* Sunday */, + firstWeekContainsDate: 1, + }, +}); + + +/***/ }), + +/***/ 5436: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +exports.formatDistance = void 0; + +const 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", + }, + + aboutXWeeks: { + one: "about 1 week", + other: "about {{count}} weeks", + }, + + xWeeks: { + one: "1 week", + other: "{{count}} weeks", + }, + + aboutXMonths: { + one: "about 1 month", + other: "about {{count}} months", + }, -/***/ 3902: -/***/ ((__unused_webpack_module, exports) => { + xMonths: { + one: "1 month", + other: "{{count}} months", + }, -"use strict"; + aboutXYears: { + one: "about 1 year", + other: "about {{count}} years", + }, -/* eslint-disable @typescript-eslint/naming-convention */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -const replacer = (str) => ({ - '\\': '\\\\', - '\t': '\\t', - '\n': '\\n', - '\r': '\\r', - '\f': '\\f', - '"': '\\"', -}[str] ?? ''); -/** - * Replace any characters in the string that will break JSON.parse for our Git Log output - * - * Solution partly taken from SO user Gabriel Rodríguez Flores 🙇 - * https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading - */ -const sanitizeStringForJSONParse = (inputString) => { - if (typeof inputString !== 'string') { - throw new TypeError('Input must me of type String'); + 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", + }, +}; + +const formatDistance = (token, count, options) => { + let result; + + const tokenValue = formatDistanceLocale[token]; + if (typeof tokenValue === "string") { + result = tokenValue; + } else if (count === 1) { + result = tokenValue.one; + } else { + result = tokenValue.other.replace("{{count}}", count.toString()); + } + + if (options?.addSuffix) { + if (options.comparison && options.comparison > 0) { + return "in " + result; + } else { + return result + " ago"; } - // Replace any newlines and escape backslashes - return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer); + } + + return result; }; -exports["default"] = sanitizeStringForJSONParse; +exports.formatDistance = formatDistance; /***/ }), -/***/ 8982: -/***/ ((__unused_webpack_module, exports) => { +/***/ 5217: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getPreviousVersion = exports.incrementPatch = exports.incrementMinor = exports.SEMANTIC_VERSION_LEVELS = exports.MAX_INCREMENTS = exports.incrementVersion = exports.getVersionStringFromNumber = exports.getVersionNumberFromString = exports.isValidSemverLevel = void 0; -const SEMANTIC_VERSION_LEVELS = { - MAJOR: 'MAJOR', - MINOR: 'MINOR', - PATCH: 'PATCH', - BUILD: 'BUILD', -}; -exports.SEMANTIC_VERSION_LEVELS = SEMANTIC_VERSION_LEVELS; -const MAX_INCREMENTS = 99; -exports.MAX_INCREMENTS = MAX_INCREMENTS; -function isValidSemverLevel(str) { - return Object.keys(SEMANTIC_VERSION_LEVELS).includes(str); -} -exports.isValidSemverLevel = isValidSemverLevel; -/** - * Transforms a versions string into a number - */ -const getVersionNumberFromString = (versionString) => { - const [version, build] = versionString.split('-'); - const [major, minor, patch] = version.split('.').map((n) => Number(n)); - return [major, minor, patch, Number.isInteger(Number(build)) ? Number(build) : 0]; -}; -exports.getVersionNumberFromString = getVersionNumberFromString; -/** - * Transforms version numbers components into a version string - */ -const getVersionStringFromNumber = (major, minor, patch, build = 0) => `${major}.${minor}.${patch}-${build}`; -exports.getVersionStringFromNumber = getVersionStringFromNumber; -/** - * Increments a minor version - */ -const incrementMinor = (major, minor) => { - if (minor < MAX_INCREMENTS) { - return getVersionStringFromNumber(major, minor + 1, 0, 0); - } - return getVersionStringFromNumber(major + 1, 0, 0, 0); +exports.formatLong = void 0; +var _index = __nccwpck_require__(9566); + +const dateFormats = { + full: "EEEE, MMMM do, y", + long: "MMMM do, y", + medium: "MMM d, y", + short: "MM/dd/yyyy", }; -exports.incrementMinor = incrementMinor; -/** - * Increments a Patch version - */ -const incrementPatch = (major, minor, patch) => { - if (patch < MAX_INCREMENTS) { - return getVersionStringFromNumber(major, minor, patch + 1, 0); - } - return incrementMinor(major, minor); + +const timeFormats = { + full: "h:mm:ss a zzzz", + long: "h:mm:ss a z", + medium: "h:mm:ss a", + short: "h:mm a", }; -exports.incrementPatch = incrementPatch; -/** - * Increments a build version - */ -const incrementVersion = (version, level) => { - const [major, minor, patch, build] = getVersionNumberFromString(version); - // Majors will always be incremented - if (level === SEMANTIC_VERSION_LEVELS.MAJOR) { - return getVersionStringFromNumber(major + 1, 0, 0, 0); - } - if (level === SEMANTIC_VERSION_LEVELS.MINOR) { - return incrementMinor(major, minor); - } - if (level === SEMANTIC_VERSION_LEVELS.PATCH) { - return incrementPatch(major, minor, patch); - } - if (build < MAX_INCREMENTS) { - return getVersionStringFromNumber(major, minor, patch, build + 1); - } - return incrementPatch(major, minor, patch); + +const dateTimeFormats = { + full: "{{date}} 'at' {{time}}", + long: "{{date}} 'at' {{time}}", + medium: "{{date}}, {{time}}", + short: "{{date}}, {{time}}", }; -exports.incrementVersion = incrementVersion; -function getPreviousVersion(currentVersion, level) { - const [major, minor, patch, build] = getVersionNumberFromString(currentVersion); - if (level === SEMANTIC_VERSION_LEVELS.MAJOR) { - if (major === 1) { - return getVersionStringFromNumber(1, 0, 0, 0); - } - return getVersionStringFromNumber(major - 1, 0, 0, 0); - } - if (level === SEMANTIC_VERSION_LEVELS.MINOR) { - if (minor === 0) { - return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MAJOR); - } - return getVersionStringFromNumber(major, minor - 1, 0, 0); - } - if (level === SEMANTIC_VERSION_LEVELS.PATCH) { - if (patch === 0) { - return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.MINOR); - } - return getVersionStringFromNumber(major, minor, patch - 1, 0); - } - if (build === 0) { - return getPreviousVersion(currentVersion, SEMANTIC_VERSION_LEVELS.PATCH); - } - return getVersionStringFromNumber(major, minor, patch, build - 1); -} -exports.getPreviousVersion = getPreviousVersion; + +const formatLong = (exports.formatLong = { + date: (0, _index.buildFormatLongFn)({ + formats: dateFormats, + defaultWidth: "full", + }), + + time: (0, _index.buildFormatLongFn)({ + formats: timeFormats, + defaultWidth: "full", + }), + + dateTime: (0, _index.buildFormatLongFn)({ + formats: dateTimeFormats, + defaultWidth: "full", + }), +}); /***/ }), -/***/ 8227: +/***/ 1566: /***/ ((__unused_webpack_module, exports) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isEmptyObject = void 0; -function isEmptyObject(obj) { - return Object.keys(obj ?? {}).length === 0; -} -exports.isEmptyObject = isEmptyObject; +exports.formatRelative = void 0; + +const formatRelativeLocale = { + lastWeek: "'last' eeee 'at' p", + yesterday: "'yesterday at' p", + today: "'today at' p", + tomorrow: "'tomorrow at' p", + nextWeek: "eeee 'at' p", + other: "P", +}; + +const formatRelative = (token, _date, _baseDate, _options) => + formatRelativeLocale[token]; +exports.formatRelative = formatRelative; /***/ }), -/***/ 7034: -/***/ ((__unused_webpack_module, exports) => { +/***/ 2720: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * This function is an equivalent of _.difference, it takes two arrays and returns the difference between them. - * It returns an array of items that are in the first array but not in the second array. - */ -function arrayDifference(array1, array2) { - return [array1, array2].reduce((a, b) => a.filter((c) => !b.includes(c))); -} -exports["default"] = arrayDifference; +exports.localize = void 0; +var _index = __nccwpck_require__(4177); + +const eraValues = { + narrow: ["B", "A"], + abbreviated: ["BC", "AD"], + wide: ["Before Christ", "Anno Domini"], +}; + +const quarterValues = { + narrow: ["1", "2", "3", "4"], + abbreviated: ["Q1", "Q2", "Q3", "Q4"], + wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"], +}; + +// 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. +const monthValues = { + narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], + abbreviated: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + + wide: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], +}; + +const dayValues = { + narrow: ["S", "M", "T", "W", "T", "F", "S"], + short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], + abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + wide: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], +}; + +const dayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night", + }, + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night", + }, + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night", + }, +}; + +const formattingDayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night", + }, + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night", + }, + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night", + }, +}; + +const ordinalNumber = (dirtyNumber, _options) => { + const number = Number(dirtyNumber); + + // If ordinal numbers depend on context, for example, + // if they are different for different grammatical genders, + // use `options.unit`. + // + // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', + // 'day', 'hour', 'minute', 'second'. + + const 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"; +}; + +const localize = (exports.localize = { + ordinalNumber, + + era: (0, _index.buildLocalizeFn)({ + values: eraValues, + defaultWidth: "wide", + }), + + quarter: (0, _index.buildLocalizeFn)({ + values: quarterValues, + defaultWidth: "wide", + argumentCallback: (quarter) => quarter - 1, + }), + + month: (0, _index.buildLocalizeFn)({ + values: monthValues, + defaultWidth: "wide", + }), + + day: (0, _index.buildLocalizeFn)({ + values: dayValues, + defaultWidth: "wide", + }), + + dayPeriod: (0, _index.buildLocalizeFn)({ + values: dayPeriodValues, + defaultWidth: "wide", + formattingValues: formattingDayPeriodValues, + defaultFormattingWidth: "wide", + }), +}); /***/ }), -/***/ 9491: -/***/ ((module) => { +/***/ 6686: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("assert"); -/***/ }), +exports.match = void 0; -/***/ 2081: -/***/ ((module) => { +var _index = __nccwpck_require__(3277); +var _index2 = __nccwpck_require__(8009); -"use strict"; -module.exports = require("child_process"); +const matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; +const parseOrdinalNumberPattern = /\d+/i; -/***/ }), +const matchEraPatterns = { + narrow: /^(b|a)/i, + abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, + wide: /^(before christ|before common era|anno domini|common era)/i, +}; +const parseEraPatterns = { + any: [/^b/i, /^(a|c)/i], +}; -/***/ 6113: -/***/ ((module) => { +const matchQuarterPatterns = { + narrow: /^[1234]/i, + abbreviated: /^q[1234]/i, + wide: /^[1234](th|st|nd|rd)? quarter/i, +}; +const parseQuarterPatterns = { + any: [/1/i, /2/i, /3/i, /4/i], +}; -"use strict"; -module.exports = require("crypto"); +const matchMonthPatterns = { + narrow: /^[jfmasond]/i, + abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, + wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i, +}; +const parseMonthPatterns = { + narrow: [ + /^j/i, + /^f/i, + /^m/i, + /^a/i, + /^m/i, + /^j/i, + /^j/i, + /^a/i, + /^s/i, + /^o/i, + /^n/i, + /^d/i, + ], + + 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, + ], +}; -/***/ }), +const matchDayPatterns = { + narrow: /^[smtwf]/i, + short: /^(su|mo|tu|we|th|fr|sa)/i, + abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, + wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i, +}; +const parseDayPatterns = { + narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i], +}; -/***/ 3975: -/***/ ((module) => { +const matchDayPeriodPatterns = { + narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, + any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i, +}; +const parseDayPeriodPatterns = { + any: { + am: /^a/i, + pm: /^p/i, + midnight: /^mi/i, + noon: /^no/i, + morning: /morning/i, + afternoon: /afternoon/i, + evening: /evening/i, + night: /night/i, + }, +}; -"use strict"; -module.exports = require("encoding"); +const match = (exports.match = { + ordinalNumber: (0, _index2.buildMatchPatternFn)({ + matchPattern: matchOrdinalNumberPattern, + parsePattern: parseOrdinalNumberPattern, + valueCallback: (value) => parseInt(value, 10), + }), -/***/ }), + era: (0, _index.buildMatchFn)({ + matchPatterns: matchEraPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseEraPatterns, + defaultParseWidth: "any", + }), -/***/ 2361: -/***/ ((module) => { + quarter: (0, _index.buildMatchFn)({ + matchPatterns: matchQuarterPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseQuarterPatterns, + defaultParseWidth: "any", + valueCallback: (index) => index + 1, + }), -"use strict"; -module.exports = require("events"); + month: (0, _index.buildMatchFn)({ + matchPatterns: matchMonthPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseMonthPatterns, + defaultParseWidth: "any", + }), -/***/ }), + day: (0, _index.buildMatchFn)({ + matchPatterns: matchDayPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseDayPatterns, + defaultParseWidth: "any", + }), -/***/ 7147: -/***/ ((module) => { + dayPeriod: (0, _index.buildMatchFn)({ + matchPatterns: matchDayPeriodPatterns, + defaultMatchWidth: "any", + parsePatterns: parseDayPeriodPatterns, + defaultParseWidth: "any", + }), +}); -"use strict"; -module.exports = require("fs"); /***/ }), -/***/ 3685: -/***/ ((module) => { +/***/ 5951: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("http"); -/***/ }), +exports.startOfDay = startOfDay; +var _index = __nccwpck_require__(6439); -/***/ 5687: -/***/ ((module) => { +/** + * The {@link startOfDay} function options. + */ + +/** + * @name startOfDay + * @category Day Helpers + * @summary Return the start of a day for the given date. + * + * @description + * Return the start of a day for the given date. + * The result will be in the local timezone. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param date - The original date + * @param options - The options + * + * @returns The start of a day + * + * @example + * // The start of a day for 2 September 2014 11:55:00: + * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0)) + * //=> Tue Sep 02 2014 00:00:00 + */ +function startOfDay(date, options) { + const _date = (0, _index.toDate)(date, options?.in); + _date.setHours(0, 0, 0, 0); + return _date; +} -"use strict"; -module.exports = require("https"); /***/ }), -/***/ 1808: -/***/ ((module) => { +/***/ 8516: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("net"); -/***/ }), +exports.startOfISOWeek = startOfISOWeek; +var _index = __nccwpck_require__(1284); -/***/ 2037: -/***/ ((module) => { +/** + * The {@link startOfISOWeek} function options. + */ + +/** + * @name startOfISOWeek + * @category ISO Week Helpers + * @summary Return the start of an ISO week for the given date. + * + * @description + * Return the start of an ISO week for the given date. + * The result will be in the local timezone. + * + * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param date - The original date + * @param options - An object with options + * + * @returns The start of an ISO week + * + * @example + * // The start of an ISO week for 2 September 2014 11:55:00: + * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) + * //=> Mon Sep 01 2014 00:00:00 + */ +function startOfISOWeek(date, options) { + return (0, _index.startOfWeek)(date, { ...options, weekStartsOn: 1 }); +} -"use strict"; -module.exports = require("os"); /***/ }), -/***/ 1017: -/***/ ((module) => { +/***/ 5437: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("path"); -/***/ }), +exports.startOfISOWeekYear = startOfISOWeekYear; +var _index = __nccwpck_require__(926); +var _index2 = __nccwpck_require__(7131); +var _index3 = __nccwpck_require__(8516); -/***/ 5477: -/***/ ((module) => { +/** + * The {@link startOfISOWeekYear} function options. + */ + +/** + * @name startOfISOWeekYear + * @category ISO Week-Numbering Year Helpers + * @summary Return the start of an ISO week-numbering year for the given date. + * + * @description + * Return the start of an ISO week-numbering year, + * which always starts 3 days before the year's first Thursday. + * The result will be in the local timezone. + * + * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param date - The original date + * @param options - An object with options + * + * @returns The start of an ISO week-numbering year + * + * @example + * // The start of an ISO week-numbering year for 2 July 2005: + * const result = startOfISOWeekYear(new Date(2005, 6, 2)) + * //=> Mon Jan 03 2005 00:00:00 + */ +function startOfISOWeekYear(date, options) { + const year = (0, _index2.getISOWeekYear)(date, options); + const fourthOfJanuary = (0, _index.constructFrom)(options?.in || date, 0); + fourthOfJanuary.setFullYear(year, 0, 4); + fourthOfJanuary.setHours(0, 0, 0, 0); + return (0, _index3.startOfISOWeek)(fourthOfJanuary); +} -"use strict"; -module.exports = require("punycode"); /***/ }), -/***/ 2781: -/***/ ((module) => { +/***/ 1284: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("stream"); -/***/ }), +exports.startOfWeek = startOfWeek; +var _index = __nccwpck_require__(5586); +var _index2 = __nccwpck_require__(6439); -/***/ 4404: -/***/ ((module) => { +/** + * The {@link startOfWeek} function options. + */ -"use strict"; -module.exports = require("tls"); +/** + * @name startOfWeek + * @category Week Helpers + * @summary Return the start of a week for the given date. + * + * @description + * Return the start of a week for the given date. + * The result will be in the local timezone. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param date - The original date + * @param options - An object with options + * + * @returns The start of a week + * + * @example + * // The start of a week for 2 September 2014 11:55:00: + * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) + * //=> Sun Aug 31 2014 00:00:00 + * + * @example + * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: + * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) + * //=> Mon Sep 01 2014 00:00:00 + */ +function startOfWeek(date, options) { + const defaultOptions = (0, _index.getDefaultOptions)(); + const weekStartsOn = + options?.weekStartsOn ?? + options?.locale?.options?.weekStartsOn ?? + defaultOptions.weekStartsOn ?? + defaultOptions.locale?.options?.weekStartsOn ?? + 0; -/***/ }), + const _date = (0, _index2.toDate)(date, options?.in); + const day = _date.getDay(); + const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; -/***/ 7310: -/***/ ((module) => { + _date.setDate(_date.getDate() - diff); + _date.setHours(0, 0, 0, 0); + return _date; +} -"use strict"; -module.exports = require("url"); /***/ }), -/***/ 3837: -/***/ ((module) => { +/***/ 5129: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("util"); + +exports.startOfWeekYear = startOfWeekYear; +var _index = __nccwpck_require__(5586); +var _index2 = __nccwpck_require__(926); +var _index3 = __nccwpck_require__(9116); +var _index4 = __nccwpck_require__(1284); + +/** + * The {@link startOfWeekYear} function options. + */ + +/** + * @name startOfWeekYear + * @category Week-Numbering Year Helpers + * @summary Return the start of a local week-numbering year for the given date. + * + * @description + * Return the start of a local week-numbering year. + * The exact calculation depends on the values of + * `options.weekStartsOn` (which is the index of the first day of the week) + * and `options.firstWeekContainsDate` (which is the day of January, which is always in + * the first week of the week-numbering year) + * + * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type. + * + * @param date - The original date + * @param options - An object with options + * + * @returns The start of a week-numbering year + * + * @example + * // The start of an a week-numbering year for 2 July 2005 with default settings: + * const result = startOfWeekYear(new Date(2005, 6, 2)) + * //=> Sun Dec 26 2004 00:00:00 + * + * @example + * // The start of a week-numbering year for 2 July 2005 + * // if Monday is the first day of week + * // and 4 January is always in the first week of the year: + * const result = startOfWeekYear(new Date(2005, 6, 2), { + * weekStartsOn: 1, + * firstWeekContainsDate: 4 + * }) + * //=> Mon Jan 03 2005 00:00:00 + */ +function startOfWeekYear(date, options) { + const defaultOptions = (0, _index.getDefaultOptions)(); + const firstWeekContainsDate = + options?.firstWeekContainsDate ?? + options?.locale?.options?.firstWeekContainsDate ?? + defaultOptions.firstWeekContainsDate ?? + defaultOptions.locale?.options?.firstWeekContainsDate ?? + 1; + + const year = (0, _index3.getWeekYear)(date, options); + const firstWeek = (0, _index2.constructFrom)(options?.in || date, 0); + firstWeek.setFullYear(year, 0, firstWeekContainsDate); + firstWeek.setHours(0, 0, 0, 0); + const _date = (0, _index4.startOfWeek)(firstWeek, options); + return _date; +} + /***/ }), -/***/ 9796: -/***/ ((module) => { +/***/ 8537: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("zlib"); -/***/ }), +exports.startOfYear = startOfYear; +var _index = __nccwpck_require__(6439); -/***/ 3286: -/***/ ((module) => { +/** + * The {@link startOfYear} function options. + */ -function _interopRequireDefault(e) { - return e && e.__esModule ? e : { - "default": e - }; +/** + * @name startOfYear + * @category Year Helpers + * @summary Return the start of a year for the given date. + * + * @description + * Return the start of a year for the given date. + * The result will be in the local timezone. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param date - The original date + * @param options - The options + * + * @returns The start of a year + * + * @example + * // The start of a year for 2 September 2014 11:55:00: + * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00)) + * //=> Wed Jan 01 2014 00:00:00 + */ +function startOfYear(date, options) { + const date_ = (0, _index.toDate)(date, options?.in); + date_.setFullYear(date_.getFullYear(), 0, 1); + date_.setHours(0, 0, 0, 0); + return date_; } -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; + /***/ }), -/***/ 5605: -/***/ ((module) => { +/***/ 6439: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; -function _typeof(o) { - "@babel/helpers - typeof"; +exports.toDate = toDate; +var _index = __nccwpck_require__(926); - return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { - return typeof o; - } : function (o) { - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o); +/** + * @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 the argument is none of the above, the function returns Invalid Date. + * + * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]` + * enabling to transfer extra properties from the reference date to the new date. + * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) + * that accept a time zone as a constructor argument. + * + * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param argument - The value to convert + * + * @returns The parsed date in the local time zone + * + * @example + * // Clone the date: + * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) + * //=> Tue Feb 11 2014 11:30:30 + * + * @example + * // Convert the timestamp to date: + * const result = toDate(1392098430000) + * //=> Tue Feb 11 2014 11:30:30 + */ +function toDate(argument, context) { + // [TODO] Get rid of `toDate` or `constructFrom`? + return (0, _index.constructFrom)(context || argument, argument); } -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; + /***/ }), diff --git a/.github/workflows/buildAndroid.yml b/.github/workflows/buildAndroid.yml index 403a40214b40..c88542068b92 100644 --- a/.github/workflows/buildAndroid.yml +++ b/.github/workflows/buildAndroid.yml @@ -20,11 +20,14 @@ on: description: The pull request number associated with this build, if relevant. type: string required: false + outputs: AAB_FILE_NAME: value: ${{ jobs.build.outputs.AAB_FILE_NAME }} APK_FILE_NAME: value: ${{ jobs.build.outputs.APK_FILE_NAME }} + APK_ARTIFACT_NAME: + value: ${{ jobs.build.outputs.APK_ARTIFACT_NAME }} workflow_dispatch: inputs: @@ -56,6 +59,7 @@ jobs: outputs: AAB_FILE_NAME: ${{ steps.build.outputs.AAB_FILE_NAME }} APK_FILE_NAME: ${{ steps.build.outputs.APK_FILE_NAME }} + APK_ARTIFACT_NAME: ${{ steps.build.outputs.APK_ARTIFACT_NAME }} steps: - name: Checkout @@ -118,42 +122,49 @@ jobs: } >> "$envFile" fi - - name: Build Android app + - name: Build Android app (retryable) + uses: nick-fields/retry@v3 id: build - run: | - lane='' - case '${{ inputs.type }}' in - 'release') - lane='build';; - 'adhoc') - lane='build_adhoc';; - 'e2e') - lane='build_e2e';; - 'e2eDelta') - lane='build_e2eDelta';; - esac - bundle exec fastlane android "$lane" - - # Refresh environment variables from GITHUB_ENV that are updated when running fastlane - # shellcheck disable=SC1090 - source "$GITHUB_ENV" - - SHOULD_UPLOAD_SOURCEMAPS='false' - if [ -f ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map ]; then - SHOULD_UPLOAD_SOURCEMAPS='true' - fi - - { - # aabPath and apkPath are environment varibles set within the Fastfile - echo "AAB_PATH=$aabPath" - echo "AAB_FILE_NAME=$(basename "$aabPath")" - echo "APK_PATH=$apkPath" - echo "APK_FILE_NAME=$(basename "$apkPath")" - echo "SHOULD_UPLOAD_SOURCEMAPS=$SHOULD_UPLOAD_SOURCEMAPS" - } >> "$GITHUB_OUTPUT" env: MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }} MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }} + with: + retry_on: error + retry_wait_seconds: 60 + timeout_minutes: 60 + max_attempts: 3 + command: | + lane='' + case '${{ inputs.type }}' in + 'release') + lane='build';; + 'adhoc') + lane='build_adhoc';; + 'e2e') + lane='build_e2e';; + 'e2eDelta') + lane='build_e2eDelta';; + esac + bundle exec fastlane android "$lane" + + # Refresh environment variables from GITHUB_ENV that are updated when running fastlane + # shellcheck disable=SC1090 + source "$GITHUB_ENV" + + SHOULD_UPLOAD_SOURCEMAPS='false' + if [ -f ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map ]; then + SHOULD_UPLOAD_SOURCEMAPS='true' + fi + + { + # aabPath and apkPath are environment varibles set within the Fastfile + echo "AAB_PATH=$aabPath" + echo "AAB_FILE_NAME=$(basename "$aabPath")" + echo "APK_PATH=$apkPath" + echo "APK_FILE_NAME=$(basename "$apkPath")" + echo "SHOULD_UPLOAD_SOURCEMAPS=$SHOULD_UPLOAD_SOURCEMAPS" + echo "APK_ARTIFACT_NAME=${{ inputs.artifact-prefix }}android-artifact-apk" >> "$GITHUB_OUTPUT" + } >> "$GITHUB_OUTPUT" - name: Upload Android AAB artifact if: ${{ steps.build.outputs.AAB_PATH != '' }} @@ -168,7 +179,7 @@ jobs: continue-on-error: true uses: actions/upload-artifact@v4 with: - name: ${{ inputs.artifact-prefix }}android-artifact-apk + name: ${{ steps.build.outputs.APK_ARTIFACT_NAME }} path: ${{ steps.build.outputs.APK_PATH }} - name: Upload Android sourcemaps artifact diff --git a/.github/workflows/deployBlocker.yml b/.github/workflows/deployBlocker.yml index 47df9b4285b9..2707305fb43c 100644 --- a/.github/workflows/deployBlocker.yml +++ b/.github/workflows/deployBlocker.yml @@ -29,23 +29,6 @@ jobs: escaped_title=$(echo "$GH_ISSUE_TITLE" | sed -e 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g; s/|/\|/g') echo "GH_ISSUE_TITLE=$escaped_title" >> "$GITHUB_ENV" - - name: 'Post the issue in the #expensify-open-source slack room' - if: ${{ success() }} - uses: 8398a7/action-slack@v3 - with: - status: custom - custom_payload: | - { - channel: '#expensify-open-source', - attachments: [{ - color: "#DB4545", - text: '💥 New Deploy Blocker: <${{ github.event.issue.html_url }}|${{ env.GH_ISSUE_TITLE }}>. If you have any idea which PR could be causing this, please comment in the issue.' - }] - } - env: - GITHUB_TOKEN: ${{ github.token }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Comment on deploy blocker run: | gh issue comment ${{ github.event.issue.number }} --body "$(cat <<'EOF' diff --git a/.github/workflows/deployNewHelp.yml b/.github/workflows/deployNewHelp.yml index ec91f593e4b1..45a4ab7c3620 100644 --- a/.github/workflows/deployNewHelp.yml +++ b/.github/workflows/deployNewHelp.yml @@ -51,6 +51,17 @@ jobs: bundler-cache: true working-directory: ./help + # Install Node for _scripts/*.js + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.15.1' + + # Wil install the _help/package.js + - name: Install Node.js Dependencies + run: npm install + working-directory: ./help # Install the help dependencies, not App + # Manually run Jekyll, bypassing Github Pages - name: Build Jekyll site run: bundle exec jekyll build --source ./ --destination ./_site diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index f88e841617bb..d8e706d467ba 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -46,7 +46,7 @@ jobs: uses: ./.github/actions/javascript/getArtifactInfo with: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - ARTIFACT_NAME: baseline-${{ steps.getMostRecentRelease.outputs.VERSION }}-android-artifact-apk + ARTIFACT_NAME: baseline-${{ steps.getMostRecentRelease.outputs.VERSION }}android-artifact-apk - name: Skip build if there's already an existing artifact for the baseline if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} @@ -125,7 +125,7 @@ jobs: uses: actions/download-artifact@v4 id: downloadBaselineAPK with: - name: baseline-${{ needs.prep.outputs.BASELINE_VERSION }}-android-artifact-apk + name: ${{ needs.buildBaseline.outputs.APK_ARTIFACT_NAME }} path: zip # Set github-token only if the baseline was built in this workflow run: github-token: ${{ needs.prep.outputs.BASELINE_ARTIFACT_WORKFLOW_ID && github.token }} @@ -139,7 +139,7 @@ jobs: uses: actions/download-artifact@v4 id: downloadDeltaAPK with: - name: delta-${{ needs.prep.outputs.DELTA_REF }}-android-artifact-apk + name: ${{ needs.buildDelta.outputs.APK_ARTIFACT_NAME }} path: zip - name: Rename delta APK diff --git a/android/app/build.gradle b/android/app/build.gradle index 56ae4bd0a873..ffb9fa2b4c57 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -13,7 +13,7 @@ apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.grad /* Fullstory settings */ fullstory { org 'o-1WN56P-na1' - enabledVariants 'all' + enabledVariants 'production' logcatLevel 'debug' recordOnStart false } @@ -110,8 +110,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009004502 - versionName "9.0.45-2" + versionCode 1009005007 + versionName "9.0.50-7" // Supported language variants must be declared here to avoid from being removed during the compilation. // This also helps us to not include unnecessary language variants in the APK. resConfigs "en", "es" diff --git a/android/build.gradle b/android/build.gradle index fd3f9997612e..e47972bf45e5 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -42,12 +42,6 @@ allprojects { configurations.all { resolutionStrategy { force 'org.xerial:sqlite-jdbc:3.34.0' - - // Manually set the react-native version to resolve this upstream issue: https://github.com/facebook/react-native/issues/35210 - def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) - force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION - force "com.facebook.react:hermes-engine:" + REACT_NATIVE_VERSION - //Fix Investigate App Crash MainActivity.onCreate #35655 force "com.facebook.soloader:soloader:0.10.4+" diff --git a/assets/images/companyCards/card-bank_of_america.svg b/assets/images/companyCards/card-bank_of_america.svg deleted file mode 100644 index 684a6a0a28f5..000000000000 --- a/assets/images/companyCards/card-bank_of_america.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/images/companyCards/card-other.svg b/assets/images/companyCards/card-other.svg deleted file mode 100644 index 11ff21285626..000000000000 --- a/assets/images/companyCards/card-other.svg +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/images/integrationicons/qbd-icon-square.svg b/assets/images/integrationicons/qbd-icon-square.svg new file mode 100644 index 000000000000..e297b597f980 --- /dev/null +++ b/assets/images/integrationicons/qbd-icon-square.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/laptop-with-second-screen-sync.svg b/assets/images/laptop-with-second-screen-sync.svg new file mode 100644 index 000000000000..a74048795dbf --- /dev/null +++ b/assets/images/laptop-with-second-screen-sync.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/laptop-with-second-screen-x.svg b/assets/images/laptop-with-second-screen-x.svg new file mode 100644 index 000000000000..f4b6b77f70f1 --- /dev/null +++ b/assets/images/laptop-with-second-screen-x.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/desktop/package-lock.json b/desktop/package-lock.json index 4803d189074c..75cb080f1349 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -9,7 +9,7 @@ "dependencies": { "electron-context-menu": "^2.3.0", "electron-log": "^4.4.8", - "electron-updater": "^6.3.5", + "electron-updater": "^6.3.8", "mime-types": "^2.1.35", "node-machine-id": "^1.1.12" }, @@ -59,9 +59,9 @@ } }, "node_modules/builder-util-runtime": { - "version": "9.2.6", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.6.tgz", - "integrity": "sha512-sCNP0uykVxn1vdYdPGW3+8D4kMOF8PR9eL5HgUcQXhpoIoUGxdD03yQgZcuMQt4iGLKb5DD62evElwGq1ylEag==", + "version": "9.2.9", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.9.tgz", + "integrity": "sha512-DWeHdrRFVvNnVyD4+vMztRpXegOGaQHodsAjyhstTbUNBIjebxM1ahxokQL+T1v8vpW8SY7aJ5is/zILH82lAw==", "license": "MIT", "dependencies": { "debug": "^4.3.4", @@ -156,12 +156,12 @@ "integrity": "sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA==" }, "node_modules/electron-updater": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.5.tgz", - "integrity": "sha512-8bUtfe3UHnM+D7971N/zo3NCG2TIHuE4GFUtHRVmVOQg0prXEd+uZoVekakdPiTDkkXJv4b09CZMw/ZJJfag1A==", + "version": "6.3.8", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.8.tgz", + "integrity": "sha512-OFsA2vyuOZgsqq4EW6tgW8X8e521ybDmQyIYLqss7HdXev+Ak90YatzpIECOBJXpmro5YDq4yZ2xFsKXqPt1DQ==", "license": "MIT", "dependencies": { - "builder-util-runtime": "9.2.6", + "builder-util-runtime": "9.2.9", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lazy-val": "^1.0.5", @@ -469,9 +469,9 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==" }, "builder-util-runtime": { - "version": "9.2.6", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.6.tgz", - "integrity": "sha512-sCNP0uykVxn1vdYdPGW3+8D4kMOF8PR9eL5HgUcQXhpoIoUGxdD03yQgZcuMQt4iGLKb5DD62evElwGq1ylEag==", + "version": "9.2.9", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.9.tgz", + "integrity": "sha512-DWeHdrRFVvNnVyD4+vMztRpXegOGaQHodsAjyhstTbUNBIjebxM1ahxokQL+T1v8vpW8SY7aJ5is/zILH82lAw==", "requires": { "debug": "^4.3.4", "sax": "^1.2.4" @@ -538,11 +538,11 @@ "integrity": "sha512-QQ4GvrXO+HkgqqEOYbi+DHL7hj5JM+nHi/j+qrN9zeeXVKy8ZABgbu4CnG+BBqDZ2+tbeq9tUC4DZfIWFU5AZA==" }, "electron-updater": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.5.tgz", - "integrity": "sha512-8bUtfe3UHnM+D7971N/zo3NCG2TIHuE4GFUtHRVmVOQg0prXEd+uZoVekakdPiTDkkXJv4b09CZMw/ZJJfag1A==", + "version": "6.3.8", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.8.tgz", + "integrity": "sha512-OFsA2vyuOZgsqq4EW6tgW8X8e521ybDmQyIYLqss7HdXev+Ak90YatzpIECOBJXpmro5YDq4yZ2xFsKXqPt1DQ==", "requires": { - "builder-util-runtime": "9.2.6", + "builder-util-runtime": "9.2.9", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lazy-val": "^1.0.5", diff --git a/desktop/package.json b/desktop/package.json index b8e1e175b0fe..326d6f24f740 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -6,7 +6,7 @@ "dependencies": { "electron-context-menu": "^2.3.0", "electron-log": "^4.4.8", - "electron-updater": "^6.3.5", + "electron-updater": "^6.3.8", "mime-types": "^2.1.35", "node-machine-id": "^1.1.12" }, diff --git a/docs/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account.md b/docs/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account.md index 1ad70117ed5c..49aaa480e2dc 100644 --- a/docs/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account.md +++ b/docs/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account.md @@ -8,7 +8,7 @@ You can choose to connect either a business deposit-only account that only recei | Business deposit-only account | Verified business account | |---------------------------------------------------|------------------------------------------------------| -| ✔ Receive reimbursements for invoices | ✔ Reimburse expenses via direct bank transfer | +| ✔ Receive payments for invoices | ✔ Reimburse expenses via direct bank transfer | | | ✔ Pay bills | | | ✔ Issue Expensify Cards | diff --git a/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-Bills.md b/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Create-and-Pay-Bills.md similarity index 95% rename from docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-Bills.md rename to docs/articles/expensify-classic/bank-accounts-and-payments/payments/Create-and-Pay-Bills.md index 465f6742eaea..aff11c059d81 100644 --- a/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-Bills.md +++ b/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Create-and-Pay-Bills.md @@ -1,26 +1,26 @@ --- -title: Pay Bills +title: Create and Pay Bills description: Expensify bill management and payment methods. --- Streamline your operations by receiving and paying vendor or supplier bills directly in Expensify. Vendors can send bills even if they don't have an Expensify account, and you can manage payments seamlessly. -## Receive Bills in Expensify +# Receive Bills in Expensify You can receive bills in three ways: - Directly from Vendors: Provide your Expensify billing email to vendors. - Forwarding Emails: Forward bills received in your email to Expensify. - Manual Upload: For physical bills, create a Bill in Expensify from the Reports page. -## Bill Pay Workflow +# Bill Pay Workflow 1. When a vendor or supplier sends a bill to Expensify, the document is automatically SmartScanned, and a Bill is created. This Bill is managed by the primary domain contact, who can view it on the Reports page within their default group policy. 2. Once the Bill is ready for processing, it follows the established approval workflow. As each person approves it, the Bill appears in the next approver’s Inbox. The final approver will pay the Bill using one of the available payment methods. 3. During this process, the Bill is coded with the appropriate GL codes from your connected accounting software. After completing the approval workflow, the Bill can be exported back to your accounting system. -## Payment Methods +# Payment Methods There are multiple ways to pay Bills in Expensify. Let’s go over each method below. -### ACH bank-to-bank transfer +## ACH bank-to-bank transfer To use this payment method, you must have a [business bank account connected to your Expensify account](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account). @@ -32,7 +32,7 @@ To use this payment method, you must have a [business bank account connected to **Fees:** None -### Credit or Debit Card +## Credit or Debit Card This option is available to all US and International customers receiving a bill from a US vendor with a US business bank account. **To pay with a credit or debit card:** @@ -43,13 +43,13 @@ This option is available to all US and International customers receiving a bill **Fees:** 2.9% of the total amount paid. -### Venmo +## Venmo If both you and the vendor must have Venmo connected to Expensify, you can pay the bill by following the steps outlined [here](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/Third-Party-Payments#setting-up-third-party-payments). **Fees:** Venmo charges a 3% sender’s fee. -### Pay outside of Expensify +## Pay outside of Expensify If you are unable to pay using one of the above methods, you can still mark the Bill as paid. This will update its status to indicate that the payment was made outside Expensify. **To mark a Bill as paid outside of Expensify:** diff --git a/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-an-Invoice.md b/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-an-Invoice.md new file mode 100644 index 000000000000..84fafc949527 --- /dev/null +++ b/docs/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-an-Invoice.md @@ -0,0 +1,65 @@ +--- +title: Pay an Invoice +description: A guide to different methods of paying an invoice +--- + +
+ +There are multiple ways to pay Invoices in Expensify. Let’s go over each method below. + +# How to Pay Invoices + +1. Sign in to your [Expensify web account](www.expensify.com). +2. Click on the Invoice you’d like to pay to see the details. +3. Click on the **Pay** button. +4. Follow the prompts to pay through one of the following methods. + +### ACH bank-to-bank transfer + +To use this payment method, you must have a [business bank account connected to your Expensify account](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account). + +**To pay with an ACH bank-to-bank transfer:** +1. Sign in to your [Expensify web account](www.expensify.com). +2. Go to the **Home** or **Reports** page and locate the Invoice that needs to be paid. +3. Click the **Pay** button to be redirected to the Invoice. +4. Choose the ACH option from the drop-down list. + +**Fees:** None + +### Credit or Debit Card +This option is available to all US and International customers receiving an invoice from a US vendor with a US business bank account. + +**To pay with a credit or debit card:** +1. Sign in to your [Expensify web account](www.expensify.com). +2. Click on the Invoice you’d like to pay to see the details. +3. Click the **Pay** button. +4. Enter your credit card or debit card details. + +**Fees:** 2.9% credit card payment fee. + +### Venmo +If both you and the vendor must have Venmo connected to Expensify, you can pay the Invoice by following the steps outlined [here](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/Third-Party-Payments#setting-up-third-party-payments). + +**Fees:** Venmo and Paypal.me charges may apply. + + +### Pay outside of Expensify +If you are unable to pay using one of the above methods, you can still mark the Invoice as paid. This will update its status to indicate that the payment was made outside Expensify. + +**To mark an Invoice as paid outside of Expensify:** +1. Sign in to your [Expensify web account](www.expensify.com). +2. Click on the Invoice you’d like to pay to see the details. +3. Click the Pay button. +4. Choose **I’ll do it manually**. + +**Fees:** None. + +{% include faq-begin.md %} + +## What’s the difference between an Invoice and an Expense Report in Expensify? +An invoice is an expense submitted to a client or contractor for payment. An expense report is an expense/group of expenses submitted to an employer for reimbursement. + +## What’s the difference between a Bill and an Invoice in Expensify? +A Bill is an amount owed to a payee (usually a vendor or supplier) and is usually created from a vendor invoice. An Invoice is a receivable and indicates an amount owed to you by someone else. + +{% include faq-end.md %} diff --git a/docs/articles/expensify-classic/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md b/docs/articles/expensify-classic/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md index 158a55b93e0f..6a43141f1ab9 100644 --- a/docs/articles/expensify-classic/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md +++ b/docs/articles/expensify-classic/connections/quickbooks-online/Quickbooks-Online-Troubleshooting.md @@ -18,7 +18,7 @@ This error occurs when the account applied as a category to the expense in Expen 5. Click on the pencil icon on the right to check if you have "In multiple accounts" selected: 6. If "In multiple accounts" is selected, go to Chart of Accounts and click Edit for the account in question. 7. Check the billable option and select an income account within your chart of accounts -8. Sync your QuickBooks Online connection in Settings > Workspaces > [click workspace] > Connections. +8. Sync your QuickBooks Online connection in Settings > Workspaces > [workspace name] > Connections. 9. Open the report and click the Export to button and then the QuickBooks Online option. # ExpensiError QBO046: Feature Not Included in Subscription @@ -40,11 +40,11 @@ _Please note: Self Employed is not supported:_ **Why does this happen?** -QuickBooks Online requires all expenses exported from Expensify to use a category matching an account in your chart of accounts. If a category from another source is used, QuickBooks Online will reject the expense. This errors occurs when an expense on the report has a category applied that is not valid in QuickBooks Online. +QuickBooks Online requires all expenses exported from Expensify to use a category matching an account in your chart of accounts. If a category from another source is used, QuickBooks Online will reject the expense. This error occurs when an expense on the report has a category applied that is not valid in QuickBooks Online. ## How to fix it -1. Sync your QuickBooks Online connection in Expensify from Settings > Workspaces > [click workspace] > Connections, and click the **Sync Now** button. +1. Sync your QuickBooks Online connection in Expensify from Settings > Workspaces > [workspace name] > Connections, and click the **Sync Now** button. 2. Review the expenses on the report. If any appear with a red _Category no longer valid_ violation, recategorize the expense until all expenses are violation-free. 3. Click the **Export t**o button and then the **QuickBooks Online** option. - If you receive the same error, continue. @@ -56,7 +56,7 @@ QuickBooks Online requires all expenses exported from Expensify to use a categor **Why does this happen?** -This error occurs when you have an Employee Record set up with the employee's name, which prevents the Expensify integration from automatically creating the Vendor Record with the same name, since QuickBooks Online won't allow you to have an employee and vendor with the same name. +This error occurs when you have an Employee Record set up with the employee's name. This prevents the Expensify integration from automatically creating the Vendor Record with the same name since QuickBooks Online won't allow you to have an employee and vendor with the same name. ## How to fix it @@ -67,7 +67,7 @@ There are two different ways you can resolve this error. 1. Log into QuickBooks Online. 2. Access the Employee Records for your submitters. 3. Edit the name to differentiate them from the name they have on their account in Expensify. -4. Sync your QuickBooks Online connection in Settings > Workspaces > [click workspace] > Connections. +4. Sync your QuickBooks Online connection in Settings > Workspaces > [workspace name] > Connections. 5. Open the report and click the Export to button and then the QuickBooks Online option. **Option 2**: @@ -85,7 +85,7 @@ This error occurs when you are exporting reimbursable expenses as Journal Entrie There are three different ways you can resolve this error. - Select a different type of export for reimbursable expenses under Settings > Workspaces > [worksapce name] > Connections > Configure > Export tab. -- Enable _Automatically Create Entities_ under Settings > Workspaces > [worksapce name] > Connections > Configure > Advanced to create vendor records automatically. +- Enable _Automatically Create Entities_ under Settings > Workspaces > [workspace name] > Connections > Configure > Advanced to create vendor records automatically. - Manually create vendor records in QuickBooks Online for each employee. # ExpensiError QBO099: Items marked as billable must have sales information checked @@ -97,7 +97,7 @@ This error occurs when an Item category on an expense does not have sales inform ## How to fix it 1. Log into QuickBooks Online. -2. Navigate to to your items list. +2. Navigate to your items list. 3. Click **Edit** to the right of the item used on the report with the error. Here you will see an option to check either "Sales" or "Purchasing". 4. Check the option for **Sales**. 5. Select an income account. @@ -146,12 +146,12 @@ This error occurs because the currency on the Vendor record in QuickBooks Online 1. Log into QuickBooks Online. 2. Open the vendor record. -3. Update the record to use with the correct A/P account, currency and an email matching their Expensify email. -You can find the correct Vendor record by exporting your QuickBooks Online [vendor list](https://community.expensify.com/home/leaving?allowTrusted=1&target=https%3A%2F%2Fqbo.intuit.com%2Fapp%2Fvendors) to a spreadsheet (click the export icon on the right-hand side of the page), and search for the email address of the person who submitted the report. +3. Update the record to use with the correct A/P account, currency, and email matching their Expensify email. +You can find the correct Vendor record by exporting your QuickBooks Online vendor list to a spreadsheet (click the export icon on the right-hand side of the page), and search for the email address of the person who submitted the report. If you have multiple Vendors with different currencies with the same email, Expensify is likely trying to export to the wrong one. -1. Try removing the email address from the vendor in QuickBooks Online you aren't trying to export to. +1. Try removing the email address from the vendor in QuickBooks Online that you aren't trying to export to. 2. Sync your QuickBooks Online connection in Settings > Workspaces > [workspace name] > Connections. 3. Open the report and click the **Export to** button and then the **QuickBooks Online** option. @@ -160,13 +160,13 @@ If this still fails, you'll need to confirm that the A/P account selected in Exp 1. Navigate to Settings > Workspaces > [workspace name] > Connections. 2. Under the Exports tab check that both A/P accounts are the correct currency. -# Why are company card expenses exporting to the wrong account in QuickBooks Online? +# Why are company card expenses exported to the wrong account in QuickBooks Online? Multiple factors could be causing your company card transactions to export to the wrong place in your accounting system, but the best place to start is always the same. 1. First, confirm that the company cards have been mapped to the correct accounts in Settings > Domains > Company Cards > click the **Edit Export button** for the card to view the account. -2. Next, confirm the expenses in question have been imported from the company card? - - Only expenses that have the Card+Lock icon next to them will export according to the mapping settings that you configure in the domain settings. +2. Next, confirm the expenses in question have been imported from the company card. + - Only expenses with the Card+Lock icon next to them will export according to the mapping settings that you configure in the domain settings. It’s important to note that expenses imported from a card linked at the individual account level, expenses created from a SmartScanned receipt, and manually created cash expenses will export to the default bank account selected in your connection's configuration settings. @@ -174,7 +174,7 @@ It’s important to note that expenses imported from a card linked at the indivi The user exporting the report must be a domain admin. You can check the history and comment section at the bottom of the report to see who exported the report. -If your reports are being exported automatically by Concierge, the user listed as the Preferred Exporter under Settings > Workspaces > [workspaces name] > Connections > click **Configure** must be a domain admin as well. +If your reports are being exported automatically by Concierge, the user listed as the Preferred Exporter under Settings > Workspaces > [workspace name] > Connections > click **Configure** must also be a domain admin. If the report exporter is not a domain admin, all company card expenses will export to the bank account set in Settings > Workspaces > [workspace name] > Connections > click **Configure** for non-reimbursable expenses. diff --git a/docs/articles/expensify-classic/domains/SAML-SSO.md b/docs/articles/expensify-classic/domains/SAML-SSO.md index e4b27b238e46..a6032afe8d24 100644 --- a/docs/articles/expensify-classic/domains/SAML-SSO.md +++ b/docs/articles/expensify-classic/domains/SAML-SSO.md @@ -2,18 +2,20 @@ title: Managing Single Sign-On (SSO) and User Authentication in Expensify description: Learn how to effectively manage Single Sign-On (SSO) and user authentication in Expensify alongside your preferred SSO provider. Our comprehensive guide covers SSO setup, domain verification, and specific instructions for popular providers like AWS, Okta, and Microsoft Azure. Streamline user access and enhance security with Expensify's SAML-based SSO integration. --- -# Overview -This article provides a comprehensive guide on managing Single Sign-On (SSO) and user authentication in Expensify alongside your preferred SSO provider. Expensify uses SAML to enable and manage SSO between Expensify and your SSO provider. -# How to Use SSO in Expensify -Before setting up Single Sign-On with Expensify you will need to make sure your domain has been verified. Once the domain is verified, you can access the SSO settings by navigating to Settings > Domains > [Domain Name] > SAML. -On this page, you can: +# Using SSO in Expensify +Before setting up Single Sign-On with Expensify you will need to make sure the [domain is verified](https://help.expensify.com/articles/expensify-classic/domains/Claim-And-Verify-A-Domain#step-2-verify-domain-ownership). + +Once the domain is verified, you can access the SSO settings by navigating to Settings > Domains > [Domain Name] > SAML. + +## The Domains page +**On this page, you can:** - Get Expensify's Service Provider MetaData. You will need to give this to your identity provider. - Enter your Identity Provider MetaData. Please contact your SAML SSO provider if you are unsure how to get this. - Choose whether you want to make SAML SSO required for login. If you choose this option, members will only be able to log in to Expensify via SAML SSO. -Instructions for setting up Expensify for specific SSO providers can be found below. If you do not see your provider listed below, please contact them and request instructions. + +**Below are instructions for setting up Expensify for specific SSO providers:** - [Amazon Web Services (AWS SSO)](https://static.global.sso.amazonaws.com/app-202a715cb67cddd9/instructions/index.htm) -- [Bitium](https://support.bitium.com/administration/saml-expensify/) - [Google SAML](https://support.google.com/a/answer/7371682) (for GSuite, not Google SSO) - [Microsoft Azure Active Directory](https://azure.microsoft.com/en-us/documentation/articles/active-directory-saas-expensify-tutorial/) - [Okta](https://saml-doc.okta.com/SAML_Docs/How-to-Configure-SAML-2.0-for-Expensify.html) @@ -22,22 +24,39 @@ Instructions for setting up Expensify for specific SSO providers can be found be - [SAASPASS](https://saaspass.com/saaspass/expensify-two-factor-authentication-2fa-single-sign-on-sso-saml.html) - Microsoft Active Directory Federation Services (see instructions in the FAQ section below) -When SSO is enabled, employees will be prompted to sign in through Single Sign-On when using their company email (private domain email) and also a public email (e.g. gmail.com) linked as a secondary login. +If your provider is not listed, please contact them and request instructions. + +When SSO is enabled, employees will be prompted to sign in through Single Sign-On when using their company email (private domain email) and also a public email (e.g. gmail.com) linked as a [Secondary Login](https://help.expensify.com/articles/expensify-classic/settings/Change-or-add-email-address). + +{% include faq-begin.md %} + +## What should I do if I’m getting an error when trying to set up SSO? +You can double-check your configuration data for errors using samltool.com. If you’re still having issues, you can contact your Account Manager or Concierge for assistance. + +## What is the EntityID for Expensify? +The entityID for Expensify is https://expensify.com. Remember not to copy and paste any extra slashes or spaces. If you've enabled the Multi-Domain support (see below) then your entityID will be https://expensify.com/mydomainname.com. + +## Can you have multiple domains with only one entity ID? +Yes. Please send a message to the Concierge or your account manager, and we will enable the use of the same entity ID with multiple domains. ## How can I update the Microsoft Azure SSO Certificate? -Expensify's SAML configuration doesn't support multiple active certificates. This means that if you create the new certification ahead of time without first removing the old one, the respective IdP will include two unique x509 certificates instead of one and the connection will break. Should you need to access Expensify, switching back to the old certificate will continue to allow access while that certificate is still valid. +Expensify's SAML configuration doesn't support multiple active certificates. This means that if you create the new certification ahead of time without first removing the old one, the respective IDP will include two unique x509 certificates instead of one, and the connection will break. Should you need to access Expensify, switching back to the old certificate will continue to allow access while that certificate is still valid. -To transfer from one Microsoft Azure certificate to another, please follow the below steps: -1. In Azure Directory , create your new certificate. +**To transfer from one Microsoft Azure certificate to another, please follow the below steps:** +1. In Azure Directory, create your new certificate. 2. In Azure Director, remove the old, expiring certificate. -3. In Azure Directory, activate the remaining certificate, and get a new IdP for Expensify from it. -4. In Expensify, replace the previous IdP with the new IdP. -5. Log in via SSO. If login continues to fails, write into Concierge for assistance. +3. In Azure Directory, activate the remaining certificate and get a new IDP for Expensify from it. +4. In Expensify, replace the previous IDP with the new IDP. +5. Log in via SSO. If login continues to fail, write to Concierge for assistance. -## How can I enable deactivating users with the Okta SSO integration? -Companies using Okta can deactivate users in Expensify using the Okta SCIM API. This means that when a user is deactivated in Okta their access to Expensify will expire and they will be logged out of both the web and mobile apps. Deactivating a user through Okta will not close their account in Expensify, if you are offboarding this employee, you will still want to close the account. You will need have a verified domain and SAML fully setup before completing setting up the deactivation feature. +## How can I enable "deactivating users" with the Okta SSO integration? +Companies using Okta can deactivate users in Expensify using the Okta SCIM API: +- When a user is deactivated in Okta, their access to Expensify expires, and they are logged out of both the web and mobile apps. +- Deactivating a user through Okta will not close their account in Expensify +- If you are offboarding this employee, you will still want to close the account. +- A verified domain and a complete SAML setup are required before you can configure the deactivation feature. -To enable deactivating users in Okta, follow these steps: +**To enable deactivating users in Okta, follow these steps:** 1. In Expensify, head to *Settings > Domains > _[Domain Name]_ > SAML* 2. Ensure that the toggle is set to Enabled for *SAML Login* and *Required for login* 3. In Okta, go to *Admin > Applications > Add Application* @@ -49,18 +68,18 @@ To enable deactivating users in Okta, follow these steps: 9. Then, go to *Directory > Profile Editor > Okta user > Profile* 10. Click the information bubble to the right of the *First name* and *Last name* attributes 11. Uncheck *Yes* under *Attribute required* field and press *Save Attribute*. -12. Email concierge@expensify.com providing your domain and request that Okta SCIM be enabled. You will receive a response when this step has been completed. +12. Email concierge@expensify.com, providing your domain, and request that Okta SCIM be enabled. You will receive a response when this step has been completed. 13. In Expensify, go to *Domains > _[Domain Name]_ > SAML > Show Token* and copy the Okta SCIM Token you received. 14. In Okta, go to *Admin > Applications > Expensify > Provisioning > API Integration > Configure API Integration* -15. Select Enable API Integration and paste the Okta SCIM Token in API Token field and then click Save. -15. Go to To App, click Edit Provisioning Users, select Enable Deactivate Users and then Save. (You may also need to set up the Expensify Attribute Mappings if you have not previously in steps 9-11). +15. Select Enable API Integration, paste the Okta SCIM Token in the API Token field, and then click Save. +15. Go to To App, click Edit Provisioning Users, select Enable Deactivate Users, and then Save. (You may also need to set up the Expensify Attribute Mappings if you have not previously in steps 9-11). Successful activation of this function will be indicated by the green Push User Deactivation icon being enabled at the top of the app page. -## How can I set up SAML authentication with Microsoft ADFS? -Before getting started, you will need to have a verified domain and Control plan in order to set up SSO with Microsoft ADFS. +## How do I set up the SAML authentication with Microsoft ADFS? +Before getting started, you will need a verified domain and Control plan to set up SSO with Microsoft ADFS. -To enable SSO with Microsoft ADFS follow these steps: +**To enable SSO with Microsoft ADFS follow these steps:** 1. Open the ADFS management console, and click the *Add Relying Party Trust* link on the right. 2. Check the option to *Import data about the relying party from a file*, then click the *Browse* button. You will input the XML file of Expensify’s metadata which can be found on the Expensify SAML setup page. 3. The metadata file will provide the critical information that ADFS needs to set up the trust. In ADFS, give it a name, and click Next. @@ -69,22 +88,10 @@ To enable SSO with Microsoft ADFS follow these steps: 6. The new trust is now created. Highlight the trust, then click *Edit claim rules* on the right. 7. Click *Add a Rule*. 8. The default option should be *Send LDAP Attributes as Claims*. Click Next. -9. Depending upon how your Active Directory is set up, you may or may not have a useful email address associated with each user, or you may have a policy to use the UPN as the user attribute for authentication. If so, using the UPN user attribute may be appropriate for you. If not, you can use the emailaddress attribute. +9. Depending upon how your Active Directory is set up, you may or may not have a useful email address associated with each user, or you may have a policy to use the UPN as the user attribute for authentication. If so, using the UPN user attribute may be appropriate for you. If not, you can use the email address attribute. 10. Give the rule a name like *Get email address from AD*. Choose Active Directory as the attribute store from the dropdown list. Choose your source user attribute to pass to Expensify that has users’ email address info in it, usually either *E-Mail-Address* or *User-Principal-Name*. Select the outgoing claim type as “E-Mail Address”. Click OK. 11. Add another rule; this time, we want to *Transform an Incoming Claim*. Click Next. 12. Name the rule *Send email address*. The Incoming claim type should be *E-Mail Address*. The outgoing claim type should be *Name ID*, and the outgoing name ID format should be *Email*. Click OK. 13. You should now have two claim rules. -Assuming you’ve also set up Expensify SAML configuration with your metadata, SAML logins on Expensify.com should now work. For reference, ADFS’ default metadata path is: https://yourservicename.yourdomainname.com/FederationMetadata/2007-06/FederationMetadata.xml. - -{% include faq-begin.md %} -## What should I do if I’m getting an error when trying to set up SSO? -You can double check your configuration data for errors using samltool.com. If you’re still having issues, you can reach out to your Account Manager or contact Concierge for assistance. - -## What is the EntityID for Expensify? -The entityID for Expensify is https://expensify.com. Remember not to copy and paste any extra slashes or spaces. If you've enabled the Multi-Domain support (see below) then your entityID will be https://expensify.com/mydomainname.com. - -## Can you have multiple domains with only one entityID? -Yes. Please send a message to Concierge or your account manager and we will enable the ability to use the same entityID with multiple domains. - {% include faq-end.md %} diff --git a/docs/articles/expensify-classic/expenses/Add-Invoices-in-Bulk.md b/docs/articles/expensify-classic/expenses/Add-Invoices-in-Bulk.md new file mode 100644 index 000000000000..6257c1e6d84d --- /dev/null +++ b/docs/articles/expensify-classic/expenses/Add-Invoices-in-Bulk.md @@ -0,0 +1,48 @@ +--- +title: Bulk Upload Invoices +description: How to Bulk Upload Invoices +--- + +Expensify offers importing multiple invoices (bulk import) via CSV to save you from manually creating individual invoices. + +## Uploading Invoices into Expensify + +1. Click the **Reports** tab. +2. Click the **New Report** drop-down. +3. Select **Bulk Import Invoices**. +4. Click the sample CSV link to download your custom CSV template to your browser or computer. +5. Add the invoice details following the formatting rules (see below **CSV formatting guide** section) +6. Click **Upload CSV** + +## CSV formatting guide + +- Send to: recipient's email address (ex: john.smith@companydomain.com) +- Share: email address (ex: julie.clarke@companydomain.com) +- Report Name: this will be the name of the Invoice report +- Merchant: business name of invoice sender +- Amount: use the number format in this column. Negative amounts cannot be invoiced. +- Date: YYYY-MM-DD formatting +- Due Date: YYYY-MM-DD formatting + +## After the Invoices are uploaded + +- After you click **Upload**, the invoices will automatically be created and viewable on the **Reports** page. +- The **Send To** contact will get an email notifying them of the invoice you sent. +- You can manually edit the invoice details. +- You can manually upload a PDF of the invoice to the report. + +{% include faq-begin.md %} + +## Are there any fees associated with Invoices in Expensify? +No, Invoices are part of the [Control Plan](https://help.expensify.com/articles/expensify-classic/expensify-billing/Change-Plan-Or-Subscription#change-group-plan). + +## Can Invoices be revised once they are sent? +If you sent an invoice by mistake, you can click **Undo Send** on the invoice to revoke it. If you’d like to add more details to a sent invoice, you can add those as a [Report comment](https://help.expensify.com/articles/expensify-classic/reports/Add-comments-and-attachments-to-a-report) for everyone to view. + +## How do I communicate with the payor +You can communicate with the payor through [Report comments](https://help.expensify.com/articles/expensify-classic/reports/Add-comments-and-attachments-to-a-report). + +## What’s the difference between an Invoice and an Expense Report in Expensify? +An invoice is an expense submitted to a client or contractor for payment. An expense report is an expense or group of expenses submitted to an employer for reimbursement. + +{% include faq-end.md %} diff --git a/docs/articles/expensify-classic/expenses/Send-and-Receive-Payment-for-Invoices.md b/docs/articles/expensify-classic/expenses/Send-and-Receive-Payment-for-Invoices.md new file mode 100644 index 000000000000..c2ebb64b0af6 --- /dev/null +++ b/docs/articles/expensify-classic/expenses/Send-and-Receive-Payment-for-Invoices.md @@ -0,0 +1,39 @@ +--- +title: Send and Receive Payment for Invoices +description: How to Send and Receive Payments for Invoices +--- + +Simplify your back office by sending invoices to vendors and suppliers in Expensify. +Invoices can be sent to anyone with or without an Expensify account and paid directly to your business bank account through Expensify. + +## How to send an invoice in Expensify + +1. Sign in to your [Expensify web account](www.expensify.com) +2. Customize your company invoices following the steps in this [help article](https://help.expensify.com/articles/expensify-classic/workspaces/Set-Up-Invoicing). (Optional) +3. From the **Reports** page, click the drop-down and select **Invoice**. +4. Upload a PDF/image of the invoice. +5. Add applicable tags and categories based on your workspace settings. +6. Click **Send**. + +## How to Receive an Invoice Payment in Expensify + +1. To use Expensify payments, you must have a [business bank account connected to your Expensify account](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account). +2. Ensure the payment details are on the invoice sent to the payor. +3. The payor will receive a notification of the submitted invoice. +4. They will have the option to pay the invoice through Expensify. + +{% include faq-begin.md %} + +## Are there any fees associated with Invoices in Expensify? +No, Invoices are part of the [Control Plan](https://help.expensify.com/articles/expensify-classic/expensify-billing/Change-Plan-Or-Subscription#change-group-plan). + +## Can Invoices be revised once they are sent? +If you sent an invoice by mistake, you can click **Undo Send** on the invoice to revoke it. If you’d like to add more details to a sent invoice, you can add those as a [Report comment](https://help.expensify.com/articles/expensify-classic/reports/Add-comments-and-attachments-to-a-report) for everyone to view. + +## How do I communicate with the payor +You can communicate with the payor through [Report comments](https://help.expensify.com/articles/expensify-classic/reports/Add-comments-and-attachments-to-a-report). + +## What’s the difference between an Invoice and an Expense Report in Expensify? +An invoice is an expense submitted to a client or contractor for payment. An expense report is an expense or group of expenses submitted to an employer for reimbursement. + +{% include faq-end.md %} diff --git a/docs/articles/expensify-classic/expenses/Trips.md b/docs/articles/expensify-classic/expenses/Trips.md index 04f95c96eb44..1c84cd9189f7 100644 --- a/docs/articles/expensify-classic/expenses/Trips.md +++ b/docs/articles/expensify-classic/expenses/Trips.md @@ -2,38 +2,35 @@ title: Trips description: Automate getting paid back for your travel through Expensify's Trips feature. --- -# Overview -Discover how Expensify streamlines your travel expense management when it comes to trips. With the automatic classification of trip receipts and real-time notifications for travel changes, you can effortlessly stay organized and informed on all your trips. - -When a travel receipt/itinerary is uploaded into Expensify and SmartScanned, the Trips section of the mobile app will automatically populate your trip information.. If your flight has any cancellations, unexpected changes, or delays, we will make sure you know about it. We will notify you of the change as soon as it happens via the mobile app. +When a travel receipt or itinerary is uploaded to Expensify via SmartScan, the Trips section of the mobile app automatically populates your trip information. If your flight has any cancellations, unexpected changes, or delays, we will notify you of them as soon as they occur via the mobile app. For the receipt to be processed as a Trip, it must include the total amount of the expense, date, and merchant name. If your company is using a travel integration from the list shown below, you can automate this process entirely: - [TravelPerk](https://help.expensify.com/articles/expensify-classic/integrations/travel-integrations/TravelPerk) - [Egencia](https://help.expensify.com/articles/expensify-classic/integrations/travel-integrations/Egencia) -- [Navan](https://help.expensify.com/articles/expensify-classic/integrations/travel-integrations/Trip-Actions) +- [Navan](https://help.expensify.com/articles/expensify-classic/connections/Navan) -# How to add a Trip to your account +# Add a Trip to your account -Trip receipts are typically sent via email, and will include multiple pages. With that in mind, we recommend emailing receipts directly to Expensify for ease. +Trip receipts are typically sent via email and will include multiple pages. For ease, we recommend emailing receipts directly to Expensify. -To email a flight or hotel receipt, you’ll forward the receipt from your Expensify-associated email address to receipts@expensify.com. +To email a flight or hotel receipt, simply forward the receipt from your Expensify-associated email address to receipts@expensify.com. -# How to access your Trip information +# Access your Trip information To view details about your past or upcoming trips, follow these steps within the Expensify mobile app: 1. Open the Expensify mobile app -2. Navigate to the "Menu" option (top left ≡ icon) +2. Navigate to the **Menu** option (top left ≡ icon) 3. Select **Trips** {% include faq-begin.md %} ## How do I capture Trip receipts sent to my personal email address? -If you received your receipt in an email that is not associated with your Expensify account, you can add this email as a [secondary login](https://help.expensify.com/articles/expensify-classic/account-settings/Account-Details#how-to-add-a-secondary-login) to directly forward the receipt into your account. +If you received your receipt in an email that is not associated with your Expensify account, you can add this email as a [secondary login](https://help.expensify.com/articles/expensify-classic/settings/Change-or-add-email-address) to directly forward the receipt into your account. ## How do I upload Trip receipts that were not sent to me by email? -If your trip receipt was not sent to you by email, you can manually upload the receipt to your account. Check out this resource for more information on [manually uploading receipts](https://help.expensify.com/articles/expensify-classic/expenses/expenses/Upload-Receipts#manually-upload). +If your trip receipt was not sent to you by email, you can manually upload the receipt to your account. Check out this resource for more information on [manually creating expenses](https://help.expensify.com/articles/expensify-classic/expenses/Add-an-expense#add-an-expense-manually). {% include faq-end.md %} diff --git a/docs/articles/expensify-classic/expensify-billing/Consolidated-Domain-Billing.md b/docs/articles/expensify-classic/expensify-billing/Consolidated-Domain-Billing.md index 2e829c0785d3..671d0c41e772 100644 --- a/docs/articles/expensify-classic/expensify-billing/Consolidated-Domain-Billing.md +++ b/docs/articles/expensify-classic/expensify-billing/Consolidated-Domain-Billing.md @@ -16,9 +16,12 @@ When a Domain Admin enables Consolidated Domain Billing, all Group workspaces ow If you don’t have multiple billing owners across your organization, or if you want to keep billing separate for any reason, then this feature isn’t necessary. If you have an Annual Subscription and enable Consolidated Domain Billing, the Consolidated Domain Billing feature will gather the amounts due for each Group workspace Billing Owner (listed under **Settings > Workspaces > Group**). To make full use of the Annual Subscription for all workspaces in your domain, you should also be the billing owner for all Group workspaces. + {% include faq-begin.md %} + ## How do I take over the billing of a workspace with Consolidated Domain Billing enabled? You’ll have to toggle off Consolidated Domain Billing, take over ownership of the workspace, and then toggle it back on. + ## Can I use Consolidated Domain Billing to cover the bill for some workspaces, but not others? No, this feature means that you’ll be paying the bill for all domain members who choose a subscription. diff --git a/docs/articles/expensify-classic/expensify-billing/Receipt-Breakdown.md b/docs/articles/expensify-classic/expensify-billing/Receipt-Breakdown.md index 21e2db5604f8..8f512fb71512 100644 --- a/docs/articles/expensify-classic/expensify-billing/Receipt-Breakdown.md +++ b/docs/articles/expensify-classic/expensify-billing/Receipt-Breakdown.md @@ -2,46 +2,36 @@ title: Receipts Breakdown description: This article goes over the Expensify receipt for billing owners. --- +**Your receipt is broken up into the following sections:** +- A high-level summary of your total Expensify bill +- Ways to reduce your bill and get paid to use Expensify +- A billing breakdown that covers all activity and discounts +- An activity breakdown by workspace -# Overview -This article will give you (the billing owner) a detailed breakdown of your Expensify bill. +## A high-level summary -Your receipt is broken up into multiple sections that include: -1. A high-level summary of your total Expensify bill -2. Ways to reduce your bill and get paid to use Expensify -3. A billing breakdown that covers all activity and discounts -4. An activity breakdown by workspace +- The top section will show the total amount you paid as the billing owner of Expensify Workspaces and give you a breakdown of the price per member. +- Every member of your workspace(s) can store data, review data, and access free features like Expensify Chat. +- We show the total price and then calculate the price per member by using the number of members across all of the workspaces you own. +- Further down in the receipt, there's a breakdown of the members who generated billable activity. -## How-to understand the high-level summary -The top section will show the total amount you paid as the billing owner of Expensify workspaces and give you a breakdown of price per member. Every member of your workspace(s) gets to store data, review data, and access free features like Expensify Chat. Thus, we show the total price and then use all of the members across all of the workspaces you own to calculate the price per member. Further down in the receipt, and in this article, we break down the members who generated billable activity. - -## How-to reduce your bill and get paid to use Expensify +## Reduce your bill and get paid to use Expensify Chances are you can actually get paid to use Expensify with the Expensify Card. In this section of the receipt, we outline how much money you're leaving on the table by not using the Expensify Card. You can click `Get started` to connect with your account manager (if you have one) or Concierge, both of whom can help get you started with the card. _Note: Currently, we offer Expensify Cards to companies with US bank accounts._ -## How-to understand your billing breakdown +## The billing breakdown Your receipt will have a detailed breakdown of activity and discounts across all workspaces. Here's a description of items that may appear on your bill: -- [Number of] Inactive workspace members @ $0.00 - - All inactive members from any of your workspaces. -- [Number of] Chat-only members @ $0.00 - - Any workspace members who chatted but didn't generate any other billable activity. Learn more about [chatting for free.](https://help.expensify.com/articles/new-expensify/chat/Introducing-Expensify-Chat) -- [Number of] Annual Control members @ $18.00 - - Any members included in your annual subscription on the Control plan. -- [Number of] Pay-per-use Control members @ $36.00 - - Any members above your annual subscription size on the Control plan. They're billed at the pay-per-use rate. -- [Number of] Annual Collect members @ $10.00 - - Any members included in your annual subscription on the Collect plan. -- [Number of] Pay-per-use Collect members @ $20.00 - - Any members above your annual subscription size on the Collect plan. These members are billed at the pay-per-use rate. -- X% Expensify Card discount with $Y spend - - The % discount you're getting based on total settled US purchases across your Expensify Cards. -- X% Expensify Card cash back credit for $Y spend - - The amount of cash back you've earned based on total settled US purchases across your Expensify Cards. -- 50% ExpensifyApproved! partner discount - - If you're part of an accounting firm, you get an additional discount for being our partner. [Learn more about our ExpensifyApproved! accountants program.](https://use.expensify.com/accountants-program) -- Total - - Sum of all the line items above. +- **[Number of] Inactive workspace members @ $0.00:** All inactive members from any of your workspaces. +- **[Number of] Chat-only members @ $0.00:** Any workspace members who chatted but didn't generate any other billable activity. Learn more about [chatting for free.](https://help.expensify.com/new-expensify/hubs/chat/) +- **[Number of] Annual Control members @ $18.00:** Any members included in your annual subscription on the Control plan. +- **[Number of] Pay-per-use Control members @ $36.00:** Any members above your annual subscription size on the Control plan. They're billed at the pay-per-use rate. +- **[Number of] Annual Collect members @ $10.00:** Any members included in your annual subscription on the Collect plan. +- **[Number of] Pay-per-use Collect members @ $20.00:** Any members above your annual subscription size on the Collect plan. These members are billed at the pay-per-use rate. +- **X% Expensify Card discount with $Y spend:** The % discount you're getting based on total settled US purchases across your Expensify Cards. +- **X% Expensify Card cash back credit for $Y spend:** The amount of cash back you've earned based on total settled US purchases across your Expensify Cards. +- **50% ExpensifyApproved! partner discount:** If you're part of an accounting firm, you get an additional discount for being our partner -- learn more about our ExpensifyApproved! accountant program [here](https://use.expensify.com/accountants-program). +- **Total:** The sum of all the line items above. -## How-to understand your activity breakdown +## The activity breakdown This section will list all of your workspaces alongside their IDs and break down the billing for each of them. diff --git a/docs/articles/expensify-classic/expensify-card/Unlimited-Virtual-Cards.md b/docs/articles/expensify-classic/expensify-card/Unlimited-Virtual-Cards.md index fdbc178737e1..5b0f0c1c2879 100644 --- a/docs/articles/expensify-classic/expensify-card/Unlimited-Virtual-Cards.md +++ b/docs/articles/expensify-classic/expensify-card/Unlimited-Virtual-Cards.md @@ -9,7 +9,7 @@ For admins to issue virtual cards, your company **must upgrade to Expensify’s Once upgraded to the new Expensify Card, admins can issue an unlimited number of virtual cards with a fixed or monthly limit for specific company purchases or recurring subscription payments _(e.g., Marketing purchases, Advertising, Travel, Amazon Web Services, etc.)._ -This feature supports businesses that require tighter controls on company spending, allowing customers to set fixed or monthly spending limits for each virtual card. +This feature supports businesses that require tighter controls on company spending. Customers can set fixed or monthly spending limits for each virtual card. Use virtual cards if your company needs or wants: @@ -20,7 +20,7 @@ Use virtual cards if your company needs or wants: Admins can also name each virtual card, making it easy to categorize and assign them to specific accounts upon creation. Naming the card ensures a clear and organized overview of expenses within the Expensify platform. -# How to set up virtual cards +# Set up virtual cards After adopting the new Expensify Card, domain admins can issue virtual cards to any employee using an email matching your domain. Once created and assigned, the card will be visible under the name given to the card. @@ -36,7 +36,7 @@ Head to **Settings** > **Domains** > [**Company Cards**](https://www.expensify.c ![The Issue Virtual Cards modal is open in the middle of the screen. There are four options to set; Card Name, Assignee, Card Limit, and Limit type. A cancel (left) and save (right) button are at the bottom right of the modal.]({{site.url}}/assets/images/AdminissuedVirtualCards.png){:width="100%"} -# How to edit virtual cards +# Edit virtual cards Domain admin can update the details of a virtual card on the [Company Cards](https://www.expensify.com/domain_companycards) page. @@ -46,7 +46,7 @@ Domain admin can update the details of a virtual card on the [Company Cards](htt 2. Change the editable details. 3. Click **Edit Card** to save the changes. -# How to terminate a virtual card +# Terminate a virtual card Domain admin can also terminate a virtual card on the [Company Cards](https://www.expensify.com/domain_companycards) page by setting the limit to $0. @@ -59,30 +59,29 @@ Domain admin can also terminate a virtual card on the [Company Cards](https://ww {% include faq-begin.md %} -**What is the difference between a fixed limit and a monthly limit?** +## What is the difference between a fixed limit and a monthly limit? There are two different limit types that are best suited for their intended purpose. - -- _Fixed limit_ spend cards are ideal for one-time expenses or providing employees access to a card for a designated purchase. +- _Fixed-limit_ spend cards are ideal for one-time expenses or providing employees with access to a card for a designated purchase. - _Monthly_ limit spend cards are perfect for managing recurring expenses such as subscriptions and memberships. A virtual card with either of these limit types doesn't share its limit with any other cards, including the cardholder's smart limit cards. -**Where can employees see their virtual cards?** +## Where can employees see their virtual cards? Employees can see their assigned virtual cards by navigating to **Settings** > **Account** > [**Credit Cards Import**](https://www.expensify.com/settings?param=%7B%22section%22:%22creditcards%22%7D) in their account. -On this page, employees can see the remaining card limit, the type of card it is (i.e., fixed or monthly), and view the name given to the card. +On this page, employees can see the remaining card limit, the type of card (e.g., fixed or monthly), and the name given to the card. When the employee needs to use the card, they’ll click the **Show Details** button to expose the card details for making purchases. _Note: If the employee doesn’t have Two-Factor Authentication (2FA) enabled when they display the card details, they’ll be prompted to enable it. Enabling 2FA for their account provides the best protection from fraud and is **required** to dispute virtual card expenses._ -**What do I do when there is fraud on one of our virtual cards?** +## What do I do when there is fraud on one of our virtual cards? -If you or an employee loses their virtual card, experiences fraud, or suspects the card details are no longer secure, please [request a new card](https://help.expensify.com/articles/expensify-classic/expensify-card/Dispute-A-Transaction) immediately. A domain admin can also set the limit for the card to $0 to terminate the specific card immediately if the employee cannot take action. +If you or an employee loses their virtual card, experiences fraud, or suspects the card details are no longer secure, please [request a new card](https://help.expensify.com/articles/expensify-classic/expensify-card/Request-the-Card) immediately. A domain admin can also set the limit for the card to $0 to terminate the specific card immediately if the employee cannot take action. -When the employee requests a new card, the compromised card will be terminated immediately. This is best practice for any Expensify Card and if fraud is suspected, action should be taken as soon as possible to reduce financial impact on the company. +When the employee requests a new card, the compromised card will be terminated immediately. This is best practice for any Expensify Card, and if fraud is suspected, action should be taken as soon as possible to reduce the company's financial impact. {% include faq-end.md %} diff --git a/docs/articles/expensify-classic/expensify-partner-program/Card-Revenue-Share.md b/docs/articles/expensify-classic/expensify-partner-program/Card-Revenue-Share.md index b6c3bc0904c0..663a5e3cd9c8 100644 --- a/docs/articles/expensify-classic/expensify-partner-program/Card-Revenue-Share.md +++ b/docs/articles/expensify-classic/expensify-partner-program/Card-Revenue-Share.md @@ -2,26 +2,23 @@ title: Expensify Card revenue share for ExpensifyApproved! partners description: Earn money when your clients adopt the Expensify Card --- -# Overview You can now earn additional income for your firm every time your client uses their Expensify Card. In short, your firm gets 0.5% of your clients’ total Expensify Card spend as cash back. The more your clients spend, the more cashback your firm receives! This program is currently only available to US-based ExpensifyApproved! partner accountants. -# Become a domain admin -To benefit from this program, you or a member of your firm must be a domain admin on your client’s domain in Expensify. +# Become a Domain Admin +To benefit from this program, you or a member of your firm must be a domain admin on the client’s domain in Expensify: 1. Head to *Settings > Domains* -2. Click the name of your client's domain +2. Click the client's domain + - If you can click on the domain and access the domain settings, you are a Domain Admin + - If you’re not a Domain Admin, your client can add you as one by heading to **Settings > Domains > [Client's Domain] > Domain Admins > Add Admin**. -If you can click into the domain and access the domain settings, that means you are a domain admin. +_**Note:** You can view all domain admins under Settings > Domains > [Client's Domain] > Domain Admins._ -Note: You can view all domain admins under *Settings > Domains > [Client's domain name] > Domain Admins*. +# Connect a deposit-only business bank account +[Follow these instructions](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/bank-accounts/Connect-US-Business-Bank-Account#connect-a-business-deposit-only-account) to connect a deposit-only business bank account. -If you’re not a domain admin, your client can add you as one by heading to **Settings > Domains > [Client's domain name] > Domain Admins > Add admin**. - -# Connect a deposit account -Next, connect a deposit-only business bank account. Any revenue earned will be deposited directly into that account. - -Instructions to connect a deposit-only business bank account are [here](https://help.expensify.com/articles/expensify-classic/bank-accounts-and-credit-cards/deposit-accounts/Deposit-Accounts-USD#how-to-connect-a-business-deposit-only-bank-account). +Once that's complete, any revenue earned will be deposited directly into that bank account. {% include faq-begin.md %} diff --git a/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-Small-To-Medium-Sized-Businesses.md b/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-Small-To-Medium-Sized-Businesses.md index 411cc64eda7f..fc457c1d6f7f 100644 --- a/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-Small-To-Medium-Sized-Businesses.md +++ b/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-Small-To-Medium-Sized-Businesses.md @@ -9,7 +9,7 @@ This guide provides practical tips and recommendations for small businesses with - See our [US-based VC-Backed Startups](https://help.expensify.com/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-US-Based-VC-Backed-Startups) if you are more concerned with top-line revenue growth # Who you are -As a small to medium-sized business owner, your main aim is to achieve success and grow your business. To achieve your goals, it is crucial that you make worthwhile investments in both your workforce and your business processes. This means providing your employees with the resources they need to generate revenue effectively, while also adopting measures to guarantee that expenses are compliant. +As a small—to medium-sized business owner, your main aim is to achieve success and grow your business. To achieve your goals, it is crucial that you make worthwhile investments in your workforce and your business processes. This means providing your employees with the resources they need to generate revenue effectively while also adopting measures to guarantee that expenses are compliant. # Step-by-step instructions for setting up Expensify This playbook is built on best practices we’ve developed after processing expenses for tens of thousands of companies around the world. As such, use this playbook as your starting point, knowing that you can customize Expensify to suit your business needs. Every company is different, and your dedicated Setup Specialist is always one chat away with any questions you may have. @@ -26,7 +26,7 @@ If you don't already have one, go to *[new.expensify.com](https://new.expensify. There are three workspace types, but for your small business needs we recommend the *Control Plan* for the following reasons: - *The Control Plan* is designed for organizations with a high volume of employee expense submissions, who also rely on compliance controls -- The ease of use and mobile-first design of the Control plan can increase employee adoption and participation, leading to better expense tracking and management. +The Control plan's ease of use and mobile-first design can increase employee adoption and participation, leading to better expense tracking and management. - The plan integrates with a variety of tools, including accounting software and payroll systems, providing a seamless and integrated experience - Accounting integrations include QuickBooks Online, Xero, NetSuite, and Sage Intacct, with indirect support from Microsoft Dynamics and any other accounting solution you work with @@ -38,14 +38,14 @@ To create your Control Workspace: 2. Select *Group* and click the button that says *New Workspace* 3. Click *Select* under Control -The Control Plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your workspace's *#admins* room in *[new.expensify.com](https://new.expensify.com)*, and in your company’s workspace settings in the *Overview* tab, where you can chat with them and schedule an onboarding call to walk through any setup questions. The Control Plan bundled with the Expensify Visa® Commercial Card is only *$9 per user per month* (not taking into account cash back your earn) when you commit annually. Adopting the Expensify Card with an Annual Subscription gives a 75% discount off the unbundled price. +The Control Plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your workspace's *#admins* room in *[new.expensify.com](https://new.expensify.com)*, and in your company’s workspace settings in the *Overview* tab, where you can chat with them and schedule an onboarding call to walk through any setup questions. The Control Plan bundled with the Expensify Visa® Commercial Card is only *$9 per user per month* (not taking into account cash back you earn) when you commit annually. Adopting the Expensify Card with an Annual Subscription gives a 75% discount off the unbundled price. ## Step 3: Connect your accounting system -As a small to medium-sized business, it's important to maintain proper spend management to ensure the success and stability of your organization. This requires paying close attention to your expenses, streamlining your financial processes, and making sure that your financial information is accurate, compliant, and transparent. Include best practices such as: +As a small to medium-sized business, it's important to maintain proper spending management to ensure the success and stability of your organization. This requires paying close attention to your expenses, streamlining your financial processes, and making sure that your financial information is accurate, compliant, and transparent. Include best practices such as: - Every purchase is categorized into the correct account in your chart of accounts - Receipts are sent to the accounting package to ensure visibility across the organization and to auditors -- Every expense is accounted for and added to your accounting system on time for your monthly accounts reconciliation. +- Every expense is accounted for and added to your accounting system on time for the reconciliation of your monthly accounts. You do this by synchronizing Expensify and your accounting package as follows: @@ -68,53 +68,53 @@ Check out the links below for more information on how to connect to your account ## Step 4: Set category-specific compliance controls Head over to the *Categories* tab to set compliance controls on your newly imported list of categories. More specifically, we recommend the following: -1. First, enable *People Must Categorize Expenses*. Employees must select a category for each expense, otherwise, in most cases, it’s more work on you and our accounting connections will simply reject any attempt to export. +1. First, enable *People Must Categorize Expenses*. Employees must select a category for each expense; otherwise, it’s more work for you, and our accounting connections will simply reject any attempt to export. 2. For more high-risk, travel-related categories, we recommend setting more strict compliance controls. For example, “Meals & Entertainment” should be set with the following: - Receipts Required - Descriptions Required, with Description Hints set - Travel: “What is the business purpose of this expense?” - - Meals: “Could you share the business purpose, and tag attendees?” - - Entertainment: “Could you share the business purpose, and tag attendees?” + - Meals: “Could you share the business purpose and tag attendees?” + - Entertainment: “Could you share the business purpose and tag attendees?” 3. Disable any irrelevant expense categories that aren’t associated with employee spend -4. Configure *auto-categorization*, located just below your category list in the same tab. The section is titled *Default Categories*. Just find the right category, and match it with the presented category groups to allow for MCC (merchant category code) automated category selection with every imported connected card transaction. +4. Configure auto-categorization, located just below your category list in the same tab. The section is titled Default Categories. Find the right category and match it with the presented category groups to allow for MCC (merchant category code) automated category selection with every imported connected card transaction. ## Step 5: Make sure tags are required, or defaults are set -Tags in Expensify often relate to departments, projects/customers, classes, and so on. And in some cases they are *required* to be selected on every transactions. And in others, something like *departments* is a static field, meaning we could set it as an employee default and not enforce the tag selection with each expense. +Tags in Expensify often relate to departments, projects/customers, classes, and so on. And in some cases, they are *required* to be selected on every transaction. In others, something like *departments* is a static field, meaning we could set it as an employee default and not enforce the tag selection with each expense. *Make Tags Required* -In the tags tab in your workspace settings, you’ll notice the option to enable the “Required” field. This makes it so any time an employee doesn’t assign a tag to an expense, we’ll flag a violation on it and notify both the employee and the approver. +In the tags tab in your workspace settings, you’ll notice the option to enable the “Required” field. This means that any time an employee doesn’t assign a tag to an expense, we’ll flag a violation and notify both the employee and the approver. - *Note:* In general, we take prior selection into account, so anytime you select a tag in Expensify, we’ll pre-populate that same field for any subsequent expense. It’s completely interchangeable, and there for convenience. *Set Tags as an Employee Default* -Separately, if your workspace is connected to NetSuite or Sage Intacct, you can set departments, for example, as an employee default. All that means is we’ll apply the department (for example) that’s assigned to the employee record in your accounting package and apply that to every exported transaction, eliminating the need for the employee to have to manually select a department for each expense. +Separately, if your workspace is connected to NetSuite or Sage Intacct, you can set departments, for example, as an employee default. All that means is we’ll apply the department (for example) assigned to the employee record in your accounting package to every exported transaction, eliminating the need for the employee to manually select a department for each expense. ## Step 6: Set rules for all expenses regardless of categorization -In the Expenses tab in your group Control workspace, you’ll notice a *Violations* section designed to enforce top-level compliance controls that apply to every expense, for every employee in your workspace. We recommend the following confiuration: +In the Expenses tab in your group Control workspace, you’ll notice a *Violations* section designed to enforce top-level compliance controls that apply to every expense, for every employee in your workspace. We recommend the following configuration: *Max Expense Age: 90 days (or leave it blank)* -This will enable Expensify to catch employee reimbursement requests that are far too outdated for reimbursement, and present them as a violations. If you’d prefer a different time window, you can edit it accordingly +This will enable Expensify to catch employee reimbursement requests that are far too outdated for reimbursement and present them as a violation. If you’d prefer a different time window, you can edit it accordingly *Max Expense Amount: $2,000 (or leave it blank)* -This is essentially like setting a daily or individual expense limitation on any employee, regardless of whether the transaction is reimbursable or non-reimbursable.This rule will enables Expensify to present larger expenses with a violation to notify both the submitter and approvers. +This is essentially like setting a daily or individual expense limitation on any employee, regardless of whether the transaction is reimbursable or non-reimbursable. This rule will enable Expensify to present larger expenses with a violation to notify both the submitter and approvers. *Receipt Required Amount: $75* -Receipts are important, and in most cases you prefer an itemized receipt. However, Expensify will generate an IRS-compliant electronic receipt (not itemized) for every expense not tied to hotels expense. For this reason, it’s important to enforce a rule where anytime an employee is on the road, and making business-related purchases at hotel (which happens a lot!), they are required to attach a physical receipt. +Receipts are important, and in most cases, you prefer an itemized receipt. However, Expensify will generate an IRS-compliant electronic receipt (not itemized) for every expense not tied to hotel expenses. For this reason, it’s important to enforce a rule that anytime an employee is on the road and making business-related purchases at a hotel (which happens a lot!), they are required to attach a physical receipt. ![Expense Basics](https://help.expensify.com/assets/images/playbook-expense-basics.png){:width="100%"} -At this point, you’ve set enough compliance controls around categorical spend and general expenses for all employees, such that you can put trust in our solution to audit all expenses up front so you don’t have to. Next, let’s dive into how we can comfortably take on more automation, while relying on compliance controls to capture bad behavior (or better yet, instill best practices in our employees). +At this point, you’ve set enough compliance controls around categorical spending and general expenses for all employees that you can trust our solution to audit all expenses upfront so you don’t have to. Next, let’s explore how we can comfortably take on more automation while relying on compliance controls to capture bad behavior (or better yet, instill best practices in our employees). ## Step 7: Set up scheduled submit -For an efficient company, we recommend setting up [Scheduled Submit](https://help.expensify.com/articles/expensify-classic/policy-and-domain-settings/reports/Scheduled-Submit) on a *Daily* frequency: +For an efficient company, we recommend setting up [Scheduled Submit](https://help.expensify.com/articles/expensify-classic/policy-and-domain-settings/reports/Scheduled-Submit) on a *Daily* Frequency: - Click *Settings > Workspace* -- From here, select your group collect workspace +- From here, select a workspace on a Collect Plan - Within your workspace settings, select the *Reports* tab - You’ll notice *Scheduled Submit* is located directly under *Report Basics* - Choose *Daily* -Between Expensify's SmartScan technology, automatic categorization, and [DoubleCheck](https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Approving-Reports) features, your employees shouldn't need to do anything more than swipe their Expensify Card or take a photo of their receipt. +Between Expensify's SmartScan technology, automatic categorization, and [Receipt Audit](https://help.expensify.com/articles/expensify-classic/workspaces/Expense-Settings#concierge-receipt-audit) features, your employees shouldn't need to do anything more than swipe their Expensify Card or take a photo of their receipt. Expenses with violations will stay behind for the employee to fix, while expenses that are “in-workspace” will move into an approver’s queue to mitigate any potential for delays. Scheduled Submit will ensure all expenses are submitted automatically for approval. @@ -132,7 +132,7 @@ If you’re located in the US, you can utilize Expensify’s payment processing 1. Your bank account credentials 2. A form of ID (a driver’s license or passport) -3. Your business tax ID number, your business’ address and your website URL +3. Your business tax ID number, your business address, and your website URL Let’s walk through the process of linking your business bank account: @@ -143,30 +143,30 @@ Let’s walk through the process of linking your business bank account: 4. Once that’s done, we’ll collect all of the necessary information on your business, such as your legal business name and address 5. We’ll then collect your personal information, and a photo ID to confirm your identity -You only need to do this once: you are fully set up for not only reimbursing expense reports, but granting Expensify Cards, collecting customer invoice payments online (if applicable), as well as paying supplier bills online. +You only need to do this once: you are fully set up for reimbursing expense reports, granting Expensify Cards, collecting customer invoice payments online (if applicable), and paying supplier bills online. ## Step 9: Invite employees and set an approval workflow *Select an Approval Mode* We recommend you select *Advanced Approval* as your Approval Mode to set up a middle-management layer of approval. If you have a single layer of approval, we recommend selecting [Submit & Approve](https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Approval-Workflows). But if *Advanced Approval* is your jam, keep reading! *Import your employees in bulk via CSV* -Given the amount of employees you have, it’s best you import employees in bulk via CSV. You can learn more about using a CSV file to bulk upload employees with *Advanced Approval [here](https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Approval-Workflows)* +Given the amount of employees you have, it’s best you import employees in bulk via CSV. You can learn more about using a CSV file to bulk upload employees with *Advanced Approval [here](https://help.expensify.com/articles/expensify-classic/reports/How-Complex-Approval-Workflows-Work)* ![Bulk import your employees](https://help.expensify.com/assets/images/playbook-impoort-employees.png){:width="100%"} *Manually Approve All Reports* In most cases, at this stage, approvers prefer to review all expenses for a few reasons. 1) We want to make sure expense coding is accurate, and 2) We want to make sure there are no bad actors before we export transactions to our accounting system. -In this case we recommend setting *Manually approve all expenses over: $0* +In this case, we recommend setting *Manually approve all expenses over $0* ## Step 10: Configure Auto-Approval -Knowing you have all the control you need to review reports, we recommend configuring auto-approval for *all reports*. Why? Because you’ve already put reports through an entire approval workflow, and manually triggering reimbursement is an unnecessary action at this stage. +Knowing you have all the control you need to review reports, we recommend configuring auto-approval for all reports. You’ve already put reports through an entire approval workflow, and manually triggering reimbursement is an unnecessary action at this stage. 1. Navigate to *Settings > Workspace > Group > [Workspace Name] > Reimbursement* 2. Set your *Manual Reimbursement threshold to $20,000* ## Step 11: Enable Domains and set up your corporate card feed for employees -Expensify is optimized to work with corporate cards from all banks – or even better, use our own perfectly integrated *[Expensify Card](https://use.expensify.com/company-credit-card)*. The first step for connecting to any bank you use for corporate cards, and the Expensify Card is to validate your company’s domain in Domain settings. +Expensify is optimized to work with corporate cards from all banks—or, even better, use our perfectly integrated *[Expensify Card](https://use.expensify.com/company-credit-card)*. The first step for connecting to any bank you use for corporate cards and the Expensify Card is to validate your company’s domain in Domain settings. To do this: @@ -215,7 +215,7 @@ Here’s how to enable it: Once the Expensify Cards have been assigned, each employee will be prompted to enter their mailing address so they can receive their physical card. In the meantime, a virtual card will be ready to use immediately. -If you have an accounting system we directly integrate with, check out how we take automation a step further with [Continuous Reconciliation](https://help.expensify.com/articles/expensify-classic/expensify-card/Auto-Reconciliation). We’ll create an Expensify Card clearing and liability account for you. Each time settlement occurs, we’ll take the total amount of your purchases and create a journal entry that credits the settlement account and debits the liability account - saving you hours of manual reconciliation work at the end of your statement period. +If you have an accounting system we directly integrate with, check out how we take automation a step further with [Continuous Reconciliation](https://help.expensify.com/articles/expensify-classic/expensify-card/Expensify-Card-Reconciliation). We’ll create an Expensify Card clearing and liability account for you. Each time settlement occurs, we’ll take the total amount of your purchases and create a journal entry that credits the settlement account and debits the liability account - saving you hours of manual reconciliation work at the end of your statement period. ## Step 12: Set up Bill Pay and Invoicing As a small business, managing bills and invoices can be a complex and time-consuming task. Whether you receive bills from vendors or need to invoice clients, it's important to have a solution that makes the process simple, efficient, and cost-effective. @@ -223,21 +223,20 @@ As a small business, managing bills and invoices can be a complex and time-consu Here are some of the key benefits of using Expensify for bill payments and invoicing: - Flexible payment options: Expensify allows you to pay your bills via ACH, credit card, or check, so you can choose the option that works best for you (US businesses only). - No Cost Feature: The bill pay and invoicing features come included with every workspace and plan. -- Integration with your business bank account: With your business bank account verified, you can easily link your finances to receive payment from customers when invoices are paid. - -Let’s first chat through how Bill Pay works +Integration with your business bank account: Once your business bank account is verified, you can easily link your finances to receive payment from customers when invoices are paid. +Let’s go over how Bill Pay works: 1. Have your vendors send their invoices to yourdomain.com@expensify.cash. - This email address comes with every account, so no need to activate it anywhere. -2. Once the invoicehas been received, we’ll create a bill to pay for your review directly in Expensify -3. At the top of the bill, you’ll notice a Pay button. Once you click that, you’ll see options including ACH, credit/debit card, along with mailing a physical check. +2. Once the invoices have been received, we’ll create a bill to pay for your review directly in Expensify +3. At the top of the bill, you’ll notice a Pay button. Once you click that, you’ll see options including ACH, credit/debit card, and mailing a physical check. Similarly, you can send bills directly from Expensify as well. 1. From the *Reports* tab, select the down arrow next to *New Report* and select *Bill* 2. Next, enter the Supplier’s email address, the Merchant name, the total amount, and the date 3. At this point, you can also upload an attachment to further validate the bill if necessary -4. Click *Submit*, we’ll forward the newly created bill directly to your Supplier. +4. Click *Submit*, and we’ll forward the newly created bill directly to your Supplier. ![Send bills directly from Expensify](https://help.expensify.com/assets/images/playbook-new-bill.png){:width="100%"} @@ -247,10 +246,10 @@ Reports, invoices, and bills are largely the same, in theory, just with differen 2. Add all of the expenses/transactions tied to the Invoice 3. Enter the recipient’s email address, a memo if needed, and a due date for when it needs to get paid, and click *Send* -You’ll notice it’s a slightly different flow from creating a Bill. Here, you are adding the transactions tied to the Invoice, and establishing a due date for when it needs to get paid. If you need to apply any markups, you can do so from your workspace settings under the Invoices tab. Your customers can pay their invoice in Expensify via ACH, or Check, or Credit Card. +You’ll notice it’s a slightly different flow from creating a Bill. Here, you are adding the transactions tied to the Invoice and establishing a due date for when it needs to be paid. If you need to apply any markups, you can do so from your workspace settings under the Invoices tab. Your customers can pay their invoices in Expensify via ACH, Check, or Credit Card. -## Step 13: Run monthly, quarterly and annual reporting -At this stage, reporting is important and given that Expensify is the primary point of entry for all employee spend, we make reporting visually appealing and wildly customizable. +## Step 13: Run monthly, quarterly, and annual reporting +At this stage, reporting is important, and given that Expensify is the primary point of entry for all employee spending, we make reporting visually appealing and wildly customizable. 1. Head to the *Expenses* tab on the far left of your left-hand navigation 2. Select the pie chart icon on the right top right corner @@ -258,17 +257,16 @@ At this stage, reporting is important and given that Expensify is the primary po We recommend reporting: -- *Monthly* - for spend analysis on your GLs, active projects and department spend +- *Monthly* - for spend analysis on your GLs, active projects, and department spend - *Quarterly* - for budget comparison reporting. Pull up your BI tool and compare your active budgets with your spend reporting here in Expensify -- *Annually* - Run annual spend trend reports with month-over-month spend analysis, and prepare yourself for the upcoming fiscal year. +- *Annually*— Run annual spending trend reports with month-over-month spending analysis to prepare for the upcoming fiscal year. ![Expenses!](https://help.expensify.com/assets/images/playbook-expenses.png){:width="100%"} ## Step 14: Set your Subscription Size and Add a Payment card -Our pricing model is unique in the sense that you are in full control of your billing. Meaning, you have the ability to set a minimum number of employees you know will be active each month and you can choose which level of commitment fits best. We recommend setting your subscription to *Annual* to get an additional 50% off on your monthly Expensify bill. In the end, you've spent enough time getting your company fully set up with Expensify, and you've seen how well it supports you and your employees. Committing annually just makes sense. - -To set your subscription, head to: +Our pricing model is unique in the sense that you are in full control of your billing. This means you have the ability to set a minimum number of employees you know will be active each month, and you can choose which level of commitment fits best. We recommend setting your subscription to *Annual* to get an additional 50% off on your monthly Expensify bill. In the end, you've spent enough time getting your company fully set up with Expensify, and you've seen how well it supports you and your employees. Committing annually just makes sense. +To set up your subscription, head to: 1. Settings > Workspace 2. Select *Group* 3. Scroll down to *Subscription* @@ -276,12 +274,12 @@ To set your subscription, head to: 5. Enter the number of employees you know will be active each month 6. Enable *Auto-Renew* and *Auto-Increase Subscription Size* -Now that we’ve gone through all of the steps for setting up your account, let’s make it official so there are no interruptions in service as your employees begin using Expensify. We handle payments for our service via a paymentcard, and to add one: +Now that we’ve gone through all of the steps for setting up your account, let’s make it official so there are no interruptions in service as your employees begin using Expensify. We handle payments for our service via a payment card, and to add one: 1. Go to *Account > Settings > Payments* 2. Select *Add Payment Card* -3. Enter your name, card number, postal code, expiration and CVV +3. Enter your name, card number, postal code, expiration, and CVV 4. Click *Accept Terms* # You’re all set! -Congrats, you are all set up! If you need any assistance with anything mentioned above or would like to understand other features available in Expensify, reach out to your Setup Specialist directly in *[new.expensify.com](https://new.expensify.com)*. Don’t have one yet? Create a Control Workspace, and we’ll automatically assign a dedicated Setup Specialist to you. +Congrats, you are all set up! If you need any assistance with anything mentioned above or would like to understand other features available in Expensify, reach out to your Setup Specialist directly at *[new.expensify.com](https://new.expensify.com)*. Don’t have one yet? Create a Control Workspace, and we’ll automatically assign a dedicated Setup Specialist to you. diff --git a/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-US-Based-VC-Backed-Startups.md b/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-US-Based-VC-Backed-Startups.md index 0f6df238db5b..144e7328e630 100644 --- a/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-US-Based-VC-Backed-Startups.md +++ b/docs/articles/expensify-classic/getting-started/playbooks/Expensify-Playbook-For-US-Based-VC-Backed-Startups.md @@ -3,11 +3,7 @@ title: Expensify Playbook for US-Based VC-Backed Startups description: Best practices for how to deploy Expensify for your business redirect_from: articles/playbooks/Expensify-Playbook-for-US-based-VC-Backed-Startups/ --- -This playbook details best practices on how Seed to Series A startups with under 100 employees can use Expensify to prioritize top-line revenue growth while managing spend responsibly. - -- See our Playbook for Bootstrapped Businesses if you haven't taken any VC money yet. -- See our Playbook for Small Businesses if you are more concerned with maintaining profitability than growing top-line revenue. [Coming soon…] -- See our Playbook for Midsize Businesses if you are series B or beyond, or have more than 100 employees. [Coming soon…] +This playbook details best practices for Seed to Series A startups with under 100 employees who can use Expensify to prioritize top-line revenue growth while managing spending responsibly. # Who you are As a VC-backed business focused on growth and efficiency, you are looking for a product that puts smart automation in your hands. You prioritize top-line revenue growth over cash conservation, understanding that you’ll need to spend in order to grow. As a result, you want to enable your employees by putting spending power in their hands responsibly so there are appropriate compliance controls in place that scale with the business growth. Not only that, you want to decrease the amount of time you spend at the end of each month reimbursing employees, reconciling spend, and closing your books. @@ -18,19 +14,18 @@ This playbook is built based on best practices we’ve developed after processin ## Step 1: Create your Expensify account If you don't already have one, go to *[new.expensify.com](https://new.expensify.com)* and sign up for an account with your work email address. The account is free so don’t worry about the cost at this stage. -## Step 2: Upgrade to a paid policy -There are three paid policies; Individual, Collect, and Control, but for your needs we recommend the Control Policy for the following reasons: - -- You can cap spend on certain expense types, and set compliance controls so Expensify’s built-in Concierge Audit Tracking can detect violations on your behalf -- As a growing business with VC-funding, the Control plan will scale with you as your team grows and you start to introduce more sophisticated [approval workflows](https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Approval-Workflows) (see Step 8 below). +## Step 2: Upgrade to a paid workspace +There are three paid workspaces; Individual, Collect, and Control, but for your needs we recommend the Control workspace for the following reasons: -To create your Control Policy: +- You can cap spending on certain expense types, and set compliance controls so Expensify’s built-in Concierge Audit Tracking can detect violations on your behalf +- As a growing business with VC funding, the Control plan will scale with you as your team grows and you start to introduce more sophisticated [approval workflows](https://help.expensify.com/articles/expensify-classic/copilots-and-delegates/Approval-Workflows) (see Step 8 below). -1. Go to *Settings > Policies* -2. Select *Group* and click the button that says *New Policy* +To create a Control workspace: +1. Go to *Settings > Workspaces* +2. Select *Group* and click the button that says *New workspace* 3. Click *Select* under Control -The Control plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your policy's #admins room at *[new.expensify.com](https://new.expensify.com)*, and chatting with them there. The Control plan is bundled with the Expensify Visa® Commercial Card is $9 per user per month when you commit annually, which is a 75% discount off our standard unbundled price point. The Control plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your policy's *#admins* room in *[new.expensify.com](https://new.expensify.com)*, and chat with them there. +The Control plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your workspace's #admins room at *[new.expensify.com](https://new.expensify.com)* and chatting with them there. The Control plan is bundled with the Expensify Visa® Commercial Card is $9 per user per month when you commit annually, which is a 75% discount off our standard unbundled price point. The Control plan also gives you access to a dedicated Setup Specialist. You can find yours by looking at your workspace's *#admins* room in *[new.expensify.com](https://new.expensify.com)*, and chat with them there. ## Step 3: Connect your accounting system As a VC-backed company, your investors will want to see that your books are managed properly. That means making sure that: @@ -38,9 +33,8 @@ As a VC-backed company, your investors will want to see that your books are mana - Every purchase is categorized into the correct account in your chart of accounts - Every expense is accounted for and added to your accounting system -You do this by synchronizing Expensify and your accounting package as follows: - -1. Click *Settings > Policies* +**You do this by synchronizing Expensify and your accounting package as follows:** +1. Click *Settings > Workspaces* 2. Navigate to the *Connections* tab 3. Select your accounting system - If you don’t see your accounting solution in the list of integrations we support, you can review an alternative solution in the Feature Deep Dives section below. @@ -48,16 +42,16 @@ You do this by synchronizing Expensify and your accounting package as follows: - Detailed instructions on connecting your accounting package are linked on the Connections page 5. Once connected, your categories will sync, and you’re ready to set Category Rules -_“Expensify syncs seamlessly with QuickBooks, supports our web-based, paperless workflow, and offers internal controls, so it was the natural choice.”_ +_“Expensify syncs seamlessly with QuickBooks, supports our web-based, paperless workflow, and offers internal controls, so it was a natural choice.”_ _- Laura Redmond, CEO of Redmond Accounting_ ## Step 4: Set up category rules [Category rules](https://community.expensify.com/discussion/4638/how-to-enable-category-specific-rules-and-descriptions) are how you provide employees hints and requirements to make sure purchases stay within reasonable ranges and are documented appropriately for approval. For your company size and stage, we recommend the following: -1. Click *Settings > Policies* +1. Click *Settings > Workspaces* 2. Navigate to the *Categories* tab where you’ll see all the categories you just imported from your accounting package 3. To set a rule for a specific category, click *“Edit Rules”* -4. The Edit Rules section will provide several expense category rules that tie to specific general ledger categories. While the individual rules might change slightly from business to business, and the exact category name will depend on your specific chart of accounts, we recommend these settings for VC backed startups: +4. The Edit Rules section will provide several expense category rules that tie to specific general ledger categories. While the individual rules might change slightly from business to business, and the exact category name will depend on your specific chart of accounts, we recommend these settings for VC-backed startups: - Set a $75 daily limit on meals and entertainment purchases - Though we recommend [Expensify Guaranteed eReceipts](https://community.expensify.com/discussion/5542/deep-dive-what-are-ereceipts) for most purchases, for large purchases or those in categories most often associated with fraud, we recommend scanned receipts for extra protection: - For any purchase over $1000 @@ -66,38 +60,38 @@ _“Expensify syncs seamlessly with QuickBooks, supports our web-based, paperles - For all office supplies - For all software purchases - For all airfare purchases - - Require manual explanations for certain high risk categories: - - For airfare expenses a description of the expense mandatory for the employee to include the purpose of the travel + - Require manual explanations for certain high-risk categories: + - For airfare expenses, a description of the expense is mandatory for the employee to include the purpose of the travel - Require a description for all rideshare and taxi expenses, ensuring employees are listing a purpose for the expense Setting up these category rules allows you to concentrate on growth versus needing to micromanage your employees' spending. + ## Step 5: Set up scheduled submit For an efficiency-focused company, we recommend setting up [Scheduled Submit](https://community.expensify.com/discussion/4476/how-to-enable-scheduled-submit-for-a-group-policy) on a Daily frequency: -1. Click *Settings > Policies* -2. From here, select your group Control policy -3. Within your policy settings, select the *Reports* tab +1. Click *Settings > Workspaces* +2. From here, select your group Control workspace +3. Within your workspace settings, select the *Reports* tab 4. You’ll notice *Scheduled Submit* is located directly under *Report Basics* 5. Choose *Daily* -Between Expensify's SmartScan technology, direct corporate card feed import, automatic categorization, and [DoubleCheck](https://community.expensify.com/discussion/5738/deep-dive-how-does-concierge-receipt-audit-work) features, your employees shouldn't need to do anything more than swipe their Expensify Visa® Commercial Card or scan their receipt. +Between Expensify's SmartScan technology, direct corporate card feed import, automatic categorization, and [Receipt Audit](https://community.expensify.com/discussion/5738/deep-dive-how-does-concierge-receipt-audit-work) features, your employees shouldn't need to do anything more than swipe their Expensify Visa® Commercial Card or scan their receipt. -Scheduled Submit will ensure all expenses are submitted automatically. Any expenses that do not fall within the rules you’ve set up for your policy will be escalated to you for manual review. +Scheduled Submit will ensure all expenses are submitted automatically. Any expenses that do not fall within the rules you’ve set up for your workspace will be escalated to you for manual review. _“Our employees just SmartScan a receipt as soon as they receive it, and regardless of what currency it's in, we process the expense and issue reimbursement automatically.”_ _- Amina Mobasher, Accountant at Ideo.org_ -## Step 6: Connect your business bank account +## Step 6: Connect a business bank account If you’re located in the US, you can utilize Expensify’s payment processing and reimbursement features. *Note:* Before you begin, you’ll need the following to validate your business bank account: - Your bank account credentials - A form of ID (a driver’s license or passport) -- Your business tax ID number, your business’ address and your website URL - -Let’s walk through the process of linking your business bank account: +- Your business tax ID number, your business address, and your website URL +**Let’s walk through the process of linking your business bank account:** 1. Go to *Settings > Account*, and select the *Payments* tab 2. Select *Add Verified Bank Account* 3. From here, we’ll ask you to use your online banking credentials to connect to your bank @@ -105,30 +99,30 @@ Let’s walk through the process of linking your business bank account: 4. Once that’s done, we’ll collect all of the necessary information on your business, such as your legal business name and address 5. We’ll then collect your personal information, and a photo ID to confirm your identity -You only need to do this once. You are fully set up for not only reimbursing expense reports, but issuing Expensify Cards, collecting invoice payments online, as well as paying bills online. +You only need to do this once. You are fully set up to reimburse expense reports, issue Expensify Cards, collect invoice payments online, and pay bills online. ## Step 7: Invite employees -Next, you’ll want to invite your employees to the company policy you created. You can invite employees under *Settings > Policies > Policy Name > People*. From there, you can add employees one of three ways: +Next, you’ll want to invite your employees to the company workspace you created. You can invite employees under *Settings > Workspaces > Workspace Name > member*. From there, you can add employees one of three ways: -- [Unique Policy Link](https://community.expensify.com/discussion/4643/how-to-invite-people-to-your-policy-using-a-join-link) - Each policy has a unique policy invite link, which is located at the top of the People tab in your policy settings. Simply share that link with anyone you’d like to add to your policy. -- [Manually](https://community.expensify.com/discussion/4975/how-to-invite-users-to-your-policy-manually-or-in-bulk/p1?new=1) - Enter employee email addresses manually by clicking the green Invite button in the People tab of your policy -- [Google SSO](https://community.expensify.com/discussion/4774/how-to-enable-google-apps-sso-with-your-expensify-group-policy) - Or, if you have a Google Workspace configured, you can synchronize your policy's people list to match your Google Workspace employee list. +- [Unique Workspace Link](https://community.expensify.com/discussion/4643/how-to-invite-people-to-your-policy-using-a-join-link) - Each workspace has a unique workspace invite link, which is located at the top of the member tab in your workspace settings. Simply share that link with anyone you’d like to add to your workspace. +- [Manually](https://help.expensify.com/articles/expensify-classic/workspaces/Invite-members-and-assign-roles#invite-with-a-link) - Enter employee email addresses manually by clicking the green Invite button in the member tab of your workspace +- [Google SSO](https://community.expensify.com/discussion/4774/how-to-enable-google-apps-sso-with-your-expensify-group-policy) - Or, if you have a Google Workspace configured, you can synchronize your workspace's member list to match your Google Workspace employee list. -In the next section, we’ll go through how to configure approval routing but it’s important to remember that you’ll always have these 3 options to utilize, specifically the unique policy link and manual invites as your team continues to grow. +In the next section, we’ll go through how to configure approval routing, but it’s important to remember that you’ll always have these 3 options to utilize, specifically the unique workspace link and manual invites, as your team continues to grow. ## Step 8: Set up an approval workflow Now, let’s set up some approval rules for your business as well as the ideal approval workflow that employee reports will follow after report submission: -1. Go to *Settings > Policies*, and select the *People* tab. -2. From there, select [Submit & Approve](https://community.expensify.com/discussion/5643/deep-dive-submit-and-approve) - this will automatically add you as the approver, which ensures that any expenses that fall outside of the rules you set for your policy are brought to your attention. +1. Go to *Settings > Workspaces*, and select the *Members* tab. +2. From there, select [Submit & Approve](https://community.expensify.com/discussion/5643/deep-dive-submit-and-approve). This will automatically add you as the approver, which ensures that any expenses that fall outside of the rules you set for your workspace are brought to your attention. - *Note*: If you are over 50 employees, please ask your Guide about the benefits of setting up an Advanced Approval workflow. 3. Next, enable manual approval for *expenses over $1000*. - *Note*: We do not recommend configuring random report auditing for companies of your stage and scale. 4. Next, enable *Workflow Enforcement*. - This ensures that employees are required to submit to you and not to someone else. -5. Disable *Prevent Self-Approval*. This is a more powerful feature recommended for companies with advanced compliance requirements, but generally isn't recommended for a company of your scale. +5. Disable *Prevent Self-Approval*: This is a more powerful feature recommended for companies with advanced compliance requirements, but it is generally not recommended for a company of your scale. -Thanks to our [Concierge Receipt audit technology](https://community.expensify.com/discussion/5738/deep-dive-how-does-concierge-receipt-audit-work), once you set up an approval workflow, most expenses will be audited automatically and won’t require manual review. Your time is valuable, so you should focus it on reviewing only the expenses that fall outside of your policy’s rules. +Thanks to our [Concierge Receipt audit technology](https://community.expensify.com/discussion/5738/deep-dive-how-does-concierge-receipt-audit-work), once you set up an approval workflow, most expenses will be audited automatically and won’t require manual review. Your time is valuable, so you should focus on reviewing only the expenses that fall outside of your workspace’s rules. ## Step 9: Set up your corporate card and assign cards to employees Expensify is optimized to work with corporate cards from all banks – or even better, use our own perfectly integrated Expensify Card. @@ -163,8 +157,7 @@ Expensify provides a corporate card with the following features: The Expensify Card is recommended as the most efficient way to manage your company's spending. -Here’s how to enable it: - +**Here’s how to enable it:** 1. There are *two ways* you can [apply for the Expensify Card](https://community.expensify.com/discussion/4874/how-to-apply-for-the-expensify-card) - *Via your Inbox* - *Via Domain Settings* - Go to Settings > Domain > Company Cards > Enable Expensify Card @@ -176,43 +169,40 @@ Here’s how to enable it: Once the Expensify Cards have been assigned, each employee will be prompted to enter their mailing address so they can receive their physical card. In the meantime, a virtual card will be ready to use immediately. -If you have an accounting system we directly integrate with, check out how we take automation a step further with [Auto-Reconciliation](https://community.expensify.com/discussion/7335/faq-what-is-the-expensify-card-auto-reconciliation-process). We’ll create an Expensify Card clearing and liability account for you. Each time settlement occurs, we’ll take the total amount of your purchases and create a journal entry that credits the settlement account and debits the liability account - saving you hours of manual reconciliation work at the end of your statement period. +If you have an accounting system we directly integrate with, check out how we take automation a step further with [Auto-Reconciliation](https://help.expensify.com/articles/expensify-classic/expensify-card/Expensify-Card-Reconciliation). We’ll create an Expensify Card clearing and liability account for you. Each time settlement occurs, we’ll take the total amount of your purchases and create a journal entry that credits the settlement account and debits the liability account - saving you hours of manual reconciliation work at the end of your statement period. _“Moving from our other bank and getting Expensify cards into the hands of employees was super easy. I also love how simple it is to adjust credit limits and the auto reconciliation with the daily settlement.”_ _- Robin Gresham, Senior Accounting Systems Manager at SunCommon_ ## Step 10: Set up Bill Pay and Invoicing -As a VC-backed startup, you might have vendors you work with that send you bills. And in most cases, you probably use some third party to pay those bills if you aren’t cutting checks the old fashioned way. Similarly, you probably have clients you invoice from time to time. As an all-in-one solution, we’re here to make bill payments and invoicing easy, and every policy and workspace comes with bill pay and invoicing - at no additional cost. Since you have your business bank account verified, you can either pay your bills via ACH. Alternatively, you can pay via credit card or by check. - -Let’s first chat through how Bill Pay works +As a VC-backed startup, you might have vendors you work with that send you bills. And in most cases, you probably use some third party to pay those bills if you aren’t cutting checks the old fashioned way. Similarly, you probably have clients you invoice from time to time. As an all-in-one solution, we’re here to make bill payments and invoicing easy, and every workspace and workspace comes with bill pay and invoicing - at no additional cost. Since you have your business bank account verified, you can either pay your bills via ACH. Alternatively, you can pay via credit card or by check. +**Let’s go over how Bill Pay works:** 1. Have your vendors submit bills to domain.com@expensify.cash. - This email address comes with every account, so no need to activate it anywhere. 2. Once the bill has been received, we’ll create the bill for your review directly in Expensify -3. At the top of the bill/invoice, you’ll notice a Pay button. Once you click that, you’ll see options including ACH, credit/debit card, along with mailing a physical check. - -Similarly, you can send bills directly from Expensify as well. +3. At the top of the bill/invoice, you’ll notice a Pay button. Once you click that, you’ll see options including ACH, credit/debit card, and mailing a physical check. +**Similarly, you can send bills directly from Expensify:** 1. From the *Reports* tab, select the down arrow next to *New Report* and select *Bill* -2. Next, enter in the Supplier’s email address, the Merchant name, total amount and date -3. At this point, you can also enter in an attachment to further validate the bill if necessary -4. Click *Submit*, we’ll forward the newly created bill directly to your Supplier. - -Reports, invoices and bills - they are largely the same in theory, just with different rules. As such, creating an invoice is just like creating an expense report and even a Bill. +2. Next, enter the Supplier’s email address, the Merchant name, the total amount, and the date +3. At this point, you can also enter an attachment to further validate the bill if necessary +4. Click *Submit*, and we’ll forward the newly created bill directly to your Supplier. +**Reports, invoices, and bills are largely the same in theory, just with different rules. As such, creating an invoice is just like creating an expense report or even a Bill:** 1. From the *Reports* tab, select the down arrow next to *New Report* and select *Invoice*. 2. Add all of the expenses/transactions tied to the Invoice 3. Enter the recipient’s email address, a memo if needed, and a due date for when it needs to get paid, and click *Send* -You’ll notice it’s a slightly different flow from creating a Bill. Here, you are adding the transactions tied to the Invoice, and establishing a due date for when it needs to get paid. If you need to apply any markups, you can do so from your policy settings under the Invoices tab. +You’ll notice it’s a slightly different flow from creating a Bill. Here, you are adding the transactions tied to the Invoice, and establishing a due date for when it needs to get paid. If you need to apply any markups, you can do so from your workspace settings under the Invoices tab. ## Step 11: Add a billing card Now that we’ve gone through all of the steps for setting up your account, let’s make it official so there are no interruptions in service as your employees begin using Expensify. We handle billing via a billing card, and to add one: 1. Go to *Account > Settings > Payments* 2. Select *Add Payment Card* -3. Enter your name, card number, postal code, expiration and CVV +3. Enter your name, card number, postal code, expiration, and CVV 4. Click *Accept Terms* # You’re all set! -Congrats, you are all set up! If you need any assistance with anything mentioned above, reach out to either your Setup Specialist or your Account Manager directly in *[new.expensify.com](https://new.expensify.com)*. Don’t have one yet? Create a Control Policy, and we’ll automatically assign a dedicated Setup Specialist to you. +Congrats, you are all set up! If you need any assistance with anything mentioned above, reach out to either your Setup Specialist or your Account Manager directly in *[new. Expensify.com](https://new.expensify.com)*. Don’t have one yet? Create a Control workspace, and we’ll automatically assign you a dedicated Setup Specialist. diff --git a/docs/articles/expensify-classic/spending-insights/Insights.md b/docs/articles/expensify-classic/spending-insights/Insights.md index c5ee218352fd..edd9c2207466 100644 --- a/docs/articles/expensify-classic/spending-insights/Insights.md +++ b/docs/articles/expensify-classic/spending-insights/Insights.md @@ -1,12 +1,11 @@ --- title: Custom Reporting and Insights -description: How to get the most out of the Custom Reporing and Insights +description: How to get the most out of the Custom Reporting and Insights redirect_from: articles/other/Insights/ --- -# Overview -The Insights dashboard allows you to monitor all aspects of company spending across categories, employees, projects, departments, and more. You can see trends in real-time, forecast company budgets, and build unlimited custom reports with help from our trained specialist team. +The Insights dashboard allows you to monitor all aspects of company spending across categories, employees, projects, departments, and more. You can see trends in real time, forecast company budgets, and build unlimited custom reports with help from our trained specialist team. ![Insights Pie Chart](https://help.expensify.com/assets/images/insights-chart.png){:width="100%"} ## Review your Insights data @@ -15,7 +14,7 @@ The Insights dashboard allows you to monitor all aspects of company spending acr 2. Select a specific date range (the default view has the current month pre-selected) 3. Use the filter options to select the categories, tags, employees, or any other parameter 4. Make sure that View in the top right corner is set to the pie chart icon -5. You can view any dataset in more detail by clicking in the “View Raw Data” column +5. You can view any dataset in more detail by clicking in the **View Raw Data** column ## Export your Insights data @@ -26,46 +25,47 @@ The Insights dashboard allows you to monitor all aspects of company spending acr ## Create a Custom Export Report for your Expenses 1. Navigate to **Settings > Account > Preferences > scroll down to CSV Export Formats** -2. Build up a report using these [formulas]((https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates)) +2. Build up a report using these [expense-level formulas](https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates#expense-level) 3. Click the **Custom Export** button on the Insights page and your Account Manager will help get you started on building up your report ## Create a Custom Export Report for your Workspace 1. Navigate to **Settings > Workspaces > Group > [Workspace Name] > Export Formats** -2. Build up a report using these [formulas](https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates) -3. If you need any help, click the **Support** button on the top left to contact your Account Manager +2. Build up a report using these [report-level formulas](https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates#report-level) +3. If you need any help, click the **Support** button on the top left to contact Concierge or your Account Manager {% include faq-begin.md %} -#### Can I share my custom export report? +## Can I share my custom export report? If you would like to create a custom export report that can be shared with other workspace admins, you can do so by navigating to the **[Settings > Workspaces > Group > [Workspace Name] > Export Formats** page. Custom export reports created under the **Settings > Account > Preferences** page are only available to the member who created them. -#### Can I put expenses from different workspaces on the same report? +## Can I put expenses from different workspaces on the same report? -Custom export reports created under the Settings > Account > Preferences page can export expenses from multiple workspaces, and custom export formats created under Settings > Workspaces> Group > [Workspace Name] > Export Formats are for expenses reported under that workspace only. +Custom export reports created under the **Settings > Account > Preferences** page can export expenses from multiple workspaces. -#### Are there any default export reports available? +Custom export formats created under **Settings > Workspaces> Group > [Workspace Name] > Export Formats** are for expenses reported under that workspace only. + +## Are there any default export reports available? Yes! We have [seven default reports](https://help.expensify.com/articles/expensify-classic/spending-insights/Default-Export-Templates) available to export directly from the Reports page: -- **All Data** - Expense Level Export** - the name says it all! This is for the people who want ALL the details from their expense reports. We're talking Tax, Merchant Category Codes, Approvers - you name it, this report's got it! -- **All Data** - Report Level Export - this is the report for those who don't need to see each individual expense but want to see a line-by-line breakdown at a report level - submitter, total amount, report ID - that kind of stuff -- **Basic Export** - this is the best way to get a simple breakdown of all your expenses - just the basics -- **Canadian Multiple Tax Export** - tax, GST, PST...if you need to know tax then this is the export you want! -- **Category Export** - want to see a breakdown of your expenses by Category? This is the export you -- **Per Diem Export** - the name says it all -- **Tag Export** - much like the Category Export, but for Tags +- **All Data — Expense Level Export**: Use this to view all of the details from their expense reports (tax, merchant category codes, approvals, etc.) +- **All Data—Report Level Export**: This report is great if you don't need to see each individual expense but want to see a line-by-line breakdown at a report level (submitter, total amount, report ID, etc.) +- **Basic Export**: The best way to get a simple breakdown of all your expenses +- **Canadian Multiple Tax Export**: To gain a better understanding of the various Canadian taxes tied to expenses (GST, PST, etc.) +- **Category Export**: Use this to see a breakdown of your expenses by Category +- **Per Diem Export**: Use to export your Per Diem details +- **Tag Export**: Similar to the Category Export, but for Tags *These reports will be emailed directly to your email address rather than automatically downloaded.* -#### How many expenses can I export in one report? +## How many expenses can I export in one report? The custom export reports are best for small-to-medium chunks of data. If you want to export large amounts of data, we recommend you use a [default export report](https://help.expensify.com/articles/expensify-classic/spending-insights/Default-Export-Templates) that you can run from the Reports page. -#### What other kinds of export reports can my Account Manager help me create? +## What other kinds of export reports can my Account Manager help me create? We’ve built a huge variety of custom reports for customers, so make sure to reach out to your Account Manager for more details. Some examples of custom reports we’ve built for customers before are: - - Accrual Report - Aged Approval Reports - Attendee Reporting diff --git a/docs/articles/expensify-classic/workspaces/Create-tags.md b/docs/articles/expensify-classic/workspaces/Create-tags.md index ad3f51bc8c58..0743b53ff5fa 100644 --- a/docs/articles/expensify-classic/workspaces/Create-tags.md +++ b/docs/articles/expensify-classic/workspaces/Create-tags.md @@ -1,23 +1,20 @@ --- -title: Create tags +title: Create Tags description: Code expenses by creating tags ---
You can tag expenses for a specific department, project, location, cost center, customer, etc. You can also use different tags for each workspace to create customized coding for different employees. -You can use single tags or multi-level tags: -- **Single Tags**: Employees click one dropdown to select one tag. Single tags are helpful if employees need to select only one tag from a list, for example their department. -- **Multi-level Tags**: Employees click multiple dropdowns to select more than one tag. You can also create dependent tags that only appear if another tag has already been selected. Multi-tags are helpful if you have multiple tags, for example projects, locations, cost centers, etc., for employees to select, or if you have dependent tags. For example, if an employee selects a specific department, another tag can appear where they have to select their project. +**There are two options for tag configuration in Expensify:** +- **Single Tags**: Employees click one dropdown to select one tag. Single tags are helpful if employees need to select only one tag from a list, for example, their department. +- **Multi-level Tags**: Employees click multiple dropdowns to select more than one tag. You can also create dependent tags that only appear if another tag has already been selected. Multi-tags are helpful if you have multiple tags, for example, projects, locations, cost centers, etc., for employees to select or if you have dependent tags. For example, if an employee selects a specific department, another tag can appear where they have to select their project. -To add your tags, you can either import them for an accounting system or spreadsheet, or add them manually. +# Individual Tags -# Single tags - -## Import a spreadsheet - -You can add a list of single tags by importing them in a .csv, .txt, .xls, or .xlsx spreadsheet. +## Import via spreadsheet +You can add a list of single tags by importing them via .csv, .txt, .xls, or .xlsx spreadsheet: 1. Hover over Settings, then click **Workspaces**. 2. Click the **Group** tab on the left. 3. Click the desired workspace name. @@ -30,31 +27,35 @@ Each time you upload a list of tags, it will override your previous list. To avo {% include end-info.html %} ## Manually add individual tags - +You can also add single tags by adding them manually: 1. Hover over Settings, then click **Workspaces**. 2. Click the **Group** tab on the left. 3. Click the desired workspace name. 4. Click the **Tags** tab on the left. 5. Enter a tag name into the field and click **Add**. -# Multi-level tags +# Multi-level Tags + +## Automatic import via accounting integration + +When you first connect your accounting integration (for example, QuickBooks Online, QuickBooks Desktop, Sage Intacct, Xero, or NetSuite), you’ll configure classes, customers, projects, department locations, etc., that automatically import into Expensify as tags. -## Automatic import with accounting integration +To update your tags in Expensify, you must first update the tag in your accounting system: +1. Hover over Settings, then click **Workspaces**. +2. Click the **Group** tab on the left. +3. Click the desired workspace name. +4. Click the **Connections** tab on the left. +5. Click **Sync Now**. -When you first connect your accounting integration (for example, QuickBooks Online, QuickBooks Desktop, Sage Intacct, Xero, or NetSuite), you’ll configure classes, customers, projects, departments locations, etc. that automatically import into Expensify as tags. +Once the tags are updated in your accounting integration, the changes will automatically reflect in Expensify after the connection sync is run. -1. To update your tags in Expensify, you must first update the tag in your accounting system. Then in Expensify, -2. Hover over Settings, then click **Workspaces**. -3. Click the **Group** tab on the left. -4. Click the desired workspace name. -5. Click the **Connections** tab on the left. -6. Click **Sync Now**. +## Import via spreadsheet -## Import a spreadsheet +You can add mutli-level tags by importing them in a .csv, .txt, .xls, or .xlsx spreadsheet. -You can add a list of single tags by importing them in a .csv, .txt, .xls, or .xlsx spreadsheet. +First, determine whether you will use independent (a separate tag for department and project) or dependent tags (the project tags populate different options based on the department selected) and whether you will capture general ledger (GL) codes. -1. Determine whether you will use independent (a separate tag for department and project) or dependent tags (the project tags populate different options based on the department selected), and whether you will capture general ledge (GL) codes. Then use one of the following templates to build your tags list: +Then use one of the following templates to build your tags list: - [Dependent tags with GL codes]({{site.url}}/assets/Files/Dependent+with+GL+codes+format.csv) - [Dependent tags without GL codes]({{site.url}}/assets/Files/Dependent+without+GL+codes+format.csv) - [Independent tags with GL codes]({{site.url}}/assets/Files/Independent+with+GL+codes+format.csv) @@ -64,21 +65,22 @@ You can add a list of single tags by importing them in a .csv, .txt, .xls, or .x If you have more than 50,000 tags, divide them into two separate files. {% include end-info.html %} -2. Hover over Settings, then click **Workspaces**. -3. Click the **Group** tab on the left. -4. Click the desired workspace name. -5. Click the **Tags** tab on the left. -6. Enable the “Use multiple levels of tags” option. -7. Click **Import from Spreadsheet**. -8. Select the applicable checkboxes and click **Upload Tags**. +To import multi-level tags: +1. Hover over Settings, then click **Workspaces**. +2. Click the **Group** tab on the left. +3. Click the desired workspace name. +4. Click the **Tags** tab on the left. +5. Enable the “Use multiple levels of tags” option. +6. Click **Import from Spreadsheet**. +7. Select the applicable checkboxes and click **Upload Tags**. {% include info.html %} Each time you upload a list of tags, it will override your previous list. To avoid losing tags, update your current spreadsheet and re-import it into Expensify. {% include end-info.html %} -# FAQs +# FAQ -**Why can’t I see a "Do you want to use multiple level tags" option on my workspace.** +## Why can’t I see a multi-level tags option on my workspace? If you are connected to an accounting integration, you will not see this feature. You will need to add those tags in your integration first, then sync the connection. diff --git a/docs/articles/new-expensify/connections/sage-intacct/Connect-to-Sage-Intacct.md b/docs/articles/new-expensify/connections/sage-intacct/Connect-to-Sage-Intacct.md index 8e69a03fb666..c577c17e8463 100644 --- a/docs/articles/new-expensify/connections/sage-intacct/Connect-to-Sage-Intacct.md +++ b/docs/articles/new-expensify/connections/sage-intacct/Connect-to-Sage-Intacct.md @@ -4,37 +4,37 @@ description: Integrate Sage Intacct with Expensify order: 1 --- -# Connect to Sage Intacct +The Sage Intacct integration allows for automated syncing and reduces manual entries. The integration allows you to import your standard dimensions (like department, class, location, customer, and project/job) as well as user-defined dimensions for selection in Expensify. -Enjoy automated syncing and reduce manual entries with the Expensify and Sage Intacct integration. Gain in-depth, real-time financial insights with user-defined dimensions, as well as expense coding by department, class, location, customer, and project (job). +The features available for the Expensify connection with Sage Intacct vary based on your Sage Intacct subscription. The features may still be visible in Expensify even if you don't have access, but you will receive an error if the feature isn't available with your subscription. {% include info.html %} The Sage Intacct integration is only available on the Control plan. {% include end-info.html %} -## Overview +# Overview -Expensify’s integration with Sage Intacct allows you to connect using either role-based permissions or user-based permissions and exporting either expense reports or vendor bills. +Expensify’s integration with Sage Intacct allows you to connect using either role-based permissions or user-based permissions and to export either expense reports or vendor bills. -Checklist of items to complete: +**Checklist of items to complete:** 1. Create a web services user and configure permissions -1. Enable the T&E module (only required if exporting out-of-pocket expenses as Expense Reports) -1. Set up Employees in Sage Intacct (only required if exporting expenses as Expense Reports) -1. Set up Expense Types (only required if exporting expenses as Expense Reports) -1. Enable Customization Services -1. Download the Expensify Package -1. Upload the Expensify Package in Sage Intacct -1. Add web services authorization -1. Enter credentials and connect Expensify and Sage Intacct -1. Configure integration sync options - -## Step 1a: Create a web services user (Connecting with User-based permissions) -Note: If the steps in this section look different in your Sage Intacct instance, you likely use role-based permissions. If that’s the case, follow the steps [here]. +2. Enable the T&E module (only required if exporting out-of-pocket expenses as Expense Reports) +3. Set up Employees in Sage Intacct (only required if exporting expenses as Expense Reports) +4. Set up Expense Types (only required if exporting expenses as Expense Reports) +5. Enable Customization Services +6. Download the Expensify Package +7. Upload the Expensify Package in Sage Intacct +8. Add web services authorization +9. Enter credentials and connect Expensify and Sage Intacct +10. Configure integration sync options + +# Step 1a: Create a web services user (Connecting with User-based permissions) +Note: If the steps in this section look different from your Sage Intacct instance, you likely use role-based permissions. If that’s the case, start with [Step 1b](#step-1b-create-a-web-services-user-connecting-with-role-based-permissions). To connect to Sage Intacct, you’ll need to create a special web services user (please note that Sage Intacct does not charge extra for web services users). -1. Go to **Company > Web Services Users > New**. +1. Go to **Company > Web Services Users > New** 2. Configure the user as outlined below: - **User ID**: “xmlgateway_expensify” - **Last Name and First Name:** “Expensify” @@ -59,15 +59,15 @@ These are the permissions required for this integration when exporting out-of-po - **Projects (Read-only)** - Only required if using Projects or Customers - **Accounts Payable (All)** - Only required if exporting any expenses expenses as vendor bills -## Step 1b: Create a web services user (Connecting with Role-based permissions) -Note: If the steps in this section look different in your Sage Intacct instance, you likely use role-based permissions. If that’s the case, follow the steps [here]. +# Step 1b: Create a web services user (Connecting with Role-based permissions) +Note: If the steps in this section look different in your Sage Intacct instance, you likely use role-based permissions. If that’s the case, start with [Step 1a](#step-1a-create-a-web-services-user-connecting-with-user-based-permissions). **First, you'll need to create the new role:** 1. In Sage Intacct, click **Company**, then click on the **+ button** next to Roles -1. Name the role "Expensify", then click **Save** -1. Go to **Roles > Subscriptions** and find the “Expensify” role you just created -1. Configure correct permissions for this role by clicking the checkbox and then clicking on the Permissions hyperlink. These are the permissions required for this integration when exporting out-of-pocket expenses as vendor bills: +2. Name the role "Expensify", then click **Save** +3. Go to **Roles > Subscriptions** and find the “Expensify” role you just created +4. Configure correct permissions for this role by clicking the checkbox and then clicking on the Permissions hyperlink. These are the permissions required for this integration when exporting out-of-pocket expenses as vendor bills: - **Administration (All)** - **Company (Read-only)** - **Cash Management (All)** @@ -89,7 +89,7 @@ Note: If the steps in this section look different in your Sage Intacct instance, 3. Assign the role to that user: click the **+ button**, then select the “Expensify” role and click **Save** -## Step 2: Enable and configure the Time & Expenses Module +# Step 2: Enable and configure the Time & Expenses Module **Note: This step is only required if exporting out-of-pocket expenses from Expensify to Sage Intacct as Expense Reports.** Enabling the T&E module is a paid subscription through Sage Intacct and the T&E module is often included in your Sage Intacct instance. For information on the costs of enabling this module, please contact your Sage Intacct account manager. @@ -118,7 +118,7 @@ In Sage Intacct, go to **Company menu > Subscriptions > Time & Expenses** and to 6. Click **Save** to confirm your configuration -## Step 3: Set up Employees in Sage Intacct +# Step 3: Set up Employees in Sage Intacct **Note: This step is only required if exporting out-of-pocket expenses from Expensify to Sage Intacct as Expense Reports.** To set up employees in Sage Intacct: @@ -135,7 +135,7 @@ To set up employees in Sage Intacct: 1. Fill in their Primary Email Address along with any other required information -## Step 4: Set up Expense Types in Sage Intacct +# Step 4: Set up Expense Types in Sage Intacct **Note: This step is only required if exporting out-of-pocket expenses from Expensify to Sage Intacct as Expense Reports.** Expense Types provide a user-friendly way to display the names of your expense accounts to your employees. To set up expense types in Sage Intacct: @@ -150,20 +150,20 @@ Expense Types provide a user-friendly way to display the names of your expense a - **Description** - **Account Number** (from your General Ledger) -## Step 5: Enable Customization Services +# Step 5: Enable Customization Services **Note:** If you already have Platform Services enabled, you can skip this step. To enable Customization Services, go to **Company > Subscriptions > Customization Services**. -## Step 6: Download the Expensify Package +# Step 6: Download the Expensify Package 1. In Expensify, go to Settings > Workspaces 1. Click into the workspace where you'd like to connect to Sage Intacct - If you already use Expensify, you can optionally create a test workspace by clicking **New Workspace** at the top-right of the Workspaces page. A test workspace allows you to have a sandbox environment for testing before implementing the integration live. 1. Go to **Connections > Sage Intacct > Connect to Sage Intacct** 1. Select **Download Package** (You only need to download the file; we’ll upload it from your Downloads folder later) -## Step 7: Upload Package in Sage Intacct +# Step 7: Upload Package in Sage Intacct If you use Customization Services: 1. Go to **Customization Services > Custom Packages > New Package** @@ -177,20 +177,20 @@ If you use Platform Services: 1. Click **Import** -## Step 8: Add Web Services Authorization +# Step 8: Add Web Services Authorization 1. Go to **Company > Company Info > Security** in Sage Intacct and click **Edit** 2. Scroll down to **Web Services Authorizations** and add “expensify” (all lower case) as a Sender ID -## Step 9: Enter Credentials and Connect Expensify and Sage Intacct +# Step 9: Enter Credentials and Connect Expensify and Sage Intacct 1. In Expensify, go to **Settings > Workspaces > [Workspace Name] > Accounting** 1. Click **Set up** next to Sage Intacct 1. Enter the credentials you set for your web services user in Step 1 1. Click **Confirm** -## FAQ +# FAQ -### Why wasn't my report automatically exported to Sage Intacct? +## Why wasn't my report automatically exported to Sage Intacct? There are a number of factors that can cause auto-export to fail. If this happens, you will find the specific export error in the report comments for the report that failed to export. Once you’ve resolved any errors, you can manually export the report to Sage Intacct. -### Can I export negative expenses to Sage Intacct? +## Can I export negative expenses to Sage Intacct? Yes, you can export negative expenses to Sage Intacct. If you are exporting out-of-pocket expenses as expense reports, then the total of each exported report cannot be negative. diff --git a/docs/articles/new-expensify/expenses-&-payments/Track-expenses.md b/docs/articles/new-expensify/expenses-&-payments/Track-expenses.md index f4eeea09ecec..f6260b9f8f84 100644 --- a/docs/articles/new-expensify/expenses-&-payments/Track-expenses.md +++ b/docs/articles/new-expensify/expenses-&-payments/Track-expenses.md @@ -13,7 +13,7 @@ Create, store, or share non-reimbursable expenses with the Track Expenses featur 2. Create the expense manually, scan the receipt, or add a distance expense. {% include info.html %} -For an in-depth walkthrough on how to create an expense, check out the create an expense article. +For an in-depth walkthrough on how to create an expense, check out the [create an expense](https://help.expensify.com/articles/new-expensify/expenses-&-payments/Create-an-expense) article. {% include end-info.html %} 3. Choose the next steps for the expense: @@ -28,7 +28,7 @@ For an in-depth walkthrough on how to create an expense, check out the create an expense article. +For an in-depth walkthrough on how to create an expense, check out the [create an expense](https://help.expensify.com/articles/new-expensify/expenses-&-payments/Create-an-expense) article. {% include end-info.html %} 3. Choose the next steps for the expense: diff --git a/docs/articles/new-expensify/expensify-card/Manage-Expensify-Cards.md b/docs/articles/new-expensify/expensify-card/Manage-Expensify-Cards.md index d7a1b75e128d..47962f81a5a7 100644 --- a/docs/articles/new-expensify/expensify-card/Manage-Expensify-Cards.md +++ b/docs/articles/new-expensify/expensify-card/Manage-Expensify-Cards.md @@ -4,6 +4,10 @@ description: How to manage the Expensify Card ---
+{% include info.html %} +You must be a Workspace Admin to manage this feature. +{% include end-info.html %} + Once your Expensify Cards have been issued, you can monitor them and check your card’s current balance, remaining limit, and earned cash back. 1. Click your profile image or icon in the bottom left menu. diff --git a/docs/articles/new-expensify/expensify-card/Set-up-the-Expensify-Card.md b/docs/articles/new-expensify/expensify-card/Set-up-the-Expensify-Card.md index ad4982cee4b3..d52c475aa488 100644 --- a/docs/articles/new-expensify/expensify-card/Set-up-the-Expensify-Card.md +++ b/docs/articles/new-expensify/expensify-card/Set-up-the-Expensify-Card.md @@ -34,7 +34,7 @@ Before you can issue your Expensify Cards, you must connect your cards with the 1. Click **Expensify Card** in the left menu. 2. Click **Issue new card**. -3. Select an existing bank account from the list, or follow the steps to add a new one. +3. Select an existing bank account from the list, or follow [the steps to add a new one](https://help.expensify.com/articles/new-expensify/expenses-&-payments/Connect-a-Business-Bank-Account). ![Click the issue card button]({{site.url}}/assets/images/ExpensifyHelp-WorkspaceFeeds_02.png){:width="100%"} diff --git a/docs/articles/new-expensify/expensify-card/Upgrade-to-the-new-Expensify-Card-from-Visa.md b/docs/articles/new-expensify/expensify-card/Upgrade-to-the-new-Expensify-Card-from-Visa.md index 56e456eb1256..8fffec75e744 100644 --- a/docs/articles/new-expensify/expensify-card/Upgrade-to-the-new-Expensify-Card-from-Visa.md +++ b/docs/articles/new-expensify/expensify-card/Upgrade-to-the-new-Expensify-Card-from-Visa.md @@ -4,25 +4,26 @@ description: Get the new Expensify Visa® Commercial Card ---
-If your company is already using Expensify Cards, you can upgrade your cards for free to the new Expensify Visa® Commercial Card to get even more tools to manage employee spending, including: -- Unlimited virtual cards +When you upgrade the Expensify Cards to the new program, you'll have access to even more tools to manage employee spending, including: +- Unlimited [virtual cards](https://use.expensify.com/unlimited-virtual-cards) - Controlled spending amounts on virtual cards to manage subscriptions - Tighter controls for managing spend across employees and merchants -- Fixed or monthly spend limits for each card +- Fixed or monthly spending limits for each card - Unique naming for each virtual card for simplified expense categorization -# Upgrade your company’s Expensify Cards - {% include info.html %} -This process must be completed by a Domain Admin. Although the process is available for all Domain Admins, only one admin needs to complete these steps. +The Expensify Card upgrade must be completed by November 1, 2024. +{% include end-info.html %} -Before completing this process, you’ll want to: +# Upgrade your company’s Expensify Card program +This process must be completed by a Domain Admin. Any domain Admin can complete the upgrade, but only one admin needs to complete these steps. -- Have your employees update their address if needed so that they receive their new Expensify Card in the mail before completing the steps below. -- Ensure that existing cardholders have a limit greater than $0 if you want them to receive a new Expensify Card. If their limit is $0, increase the limit. -{% include end-info.html %} +**Before updating the card program:** +- Make sure your employees' address is up-to-date in their Expensify account +- Confirm the employees who should be receiving a new Expensify Card have a card limit set that's greater than $0 -1. On your Home page, click the task titled “Upgrade to the new and improved Expensify Card.” +## Steps to upgrade the Expensify Cards +1. On your Home page, click the task titled _Upgrade to the new and improved Expensify Card._ 2. Review and agree to the Terms of Service. 3. Click **Get the new card**. All existing cardholders with a limit greater than $0 will be automatically mailed a new physical card to the address they have on file. Virtual cards will be automatically issued and available for immediate use. 4. If you have Positive Pay enabled for your settlement account, contact your bank as soon as possible to whitelist the new ACH ID: 2270239450. @@ -36,19 +37,19 @@ Cards won’t be issued to any employees who don’t currently have them. In thi {% include faq-begin.md %} -**Why don’t I see the task to agree to new terms on my Home page?** +## Why don’t I see the task to agree to new terms on my Home page? There are a few reasons why you might not see the task on your Home page: - You may not be a Domain Admin - Another domain admin has already accepted the terms - The task may be hidden. To find hidden tasks, scroll to the bottom of the Home page and click **Show Hidden Tasks** to see all of your available tasks. -**Will this affect the continuous reconciliation process?** +## Will this affect the continuous reconciliation process? No. During the transition period, you may have some employees with old cards and some with new cards, so you’ll have two different debits (settlements) made to your settlement account for each settlement period. Once all spending has transitioned to the new cards, you’ll only see one debit/settlement. -**Do I have to upgrade to the new Expensify Visa® Commercial Card?** +## Do I have to upgrade to the new Expensify Visa® Commercial Card? -Yes. We’ll provide a deadline soon. But don’t worry—you’ll have plenty of time to upgrade. +Yes, the Expensify Cards will not work on the old program. This must be completed by November 1, 2024. {% include faq-end.md %}
diff --git a/docs/articles/new-expensify/settings/Add-or-Act-As-a-Copilot.md b/docs/articles/new-expensify/settings/Add-or-Act-As-a-Copilot.md new file mode 100644 index 000000000000..6be4e0451d22 --- /dev/null +++ b/docs/articles/new-expensify/settings/Add-or-Act-As-a-Copilot.md @@ -0,0 +1,78 @@ +--- +title: Add-or-Act-As-a-Copilot.md +description: How to add a Copilot or act as a Copilot for delegated account access +--- + + +Copilots can access another Expensify user’s account directly from their own Expensify account to: + +- View all expenses and chats visible from the other user’s account +- Prepare expenses on their behalf +- Approve and reimburse expense reports submitted to them +- View and make changes to their account, domain, and workspace settings + +Copilots **cannot** add additional Copilots. + +# Add a Copilot + +**To add a Copilot to your account:** + +1. Click your profile icon in the bottom left corner to open Settings +2. Click **Security** +3. Under Copilot: Delegated Access, click **Add copilot** +4. Search for the user you'd like to add as a Copilot using their name or email address +5. Select **Full** or **Limited** access + - **Full Access**: Grants access to take any actions in your account that you can take. This includes chat, submissions, approvals, payments, and settings. All Copilots (both Full and Limited access) are prevented from adding additional Copilots. + - **Limited Access**: Limited access excludes approvals, payments, rejections, and holds. +6. Click **Add Copilot** + +**Note:** You can invite someone to be your Copilot who doesn’t have an Expensify account yet. Your invitation will also help them create an account. + +# Remove or change a Copilot's access level + +**To remove a Copilot from your account:** + +1. Click your profile icon in the bottom left corner to open Settings +2. Click **Security** +3. Under Copilot: Delegated Access, click the three vertical dots next to the Copilot you'd like to remove, then click **Remove Copilot** +4. Click the red **Remove Copilot** button to confirm removal + +**To change a Copilot's access level:** + +1. Click your profile icon in the bottom left corner to open Settings +2. Click **Security** +3. Under Copilot: Delegated Access, click the three vertical dots next to the Copilot you'd like to change, then click **Change access level** +4. Select **Full** or **Limited** access + - **Full Access**: Grants access to take any actions in your account that you can take. This includes chat, submissions, approvals, payments, and settings. All Copilots (both Full and Limited access) are prevented from adding additional Copilots. + - **Limited Access**: Limited access excludes approvals, payments, rejections, and holds. + +# Act as a Copilot + +Once you have been added as a Copilot, you can switch between the account you’ve been granted Copilot access to and your own account on the Expensify website and mobile app. + +**To switch accounts:** + +1. Click your profile icon in the bottom left corner to open Settings +2. Click the up-down arrow next to your profile name in the top left corner to access the account switcher +3. Select the account you'd like to switch to. Each account will show the level of access you've been granted. + +A dual avatar displays in the bottom left corner to confirm that you are in Copilot mode. + +# Forward an email receipt as a Copilot +If you have been added to another user's account as their Copilot, you can forward email receipts to their account from your own email. + +1. Forward the email receipt +2. Add receipts@expensify.com to the To: field +3. For the email’s subject line, enter the email address of the account you are a Copilot for. This ensures the receipt is routed to the correct Expensify account. +4. Send the email + +# FAQ + +## As a Copilot, can I add or remove other Copilots? +No. Copilots are restricted from adding or removing Copilots from other accounts. Only the account owner can add or remove Copilots from their own account. The only exception is that Copilots can remove themselves from another user's account. + +## How can I tell which actions were taken by a Copilot? +Any action taken by a Copilot will be displayed as being taken by the Copilot on behalf of the account owner. + +## Can I have more than one Copilot? +You can assign as many Copilots as you need—there is no limit. However, you can only add one Copilot per minute. diff --git a/docs/articles/new-expensify/workspaces/Create-expense-categories.md b/docs/articles/new-expensify/workspaces/Create-expense-categories.md index 80588aa95d63..56557d449908 100644 --- a/docs/articles/new-expensify/workspaces/Create-expense-categories.md +++ b/docs/articles/new-expensify/workspaces/Create-expense-categories.md @@ -12,36 +12,41 @@ An admin can manually create categories for a workspace, or they will be automat # Manually add or delete categories +To manually add a category, + {% include selector.html values="desktop, mobile" %} {% include option.html value="desktop" %} -To manually add a category, - 1. Click your profile image or icon in the bottom left menu. 2. Scroll down and click **Workspaces** in the left menu. 3. Select the workspace you want to add categories to. 4. Click **Categories** in the left menu. 5. Click **Add Category** in the top right. 6. Enter a name for the category and click **Save**. - -To delete a category, - -1. Click the category on the Categories page. -2. Click the 3-dot menu in the top right. -3. Click **Delete category** to permanently delete the category. {% include end-option.html %} {% include option.html value="mobile" %} -To manually add a category, - 1. Tap your profile image or icon in the bottom menu. 2. Tap **Workspaces**. 3. Select the workspace you want to add categories to. 4. Tap **Categories**. 5. Tap **Add Category**. 6. Enter a name for the category and tap **Save**. +{% include end-option.html %} + +{% include end-selector.html %} To delete a category, + +{% include selector.html values="desktop, mobile" %} + +{% include option.html value="desktop" %} +1. Click the category on the Categories page. +2. Click the 3-dot menu in the top right. +3. Click **Delete category** to permanently delete the category. +{% include end-option.html %} + +{% include option.html value="mobile" %} 1. Tap the category on the Categories page. 2. Tap the 3-dot menu in the top right. 3. Tap **Delete category** to permanently delete the category. @@ -106,8 +111,7 @@ GL codes and payroll codes can be exported to a CSV export. They are not display 7. To add or edit a payroll code, click the payroll code field, make the desired change, then click **Save** - -# Automatic Expensify categories +# Apply categories to expenses automatically Over time, Expensify learns how you categorize specific merchants and automatically applies that category to the merchant in the future. - If you change a category, Expensify learns that correction over time as well. However, changing a category on one expense does not change it for other expenses that have already been assigned the category. @@ -129,6 +133,10 @@ Yes. When a category is manually edited, Expensify will log the change in the re If a category is disabled in the accounting system, it will be removed from the workspace’s categories list in the workspace. However, the disabled category will remain on approved and drafted expense reports that it has been previously added to. An admin can change the category on an approved or reimbursed expense, and anyone can change the category on an unapproved expense. +**How can my employees see the GL codes on categories?** + +GL codes added in the GL section of individual category settings are not visible to employees. If your employees need to see the GL code associated with a category, the category name would need to be edited to include it. + {% include faq-end.md %}
diff --git a/docs/articles/new-expensify/workspaces/Create-expense-tags.md b/docs/articles/new-expensify/workspaces/Create-expense-tags.md index cc76b4016856..fa4ce5327a27 100644 --- a/docs/articles/new-expensify/workspaces/Create-expense-tags.md +++ b/docs/articles/new-expensify/workspaces/Create-expense-tags.md @@ -6,17 +6,17 @@ description: Add tags to use for coding expenses In Expensify, tags refer to **classes, projects, cost centers, locations, customers, jobs**, and other line-item details that help code expenses for accounting and financial reporting. -An admin can manually create tags for a workspace, or they will be automatically imported if your workspace is connected to an accounting system, like QuickBooks Online or Xero. These imported tags can be enabled or disabled to use as tags for expenses added to Expensify. Additionally, Expensify will learn how you apply tags to specific merchants over time and apply them automatically. +An admin can manually create tags for a workspace, or they will be automatically imported if your workspace is connected to an accounting system, like QuickBooks Online, Intacct, Xero, or NetSuite. These imported tags can be enabled or disabled to use as tags for expenses added to Expensify. Additionally, Expensify will learn how you apply tags to specific merchants over time and apply them automatically. ![The Tags tab]({{site.url}}/assets/images/ExpensifyHelp_R4_Tags_2.png){:width="100%"} # Manually add or delete tags +To manually add a tag, + {% include selector.html values="desktop, mobile" %} {% include option.html value="desktop" %} -To manually add a tag, - 1. Click your profile image or icon in the bottom left menu. 2. Scroll down and click **Workspaces** in the left menu. 3. Select the workspace you want to add tags to. @@ -25,19 +25,9 @@ To manually add a tag, 6. Click **Tags** in the left menu. 7. Click **Add Tag** in the top right. 8. Enter a name for the tag and click **Save**. - -![The toggle to enable Tags]({{site.url}}/assets/images/ExpensifyHelp_R4_Tags_1.png){:width="100%"} - -To delete a tag, - -1. Click the tag on the Tags page. -2. Click the 3-dot menu in the top right. -3. Click **Delete tag** to permanently delete the tag. {% include end-option.html %} {% include option.html value="mobile" %} -To manually add a tag, - 1. Tap your profile image or icon in the bottom menu. 2. Tap **Workspaces**. 3. Select the workspace you want to add tags to. @@ -46,10 +36,26 @@ To manually add a tag, 6. Tap **Tags**. 7. Tap **Add Tag**. 8. Enter a name for the tag and tap **Save**. +{% include end-option.html %} +{% include end-selector.html %} + +![The toggle to enable Tags]({{site.url}}/assets/images/ExpensifyHelp_R4_Tags_1.png){:width="100%"} + +To delete a tag, + +{% include selector.html values="desktop, mobile" %} + +{% include option.html value="desktop" %} +1. Click the tag on the Tags page. +2. Click the 3-dot menu in the top right. +3. Click **Delete tag** to permanently delete the tag. +{% include end-option.html %} + +{% include option.html value="mobile" %} To delete a tag, 1. Tap the tag on the Tags page. -2. Tap the 3-dot menu in the top right. +2. Tap the three-dot menu in the top right. 3. Tap **Delete tag** to permanently delete the tag. {% include end-option.html %} @@ -95,23 +101,22 @@ You can enable, disable, or delete tags in bulk by selecting the checkbox to the {% include end-selector.html %} -# Add or edit a GL code or payroll code +# Add or edit a GL code -If your workspace is on the Control plan, you can optionally add a GL code and payroll code to each category. Collect plan users will need to upgrade to Control for access to GL codes and payroll codes. +If your workspace is on the Control plan, you can optionally add a GL code to each tag. Collect plan users will need to upgrade to Control for access to GL codes. -GL codes and payroll codes can be exported to a CSV export. They are not displayed to users. +GL codes can be exported to a CSV export. They are not displayed to users. -**To edit GL codes or payroll codes for a category:** +**To edit GL codes for a tag:** 1. Click your profile image or icon in the bottom left menu 2. Click **Workspaces** in the left menu 3. Select a workspace -4. Click **Categories** -5. Click a category to open the category-settings +4. Click **Tags** +5. Click a tag to open the tag-settings 6. To add or edit a GL code, click the GL code field, make the desired change, then click **Save** -7. To add or edit a payroll code, click the payroll code field, make the desired change, then click **Save** -# Automatic Expensify tags +# Apply tags to expenses automatically Over time, Expensify learns how you tag specific merchants and automatically applies that tag to the merchant in the future. - If you change a tag, Expensify learns that correction over time as well. However, changing a tag on one expense does not change it for other expenses that have already been assigned the tag. diff --git a/docs/assets/images/ExpensifyHelp-AttendeeTracking-1.png b/docs/assets/images/ExpensifyHelp-AttendeeTracking-1.png new file mode 100644 index 000000000000..e3c08b9133b8 Binary files /dev/null and b/docs/assets/images/ExpensifyHelp-AttendeeTracking-1.png differ diff --git a/docs/assets/images/quickbooks-desktop-access-rights.png b/docs/assets/images/quickbooks-desktop-access-rights.png new file mode 100644 index 000000000000..bcdd35b8c827 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-access-rights.png differ diff --git a/docs/assets/images/quickbooks-desktop-advanced-settings.png b/docs/assets/images/quickbooks-desktop-advanced-settings.png new file mode 100644 index 000000000000..181380ed7674 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-advanced-settings.png differ diff --git a/docs/assets/images/quickbooks-desktop-coding-settings.png b/docs/assets/images/quickbooks-desktop-coding-settings.png new file mode 100644 index 000000000000..7b9fc8086c9f Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-coding-settings.png differ diff --git a/docs/assets/images/quickbooks-desktop-company-preferences.png b/docs/assets/images/quickbooks-desktop-company-preferences.png new file mode 100644 index 000000000000..31f2be54bfb8 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-company-preferences.png differ diff --git a/docs/assets/images/quickbooks-desktop-export-settings.png b/docs/assets/images/quickbooks-desktop-export-settings.png new file mode 100644 index 000000000000..3ff190bc2d60 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-export-settings.png differ diff --git a/docs/assets/images/quickbooks-desktop-exported-report-comments.png b/docs/assets/images/quickbooks-desktop-exported-report-comments.png new file mode 100644 index 000000000000..2b0d2939e4b0 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-exported-report-comments.png differ diff --git a/docs/assets/images/quickbooks-desktop-web-connector.png b/docs/assets/images/quickbooks-desktop-web-connector.png new file mode 100644 index 000000000000..b2086420edd8 Binary files /dev/null and b/docs/assets/images/quickbooks-desktop-web-connector.png differ diff --git a/docs/redirects.csv b/docs/redirects.csv index 783e13f8de07..90baeff59260 100644 --- a/docs/redirects.csv +++ b/docs/redirects.csv @@ -583,3 +583,7 @@ https://community.expensify.com/discussion/47/auto-sync-best-practices,https://h https://community.expensify.com/discussion/6699/faq-troubleshooting-known-bank-specific-issues,https://help.expensify.com/expensify-classic/hubs/bank-accounts-and-payments/bank-accounts https://community.expensify.com/discussion/4730/faq-expenses-are-exporting-to-the-wrong-accounts-whys-that,https://help.expensify.com/articles/expensify-classic/connect-credit-cards/company-cards/Company-Card-Settings https://community.expensify.com/discussion/9000/how-to-integrate-with-deel,https://help.expensify.com/articles/expensify-classic/connections/Deel +https://community.expensify.com/categories/expensify-classroom,https://use.expensify.com +https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Send-Receive-for-Invoices,https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Send-and-Receive-Payment-for-Invoices.md +https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Bulk-Upload-Multiple-Invoices,https://help.expensify.com/articles/expensify-classic/articles/expensify-classic/expenses/Add-Invoices-in-Bulk +https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/payments/Pay-Bills,https://help.expensify.com/articles/expensify-classic/bank-accounts-and-payments/payments/Create-and-Pay-Bills diff --git a/help/_includes/search.html b/help/_includes/search.html new file mode 100644 index 000000000000..7b024ba8ec33 --- /dev/null +++ b/help/_includes/search.html @@ -0,0 +1,363 @@ +
+ + + + + +
+ + + + + + + + + + diff --git a/help/_layouts/default.html b/help/_layouts/default.html index cf95e1f54b06..cf8c7feeaea0 100644 --- a/help/_layouts/default.html +++ b/help/_layouts/default.html @@ -4,22 +4,390 @@ {{ page.title }} + + -
-