@barchart/portfolio-client-js 1.3.6 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,11 +58,11 @@ module.exports = function () {
58
58
  if (host === Configuration.developmentHost) {
59
59
  return '7enbtpamgg.execute-api.us-east-1.amazonaws.com/dev';
60
60
  } else if (host === Configuration.stagingHost) {
61
- return '';
61
+ return 'i98b1sdxp6.execute-api.us-east-1.amazonaws.com/stage';
62
62
  } else if (host === Configuration.productionHost) {
63
- return '';
63
+ return 'xos40seq3e.execute-api.us-east-1.amazonaws.com/prod';
64
64
  } else if (host === Configuration.adminHost) {
65
- return '';
65
+ return 'q1x45oxon1.execute-api.us-east-1.amazonaws.com/admin';
66
66
  } else {
67
67
  return '';
68
68
  }
@@ -123,6 +123,20 @@ module.exports = function () {
123
123
  get: function get() {
124
124
  return 'portfolio-admin.aws.barchart.com';
125
125
  }
126
+
127
+ /**
128
+ * The host of the public demo system.
129
+ *
130
+ * @public
131
+ * @static
132
+ * @return {String}
133
+ */
134
+
135
+ }, {
136
+ key: 'demoHost',
137
+ get: function get() {
138
+ return 'portfolio-demo.aws.barchart.com';
139
+ }
126
140
  }]);
127
141
 
128
142
  return Configuration;
@@ -307,7 +321,7 @@ module.exports = function () {
307
321
  }).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
308
322
 
309
323
  _this._brokerageReportUrlGenerator = function (user, portfolio, frame, end) {
310
- return 'https://' + Configuration.getBrokerageHost(host) + '/binary/reports/portfolios/' + portfolio + '/frames/' + frame.code + '/date/' + end.format() + '/' + user;
324
+ return 'https://' + Configuration.getBrokerageHost(host) + '/reports/portfolios/' + portfolio + '/frames/' + frame.code + '/date/' + end.format() + '/' + user;
311
325
  };
312
326
  return _this;
313
327
  }
@@ -1538,6 +1552,38 @@ module.exports = function () {
1538
1552
  return jwtGateway.toRequestInterceptor();
1539
1553
  });
1540
1554
  }
1555
+
1556
+ /**
1557
+ * Creates and starts a new {@link JwtGateway} for use in the demo environment.
1558
+ *
1559
+ * @public
1560
+ * @static
1561
+ * @param {String} userId - The identifier of the user to impersonate.
1562
+ * @returns {Promise<JwtGateway>}
1563
+ */
1564
+
1565
+ }, {
1566
+ key: 'forDemo',
1567
+ value: function forDemo(userId) {
1568
+ return start(new JwtGateway(_forDemo(userId), 180000));
1569
+ }
1570
+
1571
+ /**
1572
+ * Creates and starts a new {@link RequestInterceptor} for use in the demo environment.
1573
+ *
1574
+ * @public
1575
+ * @static
1576
+ * @param {String} userId - The identifier of the user to impersonate.
1577
+ * @returns {Promise<RequestInterceptor>}
1578
+ */
1579
+
1580
+ }, {
1581
+ key: 'forDemoClient',
1582
+ value: function forDemoClient(userId) {
1583
+ return JwtGateway.forDemo(userId).then(function (jwtGateway) {
1584
+ return jwtGateway.toRequestInterceptor();
1585
+ });
1586
+ }
1541
1587
  }]);
1542
1588
 
1543
1589
  return JwtGateway;
@@ -1595,6 +1641,14 @@ module.exports = function () {
1595
1641
  }).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1596
1642
  }
1597
1643
 
1644
+ function _forDemo(userId) {
1645
+ return EndpointBuilder.for('read-jwt-token-for-demo', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.developmentHost).withPathBuilder(function (pb) {
1646
+ pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1647
+ }).withQueryBuilder(function (qb) {
1648
+ qb.withLiteralParameter('user', 'userId', userId).withLiteralParameter('legacy user', 'userLegacyId', userId).withLiteralParameter('user context', 'userContext', 'Barchart').withLiteralParameter('user permission level', 'userPermissions', 'registered');
1649
+ }).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1650
+ }
1651
+
1598
1652
  return JwtGateway;
1599
1653
  }();
1600
1654
 
@@ -1610,7 +1664,7 @@ module.exports = function () {
1610
1664
  return {
1611
1665
  JwtGateway: JwtGateway,
1612
1666
  PortfolioGateway: PortfolioGateway,
1613
- version: '1.3.6'
1667
+ version: '1.3.9'
1614
1668
  };
1615
1669
  }();
1616
1670
 
@@ -4398,7 +4452,7 @@ module.exports = function () {
4398
4452
  *
4399
4453
  * @public
4400
4454
  * @param {*} value - The value of the node.
4401
- * @param {Tree=} parent - The parent node. If not supplied, this will be the root node.
4455
+ * @param {Tree} parent - The parent node. If not supplied, this will be the root node.
4402
4456
  */
4403
4457
 
4404
4458
  var Tree = function () {
@@ -5435,32 +5489,6 @@ module.exports = function () {
5435
5489
  return this.addYears(years, true);
5436
5490
  }
5437
5491
 
5438
- /**
5439
- * Returns a new {@link Day} instance for the start of the month referenced by the current instance.
5440
- *
5441
- * @public
5442
- * @returns {Day}
5443
- */
5444
-
5445
- }, {
5446
- key: 'getStartOfMonth',
5447
- value: function getStartOfMonth() {
5448
- return new Day(this.year, this.month, 1);
5449
- }
5450
-
5451
- /**
5452
- * Returns a new instance for the {@link Day} end of the month referenced by the current instance.
5453
- *
5454
- * @public
5455
- * @returns {Day}
5456
- */
5457
-
5458
- }, {
5459
- key: 'getEndOfMonth',
5460
- value: function getEndOfMonth() {
5461
- return new Day(this.year, this.month, Day.getDaysInMonth(this.year, this.month));
5462
- }
5463
-
5464
5492
  /**
5465
5493
  * Indicates if another {@link Day} occurs before the current instance.
5466
5494
  *
@@ -5601,7 +5629,7 @@ module.exports = function () {
5601
5629
  return this._month;
5602
5630
  }
5603
5631
 
5604
- /**day
5632
+ /**
5605
5633
  * The day of the month.
5606
5634
  *
5607
5635
  * @public
@@ -5622,7 +5650,7 @@ module.exports = function () {
5622
5650
  }
5623
5651
 
5624
5652
  /**
5625
- * Converts a string (which matches the output of {@link Day#format}) into
5653
+ * Converts a string (which matches the output of {@link Day#format} into
5626
5654
  * a {@link Day} instance.
5627
5655
  *
5628
5656
  * @public
@@ -5893,24 +5921,6 @@ module.exports = function () {
5893
5921
  return new Decimal(this._big.div(getBig(other)));
5894
5922
  }
5895
5923
 
5896
- /**
5897
- * Returns a new {@link Decimal} instance with a value that results
5898
- * from raising the current instance to the power of the exponent
5899
- * provided.
5900
- *
5901
- * @public
5902
- * @param {Decimal|Number|String} exponent
5903
- * @returns {Decimal}
5904
- */
5905
-
5906
- }, {
5907
- key: 'raise',
5908
- value: function raise(exponent) {
5909
- assert.argumentIsRequired(exponent, 'exponent', Number);
5910
-
5911
- return new Decimal(this._big.pow(exponent));
5912
- }
5913
-
5914
5924
  /**
5915
5925
  * Returns a new {@link Decimal} with a value resulting from a rounding
5916
5926
  * operation on the current value.
@@ -6075,28 +6085,6 @@ module.exports = function () {
6075
6085
  return this._big.eq(getBig(other));
6076
6086
  }
6077
6087
 
6078
- /**
6079
- * Returns true is close to another value.
6080
- *
6081
- * @public
6082
- * @param {Decimal|Number|String} other - The value to compare.
6083
- * @param {Number} places - The significant digits.
6084
- * @returns {Boolean}
6085
- */
6086
-
6087
- }, {
6088
- key: 'getIsApproximate',
6089
- value: function getIsApproximate(other, places) {
6090
- if (places === 0) {
6091
- return this.getIsEqual(other);
6092
- }
6093
-
6094
- var difference = this.subtract(other).absolute();
6095
- var tolerance = Decimal.ONE.divide(new Decimal(10).raise(places));
6096
-
6097
- return difference.getIsLessThan(tolerance);
6098
- }
6099
-
6100
6088
  /**
6101
6089
  * Returns true if the current instance is an integer (i.e. has no decimal
6102
6090
  * component).
@@ -7623,62 +7611,8 @@ module.exports = function () {
7623
7611
  }
7624
7612
 
7625
7613
  return found;
7626
- },
7627
-
7628
-
7629
- /**
7630
- * Inserts an item into an array using a binary search is used to determine the
7631
- * proper point for insertion and returns the same array.
7632
- *
7633
- * @static
7634
- * @public
7635
- * @param {Array} a
7636
- * @param {*} item
7637
- * @param {Function} comparator
7638
- * @returns {Array}
7639
- */
7640
- insert: function insert(a, item, comparator) {
7641
- assert.argumentIsArray(a, 'a');
7642
- assert.argumentIsRequired(comparator, 'comparator', Function);
7643
-
7644
- if (a.length === 0 || !(comparator(item, a[a.length - 1]) < 0)) {
7645
- a.push(item);
7646
- } else if (comparator(item, a[0]) < 0) {
7647
- a.unshift(item);
7648
- } else {
7649
- a.splice(binarySearch(a, item, comparator, 0, a.length - 1), 0, item);
7650
- }
7651
-
7652
- return a;
7653
7614
  }
7654
7615
  };
7655
-
7656
- function binarySearch(array, item, comparator, start, end) {
7657
- var size = end - start;
7658
-
7659
- var midpointIndex = start + Math.floor(size / 2);
7660
- var midpointItem = array[midpointIndex];
7661
-
7662
- var comparison = comparator(item, midpointItem) > 0;
7663
-
7664
- if (size < 2) {
7665
- if (comparison > 0) {
7666
- var finalIndex = array.length - 1;
7667
-
7668
- if (end === finalIndex && comparator(item, array[finalIndex]) > 0) {
7669
- return end + 1;
7670
- } else {
7671
- return end;
7672
- }
7673
- } else {
7674
- return start;
7675
- }
7676
- } else if (comparison > 0) {
7677
- return binarySearch(array, item, comparator, midpointIndex, end);
7678
- } else {
7679
- return binarySearch(array, item, comparator, start, midpointIndex);
7680
- }
7681
- }
7682
7616
  }();
