vuejs-rails 1.0.24 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2577a08c2d277a4f5a7c3afc88ce511c46b59dd
4
- data.tar.gz: 8b7d24d0ea59feb2faccfb2c254256c9070dbcb6
3
+ metadata.gz: e5c3590a5e691190610ef22eddfe294892705fa0
4
+ data.tar.gz: a4bd0b73a31ffa043243aeb9d9e877196026745f
5
5
  SHA512:
6
- metadata.gz: 73424af37a8b27043e74bb640ca90605419b494113d3b99205dc59dfec3c759af51ac2cdf4f1cc0052aba6227414a98ad322978e90d5376cf82eda48b97bcac0
7
- data.tar.gz: 70328412997be4f0393d2f2acd688d1415e28a896cf11f91d592eb64364f10fc934cbbe115d8006e1f229f13dc924a1fa9412993584eb99db43e7ff5cee93a82
6
+ metadata.gz: 7aba42067eec9c960b8c8368558aeeffbd4de682ee15dbfd4be3145dada81e597224d70487e6657e1ea80078380d3110888b6029bb2a47df40571cf62b030608
7
+ data.tar.gz: 67ef924ee0fad31c79df69d1265c6ad64a23d2ef0b22b06dcbf0b5ce08f488b352beab5ca286ce5b166ae2139ee6695cd0b4070386cb9a70fdfa186e3d7a6f7d
@@ -1,5 +1,5 @@
1
1
  module Vue
2
2
  module Rails
3
- VERSION = '1.0.24'
3
+ VERSION = '1.0.26'
4
4
  end
5
5
  end
