/*!
- * vue-resource v1.2.0
+ * vue-resource v1.5.1
* https://github.com/pagekit/vue-resource
* Released under the MIT License.
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.VueResource = factory());
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global.VueResource = factory());
}(this, (function () { 'use strict';
-/**
- * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
- */
+ /**
+ * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
+ */
-var RESOLVED = 0;
-var REJECTED = 1;
-var PENDING = 2;
+ var RESOLVED = 0;
+ var REJECTED = 1;
+ var PENDING = 2;
-function Promise$1(executor) {
+ function Promise$1(executor) {
- this.state = PENDING;
- this.value = undefined;
- this.deferred = [];
+ this.state = PENDING;
+ this.value = undefined;
+ this.deferred = [];
- var promise = this;
+ var promise = this;
- try {
- executor(function (x) {
- promise.resolve(x);
- }, function (r) {
- promise.reject(r);
- });
- } catch (e) {
- promise.reject(e);
+ try {
+ executor(function (x) {
+ promise.resolve(x);
+ }, function (r) {
+ promise.reject(r);
+ });
+ } catch (e) {
+ promise.reject(e);
+ }
}
-}
-Promise$1.reject = function (r) {
- return new Promise$1(function (resolve, reject) {
- reject(r);
- });
-};
+ Promise$1.reject = function (r) {
+ return new Promise$1(function (resolve, reject) {
+ reject(r);
+ });
+ };
-Promise$1.resolve = function (x) {
- return new Promise$1(function (resolve, reject) {
- resolve(x);
- });
-};
+ Promise$1.resolve = function (x) {
+ return new Promise$1(function (resolve, reject) {
+ resolve(x);
+ });
+ };
-Promise$1.all = function all(iterable) {
- return new Promise$1(function (resolve, reject) {
- var count = 0, result = [];
+ Promise$1.all = function all(iterable) {
+ return new Promise$1(function (resolve, reject) {
+ var count = 0, result = [];
- if (iterable.length === 0) {
- resolve(result);
- }
+ if (iterable.length === 0) {
+ resolve(result);
+ }
- function resolver(i) {
- return function (x) {
- result[i] = x;
- count += 1;
+ function resolver(i) {
+ return function (x) {
+ result[i] = x;
+ count += 1;
- if (count === iterable.length) {
- resolve(result);
- }
- };
- }
+ if (count === iterable.length) {
+ resolve(result);
+ }
+ };
+ }
- for (var i = 0; i < iterable.length; i += 1) {
- Promise$1.resolve(iterable[i]).then(resolver(i), reject);
- }
- });
-};
+ for (var i = 0; i < iterable.length; i += 1) {
+ Promise$1.resolve(iterable[i]).then(resolver(i), reject);
+ }
+ });
+ };
-Promise$1.race = function race(iterable) {
- return new Promise$1(function (resolve, reject) {
- for (var i = 0; i < iterable.length; i += 1) {
- Promise$1.resolve(iterable[i]).then(resolve, reject);
- }
- });
-};
+ Promise$1.race = function race(iterable) {
+ return new Promise$1(function (resolve, reject) {
+ for (var i = 0; i < iterable.length; i += 1) {
+ Promise$1.resolve(iterable[i]).then(resolve, reject);
+ }
+ });
+ };
-var p$1 = Promise$1.prototype;
+ var p = Promise$1.prototype;
-p$1.resolve = function resolve(x) {
- var promise = this;
+ p.resolve = function resolve(x) {
+ var promise = this;
- if (promise.state === PENDING) {
- if (x === promise) {
- throw new TypeError('Promise settled with itself.');
- }
+ if (promise.state === PENDING) {
+ if (x === promise) {
+ throw new TypeError('Promise settled with itself.');
+ }
- var called = false;
+ var called = false;
- try {
- var then = x && x['then'];
+ try {
+ var then = x && x['then'];
- if (x !== null && typeof x === 'object' && typeof then === 'function') {
- then.call(x, function (x) {
- if (!called) {
- promise.resolve(x);
- }
- called = true;
+ if (x !== null && typeof x === 'object' && typeof then === 'function') {
+ then.call(x, function (x) {
+ if (!called) {
+ promise.resolve(x);
+ }
+ called = true;
- }, function (r) {
- if (!called) {
- promise.reject(r);
- }
- called = true;
- });
+ }, function (r) {
+ if (!called) {
+ promise.reject(r);
+ }
+ called = true;
+ });
+ return;
+ }
+ } catch (e) {
+ if (!called) {
+ promise.reject(e);
+ }
return;
}
- } catch (e) {
- if (!called) {
- promise.reject(e);
- }
- return;
+
+ promise.state = RESOLVED;
+ promise.value = x;
+ promise.notify();
}
+ };
- promise.state = RESOLVED;
- promise.value = x;
- promise.notify();
- }
-};
+ p.reject = function reject(reason) {
+ var promise = this;
-p$1.reject = function reject(reason) {
- var promise = this;
+ if (promise.state === PENDING) {
+ if (reason === promise) {
+ throw new TypeError('Promise settled with itself.');
+ }
- if (promise.state === PENDING) {
- if (reason === promise) {
- throw new TypeError('Promise settled with itself.');
+ promise.state = REJECTED;
+ promise.value = reason;
+ promise.notify();
}
+ };
- promise.state = REJECTED;
- promise.value = reason;
- promise.notify();
- }
-};
-
-p$1.notify = function notify() {
- var promise = this;
-
- nextTick(function () {
- if (promise.state !== PENDING) {
- while (promise.deferred.length) {
- var deferred = promise.deferred.shift(),
- onResolved = deferred[0],
- onRejected = deferred[1],
- resolve = deferred[2],
- reject = deferred[3];
-
- try {
- if (promise.state === RESOLVED) {
- if (typeof onResolved === 'function') {
- resolve(onResolved.call(undefined, promise.value));
- } else {
- resolve(promise.value);
- }
- } else if (promise.state === REJECTED) {
- if (typeof onRejected === 'function') {
- resolve(onRejected.call(undefined, promise.value));
- } else {
- reject(promise.value);
+ p.notify = function notify() {
+ var promise = this;
+
+ nextTick(function () {
+ if (promise.state !== PENDING) {
+ while (promise.deferred.length) {
+ var deferred = promise.deferred.shift(),
+ onResolved = deferred[0],
+ onRejected = deferred[1],
+ resolve = deferred[2],
+ reject = deferred[3];
+
+ try {
+ if (promise.state === RESOLVED) {
+ if (typeof onResolved === 'function') {
+ resolve(onResolved.call(undefined, promise.value));
+ } else {
+ resolve(promise.value);
+ }
+ } else if (promise.state === REJECTED) {
+ if (typeof onRejected === 'function') {
+ resolve(onRejected.call(undefined, promise.value));
+ } else {
+ reject(promise.value);
+ }
}
+ } catch (e) {
+ reject(e);
}
- } catch (e) {
- reject(e);
}
}
- }
- });
-};
+ });
+ };
-p$1.then = function then(onResolved, onRejected) {
- var promise = this;
+ p.then = function then(onResolved, onRejected) {
+ var promise = this;
- return new Promise$1(function (resolve, reject) {
- promise.deferred.push([onResolved, onRejected, resolve, reject]);
- promise.notify();
- });
-};
+ return new Promise$1(function (resolve, reject) {
+ promise.deferred.push([onResolved, onRejected, resolve, reject]);
+ promise.notify();
+ });
+ };
-p$1.catch = function (onRejected) {
- return this.then(undefined, onRejected);
-};
+ p.catch = function (onRejected) {
+ return this.then(undefined, onRejected);
+ };
-/**
- * Promise adapter.
- */
+ /**
+ * Promise adapter.
+ */
-if (typeof Promise === 'undefined') {
- window.Promise = Promise$1;
-}
+ if (typeof Promise === 'undefined') {
+ window.Promise = Promise$1;
+ }
-function PromiseObj(executor, context) {
+ function PromiseObj(executor, context) {
- if (executor instanceof Promise) {
- this.promise = executor;
- } else {
- this.promise = new Promise(executor.bind(context));
- }
+ if (executor instanceof Promise) {
+ this.promise = executor;
+ } else {
+ this.promise = new Promise(executor.bind(context));
+ }
- this.context = context;
-}
+ this.context = context;
+ }
-PromiseObj.all = function (iterable, context) {
- return new PromiseObj(Promise.all(iterable), context);
-};
+ PromiseObj.all = function (iterable, context) {
+ return new PromiseObj(Promise.all(iterable), context);
+ };
-PromiseObj.resolve = function (value, context) {
- return new PromiseObj(Promise.resolve(value), context);
-};
+ PromiseObj.resolve = function (value, context) {
+ return new PromiseObj(Promise.resolve(value), context);
+ };
-PromiseObj.reject = function (reason, context) {
- return new PromiseObj(Promise.reject(reason), context);
-};
+ PromiseObj.reject = function (reason, context) {
+ return new PromiseObj(Promise.reject(reason), context);
+ };
-PromiseObj.race = function (iterable, context) {
- return new PromiseObj(Promise.race(iterable), context);
-};
+ PromiseObj.race = function (iterable, context) {
+ return new PromiseObj(Promise.race(iterable), context);
+ };
-var p = PromiseObj.prototype;
+ var p$1 = PromiseObj.prototype;
-p.bind = function (context) {
- this.context = context;
- return this;
-};
+ p$1.bind = function (context) {
+ this.context = context;
+ return this;
+ };
-p.then = function (fulfilled, rejected) {
+ p$1.then = function (fulfilled, rejected) {
- if (fulfilled && fulfilled.bind && this.context) {
- fulfilled = fulfilled.bind(this.context);
- }
+ if (fulfilled && fulfilled.bind && this.context) {
+ fulfilled = fulfilled.bind(this.context);
+ }
- if (rejected && rejected.bind && this.context) {
- rejected = rejected.bind(this.context);
- }
+ if (rejected && rejected.bind && this.context) {
+ rejected = rejected.bind(this.context);
+ }
- return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
-};
+ return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
+ };
-p.catch = function (rejected) {
+ p$1.catch = function (rejected) {
- if (rejected && rejected.bind && this.context) {
- rejected = rejected.bind(this.context);
- }
+ if (rejected && rejected.bind && this.context) {
+ rejected = rejected.bind(this.context);
+ }
- return new PromiseObj(this.promise.catch(rejected), this.context);
-};
+ return new PromiseObj(this.promise.catch(rejected), this.context);
+ };
-p.finally = function (callback) {
+ p$1.finally = function (callback) {
- return this.then(function (value) {
+ return this.then(function (value) {
callback.call(this);
return value;
}, function (reason) {
callback.call(this);
return Promise.reject(reason);
}
- );
-};
-
-/**
- * Utility functions.
- */
+ );
+ };
-var debug = false;
-var util = {};
-var ref = {};
-var hasOwnProperty = ref.hasOwnProperty;
+ /**
+ * Utility functions.
+ */
-var ref$1 = [];
-var slice = ref$1.slice;
+ var ref = {};
+ var hasOwnProperty = ref.hasOwnProperty;
+ var ref$1 = [];
+ var slice = ref$1.slice;
+ var debug = false, ntick;
-var inBrowser = typeof window !== 'undefined';
+ var inBrowser = typeof window !== 'undefined';
-var Util = function (Vue) {
- util = Vue.util;
- debug = Vue.config.debug || !Vue.config.silent;
-};
+ function Util (ref) {
+ var config = ref.config;
+ var nextTick = ref.nextTick;
-function warn(msg) {
- if (typeof console !== 'undefined' && debug) {
- console.warn('[VueResource warn]: ' + msg);
+ ntick = nextTick;
+ debug = config.debug || !config.silent;
}
-}
-function error(msg) {
- if (typeof console !== 'undefined') {
- console.error(msg);
+ function warn(msg) {
+ if (typeof console !== 'undefined' && debug) {
+ console.warn('[VueResource warn]: ' + msg);
+ }
}
-}
-function nextTick(cb, ctx) {
- return util.nextTick(cb, ctx);
-}
+ function error(msg) {
+ if (typeof console !== 'undefined') {
+ console.error(msg);
+ }
+ }
-function trim(str) {
- return str ? str.replace(/^\s*|\s*$/g, '') : '';
-}
+ function nextTick(cb, ctx) {
+ return ntick(cb, ctx);
+ }
-function toLower(str) {
- return str ? str.toLowerCase() : '';
-}
+ function trim(str) {
+ return str ? str.replace(/^\s*|\s*$/g, '') : '';
+ }
-function toUpper(str) {
- return str ? str.toUpperCase() : '';
-}
+ function trimEnd(str, chars) {
-var isArray = Array.isArray;
+ if (str && chars === undefined) {
+ return str.replace(/\s+$/, '');
+ }
-function isString(val) {
- return typeof val === 'string';
-}
+ if (!str || !chars) {
+ return str;
+ }
+ return str.replace(new RegExp(("[" + chars + "]+$")), '');
+ }
+ function toLower(str) {
+ return str ? str.toLowerCase() : '';
+ }
-function isFunction(val) {
- return typeof val === 'function';
-}
+ function toUpper(str) {
+ return str ? str.toUpperCase() : '';
+ }
-function isObject(obj) {
- return obj !== null && typeof obj === 'object';
-}
+ var isArray = Array.isArray;
-function isPlainObject(obj) {
- return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
-}
+ function isString(val) {
+ return typeof val === 'string';
+ }
-function isBlob(obj) {
- return typeof Blob !== 'undefined' && obj instanceof Blob;
-}
+ function isFunction(val) {
+ return typeof val === 'function';
+ }
-function isFormData(obj) {
- return typeof FormData !== 'undefined' && obj instanceof FormData;
-}
+ function isObject(obj) {
+ return obj !== null && typeof obj === 'object';
+ }
-function when(value, fulfilled, rejected) {
+ function isPlainObject(obj) {
+ return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
+ }
- var promise = PromiseObj.resolve(value);
+ function isBlob(obj) {
+ return typeof Blob !== 'undefined' && obj instanceof Blob;
+ }
- if (arguments.length < 2) {
- return promise;
+ function isFormData(obj) {
+ return typeof FormData !== 'undefined' && obj instanceof FormData;
}
- return promise.then(fulfilled, rejected);
-}
+ function when(value, fulfilled, rejected) {
-function options(fn, obj, opts) {
+ var promise = PromiseObj.resolve(value);
- opts = opts || {};
+ if (arguments.length < 2) {
+ return promise;
+ }
- if (isFunction(opts)) {
- opts = opts.call(obj);
+ return promise.then(fulfilled, rejected);
}
- return merge(fn.bind({$vm: obj, $options: opts}), fn, {$options: opts});
-}
-
-function each(obj, iterator) {
+ function options(fn, obj, opts) {
- var i, key;
+ opts = opts || {};
- if (isArray(obj)) {
- for (i = 0; i < obj.length; i++) {
- iterator.call(obj[i], obj[i], i);
+ if (isFunction(opts)) {
+ opts = opts.call(obj);
}
- } else if (isObject(obj)) {
- for (key in obj) {
- if (hasOwnProperty.call(obj, key)) {
- iterator.call(obj[key], obj[key], key);
+
+ return merge(fn.bind({$vm: obj, $options: opts}), fn, {$options: opts});
+ }
+
+ function each(obj, iterator) {
+
+ var i, key;
+
+ if (isArray(obj)) {
+ for (i = 0; i < obj.length; i++) {
+ iterator.call(obj[i], obj[i], i);
+ }
+ } else if (isObject(obj)) {
+ for (key in obj) {
+ if (hasOwnProperty.call(obj, key)) {
+ iterator.call(obj[key], obj[key], key);
+ }
}
}
- }
- return obj;
-}
+ return obj;
+ }
-var assign = Object.assign || _assign;
+ var assign = Object.assign || _assign;
-function merge(target) {
+ function merge(target) {
- var args = slice.call(arguments, 1);
+ var args = slice.call(arguments, 1);
- args.forEach(function (source) {
- _merge(target, source, true);
- });
+ args.forEach(function (source) {
+ _merge(target, source, true);
+ });
- return target;
-}
+ return target;
+ }
-function defaults(target) {
+ function defaults(target) {
- var args = slice.call(arguments, 1);
+ var args = slice.call(arguments, 1);
- args.forEach(function (source) {
+ args.forEach(function (source) {
- for (var key in source) {
- if (target[key] === undefined) {
- target[key] = source[key];
+ for (var key in source) {
+ if (target[key] === undefined) {
+ target[key] = source[key];
+ }
}
- }
- });
+ });
- return target;
-}
+ return target;
+ }
-function _assign(target) {
+ function _assign(target) {
- var args = slice.call(arguments, 1);
+ var args = slice.call(arguments, 1);
- args.forEach(function (source) {
- _merge(target, source);
- });
+ args.forEach(function (source) {
+ _merge(target, source);
+ });
- return target;
-}
+ return target;
+ }
-function _merge(target, source, deep) {
- for (var key in source) {
- if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
- if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
- target[key] = {};
- }
- if (isArray(source[key]) && !isArray(target[key])) {
- target[key] = [];
+ function _merge(target, source, deep) {
+ for (var key in source) {
+ if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
+ if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
+ target[key] = {};
+ }
+ if (isArray(source[key]) && !isArray(target[key])) {
+ target[key] = [];
+ }
+ _merge(target[key], source[key], deep);
+ } else if (source[key] !== undefined) {
+ target[key] = source[key];
}
- _merge(target[key], source[key], deep);
- } else if (source[key] !== undefined) {
- target[key] = source[key];
}
}
-}
-/**
- * Root Prefix Transform.
- */
+ /**
+ * Root Prefix Transform.
+ */
-var root = function (options$$1, next) {
+ function root (options$$1, next) {
- var url = next(options$$1);
+ var url = next(options$$1);
- if (isString(options$$1.root) && !url.match(/^(https?:)?\//)) {
- url = options$$1.root + '/' + url;
+ if (isString(options$$1.root) && !/^(https?:)?\//.test(url)) {
+ url = trimEnd(options$$1.root, '/') + '/' + url;
+ }
+
+ return url;
}
- return url;
-};
+ /**
+ * Query Parameter Transform.
+ */
-/**
- * Query Parameter Transform.
- */
+ function query (options$$1, next) {
-var query = function (options$$1, next) {
+ var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
- var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
+ each(options$$1.params, function (value, key) {
+ if (urlParams.indexOf(key) === -1) {
+ query[key] = value;
+ }
+ });
- each(options$$1.params, function (value, key) {
- if (urlParams.indexOf(key) === -1) {
- query[key] = value;
- }
- });
+ query = Url.params(query);
- query = Url.params(query);
+ if (query) {
+ url += (url.indexOf('?') == -1 ? '?' : '&') + query;
+ }
- if (query) {
- url += (url.indexOf('?') == -1 ? '?' : '&') + query;
+ return url;
}
- return url;
-};
+ /**
+ * URL Template v2.0.6 (https://github.com/bramstein/url-template)
+ */
-/**
- * URL Template v2.0.6 (https://github.com/bramstein/url-template)
- */
+ function expand(url, params, variables) {
-function expand(url, params, variables) {
+ var tmpl = parse(url), expanded = tmpl.expand(params);
- var tmpl = parse(url), expanded = tmpl.expand(params);
+ if (variables) {
+ variables.push.apply(variables, tmpl.vars);
+ }
- if (variables) {
- variables.push.apply(variables, tmpl.vars);
+ return expanded;
}
- return expanded;
-}
+ function parse(template) {
-function parse(template) {
+ var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
- var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
+ return {
+ vars: variables,
+ expand: function expand(context) {
+ return template.replace(/\{([^{}]+)\}|([^{}]+)/g, function (_, expression, literal) {
+ if (expression) {
- return {
- vars: variables,
- expand: function expand(context) {
- return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
- if (expression) {
+ var operator = null, values = [];
- var operator = null, values = [];
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
+ operator = expression.charAt(0);
+ expression = expression.substr(1);
+ }
- if (operators.indexOf(expression.charAt(0)) !== -1) {
- operator = expression.charAt(0);
- expression = expression.substr(1);
- }
+ expression.split(/,/g).forEach(function (variable) {
+ var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
+ values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
+ variables.push(tmp[1]);
+ });
- expression.split(/,/g).forEach(function (variable) {
- var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
- values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
- variables.push(tmp[1]);
- });
+ if (operator && operator !== '+') {
- if (operator && operator !== '+') {
+ var separator = ',';
- var separator = ',';
+ if (operator === '?') {
+ separator = '&';
+ } else if (operator !== '#') {
+ separator = operator;
+ }
- if (operator === '?') {
- separator = '&';
- } else if (operator !== '#') {
- separator = operator;
+ return (values.length !== 0 ? operator : '') + values.join(separator);
+ } else {
+ return values.join(',');
}
- return (values.length !== 0 ? operator : '') + values.join(separator);
} else {
- return values.join(',');
+ return encodeReserved(literal);
}
+ });
+ }
+ };
+ }
- } else {
- return encodeReserved(literal);
- }
- });
- }
- };
-}
-
-function getValues(context, operator, key, modifier) {
-
- var value = context[key], result = [];
+ function getValues(context, operator, key, modifier) {
- if (isDefined(value) && value !== '') {
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
- value = value.toString();
+ var value = context[key], result = [];
- if (modifier && modifier !== '*') {
- value = value.substring(0, parseInt(modifier, 10));
- }
+ if (isDefined(value) && value !== '') {
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
+ value = value.toString();
- result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
- } else {
- if (modifier === '*') {
- if (Array.isArray(value)) {
- value.filter(isDefined).forEach(function (value) {
- result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
- });
- } else {
- Object.keys(value).forEach(function (k) {
- if (isDefined(value[k])) {
- result.push(encodeValue(operator, value[k], k));
- }
- });
+ if (modifier && modifier !== '*') {
+ value = value.substring(0, parseInt(modifier, 10));
}
- } else {
- var tmp = [];
- if (Array.isArray(value)) {
- value.filter(isDefined).forEach(function (value) {
- tmp.push(encodeValue(operator, value));
- });
+ result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
+ } else {
+ if (modifier === '*') {
+ if (Array.isArray(value)) {
+ value.filter(isDefined).forEach(function (value) {
+ result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
+ });
+ } else {
+ Object.keys(value).forEach(function (k) {
+ if (isDefined(value[k])) {
+ result.push(encodeValue(operator, value[k], k));
+ }
+ });
+ }
} else {
- Object.keys(value).forEach(function (k) {
- if (isDefined(value[k])) {
- tmp.push(encodeURIComponent(k));
- tmp.push(encodeValue(operator, value[k].toString()));
- }
- });
- }
+ var tmp = [];
- if (isKeyOperator(operator)) {
- result.push(encodeURIComponent(key) + '=' + tmp.join(','));
- } else if (tmp.length !== 0) {
- result.push(tmp.join(','));
+ if (Array.isArray(value)) {
+ value.filter(isDefined).forEach(function (value) {
+ tmp.push(encodeValue(operator, value));
+ });
+ } else {
+ Object.keys(value).forEach(function (k) {
+ if (isDefined(value[k])) {
+ tmp.push(encodeURIComponent(k));
+ tmp.push(encodeValue(operator, value[k].toString()));
+ }
+ });
+ }
+
+ if (isKeyOperator(operator)) {
+ result.push(encodeURIComponent(key) + '=' + tmp.join(','));
+ } else if (tmp.length !== 0) {
+ result.push(tmp.join(','));
+ }
}
}
+ } else {
+ if (operator === ';') {
+ result.push(encodeURIComponent(key));
+ } else if (value === '' && (operator === '&' || operator === '?')) {
+ result.push(encodeURIComponent(key) + '=');
+ } else if (value === '') {
+ result.push('');
+ }
}
- } else {
- if (operator === ';') {
- result.push(encodeURIComponent(key));
- } else if (value === '' && (operator === '&' || operator === '?')) {
- result.push(encodeURIComponent(key) + '=');
- } else if (value === '') {
- result.push('');
+
+ return result;
+ }
+
+ function isDefined(value) {
+ return value !== undefined && value !== null;
+ }
+
+ function isKeyOperator(operator) {
+ return operator === ';' || operator === '&' || operator === '?';
+ }
+
+ function encodeValue(operator, value, key) {
+
+ value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeURIComponent(value);
+
+ if (key) {
+ return encodeURIComponent(key) + '=' + value;
+ } else {
+ return value;
}
}
- return result;
-}
+ function encodeReserved(str) {
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
+ if (!/%[0-9A-Fa-f]/.test(part)) {
+ part = encodeURI(part);
+ }
+ return part;
+ }).join('');
+ }
-function isDefined(value) {
- return value !== undefined && value !== null;
-}
+ /**
+ * URL Template (RFC 6570) Transform.
+ */
-function isKeyOperator(operator) {
- return operator === ';' || operator === '&' || operator === '?';
-}
+ function template (options) {
-function encodeValue(operator, value, key) {
+ var variables = [], url = expand(options.url, options.params, variables);
- value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeURIComponent(value);
+ variables.forEach(function (key) {
+ delete options.params[key];
+ });
- if (key) {
- return encodeURIComponent(key) + '=' + value;
- } else {
- return value;
+ return url;
}
-}
-function encodeReserved(str) {
- return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
- if (!/%[0-9A-Fa-f]/.test(part)) {
- part = encodeURI(part);
- }
- return part;
- }).join('');
-}
+ /**
+ * Service for URL templating.
+ */
-/**
- * URL Template (RFC 6570) Transform.
- */
+ function Url(url, params) {
-var template = function (options) {
+ var self = this || {}, options$$1 = url, transform;
- var variables = [], url = expand(options.url, options.params, variables);
+ if (isString(url)) {
+ options$$1 = {url: url, params: params};
+ }
- variables.forEach(function (key) {
- delete options.params[key];
- });
+ options$$1 = merge({}, Url.options, self.$options, options$$1);
- return url;
-};
+ Url.transforms.forEach(function (handler) {
-/**
- * Service for URL templating.
- */
+ if (isString(handler)) {
+ handler = Url.transform[handler];
+ }
-function Url(url, params) {
+ if (isFunction(handler)) {
+ transform = factory(handler, transform, self.$vm);
+ }
- var self = this || {}, options$$1 = url, transform;
+ });
- if (isString(url)) {
- options$$1 = {url: url, params: params};
+ return transform(options$$1);
}
- options$$1 = merge({}, Url.options, self.$options, options$$1);
+ /**
+ * Url options.
+ */
- Url.transforms.forEach(function (handler) {
- transform = factory(handler, transform, self.$vm);
- });
+ Url.options = {
+ url: '',
+ root: null,
+ params: {}
+ };
- return transform(options$$1);
-}
+ /**
+ * Url transforms.
+ */
-/**
- * Url options.
- */
+ Url.transform = {template: template, query: query, root: root};
+ Url.transforms = ['template', 'query', 'root'];
-Url.options = {
- url: '',
- root: null,
- params: {}
-};
+ /**
+ * Encodes a Url parameter string.
+ *
+ * @param {Object} obj
+ */
-/**
- * Url transforms.
- */
-
-Url.transforms = [template, query, root];
+ Url.params = function (obj) {
-/**
- * Encodes a Url parameter string.
- *
- * @param {Object} obj
- */
+ var params = [], escape = encodeURIComponent;
-Url.params = function (obj) {
+ params.add = function (key, value) {
- var params = [], escape = encodeURIComponent;
+ if (isFunction(value)) {
+ value = value();
+ }
- params.add = function (key, value) {
+ if (value === null) {
+ value = '';
+ }
- if (isFunction(value)) {
- value = value();
- }
+ this.push(escape(key) + '=' + escape(value));
+ };
- if (value === null) {
- value = '';
- }
+ serialize(params, obj);
- this.push(escape(key) + '=' + escape(value));
+ return params.join('&').replace(/%20/g, '+');
};
- serialize(params, obj);
-
- return params.join('&').replace(/%20/g, '+');
-};
+ /**
+ * Parse a URL and return its components.
+ *
+ * @param {String} url
+ */
-/**
- * Parse a URL and return its components.
- *
- * @param {String} url
- */
+ Url.parse = function (url) {
-Url.parse = function (url) {
+ var el = document.createElement('a');
- var el = document.createElement('a');
+ if (document.documentMode) {
+ el.href = url;
+ url = el.href;
+ }
- if (document.documentMode) {
el.href = url;
- url = el.href;
- }
- el.href = url;
-
- return {
- href: el.href,
- protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
- port: el.port,
- host: el.host,
- hostname: el.hostname,
- pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
- search: el.search ? el.search.replace(/^\?/, '') : '',
- hash: el.hash ? el.hash.replace(/^#/, '') : ''
+ return {
+ href: el.href,
+ protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
+ port: el.port,
+ host: el.host,
+ hostname: el.hostname,
+ pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
+ search: el.search ? el.search.replace(/^\?/, '') : '',
+ hash: el.hash ? el.hash.replace(/^#/, '') : ''
+ };
};
-};
-function factory(handler, next, vm) {
- return function (options$$1) {
- return handler.call(vm, options$$1, next);
- };
-}
+ function factory(handler, next, vm) {
+ return function (options$$1) {
+ return handler.call(vm, options$$1, next);
+ };
+ }
-function serialize(params, obj, scope) {
+ function serialize(params, obj, scope) {
- var array = isArray(obj), plain = isPlainObject(obj), hash;
+ var array = isArray(obj), plain = isPlainObject(obj), hash;
- each(obj, function (value, key) {
+ each(obj, function (value, key) {
- hash = isObject(value) || isArray(value);
+ hash = isObject(value) || isArray(value);
- if (scope) {
- key = scope + '[' + (plain || hash ? key : '') + ']';
- }
+ if (scope) {
+ key = scope + '[' + (plain || hash ? key : '') + ']';
+ }
- if (!scope && array) {
- params.add(value.name, value.value);
- } else if (hash) {
- serialize(params, value, key);
- } else {
- params.add(key, value);
- }
- });
-}
+ if (!scope && array) {
+ params.add(value.name, value.value);
+ } else if (hash) {
+ serialize(params, value, key);
+ } else {
+ params.add(key, value);
+ }
+ });
+ }
-/**
- * XDomain client (Internet Explorer).
- */
+ /**
+ * XDomain client (Internet Explorer).
+ */
-var xdrClient = function (request) {
- return new PromiseObj(function (resolve) {
+ function xdrClient (request) {
+ return new PromiseObj(function (resolve) {
- var xdr = new XDomainRequest(), handler = function (ref) {
- var type = ref.type;
+ var xdr = new XDomainRequest(), handler = function (ref) {
+ var type = ref.type;
- var status = 0;
+ var status = 0;
- if (type === 'load') {
- status = 200;
- } else if (type === 'error') {
- status = 500;
- }
+ if (type === 'load') {
+ status = 200;
+ } else if (type === 'error') {
+ status = 500;
+ }
- resolve(request.respondWith(xdr.responseText, {status: status}));
- };
+ resolve(request.respondWith(xdr.responseText, {status: status}));
+ };
- request.abort = function () { return xdr.abort(); };
+ request.abort = function () { return xdr.abort(); };
- xdr.open(request.method, request.getUrl());
+ xdr.open(request.method, request.getUrl());
- if (request.timeout) {
- xdr.timeout = request.timeout;
- }
+ if (request.timeout) {
+ xdr.timeout = request.timeout;
+ }
- xdr.onload = handler;
- xdr.onabort = handler;
- xdr.onerror = handler;
- xdr.ontimeout = handler;
- xdr.onprogress = function () {};
- xdr.send(request.getBody());
- });
-};
+ xdr.onload = handler;
+ xdr.onabort = handler;
+ xdr.onerror = handler;
+ xdr.ontimeout = handler;
+ xdr.onprogress = function () {};
+ xdr.send(request.getBody());
+ });
+ }
-/**
- * CORS Interceptor.
- */
+ /**
+ * CORS Interceptor.
+ */
-var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
+ var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
-var cors = function (request, next) {
+ function cors (request) {
- if (inBrowser) {
+ if (inBrowser) {
- var orgUrl = Url.parse(location.href);
- var reqUrl = Url.parse(request.getUrl());
+ var orgUrl = Url.parse(location.href);
+ var reqUrl = Url.parse(request.getUrl());
- if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
+ if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
- request.crossOrigin = true;
- request.emulateHTTP = false;
+ request.crossOrigin = true;
+ request.emulateHTTP = false;
- if (!SUPPORTS_CORS) {
- request.client = xdrClient;
+ if (!SUPPORTS_CORS) {
+ request.client = xdrClient;
+ }
}
}
+
}
- next();
-};
+ /**
+ * Form data Interceptor.
+ */
-/**
- * Body Interceptor.
- */
+ function form (request) {
-var body = function (request, next) {
+ if (isFormData(request.body)) {
+ request.headers.delete('Content-Type');
+ } else if (isObject(request.body) && request.emulateJSON) {
+ request.body = Url.params(request.body);
+ request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
+ }
- if (isFormData(request.body)) {
+ }
- request.headers.delete('Content-Type');
+ /**
+ * JSON Interceptor.
+ */
- } else if (isObject(request.body) || isArray(request.body)) {
+ function json (request) {
- if (request.emulateJSON) {
- request.body = Url.params(request.body);
- request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
- } else {
+ var type = request.headers.get('Content-Type') || '';
+
+ if (isObject(request.body) && type.indexOf('application/json') === 0) {
request.body = JSON.stringify(request.body);
}
- }
- next(function (response) {
+ return function (response) {
- Object.defineProperty(response, 'data', {
+ return response.bodyText ? when(response.text(), function (text) {
- get: function get() {
- return this.body;
- },
+ var type = response.headers.get('Content-Type') || '';
- set: function set(body) {
- this.body = body;
- }
+ if (type.indexOf('application/json') === 0 || isJson(text)) {
- });
+ try {
+ response.body = JSON.parse(text);
+ } catch (e) {
+ response.body = null;
+ }
- return response.bodyText ? when(response.text(), function (text) {
+ } else {
+ response.body = text;
+ }
- var type = response.headers.get('Content-Type') || '';
+ return response;
- if (type.indexOf('application/json') === 0 || isJson(text)) {
+ }) : response;
- try {
- response.body = JSON.parse(text);
- } catch (e) {
- response.body = null;
- }
+ };
+ }
- } else {
- response.body = text;
- }
+ function isJson(str) {
+
+ var start = str.match(/^\s*(\[|\{)/);
+ var end = {'[': /]\s*$/, '{': /}\s*$/};
- return response;
+ return start && end[start[1]].test(str);
+ }
- }) : response;
+ /**
+ * JSONP client (Browser).
+ */
- });
-};
+ function jsonpClient (request) {
+ return new PromiseObj(function (resolve) {
-function isJson(str) {
+ var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
- var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/};
+ handler = function (ref) {
+ var type = ref.type;
- return start && end[start[0]].test(str);
-}
-/**
- * JSONP client (Browser).
- */
+ var status = 0;
-var jsonpClient = function (request) {
- return new PromiseObj(function (resolve) {
+ if (type === 'load' && body !== null) {
+ status = 200;
+ } else if (type === 'error') {
+ status = 500;
+ }
- var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
+ if (status && window[callback]) {
+ delete window[callback];
+ document.body.removeChild(script);
+ }
- handler = function (ref) {
- var type = ref.type;
+ resolve(request.respondWith(body, {status: status}));
+ };
+ window[callback] = function (result) {
+ body = JSON.stringify(result);
+ };
- var status = 0;
+ request.abort = function () {
+ handler({type: 'abort'});
+ };
- if (type === 'load' && body !== null) {
- status = 200;
- } else if (type === 'error') {
- status = 500;
- }
+ request.params[name] = callback;
- if (status && window[callback]) {
- delete window[callback];
- document.body.removeChild(script);
+ if (request.timeout) {
+ setTimeout(request.abort, request.timeout);
}
- resolve(request.respondWith(body, {status: status}));
- };
+ script = document.createElement('script');
+ script.src = request.getUrl();
+ script.type = 'text/javascript';
+ script.async = true;
+ script.onload = handler;
+ script.onerror = handler;
- window[callback] = function (result) {
- body = JSON.stringify(result);
- };
+ document.body.appendChild(script);
+ });
+ }
- request.abort = function () {
- handler({type: 'abort'});
- };
+ /**
+ * JSONP Interceptor.
+ */
- request.params[name] = callback;
+ function jsonp (request) {
- if (request.timeout) {
- setTimeout(request.abort, request.timeout);
+ if (request.method == 'JSONP') {
+ request.client = jsonpClient;
}
- script = document.createElement('script');
- script.src = request.getUrl();
- script.type = 'text/javascript';
- script.async = true;
- script.onload = handler;
- script.onerror = handler;
+ }
- document.body.appendChild(script);
- });
-};
+ /**
+ * Before Interceptor.
+ */
-/**
- * JSONP Interceptor.
- */
+ function before (request) {
-var jsonp = function (request, next) {
+ if (isFunction(request.before)) {
+ request.before.call(this, request);
+ }
- if (request.method == 'JSONP') {
- request.client = jsonpClient;
}
- next();
-};
+ /**
+ * HTTP method override Interceptor.
+ */
-/**
- * Before Interceptor.
- */
+ function method (request) {
-var before = function (request, next) {
+ if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
+ request.headers.set('X-HTTP-Method-Override', request.method);
+ request.method = 'POST';
+ }
- if (isFunction(request.before)) {
- request.before.call(this, request);
}
- next();
-};
+ /**
+ * Header Interceptor.
+ */
-/**
- * HTTP method override Interceptor.
- */
-
-var method = function (request, next) {
+ function header (request) {
- if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
- request.headers.set('X-HTTP-Method-Override', request.method);
- request.method = 'POST';
- }
+ var headers = assign({}, Http.headers.common,
+ !request.crossOrigin ? Http.headers.custom : {},
+ Http.headers[toLower(request.method)]
+ );
- next();
-};
+ each(headers, function (value, name) {
+ if (!request.headers.has(name)) {
+ request.headers.set(name, value);
+ }
+ });
-/**
- * Header Interceptor.
- */
+ }
-var header = function (request, next) {
+ /**
+ * XMLHttp client (Browser).
+ */
- var headers = assign({}, Http.headers.common,
- !request.crossOrigin ? Http.headers.custom : {},
- Http.headers[toLower(request.method)]
- );
+ function xhrClient (request) {
+ return new PromiseObj(function (resolve) {
- each(headers, function (value, name) {
- if (!request.headers.has(name)) {
- request.headers.set(name, value);
- }
- });
+ var xhr = new XMLHttpRequest(), handler = function (event) {
- next();
-};
+ var response = request.respondWith(
+ 'response' in xhr ? xhr.response : xhr.responseText, {
+ status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
+ statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)
+ });
-/**
- * XMLHttp client (Browser).
- */
+ each(trim(xhr.getAllResponseHeaders()).split('\n'), function (row) {
+ response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
+ });
-var SUPPORTS_BLOB = typeof Blob !== 'undefined' && typeof FileReader !== 'undefined';
+ resolve(response);
+ };
-var xhrClient = function (request) {
- return new PromiseObj(function (resolve) {
+ request.abort = function () { return xhr.abort(); };
- var xhr = new XMLHttpRequest(), handler = function (event) {
+ xhr.open(request.method, request.getUrl(), true);
- var response = request.respondWith(
- 'response' in xhr ? xhr.response : xhr.responseText, {
- status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
- statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)
- }
- );
+ if (request.timeout) {
+ xhr.timeout = request.timeout;
+ }
- each(trim(xhr.getAllResponseHeaders()).split('\n'), function (row) {
- response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
- });
+ if (request.responseType && 'responseType' in xhr) {
+ xhr.responseType = request.responseType;
+ }
- resolve(response);
- };
+ if (request.withCredentials || request.credentials) {
+ xhr.withCredentials = true;
+ }
- request.abort = function () { return xhr.abort(); };
+ if (!request.crossOrigin) {
+ request.headers.set('X-Requested-With', 'XMLHttpRequest');
+ }
- if (request.progress) {
- if (request.method === 'GET') {
+ // deprecated use downloadProgress
+ if (isFunction(request.progress) && request.method === 'GET') {
xhr.addEventListener('progress', request.progress);
- } else if (/^(POST|PUT)$/i.test(request.method)) {
- xhr.upload.addEventListener('progress', request.progress);
}
- }
-
- xhr.open(request.method, request.getUrl(), true);
- if (request.timeout) {
- xhr.timeout = request.timeout;
- }
+ if (isFunction(request.downloadProgress)) {
+ xhr.addEventListener('progress', request.downloadProgress);
+ }
- if (request.credentials === true) {
- xhr.withCredentials = true;
- }
+ // deprecated use uploadProgress
+ if (isFunction(request.progress) && /^(POST|PUT)$/i.test(request.method)) {
+ xhr.upload.addEventListener('progress', request.progress);
+ }
- if (!request.crossOrigin) {
- request.headers.set('X-Requested-With', 'XMLHttpRequest');
- }
+ if (isFunction(request.uploadProgress) && xhr.upload) {
+ xhr.upload.addEventListener('progress', request.uploadProgress);
+ }
- if ('responseType' in xhr && SUPPORTS_BLOB) {
- xhr.responseType = 'blob';
- }
+ request.headers.forEach(function (value, name) {
+ xhr.setRequestHeader(name, value);
+ });
- request.headers.forEach(function (value, name) {
- xhr.setRequestHeader(name, value);
+ xhr.onload = handler;
+ xhr.onabort = handler;
+ xhr.onerror = handler;
+ xhr.ontimeout = handler;
+ xhr.send(request.getBody());
});
+ }
- xhr.onload = handler;
- xhr.onabort = handler;
- xhr.onerror = handler;
- xhr.ontimeout = handler;
- xhr.send(request.getBody());
- });
-};
-
-/**
- * Http client (Node).
- */
+ /**
+ * Http client (Node).
+ */
-var nodeClient = function (request) {
+ function nodeClient (request) {
- var client = require('got');
+ var client = require('got');
- return new PromiseObj(function (resolve) {
+ return new PromiseObj(function (resolve) {
- var url = request.getUrl();
- var body = request.getBody();
- var method = request.method;
- var headers = {}, handler;
+ var url = request.getUrl();
+ var body = request.getBody();
+ var method = request.method;
+ var headers = {}, handler;
- request.headers.forEach(function (value, name) {
- headers[name] = value;
- });
+ request.headers.forEach(function (value, name) {
+ headers[name] = value;
+ });
- client(url, {body: body, method: method, headers: headers}).then(handler = function (resp) {
+ client(url, {body: body, method: method, headers: headers}).then(handler = function (resp) {
- var response = request.respondWith(resp.body, {
+ var response = request.respondWith(resp.body, {
status: resp.statusCode,
statusText: trim(resp.statusMessage)
- }
- );
-
- each(resp.headers, function (value, name) {
- response.headers.set(name, value);
- });
+ });
- resolve(response);
+ each(resp.headers, function (value, name) {
+ response.headers.set(name, value);
+ });
- }, function (error$$1) { return handler(error$$1.response); });
- });
-};
+ resolve(response);
-/**
- * Base client.
- */
+ }, function (error$$1) { return handler(error$$1.response); });
+ });
+ }
-var Client = function (context) {
+ /**
+ * Base client.
+ */
- var reqHandlers = [sendRequest], resHandlers = [], handler;
+ function Client (context) {
- if (!isObject(context)) {
- context = null;
- }
+ var reqHandlers = [sendRequest], resHandlers = [];
- function Client(request) {
- return new PromiseObj(function (resolve) {
+ if (!isObject(context)) {
+ context = null;
+ }
- function exec() {
+ function Client(request) {
+ while (reqHandlers.length) {
- handler = reqHandlers.pop();
+ var handler = reqHandlers.pop();
if (isFunction(handler)) {
- handler.call(context, request, next);
- } else {
- warn(("Invalid interceptor of type " + (typeof handler) + ", must be a function"));
- next();
- }
- }
- function next(response) {
+ var response = (void 0), next = (void 0);
- if (isFunction(response)) {
+ response = handler.call(context, request, function (val) { return next = val; }) || next;
- resHandlers.unshift(response);
+ if (isObject(response)) {
+ return new PromiseObj(function (resolve, reject) {
- } else if (isObject(response)) {
+ resHandlers.forEach(function (handler) {
+ response = when(response, function (response) {
+ return handler.call(context, response) || response;
+ }, reject);
+ });
- resHandlers.forEach(function (handler) {
- response = when(response, function (response) {
- return handler.call(context, response) || response;
- });
- });
+ when(response, resolve, reject);
- when(response, resolve);
+ }, context);
+ }
- return;
- }
+ if (isFunction(response)) {
+ resHandlers.unshift(response);
+ }
- exec();
+ } else {
+ warn(("Invalid interceptor of type " + (typeof handler) + ", must be a function"));
+ }
}
+ }
- exec();
+ Client.use = function (handler) {
+ reqHandlers.push(handler);
+ };
- }, context);
+ return Client;
}
- Client.use = function (handler) {
- reqHandlers.push(handler);
- };
-
- return Client;
-};
+ function sendRequest(request) {
-function sendRequest(request, resolve) {
+ var client = request.client || (inBrowser ? xhrClient : nodeClient);
- var client = request.client || (inBrowser ? xhrClient : nodeClient);
+ return client(request);
+ }
- resolve(client(request));
-}
+ /**
+ * HTTP Headers.
+ */
-/**
- * HTTP Headers.
- */
+ var Headers = function Headers(headers) {
+ var this$1 = this;
-var Headers = function Headers(headers) {
- var this$1 = this;
+ this.map = {};
- this.map = {};
+ each(headers, function (value, name) { return this$1.append(name, value); });
+ };
- each(headers, function (value, name) { return this$1.append(name, value); });
-};
+ Headers.prototype.has = function has (name) {
+ return getName(this.map, name) !== null;
+ };
-Headers.prototype.has = function has (name) {
- return getName(this.map, name) !== null;
-};
+ Headers.prototype.get = function get (name) {
-Headers.prototype.get = function get (name) {
+ var list = this.map[getName(this.map, name)];
- var list = this.map[getName(this.map, name)];
+ return list ? list.join() : null;
+ };
- return list ? list[0] : null;
-};
+ Headers.prototype.getAll = function getAll (name) {
+ return this.map[getName(this.map, name)] || [];
+ };
-Headers.prototype.getAll = function getAll (name) {
- return this.map[getName(this.map, name)] || [];
-};
+ Headers.prototype.set = function set (name, value) {
+ this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];
+ };
-Headers.prototype.set = function set (name, value) {
- this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];
-};
+ Headers.prototype.append = function append (name, value) {
-Headers.prototype.append = function append (name, value){
+ var list = this.map[getName(this.map, name)];
- var list = this.getAll(name);
+ if (list) {
+ list.push(trim(value));
+ } else {
+ this.set(name, value);
+ }
+ };
- if (list.length) {
- list.push(trim(value));
- } else {
- this.set(name, value);
- }
-};
+ Headers.prototype.delete = function delete$1 (name) {
+ delete this.map[getName(this.map, name)];
+ };
-Headers.prototype.delete = function delete$1 (name){
- delete this.map[getName(this.map, name)];
-};
+ Headers.prototype.deleteAll = function deleteAll () {
+ this.map = {};
+ };
-Headers.prototype.deleteAll = function deleteAll (){
- this.map = {};
-};
+ Headers.prototype.forEach = function forEach (callback, thisArg) {
+ var this$1 = this;
-Headers.prototype.forEach = function forEach (callback, thisArg) {
- var this$1 = this;
+ each(this.map, function (list, name) {
+ each(list, function (value) { return callback.call(thisArg, value, name, this$1); });
+ });
+ };
- each(this.map, function (list, name) {
- each(list, function (value) { return callback.call(thisArg, value, name, this$1); });
- });
-};
+ function getName(map, name) {
+ return Object.keys(map).reduce(function (prev, curr) {
+ return toLower(name) === toLower(curr) ? curr : prev;
+ }, null);
+ }
-function getName(map, name) {
- return Object.keys(map).reduce(function (prev, curr) {
- return toLower(name) === toLower(curr) ? curr : prev;
- }, null);
-}
+ function normalizeName(name) {
-function normalizeName(name) {
+ if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
+ throw new TypeError('Invalid character in header field name');
+ }
- if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
- throw new TypeError('Invalid character in header field name');
+ return trim(name);
}
- return trim(name);
-}
+ /**
+ * HTTP Response.
+ */
-/**
- * HTTP Response.
- */
+ var Response = function Response(body, ref) {
+ var url = ref.url;
+ var headers = ref.headers;
+ var status = ref.status;
+ var statusText = ref.statusText;
-var Response = function Response(body, ref) {
- var url = ref.url;
- var headers = ref.headers;
- var status = ref.status;
- var statusText = ref.statusText;
+ this.url = url;
+ this.ok = status >= 200 && status < 300;
+ this.status = status || 0;
+ this.statusText = statusText || '';
+ this.headers = new Headers(headers);
+ this.body = body;
- this.url = url;
- this.ok = status >= 200 && status < 300;
- this.status = status || 0;
- this.statusText = statusText || '';
- this.headers = new Headers(headers);
- this.body = body;
+ if (isString(body)) {
- if (isString(body)) {
+ this.bodyText = body;
- this.bodyText = body;
+ } else if (isBlob(body)) {
- } else if (isBlob(body)) {
+ this.bodyBlob = body;
- this.bodyBlob = body;
-
- if (isBlobText(body)) {
- this.bodyText = blobText(body);
+ if (isBlobText(body)) {
+ this.bodyText = blobText(body);
+ }
}
- }
-};
+ };
-Response.prototype.blob = function blob () {
- return when(this.bodyBlob);
-};
+ Response.prototype.blob = function blob () {
+ return when(this.bodyBlob);
+ };
-Response.prototype.text = function text () {
- return when(this.bodyText);
-};
+ Response.prototype.text = function text () {
+ return when(this.bodyText);
+ };
-Response.prototype.json = function json () {
- return when(this.text(), function (text) { return JSON.parse(text); });
-};
+ Response.prototype.json = function json () {
+ return when(this.text(), function (text) { return JSON.parse(text); });
+ };
-function blobText(body) {
- return new PromiseObj(function (resolve) {
+ Object.defineProperty(Response.prototype, 'data', {
- var reader = new FileReader();
+ get: function get() {
+ return this.body;
+ },
- reader.readAsText(body);
- reader.onload = function () {
- resolve(reader.result);
- };
+ set: function set(body) {
+ this.body = body;
+ }
});
-}
-function isBlobText(body) {
- return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
-}
-
-/**
- * HTTP Request.
- */
+ function blobText(body) {
+ return new PromiseObj(function (resolve) {
-var Request = function Request(options$$1) {
+ var reader = new FileReader();
- this.body = null;
- this.params = {};
+ reader.readAsText(body);
+ reader.onload = function () {
+ resolve(reader.result);
+ };
- assign(this, options$$1, {
- method: toUpper(options$$1.method || 'GET')
- });
+ });
+ }
- if (!(this.headers instanceof Headers)) {
- this.headers = new Headers(this.headers);
+ function isBlobText(body) {
+ return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
}
-};
-Request.prototype.getUrl = function getUrl (){
- return Url(this);
-};
+ /**
+ * HTTP Request.
+ */
-Request.prototype.getBody = function getBody (){
- return this.body;
-};
+ var Request = function Request(options$$1) {
-Request.prototype.respondWith = function respondWith (body, options$$1) {
- return new Response(body, assign(options$$1 || {}, {url: this.getUrl()}));
-};
+ this.body = null;
+ this.params = {};
-/**
- * Service for sending network requests.
- */
+ assign(this, options$$1, {
+ method: toUpper(options$$1.method || 'GET')
+ });
-var COMMON_HEADERS = {'Accept': 'application/json, text/plain, */*'};
-var JSON_CONTENT_TYPE = {'Content-Type': 'application/json;charset=utf-8'};
+ if (!(this.headers instanceof Headers)) {
+ this.headers = new Headers(this.headers);
+ }
+ };
-function Http(options$$1) {
+ Request.prototype.getUrl = function getUrl () {
+ return Url(this);
+ };
- var self = this || {}, client = Client(self.$vm);
+ Request.prototype.getBody = function getBody () {
+ return this.body;
+ };
- defaults(options$$1 || {}, self.$options, Http.options);
+ Request.prototype.respondWith = function respondWith (body, options$$1) {
+ return new Response(body, assign(options$$1 || {}, {url: this.getUrl()}));
+ };
- Http.interceptors.forEach(function (handler) {
- client.use(handler);
- });
+ /**
+ * Service for sending network requests.
+ */
- return client(new Request(options$$1)).then(function (response) {
+ var COMMON_HEADERS = {'Accept': 'application/json, text/plain, */*'};
+ var JSON_CONTENT_TYPE = {'Content-Type': 'application/json;charset=utf-8'};
- return response.ok ? response : PromiseObj.reject(response);
+ function Http(options$$1) {
- }, function (response) {
+ var self = this || {}, client = Client(self.$vm);
- if (response instanceof Error) {
- error(response);
- }
+ defaults(options$$1 || {}, self.$options, Http.options);
- return PromiseObj.reject(response);
- });
-}
+ Http.interceptors.forEach(function (handler) {
-Http.options = {};
+ if (isString(handler)) {
+ handler = Http.interceptor[handler];
+ }
-Http.headers = {
- put: JSON_CONTENT_TYPE,
- post: JSON_CONTENT_TYPE,
- patch: JSON_CONTENT_TYPE,
- delete: JSON_CONTENT_TYPE,
- common: COMMON_HEADERS,
- custom: {}
-};
+ if (isFunction(handler)) {
+ client.use(handler);
+ }
-Http.interceptors = [before, method, body, jsonp, header, cors];
+ });
-['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
+ return client(new Request(options$$1)).then(function (response) {
- Http[method$$1] = function (url, options$$1) {
- return this(assign(options$$1 || {}, {url: url, method: method$$1}));
- };
+ return response.ok ? response : PromiseObj.reject(response);
-});
+ }, function (response) {
-['post', 'put', 'patch'].forEach(function (method$$1) {
+ if (response instanceof Error) {
+ error(response);
+ }
- Http[method$$1] = function (url, body$$1, options$$1) {
- return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body$$1}));
- };
+ return PromiseObj.reject(response);
+ });
+ }
-});
+ Http.options = {};
-/**
- * Service for interacting with RESTful services.
- */
+ Http.headers = {
+ put: JSON_CONTENT_TYPE,
+ post: JSON_CONTENT_TYPE,
+ patch: JSON_CONTENT_TYPE,
+ delete: JSON_CONTENT_TYPE,
+ common: COMMON_HEADERS,
+ custom: {}
+ };
-function Resource(url, params, actions, options$$1) {
+ Http.interceptor = {before: before, method: method, jsonp: jsonp, json: json, form: form, header: header, cors: cors};
+ Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
- var self = this || {}, resource = {};
+ ['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
- actions = assign({},
- Resource.actions,
- actions
- );
+ Http[method$$1] = function (url, options$$1) {
+ return this(assign(options$$1 || {}, {url: url, method: method$$1}));
+ };
- each(actions, function (action, name) {
+ });
- action = merge({url: url, params: assign({}, params)}, options$$1, action);
+ ['post', 'put', 'patch'].forEach(function (method$$1) {
- resource[name] = function () {
- return (self.$http || Http)(opts(action, arguments));
+ Http[method$$1] = function (url, body, options$$1) {
+ return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body}));
};
+
});
- return resource;
-}
+ /**
+ * Service for interacting with RESTful services.
+ */
-function opts(action, args) {
+ function Resource(url, params, actions, options$$1) {
- var options$$1 = assign({}, action), params = {}, body;
+ var self = this || {}, resource = {};
- switch (args.length) {
+ actions = assign({},
+ Resource.actions,
+ actions
+ );
- case 2:
+ each(actions, function (action, name) {
- params = args[0];
- body = args[1];
+ action = merge({url: url, params: assign({}, params)}, options$$1, action);
- break;
+ resource[name] = function () {
+ return (self.$http || Http)(opts(action, arguments));
+ };
+ });
- case 1:
+ return resource;
+ }
- if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {
- body = args[0];
- } else {
- params = args[0];
- }
+ function opts(action, args) {
- break;
+ var options$$1 = assign({}, action), params = {}, body;
- case 0:
+ switch (args.length) {
- break;
+ case 2:
- default:
+ params = args[0];
+ body = args[1];
- throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
- }
+ break;
- options$$1.body = body;
- options$$1.params = assign({}, options$$1.params, params);
+ case 1:
- return options$$1;
-}
+ if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {
+ body = args[0];
+ } else {
+ params = args[0];
+ }
-Resource.actions = {
+ break;
- get: {method: 'GET'},
- save: {method: 'POST'},
- query: {method: 'GET'},
- update: {method: 'PUT'},
- remove: {method: 'DELETE'},
- delete: {method: 'DELETE'}
+ case 0:
-};
+ break;
-/**
- * Install plugin.
- */
+ default:
+
+ throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
+ }
-function plugin(Vue) {
+ options$$1.body = body;
+ options$$1.params = assign({}, options$$1.params, params);
- if (plugin.installed) {
- return;
+ return options$$1;
}
- Util(Vue);
+ Resource.actions = {
- Vue.url = Url;
- Vue.http = Http;
- Vue.resource = Resource;
- Vue.Promise = PromiseObj;
+ get: {method: 'GET'},
+ save: {method: 'POST'},
+ query: {method: 'GET'},
+ update: {method: 'PUT'},
+ remove: {method: 'DELETE'},
+ delete: {method: 'DELETE'}
- Object.defineProperties(Vue.prototype, {
+ };
- $url: {
- get: function get() {
- return options(Vue.url, this, this.$options.url);
- }
- },
+ /**
+ * Install plugin.
+ */
- $http: {
- get: function get() {
- return options(Vue.http, this, this.$options.http);
- }
- },
+ function plugin(Vue) {
- $resource: {
- get: function get() {
- return Vue.resource.bind(this);
- }
- },
+ if (plugin.installed) {
+ return;
+ }
+
+ Util(Vue);
+
+ Vue.url = Url;
+ Vue.http = Http;
+ Vue.resource = Resource;
+ Vue.Promise = PromiseObj;
+
+ Object.defineProperties(Vue.prototype, {
+
+ $url: {
+ get: function get() {
+ return options(Vue.url, this, this.$options.url);
+ }
+ },
+
+ $http: {
+ get: function get() {
+ return options(Vue.http, this, this.$options.http);
+ }
+ },
+
+ $resource: {
+ get: function get() {
+ return Vue.resource.bind(this);
+ }
+ },
- $promise: {
- get: function get() {
- var this$1 = this;
+ $promise: {
+ get: function get() {
+ var this$1 = this;
- return function (executor) { return new Vue.Promise(executor, this$1); };
+ return function (executor) { return new Vue.Promise(executor, this$1); };
+ }
}
- }
- });
-}
+ });
+ }
-if (typeof window !== 'undefined' && window.Vue) {
- window.Vue.use(plugin);
-}
+ if (typeof window !== 'undefined' && window.Vue) {
+ window.Vue.use(plugin);
+ }
-return plugin;
+ return plugin;
})));
/*!
- * vue-resource v1.2.0
+ * vue-resource v1.5.1
* https://github.com/pagekit/vue-resource
* Released under the MIT License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=J,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){"undefined"!=typeof console&&G&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return V.nextTick(t,e)}function i(t){return t?t.replace(/^\s*|\s*$/g,""):""}function u(t){return t?t.toLowerCase():""}function s(t){return t?t.toUpperCase():""}function a(t){return"string"==typeof t}function c(t){return"function"==typeof t}function f(t){return null!==t&&"object"==typeof t}function h(t){return f(t)&&Object.getPrototypeOf(t)==Object.prototype}function p(t){return"undefined"!=typeof Blob&&t instanceof Blob}function d(t){return"undefined"!=typeof FormData&&t instanceof FormData}function l(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function m(t,e,n){return n=n||{},c(n)&&(n=n.call(e)),v(t.bind({$vm:e,$options:n}),t,{$options:n})}function y(t,e){var n,o;if(tt(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(f(t))for(o in t)z.call(t,o)&&e.call(t[o],t[o],o);return t}function v(t){var e=Q.call(arguments,1);return e.forEach(function(e){w(t,e,!0)}),t}function b(t){var e=Q.call(arguments,1);return e.forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function g(t){var e=Q.call(arguments,1);return e.forEach(function(e){w(t,e)}),t}function w(t,e,n){for(var o in e)n&&(h(e[o])||tt(e[o]))?(h(e[o])&&!h(t[o])&&(t[o]={}),tt(e[o])&&!tt(t[o])&&(t[o]=[]),w(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function T(t,e,n){var o=x(t),r=o.expand(e);return n&&n.push.apply(n,o.vars),r}function x(t){var e=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(o){return t.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(t,r,i){if(r){var u=null,s=[];if(e.indexOf(r.charAt(0))!==-1&&(u=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(t){var e=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);s.push.apply(s,j(o,u,e[1],e[2]||e[3])),n.push(e[1])}),u&&"+"!==u){var a=",";return"?"===u?a="&":"#"!==u&&(a=u),(0!==s.length?u:"")+s.join(a)}return s.join(",")}return C(i)})}}}function j(t,e,n,o){var r=t[n],i=[];if(E(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(P(e,r,O(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(E).forEach(function(t){i.push(P(e,t,O(e)?n:null))}):Object.keys(r).forEach(function(t){E(r[t])&&i.push(P(e,r[t],t))});else{var u=[];Array.isArray(r)?r.filter(E).forEach(function(t){u.push(P(e,t))}):Object.keys(r).forEach(function(t){E(r[t])&&(u.push(encodeURIComponent(t)),u.push(P(e,r[t].toString())))}),O(e)?i.push(encodeURIComponent(n)+"="+u.join(",")):0!==u.length&&i.push(u.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}function E(t){return void 0!==t&&null!==t}function O(t){return";"===t||"&"===t||"?"===t}function P(t,e,n){return e="+"===t||"#"===t?C(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function C(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function $(t,e){var n,o=this||{},r=t;return a(t)&&(r={url:t,params:e}),r=v({},$.options,o.$options,r),$.transforms.forEach(function(t){n=U(t,n,o.$vm)}),n(r)}function U(t,e,n){return function(o){return t.call(n,o,e)}}function A(t,e,n){var o,r=tt(e),i=h(e);y(e,function(e,u){o=f(e)||tt(e),n&&(u=n+"["+(i||o?u:"")+"]"),!n&&r?t.add(e.name,e.value):o?A(t,e,u):t.add(u,e)})}function R(t){var e=t.match(/^\[|^\{(?!\{)/),n={"[":/]$/,"{":/}$/};return e&&n[e[0]].test(t)}function S(t,e){var n=t.client||(Y?mt:yt);e(n(t))}function k(t,e){return Object.keys(t).reduce(function(t,n){return u(e)===u(n)?n:t},null)}function I(t){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return i(t)}function H(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}function B(t){return 0===t.type.indexOf("text")||t.type.indexOf("json")!==-1}function L(t){var n=this||{},r=vt(n.$vm);return b(t||{},n.$options,L.options),L.interceptors.forEach(function(t){r.use(t)}),r(new wt(t)).then(function(t){return t.ok?t:e.reject(t)},function(t){return t instanceof Error&&o(t),e.reject(t)})}function q(t,e,n,o){var r=this||{},i={};return n=et({},q.actions,n),y(n,function(n,u){n=v({url:t,params:et({},e)},o,n),i[u]=function(){return(r.$http||L)(M(n,arguments))}}),i}function M(t,e){var n,o=et({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=et({},o.params,r),o}function N(t){N.installed||(Z(t),t.url=$,t.http=L,t.resource=q,t.Promise=e,Object.defineProperties(t.prototype,{$url:{get:function(){return m(t.url,this,this.$options.url)}},$http:{get:function(){return m(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}var D=0,F=1,J=2;t.reject=function(e){return new t(function(t,n){n(e)})},t.resolve=function(e){return new t(function(t,n){t(e)})},t.all=function(e){return new t(function(n,o){function r(t){return function(o){u[t]=o,i+=1,i===e.length&&n(u)}}var i=0,u=[];0===e.length&&n(u);for(var s=0;s<e.length;s+=1)t.resolve(e[s]).then(r(s),o)})},t.race=function(e){return new t(function(n,o){for(var r=0;r<e.length;r+=1)t.resolve(e[r]).then(n,o)})};var W=t.prototype;W.resolve=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=D,e.value=t,e.notify()}},W.reject=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");e.state=F,e.value=t,e.notify()}},W.notify=function(){var t=this;r(function(){if(t.state!==J)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],o=e[1],r=e[2],i=e[3];try{t.state===D?r("function"==typeof n?n.call(void 0,t.value):t.value):t.state===F&&("function"==typeof o?r(o.call(void 0,t.value)):i(t.value))}catch(t){i(t)}}})},W.then=function(e,n){var o=this;return new t(function(t,r){o.deferred.push([e,n,t,r]),o.notify()})},W.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=t),e.all=function(t,n){return new e(Promise.all(t),n)},e.resolve=function(t,n){return new e(Promise.resolve(t),n)},e.reject=function(t,n){return new e(Promise.reject(t),n)},e.race=function(t,n){return new e(Promise.race(t),n)};var X=e.prototype;X.bind=function(t){return this.context=t,this},X.then=function(t,n){return t&&t.bind&&this.context&&(t=t.bind(this.context)),n&&n.bind&&this.context&&(n=n.bind(this.context)),new e(this.promise.then(t,n),this.context)},X.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new e(this.promise.catch(t),this.context)},X.finally=function(t){return this.then(function(e){return t.call(this),e},function(e){return t.call(this),Promise.reject(e)})};var G=!1,V={},_={},z=_.hasOwnProperty,K=[],Q=K.slice,Y="undefined"!=typeof window,Z=function(t){V=t.util,G=t.config.debug||!t.config.silent},tt=Array.isArray,et=Object.assign||g,nt=function(t,e){var n=e(t);return a(t.root)&&!n.match(/^(https?:)?\//)&&(n=t.root+"/"+n),n},ot=function(t,e){var n=Object.keys($.options.params),o={},r=e(t);return y(t.params,function(t,e){n.indexOf(e)===-1&&(o[e]=t)}),o=$.params(o),o&&(r+=(r.indexOf("?")==-1?"?":"&")+o),r},rt=function(t){var e=[],n=T(t.url,t.params,e);return e.forEach(function(e){delete t.params[e]}),n};$.options={url:"",root:null,params:{}},$.transforms=[rt,ot,nt],$.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){c(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},A(e,t),e.join("&").replace(/%20/g,"+")},$.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var it=function(t){return new e(function(e){var n=new XDomainRequest,o=function(o){var r=o.type,i=0;"load"===r?i=200:"error"===r&&(i=500),e(t.respondWith(n.responseText,{status:i}))};t.abort=function(){return n.abort()},n.open(t.method,t.getUrl()),t.timeout&&(n.timeout=t.timeout),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){},n.send(t.getBody())})},ut=Y&&"withCredentials"in new XMLHttpRequest,st=function(t,e){if(Y){var n=$.parse(location.href),o=$.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,ut||(t.client=it))}e()},at=function(t,e){d(t.body)?t.headers.delete("Content-Type"):(f(t.body)||tt(t.body))&&(t.emulateJSON?(t.body=$.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")):t.body=JSON.stringify(t.body)),e(function(t){return Object.defineProperty(t,"data",{get:function(){return this.body},set:function(t){this.body=t}}),t.bodyText?l(t.text(),function(e){var n=t.headers.get("Content-Type")||"";if(0===n.indexOf("application/json")||R(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},ct=function(t){return new e(function(e){var n,o,r=t.jsonp||"callback",i=t.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),u=null;n=function(n){var r=n.type,s=0;"load"===r&&null!==u?s=200:"error"===r&&(s=500),s&&window[i]&&(delete window[i],document.body.removeChild(o)),e(t.respondWith(u,{status:s}))},window[i]=function(t){u=JSON.stringify(t)},t.abort=function(){n({type:"abort"})},t.params[r]=i,t.timeout&&setTimeout(t.abort,t.timeout),o=document.createElement("script"),o.src=t.getUrl(),o.type="text/javascript",o.async=!0,o.onload=n,o.onerror=n,document.body.appendChild(o)})},ft=function(t,e){"JSONP"==t.method&&(t.client=ct),e()},ht=function(t,e){c(t.before)&&t.before.call(this,t),e()},pt=function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},dt=function(t,e){var n=et({},L.headers.common,t.crossOrigin?{}:L.headers.custom,L.headers[u(t.method)]);y(n,function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},lt="undefined"!=typeof Blob&&"undefined"!=typeof FileReader,mt=function(t){return new e(function(e){var n=new XMLHttpRequest,o=function(o){var r=t.respondWith("response"in n?n.response:n.responseText,{status:1223===n.status?204:n.status,statusText:1223===n.status?"No Content":i(n.statusText)});y(i(n.getAllResponseHeaders()).split("\n"),function(t){r.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),e(r)};t.abort=function(){return n.abort()},t.progress&&("GET"===t.method?n.addEventListener("progress",t.progress):/^(POST|PUT)$/i.test(t.method)&&n.upload.addEventListener("progress",t.progress)),n.open(t.method,t.getUrl(),!0),t.timeout&&(n.timeout=t.timeout),t.credentials===!0&&(n.withCredentials=!0),t.crossOrigin||t.headers.set("X-Requested-With","XMLHttpRequest"),"responseType"in n&<&&(n.responseType="blob"),t.headers.forEach(function(t,e){n.setRequestHeader(e,t)}),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.send(t.getBody())})},yt=function(t){var n=require("got");return new e(function(e){var o,r=t.getUrl(),u=t.getBody(),s=t.method,a={};t.headers.forEach(function(t,e){a[e]=t}),n(r,{body:u,method:s,headers:a}).then(o=function(n){var o=t.respondWith(n.body,{status:n.statusCode,statusText:i(n.statusMessage)});y(n.headers,function(t,e){o.headers.set(e,t)}),e(o)},function(t){return o(t.response)})})},vt=function(t){function o(o){return new e(function(e){function s(){r=i.pop(),c(r)?r.call(t,o,a):(n("Invalid interceptor of type "+typeof r+", must be a function"),a())}function a(n){if(c(n))u.unshift(n);else if(f(n))return u.forEach(function(e){n=l(n,function(n){return e.call(t,n)||n})}),void l(n,e);s()}s()},t)}var r,i=[S],u=[];return f(t)||(t=null),o.use=function(t){i.push(t)},o},bt=function(t){var e=this;this.map={},y(t,function(t,n){return e.append(n,t)})};bt.prototype.has=function(t){return null!==k(this.map,t)},bt.prototype.get=function(t){var e=this.map[k(this.map,t)];return e?e[0]:null},bt.prototype.getAll=function(t){return this.map[k(this.map,t)]||[]},bt.prototype.set=function(t,e){this.map[I(k(this.map,t)||t)]=[i(e)]},bt.prototype.append=function(t,e){var n=this.getAll(t);n.length?n.push(i(e)):this.set(t,e)},bt.prototype.delete=function(t){delete this.map[k(this.map,t)]},bt.prototype.deleteAll=function(){this.map={}},bt.prototype.forEach=function(t,e){var n=this;y(this.map,function(o,r){y(o,function(o){return t.call(e,o,r,n)})})};var gt=function(t,e){var n=e.url,o=e.headers,r=e.status,i=e.statusText;this.url=n,this.ok=r>=200&&r<300,this.status=r||0,this.statusText=i||"",this.headers=new bt(o),this.body=t,a(t)?this.bodyText=t:p(t)&&(this.bodyBlob=t,B(t)&&(this.bodyText=H(t)))};gt.prototype.blob=function(){return l(this.bodyBlob)},gt.prototype.text=function(){return l(this.bodyText)},gt.prototype.json=function(){return l(this.text(),function(t){return JSON.parse(t)})};var wt=function(t){this.body=null,this.params={},et(this,t,{method:s(t.method||"GET")}),this.headers instanceof bt||(this.headers=new bt(this.headers))};wt.prototype.getUrl=function(){return $(this)},wt.prototype.getBody=function(){return this.body},wt.prototype.respondWith=function(t,e){return new gt(t,et(e||{},{url:this.getUrl()}))};var Tt={Accept:"application/json, text/plain, */*"},xt={"Content-Type":"application/json;charset=utf-8"};return L.options={},L.headers={put:xt,post:xt,patch:xt,delete:xt,common:Tt,custom:{}},L.interceptors=[ht,pt,at,ft,dt,st],["get","delete","head","jsonp"].forEach(function(t){L[t]=function(e,n){return this(et(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){L[t]=function(e,n,o){return this(et(o||{},{url:e,method:t,body:n}))}}),q.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(N),N});
\ No newline at end of file
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function u(t){this.state=2,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}u.reject=function(n){return new u(function(t,e){e(n)})},u.resolve=function(n){return new u(function(t,e){t(n)})},u.all=function(s){return new u(function(n,t){var o=0,r=[];function e(e){return function(t){r[e]=t,(o+=1)===s.length&&n(r)}}0===s.length&&n(r);for(var i=0;i<s.length;i+=1)u.resolve(s[i]).then(e(i),t)})},u.race=function(o){return new u(function(t,e){for(var n=0;n<o.length;n+=1)u.resolve(o[n]).then(t,e)})};var t=u.prototype;function c(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}t.resolve=function(t){var e=this;if(2===e.state){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},t.reject=function(t){var e=this;if(2===e.state){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify()}},t.notify=function(){var t,i=this;r(function(){if(2!==i.state)for(;i.deferred.length;){var t=i.deferred.shift(),e=t[0],n=t[1],o=t[2],r=t[3];try{0===i.state?o("function"==typeof e?e.call(void 0,i.value):i.value):1===i.state&&("function"==typeof n?o(n.call(void 0,i.value)):r(i.value))}catch(t){r(t)}}},t)},t.then=function(n,o){var r=this;return new u(function(t,e){r.deferred.push([n,o,t,e]),r.notify()})},t.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=u),c.all=function(t,e){return new c(Promise.all(t),e)},c.resolve=function(t,e){return new c(Promise.resolve(t),e)},c.reject=function(t,e){return new c(Promise.reject(t),e)},c.race=function(t,e){return new c(Promise.race(t),e)};var e=c.prototype;e.bind=function(t){return this.context=t,this},e.then=function(t,e){return t&&t.bind&&this.context&&(t=t.bind(this.context)),e&&e.bind&&this.context&&(e=e.bind(this.context)),new c(this.promise.then(t,e),this.context)},e.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new c(this.promise.catch(t),this.context)},e.finally=function(e){return this.then(function(t){return e.call(this),t},function(t){return e.call(this),Promise.reject(t)})};var r,i={}.hasOwnProperty,o=[].slice,a=!1,s="undefined"!=typeof window;function f(t){return t?t.replace(/^\s*|\s*$/g,""):""}function p(t){return t?t.toLowerCase():""}var h=Array.isArray;function d(t){return"string"==typeof t}function l(t){return"function"==typeof t}function m(t){return null!==t&&"object"==typeof t}function y(t){return m(t)&&Object.getPrototypeOf(t)==Object.prototype}function v(t,e,n){var o=c.resolve(t);return arguments.length<2?o:o.then(e,n)}function b(t,e,n){return l(n=n||{})&&(n=n.call(e)),T(t.bind({$vm:e,$options:n}),t,{$options:n})}function g(t,e){var n,o;if(h(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(m(t))for(o in t)i.call(t,o)&&e.call(t[o],t[o],o);return t}var w=Object.assign||function(e){return o.call(arguments,1).forEach(function(t){x(e,t)}),e};function T(e){return o.call(arguments,1).forEach(function(t){x(e,t,!0)}),e}function x(t,e,n){for(var o in e)n&&(y(e[o])||h(e[o]))?(y(e[o])&&!y(t[o])&&(t[o]={}),h(e[o])&&!h(t[o])&&(t[o]=[]),x(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function j(t,e,n){var o,u,a,r=(o=t,u=["+","#",".","/",";","?","&"],{vars:a=[],expand:function(s){return o.replace(/\{([^{}]+)\}|([^{}]+)/g,function(t,e,n){if(e){var o=null,r=[];if(-1!==u.indexOf(e.charAt(0))&&(o=e.charAt(0),e=e.substr(1)),e.split(/,/g).forEach(function(t){var e=/([^:*]*)(?::(\d+)|(\*))?/.exec(t);r.push.apply(r,function(t,e,n,o){var r=t[n],i=[];if(E(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(O(e,r,P(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(E).forEach(function(t){i.push(O(e,t,P(e)?n:null))}):Object.keys(r).forEach(function(t){E(r[t])&&i.push(O(e,r[t],t))});else{var s=[];Array.isArray(r)?r.filter(E).forEach(function(t){s.push(O(e,t))}):Object.keys(r).forEach(function(t){E(r[t])&&(s.push(encodeURIComponent(t)),s.push(O(e,r[t].toString())))}),P(e)?i.push(encodeURIComponent(n)+"="+s.join(",")):0!==s.length&&i.push(s.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}(s,o,e[1],e[2]||e[3])),a.push(e[1])}),o&&"+"!==o){var i=",";return"?"===o?i="&":"#"!==o&&(i=o),(0!==r.length?o:"")+r.join(i)}return r.join(",")}return C(n)})}}),i=r.expand(e);return n&&n.push.apply(n,r.vars),i}function E(t){return null!=t}function P(t){return";"===t||"&"===t||"?"===t}function O(t,e,n){return e="+"===t||"#"===t?C(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function C(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function $(t,e){var r,i=this||{},n=t;return d(t)&&(n={url:t,params:e}),n=T({},$.options,i.$options,n),$.transforms.forEach(function(t){var e,n,o;d(t)&&(t=$.transform[t]),l(t)&&(e=t,n=r,o=i.$vm,r=function(t){return e.call(o,t,n)})}),r(n)}function U(i){return new c(function(o){var r=new XDomainRequest,t=function(t){var e=t.type,n=0;"load"===e?n=200:"error"===e&&(n=500),o(i.respondWith(r.responseText,{status:n}))};i.abort=function(){return r.abort()},r.open(i.method,i.getUrl()),i.timeout&&(r.timeout=i.timeout),r.onload=t,r.onabort=t,r.onerror=t,r.ontimeout=t,r.onprogress=function(){},r.send(i.getBody())})}$.options={url:"",root:null,params:{}},$.transform={template:function(e){var t=[],n=j(e.url,e.params,t);return t.forEach(function(t){delete e.params[t]}),n},query:function(t,e){var n=Object.keys($.options.params),o={},r=e(t);return g(t.params,function(t,e){-1===n.indexOf(e)&&(o[e]=t)}),(o=$.params(o))&&(r+=(-1==r.indexOf("?")?"?":"&")+o),r},root:function(t,e){var n,o,r=e(t);return d(t.root)&&!/^(https?:)?\//.test(r)&&(n=t.root,o="/",r=(n&&void 0===o?n.replace(/\s+$/,""):n&&o?n.replace(new RegExp("["+o+"]+$"),""):n)+"/"+r),r}},$.transforms=["template","query","root"],$.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){l(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},function n(o,t,r){var i,s=h(t),u=y(t);g(t,function(t,e){i=m(t)||h(t),r&&(e=r+"["+(u||i?e:"")+"]"),!r&&s?o.add(t.name,t.value):i?n(o,t,e):o.add(e,t)})}(e,t),e.join("&").replace(/%20/g,"+")},$.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var R=s&&"withCredentials"in new XMLHttpRequest;function n(u){return new c(function(o){var t,r,e=u.jsonp||"callback",i=u.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),s=null;t=function(t){var e=t.type,n=0;"load"===e&&null!==s?n=200:"error"===e&&(n=500),n&&window[i]&&(delete window[i],document.body.removeChild(r)),o(u.respondWith(s,{status:n}))},window[i]=function(t){s=JSON.stringify(t)},u.abort=function(){t({type:"abort"})},u.params[e]=i,u.timeout&&setTimeout(u.abort,u.timeout),(r=document.createElement("script")).src=u.getUrl(),r.type="text/javascript",r.async=!0,r.onload=t,r.onerror=t,document.body.appendChild(r)})}function A(r){return new c(function(n){var o=new XMLHttpRequest,t=function(t){var e=r.respondWith("response"in o?o.response:o.responseText,{status:1223===o.status?204:o.status,statusText:1223===o.status?"No Content":f(o.statusText)});g(f(o.getAllResponseHeaders()).split("\n"),function(t){e.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),n(e)};r.abort=function(){return o.abort()},o.open(r.method,r.getUrl(),!0),r.timeout&&(o.timeout=r.timeout),r.responseType&&"responseType"in o&&(o.responseType=r.responseType),(r.withCredentials||r.credentials)&&(o.withCredentials=!0),r.crossOrigin||r.headers.set("X-Requested-With","XMLHttpRequest"),l(r.progress)&&"GET"===r.method&&o.addEventListener("progress",r.progress),l(r.downloadProgress)&&o.addEventListener("progress",r.downloadProgress),l(r.progress)&&/^(POST|PUT)$/i.test(r.method)&&o.upload.addEventListener("progress",r.progress),l(r.uploadProgress)&&o.upload&&o.upload.addEventListener("progress",r.uploadProgress),r.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.onload=t,o.onabort=t,o.onerror=t,o.ontimeout=t,o.send(r.getBody())})}function S(s){var u=require("got");return new c(function(e){var n,t=s.getUrl(),o=s.getBody(),r=s.method,i={};s.headers.forEach(function(t,e){i[e]=t}),u(t,{body:o,method:r,headers:i}).then(n=function(t){var n=s.respondWith(t.body,{status:t.statusCode,statusText:f(t.statusMessage)});g(t.headers,function(t,e){n.headers.set(e,t)}),e(n)},function(t){return n(t.response)})})}function k(t){return(t.client||(s?A:S))(t)}var I=function(t){var n=this;this.map={},g(t,function(t,e){return n.append(e,t)})};function L(t,n){return Object.keys(t).reduce(function(t,e){return p(n)===p(e)?e:t},null)}I.prototype.has=function(t){return null!==L(this.map,t)},I.prototype.get=function(t){var e=this.map[L(this.map,t)];return e?e.join():null},I.prototype.getAll=function(t){return this.map[L(this.map,t)]||[]},I.prototype.set=function(t,e){this.map[function(t){if(/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return f(t)}(L(this.map,t)||t)]=[f(e)]},I.prototype.append=function(t,e){var n=this.map[L(this.map,t)];n?n.push(f(e)):this.set(t,e)},I.prototype.delete=function(t){delete this.map[L(this.map,t)]},I.prototype.deleteAll=function(){this.map={}},I.prototype.forEach=function(n,o){var r=this;g(this.map,function(t,e){g(t,function(t){return n.call(o,t,e,r)})})};var q=function(t,e){var n,o,r,i=e.url,s=e.headers,u=e.status,a=e.statusText;this.url=i,this.ok=200<=u&&u<300,this.status=u||0,this.statusText=a||"",this.headers=new I(s),d(this.body=t)?this.bodyText=t:(r=t,"undefined"!=typeof Blob&&r instanceof Blob&&(this.bodyBlob=t,(0===(o=t).type.indexOf("text")||-1!==o.type.indexOf("json"))&&(this.bodyText=(n=t,new c(function(t){var e=new FileReader;e.readAsText(n),e.onload=function(){t(e.result)}})))))};q.prototype.blob=function(){return v(this.bodyBlob)},q.prototype.text=function(){return v(this.bodyText)},q.prototype.json=function(){return v(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(q.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var H=function(t){var e;this.body=null,this.params={},w(this,t,{method:(e=t.method||"GET",e?e.toUpperCase():"")}),this.headers instanceof I||(this.headers=new I(this.headers))};H.prototype.getUrl=function(){return $(this)},H.prototype.getBody=function(){return this.body},H.prototype.respondWith=function(t,e){return new q(t,w(e||{},{url:this.getUrl()}))};var B={"Content-Type":"application/json;charset=utf-8"};function M(t){var e=this||{},n=function(i){var s=[k],u=[];function t(t){for(;s.length;){var e=s.pop();if(l(e)){var o=void 0,n=void 0;if(m(o=e.call(i,t,function(t){return n=t})||n))return new c(function(t,n){u.forEach(function(e){o=v(o,function(t){return e.call(i,t)||t},n)}),v(o,t,n)},i);l(o)&&u.unshift(o)}else r="Invalid interceptor of type "+typeof e+", must be a function","undefined"!=typeof console&&a&&console.warn("[VueResource warn]: "+r)}var r}return m(i)||(i=null),t.use=function(t){s.push(t)},t}(e.$vm);return function(n){o.call(arguments,1).forEach(function(t){for(var e in t)void 0===n[e]&&(n[e]=t[e])})}(t||{},e.$options,M.options),M.interceptors.forEach(function(t){d(t)&&(t=M.interceptor[t]),l(t)&&n.use(t)}),n(new H(t)).then(function(t){return t.ok?t:c.reject(t)},function(t){var e;return t instanceof Error&&(e=t,"undefined"!=typeof console&&console.error(e)),c.reject(t)})}function N(n,o,t,r){var i=this||{},s={};return g(t=w({},N.actions,t),function(t,e){t=T({url:n,params:w({},o)},r,t),s[e]=function(){return(i.$http||M)(function(t,e){var n,o=w({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=w({},o.params,r),o}(t,arguments))}}),s}function D(n){var t,e,o;D.installed||(e=(t=n).config,o=t.nextTick,r=o,a=e.debug||!e.silent,n.url=$,n.http=M,n.resource=N,n.Promise=c,Object.defineProperties(n.prototype,{$url:{get:function(){return b(n.url,this,this.$options.url)}},$http:{get:function(){return b(n.http,this,this.$options.http)}},$resource:{get:function(){return n.resource.bind(this)}},$promise:{get:function(){var e=this;return function(t){return new n.Promise(t,e)}}}}))}return M.options={},M.headers={put:B,post:B,patch:B,delete:B,common:{Accept:"application/json, text/plain, */*"},custom:{}},M.interceptor={before:function(t){l(t.before)&&t.before.call(this,t)},method:function(t){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST")},jsonp:function(t){"JSONP"==t.method&&(t.client=n)},json:function(t){var e=t.headers.get("Content-Type")||"";return m(t.body)&&0===e.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),function(o){return o.bodyText?v(o.text(),function(t){var e,n;if(0===(o.headers.get("Content-Type")||"").indexOf("application/json")||(n=(e=t).match(/^\s*(\[|\{)/))&&{"[":/]\s*$/,"{":/}\s*$/}[n[1]].test(e))try{o.body=JSON.parse(t)}catch(t){o.body=null}else o.body=t;return o}):o}},form:function(t){var e;e=t.body,"undefined"!=typeof FormData&&e instanceof FormData?t.headers.delete("Content-Type"):m(t.body)&&t.emulateJSON&&(t.body=$.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded"))},header:function(n){g(w({},M.headers.common,n.crossOrigin?{}:M.headers.custom,M.headers[p(n.method)]),function(t,e){n.headers.has(e)||n.headers.set(e,t)})},cors:function(t){if(s){var e=$.parse(location.href),n=$.parse(t.getUrl());n.protocol===e.protocol&&n.host===e.host||(t.crossOrigin=!0,t.emulateHTTP=!1,R||(t.client=U))}}},M.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(n){M[n]=function(t,e){return this(w(e||{},{url:t,method:n}))}}),["post","put","patch"].forEach(function(o){M[o]=function(t,e,n){return this(w(n||{},{url:t,method:o,body:e}))}}),N.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(D),D});
\ No newline at end of file