axios_rails 0.5.0 → 0.6.0
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/axios.js +360 -1333
- data/app/assets/javascripts/axios.min.js +2 -9
- data/lib/axios_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 506f0982f33d5feb794bcb0d6fd2914a00bc6534
|
4
|
+
data.tar.gz: 660ab47c44260b3c6d77dc59f5dfe61bafd9adaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f936fee724dfb4d35cf65d18ba184660bb36569b6c7fecfe86f521de3c12066fb3468128fdd41b244200ac65a5ed1563bc34ca50cbc553a85e4c237176297540
|
7
|
+
data.tar.gz: a1a342c7672c58e306ca310a2e99986840dc7fe7f61fefb667f55760c545465724ad6f55926e07120100cb1cf69a56990fa2c812d9f46544d909debe9adb6b24
|
@@ -1,6 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory();
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define([], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["axios"] = factory();
|
8
|
+
else
|
9
|
+
root["axios"] = factory();
|
10
|
+
})(this, function() {
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
4
12
|
/******/ // The module cache
|
5
13
|
/******/ var installedModules = {};
|
6
14
|
/******/
|
@@ -52,14 +60,12 @@ var axios =
|
|
52
60
|
/* 1 */
|
53
61
|
/***/ function(module, exports, __webpack_require__) {
|
54
62
|
|
63
|
+
'use strict';
|
64
|
+
|
55
65
|
var defaults = __webpack_require__(2);
|
56
66
|
var utils = __webpack_require__(3);
|
57
|
-
var
|
58
|
-
var
|
59
|
-
var InterceptorManager = __webpack_require__(6);
|
60
|
-
|
61
|
-
// Polyfill ES6 Promise if needed
|
62
|
-
__webpack_require__(9).polyfill();
|
67
|
+
var dispatchRequest = __webpack_require__(4);
|
68
|
+
var InterceptorManager = __webpack_require__(12);
|
63
69
|
|
64
70
|
var axios = module.exports = function axios(config) {
|
65
71
|
config = utils.merge({
|
@@ -88,26 +94,6 @@ var axios =
|
|
88
94
|
promise = promise.then(chain.shift(), chain.shift());
|
89
95
|
}
|
90
96
|
|
91
|
-
// Provide alias for success
|
92
|
-
promise.success = function success(fn) {
|
93
|
-
deprecatedMethod('success', 'then', 'https://github.com/mzabriskie/axios/blob/master/README.md#response-api');
|
94
|
-
|
95
|
-
promise.then(function(response) {
|
96
|
-
fn(response.data, response.status, response.headers, response.config);
|
97
|
-
});
|
98
|
-
return promise;
|
99
|
-
};
|
100
|
-
|
101
|
-
// Provide alias for error
|
102
|
-
promise.error = function error(fn) {
|
103
|
-
deprecatedMethod('error', 'catch', 'https://github.com/mzabriskie/axios/blob/master/README.md#response-api');
|
104
|
-
|
105
|
-
promise.then(null, function(response) {
|
106
|
-
fn(response.data, response.status, response.headers, response.config);
|
107
|
-
});
|
108
|
-
return promise;
|
109
|
-
};
|
110
|
-
|
111
97
|
return promise;
|
112
98
|
};
|
113
99
|
|
@@ -118,7 +104,7 @@ var axios =
|
|
118
104
|
axios.all = function (promises) {
|
119
105
|
return Promise.all(promises);
|
120
106
|
};
|
121
|
-
axios.spread = __webpack_require__(
|
107
|
+
axios.spread = __webpack_require__(13);
|
122
108
|
|
123
109
|
// Expose interceptors
|
124
110
|
axios.interceptors = {
|
@@ -127,32 +113,33 @@ var axios =
|
|
127
113
|
};
|
128
114
|
|
129
115
|
// Provide aliases for supported request methods
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
});
|
142
|
-
}
|
116
|
+
(function () {
|
117
|
+
function createShortMethods() {
|
118
|
+
utils.forEach(arguments, function (method) {
|
119
|
+
axios[method] = function (url, config) {
|
120
|
+
return axios(utils.merge(config || {}, {
|
121
|
+
method: method,
|
122
|
+
url: url
|
123
|
+
}));
|
124
|
+
};
|
125
|
+
});
|
126
|
+
}
|
143
127
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
128
|
+
function createShortMethodsWithData() {
|
129
|
+
utils.forEach(arguments, function (method) {
|
130
|
+
axios[method] = function (url, data, config) {
|
131
|
+
return axios(utils.merge(config || {}, {
|
132
|
+
method: method,
|
133
|
+
url: url,
|
134
|
+
data: data
|
135
|
+
}));
|
136
|
+
};
|
137
|
+
});
|
138
|
+
}
|
155
139
|
|
140
|
+
createShortMethods('delete', 'get', 'head');
|
141
|
+
createShortMethodsWithData('post', 'put', 'patch');
|
142
|
+
})();
|
156
143
|
|
157
144
|
|
158
145
|
/***/ },
|
@@ -163,8 +150,6 @@ var axios =
|
|
163
150
|
|
164
151
|
var utils = __webpack_require__(3);
|
165
152
|
|
166
|
-
var JSON_START = /^\s*(\[|\{[^\{])/;
|
167
|
-
var JSON_END = /[\}\]]\s*$/;
|
168
153
|
var PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
169
154
|
var DEFAULT_CONTENT_TYPE = {
|
170
155
|
'Content-Type': 'application/x-www-form-urlencoded'
|
@@ -172,6 +157,9 @@ var axios =
|
|
172
157
|
|
173
158
|
module.exports = {
|
174
159
|
transformRequest: [function (data, headers) {
|
160
|
+
if(utils.isFormData(data)) {
|
161
|
+
return data;
|
162
|
+
}
|
175
163
|
if (utils.isArrayBuffer(data)) {
|
176
164
|
return data;
|
177
165
|
}
|
@@ -180,8 +168,16 @@ var axios =
|
|
180
168
|
}
|
181
169
|
if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
|
182
170
|
// Set application/json if no Content-Type has been specified
|
183
|
-
if (!utils.isUndefined(headers)
|
184
|
-
headers
|
171
|
+
if (!utils.isUndefined(headers)) {
|
172
|
+
utils.forEach(headers, function (val, key) {
|
173
|
+
if (key.toLowerCase() === 'content-type') {
|
174
|
+
headers['Content-Type'] = val;
|
175
|
+
}
|
176
|
+
});
|
177
|
+
|
178
|
+
if (utils.isUndefined(headers['Content-Type'])) {
|
179
|
+
headers['Content-Type'] = 'application/json;charset=utf-8';
|
180
|
+
}
|
185
181
|
}
|
186
182
|
return JSON.stringify(data);
|
187
183
|
}
|
@@ -191,9 +187,9 @@ var axios =
|
|
191
187
|
transformResponse: [function (data) {
|
192
188
|
if (typeof data === 'string') {
|
193
189
|
data = data.replace(PROTECTION_PREFIX, '');
|
194
|
-
|
190
|
+
try {
|
195
191
|
data = JSON.parse(data);
|
196
|
-
}
|
192
|
+
} catch (e) { /* Ignore */ }
|
197
193
|
}
|
198
194
|
return data;
|
199
195
|
}],
|
@@ -207,13 +203,20 @@ var axios =
|
|
207
203
|
put: utils.merge(DEFAULT_CONTENT_TYPE)
|
208
204
|
},
|
209
205
|
|
206
|
+
timeout: 0,
|
207
|
+
|
210
208
|
xsrfCookieName: 'XSRF-TOKEN',
|
211
209
|
xsrfHeaderName: 'X-XSRF-TOKEN'
|
212
210
|
};
|
213
211
|
|
212
|
+
|
214
213
|
/***/ },
|
215
214
|
/* 3 */
|
216
|
-
/***/ function(module, exports
|
215
|
+
/***/ function(module, exports) {
|
216
|
+
|
217
|
+
'use strict';
|
218
|
+
|
219
|
+
/*global toString:true*/
|
217
220
|
|
218
221
|
// utils is a library of generic helper functions non-specific to axios
|
219
222
|
|
@@ -343,6 +346,16 @@ var axios =
|
|
343
346
|
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
344
347
|
}
|
345
348
|
|
349
|
+
/**
|
350
|
+
* Determine if a value is an Arguments object
|
351
|
+
*
|
352
|
+
* @param {Object} val The value to test
|
353
|
+
* @returns {boolean} True if value is an Arguments object, otherwise false
|
354
|
+
*/
|
355
|
+
function isArguments(val) {
|
356
|
+
return toString.call(val) === '[object Arguments]';
|
357
|
+
}
|
358
|
+
|
346
359
|
/**
|
347
360
|
* Iterate over an Array or an Object invoking a function for each item.
|
348
361
|
*
|
@@ -362,16 +375,16 @@ var axios =
|
|
362
375
|
}
|
363
376
|
|
364
377
|
// Check if obj is array-like
|
365
|
-
var
|
378
|
+
var isArrayLike = isArray(obj) || isArguments(obj);
|
366
379
|
|
367
380
|
// Force an array if not already something iterable
|
368
|
-
if (typeof obj !== 'object' && !
|
381
|
+
if (typeof obj !== 'object' && !isArrayLike) {
|
369
382
|
obj = [obj];
|
370
383
|
}
|
371
384
|
|
372
385
|
// Iterate over array values
|
373
|
-
if (
|
374
|
-
for (var i=0, l=obj.length; i<l; i++) {
|
386
|
+
if (isArrayLike) {
|
387
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
375
388
|
fn.call(null, obj[i], i, obj);
|
376
389
|
}
|
377
390
|
}
|
@@ -402,7 +415,7 @@ var axios =
|
|
402
415
|
* @param {Object} obj1 Object to merge
|
403
416
|
* @returns {Object} Result of all merge properties
|
404
417
|
*/
|
405
|
-
function merge(obj1
|
418
|
+
function merge(/*obj1, obj2, obj3, ...*/) {
|
406
419
|
var result = {};
|
407
420
|
forEach(arguments, function (obj) {
|
408
421
|
forEach(obj, function (val, key) {
|
@@ -429,42 +442,13 @@ var axios =
|
|
429
442
|
trim: trim
|
430
443
|
};
|
431
444
|
|
432
|
-
/***/ },
|
433
|
-
/* 4 */
|
434
|
-
/***/ function(module, exports, __webpack_require__) {
|
435
|
-
|
436
|
-
'use strict';
|
437
|
-
|
438
|
-
/**
|
439
|
-
* Supply a warning to the developer that a method they are using
|
440
|
-
* has been deprecated.
|
441
|
-
*
|
442
|
-
* @param {string} method The name of the deprecated method
|
443
|
-
* @param {string} [instead] The alternate method to use if applicable
|
444
|
-
* @param {string} [docs] The documentation URL to get further details
|
445
|
-
*/
|
446
|
-
module.exports = function deprecatedMethod(method, instead, docs) {
|
447
|
-
try {
|
448
|
-
console.warn(
|
449
|
-
'DEPRECATED method `' + method + '`.' +
|
450
|
-
(instead ? ' Use `' + instead + '` instead.' : '') +
|
451
|
-
' This method will be removed in a future release.');
|
452
|
-
|
453
|
-
if (docs) {
|
454
|
-
console.warn('For more information about usage see ' + docs);
|
455
|
-
}
|
456
|
-
} catch (e) {}
|
457
|
-
};
|
458
|
-
|
459
445
|
|
460
446
|
/***/ },
|
461
|
-
/*
|
447
|
+
/* 4 */
|
462
448
|
/***/ function(module, exports, __webpack_require__) {
|
463
449
|
|
464
450
|
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
|
465
451
|
|
466
|
-
var Promise = __webpack_require__(9).Promise;
|
467
|
-
|
468
452
|
/**
|
469
453
|
* Dispatch a request to the server using whichever adapter
|
470
454
|
* is supported by the current environment.
|
@@ -476,12 +460,12 @@ var axios =
|
|
476
460
|
return new Promise(function (resolve, reject) {
|
477
461
|
try {
|
478
462
|
// For browsers use XHR adapter
|
479
|
-
if (typeof
|
480
|
-
__webpack_require__(
|
463
|
+
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) {
|
464
|
+
__webpack_require__(6)(resolve, reject, config);
|
481
465
|
}
|
482
466
|
// For node use HTTP adapter
|
483
467
|
else if (typeof process !== 'undefined') {
|
484
|
-
__webpack_require__(
|
468
|
+
__webpack_require__(6)(resolve, reject, config);
|
485
469
|
}
|
486
470
|
} catch (e) {
|
487
471
|
reject(e);
|
@@ -490,108 +474,120 @@ var axios =
|
|
490
474
|
};
|
491
475
|
|
492
476
|
|
493
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(
|
477
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
494
478
|
|
495
479
|
/***/ },
|
496
|
-
/*
|
497
|
-
/***/ function(module, exports
|
498
|
-
|
499
|
-
'use strict';
|
480
|
+
/* 5 */
|
481
|
+
/***/ function(module, exports) {
|
500
482
|
|
501
|
-
|
483
|
+
// shim for using process in browser
|
502
484
|
|
503
|
-
|
504
|
-
|
505
|
-
|
485
|
+
var process = module.exports = {};
|
486
|
+
var queue = [];
|
487
|
+
var draining = false;
|
488
|
+
var currentQueue;
|
489
|
+
var queueIndex = -1;
|
490
|
+
|
491
|
+
function cleanUpNextTick() {
|
492
|
+
draining = false;
|
493
|
+
if (currentQueue.length) {
|
494
|
+
queue = currentQueue.concat(queue);
|
495
|
+
} else {
|
496
|
+
queueIndex = -1;
|
497
|
+
}
|
498
|
+
if (queue.length) {
|
499
|
+
drainQueue();
|
500
|
+
}
|
501
|
+
}
|
506
502
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
* @return {Number} An ID used to remove interceptor later
|
514
|
-
*/
|
515
|
-
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
516
|
-
this.handlers.push({
|
517
|
-
fulfilled: fulfilled,
|
518
|
-
rejected: rejected
|
519
|
-
});
|
520
|
-
return this.handlers.length - 1;
|
521
|
-
};
|
503
|
+
function drainQueue() {
|
504
|
+
if (draining) {
|
505
|
+
return;
|
506
|
+
}
|
507
|
+
var timeout = setTimeout(cleanUpNextTick);
|
508
|
+
draining = true;
|
522
509
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
510
|
+
var len = queue.length;
|
511
|
+
while(len) {
|
512
|
+
currentQueue = queue;
|
513
|
+
queue = [];
|
514
|
+
while (++queueIndex < len) {
|
515
|
+
if (currentQueue) {
|
516
|
+
currentQueue[queueIndex].run();
|
517
|
+
}
|
518
|
+
}
|
519
|
+
queueIndex = -1;
|
520
|
+
len = queue.length;
|
521
|
+
}
|
522
|
+
currentQueue = null;
|
523
|
+
draining = false;
|
524
|
+
clearTimeout(timeout);
|
525
|
+
}
|
533
526
|
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
if (h !== null) {
|
545
|
-
fn(h);
|
527
|
+
process.nextTick = function (fun) {
|
528
|
+
var args = new Array(arguments.length - 1);
|
529
|
+
if (arguments.length > 1) {
|
530
|
+
for (var i = 1; i < arguments.length; i++) {
|
531
|
+
args[i - 1] = arguments[i];
|
532
|
+
}
|
533
|
+
}
|
534
|
+
queue.push(new Item(fun, args));
|
535
|
+
if (queue.length === 1 && !draining) {
|
536
|
+
setTimeout(drainQueue, 0);
|
546
537
|
}
|
547
|
-
});
|
548
538
|
};
|
549
539
|
|
550
|
-
|
540
|
+
// v8 likes predictible objects
|
541
|
+
function Item(fun, array) {
|
542
|
+
this.fun = fun;
|
543
|
+
this.array = array;
|
544
|
+
}
|
545
|
+
Item.prototype.run = function () {
|
546
|
+
this.fun.apply(null, this.array);
|
547
|
+
};
|
548
|
+
process.title = 'browser';
|
549
|
+
process.browser = true;
|
550
|
+
process.env = {};
|
551
|
+
process.argv = [];
|
552
|
+
process.version = ''; // empty string to avoid regexp issues
|
553
|
+
process.versions = {};
|
551
554
|
|
555
|
+
function noop() {}
|
552
556
|
|
557
|
+
process.on = noop;
|
558
|
+
process.addListener = noop;
|
559
|
+
process.once = noop;
|
560
|
+
process.off = noop;
|
561
|
+
process.removeListener = noop;
|
562
|
+
process.removeAllListeners = noop;
|
563
|
+
process.emit = noop;
|
553
564
|
|
554
|
-
|
555
|
-
|
556
|
-
|
565
|
+
process.binding = function (name) {
|
566
|
+
throw new Error('process.binding is not supported');
|
567
|
+
};
|
557
568
|
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
* Common use case would be to use `Function.prototype.apply`.
|
562
|
-
*
|
563
|
-
* ```js
|
564
|
-
* function f(x, y, z) {}
|
565
|
-
* var args = [1, 2, 3];
|
566
|
-
* f.apply(null, args);
|
567
|
-
* ```
|
568
|
-
*
|
569
|
-
* With `spread` this example can be re-written.
|
570
|
-
*
|
571
|
-
* ```js
|
572
|
-
* spread(function(x, y, z) {})([1, 2, 3]);
|
573
|
-
* ```
|
574
|
-
*
|
575
|
-
* @param {Function} callback
|
576
|
-
* @returns {Function}
|
577
|
-
*/
|
578
|
-
module.exports = function spread(callback) {
|
579
|
-
return function (arr) {
|
580
|
-
callback.apply(null, arr);
|
581
|
-
};
|
569
|
+
process.cwd = function () { return '/' };
|
570
|
+
process.chdir = function (dir) {
|
571
|
+
throw new Error('process.chdir is not supported');
|
582
572
|
};
|
573
|
+
process.umask = function() { return 0; };
|
574
|
+
|
583
575
|
|
584
576
|
/***/ },
|
585
|
-
/*
|
577
|
+
/* 6 */
|
586
578
|
/***/ function(module, exports, __webpack_require__) {
|
587
579
|
|
580
|
+
'use strict';
|
581
|
+
|
582
|
+
/*global ActiveXObject:true*/
|
583
|
+
|
588
584
|
var defaults = __webpack_require__(2);
|
589
585
|
var utils = __webpack_require__(3);
|
590
|
-
var buildUrl = __webpack_require__(
|
591
|
-
var cookies = __webpack_require__(
|
592
|
-
var parseHeaders = __webpack_require__(
|
593
|
-
var transformData = __webpack_require__(
|
594
|
-
var urlIsSameOrigin = __webpack_require__(
|
586
|
+
var buildUrl = __webpack_require__(7);
|
587
|
+
var cookies = __webpack_require__(8);
|
588
|
+
var parseHeaders = __webpack_require__(9);
|
589
|
+
var transformData = __webpack_require__(10);
|
590
|
+
var urlIsSameOrigin = __webpack_require__(11);
|
595
591
|
|
596
592
|
module.exports = function xhrAdapter(resolve, reject, config) {
|
597
593
|
// Transform request data
|
@@ -602,40 +598,45 @@ var axios =
|
|
602
598
|
);
|
603
599
|
|
604
600
|
// Merge headers
|
605
|
-
var
|
601
|
+
var requestHeaders = utils.merge(
|
606
602
|
defaults.headers.common,
|
607
603
|
defaults.headers[config.method] || {},
|
608
604
|
config.headers || {}
|
609
605
|
);
|
610
606
|
|
611
607
|
if (utils.isFormData(data)) {
|
612
|
-
delete
|
608
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
613
609
|
}
|
614
610
|
|
615
611
|
// Create the request
|
616
|
-
var request = new(XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');
|
612
|
+
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');
|
617
613
|
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true);
|
618
614
|
|
615
|
+
// Set the request timeout in MS
|
616
|
+
request.timeout = config.timeout;
|
617
|
+
|
619
618
|
// Listen for ready state
|
620
619
|
request.onreadystatechange = function () {
|
621
620
|
if (request && request.readyState === 4) {
|
622
621
|
// Prepare the response
|
623
|
-
var
|
622
|
+
var responseHeaders = parseHeaders(request.getAllResponseHeaders());
|
623
|
+
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;
|
624
624
|
var response = {
|
625
625
|
data: transformData(
|
626
|
-
|
627
|
-
|
626
|
+
responseData,
|
627
|
+
responseHeaders,
|
628
628
|
config.transformResponse
|
629
629
|
),
|
630
630
|
status: request.status,
|
631
|
-
|
631
|
+
statusText: request.statusText,
|
632
|
+
headers: responseHeaders,
|
632
633
|
config: config
|
633
634
|
};
|
634
635
|
|
635
636
|
// Resolve or reject the Promise based on the status
|
636
|
-
(request.status >= 200 && request.status < 300
|
637
|
-
|
638
|
-
|
637
|
+
(request.status >= 200 && request.status < 300 ?
|
638
|
+
resolve :
|
639
|
+
reject)(response);
|
639
640
|
|
640
641
|
// Clean up request
|
641
642
|
request = null;
|
@@ -643,18 +644,18 @@ var axios =
|
|
643
644
|
};
|
644
645
|
|
645
646
|
// Add xsrf header
|
646
|
-
var xsrfValue = urlIsSameOrigin(config.url)
|
647
|
-
|
648
|
-
|
647
|
+
var xsrfValue = urlIsSameOrigin(config.url) ?
|
648
|
+
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) :
|
649
|
+
undefined;
|
649
650
|
if (xsrfValue) {
|
650
|
-
|
651
|
+
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue;
|
651
652
|
}
|
652
653
|
|
653
654
|
// Add headers to the request
|
654
|
-
utils.forEach(
|
655
|
+
utils.forEach(requestHeaders, function (val, key) {
|
655
656
|
// Remove Content-Type if data is undefined
|
656
657
|
if (!data && key.toLowerCase() === 'content-type') {
|
657
|
-
delete
|
658
|
+
delete requestHeaders[key];
|
658
659
|
}
|
659
660
|
// Otherwise add header to the request
|
660
661
|
else {
|
@@ -686,1149 +687,99 @@ var axios =
|
|
686
687
|
request.send(data);
|
687
688
|
};
|
688
689
|
|
690
|
+
|
689
691
|
/***/ },
|
690
|
-
/*
|
692
|
+
/* 7 */
|
691
693
|
/***/ function(module, exports, __webpack_require__) {
|
692
694
|
|
693
|
-
|
694
|
-
* @overview es6-promise - a tiny implementation of Promises/A+.
|
695
|
-
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
696
|
-
* @license Licensed under MIT license
|
697
|
-
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
|
698
|
-
* @version 2.0.1
|
699
|
-
*/
|
695
|
+
'use strict';
|
700
696
|
|
701
|
-
(
|
702
|
-
"use strict";
|
697
|
+
var utils = __webpack_require__(3);
|
703
698
|
|
704
|
-
|
705
|
-
|
706
|
-
|
699
|
+
function encode(val) {
|
700
|
+
return encodeURIComponent(val).
|
701
|
+
replace(/%40/gi, '@').
|
702
|
+
replace(/%3A/gi, ':').
|
703
|
+
replace(/%24/g, '$').
|
704
|
+
replace(/%2C/gi, ',').
|
705
|
+
replace(/%20/g, '+').
|
706
|
+
replace(/%5B/gi, '[').
|
707
|
+
replace(/%5D/gi, ']');
|
708
|
+
}
|
707
709
|
|
708
|
-
|
709
|
-
|
710
|
-
|
710
|
+
/**
|
711
|
+
* Build a URL by appending params to the end
|
712
|
+
*
|
713
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
714
|
+
* @param {object} [params] The params to be appended
|
715
|
+
* @returns {string} The formatted url
|
716
|
+
*/
|
717
|
+
module.exports = function buildUrl(url, params) {
|
718
|
+
if (!params) {
|
719
|
+
return url;
|
720
|
+
}
|
711
721
|
|
712
|
-
|
713
|
-
return typeof x === 'object' && x !== null;
|
714
|
-
}
|
722
|
+
var parts = [];
|
715
723
|
|
716
|
-
|
724
|
+
utils.forEach(params, function (val, key) {
|
725
|
+
if (val === null || typeof val === 'undefined') {
|
726
|
+
return;
|
727
|
+
}
|
717
728
|
|
718
|
-
if (
|
719
|
-
|
720
|
-
return Object.prototype.toString.call(x) === '[object Array]';
|
721
|
-
};
|
722
|
-
} else {
|
723
|
-
$$utils$$_isArray = Array.isArray;
|
729
|
+
if (utils.isArray(val)) {
|
730
|
+
key = key + '[]';
|
724
731
|
}
|
725
732
|
|
726
|
-
|
727
|
-
|
728
|
-
|
733
|
+
if (!utils.isArray(val)) {
|
734
|
+
val = [val];
|
735
|
+
}
|
729
736
|
|
730
|
-
|
731
|
-
if (
|
732
|
-
|
737
|
+
utils.forEach(val, function (v) {
|
738
|
+
if (utils.isDate(v)) {
|
739
|
+
v = v.toISOString();
|
733
740
|
}
|
734
|
-
if (
|
735
|
-
|
741
|
+
else if (utils.isObject(v)) {
|
742
|
+
v = JSON.stringify(v);
|
736
743
|
}
|
737
|
-
|
738
|
-
return new $$utils$$F();
|
744
|
+
parts.push(encode(key) + '=' + encode(v));
|
739
745
|
});
|
746
|
+
});
|
740
747
|
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
$$asap$$queue[$$asap$$len] = callback;
|
745
|
-
$$asap$$queue[$$asap$$len + 1] = arg;
|
746
|
-
$$asap$$len += 2;
|
747
|
-
if ($$asap$$len === 2) {
|
748
|
-
// If len is 1, that means that we need to schedule an async flush.
|
749
|
-
// If additional callbacks are queued before the queue is flushed, they
|
750
|
-
// will be processed by this flush that we are scheduling.
|
751
|
-
$$asap$$scheduleFlush();
|
752
|
-
}
|
753
|
-
};
|
748
|
+
if (parts.length > 0) {
|
749
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
|
750
|
+
}
|
754
751
|
|
755
|
-
|
756
|
-
|
752
|
+
return url;
|
753
|
+
};
|
757
754
|
|
758
|
-
// test for web worker but not in IE10
|
759
|
-
var $$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
|
760
|
-
typeof importScripts !== 'undefined' &&
|
761
|
-
typeof MessageChannel !== 'undefined';
|
762
755
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
process.nextTick($$asap$$flush);
|
767
|
-
};
|
768
|
-
}
|
756
|
+
/***/ },
|
757
|
+
/* 8 */
|
758
|
+
/***/ function(module, exports, __webpack_require__) {
|
769
759
|
|
770
|
-
|
771
|
-
var iterations = 0;
|
772
|
-
var observer = new $$asap$$BrowserMutationObserver($$asap$$flush);
|
773
|
-
var node = document.createTextNode('');
|
774
|
-
observer.observe(node, { characterData: true });
|
760
|
+
'use strict';
|
775
761
|
|
776
|
-
|
777
|
-
node.data = (iterations = ++iterations % 2);
|
778
|
-
};
|
779
|
-
}
|
762
|
+
var utils = __webpack_require__(3);
|
780
763
|
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
return function () {
|
786
|
-
channel.port2.postMessage(0);
|
787
|
-
};
|
788
|
-
}
|
764
|
+
module.exports = {
|
765
|
+
write: function write(name, value, expires, path, domain, secure) {
|
766
|
+
var cookie = [];
|
767
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
789
768
|
|
790
|
-
|
791
|
-
|
792
|
-
setTimeout($$asap$$flush, 1);
|
793
|
-
};
|
769
|
+
if (utils.isNumber(expires)) {
|
770
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
794
771
|
}
|
795
772
|
|
796
|
-
|
797
|
-
|
798
|
-
function $$asap$$flush() {
|
799
|
-
for (var i = 0; i < $$asap$$len; i+=2) {
|
800
|
-
var callback = $$asap$$queue[i];
|
801
|
-
var arg = $$asap$$queue[i+1];
|
802
|
-
|
803
|
-
callback(arg);
|
804
|
-
|
805
|
-
$$asap$$queue[i] = undefined;
|
806
|
-
$$asap$$queue[i+1] = undefined;
|
807
|
-
}
|
808
|
-
|
809
|
-
$$asap$$len = 0;
|
773
|
+
if (utils.isString(path)) {
|
774
|
+
cookie.push('path=' + path);
|
810
775
|
}
|
811
776
|
|
812
|
-
|
813
|
-
|
814
|
-
// Decide what async method to use to triggering processing of queued callbacks:
|
815
|
-
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
816
|
-
$$asap$$scheduleFlush = $$asap$$useNextTick();
|
817
|
-
} else if ($$asap$$BrowserMutationObserver) {
|
818
|
-
$$asap$$scheduleFlush = $$asap$$useMutationObserver();
|
819
|
-
} else if ($$asap$$isWorker) {
|
820
|
-
$$asap$$scheduleFlush = $$asap$$useMessageChannel();
|
821
|
-
} else {
|
822
|
-
$$asap$$scheduleFlush = $$asap$$useSetTimeout();
|
777
|
+
if (utils.isString(domain)) {
|
778
|
+
cookie.push('domain=' + domain);
|
823
779
|
}
|
824
780
|
|
825
|
-
|
826
|
-
|
827
|
-
var $$$internal$$FULFILLED = 1;
|
828
|
-
var $$$internal$$REJECTED = 2;
|
829
|
-
var $$$internal$$GET_THEN_ERROR = new $$$internal$$ErrorObject();
|
830
|
-
|
831
|
-
function $$$internal$$selfFullfillment() {
|
832
|
-
return new TypeError("You cannot resolve a promise with itself");
|
833
|
-
}
|
834
|
-
|
835
|
-
function $$$internal$$cannotReturnOwn() {
|
836
|
-
return new TypeError('A promises callback cannot return that same promise.')
|
837
|
-
}
|
838
|
-
|
839
|
-
function $$$internal$$getThen(promise) {
|
840
|
-
try {
|
841
|
-
return promise.then;
|
842
|
-
} catch(error) {
|
843
|
-
$$$internal$$GET_THEN_ERROR.error = error;
|
844
|
-
return $$$internal$$GET_THEN_ERROR;
|
845
|
-
}
|
846
|
-
}
|
847
|
-
|
848
|
-
function $$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
|
849
|
-
try {
|
850
|
-
then.call(value, fulfillmentHandler, rejectionHandler);
|
851
|
-
} catch(e) {
|
852
|
-
return e;
|
853
|
-
}
|
854
|
-
}
|
855
|
-
|
856
|
-
function $$$internal$$handleForeignThenable(promise, thenable, then) {
|
857
|
-
$$asap$$default(function(promise) {
|
858
|
-
var sealed = false;
|
859
|
-
var error = $$$internal$$tryThen(then, thenable, function(value) {
|
860
|
-
if (sealed) { return; }
|
861
|
-
sealed = true;
|
862
|
-
if (thenable !== value) {
|
863
|
-
$$$internal$$resolve(promise, value);
|
864
|
-
} else {
|
865
|
-
$$$internal$$fulfill(promise, value);
|
866
|
-
}
|
867
|
-
}, function(reason) {
|
868
|
-
if (sealed) { return; }
|
869
|
-
sealed = true;
|
870
|
-
|
871
|
-
$$$internal$$reject(promise, reason);
|
872
|
-
}, 'Settle: ' + (promise._label || ' unknown promise'));
|
873
|
-
|
874
|
-
if (!sealed && error) {
|
875
|
-
sealed = true;
|
876
|
-
$$$internal$$reject(promise, error);
|
877
|
-
}
|
878
|
-
}, promise);
|
879
|
-
}
|
880
|
-
|
881
|
-
function $$$internal$$handleOwnThenable(promise, thenable) {
|
882
|
-
if (thenable._state === $$$internal$$FULFILLED) {
|
883
|
-
$$$internal$$fulfill(promise, thenable._result);
|
884
|
-
} else if (promise._state === $$$internal$$REJECTED) {
|
885
|
-
$$$internal$$reject(promise, thenable._result);
|
886
|
-
} else {
|
887
|
-
$$$internal$$subscribe(thenable, undefined, function(value) {
|
888
|
-
$$$internal$$resolve(promise, value);
|
889
|
-
}, function(reason) {
|
890
|
-
$$$internal$$reject(promise, reason);
|
891
|
-
});
|
892
|
-
}
|
893
|
-
}
|
894
|
-
|
895
|
-
function $$$internal$$handleMaybeThenable(promise, maybeThenable) {
|
896
|
-
if (maybeThenable.constructor === promise.constructor) {
|
897
|
-
$$$internal$$handleOwnThenable(promise, maybeThenable);
|
898
|
-
} else {
|
899
|
-
var then = $$$internal$$getThen(maybeThenable);
|
900
|
-
|
901
|
-
if (then === $$$internal$$GET_THEN_ERROR) {
|
902
|
-
$$$internal$$reject(promise, $$$internal$$GET_THEN_ERROR.error);
|
903
|
-
} else if (then === undefined) {
|
904
|
-
$$$internal$$fulfill(promise, maybeThenable);
|
905
|
-
} else if ($$utils$$isFunction(then)) {
|
906
|
-
$$$internal$$handleForeignThenable(promise, maybeThenable, then);
|
907
|
-
} else {
|
908
|
-
$$$internal$$fulfill(promise, maybeThenable);
|
909
|
-
}
|
910
|
-
}
|
911
|
-
}
|
912
|
-
|
913
|
-
function $$$internal$$resolve(promise, value) {
|
914
|
-
if (promise === value) {
|
915
|
-
$$$internal$$reject(promise, $$$internal$$selfFullfillment());
|
916
|
-
} else if ($$utils$$objectOrFunction(value)) {
|
917
|
-
$$$internal$$handleMaybeThenable(promise, value);
|
918
|
-
} else {
|
919
|
-
$$$internal$$fulfill(promise, value);
|
920
|
-
}
|
921
|
-
}
|
922
|
-
|
923
|
-
function $$$internal$$publishRejection(promise) {
|
924
|
-
if (promise._onerror) {
|
925
|
-
promise._onerror(promise._result);
|
926
|
-
}
|
927
|
-
|
928
|
-
$$$internal$$publish(promise);
|
929
|
-
}
|
930
|
-
|
931
|
-
function $$$internal$$fulfill(promise, value) {
|
932
|
-
if (promise._state !== $$$internal$$PENDING) { return; }
|
933
|
-
|
934
|
-
promise._result = value;
|
935
|
-
promise._state = $$$internal$$FULFILLED;
|
936
|
-
|
937
|
-
if (promise._subscribers.length === 0) {
|
938
|
-
} else {
|
939
|
-
$$asap$$default($$$internal$$publish, promise);
|
940
|
-
}
|
941
|
-
}
|
942
|
-
|
943
|
-
function $$$internal$$reject(promise, reason) {
|
944
|
-
if (promise._state !== $$$internal$$PENDING) { return; }
|
945
|
-
promise._state = $$$internal$$REJECTED;
|
946
|
-
promise._result = reason;
|
947
|
-
|
948
|
-
$$asap$$default($$$internal$$publishRejection, promise);
|
949
|
-
}
|
950
|
-
|
951
|
-
function $$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
|
952
|
-
var subscribers = parent._subscribers;
|
953
|
-
var length = subscribers.length;
|
954
|
-
|
955
|
-
parent._onerror = null;
|
956
|
-
|
957
|
-
subscribers[length] = child;
|
958
|
-
subscribers[length + $$$internal$$FULFILLED] = onFulfillment;
|
959
|
-
subscribers[length + $$$internal$$REJECTED] = onRejection;
|
960
|
-
|
961
|
-
if (length === 0 && parent._state) {
|
962
|
-
$$asap$$default($$$internal$$publish, parent);
|
963
|
-
}
|
964
|
-
}
|
965
|
-
|
966
|
-
function $$$internal$$publish(promise) {
|
967
|
-
var subscribers = promise._subscribers;
|
968
|
-
var settled = promise._state;
|
969
|
-
|
970
|
-
if (subscribers.length === 0) { return; }
|
971
|
-
|
972
|
-
var child, callback, detail = promise._result;
|
973
|
-
|
974
|
-
for (var i = 0; i < subscribers.length; i += 3) {
|
975
|
-
child = subscribers[i];
|
976
|
-
callback = subscribers[i + settled];
|
977
|
-
|
978
|
-
if (child) {
|
979
|
-
$$$internal$$invokeCallback(settled, child, callback, detail);
|
980
|
-
} else {
|
981
|
-
callback(detail);
|
982
|
-
}
|
983
|
-
}
|
984
|
-
|
985
|
-
promise._subscribers.length = 0;
|
986
|
-
}
|
987
|
-
|
988
|
-
function $$$internal$$ErrorObject() {
|
989
|
-
this.error = null;
|
990
|
-
}
|
991
|
-
|
992
|
-
var $$$internal$$TRY_CATCH_ERROR = new $$$internal$$ErrorObject();
|
993
|
-
|
994
|
-
function $$$internal$$tryCatch(callback, detail) {
|
995
|
-
try {
|
996
|
-
return callback(detail);
|
997
|
-
} catch(e) {
|
998
|
-
$$$internal$$TRY_CATCH_ERROR.error = e;
|
999
|
-
return $$$internal$$TRY_CATCH_ERROR;
|
1000
|
-
}
|
1001
|
-
}
|
1002
|
-
|
1003
|
-
function $$$internal$$invokeCallback(settled, promise, callback, detail) {
|
1004
|
-
var hasCallback = $$utils$$isFunction(callback),
|
1005
|
-
value, error, succeeded, failed;
|
1006
|
-
|
1007
|
-
if (hasCallback) {
|
1008
|
-
value = $$$internal$$tryCatch(callback, detail);
|
1009
|
-
|
1010
|
-
if (value === $$$internal$$TRY_CATCH_ERROR) {
|
1011
|
-
failed = true;
|
1012
|
-
error = value.error;
|
1013
|
-
value = null;
|
1014
|
-
} else {
|
1015
|
-
succeeded = true;
|
1016
|
-
}
|
1017
|
-
|
1018
|
-
if (promise === value) {
|
1019
|
-
$$$internal$$reject(promise, $$$internal$$cannotReturnOwn());
|
1020
|
-
return;
|
1021
|
-
}
|
1022
|
-
|
1023
|
-
} else {
|
1024
|
-
value = detail;
|
1025
|
-
succeeded = true;
|
1026
|
-
}
|
1027
|
-
|
1028
|
-
if (promise._state !== $$$internal$$PENDING) {
|
1029
|
-
// noop
|
1030
|
-
} else if (hasCallback && succeeded) {
|
1031
|
-
$$$internal$$resolve(promise, value);
|
1032
|
-
} else if (failed) {
|
1033
|
-
$$$internal$$reject(promise, error);
|
1034
|
-
} else if (settled === $$$internal$$FULFILLED) {
|
1035
|
-
$$$internal$$fulfill(promise, value);
|
1036
|
-
} else if (settled === $$$internal$$REJECTED) {
|
1037
|
-
$$$internal$$reject(promise, value);
|
1038
|
-
}
|
1039
|
-
}
|
1040
|
-
|
1041
|
-
function $$$internal$$initializePromise(promise, resolver) {
|
1042
|
-
try {
|
1043
|
-
resolver(function resolvePromise(value){
|
1044
|
-
$$$internal$$resolve(promise, value);
|
1045
|
-
}, function rejectPromise(reason) {
|
1046
|
-
$$$internal$$reject(promise, reason);
|
1047
|
-
});
|
1048
|
-
} catch(e) {
|
1049
|
-
$$$internal$$reject(promise, e);
|
1050
|
-
}
|
1051
|
-
}
|
1052
|
-
|
1053
|
-
function $$$enumerator$$makeSettledResult(state, position, value) {
|
1054
|
-
if (state === $$$internal$$FULFILLED) {
|
1055
|
-
return {
|
1056
|
-
state: 'fulfilled',
|
1057
|
-
value: value
|
1058
|
-
};
|
1059
|
-
} else {
|
1060
|
-
return {
|
1061
|
-
state: 'rejected',
|
1062
|
-
reason: value
|
1063
|
-
};
|
1064
|
-
}
|
1065
|
-
}
|
1066
|
-
|
1067
|
-
function $$$enumerator$$Enumerator(Constructor, input, abortOnReject, label) {
|
1068
|
-
this._instanceConstructor = Constructor;
|
1069
|
-
this.promise = new Constructor($$$internal$$noop, label);
|
1070
|
-
this._abortOnReject = abortOnReject;
|
1071
|
-
|
1072
|
-
if (this._validateInput(input)) {
|
1073
|
-
this._input = input;
|
1074
|
-
this.length = input.length;
|
1075
|
-
this._remaining = input.length;
|
1076
|
-
|
1077
|
-
this._init();
|
1078
|
-
|
1079
|
-
if (this.length === 0) {
|
1080
|
-
$$$internal$$fulfill(this.promise, this._result);
|
1081
|
-
} else {
|
1082
|
-
this.length = this.length || 0;
|
1083
|
-
this._enumerate();
|
1084
|
-
if (this._remaining === 0) {
|
1085
|
-
$$$internal$$fulfill(this.promise, this._result);
|
1086
|
-
}
|
1087
|
-
}
|
1088
|
-
} else {
|
1089
|
-
$$$internal$$reject(this.promise, this._validationError());
|
1090
|
-
}
|
1091
|
-
}
|
1092
|
-
|
1093
|
-
$$$enumerator$$Enumerator.prototype._validateInput = function(input) {
|
1094
|
-
return $$utils$$isArray(input);
|
1095
|
-
};
|
1096
|
-
|
1097
|
-
$$$enumerator$$Enumerator.prototype._validationError = function() {
|
1098
|
-
return new Error('Array Methods must be provided an Array');
|
1099
|
-
};
|
1100
|
-
|
1101
|
-
$$$enumerator$$Enumerator.prototype._init = function() {
|
1102
|
-
this._result = new Array(this.length);
|
1103
|
-
};
|
1104
|
-
|
1105
|
-
var $$$enumerator$$default = $$$enumerator$$Enumerator;
|
1106
|
-
|
1107
|
-
$$$enumerator$$Enumerator.prototype._enumerate = function() {
|
1108
|
-
var length = this.length;
|
1109
|
-
var promise = this.promise;
|
1110
|
-
var input = this._input;
|
1111
|
-
|
1112
|
-
for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
|
1113
|
-
this._eachEntry(input[i], i);
|
1114
|
-
}
|
1115
|
-
};
|
1116
|
-
|
1117
|
-
$$$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
|
1118
|
-
var c = this._instanceConstructor;
|
1119
|
-
if ($$utils$$isMaybeThenable(entry)) {
|
1120
|
-
if (entry.constructor === c && entry._state !== $$$internal$$PENDING) {
|
1121
|
-
entry._onerror = null;
|
1122
|
-
this._settledAt(entry._state, i, entry._result);
|
1123
|
-
} else {
|
1124
|
-
this._willSettleAt(c.resolve(entry), i);
|
1125
|
-
}
|
1126
|
-
} else {
|
1127
|
-
this._remaining--;
|
1128
|
-
this._result[i] = this._makeResult($$$internal$$FULFILLED, i, entry);
|
1129
|
-
}
|
1130
|
-
};
|
1131
|
-
|
1132
|
-
$$$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
|
1133
|
-
var promise = this.promise;
|
1134
|
-
|
1135
|
-
if (promise._state === $$$internal$$PENDING) {
|
1136
|
-
this._remaining--;
|
1137
|
-
|
1138
|
-
if (this._abortOnReject && state === $$$internal$$REJECTED) {
|
1139
|
-
$$$internal$$reject(promise, value);
|
1140
|
-
} else {
|
1141
|
-
this._result[i] = this._makeResult(state, i, value);
|
1142
|
-
}
|
1143
|
-
}
|
1144
|
-
|
1145
|
-
if (this._remaining === 0) {
|
1146
|
-
$$$internal$$fulfill(promise, this._result);
|
1147
|
-
}
|
1148
|
-
};
|
1149
|
-
|
1150
|
-
$$$enumerator$$Enumerator.prototype._makeResult = function(state, i, value) {
|
1151
|
-
return value;
|
1152
|
-
};
|
1153
|
-
|
1154
|
-
$$$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
|
1155
|
-
var enumerator = this;
|
1156
|
-
|
1157
|
-
$$$internal$$subscribe(promise, undefined, function(value) {
|
1158
|
-
enumerator._settledAt($$$internal$$FULFILLED, i, value);
|
1159
|
-
}, function(reason) {
|
1160
|
-
enumerator._settledAt($$$internal$$REJECTED, i, reason);
|
1161
|
-
});
|
1162
|
-
};
|
1163
|
-
|
1164
|
-
var $$promise$all$$default = function all(entries, label) {
|
1165
|
-
return new $$$enumerator$$default(this, entries, true /* abort on reject */, label).promise;
|
1166
|
-
};
|
1167
|
-
|
1168
|
-
var $$promise$race$$default = function race(entries, label) {
|
1169
|
-
/*jshint validthis:true */
|
1170
|
-
var Constructor = this;
|
1171
|
-
|
1172
|
-
var promise = new Constructor($$$internal$$noop, label);
|
1173
|
-
|
1174
|
-
if (!$$utils$$isArray(entries)) {
|
1175
|
-
$$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
|
1176
|
-
return promise;
|
1177
|
-
}
|
1178
|
-
|
1179
|
-
var length = entries.length;
|
1180
|
-
|
1181
|
-
function onFulfillment(value) {
|
1182
|
-
$$$internal$$resolve(promise, value);
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
function onRejection(reason) {
|
1186
|
-
$$$internal$$reject(promise, reason);
|
1187
|
-
}
|
1188
|
-
|
1189
|
-
for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
|
1190
|
-
$$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
|
1191
|
-
}
|
1192
|
-
|
1193
|
-
return promise;
|
1194
|
-
};
|
1195
|
-
|
1196
|
-
var $$promise$resolve$$default = function resolve(object, label) {
|
1197
|
-
/*jshint validthis:true */
|
1198
|
-
var Constructor = this;
|
1199
|
-
|
1200
|
-
if (object && typeof object === 'object' && object.constructor === Constructor) {
|
1201
|
-
return object;
|
1202
|
-
}
|
1203
|
-
|
1204
|
-
var promise = new Constructor($$$internal$$noop, label);
|
1205
|
-
$$$internal$$resolve(promise, object);
|
1206
|
-
return promise;
|
1207
|
-
};
|
1208
|
-
|
1209
|
-
var $$promise$reject$$default = function reject(reason, label) {
|
1210
|
-
/*jshint validthis:true */
|
1211
|
-
var Constructor = this;
|
1212
|
-
var promise = new Constructor($$$internal$$noop, label);
|
1213
|
-
$$$internal$$reject(promise, reason);
|
1214
|
-
return promise;
|
1215
|
-
};
|
1216
|
-
|
1217
|
-
var $$es6$promise$promise$$counter = 0;
|
1218
|
-
|
1219
|
-
function $$es6$promise$promise$$needsResolver() {
|
1220
|
-
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
|
1221
|
-
}
|
1222
|
-
|
1223
|
-
function $$es6$promise$promise$$needsNew() {
|
1224
|
-
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
1225
|
-
}
|
1226
|
-
|
1227
|
-
var $$es6$promise$promise$$default = $$es6$promise$promise$$Promise;
|
1228
|
-
|
1229
|
-
/**
|
1230
|
-
Promise objects represent the eventual result of an asynchronous operation. The
|
1231
|
-
primary way of interacting with a promise is through its `then` method, which
|
1232
|
-
registers callbacks to receive either a promise’s eventual value or the reason
|
1233
|
-
why the promise cannot be fulfilled.
|
1234
|
-
|
1235
|
-
Terminology
|
1236
|
-
-----------
|
1237
|
-
|
1238
|
-
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
|
1239
|
-
- `thenable` is an object or function that defines a `then` method.
|
1240
|
-
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
|
1241
|
-
- `exception` is a value that is thrown using the throw statement.
|
1242
|
-
- `reason` is a value that indicates why a promise was rejected.
|
1243
|
-
- `settled` the final resting state of a promise, fulfilled or rejected.
|
1244
|
-
|
1245
|
-
A promise can be in one of three states: pending, fulfilled, or rejected.
|
1246
|
-
|
1247
|
-
Promises that are fulfilled have a fulfillment value and are in the fulfilled
|
1248
|
-
state. Promises that are rejected have a rejection reason and are in the
|
1249
|
-
rejected state. A fulfillment value is never a thenable.
|
1250
|
-
|
1251
|
-
Promises can also be said to *resolve* a value. If this value is also a
|
1252
|
-
promise, then the original promise's settled state will match the value's
|
1253
|
-
settled state. So a promise that *resolves* a promise that rejects will
|
1254
|
-
itself reject, and a promise that *resolves* a promise that fulfills will
|
1255
|
-
itself fulfill.
|
1256
|
-
|
1257
|
-
|
1258
|
-
Basic Usage:
|
1259
|
-
------------
|
1260
|
-
|
1261
|
-
```js
|
1262
|
-
var promise = new Promise(function(resolve, reject) {
|
1263
|
-
// on success
|
1264
|
-
resolve(value);
|
1265
|
-
|
1266
|
-
// on failure
|
1267
|
-
reject(reason);
|
1268
|
-
});
|
1269
|
-
|
1270
|
-
promise.then(function(value) {
|
1271
|
-
// on fulfillment
|
1272
|
-
}, function(reason) {
|
1273
|
-
// on rejection
|
1274
|
-
});
|
1275
|
-
```
|
1276
|
-
|
1277
|
-
Advanced Usage:
|
1278
|
-
---------------
|
1279
|
-
|
1280
|
-
Promises shine when abstracting away asynchronous interactions such as
|
1281
|
-
`XMLHttpRequest`s.
|
1282
|
-
|
1283
|
-
```js
|
1284
|
-
function getJSON(url) {
|
1285
|
-
return new Promise(function(resolve, reject){
|
1286
|
-
var xhr = new XMLHttpRequest();
|
1287
|
-
|
1288
|
-
xhr.open('GET', url);
|
1289
|
-
xhr.onreadystatechange = handler;
|
1290
|
-
xhr.responseType = 'json';
|
1291
|
-
xhr.setRequestHeader('Accept', 'application/json');
|
1292
|
-
xhr.send();
|
1293
|
-
|
1294
|
-
function handler() {
|
1295
|
-
if (this.readyState === this.DONE) {
|
1296
|
-
if (this.status === 200) {
|
1297
|
-
resolve(this.response);
|
1298
|
-
} else {
|
1299
|
-
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
|
1300
|
-
}
|
1301
|
-
}
|
1302
|
-
};
|
1303
|
-
});
|
1304
|
-
}
|
1305
|
-
|
1306
|
-
getJSON('/posts.json').then(function(json) {
|
1307
|
-
// on fulfillment
|
1308
|
-
}, function(reason) {
|
1309
|
-
// on rejection
|
1310
|
-
});
|
1311
|
-
```
|
1312
|
-
|
1313
|
-
Unlike callbacks, promises are great composable primitives.
|
1314
|
-
|
1315
|
-
```js
|
1316
|
-
Promise.all([
|
1317
|
-
getJSON('/posts'),
|
1318
|
-
getJSON('/comments')
|
1319
|
-
]).then(function(values){
|
1320
|
-
values[0] // => postsJSON
|
1321
|
-
values[1] // => commentsJSON
|
1322
|
-
|
1323
|
-
return values;
|
1324
|
-
});
|
1325
|
-
```
|
1326
|
-
|
1327
|
-
@class Promise
|
1328
|
-
@param {function} resolver
|
1329
|
-
Useful for tooling.
|
1330
|
-
@constructor
|
1331
|
-
*/
|
1332
|
-
function $$es6$promise$promise$$Promise(resolver) {
|
1333
|
-
this._id = $$es6$promise$promise$$counter++;
|
1334
|
-
this._state = undefined;
|
1335
|
-
this._result = undefined;
|
1336
|
-
this._subscribers = [];
|
1337
|
-
|
1338
|
-
if ($$$internal$$noop !== resolver) {
|
1339
|
-
if (!$$utils$$isFunction(resolver)) {
|
1340
|
-
$$es6$promise$promise$$needsResolver();
|
1341
|
-
}
|
1342
|
-
|
1343
|
-
if (!(this instanceof $$es6$promise$promise$$Promise)) {
|
1344
|
-
$$es6$promise$promise$$needsNew();
|
1345
|
-
}
|
1346
|
-
|
1347
|
-
$$$internal$$initializePromise(this, resolver);
|
1348
|
-
}
|
1349
|
-
}
|
1350
|
-
|
1351
|
-
$$es6$promise$promise$$Promise.all = $$promise$all$$default;
|
1352
|
-
$$es6$promise$promise$$Promise.race = $$promise$race$$default;
|
1353
|
-
$$es6$promise$promise$$Promise.resolve = $$promise$resolve$$default;
|
1354
|
-
$$es6$promise$promise$$Promise.reject = $$promise$reject$$default;
|
1355
|
-
|
1356
|
-
$$es6$promise$promise$$Promise.prototype = {
|
1357
|
-
constructor: $$es6$promise$promise$$Promise,
|
1358
|
-
|
1359
|
-
/**
|
1360
|
-
The primary way of interacting with a promise is through its `then` method,
|
1361
|
-
which registers callbacks to receive either a promise's eventual value or the
|
1362
|
-
reason why the promise cannot be fulfilled.
|
1363
|
-
|
1364
|
-
```js
|
1365
|
-
findUser().then(function(user){
|
1366
|
-
// user is available
|
1367
|
-
}, function(reason){
|
1368
|
-
// user is unavailable, and you are given the reason why
|
1369
|
-
});
|
1370
|
-
```
|
1371
|
-
|
1372
|
-
Chaining
|
1373
|
-
--------
|
1374
|
-
|
1375
|
-
The return value of `then` is itself a promise. This second, 'downstream'
|
1376
|
-
promise is resolved with the return value of the first promise's fulfillment
|
1377
|
-
or rejection handler, or rejected if the handler throws an exception.
|
1378
|
-
|
1379
|
-
```js
|
1380
|
-
findUser().then(function (user) {
|
1381
|
-
return user.name;
|
1382
|
-
}, function (reason) {
|
1383
|
-
return 'default name';
|
1384
|
-
}).then(function (userName) {
|
1385
|
-
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
|
1386
|
-
// will be `'default name'`
|
1387
|
-
});
|
1388
|
-
|
1389
|
-
findUser().then(function (user) {
|
1390
|
-
throw new Error('Found user, but still unhappy');
|
1391
|
-
}, function (reason) {
|
1392
|
-
throw new Error('`findUser` rejected and we're unhappy');
|
1393
|
-
}).then(function (value) {
|
1394
|
-
// never reached
|
1395
|
-
}, function (reason) {
|
1396
|
-
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
|
1397
|
-
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
|
1398
|
-
});
|
1399
|
-
```
|
1400
|
-
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
|
1401
|
-
|
1402
|
-
```js
|
1403
|
-
findUser().then(function (user) {
|
1404
|
-
throw new PedagogicalException('Upstream error');
|
1405
|
-
}).then(function (value) {
|
1406
|
-
// never reached
|
1407
|
-
}).then(function (value) {
|
1408
|
-
// never reached
|
1409
|
-
}, function (reason) {
|
1410
|
-
// The `PedgagocialException` is propagated all the way down to here
|
1411
|
-
});
|
1412
|
-
```
|
1413
|
-
|
1414
|
-
Assimilation
|
1415
|
-
------------
|
1416
|
-
|
1417
|
-
Sometimes the value you want to propagate to a downstream promise can only be
|
1418
|
-
retrieved asynchronously. This can be achieved by returning a promise in the
|
1419
|
-
fulfillment or rejection handler. The downstream promise will then be pending
|
1420
|
-
until the returned promise is settled. This is called *assimilation*.
|
1421
|
-
|
1422
|
-
```js
|
1423
|
-
findUser().then(function (user) {
|
1424
|
-
return findCommentsByAuthor(user);
|
1425
|
-
}).then(function (comments) {
|
1426
|
-
// The user's comments are now available
|
1427
|
-
});
|
1428
|
-
```
|
1429
|
-
|
1430
|
-
If the assimliated promise rejects, then the downstream promise will also reject.
|
1431
|
-
|
1432
|
-
```js
|
1433
|
-
findUser().then(function (user) {
|
1434
|
-
return findCommentsByAuthor(user);
|
1435
|
-
}).then(function (comments) {
|
1436
|
-
// If `findCommentsByAuthor` fulfills, we'll have the value here
|
1437
|
-
}, function (reason) {
|
1438
|
-
// If `findCommentsByAuthor` rejects, we'll have the reason here
|
1439
|
-
});
|
1440
|
-
```
|
1441
|
-
|
1442
|
-
Simple Example
|
1443
|
-
--------------
|
1444
|
-
|
1445
|
-
Synchronous Example
|
1446
|
-
|
1447
|
-
```javascript
|
1448
|
-
var result;
|
1449
|
-
|
1450
|
-
try {
|
1451
|
-
result = findResult();
|
1452
|
-
// success
|
1453
|
-
} catch(reason) {
|
1454
|
-
// failure
|
1455
|
-
}
|
1456
|
-
```
|
1457
|
-
|
1458
|
-
Errback Example
|
1459
|
-
|
1460
|
-
```js
|
1461
|
-
findResult(function(result, err){
|
1462
|
-
if (err) {
|
1463
|
-
// failure
|
1464
|
-
} else {
|
1465
|
-
// success
|
1466
|
-
}
|
1467
|
-
});
|
1468
|
-
```
|
1469
|
-
|
1470
|
-
Promise Example;
|
1471
|
-
|
1472
|
-
```javascript
|
1473
|
-
findResult().then(function(result){
|
1474
|
-
// success
|
1475
|
-
}, function(reason){
|
1476
|
-
// failure
|
1477
|
-
});
|
1478
|
-
```
|
1479
|
-
|
1480
|
-
Advanced Example
|
1481
|
-
--------------
|
1482
|
-
|
1483
|
-
Synchronous Example
|
1484
|
-
|
1485
|
-
```javascript
|
1486
|
-
var author, books;
|
1487
|
-
|
1488
|
-
try {
|
1489
|
-
author = findAuthor();
|
1490
|
-
books = findBooksByAuthor(author);
|
1491
|
-
// success
|
1492
|
-
} catch(reason) {
|
1493
|
-
// failure
|
1494
|
-
}
|
1495
|
-
```
|
1496
|
-
|
1497
|
-
Errback Example
|
1498
|
-
|
1499
|
-
```js
|
1500
|
-
|
1501
|
-
function foundBooks(books) {
|
1502
|
-
|
1503
|
-
}
|
1504
|
-
|
1505
|
-
function failure(reason) {
|
1506
|
-
|
1507
|
-
}
|
1508
|
-
|
1509
|
-
findAuthor(function(author, err){
|
1510
|
-
if (err) {
|
1511
|
-
failure(err);
|
1512
|
-
// failure
|
1513
|
-
} else {
|
1514
|
-
try {
|
1515
|
-
findBoooksByAuthor(author, function(books, err) {
|
1516
|
-
if (err) {
|
1517
|
-
failure(err);
|
1518
|
-
} else {
|
1519
|
-
try {
|
1520
|
-
foundBooks(books);
|
1521
|
-
} catch(reason) {
|
1522
|
-
failure(reason);
|
1523
|
-
}
|
1524
|
-
}
|
1525
|
-
});
|
1526
|
-
} catch(error) {
|
1527
|
-
failure(err);
|
1528
|
-
}
|
1529
|
-
// success
|
1530
|
-
}
|
1531
|
-
});
|
1532
|
-
```
|
1533
|
-
|
1534
|
-
Promise Example;
|
1535
|
-
|
1536
|
-
```javascript
|
1537
|
-
findAuthor().
|
1538
|
-
then(findBooksByAuthor).
|
1539
|
-
then(function(books){
|
1540
|
-
// found books
|
1541
|
-
}).catch(function(reason){
|
1542
|
-
// something went wrong
|
1543
|
-
});
|
1544
|
-
```
|
1545
|
-
|
1546
|
-
@method then
|
1547
|
-
@param {Function} onFulfilled
|
1548
|
-
@param {Function} onRejected
|
1549
|
-
Useful for tooling.
|
1550
|
-
@return {Promise}
|
1551
|
-
*/
|
1552
|
-
then: function(onFulfillment, onRejection) {
|
1553
|
-
var parent = this;
|
1554
|
-
var state = parent._state;
|
1555
|
-
|
1556
|
-
if (state === $$$internal$$FULFILLED && !onFulfillment || state === $$$internal$$REJECTED && !onRejection) {
|
1557
|
-
return this;
|
1558
|
-
}
|
1559
|
-
|
1560
|
-
var child = new this.constructor($$$internal$$noop);
|
1561
|
-
var result = parent._result;
|
1562
|
-
|
1563
|
-
if (state) {
|
1564
|
-
var callback = arguments[state - 1];
|
1565
|
-
$$asap$$default(function(){
|
1566
|
-
$$$internal$$invokeCallback(state, child, callback, result);
|
1567
|
-
});
|
1568
|
-
} else {
|
1569
|
-
$$$internal$$subscribe(parent, child, onFulfillment, onRejection);
|
1570
|
-
}
|
1571
|
-
|
1572
|
-
return child;
|
1573
|
-
},
|
1574
|
-
|
1575
|
-
/**
|
1576
|
-
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
1577
|
-
as the catch block of a try/catch statement.
|
1578
|
-
|
1579
|
-
```js
|
1580
|
-
function findAuthor(){
|
1581
|
-
throw new Error('couldn't find that author');
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
// synchronous
|
1585
|
-
try {
|
1586
|
-
findAuthor();
|
1587
|
-
} catch(reason) {
|
1588
|
-
// something went wrong
|
1589
|
-
}
|
1590
|
-
|
1591
|
-
// async with promises
|
1592
|
-
findAuthor().catch(function(reason){
|
1593
|
-
// something went wrong
|
1594
|
-
});
|
1595
|
-
```
|
1596
|
-
|
1597
|
-
@method catch
|
1598
|
-
@param {Function} onRejection
|
1599
|
-
Useful for tooling.
|
1600
|
-
@return {Promise}
|
1601
|
-
*/
|
1602
|
-
'catch': function(onRejection) {
|
1603
|
-
return this.then(null, onRejection);
|
1604
|
-
}
|
1605
|
-
};
|
1606
|
-
|
1607
|
-
var $$es6$promise$polyfill$$default = function polyfill() {
|
1608
|
-
var local;
|
1609
|
-
|
1610
|
-
if (typeof global !== 'undefined') {
|
1611
|
-
local = global;
|
1612
|
-
} else if (typeof window !== 'undefined' && window.document) {
|
1613
|
-
local = window;
|
1614
|
-
} else {
|
1615
|
-
local = self;
|
1616
|
-
}
|
1617
|
-
|
1618
|
-
var es6PromiseSupport =
|
1619
|
-
"Promise" in local &&
|
1620
|
-
// Some of these methods are missing from
|
1621
|
-
// Firefox/Chrome experimental implementations
|
1622
|
-
"resolve" in local.Promise &&
|
1623
|
-
"reject" in local.Promise &&
|
1624
|
-
"all" in local.Promise &&
|
1625
|
-
"race" in local.Promise &&
|
1626
|
-
// Older version of the spec had a resolver object
|
1627
|
-
// as the arg rather than a function
|
1628
|
-
(function() {
|
1629
|
-
var resolve;
|
1630
|
-
new local.Promise(function(r) { resolve = r; });
|
1631
|
-
return $$utils$$isFunction(resolve);
|
1632
|
-
}());
|
1633
|
-
|
1634
|
-
if (!es6PromiseSupport) {
|
1635
|
-
local.Promise = $$es6$promise$promise$$default;
|
1636
|
-
}
|
1637
|
-
};
|
1638
|
-
|
1639
|
-
var es6$promise$umd$$ES6Promise = {
|
1640
|
-
'Promise': $$es6$promise$promise$$default,
|
1641
|
-
'polyfill': $$es6$promise$polyfill$$default
|
1642
|
-
};
|
1643
|
-
|
1644
|
-
/* global define:true module:true window: true */
|
1645
|
-
if ("function" === 'function' && __webpack_require__(16)['amd']) {
|
1646
|
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return es6$promise$umd$$ES6Promise; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
1647
|
-
} else if (typeof module !== 'undefined' && module['exports']) {
|
1648
|
-
module['exports'] = es6$promise$umd$$ES6Promise;
|
1649
|
-
} else if (typeof this !== 'undefined') {
|
1650
|
-
this['ES6Promise'] = es6$promise$umd$$ES6Promise;
|
1651
|
-
}
|
1652
|
-
}).call(this);
|
1653
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), (function() { return this; }()), __webpack_require__(17)(module)))
|
1654
|
-
|
1655
|
-
/***/ },
|
1656
|
-
/* 10 */
|
1657
|
-
/***/ function(module, exports, __webpack_require__) {
|
1658
|
-
|
1659
|
-
// shim for using process in browser
|
1660
|
-
|
1661
|
-
var process = module.exports = {};
|
1662
|
-
|
1663
|
-
process.nextTick = (function () {
|
1664
|
-
var canSetImmediate = typeof window !== 'undefined'
|
1665
|
-
&& window.setImmediate;
|
1666
|
-
var canMutationObserver = typeof window !== 'undefined'
|
1667
|
-
&& window.MutationObserver;
|
1668
|
-
var canPost = typeof window !== 'undefined'
|
1669
|
-
&& window.postMessage && window.addEventListener
|
1670
|
-
;
|
1671
|
-
|
1672
|
-
if (canSetImmediate) {
|
1673
|
-
return function (f) { return window.setImmediate(f) };
|
1674
|
-
}
|
1675
|
-
|
1676
|
-
var queue = [];
|
1677
|
-
|
1678
|
-
if (canMutationObserver) {
|
1679
|
-
var hiddenDiv = document.createElement("div");
|
1680
|
-
var observer = new MutationObserver(function () {
|
1681
|
-
var queueList = queue.slice();
|
1682
|
-
queue.length = 0;
|
1683
|
-
queueList.forEach(function (fn) {
|
1684
|
-
fn();
|
1685
|
-
});
|
1686
|
-
});
|
1687
|
-
|
1688
|
-
observer.observe(hiddenDiv, { attributes: true });
|
1689
|
-
|
1690
|
-
return function nextTick(fn) {
|
1691
|
-
if (!queue.length) {
|
1692
|
-
hiddenDiv.setAttribute('yes', 'no');
|
1693
|
-
}
|
1694
|
-
queue.push(fn);
|
1695
|
-
};
|
1696
|
-
}
|
1697
|
-
|
1698
|
-
if (canPost) {
|
1699
|
-
window.addEventListener('message', function (ev) {
|
1700
|
-
var source = ev.source;
|
1701
|
-
if ((source === window || source === null) && ev.data === 'process-tick') {
|
1702
|
-
ev.stopPropagation();
|
1703
|
-
if (queue.length > 0) {
|
1704
|
-
var fn = queue.shift();
|
1705
|
-
fn();
|
1706
|
-
}
|
1707
|
-
}
|
1708
|
-
}, true);
|
1709
|
-
|
1710
|
-
return function nextTick(fn) {
|
1711
|
-
queue.push(fn);
|
1712
|
-
window.postMessage('process-tick', '*');
|
1713
|
-
};
|
1714
|
-
}
|
1715
|
-
|
1716
|
-
return function nextTick(fn) {
|
1717
|
-
setTimeout(fn, 0);
|
1718
|
-
};
|
1719
|
-
})();
|
1720
|
-
|
1721
|
-
process.title = 'browser';
|
1722
|
-
process.browser = true;
|
1723
|
-
process.env = {};
|
1724
|
-
process.argv = [];
|
1725
|
-
|
1726
|
-
function noop() {}
|
1727
|
-
|
1728
|
-
process.on = noop;
|
1729
|
-
process.addListener = noop;
|
1730
|
-
process.once = noop;
|
1731
|
-
process.off = noop;
|
1732
|
-
process.removeListener = noop;
|
1733
|
-
process.removeAllListeners = noop;
|
1734
|
-
process.emit = noop;
|
1735
|
-
|
1736
|
-
process.binding = function (name) {
|
1737
|
-
throw new Error('process.binding is not supported');
|
1738
|
-
};
|
1739
|
-
|
1740
|
-
// TODO(shtylman)
|
1741
|
-
process.cwd = function () { return '/' };
|
1742
|
-
process.chdir = function (dir) {
|
1743
|
-
throw new Error('process.chdir is not supported');
|
1744
|
-
};
|
1745
|
-
|
1746
|
-
|
1747
|
-
/***/ },
|
1748
|
-
/* 11 */
|
1749
|
-
/***/ function(module, exports, __webpack_require__) {
|
1750
|
-
|
1751
|
-
'use strict';
|
1752
|
-
|
1753
|
-
var utils = __webpack_require__(3);
|
1754
|
-
|
1755
|
-
function encode(val) {
|
1756
|
-
return encodeURIComponent(val).
|
1757
|
-
replace(/%40/gi, '@').
|
1758
|
-
replace(/%3A/gi, ':').
|
1759
|
-
replace(/%24/g, '$').
|
1760
|
-
replace(/%2C/gi, ',').
|
1761
|
-
replace(/%20/g, '+');
|
1762
|
-
}
|
1763
|
-
|
1764
|
-
/**
|
1765
|
-
* Build a URL by appending params to the end
|
1766
|
-
*
|
1767
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
1768
|
-
* @param {object} [params] The params to be appended
|
1769
|
-
* @returns {string} The formatted url
|
1770
|
-
*/
|
1771
|
-
module.exports = function buildUrl(url, params) {
|
1772
|
-
if (!params) {
|
1773
|
-
return url;
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
var parts = [];
|
1777
|
-
|
1778
|
-
utils.forEach(params, function (val, key) {
|
1779
|
-
if (val === null || typeof val === 'undefined') {
|
1780
|
-
return;
|
1781
|
-
}
|
1782
|
-
if (!utils.isArray(val)) {
|
1783
|
-
val = [val];
|
1784
|
-
}
|
1785
|
-
|
1786
|
-
utils.forEach(val, function (v) {
|
1787
|
-
if (utils.isDate(v)) {
|
1788
|
-
v = v.toISOString();
|
1789
|
-
}
|
1790
|
-
else if (utils.isObject(v)) {
|
1791
|
-
v = JSON.stringify(v);
|
1792
|
-
}
|
1793
|
-
parts.push(encode(key) + '=' + encode(v));
|
1794
|
-
});
|
1795
|
-
});
|
1796
|
-
|
1797
|
-
if (parts.length > 0) {
|
1798
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
|
1799
|
-
}
|
1800
|
-
|
1801
|
-
return url;
|
1802
|
-
};
|
1803
|
-
|
1804
|
-
|
1805
|
-
/***/ },
|
1806
|
-
/* 12 */
|
1807
|
-
/***/ function(module, exports, __webpack_require__) {
|
1808
|
-
|
1809
|
-
'use strict';
|
1810
|
-
|
1811
|
-
var utils = __webpack_require__(3);
|
1812
|
-
|
1813
|
-
module.exports = {
|
1814
|
-
write: function write(name, value, expires, path, domain, secure) {
|
1815
|
-
var cookie = [];
|
1816
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
1817
|
-
|
1818
|
-
if (utils.isNumber(expires)) {
|
1819
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
1820
|
-
}
|
1821
|
-
|
1822
|
-
if (utils.isString(path)) {
|
1823
|
-
cookie.push('path=' + path);
|
1824
|
-
}
|
1825
|
-
|
1826
|
-
if (utils.isString(domain)) {
|
1827
|
-
cookie.push('domain=' + domain);
|
1828
|
-
}
|
1829
|
-
|
1830
|
-
if (secure === true) {
|
1831
|
-
cookie.push('secure');
|
781
|
+
if (secure === true) {
|
782
|
+
cookie.push('secure');
|
1832
783
|
}
|
1833
784
|
|
1834
785
|
document.cookie = cookie.join('; ');
|
@@ -1844,8 +795,9 @@ var axios =
|
|
1844
795
|
}
|
1845
796
|
};
|
1846
797
|
|
798
|
+
|
1847
799
|
/***/ },
|
1848
|
-
/*
|
800
|
+
/* 9 */
|
1849
801
|
/***/ function(module, exports, __webpack_require__) {
|
1850
802
|
|
1851
803
|
'use strict';
|
@@ -1868,7 +820,7 @@ var axios =
|
|
1868
820
|
module.exports = function parseHeaders(headers) {
|
1869
821
|
var parsed = {}, key, val, i;
|
1870
822
|
|
1871
|
-
if (!headers) return parsed;
|
823
|
+
if (!headers) { return parsed; }
|
1872
824
|
|
1873
825
|
utils.forEach(headers.split('\n'), function(line) {
|
1874
826
|
i = line.indexOf(':');
|
@@ -1883,8 +835,9 @@ var axios =
|
|
1883
835
|
return parsed;
|
1884
836
|
};
|
1885
837
|
|
838
|
+
|
1886
839
|
/***/ },
|
1887
|
-
/*
|
840
|
+
/* 10 */
|
1888
841
|
/***/ function(module, exports, __webpack_require__) {
|
1889
842
|
|
1890
843
|
'use strict';
|
@@ -1907,16 +860,17 @@ var axios =
|
|
1907
860
|
return data;
|
1908
861
|
};
|
1909
862
|
|
863
|
+
|
1910
864
|
/***/ },
|
1911
|
-
/*
|
865
|
+
/* 11 */
|
1912
866
|
/***/ function(module, exports, __webpack_require__) {
|
1913
867
|
|
1914
868
|
'use strict';
|
1915
869
|
|
1916
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1917
870
|
var utils = __webpack_require__(3);
|
871
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1918
872
|
var urlParsingNode = document.createElement('a');
|
1919
|
-
var originUrl
|
873
|
+
var originUrl;
|
1920
874
|
|
1921
875
|
/**
|
1922
876
|
* Parse a URL to discover it's components
|
@@ -1944,12 +898,14 @@ var axios =
|
|
1944
898
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
1945
899
|
hostname: urlParsingNode.hostname,
|
1946
900
|
port: urlParsingNode.port,
|
1947
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/')
|
1948
|
-
|
1949
|
-
|
901
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
902
|
+
urlParsingNode.pathname :
|
903
|
+
'/' + urlParsingNode.pathname
|
1950
904
|
};
|
1951
905
|
}
|
1952
906
|
|
907
|
+
originUrl = urlResolve(window.location.href);
|
908
|
+
|
1953
909
|
/**
|
1954
910
|
* Determine if a URL shares the same origin as the current location
|
1955
911
|
*
|
@@ -1962,29 +918,100 @@ var axios =
|
|
1962
918
|
parsed.host === originUrl.host);
|
1963
919
|
};
|
1964
920
|
|
921
|
+
|
1965
922
|
/***/ },
|
1966
|
-
/*
|
923
|
+
/* 12 */
|
1967
924
|
/***/ function(module, exports, __webpack_require__) {
|
1968
925
|
|
1969
|
-
|
926
|
+
'use strict';
|
1970
927
|
|
928
|
+
var utils = __webpack_require__(3);
|
1971
929
|
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
930
|
+
function InterceptorManager() {
|
931
|
+
this.handlers = [];
|
932
|
+
}
|
1975
933
|
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
934
|
+
/**
|
935
|
+
* Add a new interceptor to the stack
|
936
|
+
*
|
937
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
938
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
939
|
+
*
|
940
|
+
* @return {Number} An ID used to remove interceptor later
|
941
|
+
*/
|
942
|
+
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
943
|
+
this.handlers.push({
|
944
|
+
fulfilled: fulfilled,
|
945
|
+
rejected: rejected
|
946
|
+
});
|
947
|
+
return this.handlers.length - 1;
|
948
|
+
};
|
949
|
+
|
950
|
+
/**
|
951
|
+
* Remove an interceptor from the stack
|
952
|
+
*
|
953
|
+
* @param {Number} id The ID that was returned by `use`
|
954
|
+
*/
|
955
|
+
InterceptorManager.prototype.eject = function (id) {
|
956
|
+
if (this.handlers[id]) {
|
957
|
+
this.handlers[id] = null;
|
1983
958
|
}
|
1984
|
-
|
1985
|
-
|
959
|
+
};
|
960
|
+
|
961
|
+
/**
|
962
|
+
* Iterate over all the registered interceptors
|
963
|
+
*
|
964
|
+
* This method is particularly useful for skipping over any
|
965
|
+
* interceptors that may have become `null` calling `remove`.
|
966
|
+
*
|
967
|
+
* @param {Function} fn The function to call for each interceptor
|
968
|
+
*/
|
969
|
+
InterceptorManager.prototype.forEach = function (fn) {
|
970
|
+
utils.forEach(this.handlers, function (h) {
|
971
|
+
if (h !== null) {
|
972
|
+
fn(h);
|
973
|
+
}
|
974
|
+
});
|
975
|
+
};
|
976
|
+
|
977
|
+
module.exports = InterceptorManager;
|
978
|
+
|
979
|
+
|
980
|
+
/***/ },
|
981
|
+
/* 13 */
|
982
|
+
/***/ function(module, exports) {
|
983
|
+
|
984
|
+
'use strict';
|
985
|
+
|
986
|
+
/**
|
987
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
988
|
+
*
|
989
|
+
* Common use case would be to use `Function.prototype.apply`.
|
990
|
+
*
|
991
|
+
* ```js
|
992
|
+
* function f(x, y, z) {}
|
993
|
+
* var args = [1, 2, 3];
|
994
|
+
* f.apply(null, args);
|
995
|
+
* ```
|
996
|
+
*
|
997
|
+
* With `spread` this example can be re-written.
|
998
|
+
*
|
999
|
+
* ```js
|
1000
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
1001
|
+
* ```
|
1002
|
+
*
|
1003
|
+
* @param {Function} callback
|
1004
|
+
* @returns {Function}
|
1005
|
+
*/
|
1006
|
+
module.exports = function spread(callback) {
|
1007
|
+
return function (arr) {
|
1008
|
+
callback.apply(null, arr);
|
1009
|
+
};
|
1010
|
+
};
|
1986
1011
|
|
1987
1012
|
|
1988
1013
|
/***/ }
|
1989
1014
|
/******/ ])
|
1015
|
+
});
|
1016
|
+
;
|
1990
1017
|
//# sourceMappingURL=axios.map
|