@@ -1,1686 +1,1318 @@
1
- /**
2
- * vue-resource v0.7.0
1
+ /*!
2
+ * vue-resource v0.9.3
3
3
  * https://github.com/vuejs/vue-resource
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
- (function webpackUniversalModuleDefinition(root, factory) {
8
- if(typeof exports === 'object' && typeof module === 'object')
9
- module.exports = factory();
10
- else if(typeof define === 'function' && define.amd)
11
- define([], factory);
12
- else if(typeof exports === 'object')
13
- exports["VueResource"] = factory();
14
- else
15
- root["VueResource"] = factory();
16
- })(this, function() {
17
- return /******/ (function(modules) { // webpackBootstrap
18
- /******/ // The module cache
19
- /******/ var installedModules = {};
20
-
21
- /******/ // The require function
22
- /******/ function __webpack_require__(moduleId) {
23
-
24
- /******/ // Check if module is in cache
25
- /******/ if(installedModules[moduleId])
26
- /******/ return installedModules[moduleId].exports;
7
+ (function (global, factory) {
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9
+ typeof define === 'function' && define.amd ? define(factory) :
10
+ (global.VueResource = factory());
11
+ }(this, function () { 'use strict';
12
+
13
+ /**
14
+ * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
15
+ */
16
+
17
+ var RESOLVED = 0;
18
+ var REJECTED = 1;
19
+ var PENDING = 2;
20
+
21
+ function Promise$2(executor) {
22
+
23
+ this.state = PENDING;
24
+ this.value = undefined;
25
+ this.deferred = [];
26
+
27
+ var promise = this;
28
+
29
+ try {
30
+ executor(function (x) {
31
+ promise.resolve(x);
32
+ }, function (r) {
33
+ promise.reject(r);
34
+ });
35
+ } catch (e) {
36
+ promise.reject(e);
37
+ }
38
+ }
39
+
40
+ Promise$2.reject = function (r) {
41
+ return new Promise$2(function (resolve, reject) {
42
+ reject(r);
43
+ });
44
+ };
45
+
46
+ Promise$2.resolve = function (x) {
47
+ return new Promise$2(function (resolve, reject) {
48
+ resolve(x);
49
+ });
50
+ };
51
+
52
+ Promise$2.all = function all(iterable) {
53
+ return new Promise$2(function (resolve, reject) {
54
+ var count = 0,
55
+ result = [];
56
+
57
+ if (iterable.length === 0) {
58
+ resolve(result);
59
+ }
60
+
61
+ function resolver(i) {
62
+ return function (x) {
63
+ result[i] = x;
64
+ count += 1;
65
+
66
+ if (count === iterable.length) {
67
+ resolve(result);
68
+ }
69
+ };
70
+ }
71
+
72
+ for (var i = 0; i < iterable.length; i += 1) {
73
+ Promise$2.resolve(iterable[i]).then(resolver(i), reject);
74
+ }
75
+ });
76
+ };
77
+
78
+ Promise$2.race = function race(iterable) {
79
+ return new Promise$2(function (resolve, reject) {
80
+ for (var i = 0; i < iterable.length; i += 1) {
81
+ Promise$2.resolve(iterable[i]).then(resolve, reject);
82
+ }
83
+ });
84
+ };
85
+
86
+ var p$1 = Promise$2.prototype;
87
+
88
+ p$1.resolve = function resolve(x) {
89
+ var promise = this;
90
+
91
+ if (promise.state === PENDING) {
92
+ if (x === promise) {
93
+ throw new TypeError('Promise settled with itself.');
94
+ }
95
+
96
+ var called = false;
97
+
98
+ try {
99
+ var then = x && x['then'];
100
+
101
+ if (x !== null && typeof x === 'object' && typeof then === 'function') {
102
+ then.call(x, function (x) {
103
+ if (!called) {
104
+ promise.resolve(x);
105
+ }
106
+ called = true;
107
+ }, function (r) {
108
+ if (!called) {
109
+ promise.reject(r);
110
+ }
111
+ called = true;
112
+ });
113
+ return;
114
+ }
115
+ } catch (e) {
116
+ if (!called) {
117
+ promise.reject(e);
118
+ }
119
+ return;
120
+ }
121
+
122
+ promise.state = RESOLVED;
123
+ promise.value = x;
124
+ promise.notify();
125
+ }
126
+ };
127
+
128
+ p$1.reject = function reject(reason) {
129
+ var promise = this;
130
+
131
+ if (promise.state === PENDING) {
132
+ if (reason === promise) {
133
+ throw new TypeError('Promise settled with itself.');
134
+ }
135
+
136
+ promise.state = REJECTED;
137
+ promise.value = reason;
138
+ promise.notify();
139
+ }
140
+ };
141
+
142
+ p$1.notify = function notify() {
143
+ var promise = this;
144
+
145
+ nextTick(function () {
146
+ if (promise.state !== PENDING) {
147
+ while (promise.deferred.length) {
148
+ var deferred = promise.deferred.shift(),
149
+ onResolved = deferred[0],
150
+ onRejected = deferred[1],
151
+ resolve = deferred[2],
152
+ reject = deferred[3];
153
+
154
+ try {
155
+ if (promise.state === RESOLVED) {
156
+ if (typeof onResolved === 'function') {
157
+ resolve(onResolved.call(undefined, promise.value));
158
+ } else {
159
+ resolve(promise.value);
160
+ }
161
+ } else if (promise.state === REJECTED) {
162
+ if (typeof onRejected === 'function') {
163
+ resolve(onRejected.call(undefined, promise.value));
164
+ } else {
165
+ reject(promise.value);
166
+ }
167
+ }
168
+ } catch (e) {
169
+ reject(e);
170
+ }
171
+ }
172
+ }
173
+ });
174
+ };
175
+
176
+ p$1.then = function then(onResolved, onRejected) {
177
+ var promise = this;
178
+
179
+ return new Promise$2(function (resolve, reject) {
180
+ promise.deferred.push([onResolved, onRejected, resolve, reject]);
181
+ promise.notify();
182
+ });
183
+ };
184
+
185
+ p$1.catch = function (onRejected) {
186
+ return this.then(undefined, onRejected);
187
+ };
188
+
189
+ var PromiseObj = window.Promise || Promise$2;
190
+
191
+ function Promise$1(executor, context) {
192
+
193
+ if (executor instanceof PromiseObj) {
194
+ this.promise = executor;
195
+ } else {
196
+ this.promise = new PromiseObj(executor.bind(context));
197
+ }
198
+
199
+ this.context = context;
200
+ }
201
+
202
+ Promise$1.all = function (iterable, context) {
203
+ return new Promise$1(PromiseObj.all(iterable), context);
204
+ };
205
+
206
+ Promise$1.resolve = function (value, context) {
207
+ return new Promise$1(PromiseObj.resolve(value), context);
208
+ };
209
+
210
+ Promise$1.reject = function (reason, context) {
211
+ return new Promise$1(PromiseObj.reject(reason), context);
212
+ };
213
+
214
+ Promise$1.race = function (iterable, context) {
215
+ return new Promise$1(PromiseObj.race(iterable), context);
216
+ };
217
+
218
+ var p = Promise$1.prototype;
219
+
220
+ p.bind = function (context) {
221
+ this.context = context;
222
+ return this;
223
+ };
224
+
225
+ p.then = function (fulfilled, rejected) {
226
+
227
+ if (fulfilled && fulfilled.bind && this.context) {
228
+ fulfilled = fulfilled.bind(this.context);
229
+ }
230
+
231
+ if (rejected && rejected.bind && this.context) {
232
+ rejected = rejected.bind(this.context);
233
+ }
234
+
235
+ return new Promise$1(this.promise.then(fulfilled, rejected), this.context);
236
+ };
237
+
238
+ p.catch = function (rejected) {
239
+
240
+ if (rejected && rejected.bind && this.context) {
241
+ rejected = rejected.bind(this.context);
242
+ }
243
+
244
+ return new Promise$1(this.promise.catch(rejected), this.context);
245
+ };
246
+
247
+ p.finally = function (callback) {
248
+
249
+ return this.then(function (value) {
250
+ callback.call(this);
251
+ return value;
252
+ }, function (reason) {
253
+ callback.call(this);
254
+ return PromiseObj.reject(reason);
255
+ });
256
+ };
257
+
258
+ var debug = false;
259
+ var util = {};
260
+ var array = [];
261
+ function Util (Vue) {
262
+ util = Vue.util;
263
+ debug = Vue.config.debug || !Vue.config.silent;
264
+ }
27
265
 
28
- /******/ // Create a new module (and put it into the cache)
29
- /******/ var module = installedModules[moduleId] = {
30
- /******/ exports: {},
31
- /******/ id: moduleId,
32
- /******/ loaded: false
33
- /******/ };
34
-
35
- /******/ // Execute the module function
36
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
37
-
38
- /******/ // Flag the module as loaded
39
- /******/ module.loaded = true;
40
-
41
- /******/ // Return the exports of the module
42
- /******/ return module.exports;
43
- /******/ }
44
-
45
-
46
- /******/ // expose the modules object (__webpack_modules__)
47
- /******/ __webpack_require__.m = modules;
48
-
49
- /******/ // expose the module cache
50
- /******/ __webpack_require__.c = installedModules;
51
-
52
- /******/ // __webpack_public_path__
53
- /******/ __webpack_require__.p = "";
54
-
55
- /******/ // Load entry module and return exports
56
- /******/ return __webpack_require__(0);
57
- /******/ })
58
- /************************************************************************/
59
- /******/ ([
60
- /* 0 */
61
- /***/ function(module, exports, __webpack_require__) {
62
-
63
- /**
64
- * Install plugin.
65
- */
66
-
67
- function install(Vue) {
266
+ function warn(msg) {
267
+ if (typeof console !== 'undefined' && debug) {
268
+ console.warn('[VueResource warn]: ' + msg);
269
+ }
270
+ }
68
271
 
69
- var _ = __webpack_require__(1);
272
+ function error(msg) {
273
+ if (typeof console !== 'undefined') {
274
+ console.error(msg);
275
+ }
276
+ }
70
277
 
71
- _.config = Vue.config;
72
- _.warning = Vue.util.warn;
73
- _.nextTick = Vue.util.nextTick;
278
+ function nextTick(cb, ctx) {
279
+ return util.nextTick(cb, ctx);
280
+ }
74
281
 
75
- Vue.url = __webpack_require__(2);
76
- Vue.http = __webpack_require__(8);
77
- Vue.resource = __webpack_require__(23);
78
- Vue.Promise = __webpack_require__(10);
282
+ function trim(str) {
283
+ return str.replace(/^\s*|\s*$/g, '');
284
+ }
79
285
 
80
- Object.defineProperties(Vue.prototype, {
286
+ var isArray = Array.isArray;
81
287
 
82
- $url: {
83
- get: function () {
84
- return _.options(Vue.url, this, this.$options.url);
85
- }
86
- },
288
+ function isString(val) {
289
+ return typeof val === 'string';
290
+ }
87
291
 
88
- $http: {
89
- get: function () {
90
- return _.options(Vue.http, this, this.$options.http);
91
- }
92
- },
93
-
94
- $resource: {
95
- get: function () {
96
- return Vue.resource.bind(this);
97
- }
98
- },
292
+ function isBoolean(val) {
293
+ return val === true || val === false;
294
+ }
99
295
 
100
- $promise: {
101
- get: function () {
102
- return function (executor) {
103
- return new Vue.Promise(executor, this);
104
- }.bind(this);
105
- }
106
- }
107
-
108
- });
109
- }
296
+ function isFunction(val) {
297
+ return typeof val === 'function';
298
+ }
110
299
 
111
- if (window.Vue) {
112
- Vue.use(install);
113
- }
300
+ function isObject(obj) {
301
+ return obj !== null && typeof obj === 'object';
302
+ }
114
303
 
115
- module.exports = install;
304
+ function isPlainObject(obj) {
305
+ return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
306
+ }
116
307
 
308
+ function isFormData(obj) {
309
+ return typeof FormData !== 'undefined' && obj instanceof FormData;
310
+ }
117
311
 
118
- /***/ },
119
- /* 1 */
120
- /***/ function(module, exports) {
312
+ function when(value, fulfilled, rejected) {
121
313
 
122
- /**
123
- * Utility functions.
124
- */
314
+ var promise = Promise$1.resolve(value);
125
315
 
126
- var _ = exports, array = [], console = window.console;
316
+ if (arguments.length < 2) {
317
+ return promise;
318
+ }
127
319
 
128
- _.warn = function (msg) {
129
- if (console && _.warning && (!_.config.silent || _.config.debug)) {
130
- console.warn('[VueResource warn]: ' + msg);
131
- }
132
- };
320
+ return promise.then(fulfilled, rejected);
321
+ }
133
322
 
134
- _.error = function (msg) {
135
- if (console) {
136
- console.error(msg);
137
- }
138
- };
323
+ function options(fn, obj, opts) {
139
324
 
140
- _.trim = function (str) {
141
- return str.replace(/^\s*|\s*$/g, '');
142
- };
325
+ opts = opts || {};
143
326
 
144
- _.toLower = function (str) {
145
- return str ? str.toLowerCase() : '';
146
- };
327
+ if (isFunction(opts)) {
328
+ opts = opts.call(obj);
329
+ }
147
330
 
148
- _.isArray = Array.isArray;
331
+ return merge(fn.bind({ $vm: obj, $options: opts }), fn, { $options: opts });
332
+ }
149
333
 
150
- _.isString = function (val) {
151
- return typeof val === 'string';
152
- };
334
+ function each(obj, iterator) {
153
335
 
154
- _.isFunction = function (val) {
155
- return typeof val === 'function';
156
- };
336
+ var i, key;
157
337
 
158
- _.isObject = function (obj) {
159
- return obj !== null && typeof obj === 'object';
160
- };
338
+ if (typeof obj.length == 'number') {
339
+ for (i = 0; i < obj.length; i++) {
340
+ iterator.call(obj[i], obj[i], i);
341
+ }
342
+ } else if (isObject(obj)) {
343
+ for (key in obj) {
344
+ if (obj.hasOwnProperty(key)) {
345
+ iterator.call(obj[key], obj[key], key);
346
+ }
347
+ }
348
+ }
161
349
 
162
- _.isPlainObject = function (obj) {
163
- return _.isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
164
- };
350
+ return obj;
351
+ }
165
352
 
166
- _.options = function (fn, obj, options) {
353
+ var assign = Object.assign || _assign;
167
354
 
168
- options = options || {};
355
+ function merge(target) {
169
356
 
170
- if (_.isFunction(options)) {
171
- options = options.call(obj);
172
- }
357
+ var args = array.slice.call(arguments, 1);
173
358
 
174
- return _.merge(fn.bind({$vm: obj, $options: options}), fn, {$options: options});
175
- };
359
+ args.forEach(function (source) {
360
+ _merge(target, source, true);
361
+ });
176
362
 
177
- _.each = function (obj, iterator) {
363
+ return target;
364
+ }
178
365
 
179
- var i, key;
366
+ function defaults(target) {
180
367
 
181
- if (typeof obj.length == 'number') {
182
- for (i = 0; i < obj.length; i++) {
183
- iterator.call(obj[i], obj[i], i);
184
- }
185
- } else if (_.isObject(obj)) {
186
- for (key in obj) {
187
- if (obj.hasOwnProperty(key)) {
188
- iterator.call(obj[key], obj[key], key);
189
- }
190
- }
191
- }
368
+ var args = array.slice.call(arguments, 1);
192
369
 
193
- return obj;
194
- };
370
+ args.forEach(function (source) {
195
371
 
196
- _.defaults = function (target, source) {
372
+ for (var key in source) {
373
+ if (target[key] === undefined) {
374
+ target[key] = source[key];
375
+ }
376
+ }
377
+ });
197
378
 
198
- for (var key in source) {
199
- if (target[key] === undefined) {
200
- target[key] = source[key];
201
- }
202
- }
379
+ return target;
380
+ }
203
381
 
204
- return target;
205
- };
382
+ function _assign(target) {
206
383
 
207
- _.extend = function (target) {
384
+ var args = array.slice.call(arguments, 1);
208
385
 
209
- var args = array.slice.call(arguments, 1);
386
+ args.forEach(function (source) {
387
+ _merge(target, source);
388
+ });
210
389
 
211
- args.forEach(function (arg) {
212
- merge(target, arg);
213
- });
390
+ return target;
391
+ }
214
392
 
215
- return target;
216
- };
393
+ function _merge(target, source, deep) {
394
+ for (var key in source) {
395
+ if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
396
+ if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
397
+ target[key] = {};
398
+ }
399
+ if (isArray(source[key]) && !isArray(target[key])) {
400
+ target[key] = [];
401
+ }
402
+ _merge(target[key], source[key], deep);
403
+ } else if (source[key] !== undefined) {
404
+ target[key] = source[key];
405
+ }
406
+ }
407
+ }
217
408
 
218
- _.merge = function (target) {
409
+ function root (options, next) {
219
410
 
220
- var args = array.slice.call(arguments, 1);
411
+ var url = next(options);
221
412
 
222
- args.forEach(function (arg) {
223
- merge(target, arg, true);
224
- });
413
+ if (isString(options.root) && !url.match(/^(https?:)?\//)) {
414
+ url = options.root + '/' + url;
415
+ }
225
416
 
226
- return target;
227
- };
417
+ return url;
418
+ }
228
419
 
229
- function merge(target, source, deep) {
230
- for (var key in source) {
231
- if (deep && (_.isPlainObject(source[key]) || _.isArray(source[key]))) {
232
- if (_.isPlainObject(source[key]) && !_.isPlainObject(target[key])) {
233
- target[key] = {};
234
- }
235
- if (_.isArray(source[key]) && !_.isArray(target[key])) {
236
- target[key] = [];
237
- }
238
- merge(target[key], source[key], deep);
239
- } else if (source[key] !== undefined) {
240
- target[key] = source[key];
241
- }
242
- }
243
- }
420
+ function query (options, next) {
244
421
 
422
+ var urlParams = Object.keys(Url.options.params),
423
+ query = {},
424
+ url = next(options);
245
425
 
246
- /***/ },
247
- /* 2 */
248
- /***/ function(module, exports, __webpack_require__) {
426
+ each(options.params, function (value, key) {
427
+ if (urlParams.indexOf(key) === -1) {
428
+ query[key] = value;
429
+ }
430
+ });
431
+
432
+ query = Url.params(query);
249
433
 
250
- /**
251
- * Service for URL templating.
252
- */
434
+ if (query) {
435
+ url += (url.indexOf('?') == -1 ? '?' : '&') + query;
436
+ }
437
+
438
+ return url;
439
+ }
440
+
441
+ /**
442
+ * URL Template v2.0.6 (https://github.com/bramstein/url-template)
443
+ */
444
+
445
+ function expand(url, params, variables) {
446
+
447
+ var tmpl = parse(url),
448
+ expanded = tmpl.expand(params);
449
+
450
+ if (variables) {
451
+ variables.push.apply(variables, tmpl.vars);
452
+ }
453
+
454
+ return expanded;
455
+ }
456
+
457
+ function parse(template) {
458
+
459
+ var operators = ['+', '#', '.', '/', ';', '?', '&'],
460
+ variables = [];
461
+
462
+ return {
463
+ vars: variables,
464
+ expand: function (context) {
465
+ return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
466
+ if (expression) {
467
+
468
+ var operator = null,
469
+ values = [];
470
+
471
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
472
+ operator = expression.charAt(0);
473
+ expression = expression.substr(1);
474
+ }
475
+
476
+ expression.split(/,/g).forEach(function (variable) {
477
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
478
+ values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
479
+ variables.push(tmp[1]);
480
+ });
481
+
482
+ if (operator && operator !== '+') {
483
+
484
+ var separator = ',';
485
+
486
+ if (operator === '?') {
487
+ separator = '&';
488
+ } else if (operator !== '#') {
489
+ separator = operator;
490
+ }
491
+
492
+ return (values.length !== 0 ? operator : '') + values.join(separator);
493
+ } else {
494
+ return values.join(',');
495
+ }
496
+ } else {
497
+ return encodeReserved(literal);
498
+ }
499
+ });
500
+ }
501
+ };
502
+ }
503
+
504
+ function getValues(context, operator, key, modifier) {
505
+
506
+ var value = context[key],
507
+ result = [];
508
+
509
+ if (isDefined(value) && value !== '') {
510
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
511
+ value = value.toString();
512
+
513
+ if (modifier && modifier !== '*') {
514
+ value = value.substring(0, parseInt(modifier, 10));
515
+ }
516
+
517
+ result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
518
+ } else {
519
+ if (modifier === '*') {
520
+ if (Array.isArray(value)) {
521
+ value.filter(isDefined).forEach(function (value) {
522
+ result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
523
+ });
524
+ } else {
525
+ Object.keys(value).forEach(function (k) {
526
+ if (isDefined(value[k])) {
527
+ result.push(encodeValue(operator, value[k], k));
528
+ }
529
+ });
530
+ }
531
+ } else {
532
+ var tmp = [];
533
+
534
+ if (Array.isArray(value)) {
535
+ value.filter(isDefined).forEach(function (value) {
536
+ tmp.push(encodeValue(operator, value));
537
+ });
538
+ } else {
539
+ Object.keys(value).forEach(function (k) {
540
+ if (isDefined(value[k])) {
541
+ tmp.push(encodeURIComponent(k));
542
+ tmp.push(encodeValue(operator, value[k].toString()));
543
+ }
544
+ });
545
+ }
546
+
547
+ if (isKeyOperator(operator)) {
548
+ result.push(encodeURIComponent(key) + '=' + tmp.join(','));
549
+ } else if (tmp.length !== 0) {
550
+ result.push(tmp.join(','));
551
+ }
552
+ }
553
+ }
554
+ } else {
555
+ if (operator === ';') {
556
+ result.push(encodeURIComponent(key));
557
+ } else if (value === '' && (operator === '&' || operator === '?')) {
558
+ result.push(encodeURIComponent(key) + '=');
559
+ } else if (value === '') {
560
+ result.push('');
561
+ }
562
+ }
563
+
564
+ return result;
565
+ }
566
+
567
+ function isDefined(value) {
568
+ return value !== undefined && value !== null;
569
+ }
570
+
571
+ function isKeyOperator(operator) {
572
+ return operator === ';' || operator === '&' || operator === '?';
573
+ }
574
+
575
+ function encodeValue(operator, value, key) {
576
+
577
+ value = operator === '+' || operator === '#' ? encodeReserved(value) : encodeURIComponent(value);
578
+
579
+ if (key) {
580
+ return encodeURIComponent(key) + '=' + value;
581
+ } else {
582
+ return value;
583
+ }
584
+ }
585
+
586
+ function encodeReserved(str) {
587
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
588
+ if (!/%[0-9A-Fa-f]/.test(part)) {
589
+ part = encodeURI(part);
590
+ }
591
+ return part;
592
+ }).join('');
593
+ }
594
+
595
+ function template (options) {
596
+
597
+ var variables = [],
598
+ url = expand(options.url, options.params, variables);
599
+
600
+ variables.forEach(function (key) {
601
+ delete options.params[key];
602
+ });
603
+
604
+ return url;
605
+ }
606
+
607
+ /**
608
+ * Service for URL templating.
609
+ */
610
+
611
+ var ie = document.documentMode;
612
+ var el = document.createElement('a');
613
+
614
+ function Url(url, params) {
615
+
616
+ var self = this || {},
617
+ options = url,
618
+ transform;
619
+
620
+ if (isString(url)) {
621
+ options = { url: url, params: params };
622
+ }
623
+
624
+ options = merge({}, Url.options, self.$options, options);
625
+
626
+ Url.transforms.forEach(function (handler) {
627
+ transform = factory(handler, transform, self.$vm);
628
+ });
629
+
630
+ return transform(options);
631
+ }
632
+
633
+ /**
634
+ * Url options.
635
+ */
636
+
637
+ Url.options = {
638
+ url: '',
639
+ root: null,
640
+ params: {}
641
+ };
642
+
643
+ /**
644
+ * Url transforms.
645
+ */
646
+
647
+ Url.transforms = [template, query, root];
648
+
649
+ /**
650
+ * Encodes a Url parameter string.
651
+ *
652
+ * @param {Object} obj
653
+ */
253
654
 