7683
7617
 
7684
7618
  },{"./assert":37,"./is":40}],37:[function(require,module,exports){
@@ -8134,7 +8068,7 @@ module.exports = function () {
8134
8068
  * @static
8135
8069
  * @public
8136
8070
  * @param {*} candidate
8137
- * @returns {boolean}
8071
+ * @returns {*|boolean}
8138
8072
  */
8139
8073
  negative: function negative(candidate) {
8140
8074
  return this.number(candidate) && candidate < 0;
@@ -9961,7 +9895,7 @@ module.exports = function () {
9961
9895
  *
9962
9896
  * @public
9963
9897
  * @param {Function} actionToBackoff - The action to attempt. If it fails -- because an error is thrown, a promise is rejected, or the function returns a falsey value -- the action will be invoked again.
9964
- * @param {number=} millisecondDelay - The amount of time to wait to execute the action. Subsequent failures are multiply this value by 2 ^ [number of failures]. So, a 1000 millisecond backoff would schedule attempts using the following delays: 0, 1000, 2000, 4000, 8000, etc. If not specified, the first attempt will execute immediately, then a value of 1000 will be used.
9898
+ * @param {number=} millisecondDelay - The amount of time to wait to execute the action. Subsequent failures are multiply this value by 2 ^ [number of failures]. So, a 1000 millisecond backoff would schedule attempts using the following delays: 0, 1000, 2000, 4000, 8000, etc. If not specified, the first attemopt will execute immediately, then a value of 1000 will be used.
9965
9899
  * @param {string=} actionDescription - Description of the action to attempt, used for logging purposes.
9966
9900
  * @param {number=} maximumAttempts - The number of attempts to before giving up.
9967
9901
  * @param {Function=} failureCallback - If provided, will be invoked if a function is considered to be failing.
@@ -9985,61 +9919,59 @@ module.exports = function () {
9985
9919
  throw new Error('The Scheduler has been disposed.');
9986
9920
  }
9987
9921
 
9988
- var processAction = function processAction(attempts) {
9989
- return Promise.resolve().then(function () {
9990
- var delay = void 0;
9922
+ var scheduleBackoff = function scheduleBackoff(failureCount, e) {
9923
+ if (failureCount > 0 && is.fn(failureCallback)) {
9924
+ failureCallback(failureCount);
9925
+ }
9991
9926
 
9992
- if (attempts === 0) {
9993
- delay = 0;
9994
- } else {
9995
- delay = (millisecondDelay || 1000) * Math.pow(2, attempts - 1);
9996
- }
9927
+ if (maximumAttempts > 0 && failureCount > maximumAttempts) {
9928
+ var message = 'Maximum failures reached for ' + actionDescription;
9997
9929
 
9998
- return _this4.schedule(actionToBackoff, delay, 'Attempt [ ' + attempts + ' ] for [ ' + (actionDescription || 'unnamed action') + ' ]');
9999
- }).then(function (result) {
10000
- var resultPromise = void 0;
9930
+ var rejection = void 0;
10001
9931
 
10002
- if (!is.undefined(failureValue) && object.equals(result, failureValue)) {
10003
- resultPromise = Promise.reject('Attempt [ ' + attempts + ' ] for [ ' + (actionDescription || 'unnamed action') + ' ] failed due to invalid result');
10004
- } else {
10005
- resultPromise = Promise.resolve(result);
10006
- }
9932
+ if (e) {
9933
+ e.backoff = message;
10007
9934
 
10008
- return resultPromise;
10009
- }).catch(function (e) {
10010
- if (is.fn(failureCallback)) {
10011
- failureCallback(attempts);
9935
+ rejection = e;
9936
+ } else {
9937
+ rejection = message;
10012
9938
  }
10013
9939
 
10014
- return Promise.reject(e);
10015
- });
10016
- };
10017
-
10018
- var attempts = 0;
9940
+ return Promise.reject(rejection);
9941
+ }
10019
9942
 
10020
- var processActionRecursive = function processActionRecursive() {
10021
- return processAction(attempts++).catch(function (e) {
10022
- if (maximumAttempts > 0 && attempts === maximumAttempts) {
10023
- var message = 'Maximum failures reached for ' + (actionDescription || 'unnamed action');
9943
+ var backoffDelay = void 0;
10024
9944
 
10025
- var rejectPromise = void 0;
9945
+ if (failureCount === 0) {
9946
+ backoffDelay = millisecondDelay || 0;
9947
+ } else {
9948
+ backoffDelay = (millisecondDelay || 1000) * Math.pow(2, failureCount);
9949
+ }
10026
9950
 
10027
- if (is.object(e)) {
10028
- e.backoff = message;
9951
+ var successPredicate = void 0;
10029
9952
 
10030
- rejectPromise = Promise.reject(e);
10031
- } else {
10032
- rejectPromise = Promise.reject(message);
10033
- }
9953
+ if (is.undefined(failureValue)) {
9954
+ successPredicate = function successPredicate(value) {
9955
+ return value;
9956
+ };
9957
+ } else {
9958
+ successPredicate = function successPredicate(value) {
9959
+ return !object.equals(value, failureValue);
9960
+ };
9961
+ }
10034
9962
 
10035
- return rejectPromise;
9963
+ return _this4.schedule(actionToBackoff, backoffDelay, (actionDescription || 'unspecified') + ', attempt ' + (failureCount + 1)).then(function (result) {
9964
+ if (successPredicate(result)) {
9965
+ return result;
10036
9966
  } else {
10037
- return processActionRecursive();
9967
+ return scheduleBackoff(++failureCount);
10038
9968
  }
9969
+ }).catch(function (e) {
9970
+ return scheduleBackoff(++failureCount, e);
10039
9971
  });
10040
9972
  };
10041
9973
 
10042
- return processActionRecursive();
9974
+ return scheduleBackoff(0);
10043
9975
  });
10044
9976
  }
10045
9977
  }, {
@@ -10100,10 +10032,9 @@ module.exports = (() => {
10100
10032
  *
10101
10033
  * @public
10102
10034
  * @extends {Enum}
10103
- * @param {String} code
10104
10035
  * @param {String} description
10105
10036
  * @param {String} alternateDescription
10106
- * @param {Boolean} canExistEmpty
10037
+ * @param {String} code
10107
10038
  * @param {Boolean} canReinvest
10108
10039
  * @param {Boolean} canShort
10109
10040
  * @param {Boolean} canSwitchDirection
@@ -10115,11 +10046,10 @@ module.exports = (() => {
10115
10046
  * @param {Function} generator
10116
10047
  */
10117
10048
  class InstrumentType extends Enum {
10118
- constructor(code, description, alternateDescription, canExistEmpty, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
10049
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
10119
10050
  super(code, description);
10120
10051
 
10121
10052
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
10122
- assert.argumentIsRequired(canExistEmpty, 'canExistEmpty', Boolean);
10123
10053
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
10124
10054
  assert.argumentIsRequired(canShort, 'canShort', Boolean);
10125
10055
  assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
@@ -10131,8 +10061,6 @@ module.exports = (() => {
10131
10061
  assert.argumentIsRequired(generator, 'generator', Function);
10132
10062
 
10133
10063
  this._alternateDescription = alternateDescription;
10134
-
10135
- this._canExistEmpty = canExistEmpty;
10136
10064
  this._canReinvest = canReinvest;
10137
10065
  this._canShort = canShort;
10138
10066
  this._canSwitchDirection = canSwitchDirection;
@@ -10155,16 +10083,6 @@ module.exports = (() => {
10155
10083
  return this._alternateDescription;
10156
10084
  }
10157
10085
 
10158
- /**
10159
- * Indicates if the position can exist without any associated transactions.
10160
- *
10161
- * @public
10162
- * @returns {Boolean}
10163
- */
10164
- get canExistEmpty() {
10165
- return this._canExistEmpty;
10166
- }
10167
-
10168
10086
  /**
10169
10087
  * Indicates if the instrument type allows automatic reinvestment.
10170
10088
  *
@@ -10345,10 +10263,10 @@ module.exports = (() => {
10345
10263
  }
10346
10264
  }
10347
10265
 
10348
- const cash = new InstrumentType('CASH', 'cash', 'Cash', true, false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
10349
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', false, true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
10350
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', false, true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
10351
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
10266
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
10267
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
10268
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
10269
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
10352
10270
 
10353
10271
  const map = { };
10354
10272
 
@@ -10557,7 +10475,7 @@ module.exports = (() => {
10557
10475
  *
10558
10476
  * @public
10559
10477
  * @param {Number} periods
10560
- * @returns {PositionSummaryRange[]}
10478
+ * @returns {Array.<PositionSummaryRange>}
10561
10479
  */
10562
10480
  getRecentRanges(periods) {
10563
10481
  const startDate = this.getStartDate(periods);
@@ -10570,8 +10488,8 @@ module.exports = (() => {
10570
10488
  * Returns the ranges for the set of {@link Transaction} objects.
10571
10489
  *
10572
10490
  * @public
10573
- * @param {Transaction[]} transactions
10574
- * @returns {PositionSummaryRange[]}
10491
+ * @param {Array.<Transaction>} transactions
10492
+ * @returns {Array.<PositionSummaryRange>}
10575
10493
  */
10576
10494
  getRanges(transactions) {
10577
10495
  assert.argumentIsArray(transactions, 'transactions');
@@ -10584,7 +10502,7 @@ module.exports = (() => {
10584
10502
  *
10585
10503
  * @public
10586
10504
  * @param {Day} date
10587
- * @return {PositionSummaryRange[]}
10505
+ * @return {Array.<PositionSummaryRange>}
10588
10506
  */
10589
10507
  getRangesFromDate(date) {
10590
10508
  assert.argumentIsRequired(date, 'date', Day, 'Day');
@@ -10673,8 +10591,8 @@ module.exports = (() => {
10673
10591
  }
10674
10592
 
10675
10593
  const yearly = new PositionSummaryFrame('YEARLY', 'year', false, getYearlyRanges, getYearlyStartDate, getYearlyRangeDescription);
10676
- const quarterly = new PositionSummaryFrame('QUARTERLY', 'quarter', false, getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
10677
- const monthly = new PositionSummaryFrame('MONTHLY', 'month', false, getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
10594
+ const quarterly = new PositionSummaryFrame('QUARTER', 'quarter', false, getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
10595
+ const monthly = new PositionSummaryFrame('MONTH', 'month', false, getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
10678
10596
  const ytd = new PositionSummaryFrame('YTD', 'year-to-date', true, getYearToDateRanges, getYearToDateStartDate, getYearToDateRangeDescription);
10679
10597
 
10680
10598
  /**
@@ -10734,36 +10652,7 @@ module.exports = (() => {
10734
10652
  }
10735
10653
 
10736
10654
  function getMonthlyRanges(transactions) {
10737
- const ranges = [ ];
10738
-
10739
- if (transactions.length !== 0) {
10740
- const today = Day.getToday();
10741
-
10742
- const first = array.first(transactions);
10743
- const last = array.last(transactions);
10744
-
10745
- const firstDate = first.date;
10746
-
10747
- let lastDate;
10748
-
10749
- if (last.snapshot.open.getIsZero()) {
10750
- lastDate = last.date;
10751
- } else {
10752
- lastDate = today;
10753
- }
10754
-
10755
- if (today.month === lastDate.month && today.year === lastDate.year) {
10756
- lastDate = lastDate.subtractMonths(1);
10757
- }
10758
-
10759
- lastDate = lastDate.getEndOfMonth();
10760
-
10761
- for (let end = firstDate.getEndOfMonth(); !end.getIsAfter(lastDate); end = end.addMonths(1).getEndOfMonth()) {
10762
- ranges.push(getRange(end.subtractMonths(1).getEndOfMonth(), end));
10763
- }
10764
- }
10765
-
10766
- return ranges;
10655
+ return [ ];
10767
10656
  }
10768
10657
 
10769
10658
  function getYearToDateRanges(transactions) {
@@ -10800,11 +10689,7 @@ module.exports = (() => {
10800
10689
  }
10801
10690
 
10802
10691
  function getMonthlyStartDate(periods, date) {
10803
- const today = date || Day.getToday();
10804
-
10805
- return today
10806
- .subtractMonths(periods)
10807
- .subtractDays(today.day);
10692
+ return null;
10808
10693
  }
10809
10694
 
10810
10695
  function getYearToDateStartDate(periods, date) {
@@ -10812,7 +10697,7 @@ module.exports = (() => {
10812
10697
  }
10813
10698
 
10814
10699
  function getYearlyRangeDescription(start, end) {
10815
- return `Year ended ${end.format()}`;
10700
+ return `Year ended ${end.year.toString()}`;
10816
10701
  }
10817
10702
 
10818
10703
  function getQuarterlyRangeDescription(start, end) {
@@ -10820,7 +10705,7 @@ module.exports = (() => {
10820
10705
  }
10821
10706
 
10822
10707
  function getMonthlyRangeDescription(start, end) {
10823
- return `Month ended ${end.format()}`;
10708
+ return '';
10824
10709
  }
10825
10710
 
10826
10711
  function getYearToDateRangeDescription(start, end) {
@@ -10865,7 +10750,7 @@ module.exports = (() => {
10865
10750
  * @param {Boolean} corporateAction
10866
10751
  * @param {Boolean} initial
10867
10752
  * @param {Boolean} significant
10868
- * @param {Boolean} system
10753
+ * @param {Boolean} eod
10869
10754
  */
10870
10755
  class TransactionType extends Enum {
10871
10756
  constructor(code, description, display, sequence, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
@@ -11195,17 +11080,6 @@ module.exports = (() => {
11195
11080
  static get DEBIT() {
11196
11081
  return debit;
11197
11082
  }
11198
-
11199
- /**
11200
- * A system-generated transaction, indicating the security has stopped active trading.
11201
- *
11202
- * @public
11203
- * @static
11204
- * @returns {TransactionType}
11205
- */
11206
- static get DELIST() {
11207
- return delist;
11208
- }
11209
11083
 
11210
11084
  /**
11211
11085
  * A system-generated deposit, arising from another transaction.
@@ -11255,7 +11129,6 @@ module.exports = (() => {
11255
11129
  const split = new TransactionType('SP', 'Split', 'Split', 1, false, false, false, true, false, false, true, false, false);
11256
11130
  const fee = new TransactionType('F', 'Fee', 'Fee', 0, false, false, false, false, false, true, false, false, false);
11257
11131
  const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', 0, false, false, false, false, true, false, false, false, false);
11258
- const delist = new TransactionType('DL', 'Delist', 'Delist', 1, false, false, false, false, false, false, true, false, false);
11259
11132
 
11260
11133
  const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', 1, false, false, true, false, false, false, true, false, false);
11261
11134
  const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', 1, false, false, false, true, false, false, true, false, false);
@@ -11891,10 +11764,6 @@ module.exports = (() => {
11891
11764
  static get VALUATION() {
11892
11765
  return valuation;
11893
11766
  }
11894
-
11895
- static get DELIST() {
11896
- return delist;
11897
- }
11898
11767
 
11899
11768
  static get INCOME() {
11900
11769
  return income;
@@ -12099,23 +11968,12 @@ module.exports = (() => {
12099
11968
  .withField('sequence', DataType.NUMBER, true)
12100
11969
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
12101
11970
  .withField('date', DataType.DAY)
12102
- .withField('rate', DataType.DECIMAL, true)
12103
- .withField('value', DataType.DECIMAL, true)
12104
- .withField('force', DataType.BOOLEAN, true)
12105
- .schema
12106
- );
12107
-
12108
- const delist = new TransactionSchema(SchemaBuilder.withName(TransactionType.DELIST.code)
12109
- .withField('portfolio', DataType.STRING)
12110
- .withField('position', DataType.STRING)
12111
- .withField('sequence', DataType.NUMBER, true)
12112
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
12113
- .withField('date', DataType.DAY)
11971
+ .withField('value', DataType.DECIMAL)
12114
11972
  .withField('force', DataType.BOOLEAN, true)
12115
11973
  .schema
12116
11974
  );
12117
-
12118
- const income = new TransactionSchema(SchemaBuilder.withName(TransactionType.INCOME.code)
11975
+
11976
+ const income = new TransactionSchema(SchemaBuilder.withName(TransactionType.INCOME.code)
12119
11977
  .withField('portfolio', DataType.STRING)
12120
11978
  .withField('position', DataType.STRING)
12121
11979
  .withField('sequence', DataType.NUMBER, true)
@@ -12141,7 +11999,6 @@ module.exports = (() => {
12141
11999
  addSchemaToMap(TransactionType.DEPOSIT, deposit);
12142
12000
  addSchemaToMap(TransactionType.WITHDRAWAL, withdrawal);
12143
12001
  addSchemaToMap(TransactionType.VALUATION, valuation);
12144
- addSchemaToMap(TransactionType.DELIST, delist);
12145
12002
  addSchemaToMap(TransactionType.INCOME, income);
12146
12003
 
12147
12004
  return TransactionSchema;
@@ -12274,7 +12131,7 @@ module.exports = function () {
12274
12131
  * containing the current instance
12275
12132
  *
12276
12133
  * @public
12277
- * @returns {Promise<JwtGateway>}
12134
+ * @returns {Promise.<JwtGateway>}
12278
12135
  */
12279
12136
 
12280
12137
 
@@ -12304,7 +12161,7 @@ module.exports = function () {
12304
12161
  * Retrieves a JWT token from the remote server.
12305
12162
  *
12306
12163
  * @public
12307
- * @returns {Promise<String>}
12164
+ * @returns {Promise.<String>}
12308
12165
  */
12309
12166
 
12310
12167
  }, {
@@ -12344,7 +12201,7 @@ module.exports = function () {
12344
12201
  var refreshToken = function refreshToken() {
12345
12202
  var refreshPromise = scheduler.backoff(function () {
12346
12203
  return _this4.readToken();
12347
- }, 0, 'Read JWT token', 3).then(function (token) {
12204
+ }, 100, 'Read JWT token', 3).then(function (token) {
12348
12205
  if (_this4._refreshInterval > 0) {
12349
12206
  cachePromise = refreshPromise;
12350
12207
 
@@ -12412,8 +12269,8 @@ module.exports = function () {
12412
12269
  *
12413
12270
  * @public
12414
12271
  * @static
12415
- * @param {Promise<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
12416
- * @returns {Promise<JwtGateway>}
12272
+ * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
12273
+ * @returns {Promise.<JwtGateway>}
12417
12274
  */
12418
12275
 
12419
12276
  }, {
@@ -12441,8 +12298,8 @@ module.exports = function () {
12441
12298
  *
12442
12299
  * @public
12443
12300
  * @static
12444
- * @param {Promise<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
12445
- * @returns {Promise<RequestInterceptor>}
12301
+ * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
12302
+ * @returns {Promise.<RequestInterceptor>}
12446
12303
  */
12447
12304
 
12448
12305
  }, {
@@ -12458,7 +12315,7 @@ module.exports = function () {
12458
12315
  *
12459
12316
  * @public
12460
12317
  * @static
12461
- * @returns {Promise<JwtGateway>}
12318
+ * @returns {Promise.<JwtGateway>}
12462
12319
  */
12463
12320
 
12464
12321
  }, {
@@ -12472,7 +12329,7 @@ module.exports = function () {
12472
12329
  *
12473
12330
  * @public
12474
12331
  * @static
12475
- * @returns {Promise<RequestInterceptor>}
12332
+ * @returns {Promise.<RequestInterceptor>}
12476
12333
  */
12477
12334
 
12478
12335
  }, {
@@ -12488,7 +12345,7 @@ module.exports = function () {
12488
12345
  *
12489
12346
  * @public
12490
12347
  * @static
12491
- * @returns {Promise<JwtGateway>}
12348
+ * @returns {Promise.<JwtGateway>}
12492
12349
  */
12493
12350
 
12494
12351
  }, {
@@ -12502,7 +12359,7 @@ module.exports = function () {
12502
12359
  *
12503
12360
  * @public
12504
12361
  * @static
12505
- * @returns {Promise<RequestInterceptor>}
12362
+ * @returns {Promise.<RequestInterceptor>}
12506
12363
  */
12507
12364
 
12508
12365
  }, {
@@ -12519,7 +12376,7 @@ module.exports = function () {
12519
12376
  * @public
12520
12377
  * @static
12521
12378
  * @param {Function} tokenGenerator - A function which returns the JWT token.
12522
- * @returns {Promise<JwtGateway>}
12379
+ * @returns {Promise.<JwtGateway>}
12523
12380
  */
12524
12381
 
12525
12382
  }, {
@@ -12536,7 +12393,7 @@ module.exports = function () {
12536
12393
  * @public
12537
12394
  * @static
12538
12395
  * @param {JwtGateway~tokenGenerator} tokenGenerator - A function which returns the JWT token.
12539
- * @returns {Promise<RequestInterceptor>}
12396
+ * @returns {Promise.<RequestInterceptor>}
12540
12397
  */
12541
12398
 
12542
12399
  }, {
@@ -12599,7 +12456,7 @@ module.exports = function () {
12599
12456
  * A function returns a JWT token (or a promise for a JWT token).
12600
12457
  *
12601
12458
  * @callback JwtGateway~tokenGenerator
12602
- * @returns {String|Promise<String>}
12459
+ * @returns {String|Promise.<String>}
12603
12460
  */
12604
12461
 
12605
12462
  return JwtGateway;
@@ -12612,13 +12469,14 @@ module.exports = function () {
12612
12469
  'use strict';
12613
12470
 
12614
12471
  return {
12615
- version: '1.3.2'
12472
+ version: '1.0.42'
12616
12473
  };
12617
12474
  }();
12618
12475
 
12619
12476
  },{}],63:[function(require,module,exports){
12620
12477
  module.exports = require('./lib/axios');
12621
12478
  },{"./lib/axios":65}],64:[function(require,module,exports){
12479
+ (function (process){
12622
12480
  'use strict';
12623
12481
 
12624
12482
  var utils = require('./../utils');
@@ -12627,6 +12485,7 @@ var buildURL = require('./../helpers/buildURL');
12627
12485
  var parseHeaders = require('./../helpers/parseHeaders');
12628
12486
  var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
12629
12487
  var createError = require('../core/createError');
12488
+ var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || require('./../helpers/btoa');
12630
12489
 
12631
12490
  module.exports = function xhrAdapter(config) {
12632
12491
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -12638,6 +12497,22 @@ module.exports = function xhrAdapter(config) {
12638
12497
  }
12639
12498
 
12640
12499
  var request = new XMLHttpRequest();
12500
+ var loadEvent = 'onreadystatechange';
12501
+ var xDomain = false;
12502
+
12503
+ // For IE 8/9 CORS support
12504
+ // Only supports POST and GET calls and doesn't returns the response headers.
12505
+ // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
12506
+ if (process.env.NODE_ENV !== 'test' &&
12507
+ typeof window !== 'undefined' &&
12508
+ window.XDomainRequest && !('withCredentials' in request) &&
12509
+ !isURLSameOrigin(config.url)) {
12510
+ request = new window.XDomainRequest();
12511
+ loadEvent = 'onload';
12512
+ xDomain = true;
12513
+ request.onprogress = function handleProgress() {};
12514
+ request.ontimeout = function handleTimeout() {};
12515
+ }
12641
12516
 
12642
12517
  // HTTP basic authentication
12643
12518
  if (config.auth) {
@@ -12652,8 +12527,8 @@ module.exports = function xhrAdapter(config) {
12652
12527
  request.timeout = config.timeout;
12653
12528
 
12654
12529
  // Listen for ready state
12655
- request.onreadystatechange = function handleLoad() {
12656
- if (!request || request.readyState !== 4) {
12530
+ request[loadEvent] = function handleLoad() {
12531
+ if (!request || (request.readyState !== 4 && !xDomain)) {
12657
12532
  return;
12658
12533
  }
12659
12534
 
@@ -12670,8 +12545,9 @@ module.exports = function xhrAdapter(config) {
12670
12545
  var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
12671
12546
  var response = {
12672
12547
  data: responseData,
12673
- status: request.status,
12674
- statusText: request.statusText,
12548
+ // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
12549
+ status: request.status === 1223 ? 204 : request.status,
12550
+ statusText: request.status === 1223 ? 'No Content' : request.statusText,
12675
12551
  headers: responseHeaders,
12676
12552
  config: config,
12677
12553
  request: request
@@ -12683,18 +12559,6 @@ module.exports = function xhrAdapter(config) {
12683
12559
  request = null;
12684
12560
  };
12685
12561
 
12686
- // Handle browser request cancellation (as opposed to a manual cancellation)
12687
- request.onabort = function handleAbort() {
12688
- if (!request) {
12689
- return;
12690
- }
12691
-
12692
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
12693
-
12694
- // Clean up request
12695
- request = null;
12696
- };
12697
-
12698
12562
  // Handle low level network errors
12699
12563
  request.onerror = function handleError() {
12700
12564
  // Real errors are hidden from us by the browser
@@ -12722,8 +12586,8 @@ module.exports = function xhrAdapter(config) {
12722
12586
 
12723
12587
  // Add xsrf header
12724
12588
  var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
12725
- cookies.read(config.xsrfCookieName) :
12726
- undefined;
12589
+ cookies.read(config.xsrfCookieName) :
12590
+ undefined;
12727
12591
 
12728
12592
  if (xsrfValue) {
12729
12593
  requestHeaders[config.xsrfHeaderName] = xsrfValue;
@@ -12794,13 +12658,13 @@ module.exports = function xhrAdapter(config) {
12794
12658
  });
12795
12659
  };
12796
12660
 
12797
- },{"../core/createError":71,"./../core/settle":75,"./../helpers/buildURL":79,"./../helpers/cookies":81,"./../helpers/isURLSameOrigin":83,"./../helpers/parseHeaders":85,"./../utils":87}],65:[function(require,module,exports){
12661
+ }).call(this,require('_process'))
12662
+ },{"../core/createError":71,"./../core/settle":74,"./../helpers/btoa":78,"./../helpers/buildURL":79,"./../helpers/cookies":81,"./../helpers/isURLSameOrigin":83,"./../helpers/parseHeaders":85,"./../utils":87,"_process":89}],65:[function(require,module,exports){
12798
12663
  'use strict';
12799
12664
 
12800
12665
  var utils = require('./utils');
12801
12666
  var bind = require('./helpers/bind');
12802
12667
  var Axios = require('./core/Axios');
12803
- var mergeConfig = require('./core/mergeConfig');
12804
12668
  var defaults = require('./defaults');
12805
12669
 
12806
12670
  /**
@@ -12830,7 +12694,7 @@ axios.Axios = Axios;
12830
12694
 
12831
12695
  // Factory for creating new instances
12832
12696
  axios.create = function create(instanceConfig) {
12833
- return createInstance(mergeConfig(axios.defaults, instanceConfig));
12697
+ return createInstance(utils.merge(defaults, instanceConfig));
12834
12698
  };
12835
12699
 
12836
12700
  // Expose Cancel & CancelToken
@@ -12849,7 +12713,7 @@ module.exports = axios;
12849
12713
  // Allow use of default import syntax in TypeScript
12850
12714
  module.exports.default = axios;
12851
12715
 
12852
- },{"./cancel/Cancel":66,"./cancel/CancelToken":67,"./cancel/isCancel":68,"./core/Axios":69,"./core/mergeConfig":74,"./defaults":77,"./helpers/bind":78,"./helpers/spread":86,"./utils":87}],66:[function(require,module,exports){
12716
+ },{"./cancel/Cancel":66,"./cancel/CancelToken":67,"./cancel/isCancel":68,"./core/Axios":69,"./defaults":76,"./helpers/bind":77,"./helpers/spread":86,"./utils":87}],66:[function(require,module,exports){
12853
12717
  'use strict';
12854
12718
 
12855
12719
  /**
@@ -12939,11 +12803,10 @@ module.exports = function isCancel(value) {
12939
12803
  },{}],69:[function(require,module,exports){
12940
12804
  'use strict';
12941
12805
 
12806
+ var defaults = require('./../defaults');
12942
12807
  var utils = require('./../utils');
12943
- var buildURL = require('../helpers/buildURL');
12944
12808
  var InterceptorManager = require('./InterceptorManager');
12945
12809
  var dispatchRequest = require('./dispatchRequest');
12946
- var mergeConfig = require('./mergeConfig');
12947
12810
 
12948
12811
  /**
12949
12812
  * Create a new instance of Axios
@@ -12967,14 +12830,13 @@ Axios.prototype.request = function request(config) {
12967
12830
  /*eslint no-param-reassign:0*/
12968
12831
  // Allow for axios('example/url'[, config]) a la fetch API
12969
12832
  if (typeof config === 'string') {
12970
- config = arguments[1] || {};
12971
- config.url = arguments[0];
12972
- } else {
12973
- config = config || {};
12833
+ config = utils.merge({
12834
+ url: arguments[0]
12835
+ }, arguments[1]);
12974
12836
  }
12975
12837
 
12976
- config = mergeConfig(this.defaults, config);
12977
- config.method = config.method ? config.method.toLowerCase() : 'get';
12838
+ config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
12839
+ config.method = config.method.toLowerCase();
12978
12840
 
12979
12841
  // Hook up interceptors middleware
12980
12842
  var chain = [dispatchRequest, undefined];
@@ -12995,11 +12857,6 @@ Axios.prototype.request = function request(config) {
12995
12857
  return promise;
12996
12858
  };
12997
12859
 
12998
- Axios.prototype.getUri = function getUri(config) {
12999
- config = mergeConfig(this.defaults, config);
13000
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
13001
- };
13002
-
13003
12860
  // Provide aliases for supported request methods
13004
12861
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
13005
12862
  /*eslint func-names:0*/
@@ -13024,7 +12881,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
13024
12881
 
13025
12882
  module.exports = Axios;
13026
12883
 
13027
- },{"../helpers/buildURL":79,"./../utils":87,"./InterceptorManager":70,"./dispatchRequest":72,"./mergeConfig":74}],70:[function(require,module,exports){
12884
+ },{"./../defaults":76,"./../utils":87,"./InterceptorManager":70,"./dispatchRequest":72}],70:[function(require,module,exports){
13028
12885
  'use strict';
13029
12886
 
13030
12887
  var utils = require('./../utils');
@@ -13186,7 +13043,7 @@ module.exports = function dispatchRequest(config) {
13186
13043
  });
13187
13044
  };
13188
13045
 
13189
- },{"../cancel/isCancel":68,"../defaults":77,"./../helpers/combineURLs":80,"./../helpers/isAbsoluteURL":82,"./../utils":87,"./transformData":76}],73:[function(require,module,exports){
13046
+ },{"../cancel/isCancel":68,"../defaults":76,"./../helpers/combineURLs":80,"./../helpers/isAbsoluteURL":82,"./../utils":87,"./transformData":75}],73:[function(require,module,exports){
13190
13047
  'use strict';
13191
13048
 
13192
13049
  /**
@@ -13204,88 +13061,14 @@ module.exports = function enhanceError(error, config, code, request, response) {
13204
13061
  if (code) {
13205
13062
  error.code = code;
13206
13063
  }
13207
-
13208
13064
  error.request = request;
13209
13065
  error.response = response;
13210
- error.isAxiosError = true;
13211
-
13212
- error.toJSON = function() {
13213
- return {
13214
- // Standard
13215
- message: this.message,
13216
- name: this.name,
13217
- // Microsoft
13218
- description: this.description,
13219
- number: this.number,
13220
- // Mozilla
13221
- fileName: this.fileName,
13222
- lineNumber: this.lineNumber,
13223
- columnNumber: this.columnNumber,
13224
- stack: this.stack,
13225
- // Axios
13226
- config: this.config,
13227
- code: this.code
13228
- };
13229
- };
13230
13066
  return error;
13231
13067
  };
13232
13068
 
13233
13069
  },{}],74:[function(require,module,exports){
13234
13070
  'use strict';
13235
13071
 
13236
- var utils = require('../utils');
13237
-
13238
- /**
13239
- * Config-specific merge-function which creates a new config-object
13240
- * by merging two configuration objects together.
13241
- *
13242
- * @param {Object} config1
13243
- * @param {Object} config2
13244
- * @returns {Object} New object resulting from merging config2 to config1
13245
- */
13246
- module.exports = function mergeConfig(config1, config2) {
13247
- // eslint-disable-next-line no-param-reassign
13248
- config2 = config2 || {};
13249
- var config = {};
13250
-
13251
- utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
13252
- if (typeof config2[prop] !== 'undefined') {
13253
- config[prop] = config2[prop];
13254
- }
13255
- });
13256
-
13257
- utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
13258
- if (utils.isObject(config2[prop])) {
13259
- config[prop] = utils.deepMerge(config1[prop], config2[prop]);
13260
- } else if (typeof config2[prop] !== 'undefined') {
13261
- config[prop] = config2[prop];
13262
- } else if (utils.isObject(config1[prop])) {
13263
- config[prop] = utils.deepMerge(config1[prop]);
13264
- } else if (typeof config1[prop] !== 'undefined') {
13265
- config[prop] = config1[prop];
13266
- }
13267
- });
13268
-
13269
- utils.forEach([
13270
- 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
13271
- 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
13272
- 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
13273
- 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
13274
- 'socketPath'
13275
- ], function defaultToConfig2(prop) {
13276
- if (typeof config2[prop] !== 'undefined') {
13277
- config[prop] = config2[prop];
13278
- } else if (typeof config1[prop] !== 'undefined') {
13279
- config[prop] = config1[prop];
13280
- }
13281
- });
13282
-
13283
- return config;
13284
- };
13285
-
13286
- },{"../utils":87}],75:[function(require,module,exports){
13287
- 'use strict';
13288
-
13289
13072
  var createError = require('./createError');
13290
13073
 
13291
13074
  /**
@@ -13297,7 +13080,8 @@ var createError = require('./createError');
13297
13080
  */
13298
13081
  module.exports = function settle(resolve, reject, response) {
13299
13082
  var validateStatus = response.config.validateStatus;
13300
- if (!validateStatus || validateStatus(response.status)) {
13083
+ // Note: status is not exposed by XDomainRequest
13084
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
13301
13085
  resolve(response);
13302
13086
  } else {
13303
13087
  reject(createError(
@@ -13310,7 +13094,7 @@ module.exports = function settle(resolve, reject, response) {
13310
13094
  }
13311
13095
  };
13312
13096
 
13313
- },{"./createError":71}],76:[function(require,module,exports){
13097
+ },{"./createError":71}],75:[function(require,module,exports){
13314
13098
  'use strict';
13315
13099
 
13316
13100
  var utils = require('./../utils');
@@ -13332,7 +13116,7 @@ module.exports = function transformData(data, headers, fns) {
13332
13116
  return data;
13333
13117
  };
13334
13118
 
13335
- },{"./../utils":87}],77:[function(require,module,exports){
13119
+ },{"./../utils":87}],76:[function(require,module,exports){
13336
13120
  (function (process){
13337
13121
  'use strict';
13338
13122
 
@@ -13351,13 +13135,12 @@ function setContentTypeIfUnset(headers, value) {
13351
13135
 
13352
13136
  function getDefaultAdapter() {
13353
13137
  var adapter;
13354
- // Only Node.JS has a process variable that is of [[Class]] process
13355
- if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
13356
- // For node use HTTP adapter
13357
- adapter = require('./adapters/http');
13358
- } else if (typeof XMLHttpRequest !== 'undefined') {
13138
+ if (typeof XMLHttpRequest !== 'undefined') {
13359
13139
  // For browsers use XHR adapter
13360
13140
  adapter = require('./adapters/xhr');
13141
+ } else if (typeof process !== 'undefined') {
13142
+ // For node use HTTP adapter
13143
+ adapter = require('./adapters/http');
13361
13144
  }
13362
13145
  return adapter;
13363
13146
  }
@@ -13366,7 +13149,6 @@ var defaults = {
13366
13149
  adapter: getDefaultAdapter(),
13367
13150
 
13368
13151
  transformRequest: [function transformRequest(data, headers) {
13369
- normalizeHeaderName(headers, 'Accept');
13370
13152
  normalizeHeaderName(headers, 'Content-Type');
13371
13153
  if (utils.isFormData(data) ||
13372
13154
  utils.isArrayBuffer(data) ||
@@ -13401,10 +13183,6 @@ var defaults = {
13401
13183
  return data;
13402
13184
  }],
13403
13185
 
13404
- /**
13405
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
13406
- * timeout is not created.
13407
- */
13408
13186
  timeout: 0,
13409
13187
 
13410
13188
  xsrfCookieName: 'XSRF-TOKEN',
@@ -13434,7 +13212,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
13434
13212
  module.exports = defaults;
13435
13213
 
13436
13214
  }).call(this,require('_process'))
13437
- },{"./adapters/http":64,"./adapters/xhr":64,"./helpers/normalizeHeaderName":84,"./utils":87,"_process":89}],78:[function(require,module,exports){
13215
+ },{"./adapters/http":64,"./adapters/xhr":64,"./helpers/normalizeHeaderName":84,"./utils":87,"_process":89}],77:[function(require,module,exports){
13438
13216
  'use strict';
13439
13217
 
13440
13218
  module.exports = function bind(fn, thisArg) {
@@ -13447,6 +13225,44 @@ module.exports = function bind(fn, thisArg) {
13447
13225
  };
13448
13226
  };
13449
13227
 
13228
+ },{}],78:[function(require,module,exports){
13229
+ 'use strict';
13230
+
13231
+ // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
13232
+
13233
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
13234
+
13235
+ function E() {
13236
+ this.message = 'String contains an invalid character';
13237
+ }
13238
+ E.prototype = new Error;
13239
+ E.prototype.code = 5;
13240
+ E.prototype.name = 'InvalidCharacterError';
13241
+
13242
+ function btoa(input) {
13243
+ var str = String(input);
13244
+ var output = '';
13245
+ for (
13246
+ // initialize result and counter
13247
+ var block, charCode, idx = 0, map = chars;
13248
+ // if the next str index does not exist:
13249
+ // change the mapping table to "="
13250
+ // check if d has no fractional digits
13251
+ str.charAt(idx | 0) || (map = '=', idx % 1);
13252
+ // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
13253
+ output += map.charAt(63 & block >> 8 - idx % 1 * 8)
13254
+ ) {
13255
+ charCode = str.charCodeAt(idx += 3 / 4);
13256
+ if (charCode > 0xFF) {
13257
+ throw new E();
13258
+ }
13259
+ block = block << 8 | charCode;
13260
+ }
13261
+ return output;
13262
+ }
13263
+
13264
+ module.exports = btoa;
13265
+
13450
13266
  },{}],79:[function(require,module,exports){
13451
13267
  'use strict';
13452
13268
 
@@ -13491,7 +13307,9 @@ module.exports = function buildURL(url, params, paramsSerializer) {
13491
13307
 
13492
13308
  if (utils.isArray(val)) {
13493
13309
  key = key + '[]';
13494
- } else {
13310
+ }
13311
+
13312
+ if (!utils.isArray(val)) {
13495
13313
  val = [val];
13496
13314
  }
13497
13315
 
@@ -13509,11 +13327,6 @@ module.exports = function buildURL(url, params, paramsSerializer) {
13509
13327
  }
13510
13328
 
13511
13329
  if (serializedParams) {
13512
- var hashmarkIndex = url.indexOf('#');
13513
- if (hashmarkIndex !== -1) {
13514
- url = url.slice(0, hashmarkIndex);
13515
- }
13516
-
13517
13330
  url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
13518
13331
  }
13519
13332
 
@@ -13545,50 +13358,50 @@ module.exports = (
13545
13358
  utils.isStandardBrowserEnv() ?
13546
13359
 
13547
13360
  // Standard browser envs support document.cookie
13548
- (function standardBrowserEnv() {
13549
- return {
13550
- write: function write(name, value, expires, path, domain, secure) {
13551
- var cookie = [];
13552
- cookie.push(name + '=' + encodeURIComponent(value));
13361
+ (function standardBrowserEnv() {
13362
+ return {
13363
+ write: function write(name, value, expires, path, domain, secure) {
13364
+ var cookie = [];
13365
+ cookie.push(name + '=' + encodeURIComponent(value));
13553
13366
 
13554
- if (utils.isNumber(expires)) {
13555
- cookie.push('expires=' + new Date(expires).toGMTString());
13556
- }
13367
+ if (utils.isNumber(expires)) {
13368
+ cookie.push('expires=' + new Date(expires).toGMTString());
13369
+ }
13557
13370
 
13558
- if (utils.isString(path)) {
13559
- cookie.push('path=' + path);
13560
- }
13371
+ if (utils.isString(path)) {
13372
+ cookie.push('path=' + path);
13373
+ }
13561
13374
 
13562
- if (utils.isString(domain)) {
13563
- cookie.push('domain=' + domain);
13564
- }
13375
+ if (utils.isString(domain)) {
13376
+ cookie.push('domain=' + domain);
13377
+ }
13565
13378
 
13566
- if (secure === true) {
13567
- cookie.push('secure');
13568
- }
13379
+ if (secure === true) {
13380
+ cookie.push('secure');
13381
+ }
13569
13382
 
13570
- document.cookie = cookie.join('; ');
13571
- },
13383
+ document.cookie = cookie.join('; ');
13384
+ },
13572
13385
 
13573
- read: function read(name) {
13574
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
13575
- return (match ? decodeURIComponent(match[3]) : null);
13576
- },
13386
+ read: function read(name) {
13387
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
13388
+ return (match ? decodeURIComponent(match[3]) : null);
13389
+ },
13577
13390
 
13578
- remove: function remove(name) {
13579
- this.write(name, '', Date.now() - 86400000);
13580
- }
13581
- };
13582
- })() :
13391
+ remove: function remove(name) {
13392
+ this.write(name, '', Date.now() - 86400000);
13393
+ }
13394
+ };
13395
+ })() :
13583
13396
 
13584
13397
  // Non standard browser env (web workers, react-native) lack needed support.
13585
- (function nonStandardBrowserEnv() {
13586
- return {
13587
- write: function write() {},
13588
- read: function read() { return null; },
13589
- remove: function remove() {}
13590
- };
13591
- })()
13398
+ (function nonStandardBrowserEnv() {
13399
+ return {
13400
+ write: function write() {},
13401
+ read: function read() { return null; },
13402
+ remove: function remove() {}
13403
+ };
13404
+ })()
13592
13405
  );
13593
13406
 
13594
13407
  },{"./../utils":87}],82:[function(require,module,exports){
@@ -13617,64 +13430,64 @@ module.exports = (
13617
13430
 
13618
13431
  // Standard browser envs have full support of the APIs needed to test
13619
13432
  // whether the request URL is of the same origin as current location.
13620
- (function standardBrowserEnv() {
13621
- var msie = /(msie|trident)/i.test(navigator.userAgent);
13622
- var urlParsingNode = document.createElement('a');
13623
- var originURL;
13433
+ (function standardBrowserEnv() {
13434
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
13435
+ var urlParsingNode = document.createElement('a');
13436
+ var originURL;
13624
13437
 
13625
- /**
13438
+ /**
13626
13439
  * Parse a URL to discover it's components
13627
13440
  *
13628
13441
  * @param {String} url The URL to be parsed
13629
13442
  * @returns {Object}
13630
13443
  */
13631
- function resolveURL(url) {
13632
- var href = url;
13444
+ function resolveURL(url) {
13445
+ var href = url;
13633
13446
 
13634
- if (msie) {
13447
+ if (msie) {
13635
13448
  // IE needs attribute set twice to normalize properties
13636
- urlParsingNode.setAttribute('href', href);
13637
- href = urlParsingNode.href;
13638
- }
13639
-
13640
13449
  urlParsingNode.setAttribute('href', href);
13641
-
13642
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
13643
- return {
13644
- href: urlParsingNode.href,
13645
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
13646
- host: urlParsingNode.host,
13647
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
13648
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
13649
- hostname: urlParsingNode.hostname,
13650
- port: urlParsingNode.port,
13651
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
13652
- urlParsingNode.pathname :
13653
- '/' + urlParsingNode.pathname
13654
- };
13450
+ href = urlParsingNode.href;
13655
13451
  }
13656
13452
 
13657
- originURL = resolveURL(window.location.href);
13453
+ urlParsingNode.setAttribute('href', href);
13658
13454
 
13659
- /**
13455
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
13456
+ return {
13457
+ href: urlParsingNode.href,
13458
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
13459
+ host: urlParsingNode.host,
13460
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
13461
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
13462
+ hostname: urlParsingNode.hostname,
13463
+ port: urlParsingNode.port,
13464
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
13465
+ urlParsingNode.pathname :
13466
+ '/' + urlParsingNode.pathname
13467
+ };
13468
+ }
13469
+
13470
+ originURL = resolveURL(window.location.href);
13471
+
13472
+ /**
13660
13473
  * Determine if a URL shares the same origin as the current location
13661
13474
  *
13662
13475
  * @param {String} requestURL The URL to test
13663
13476
  * @returns {boolean} True if URL shares the same origin, otherwise false
13664
13477
  */
13665
- return function isURLSameOrigin(requestURL) {
13666
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
13667
- return (parsed.protocol === originURL.protocol &&
13478
+ return function isURLSameOrigin(requestURL) {
13479
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
13480
+ return (parsed.protocol === originURL.protocol &&
13668
13481
  parsed.host === originURL.host);
13669
- };
13670
- })() :
13482
+ };
13483
+ })() :
13671
13484
 
13672
13485
  // Non standard browser envs (web workers, react-native) lack needed support.
13673
- (function nonStandardBrowserEnv() {
13674
- return function isURLSameOrigin() {
13675
- return true;
13676
- };
13677
- })()
13486
+ (function nonStandardBrowserEnv() {
13487
+ return function isURLSameOrigin() {
13488
+ return true;
13489
+ };
13490
+ })()
13678
13491
  );
13679
13492
 
13680
13493
  },{"./../utils":87}],84:[function(require,module,exports){
@@ -13955,13 +13768,9 @@ function trim(str) {
13955
13768
  *
13956
13769
  * react-native:
13957
13770
  * navigator.product -> 'ReactNative'
13958
- * nativescript
13959
- * navigator.product -> 'NativeScript' or 'NS'
13960
13771
  */
13961
13772
  function isStandardBrowserEnv() {
13962
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
13963
- navigator.product === 'NativeScript' ||
13964
- navigator.product === 'NS')) {
13773
+ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
13965
13774
  return false;
13966
13775
  }
13967
13776
  return (
@@ -14042,32 +13851,6 @@ function merge(/* obj1, obj2, obj3, ... */) {
14042
13851
  return result;
14043
13852
  }
14044
13853
 
14045
- /**
14046
- * Function equal to merge with the difference being that no reference
14047
- * to original objects is kept.
14048
- *
14049
- * @see merge
14050
- * @param {Object} obj1 Object to merge
14051
- * @returns {Object} Result of all merge properties
14052
- */
14053
- function deepMerge(/* obj1, obj2, obj3, ... */) {
14054
- var result = {};
14055
- function assignValue(val, key) {
14056
- if (typeof result[key] === 'object' && typeof val === 'object') {
14057
- result[key] = deepMerge(result[key], val);
14058
- } else if (typeof val === 'object') {
14059
- result[key] = deepMerge({}, val);
14060
- } else {
14061
- result[key] = val;
14062
- }
14063
- }
14064
-
14065
- for (var i = 0, l = arguments.length; i < l; i++) {
14066
- forEach(arguments[i], assignValue);
14067
- }
14068
- return result;
14069
- }
14070
-
14071
13854
  /**
14072
13855
  * Extends object a by mutably adding to it the properties of object b.
14073
13856
  *
@@ -14106,12 +13889,11 @@ module.exports = {
14106
13889
  isStandardBrowserEnv: isStandardBrowserEnv,
14107
13890
  forEach: forEach,
14108
13891
  merge: merge,
14109
- deepMerge: deepMerge,
14110
13892
  extend: extend,
14111
13893
  trim: trim
14112
13894
  };
14113
13895
 
14114
- },{"./helpers/bind":78,"is-buffer":90}],88:[function(require,module,exports){
13896
+ },{"./helpers/bind":77,"is-buffer":90}],88:[function(require,module,exports){
14115
13897
  /*
14116
13898
  * big.js v5.0.3
14117
13899
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -15246,9 +15028,19 @@ process.umask = function() { return 0; };
15246
15028
  * @license MIT
15247
15029
  */
15248
15030
 
15249
- module.exports = function isBuffer (obj) {
15250
- return obj != null && obj.constructor != null &&
15251
- typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
15031
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
15032
+ // Object.prototype.constructor. Remove this eventually
15033
+ module.exports = function (obj) {
15034
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
15035
+ }
15036
+
15037
+ function isBuffer (obj) {
15038
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
15039
+ }
15040
+
15041
+ // For Node v0.10 support. Remove this eventually.
15042
+ function isSlowBuffer (obj) {
15043
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
15252
15044
  }
15253
15045
 
15254
15046
  },{}],91:[function(require,module,exports){
@@ -18805,36 +18597,22 @@ moment.tz.load(require('./data/packed/latest.json'));
18805
18597
  function createDate (y, m, d, h, M, s, ms) {
18806
18598
  // can't just apply() to create a date:
18807
18599
  // https://stackoverflow.com/q/181348
18808
- var date;
18600
+ var date = new Date(y, m, d, h, M, s, ms);
18601
+
18809
18602
  // the date constructor remaps years 0-99 to 1900-1999
18810
- if (y < 100 && y >= 0) {
18811
- // preserve leap years using a full 400 year cycle, then reset
18812
- date = new Date(y + 400, m, d, h, M, s, ms);
18813
- if (isFinite(date.getFullYear())) {
18814
- date.setFullYear(y);
18815
- }
18816
- } else {
18817
- date = new Date(y, m, d, h, M, s, ms);
18603
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
18604
+ date.setFullYear(y);
18818
18605
  }
18819
-
18820
18606
  return date;
18821
18607
  }
18822
18608
 
18823
18609
  function createUTCDate (y) {
18824
- var date;
18610
+ var date = new Date(Date.UTC.apply(null, arguments));
18611
+
18825
18612
  // the Date.UTC function remaps years 0-99 to 1900-1999
18826
- if (y < 100 && y >= 0) {
18827
- var args = Array.prototype.slice.call(arguments);
18828
- // preserve leap years using a full 400 year cycle, then reset
18829
- args[0] = y + 400;
18830
- date = new Date(Date.UTC.apply(null, args));
18831
- if (isFinite(date.getUTCFullYear())) {
18832
- date.setUTCFullYear(y);
18833
- }
18834
- } else {
18835
- date = new Date(Date.UTC.apply(null, arguments));
18613
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
18614
+ date.setUTCFullYear(y);
18836
18615
  }
18837
-
18838
18616
  return date;
18839
18617
  }
18840
18618
 
@@ -18936,7 +18714,7 @@ moment.tz.load(require('./data/packed/latest.json'));
18936
18714
 
18937
18715
  var defaultLocaleWeek = {
18938
18716
  dow : 0, // Sunday is the first day of the week.
18939
- doy : 6 // The week that contains Jan 6th is the first week of the year.
18717
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
18940
18718
  };
18941
18719
 
18942
18720
  function localeFirstDayOfWeek () {
@@ -19045,28 +18823,25 @@ moment.tz.load(require('./data/packed/latest.json'));
19045
18823
  }
19046
18824
 
19047
18825
  // LOCALES
19048
- function shiftWeekdays (ws, n) {
19049
- return ws.slice(n, 7).concat(ws.slice(0, n));
19050
- }
19051
18826
 
19052
18827
  var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
19053
18828
  function localeWeekdays (m, format) {
19054
- var weekdays = isArray(this._weekdays) ? this._weekdays :
19055
- this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
19056
- return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
19057
- : (m) ? weekdays[m.day()] : weekdays;
18829
+ if (!m) {
18830
+ return isArray(this._weekdays) ? this._weekdays :
18831
+ this._weekdays['standalone'];
18832
+ }
18833
+ return isArray(this._weekdays) ? this._weekdays[m.day()] :
18834
+ this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
19058
18835
  }
19059
18836
 
19060
18837
  var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
19061
18838
  function localeWeekdaysShort (m) {
19062
- return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
19063
- : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
18839
+ return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
19064
18840
  }
19065
18841
 
19066
18842
  var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
19067
18843
  function localeWeekdaysMin (m) {
19068
- return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
19069
- : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
18844
+ return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
19070
18845
  }
19071
18846
 
19072
18847
  function handleStrictParse$1(weekdayName, format, strict) {
@@ -19815,13 +19590,13 @@ moment.tz.load(require('./data/packed/latest.json'));
19815
19590
  weekdayOverflow = true;
19816
19591
  }
19817
19592
  } else if (w.e != null) {
19818
- // local weekday -- counting starts from beginning of week
19593
+ // local weekday -- counting starts from begining of week
19819
19594
  weekday = w.e + dow;
19820
19595
  if (w.e < 0 || w.e > 6) {
19821
19596
  weekdayOverflow = true;
19822
19597
  }
19823
19598
  } else {
19824
- // default to beginning of week
19599
+ // default to begining of week
19825
19600
  weekday = dow;
19826
19601
  }
19827
19602
  }
@@ -20415,7 +20190,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20415
20190
  years = normalizedInput.year || 0,
20416
20191
  quarters = normalizedInput.quarter || 0,
20417
20192
  months = normalizedInput.month || 0,
20418
- weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
20193
+ weeks = normalizedInput.week || 0,
20419
20194
  days = normalizedInput.day || 0,
20420
20195
  hours = normalizedInput.hour || 0,
20421
20196
  minutes = normalizedInput.minute || 0,
@@ -20719,7 +20494,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20719
20494
  ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
20720
20495
  };
20721
20496
  } else if (!!(match = isoRegex.exec(input))) {
20722
- sign = (match[1] === '-') ? -1 : 1;
20497
+ sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
20723
20498
  duration = {
20724
20499
  y : parseIso(match[2], sign),
20725
20500
  M : parseIso(match[3], sign),
@@ -20761,7 +20536,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20761
20536
  }
20762
20537
 
20763
20538
  function positiveMomentsDifference(base, other) {
20764
- var res = {};
20539
+ var res = {milliseconds: 0, months: 0};
20765
20540
 
20766
20541
  res.months = other.month() - base.month() +
20767
20542
  (other.year() - base.year()) * 12;
@@ -20870,7 +20645,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20870
20645
  if (!(this.isValid() && localInput.isValid())) {
20871
20646
  return false;
20872
20647
  }
20873
- units = normalizeUnits(units) || 'millisecond';
20648
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
20874
20649
  if (units === 'millisecond') {
20875
20650
  return this.valueOf() > localInput.valueOf();
20876
20651
  } else {
@@ -20883,7 +20658,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20883
20658
  if (!(this.isValid() && localInput.isValid())) {
20884
20659
  return false;
20885
20660
  }
20886
- units = normalizeUnits(units) || 'millisecond';
20661
+ units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
20887
20662
  if (units === 'millisecond') {
20888
20663
  return this.valueOf() < localInput.valueOf();
20889
20664
  } else {
@@ -20892,14 +20667,9 @@ moment.tz.load(require('./data/packed/latest.json'));
20892
20667
  }
20893
20668
 
20894
20669
  function isBetween (from, to, units, inclusivity) {
20895
- var localFrom = isMoment(from) ? from : createLocal(from),
20896
- localTo = isMoment(to) ? to : createLocal(to);
20897
- if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
20898
- return false;
20899
- }
20900
20670
  inclusivity = inclusivity || '()';
20901
- return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
20902
- (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
20671
+ return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
20672
+ (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
20903
20673
  }
20904
20674
 
20905
20675
  function isSame (input, units) {
@@ -20908,7 +20678,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20908
20678
  if (!(this.isValid() && localInput.isValid())) {
20909
20679
  return false;
20910
20680
  }
20911
- units = normalizeUnits(units) || 'millisecond';
20681
+ units = normalizeUnits(units || 'millisecond');
20912
20682
  if (units === 'millisecond') {
20913
20683
  return this.valueOf() === localInput.valueOf();
20914
20684
  } else {
@@ -20918,11 +20688,11 @@ moment.tz.load(require('./data/packed/latest.json'));
20918
20688
  }
20919
20689
 
20920
20690
  function isSameOrAfter (input, units) {
20921
- return this.isSame(input, units) || this.isAfter(input, units);
20691
+ return this.isSame(input, units) || this.isAfter(input,units);
20922
20692
  }
20923
20693
 
20924
20694
  function isSameOrBefore (input, units) {
20925
- return this.isSame(input, units) || this.isBefore(input, units);
20695
+ return this.isSame(input, units) || this.isBefore(input,units);
20926
20696
  }
20927
20697
 
20928
20698
  function diff (input, units, asFloat) {
@@ -21099,130 +20869,62 @@ moment.tz.load(require('./data/packed/latest.json'));
21099
20869
  return this._locale;
21100
20870
  }
21101
20871
 
21102
- var MS_PER_SECOND = 1000;
21103
- var MS_PER_MINUTE = 60 * MS_PER_SECOND;
21104
- var MS_PER_HOUR = 60 * MS_PER_MINUTE;
21105
- var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
21106
-
21107
- // actual modulo - handles negative numbers (for dates before 1970):
21108
- function mod$1(dividend, divisor) {
21109
- return (dividend % divisor + divisor) % divisor;
21110
- }
21111
-
21112
- function localStartOfDate(y, m, d) {
21113
- // the date constructor remaps years 0-99 to 1900-1999
21114
- if (y < 100 && y >= 0) {
21115
- // preserve leap years using a full 400 year cycle, then reset
21116
- return new Date(y + 400, m, d) - MS_PER_400_YEARS;
21117
- } else {
21118
- return new Date(y, m, d).valueOf();
21119
- }
21120
- }
21121
-
21122
- function utcStartOfDate(y, m, d) {
21123
- // Date.UTC remaps years 0-99 to 1900-1999
21124
- if (y < 100 && y >= 0) {
21125
- // preserve leap years using a full 400 year cycle, then reset
21126
- return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
21127
- } else {
21128
- return Date.UTC(y, m, d);
21129
- }
21130
- }
21131
-
21132
20872
  function startOf (units) {
21133
- var time;
21134
20873
  units = normalizeUnits(units);
21135
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
21136
- return this;
21137
- }
21138
-
21139
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
21140
-
20874
+ // the following switch intentionally omits break keywords
20875
+ // to utilize falling through the cases.
21141
20876
  switch (units) {
21142
20877
  case 'year':
21143
- time = startOfDate(this.year(), 0, 1);
21144
- break;
20878
+ this.month(0);
20879
+ /* falls through */
21145
20880
  case 'quarter':
21146
- time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
21147
- break;
21148
20881
  case 'month':
21149
- time = startOfDate(this.year(), this.month(), 1);
21150
- break;
20882
+ this.date(1);
20883
+ /* falls through */
21151
20884
  case 'week':
21152
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
21153
- break;
21154
20885
  case 'isoWeek':
21155
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
21156
- break;
21157
20886
  case 'day':
21158
20887
  case 'date':
21159
- time = startOfDate(this.year(), this.month(), this.date());
21160
- break;
20888
+ this.hours(0);
20889
+ /* falls through */
21161
20890
  case 'hour':
21162
- time = this._d.valueOf();
21163
- time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
21164
- break;
20891
+ this.minutes(0);
20892
+ /* falls through */
21165
20893
  case 'minute':
21166
- time = this._d.valueOf();
21167
- time -= mod$1(time, MS_PER_MINUTE);
21168
- break;
20894
+ this.seconds(0);
20895
+ /* falls through */
21169
20896
  case 'second':
21170
- time = this._d.valueOf();
21171
- time -= mod$1(time, MS_PER_SECOND);
21172
- break;
20897
+ this.milliseconds(0);
20898
+ }
20899
+
20900
+ // weeks are a special case
20901
+ if (units === 'week') {
20902
+ this.weekday(0);
20903
+ }
20904
+ if (units === 'isoWeek') {
20905
+ this.isoWeekday(1);
20906
+ }
20907
+
20908
+ // quarters are also special
20909
+ if (units === 'quarter') {
20910
+ this.month(Math.floor(this.month() / 3) * 3);
21173
20911
  }
21174
20912
 
21175
- this._d.setTime(time);
21176
- hooks.updateOffset(this, true);
21177
20913
  return this;
21178
20914
  }
21179
20915
 
21180
20916
  function endOf (units) {
21181
- var time;
21182
20917
  units = normalizeUnits(units);
21183
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
20918
+ if (units === undefined || units === 'millisecond') {
21184
20919
  return this;
21185
20920
  }
21186
20921
 
21187
- var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
21188
-
21189
- switch (units) {
21190
- case 'year':
21191
- time = startOfDate(this.year() + 1, 0, 1) - 1;
21192
- break;
21193
- case 'quarter':
21194
- time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
21195
- break;
21196
- case 'month':
21197
- time = startOfDate(this.year(), this.month() + 1, 1) - 1;
21198
- break;
21199
- case 'week':
21200
- time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
21201
- break;
21202
- case 'isoWeek':
21203
- time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
21204
- break;
21205
- case 'day':
21206
- case 'date':
21207
- time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
21208
- break;
21209
- case 'hour':
21210
- time = this._d.valueOf();
21211
- time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
21212
- break;
21213
- case 'minute':
21214
- time = this._d.valueOf();
21215
- time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
21216
- break;
21217
- case 'second':
21218
- time = this._d.valueOf();
21219
- time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
21220
- break;
20922
+ // 'date' is an alias for 'day', so it should be considered as such.
20923
+ if (units === 'date') {
20924
+ units = 'day';
21221
20925
  }
21222
20926
 
21223
- this._d.setTime(time);
21224
- hooks.updateOffset(this, true);
21225
- return this;
20927
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
21226
20928
  }
21227
20929
 
21228
20930
  function valueOf () {
@@ -21928,14 +21630,10 @@ moment.tz.load(require('./data/packed/latest.json'));
21928
21630
 
21929
21631
  units = normalizeUnits(units);
21930
21632
 
21931
- if (units === 'month' || units === 'quarter' || units === 'year') {
21932
- days = this._days + milliseconds / 864e5;
21633
+ if (units === 'month' || units === 'year') {
21634
+ days = this._days + milliseconds / 864e5;
21933
21635
  months = this._months + daysToMonths(days);
21934
- switch (units) {
21935
- case 'month': return months;
21936
- case 'quarter': return months / 3;
21937
- case 'year': return months / 12;
21938
- }
21636
+ return units === 'month' ? months : months / 12;
21939
21637
  } else {
21940
21638
  // handle milliseconds separately because of floating point math errors (issue #1867)
21941
21639
  days = this._days + Math.round(monthsToDays(this._months));
@@ -21978,7 +21676,6 @@ moment.tz.load(require('./data/packed/latest.json'));
21978
21676
  var asDays = makeAs('d');
21979
21677
  var asWeeks = makeAs('w');
21980
21678
  var asMonths = makeAs('M');
21981
- var asQuarters = makeAs('Q');
21982
21679
  var asYears = makeAs('y');
21983
21680
 
21984
21681
  function clone$1 () {
@@ -22170,7 +21867,6 @@ moment.tz.load(require('./data/packed/latest.json'));
22170
21867
  proto$2.asDays = asDays;
22171
21868
  proto$2.asWeeks = asWeeks;
22172
21869
  proto$2.asMonths = asMonths;
22173
- proto$2.asQuarters = asQuarters;
22174
21870
  proto$2.asYears = asYears;
22175
21871
  proto$2.valueOf = valueOf$1;
22176
21872
  proto$2._bubble = bubble;
@@ -22215,7 +21911,7 @@ moment.tz.load(require('./data/packed/latest.json'));
22215
21911
  // Side effect imports
22216
21912
 
22217
21913
 
22218
- hooks.version = '2.24.0';
21914
+ hooks.version = '2.22.2';
22219
21915
 
22220
21916
  setHookCallback(createLocal);
22221
21917
 
@@ -22256,7 +21952,7 @@ moment.tz.load(require('./data/packed/latest.json'));
22256
21952
  TIME: 'HH:mm', // <input type="time" />
22257
21953
  TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
22258
21954
  TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
22259
- WEEK: 'GGGG-[W]WW', // <input type="week" />
21955
+ WEEK: 'YYYY-[W]WW', // <input type="week" />
22260
21956
  MONTH: 'YYYY-MM' // <input type="month" />
22261
21957
  };
22262
21958