2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00
Files
axios/dist/axios.min.js
T
2015-10-29 12:51:37 +05:30

9 lines
14 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.axios=e():t.axios=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function r(t){this.defaultConfig=s.merge({headers:{},timeout:i.timeout,transformRequest:i.transformRequest,transformResponse:i.transformResponse},t),this.interceptors={request:new a,response:new a}}function o(t,e){return function(){return t.apply(e,Array.prototype.slice.call(arguments))}}var i=n(2),s=n(3),u=n(4),a=n(11);n(12).polyfill(),r.prototype.request=function(t){"string"==typeof t&&(t=s.merge({url:arguments[0]},arguments[1])),t=s.merge(this.defaultConfig,{method:"get"},t),t.withCredentials=t.withCredentials||i.withCredentials;var e=[u,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n};var c=new r,f=t.exports=o(r.prototype.request,c);f.create=function(t){return new r(t)},f.defaults=i,f.all=function(t){return Promise.all(t)},f.spread=n(16),f.interceptors=c.interceptors,function(){function t(){s.forEach(arguments,function(t){r.prototype[t]=function(e,n){return this.request(s.merge(n||{},{method:t,url:e}))},f[t]=o(r.prototype[t],c)})}function e(){s.forEach(arguments,function(t){r.prototype[t]=function(e,n,r){return this.request(s.merge(r||{},{method:t,url:e,data:n}))},f[t]=o(r.prototype[t],c)})}t("delete","get","head"),e("post","put","patch")}()},function(t,e,n){"use strict";var r=n(3),o=/^\)\]\}',?\n/,i={"Content-Type":"application/x-www-form-urlencoded"};t.exports={transformRequest:[function(t,e){return r.isFormData(t)?t:r.isArrayBuffer(t)?t:r.isArrayBufferView(t)?t.buffer:!r.isObject(t)||r.isFile(t)||r.isBlob(t)?t:(r.isUndefined(e)||(r.forEach(e,function(t,n){"content-type"===n.toLowerCase()&&(e["Content-Type"]=t)}),r.isUndefined(e["Content-Type"])&&(e["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(t))}],transformResponse:[function(t){if("string"==typeof t){t=t.replace(o,"");try{t=JSON.parse(t)}catch(e){}}return t}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(i),post:r.merge(i),put:r.merge(i)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(t,e){"use strict";function n(t){return"[object Array]"===g.call(t)}function r(t){return"[object ArrayBuffer]"===g.call(t)}function o(t){return"[object FormData]"===g.call(t)}function i(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function s(t){return"string"==typeof t}function u(t){return"number"==typeof t}function a(t){return"undefined"==typeof t}function c(t){return null!==t&&"object"==typeof t}function f(t){return"[object Date]"===g.call(t)}function l(t){return"[object File]"===g.call(t)}function p(t){return"[object Blob]"===g.call(t)}function h(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function d(t){return"[object Arguments]"===g.call(t)}function m(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(t,e){if(null!==t&&"undefined"!=typeof t){var r=n(t)||d(t);if("object"==typeof t||r||(t=[t]),r)for(var o=0,i=t.length;i>o;o++)e.call(null,t[o],o,t);else for(var s in t)t.hasOwnProperty(s)&&e.call(null,t[s],s,t)}}function v(){var t={};return y(arguments,function(e){y(e,function(e,n){t[n]=e})}),t}var g=Object.prototype.toString;t.exports={isArray:n,isArrayBuffer:r,isFormData:o,isArrayBufferView:i,isString:s,isNumber:u,isObject:c,isUndefined:a,isDate:f,isFile:l,isBlob:p,isStandardBrowserEnv:m,forEach:y,merge:v,trim:h}},function(t,e,n){"use strict";t.exports=function(t){return new Promise(function(e,r){try{"undefined"!=typeof XMLHttpRequest||"undefined"!=typeof ActiveXObject?n(5)(e,r,t):"undefined"!=typeof process&&n(5)(e,r,t)}catch(o){r(o)}})}},function(t,e,n){"use strict";var r=n(2),o=n(3),i=n(6),s=n(7),u=n(8);t.exports=function(t,e,a){var c=u(a.data,a.headers,a.transformRequest),f=o.merge(r.headers.common,r.headers[a.method]||{},a.headers||{});o.isFormData(c)&&delete f["Content-Type"];var l=XMLHttpRequest||ActiveXObject,p="onreadystatechange",h=!1;a.xDomain&&window&&window.XDomainRequest&&(l=window.XDomainRequest,p="onload",h=!0);var d=new l("Microsoft.XMLHTTP");if(d.open(a.method.toUpperCase(),i(a.url,a.params,a.paramsSerializer),!0),d.timeout=a.timeout,d[p]=function(){if(d&&(4===d.readyState||h)){var n=h?null:s(d.getAllResponseHeaders()),r=-1!==["text",""].indexOf(a.responseType||"")?d.responseText:d.response,o={data:u(r,n,a.transformResponse),status:d.status,statusText:d.statusText,headers:n,config:a};(d.status>=200&&d.status<300||d.responseText&&h?t:e)(o),d=null}},o.isStandardBrowserEnv()){var m=n(9),y=n(10),v=y(a.url)?m.read(a.xsrfCookieName||r.xsrfCookieName):void 0;v&&(f[a.xsrfHeaderName||r.xsrfHeaderName]=v)}if(h||o.forEach(f,function(t,e){c||"content-type"!==e.toLowerCase()?d.setRequestHeader(e,t):delete f[e]}),a.withCredentials&&(d.withCredentials=!0),a.responseType)try{d.responseType=a.responseType}catch(g){if("json"!==d.responseType)throw g}o.isArrayBuffer(c)&&(c=new DataView(c)),d.send(c)}},function(t,e,n){"use strict";function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(3);t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else{var s=[];o.forEach(e,function(t,e){null!==t&&"undefined"!=typeof t&&(o.isArray(t)&&(e+="[]"),o.isArray(t)||(t=[t]),o.forEach(t,function(t){o.isDate(t)?t=t.toISOString():o.isObject(t)&&(t=JSON.stringify(t)),s.push(r(e)+"="+r(t))}))}),i=s.join("&")}return i&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t){var e,n,o,i={};return t?(r.forEach(t.split("\n"),function(t){o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e&&(i[e]=i[e]?i[e]+", "+n:n)}),i):i}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";var r=n(3);t.exports={write:function(t,e,n,o,i,s){var u=[];u.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}},function(t,e,n){"use strict";function r(t){var e=t;return s&&(u.setAttribute("href",e),e=u.href),u.setAttribute("href",e),{href:u.href,protocol:u.protocol?u.protocol.replace(/:$/,""):"",host:u.host,search:u.search?u.search.replace(/^\?/,""):"",hash:u.hash?u.hash.replace(/^#/,""):"",hostname:u.hostname,port:u.port,pathname:"/"===u.pathname.charAt(0)?u.pathname:"/"+u.pathname}}var o,i=n(3),s=/(msie|trident)/i.test(navigator.userAgent),u=document.createElement("a");o=r(window.location.href),t.exports=function(t){var e=i.isString(t)?r(t):t;return e.protocol===o.protocol&&e.host===o.host}},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){o.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},function(t,e,n){var r;(function(t,o){/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.0.2
*/
(function(){"use strict";function i(t){return"function"==typeof t||"object"==typeof t&&null!==t}function s(t){return"function"==typeof t}function u(t){return"object"==typeof t&&null!==t}function a(t){K=t}function c(t){G=t}function f(){return function(){process.nextTick(m)}}function l(){return function(){J(m)}}function p(){var t=0,e=new Z(m),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function h(){var t=new MessageChannel;return t.port1.onmessage=m,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(m,1)}}function m(){for(var t=0;z>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}z=0}function y(){try{var t=n(14);return J=t.runOnLoop||t.runOnContext,l()}catch(e){return d()}}function v(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function w(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return st.error=e,st}}function b(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function x(t,e,n){G(function(t){var r=!1,o=b(n,e,function(n){r||(r=!0,e!==n?E(t,n):S(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,T(t,o))},t)}function A(t,e){e._state===ot?S(t,e._result):e._state===it?T(t,e._result):O(e,void 0,function(e){E(t,e)},function(e){T(t,e)})}function j(t,e){if(e.constructor===t.constructor)A(t,e);else{var n=_(e);n===st?T(t,st.error):void 0===n?S(t,e):s(n)?x(t,e,n):S(t,e)}}function E(t,e){t===e?T(t,g()):i(e)?j(t,e):S(t,e)}function C(t){t._onerror&&t._onerror(t._result),R(t)}function S(t,e){t._state===rt&&(t._result=e,t._state=ot,0!==t._subscribers.length&&G(R,t))}function T(t,e){t._state===rt&&(t._state=it,t._result=e,G(C,t))}function O(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+ot]=n,o[i+it]=r,0===i&&t._state&&G(R,t)}function R(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?D(n,r,o,i):o(i);t._subscribers.length=0}}function B(){this.error=null}function q(t,e){try{return t(e)}catch(n){return ut.error=n,ut}}function D(t,e,n,r){var o,i,u,a,c=s(n);if(c){if(o=q(n,r),o===ut?(a=!0,i=o.error,o=null):u=!0,e===o)return void T(e,w())}else o=r,u=!0;e._state!==rt||(c&&u?E(e,o):a?T(e,i):t===ot?S(e,o):t===it&&T(e,o))}function N(t,e){try{e(function(e){E(t,e)},function(e){T(t,e)})}catch(n){T(t,n)}}function P(t,e){var n=this;n._instanceConstructor=t,n.promise=new t(v),n._validateInput(e)?(n._input=e,n.length=e.length,n._remaining=e.length,n._init(),0===n.length?S(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&S(n.promise,n._result))):T(n.promise,n._validationError())}function F(t){return new at(this,t).promise}function M(t){function e(t){E(o,t)}function n(t){T(o,t)}var r=this,o=new r(v);if(!$(t))return T(o,new TypeError("You must pass an array to race.")),o;for(var i=t.length,s=0;o._state===rt&&i>s;s++)O(r.resolve(t[s]),void 0,e,n);return o}function k(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(v);return E(n,t),n}function X(t){var e=this,n=new e(v);return T(n,t),n}function H(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function U(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(t){this._id=ht++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==t&&(s(t)||H(),this instanceof L||U(),N(this,t))}function I(){var e;if("undefined"!=typeof t)e=t;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(n){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=dt)}var V;V=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var J,K,Y,$=V,z=0,G=({}.toString,function(t,e){nt[z]=t,nt[z+1]=e,z+=2,2===z&&(K?K(m):Y())}),W="undefined"!=typeof window?window:void 0,Q=W||{},Z=Q.MutationObserver||Q.WebKitMutationObserver,tt="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);Y=tt?f():Z?p():et?h():void 0===W?y():d();var rt=void 0,ot=1,it=2,st=new B,ut=new B;P.prototype._validateInput=function(t){return $(t)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var at=P;P.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,o=0;n._state===rt&&e>o;o++)t._eachEntry(r[o],o)},P.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;u(t)?t.constructor===r&&t._state!==rt?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},P.prototype._settledAt=function(t,e,n){var r=this,o=r.promise;o._state===rt&&(r._remaining--,t===it?T(o,n):r._result[e]=n),0===r._remaining&&S(o,r._result)},P.prototype._willSettleAt=function(t,e){var n=this;O(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(it,e,t)})};var ct=F,ft=M,lt=k,pt=X,ht=0,dt=L;L.all=ct,L.race=ft,L.resolve=lt,L.reject=pt,L._setScheduler=a,L._setAsap=c,L._asap=G,L.prototype={constructor:L,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===it&&!e)return this;var o=new this.constructor(v),i=n._result;if(r){var s=arguments[r-1];G(function(){D(r,o,s,i)})}else O(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var mt=I,yt={Promise:dt,polyfill:mt};n(15).amd?(r=function(){return yt}.call(e,n,e,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=yt:"undefined"!=typeof this&&(this.ES6Promise=yt),mt()}).call(this)}).call(e,function(){return this}(),n(13)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){},function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},function(t,e){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}}])});
//# sourceMappingURL=axios.min.map