254
- var _ = __webpack_require__(1);
255
- var ie = document.documentMode;
256
- var el = document.createElement('a');
655
+ Url.params = function (obj) {
257
656
 
258
- function Url(url, params) {
657
+ var params = [],
658
+ escape = encodeURIComponent;
259
659
 
260
- var options = url, transform;
660
+ params.add = function (key, value) {
261
661
 
262
- if (_.isString(url)) {
263
- options = {url: url, params: params};
264
- }
662
+ if (isFunction(value)) {
663
+ value = value();
664
+ }
265
665
 
266
- options = _.merge({}, Url.options, this.$options, options);
666
+ if (value === null) {
667
+ value = '';
668
+ }
267
669
 
268
- Url.transforms.forEach(function (handler) {
269
- transform = factory(handler, transform, this.$vm);
270
- }, this);
670
+ this.push(escape(key) + '=' + escape(value));
671
+ };
271
672
 
272
- return transform(options);
273
- };
673
+ serialize(params, obj);
274
674
 
275
- /**
276
- * Url options.
277
- */
675
+ return params.join('&').replace(/%20/g, '+');
676
+ };
278
677
 
279
- Url.options = {
280
- url: '',
281
- root: null,
282
- params: {}
283
- };
678
+ /**
679
+ * Parse a URL and return its components.
680
+ *
681
+ * @param {String} url
682
+ */
284
683
 
