You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
15 KiB
JavaScript

/*!
* vue-resource v1.3.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=D,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&&z&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return X(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 p(t){return f(t)&&Object.getPrototypeOf(t)==Object.prototype}function h(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(Y(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(f(t))for(o in t)G.call(t,o)&&e.call(t[o],t[o],o);return t}function v(t){return _.call(arguments,1).forEach(function(e){w(t,e,!0)}),t}function b(t){return _.call(arguments,1).forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function g(t){return _.call(arguments,1).forEach(function(e){w(t,e)}),t}function w(t,e,n){for(var o in e)n&&(p(e[o])||Y(e[o]))?(p(e[o])&&!p(t[o])&&(t[o]={}),Y(e[o])&&!Y(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(-1!==e.indexOf(r.charAt(0))&&(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){a(t)&&(t=$.transform[t]),c(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=Y(e),i=p(e);y(e,function(e,u){o=f(e)||Y(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){e((t.client||(K?ht:dt))(t))}function k(t,e){return Object.keys(t).reduce(function(t,n){return u(e)===u(n)?n:t},null)}function I