285
- /**
286
- * Url transforms.
287
- */
684
+ Url.parse = function (url) {
288
685
 
289
- Url.transforms = [
290
- __webpack_require__(3),
291
- __webpack_require__(5),
292
- __webpack_require__(6),
293
- __webpack_require__(7)
294
- ];
686
+ if (ie) {
687
+ el.href = url;
688
+ url = el.href;
689
+ }
295
690
 
296
- /**
297
- * Encodes a Url parameter string.
298
- *
299
- * @param {Object} obj
300
- */
691
+ el.href = url;
301
692
 
302
- Url.params = function (obj) {
693
+ return {
694
+ href: el.href,
695
+ protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
696
+ port: el.port,
697
+ host: el.host,
698
+ hostname: el.hostname,
699
+ pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
700
+ search: el.search ? el.search.replace(/^\?/, '') : '',
701
+ hash: el.hash ? el.hash.replace(/^#/, '') : ''
702
+ };
703
+ };
303
704
 
304
- var params = [], escape = encodeURIComponent;
705
+ function factory(handler, next, vm) {
706
+ return function (options) {
707
+ return handler.call(vm, options, next);
708
+ };
709
+ }
305
710
 
306
- params.add = function (key, value) {
711
+ function serialize(params, obj, scope) {
307
712
 
308
- if (_.isFunction(value)) {
309
- value = value();
310
- }
713
+ var array = isArray(obj),
714
+ plain = isPlainObject(obj),
715
+ hash;
311
716
 
312
- if (value === null) {
313
- value = '';
314
- }
717
+ each(obj, function (value, key) {
315
718
 
316
- this.push(escape(key) + '=' + escape(value));
317
- };
719
+ hash = isObject(value) || isArray(value);
318
720
 
319
- serialize(params, obj);
721
+ if (scope) {
722
+ key = scope + '[' + (plain || hash ? key : '') + ']';
723
+ }
320
724
 
321
- return params.join('&').replace(/%20/g, '+');
322
- };
725
+ if (!scope && array) {
726
+ params.add(value.name, value.value);
727
+ } else if (hash) {
728
+ serialize(params, value, key);
729
+ } else {
730
+ params.add(key, value);
731
+ }
732
+ });
733
+ }
323
734
 
324
- /**
325
- * Parse a URL and return its components.
326
- *
327
- * @param {String} url
328
- */
735
+ function xdrClient (request) {
736
+ return new Promise$1(function (resolve) {
329
737
 
330
- Url.parse = function (url) {
738
+ var xdr = new XDomainRequest(),
739
+ handler = function (event) {
331
740
 
332
- if (ie) {
333
- el.href = url;
334
- url = el.href;
335
- }
741
+ var response = request.respondWith(xdr.responseText, {
742
+ status: xdr.status,
743
+ statusText: xdr.statusText
744
+ });
336
745
 
337
- el.href = url;
746
+ resolve(response);
747
+ };
338
748
 
339
- return {
340
- href: el.href,
341
- protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
342
- port: el.port,
343
- host: el.host,
344
- hostname: el.hostname,
345
- pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
346
- search: el.search ? el.search.replace(/^\?/, '') : '',
347
- hash: el.hash ? el.hash.replace(/^#/, '') : ''
348
- };
349
- };
749
+ request.abort = function () {
750
+ return xdr.abort();
751
+ };
350
752
 
351
- function factory(handler, next, vm) {
352
- return function (options) {
353
- return handler.call(vm, options, next);
354
- };
355
- }
753
+ xdr.open(request.method, request.getUrl(), true);
754
+ xdr.timeout = 0;
755
+ xdr.onload = handler;
756
+ xdr.onerror = handler;
757
+ xdr.ontimeout = function () {};
758
+ xdr.onprogress = function () {};
759
+ xdr.send(request.getBody());
760
+ });
761
+ }
356
762
 
357
- function serialize(params, obj, scope) {
763
+ var ORIGIN_URL = Url.parse(location.href);
764
+ var SUPPORTS_CORS = 'withCredentials' in new XMLHttpRequest();
358
765
 
359
- var array = _.isArray(obj), plain = _.isPlainObject(obj), hash;
766
+ function cors (request, next) {
360
767
 
361
- _.each(obj, function (value, key) {
768
+ if (!isBoolean(request.crossOrigin) && crossOrigin(request)) {
769
+ request.crossOrigin = true;
770
+ }
362
771
 
363
- hash = _.isObject(value) || _.isArray(value);
772
+ if (request.crossOrigin) {
364
773
 
365
- if (scope) {
366
- key = scope + '[' + (plain || hash ? key : '') + ']';
367
- }
774
+ if (!SUPPORTS_CORS) {
775
+ request.client = xdrClient;
776
+ }
368
777
 
369
- if (!scope && array) {
370
- params.add(value.name, value.value);
371
- } else if (hash) {
372
- serialize(params, value, key);
373
- } else {
374
- params.add(key, value);
375
- }
376
- });
377
- }
778
+ delete request.emulateHTTP;
779
+ }
378
780
 
379
- module.exports = _.url = Url;
781
+ next();
782
+ }
380
783
 
784
+ function crossOrigin(request) {
381
785
 
382
- /***/ },
383
- /* 3 */
384
- /***/ function(module, exports, __webpack_require__) {
786
+ var requestUrl = Url.parse(Url(request));
385
787
 
386
- /**
387
- * URL Template (RFC 6570) Transform.
388
- */
788
+ return requestUrl.protocol !== ORIGIN_URL.protocol || requestUrl.host !== ORIGIN_URL.host;
789
+ }
389
790
 
390
- var UrlTemplate = __webpack_require__(4);
791
+ function body (request, next) {
391
792
 
392
- module.exports = function (options) {
793
+ if (request.emulateJSON && isPlainObject(request.body)) {
794
+ request.body = Url.params(request.body);
795
+ request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
796
+ }
393
797
 
394
- var variables = [], url = UrlTemplate.expand(options.url, options.params, variables);
798
+ if (isFormData(request.body)) {
799
+ delete request.headers['Content-Type'];
800
+ }
395
801
 
396
- variables.forEach(function (key) {
397
- delete options.params[key];
398
- });
802
+ if (isPlainObject(request.body)) {
803
+ request.body = JSON.stringify(request.body);
804
+ }
399
805
 
400
- return url;
401
- };
806
+ next(function (response) {
402
807
 
808
+ var contentType = response.headers['Content-Type'];
403
809
 
404
- /***/ },
405
- /* 4 */
406
- /***/ function(module, exports) {
810
+ if (isString(contentType) && contentType.indexOf('application/json') === 0) {
407
811
 
408
- /**
409
- * URL Template v2.0.6 (https://github.com/bramstein/url-template)
410
- */
812
+ try {
813
+ response.data = response.json();
814
+ } catch (e) {
815
+ response.data = null;
816
+ }
817
+ } else {
818
+ response.data = response.text();
819
+ }
820
+ });
821
+ }
411
822
 
412
- exports.expand = function (url, params, variables) {
413
-
414
- var tmpl = this.parse(url), expanded = tmpl.expand(params);
415
-
416
- if (variables) {
417
- variables.push.apply(variables, tmpl.vars);
418
- }
419
-
420
- return expanded;
421
- };
422
-
423
- exports.parse = function (template) {
424
-
425
- var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
426
-
427
- return {
428
- vars: variables,
429
- expand: function (context) {
430
- return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
431
- if (expression) {
432
-
433
- var operator = null, values = [];
434
-
435
- if (operators.indexOf(expression.charAt(0)) !== -1) {
436
- operator = expression.charAt(0);
437
- expression = expression.substr(1);
438
- }
439
-
440
- expression.split(/,/g).forEach(function (variable) {
441
- var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
442
- values.push.apply(values, exports.getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
443
- variables.push(tmp[1]);
444
- });
445
-
446
- if (operator && operator !== '+') {
447
-
448
- var separator = ',';
449
-
450
- if (operator === '?') {
451
- separator = '&';
452
- } else if (operator !== '#') {
453
- separator = operator;
454
- }
455
-
456
- return (values.length !== 0 ? operator : '') + values.join(separator);
457
- } else {
458
- return values.join(',');
459
- }
460
-
461
- } else {
462
- return exports.encodeReserved(literal);
463
- }
464
- });
465
- }
466
- };
467
- };
468
-
469
- exports.getValues = function (context, operator, key, modifier) {
470
-
471
- var value = context[key], result = [];
472
-
473
- if (this.isDefined(value) && value !== '') {
474
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
475
- value = value.toString();
476
-
477
- if (modifier && modifier !== '*') {
478
- value = value.substring(0, parseInt(modifier, 10));
479
- }
480
-
481
- result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
482
- } else {
483
- if (modifier === '*') {
484
- if (Array.isArray(value)) {
485
- value.filter(this.isDefined).forEach(function (value) {
486
- result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
487
- }, this);
488
- } else {
489
- Object.keys(value).forEach(function (k) {
490
- if (this.isDefined(value[k])) {
491
- result.push(this.encodeValue(operator, value[k], k));
492
- }
493
- }, this);
494
- }
495
- } else {
496
- var tmp = [];
497
-
498
- if (Array.isArray(value)) {
499
- value.filter(this.isDefined).forEach(function (value) {
500
- tmp.push(this.encodeValue(operator, value));
501
- }, this);
502
- } else {
503
- Object.keys(value).forEach(function (k) {
504
- if (this.isDefined(value[k])) {
505
- tmp.push(encodeURIComponent(k));
506
- tmp.push(this.encodeValue(operator, value[k].toString()));
507
- }
508
- }, this);
509
- }
510
-
511
- if (this.isKeyOperator(operator)) {
512
- result.push(encodeURIComponent(key) + '=' + tmp.join(','));
513
- } else if (tmp.length !== 0) {
514
- result.push(tmp.join(','));
515
- }
516
- }
517
- }
518
- } else {
519
- if (operator === ';') {
520
- result.push(encodeURIComponent(key));
521
- } else if (value === '' && (operator === '&' || operator === '?')) {
522
- result.push(encodeURIComponent(key) + '=');
523
- } else if (value === '') {
524
- result.push('');
525
- }
526
- }
527
-
528
- return result;
529
- };
530
-
531
- exports.isDefined = function (value) {
532
- return value !== undefined && value !== null;
533
- };
534
-
535
- exports.isKeyOperator = function (operator) {
536
- return operator === ';' || operator === '&' || operator === '?';
537
- };
538
-
539
- exports.encodeValue = function (operator, value, key) {
540
-
541
- value = (operator === '+' || operator === '#') ? this.encodeReserved(value) : encodeURIComponent(value);
542
-
543
- if (key) {
544
- return encodeURIComponent(key) + '=' + value;
545
- } else {
546
- return value;
547
- }
548
- };
549
-
550
- exports.encodeReserved = function (str) {
551
- return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
552
- if (!/%[0-9A-Fa-f]/.test(part)) {
553
- part = encodeURI(part);
554
- }
555
- return part;
556
- }).join('');
557
- };
558
-
559
-
560
- /***/ },
561
- /* 5 */
562
- /***/ function(module, exports, __webpack_require__) {
823
+ function jsonpClient (request) {
824
+ return new Promise$1(function (resolve) {
563
825
 
564
- /**
565
- * Legacy Transform.
566
- */
826
+ var name = request.jsonp || 'callback',
827
+ callback = '_jsonp' + Math.random().toString(36).substr(2),
828
+ body = null,
829
+ handler,
830
+ script;
567
831
 
568
- var _ = __webpack_require__(1);
832
+ handler = function (event) {
569
833
 
570
- module.exports = function (options, next) {
834
+ var status = 0;
571
835
 
572
- var variables = [], url = next(options);
573
-
574
- url = url.replace(/(\/?):([a-z]\w*)/gi, function (match, slash, name) {
575
-
576
- _.warn('The `:' + name + '` parameter syntax has been deprecated. Use the `{' + name + '}` syntax instead.');
577
-
578
- if (options.params[name]) {
579
- variables.push(name);
580
- return slash + encodeUriSegment(options.params[name]);
581
- }
836
+ if (event.type === 'load' && body !== null) {
837
+ status = 200;
838
+ } else if (event.type === 'error') {
839
+ status = 404;
840
+ }
582
841
 
583
- return '';
584
- });
842
+ resolve(request.respondWith(body, { status: status }));
585
843
 
586
- variables.forEach(function (key) {
587
- delete options.params[key];
588
- });
844
+ delete window[callback];
845
+ document.body.removeChild(script);
846
+ };
589
847
 
590
- return url;
591
- };
848
+ request.params[name] = callback;
592
849
 
593
- function encodeUriSegment(value) {
850
+ window[callback] = function (result) {
851
+ body = JSON.stringify(result);
852
+ };
594
853
 
595
- return encodeUriQuery(value, true).
596
- replace(/%26/gi, '&').
597
- replace(/%3D/gi, '=').
598
- replace(/%2B/gi, '+');
599
- }
854
+ script = document.createElement('script');
855
+ script.src = request.getUrl();
856
+ script.type = 'text/javascript';
857
+ script.async = true;
858
+ script.onload = handler;
859
+ script.onerror = handler;
600
860
 
601
- function encodeUriQuery(value, spaces) {
861
+ document.body.appendChild(script);
862
+ });
863
+ }
602
864
 
603
- return encodeURIComponent(value).
604
- replace(/%40/gi, '@').
605
- replace(/%3A/gi, ':').
606
- replace(/%24/g, '$').
607
- replace(/%2C/gi, ',').
608
- replace(/%20/g, (spaces ? '%20' : '+'));
609
- }
865
+ function jsonp (request, next) {
610
866
 
867
+ if (request.method == 'JSONP') {
868
+ request.client = jsonpClient;
869
+ }
611
870
 
612
- /***/ },
613
- /* 6 */
614
- /***/ function(module, exports, __webpack_require__) {
871
+ next(function (response) {
615
872
 
616
- /**
617
- * Query Parameter Transform.
618
- */
873
+ if (request.method == 'JSONP') {
874
+ response.data = response.json();
875
+ }
876
+ });
877
+ }
619
878
 
620
- var _ = __webpack_require__(1);
879
+ function before (request, next) {
621
880
 
622
- module.exports = function (options, next) {
881
+ if (isFunction(request.before)) {
882
+ request.before.call(this, request);
883
+ }
623
884
 
624
- var urlParams = Object.keys(_.url.options.params), query = {}, url = next(options);
885
+ next();
886
+ }
625
887
 
626
- _.each(options.params, function (value, key) {
627
- if (urlParams.indexOf(key) === -1) {
628
- query[key] = value;
629
- }
630
- });
888
+ /**
889
+ * HTTP method override Interceptor.
890
+ */
631
891
 
632
- query = _.url.params(query);
892
+ function method (request, next) {
633
893
 
634
- if (query) {
635
- url += (url.indexOf('?') == -1 ? '?' : '&') + query;
636
- }
894
+ if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
895
+ request.headers['X-HTTP-Method-Override'] = request.method;
896
+ request.method = 'POST';
897
+ }
637
898
 
638
- return url;
639
- };
899
+ next();
900
+ }
640
901
 
902
+ function header (request, next) {
641
903
 
642
- /***/ },
643
- /* 7 */
644
- /***/ function(module, exports, __webpack_require__) {
904
+ request.method = request.method.toUpperCase();
905
+ request.headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, Http.headers[request.method.toLowerCase()], request.headers);
645
906
 
646
- /**
647
- * Root Prefix Transform.
648
- */
907
+ next();
908
+ }
649
909
 
650
- var _ = __webpack_require__(1);
910
+ /**
911
+ * Timeout Interceptor.
912
+ */
651
913
 
652
- module.exports = function (options, next) {
914
+ function timeout (request, next) {
653
915
 
654
- var url = next(options);
916
+ var timeout;
655
917
 
656
- if (_.isString(options.root) && !url.match(/^(https?:)?\//)) {
657
- url = options.root + '/' + url;
658
- }
918
+ if (request.timeout) {
919
+ timeout = setTimeout(function () {
920
+ request.abort();
921
+ }, request.timeout);
922
+ }
659
923
 
660
- return url;
661
- };
924
+ next(function (response) {
662
925
 
926
+ clearTimeout(timeout);
927
+ });
928
+ }
663
929
 
664
- /***/ },
665
- /* 8 */
666
- /***/ function(module, exports, __webpack_require__) {
930
+ function xhrClient (request) {
931
+ return new Promise$1(function (resolve) {
667
932
 
668
- /**
669
- * Service for sending network requests.
670
- */
933
+ var xhr = new XMLHttpRequest(),
934
+ handler = function (event) {
671
935
 
672
- var _ = __webpack_require__(1);
673
- var Client = __webpack_require__(9);
674
- var Promise = __webpack_require__(10);
675
- var interceptor = __webpack_require__(13);
676
- var jsonType = {'Content-Type': 'application/json'};
936
+ var response = request.respondWith('response' in xhr ? xhr.response : xhr.responseText, {
937
+ status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
938
+ statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText),
939
+ headers: parseHeaders(xhr.getAllResponseHeaders())
940
+ });
677
941
 
678
- function Http(url, options) {
942
+ resolve(response);
943
+ };
679
944
 
680
- var client = Client, request, promise;
945
+ request.abort = function () {
946
+ return xhr.abort();
947
+ };
681
948
 
682
- Http.interceptors.forEach(function (handler) {
683
- client = interceptor(handler, this.$vm)(client);
684
- }, this);
949
+ xhr.open(request.method, request.getUrl(), true);
950
+ xhr.timeout = 0;
951
+ xhr.onload = handler;
952
+ xhr.onerror = handler;
685
953
 
686
- options = _.isObject(url) ? url : _.extend({url: url}, options);
687
- request = _.merge({}, Http.options, this.$options, options);
688
- promise = client(request).bind(this.$vm).then(function (response) {
954
+ if (request.progress) {
955
+ if (request.method === 'GET') {
956
+ xhr.addEventListener('progress', request.progress);
957
+ } else if (/^(POST|PUT)$/i.test(request.method)) {
958
+ xhr.upload.addEventListener('progress', request.progress);
959
+ }
960
+ }
689
961
 
690
- return response.ok ? response : Promise.reject(response);
962
+ if (request.credentials === true) {
963
+ xhr.withCredentials = true;
964
+ }
691
965
 
692
- }, function (response) {
966
+ each(request.headers || {}, function (value, header) {
967
+ xhr.setRequestHeader(header, value);
968
+ });
693
969
 
694
- if (response instanceof Error) {
695
- _.error(response);
696
- }
970
+ xhr.send(request.getBody());
971
+ });
972
+ }
697
973
 
698
- return Promise.reject(response);
699
- });
974
+ function parseHeaders(str) {
700
975
 
701
- if (request.success) {
702
- promise.success(request.success);
703
- }
976
+ var headers = {},
977
+ value,
978
+ name,
979
+ i;
704
980
 
705
- if (request.error) {
706
- promise.error(request.error);
707
- }
981
+ each(trim(str).split('\n'), function (row) {
708
982
 
709
- return promise;
710
- }
983
+ i = row.indexOf(':');
984
+ name = trim(row.slice(0, i));
985
+ value = trim(row.slice(i + 1));
711
986
 
712
- Http.options = {
713
- method: 'get',
714
- data: '',
715
- params: {},
716
- headers: {},
717
- xhr: null,
718
- upload: null,
719
- jsonp: 'callback',
720
- beforeSend: null,
721
- crossOrigin: null,
722
- emulateHTTP: false,
723
- emulateJSON: false,
724
- timeout: 0
725
- };
987
+ if (headers[name]) {
726
988
 
727
- Http.interceptors = [
728
- __webpack_require__(14),
729
- __webpack_require__(15),
730
- __webpack_require__(16),
731
- __webpack_require__(18),
732
- __webpack_require__(19),
733
- __webpack_require__(20),
734
- __webpack_require__(21)
735
- ];
989
+ if (isArray(headers[name])) {
990
+ headers[name].push(value);
991
+ } else {
992
+ headers[name] = [headers[name], value];
993
+ }
994
+ } else {
736
995
 
737
- Http.headers = {
738
- put: jsonType,
739
- post: jsonType,
740
- patch: jsonType,
741
- delete: jsonType,
742
- common: {'Accept': 'application/json, text/plain, */*'},
743
- custom: {'X-Requested-With': 'XMLHttpRequest'}
744
- };
996
+ headers[name] = value;
997
+ }
998
+ });
745
999
 
746
- ['get', 'put', 'post', 'patch', 'delete', 'jsonp'].forEach(function (method) {
1000
+ return headers;
1001
+ }
747
1002
 
748
- Http[method] = function (url, data, success, options) {
1003
+ function Client (context) {
749
1004
 
750
- if (_.isFunction(data)) {
751
- options = success;
752
- success = data;
753
- data = undefined;
754
- }
1005
+ var reqHandlers = [sendRequest],
1006
+ resHandlers = [],
1007
+ handler;
755
1008
 
756
- if (_.isObject(success)) {
757
- options = success;
758
- success = undefined;
759
- }
1009
+ if (!isObject(context)) {
1010
+ context = null;
1011
+ }
760
1012
 
761
- return this(url, _.extend({method: method, data: data, success: success}, options));
762
- };
763
- });
1013
+ function Client(request) {
1014
+ return new Promise$1(function (resolve) {
764
1015
 
765
- module.exports = _.http = Http;
1016
+ function exec() {
766
1017
 
1018
+ handler = reqHandlers.pop();
767
1019
 
768
- /***/ },
769
- /* 9 */
770
- /***/ function(module, exports, __webpack_require__) {
1020
+ if (isFunction(handler)) {
1021
+ handler.call(context, request, next);
1022
+ } else {
1023
+ warn('Invalid interceptor of type ' + typeof handler + ', must be a function');
1024
+ next();
1025
+ }
1026
+ }
771
1027
 
772
- /**
773
- * Base client.
774
- */
1028
+ function next(response) {
775
1029
 
776
- var _ = __webpack_require__(1);
777
- var Promise = __webpack_require__(10);
778
- var xhrClient = __webpack_require__(12);
1030
+ if (isFunction(response)) {
779
1031
 
780
- module.exports = function (request) {
1032
+ resHandlers.unshift(response);
1033
+ } else if (isObject(response)) {
781
1034
 
782
- var response = (request.client || xhrClient)(request);
1035
+ resHandlers.forEach(function (handler) {
1036
+ response = when(response, function (response) {
1037
+ return handler.call(context, response) || response;
1038
+ });
1039
+ });
783
1040
 
784
- return Promise.resolve(response).then(function (response) {
1041
+ when(response, resolve);
785
1042
 
786
- if (response.headers) {
1043
+ return;
1044
+ }
787
1045
 
788
- var headers = parseHeaders(response.headers);
1046
+ exec();
1047
+ }
789
1048
 
790
- response.headers = function (name) {
1049
+ exec();
1050
+ }, context);
1051
+ }
791
1052
 
792
- if (name) {
793
- return headers[_.toLower(name)];
794
- }
1053
+ Client.use = function (handler) {
1054
+ reqHandlers.push(handler);
1055
+ };
795
1056
 
796
- return headers;
797
- };
1057
+ return Client;
1058
+ }
798
1059
 
799
- }
1060
+ function sendRequest(request, resolve) {
800
1061
 
801
- response.ok = response.status >= 200 && response.status < 300;
1062
+ var client = request.client || xhrClient;
802
1063
 
803
- return response;
804
- });
1064
+ resolve(client(request));
1065
+ }
805
1066
 
806
- };
1067
+ var classCallCheck = function (instance, Constructor) {
1068
+ if (!(instance instanceof Constructor)) {
1069
+ throw new TypeError("Cannot call a class as a function");
1070
+ }
1071
+ };
807
1072
 
808
- function parseHeaders(str) {
1073
+ /**
1074
+ * HTTP Response.
1075
+ */
809
1076
 
810
- var headers = {}, value, name, i;
1077
+ var Response = function () {
1078
+ function Response(body, _ref) {
1079
+ var url = _ref.url;
1080
+ var headers = _ref.headers;
1081
+ var status = _ref.status;
1082
+ var statusText = _ref.statusText;
1083
+ classCallCheck(this, Response);
811
1084
 
812
- if (_.isString(str)) {
813
- _.each(str.split('\n'), function (row) {
814
1085
 
815
- i = row.indexOf(':');
816
- name = _.trim(_.toLower(row.slice(0, i)));
817
- value = _.trim(row.slice(i + 1));
1086
+ this.url = url;
1087
+ this.body = body;
1088
+ this.headers = headers || {};
1089
+ this.status = status || 0;
1090
+ this.statusText = statusText || '';
1091
+ this.ok = status >= 200 && status < 300;
1092
+ }
818
1093
 
819
- if (headers[name]) {
1094
+ Response.prototype.text = function text() {
1095
+ return this.body;
1096
+ };
820
1097
 
821
- if (_.isArray(headers[name])) {
822
- headers[name].push(value);
823
- } else {
824
- headers[name] = [headers[name], value];
825
- }
1098
+ Response.prototype.blob = function blob() {
1099
+ return new Blob([this.body]);
1100
+ };
826
1101
 
827
- } else {
1102
+ Response.prototype.json = function json() {
1103
+ return JSON.parse(this.body);
1104
+ };
828
1105
 
829
- headers[name] = value;
830
- }
1106
+ return Response;
1107
+ }();
831
1108
 
832
- });
833
- }
1109
+ var Request = function () {
1110
+ function Request(options) {
1111
+ classCallCheck(this, Request);
834
1112
 
835
- return headers;
836
- }
837
1113
 
1114
+ this.method = 'GET';
1115
+ this.body = null;
1116
+ this.params = {};
1117
+ this.headers = {};
838
1118
 
839
- /***/ },
840
- /* 10 */
841
- /***/ function(module, exports, __webpack_require__) {
1119
+ assign(this, options);
1120
+ }
842
1121
 
843
- /**
844
- * Promise adapter.
845
- */
1122
+ Request.prototype.getUrl = function getUrl() {
1123
+ return Url(this);
1124
+ };
846
1125
 
847
- var _ = __webpack_require__(1);
848
- var PromiseObj = window.Promise || __webpack_require__(11);
1126
+ Request.prototype.getBody = function getBody() {
1127
+ return this.body;
1128
+ };
849
1129
 
850
- function Promise(executor, context) {
1130
+ Request.prototype.respondWith = function respondWith(body, options) {
1131
+ return new Response(body, assign(options || {}, { url: this.getUrl() }));
1132
+ };
851
1133
 
852
- if (executor instanceof PromiseObj) {
853
- this.promise = executor;
854
- } else {
855
- this.promise = new PromiseObj(executor.bind(context));
856
- }
1134
+ return Request;
1135
+ }();
857
1136
 
858
- this.context = context;
859
- }
1137
+ /**
1138
+ * Service for sending network requests.
1139
+ */
860
1140
 
861
- Promise.all = function (iterable, context) {
862
- return new Promise(PromiseObj.all(iterable), context);
863
- };
1141
+ var CUSTOM_HEADERS = { 'X-Requested-With': 'XMLHttpRequest' };
1142
+ var COMMON_HEADERS = { 'Accept': 'application/json, text/plain, */*' };
1143
+ var JSON_CONTENT_TYPE = { 'Content-Type': 'application/json;charset=utf-8' };
864
1144
 
865
- Promise.resolve = function (value, context) {
866
- return new Promise(PromiseObj.resolve(value), context);
867
- };
1145
+ function Http(options) {
868
1146
 
869
- Promise.reject = function (reason, context) {
870
- return new Promise(PromiseObj.reject(reason), context);
871
- };
1147
+ var self = this || {},
1148
+ client = Client(self.$vm);
872
1149
 
873
- Promise.race = function (iterable, context) {
874
- return new Promise(PromiseObj.race(iterable), context);
875
- };
1150
+ defaults(options || {}, self.$options, Http.options);
876
1151
 
877
- var p = Promise.prototype;
1152
+ Http.interceptors.forEach(function (handler) {
1153
+ client.use(handler);
1154
+ });
878
1155
 
879
- p.bind = function (context) {
880
- this.context = context;
881
- return this;
882
- };
1156
+ return client(new Request(options)).then(function (response) {
883
1157
 
884
- p.then = function (fulfilled, rejected) {
1158
+ return response.ok ? response : Promise$1.reject(response);
1159
+ }, function (response) {
885
1160
 
886
- if (fulfilled && fulfilled.bind && this.context) {
887
- fulfilled = fulfilled.bind(this.context);
888
- }
1161
+ if (response instanceof Error) {
1162
+ error(response);
1163
+ }
889
1164
 
890
- if (rejected && rejected.bind && this.context) {
891
- rejected = rejected.bind(this.context);
892
- }
1165
+ return Promise$1.reject(response);
1166
+ });
1167
+ }
893
1168
 
894
- this.promise = this.promise.then(fulfilled, rejected);
1169
+ Http.options = {};
895
1170
 
896
- return this;
897
- };
1171
+ Http.headers = {
1172
+ put: JSON_CONTENT_TYPE,
1173
+ post: JSON_CONTENT_TYPE,
1174
+ patch: JSON_CONTENT_TYPE,
1175
+ delete: JSON_CONTENT_TYPE,
1176
+ custom: CUSTOM_HEADERS,
1177
+ common: COMMON_HEADERS
1178
+ };
898
1179
 
899
- p.catch = function (rejected) {
1180
+ Http.interceptors = [before, timeout, method, body, jsonp, header, cors];
900
1181
 
901
- if (rejected && rejected.bind && this.context) {
902
- rejected = rejected.bind(this.context);
903
- }
1182
+ ['get', 'delete', 'head', 'jsonp'].forEach(function (method) {
904
1183
 
905
- this.promise = this.promise.catch(rejected);
1184
+ Http[method] = function (url, options) {
1185
+ return this(assign(options || {}, { url: url, method: method }));
1186
+ };
1187
+ });
906
1188
 
907
- return this;
908
- };
1189
+ ['post', 'put', 'patch'].forEach(function (method) {
909
1190
 
910
- p.finally = function (callback) {
1191
+ Http[method] = function (url, body, options) {
1192
+ return this(assign(options || {}, { url: url, method: method, body: body }));
1193
+ };
1194
+ });
911
1195
 
912
- return this.then(function (value) {
913
- callback.call(this);
914
- return value;
915
- }, function (reason) {
916
- callback.call(this);
917
- return PromiseObj.reject(reason);
918
- }
919
- );
920
- };
1196
+ function Resource(url, params, actions, options) {
921
1197
 
922
- p.success = function (callback) {
1198
+ var self = this || {},
1199
+ resource = {};
923
1200
 
924
- _.warn('The `success` method has been deprecated. Use the `then` method instead.');
1201
+ actions = assign({}, Resource.actions, actions);
925
1202
 
926
- return this.then(function (response) {
927
- return callback.call(this, response.data, response.status, response) || response;
928
- });
929
- };
1203
+ each(actions, function (action, name) {
930
1204
 
931
- p.error = function (callback) {
1205
+ action = merge({ url: url, params: params || {} }, options, action);
932
1206
 
933
- _.warn('The `error` method has been deprecated. Use the `catch` method instead.');
1207
+ resource[name] = function () {
1208
+ return (self.$http || Http)(opts(action, arguments));
1209
+ };
1210
+ });
934
1211
 
935
- return this.catch(function (response) {
936
- return callback.call(this, response.data, response.status, response) || response;
937
- });
938
- };
1212
+ return resource;
1213
+ }
939
1214
 
940
- p.always = function (callback) {
1215
+ function opts(action, args) {
941
1216
 
942
- _.warn('The `always` method has been deprecated. Use the `finally` method instead.');
1217
+ var options = assign({}, action),
1218
+ params = {},
1219
+ body;
943
1220
 
944
- var cb = function (response) {
945
- return callback.call(this, response.data, response.status, response) || response;
946
- };
1221
+ switch (args.length) {
947
1222
 
948
- return this.then(cb, cb);
949
- };
1223
+ case 2:
950
1224
 
951
- module.exports = Promise;
1225
+ params = args[0];
1226
+ body = args[1];
952
1227
 
1228
+ break;
953
1229
 
954
- /***/ },
955
- /* 11 */
956
- /***/ function(module, exports, __webpack_require__) {
1230
+ case 1:
957
1231
 
958
- /**
959
- * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
960
- */
1232
+ if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
1233
+ body = args[0];
1234
+ } else {
1235
+ params = args[0];
1236
+ }
961
1237
 
962
- var _ = __webpack_require__(1);
1238
+ break;
963
1239
 
964
- var RESOLVED = 0;
965
- var REJECTED = 1;
966
- var PENDING = 2;
1240
+ case 0:
967
1241
 
968
- function Promise(executor) {
1242
+ break;
969
1243
 
970
- this.state = PENDING;
971
- this.value = undefined;
972
- this.deferred = [];
973
-
974
- var promise = this;
1244
+ default:
975
1245
 
976
- try {
977
- executor(function (x) {
978
- promise.resolve(x);
979
- }, function (r) {
980
- promise.reject(r);
981
- });
982
- } catch (e) {
983
- promise.reject(e);
984
- }
985
- }
986
-
987
- Promise.reject = function (r) {
988
- return new Promise(function (resolve, reject) {
989
- reject(r);
990
- });
991
- };
992
-
993
- Promise.resolve = function (x) {
994
- return new Promise(function (resolve, reject) {
995
- resolve(x);
996
- });
997
- };
998
-
999
- Promise.all = function all(iterable) {
1000
- return new Promise(function (resolve, reject) {
1001
- var count = 0, result = [];
1002
-
1003
- if (iterable.length === 0) {
1004
- resolve(result);
1005
- }
1006
-
1007
- function resolver(i) {
1008
- return function (x) {
1009
- result[i] = x;
1010
- count += 1;
1011
-
1012
- if (count === iterable.length) {
1013
- resolve(result);
1014
- }
1015
- };
1016
- }
1017
-
1018
- for (var i = 0; i < iterable.length; i += 1) {
1019
- Promise.resolve(iterable[i]).then(resolver(i), reject);
1020
- }
1021
- });
1022
- };
1023
-
1024
- Promise.race = function race(iterable) {
1025
- return new Promise(function (resolve, reject) {
1026
- for (var i = 0; i < iterable.length; i += 1) {
1027
- Promise.resolve(iterable[i]).then(resolve, reject);
1028
- }
1029
- });
1030
- };
1031
-
1032
- var p = Promise.prototype;
1033
-
1034
- p.resolve = function resolve(x) {
1035
- var promise = this;
1036
-
1037
- if (promise.state === PENDING) {
1038
- if (x === promise) {
1039
- throw new TypeError('Promise settled with itself.');
1040
- }
1041
-
1042
- var called = false;
1043
-
1044
- try {
1045
- var then = x && x['then'];
1046
-
1047
- if (x !== null && typeof x === 'object' && typeof then === 'function') {
1048
- then.call(x, function (x) {
1049
- if (!called) {
1050
- promise.resolve(x);
1051
- }
1052
- called = true;
1053
-
1054
- }, function (r) {
1055
- if (!called) {
1056
- promise.reject(r);
1057
- }
1058
- called = true;
1059
- });
1060
- return;
1061
- }
1062
- } catch (e) {
1063
- if (!called) {
1064
- promise.reject(e);
1065
- }
1066
- return;
1067
- }
1068
-
1069
- promise.state = RESOLVED;
1070
- promise.value = x;
1071
- promise.notify();
1072
- }
1073
- };
1074
-
1075
- p.reject = function reject(reason) {
1076
- var promise = this;
1077
-
1078
- if (promise.state === PENDING) {
1079
- if (reason === promise) {
1080
- throw new TypeError('Promise settled with itself.');
1081
- }
1082
-
1083
- promise.state = REJECTED;
1084
- promise.value = reason;
1085
- promise.notify();
1086
- }
1087
- };
1088
-
1089
- p.notify = function notify() {
1090
- var promise = this;
1091
-
1092
- _.nextTick(function () {
1093
- if (promise.state !== PENDING) {
1094
- while (promise.deferred.length) {
1095
- var deferred = promise.deferred.shift(),
1096
- onResolved = deferred[0],
1097
- onRejected = deferred[1],
1098
- resolve = deferred[2],
1099
- reject = deferred[3];
1100
-
1101
- try {
1102
- if (promise.state === RESOLVED) {
1103
- if (typeof onResolved === 'function') {
1104
- resolve(onResolved.call(undefined, promise.value));
1105
- } else {
1106
- resolve(promise.value);
1107
- }
1108
- } else if (promise.state === REJECTED) {
1109
- if (typeof onRejected === 'function') {
1110
- resolve(onRejected.call(undefined, promise.value));
1111
- } else {
1112
- reject(promise.value);
1113
- }
1114
- }
1115
- } catch (e) {
1116
- reject(e);
1117
- }
1118
- }
1119
- }
1120
- });
1121
- };
1122
-
1123
- p.then = function then(onResolved, onRejected) {
1124
- var promise = this;
1125
-
1126
- return new Promise(function (resolve, reject) {
1127
- promise.deferred.push([onResolved, onRejected, resolve, reject]);
1128
- promise.notify();
1129
- });
1130
- };
1131
-
1132
- p.catch = function (onRejected) {
1133
- return this.then(undefined, onRejected);
1134
- };
1135
-
1136
- module.exports = Promise;
1137
-
1138
-
1139
- /***/ },
1140
- /* 12 */
1141
- /***/ function(module, exports, __webpack_require__) {
1142
-
1143
- /**
1144
- * XMLHttp client.
1145
- */
1146
-
1147
- var _ = __webpack_require__(1);
1148
- var Promise = __webpack_require__(10);
1149
-
1150
- module.exports = function (request) {
1151
- return new Promise(function (resolve) {
1152
-
1153
- var xhr = new XMLHttpRequest(), response = {request: request}, handler;
1154
-
1155
- request.cancel = function () {
1156
- xhr.abort();
1157
- };
1158
-
1159
- xhr.open(request.method, _.url(request), true);
1246
+ throw 'Expected up to 4 arguments [params, body], got ' + args.length + ' arguments';
1247
+ }
1160
1248
 
1161
- handler = function (event) {
1249
+ options.body = body;
1250
+ options.params = assign({}, options.params, params);
1162
1251
 
1163
- response.data = xhr.responseText;
1164
- response.status = xhr.status;
1165
- response.statusText = xhr.statusText;
1166
- response.headers = xhr.getAllResponseHeaders();
1252
+ return options;
1253
+ }
1167
1254
 
1168
- resolve(response);
1169
- };
1255
+ Resource.actions = {
1170
1256
 
1171
- xhr.timeout = 0;
1172
- xhr.onload = handler;
1173
- xhr.onabort = handler;
1174
- xhr.onerror = handler;
1175
- xhr.ontimeout = function () {};
1176
- xhr.onprogress = function () {};
1257
+ get: { method: 'GET' },
1258
+ save: { method: 'POST' },
1259
+ query: { method: 'GET' },
1260
+ update: { method: 'PUT' },
1261
+ remove: { method: 'DELETE' },
1262
+ delete: { method: 'DELETE' }
1177
1263
 
1178
- if (_.isPlainObject(request.xhr)) {
1179
- _.extend(xhr, request.xhr);
1180
- }
1264
+ };
1181
1265
 
1182
- if (_.isPlainObject(request.upload)) {
1183
- _.extend(xhr.upload, request.upload);
1184
- }
1266
+ function plugin(Vue) {
1185
1267
 
1186
- _.each(request.headers || {}, function (value, header) {
1187
- xhr.setRequestHeader(header, value);
1188
- });
1268
+ if (plugin.installed) {
1269
+ return;
1270
+ }
1189
1271
 
1190
- xhr.send(request.data);
1191
- });
1192
- };
1272
+ Util(Vue);
1193
1273
 
1274
+ Vue.url = Url;
1275
+ Vue.http = Http;
1276
+ Vue.resource = Resource;
1277
+ Vue.Promise = Promise$1;
1194
1278
 
1195
- /***/ },
1196
- /* 13 */
1197
- /***/ function(module, exports, __webpack_require__) {
1279
+ Object.defineProperties(Vue.prototype, {
1198
1280
 
1199
- /**
1200
- * Interceptor factory.
1201
- */
1281
+ $url: {
1282
+ get: function () {
1283
+ return options(Vue.url, this, this.$options.url);
1284
+ }
1285
+ },
1202
1286
 
1203
- var _ = __webpack_require__(1);
1204
- var Promise = __webpack_require__(10);
1287
+ $http: {
1288
+ get: function () {
1289
+ return options(Vue.http, this, this.$options.http);
1290
+ }
1291
+ },
1205
1292
 
1206
- module.exports = function (handler, vm) {
1293
+ $resource: {
1294
+ get: function () {
1295
+ return Vue.resource.bind(this);
1296
+ }
1297
+ },
1207
1298
 
1208
- return function (client) {
1299
+ $promise: {
1300
+ get: function () {
1301
+ var _this = this;
1209
1302
 
1210
- if (_.isFunction(handler)) {
1211
- handler = handler.call(vm, Promise);
1212
- }
1303
+ return function (executor) {
1304
+ return new Vue.Promise(executor, _this);
1305
+ };
1306
+ }
1307
+ }
1213
1308
 
1214
- return function (request) {
1309
+ });
1310
+ }
1215
1311
 
1216
- if (_.isFunction(handler.request)) {
1217
- request = handler.request.call(vm, request);
1218
- }
1312
+ if (typeof window !== 'undefined' && window.Vue) {
1313
+ window.Vue.use(plugin);
1314
+ }
1219
1315
 
1220
- return when(request, function (request) {
1221
- return when(client(request), function (response) {
1316
+ return plugin;
1222
1317
 
1223
- if (_.isFunction(handler.response)) {
1224
- response = handler.response.call(vm, response);
1225
- }
1226
-
1227
- return response;
1228
- });
1229
- });
1230
- };
1231
- };
1232
- };
1233
-
1234
- function when(value, fulfilled, rejected) {
1235
-
1236
- var promise = Promise.resolve(value);
1237
-
1238
- if (arguments.length < 2) {
1239
- return promise;
1240
- }
1241
-
1242
- return promise.then(fulfilled, rejected);
1243
- }
1244
-
1245
-
1246
- /***/ },
1247
- /* 14 */
1248
- /***/ function(module, exports, __webpack_require__) {
1249
-
1250
- /**
1251
- * Before Interceptor.
1252
- */
1253
-
1254
- var _ = __webpack_require__(1);
1255
-
1256
- module.exports = {
1257
-
1258
- request: function (request) {
1259
-
1260
- if (_.isFunction(request.beforeSend)) {
1261
- request.beforeSend.call(this, request);
1262
- }
1263
-
1264
- return request;
1265
- }
1266
-
1267
- };
1268
-
1269
-
1270
- /***/ },
1271
- /* 15 */
1272
- /***/ function(module, exports) {
1273
-
1274
- /**
1275
- * Timeout Interceptor.
1276
- */
1277
-
1278
- module.exports = function () {
1279
-
1280
- var timeout;
1281
-
1282
- return {
1283
-
1284
- request: function (request) {
1285
-
1286
- if (request.timeout) {
1287
- timeout = setTimeout(function () {
1288
- request.cancel();
1289
- }, request.timeout);
1290
- }
1291
-
1292
- return request;
1293
- },
1294
-
1295
- response: function (response) {
1296
-
1297
- clearTimeout(timeout);
1298
-
1299
- return response;
1300
- }
1301
-
1302
- };
1303
- };
1304
-
1305
-
1306
- /***/ },
1307
- /* 16 */
1308
- /***/ function(module, exports, __webpack_require__) {
1309
-
1310
- /**
1311
- * JSONP Interceptor.
1312
- */
1313
-
1314
- var jsonpClient = __webpack_require__(17);
1315
-
1316
- module.exports = {
1317
-
1318
- request: function (request) {
1319
-
1320
- if (request.method == 'JSONP') {
1321
- request.client = jsonpClient;
1322
- }
1323
-
1324
- return request;
1325
- }
1326
-
1327
- };
1328
-
1329
-
1330
- /***/ },
1331
- /* 17 */
1332
- /***/ function(module, exports, __webpack_require__) {
1333
-
1334
- /**
1335
- * JSONP client.
1336
- */
1337
-
1338
- var _ = __webpack_require__(1);
1339
- var Promise = __webpack_require__(10);
1340
-
1341
- module.exports = function (request) {
1342
- return new Promise(function (resolve) {
1343
-
1344
- var callback = '_jsonp' + Math.random().toString(36).substr(2), response = {request: request, data: null}, handler, script;
1345
-
1346
- request.params[request.jsonp] = callback;
1347
- request.cancel = function () {
1348
- handler({type: 'cancel'});
1349
- };
1350
-
1351
- script = document.createElement('script');
1352
- script.src = _.url(request);
1353
- script.type = 'text/javascript';
1354
- script.async = true;
1355
-
1356
- window[callback] = function (data) {
1357
- response.data = data;
1358
- };
1359
-
1360
- handler = function (event) {
1361
-
1362
- if (event.type === 'load' && response.data !== null) {
1363
- response.status = 200;
1364
- } else if (event.type === 'error') {
1365
- response.status = 404;
1366
- } else {
1367
- response.status = 0;
1368
- }
1369
-
1370
- resolve(response);
1371
-
1372
- delete window[callback];
1373
- document.body.removeChild(script);
1374
- };
1375
-
1376
- script.onload = handler;
1377
- script.onerror = handler;
1378
-
1379
- document.body.appendChild(script);
1380
- });
1381
- };
1382
-
1383
-
1384
- /***/ },
1385
- /* 18 */
1386
- /***/ function(module, exports) {
1387
-
1388
- /**
1389
- * HTTP method override Interceptor.
1390
- */
1391
-
1392
- module.exports = {
1393
-
1394
- request: function (request) {
1395
-
1396
- if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
1397
- request.headers['X-HTTP-Method-Override'] = request.method;
1398
- request.method = 'POST';
1399
- }
1400
-
1401
- return request;
1402
- }
1403
-
1404
- };
1405
-
1406
-
1407
- /***/ },
1408
- /* 19 */
1409
- /***/ function(module, exports, __webpack_require__) {
1410
-
1411
- /**
1412
- * Mime Interceptor.
1413
- */
1414
-
1415
- var _ = __webpack_require__(1);
1416
-
1417
- module.exports = {
1418
-
1419
- request: function (request) {
1420
-
1421
- if (request.emulateJSON && _.isPlainObject(request.data)) {
1422
- request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1423
- request.data = _.url.params(request.data);
1424
- }
1425
-
1426
- if (_.isObject(request.data) && /FormData/i.test(request.data.toString())) {
1427
- delete request.headers['Content-Type'];
1428
- }
1429
-
1430
- if (_.isPlainObject(request.data)) {
1431
- request.data = JSON.stringify(request.data);
1432
- }
1433
-
1434
- return request;
1435
- },
1436
-
1437
- response: function (response) {
1438
-
1439
- try {
1440
- response.data = JSON.parse(response.data);
1441
- } catch (e) {}
1442
-
1443
- return response;
1444
- }
1445
-
1446
- };
1447
-
1448
-
1449
- /***/ },
1450
- /* 20 */
1451
- /***/ function(module, exports, __webpack_require__) {
1452
-
1453
- /**
1454
- * Header Interceptor.
1455
- */
1456
-
1457
- var _ = __webpack_require__(1);
1458
-
1459
- module.exports = {
1460
-
1461
- request: function (request) {
1462
-
1463
- request.method = request.method.toUpperCase();
1464
- request.headers = _.extend({}, _.http.headers.common,
1465
- !request.crossOrigin ? _.http.headers.custom : {},
1466
- _.http.headers[request.method.toLowerCase()],
1467
- request.headers
1468
- );
1469
-
1470
- if (_.isPlainObject(request.data) && /^(GET|JSONP)$/i.test(request.method)) {
1471
- _.extend(request.params, request.data);
1472
- delete request.data;
1473
- }
1474
-
1475
- return request;
1476
- }
1477
-
1478
- };
1479
-
1480
-
1481
- /***/ },
1482
- /* 21 */
1483
- /***/ function(module, exports, __webpack_require__) {
1484
-
1485
- /**
1486
- * CORS Interceptor.
1487
- */
1488
-
1489
- var _ = __webpack_require__(1);
1490
- var xdrClient = __webpack_require__(22);
1491
- var xhrCors = 'withCredentials' in new XMLHttpRequest();
1492
- var originUrl = _.url.parse(location.href);
1493
-
1494
- module.exports = {
1495
-
1496
- request: function (request) {
1497
-
1498
- if (request.crossOrigin === null) {
1499
- request.crossOrigin = crossOrigin(request);
1500
- }
1501
-
1502
- if (request.crossOrigin) {
1503
-
1504
- if (!xhrCors) {
1505
- request.client = xdrClient;
1506
- }
1507
-
1508
- request.emulateHTTP = false;
1509
- }
1510
-
1511
- return request;
1512
- }
1513
-
1514
- };
1515
-
1516
- function crossOrigin(request) {
1517
-
1518
- var requestUrl = _.url.parse(_.url(request));
1519
-
1520
- return (requestUrl.protocol !== originUrl.protocol || requestUrl.host !== originUrl.host);
1521
- }
1522
-
1523
-
1524
- /***/ },
1525
- /* 22 */
1526
- /***/ function(module, exports, __webpack_require__) {
1527
-
1528
- /**
1529
- * XDomain client (Internet Explorer).
1530
- */
1531
-
1532
- var _ = __webpack_require__(1);
1533
- var Promise = __webpack_require__(10);
1534
-
1535
- module.exports = function (request) {
1536
- return new Promise(function (resolve) {
1537
-
1538
- var xdr = new XDomainRequest(), response = {request: request}, handler;
1539
-
1540
- request.cancel = function () {
1541
- xdr.abort();
1542
- };
1543
-
1544
- xdr.open(request.method, _.url(request), true);
1545
-
1546
- handler = function (event) {
1547
-
1548
- response.data = xdr.responseText;
1549
- response.status = xdr.status;
1550
- response.statusText = xdr.statusText;
1551
-
1552
- resolve(response);
1553
- };
1554
-
1555
- xdr.timeout = 0;
1556
- xdr.onload = handler;
1557
- xdr.onabort = handler;
1558
- xdr.onerror = handler;
1559
- xdr.ontimeout = function () {};
1560
- xdr.onprogress = function () {};
1561
-
1562
- xdr.send(request.data);
1563
- });
1564
- };
1565
-
1566
-
1567
- /***/ },
1568
- /* 23 */
1569
- /***/ function(module, exports, __webpack_require__) {
1570
-
1571
- /**
1572
- * Service for interacting with RESTful services.
1573
- */
1574
-
1575
- var _ = __webpack_require__(1);
1576
-
1577
- function Resource(url, params, actions, options) {
1578
-
1579
- var self = this, resource = {};
1580
-
1581
- actions = _.extend({},
1582
- Resource.actions,
1583
- actions
1584
- );
1585
-
1586
- _.each(actions, function (action, name) {
1587
-
1588
- action = _.merge({url: url, params: params || {}}, options, action);
1589
-
1590
- resource[name] = function () {
1591
- return (self.$http || _.http)(opts(action, arguments));
1592
- };
1593
- });
1594
-
1595
- return resource;
1596
- }
1597
-
1598
- function opts(action, args) {
1599
-
1600
- var options = _.extend({}, action), params = {}, data, success, error;
1601
-
1602
- switch (args.length) {
1603
-
1604
- case 4:
1605
-
1606
- error = args[3];
1607
- success = args[2];
1608
-
1609
- case 3:
1610
- case 2:
1611
-
1612
- if (_.isFunction(args[1])) {
1613
-
1614
- if (_.isFunction(args[0])) {
1615
-
1616
- success = args[0];
1617
- error = args[1];
1618
-
1619
- break;
1620
- }
1621
-
1622
- success = args[1];
1623
- error = args[2];
1624
-
1625
- } else {
1626
-
1627
- params = args[0];
1628
- data = args[1];
1629
- success = args[2];
1630
-
1631
- break;
1632
- }
1633
-
1634
- case 1:
1635
-
1636
- if (_.isFunction(args[0])) {
1637
- success = args[0];
1638
- } else if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
1639
- data = args[0];
1640
- } else {
1641
- params = args[0];
1642
- }
1643
-
1644
- break;
1645
-
1646
- case 0:
1647
-
1648
- break;
1649
-
1650
- default:
1651
-
1652
- throw 'Expected up to 4 arguments [params, data, success, error], got ' + args.length + ' arguments';
1653
- }
1654
-
1655
- options.data = data;
1656
- options.params = _.extend({}, options.params, params);
1657
-
1658
- if (success) {
1659
- options.success = success;
1660
- }
1661
-
1662
- if (error) {
1663
- options.error = error;
1664
- }
1665
-
1666
- return options;
1667
- }
1668
-
1669
- Resource.actions = {
1670
-
1671
- get: {method: 'GET'},
1672
- save: {method: 'POST'},
1673
- query: {method: 'GET'},
1674
- update: {method: 'PUT'},
1675
- remove: {method: 'DELETE'},
1676
- delete: {method: 'DELETE'}
1677
-
1678
- };
1679
-
1680
- module.exports = _.resource = Resource;
1681
-
1682
-
1683
- /***/ }
1684
- /******/ ])
1685
- });
1686
- ;
1318
+ }));