@commercetools/sdk-middleware-http
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -53,3 +53,3 @@ 'use strict'; | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -60,3 +60,3 @@ }); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -63,0 +63,0 @@ }); |
@@ -49,3 +49,3 @@ function _typeof(obj) { | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -56,3 +56,3 @@ }); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -59,0 +59,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).CommercetoolsSdkMiddlewareHttp={})}(this,function(t){"use strict";var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function l(){c=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)s[r]=t[r],f[t.charCodeAt(r)]=r;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function p(t,r,e){for(var n,o,i=[],u=r;u<e;u+=3)n=(t[u]<<16)+(t[u+1]<<8)+t[u+2],i.push(s[(o=n)>>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}function n(t){var r;c||l();for(var e=t.length,n=e%3,o="",i=[],u=0,a=e-n;u<a;u+=16383)i.push(p(t,u,a<u+16383?a:u+16383));return 1==n?(r=t[e-1],o+=s[r>>2],o+=s[r<<4&63],o+="=="):2==n&&(r=(t[e-2]<<8)+t[e-1],o+=s[r>>10],o+=s[r>>4&63],o+=s[r<<2&63],o+="="),i.push(o),i.join("")}function e(t,r,e,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,f=s>>1,h=-7,c=e?o-1:0,l=e?-1:1,p=t[r+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=a;0<h;i=256*i+t[r+c],c+=l,h-=8);for(u=i&(1<<-h)-1,i>>=-h,h+=n;0<h;u=256*u+t[r+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===s)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=f}return(p?-1:1)*u*Math.pow(2,i-n)}function i(t,r,e,n,o,i){var u,a,s,f=8*i-o-1,h=(1<<f)-1,c=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=h):(u=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(r+=1<=u+c?l/s:l*Math.pow(2,1-c))*s&&(u++,s/=2),h<=u+c?(a=0,u=h):1<=u+c?(a=(r*s-1)*Math.pow(2,o),u+=c):(a=r*Math.pow(2,c-1)*Math.pow(2,o),u=0));8<=o;t[e+p]=255&a,p+=g,a/=256,o-=8);for(u=u<<o|a,f+=o;0<f;t[e+p]=255&u,p+=g,u/=256,f-=8);t[e+p-g]|=128*y}var o={}.toString,u=Array.isArray||function(t){return"[object Array]"==o.call(t)};function a(){return A.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(a()<r)throw new RangeError("Invalid typed array length");return A.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=A.prototype:(null===t&&(t=new A(r)),t.length=r),t}function A(t,r,e){if(!(A.TYPED_ARRAY_SUPPORT||this instanceof A))return new A(t,r,e);if("number"!=typeof t)return y(this,t,r,e);if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return w(this,t)}function y(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);A.TYPED_ARRAY_SUPPORT?(t=r).__proto__=A.prototype:t=v(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!A.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),o=(t=g(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(E(r)){var e=0|b(r.length);return 0===(t=g(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function(t){return t!=t}(r.length)?g(t,0):v(t,r);if("Buffer"===r.type&&u(r.data))return v(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function d(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function w(t,r){if(d(r),t=g(t,r<0?0:0|b(r)),!A.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function v(t,r){var e=r.length<0?0:0|b(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function b(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function E(t){return!(null==t||!t._isBuffer)}function m(t,r){if(E(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return Z(t).length;default:if(n)return V(t).length;r=(""+r).toLowerCase(),n=!0}}function R(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function _(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):2147483647<e?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=A.from(r,n)),E(r))return 0===r.length?-1:P(t,r,e,n,o);if("number"==typeof r)return r&=255,A.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):P(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function P(t,r,e,n,o){var i,u=1,a=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a/=u=2,s/=2,e/=2}function f(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var h=-1;for(i=e;i<a;i++)if(f(t,i)===f(r,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===s)return h*u}else-1!==h&&(i-=i-h),h=-1}else for(a<e+s&&(e=a-s),i=e;0<=i;i--){for(var c=!0,l=0;l<s;l++)if(f(t,i+l)!==f(r,l)){c=!1;break}if(c)return i}return-1}function T(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?o<(n=Number(n))&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");i/2<n&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(r.substr(2*u,2),16);if(isNaN(a))return u;t[e+u]=a}return u}function S(t,r,e,n){return $(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function O(t,r,e,n){return $(function(t,r){for(var e,n,o,i=[],u=0;u<t.length&&!((r-=2)<0);++u)e=t.charCodeAt(u),n=e>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function U(t,r,e){return 0===r&&e===t.length?n(t):n(t.slice(r,e))}function B(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,u,a,s,f=t[o],h=null,c=239<f?4:223<f?3:191<f?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&127<(s=(31&f)<<6|63&i)&&(h=s);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&2047<(s=(15&f)<<12|(63&i)<<6|63&u)&&(s<55296||57343<s)&&(h=s);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&65535<(s=(15&f)<<18|(63&i)<<12|(63&u)<<6|63&a)&&s<1114112&&(h=s)}null===h?(h=65533,c=1):65535<h&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=C)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=C));return e}(n)}A.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT,A.poolSize=8192,A._augment=function(t){return t.__proto__=A.prototype,t},A.from=function(t,r,e){return y(null,t,r,e)},A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array),A.alloc=function(t,r,e){return function(t,r,e,n){return d(r),r<=0?g(t,r):void 0!==e?"string"==typeof n?g(t,r).fill(e,n):g(t,r).fill(e):g(t,r)}(null,t,r,e)},A.allocUnsafe=function(t){return w(null,t)},A.allocUnsafeSlow=function(t){return w(null,t)},A.isBuffer=G,A.compare=function(t,r){if(!E(t)||!E(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},A.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},A.concat=function(t,r){if(!u(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return A.alloc(0);var e;if(void 0===r)for(e=r=0;e<t.length;++e)r+=t[e].length;var n=A.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!E(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},A.byteLength=m,A.prototype._isBuffer=!0,A.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)R(this,r,r+1);return this},A.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)R(this,r,r+3),R(this,r+1,r+2);return this},A.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)R(this,r,r+7),R(this,r+1,r+6),R(this,r+2,r+5),R(this,r+3,r+4);return this},A.prototype.toString=function(){var t=0|this.length;return 0==t?"":0===arguments.length?B(this,0,t):function(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":return M(this,r,e);case"utf8":case"utf-8":return B(this,r,e);case"ascii":return Y(this,r,e);case"latin1":case"binary":return I(this,r,e);case"base64":return U(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},A.prototype.equals=function(t){if(!E(t))throw new TypeError("Argument must be a Buffer");return this===t||0===A.compare(this,t)},A.prototype.inspect=function(){var t="";return 0<this.length&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(t+=" ... ")),"<Buffer "+t+">"},A.prototype.compare=function(t,r,e,n,o){if(!E(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&e<=r)return 0;if(o<=n)return-1;if(e<=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(i,u),s=this.slice(n,o),f=t.slice(r,e),h=0;h<a;++h)if(s[h]!==f[h]){i=s[h],u=f[h];break}return i<u?-1:u<i?1:0},A.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},A.prototype.indexOf=function(t,r,e){return _(this,t,r,e,!0)},A.prototype.lastIndexOf=function(t,r,e){return _(this,t,r,e,!1)},A.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||o<e)&&(e=o),0<t.length&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,u,a,s,f,h,c=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return f=r,h=e,$(V(t,(s=this).length-f),s,f,h);case"ascii":return S(this,t,r,e);case"latin1":case"binary":return S(this,t,r,e);case"base64":return i=this,u=r,a=e,$(Z(t),i,u,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r,e);default:if(c)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}},A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function Y(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function I(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function M(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||n<e)&&(e=n);for(var o="",i=r;i<e;++i)o+=J(t[i]);return o}function D(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function L(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(e<t+r)throw new RangeError("Trying to access beyond buffer length")}function x(t,r,e,n,o,i){if(!E(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<r||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function j(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function k(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function N(t,r,e,n){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function z(t,r,e,n,o){return o||N(t,0,e,4),i(t,r,e,n,23,4),e+4}function q(t,r,e,n,o){return o||N(t,0,e,8),i(t,r,e,n,52,8),e+8}A.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):n<r&&(r=n),r<t&&(r=t),A.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=A.prototype;else{var o=r-t;e=new A(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},A.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},A.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t+--r],o=1;0<r&&(o*=256);)n+=this[t+--r]*o;return n},A.prototype.readUInt8=function(t,r){return r||L(t,1,this.length),this[t]},A.prototype.readUInt16LE=function(t,r){return r||L(t,2,this.length),this[t]|this[t+1]<<8},A.prototype.readUInt16BE=function(t,r){return r||L(t,2,this.length),this[t]<<8|this[t+1]},A.prototype.readUInt32LE=function(t,r){return r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},A.prototype.readUInt32BE=function(t,r){return r||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},A.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return(o*=128)<=n&&(n-=Math.pow(2,8*r)),n},A.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=r,o=1,i=this[t+--n];0<n&&(o*=256);)i+=this[t+--n]*o;return(o*=128)<=i&&(i-=Math.pow(2,8*r)),i},A.prototype.readInt8=function(t,r){return r||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},A.prototype.readInt16LE=function(t,r){r||L(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},A.prototype.readInt16BE=function(t,r){r||L(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},A.prototype.readInt32LE=function(t,r){return r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},A.prototype.readInt32BE=function(t,r){return r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},A.prototype.readFloatLE=function(t,r){return r||L(t,4,this.length),e(this,t,!0,23,4)},A.prototype.readFloatBE=function(t,r){return r||L(t,4,this.length),e(this,t,!1,23,4)},A.prototype.readDoubleLE=function(t,r){return r||L(t,8,this.length),e(this,t,!0,52,8)},A.prototype.readDoubleBE=function(t,r){return r||L(t,8,this.length),e(this,t,!1,52,8)},A.prototype.writeUIntLE=function(t,r,e,n){t=+t,r|=0,e|=0,n||x(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},A.prototype.writeUIntBE=function(t,r,e,n){t=+t,r|=0,e|=0,n||x(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;0<=--o&&(i*=256);)this[r+o]=t/i&255;return r+e},A.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,1,255,0),A.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},A.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):j(this,t,r,!0),r+2},A.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):j(this,t,r,!1),r+2},A.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):k(this,t,r,!0),r+4},A.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},A.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i<e&&(u*=256);)t<0&&0===a&&0!==this[r+i-1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},A.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=e-1,u=1,a=0;for(this[r+i]=255&t;0<=--i&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},A.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,1,127,-128),A.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},A.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):j(this,t,r,!0),r+2},A.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):j(this,t,r,!1),r+2},A.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,2147483647,-2147483648),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):k(this,t,r,!0),r+4},A.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},A.prototype.writeFloatLE=function(t,r,e){return z(this,t,r,!0,e)},A.prototype.writeFloatBE=function(t,r,e){return z(this,t,r,!1,e)},A.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},A.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},A.prototype.copy=function(t,r,e,n){if(e=e||0,n||0===n||(n=this.length),r>=t.length&&(r=t.length),r=r||0,0<n&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;0<=o;--o)t[o+r]=this[o+e];else if(i<1e3||!A.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},A.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!A.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,"number"==typeof(t=t||0))for(i=r;i<e;++i)this[i]=t;else{var u=E(t)?t:V(new A(t,n).toString()),a=u.length;for(i=0;i<e-r;++i)this[i+r]=u[i%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function H(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function J(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if(55295<(e=t.charCodeAt(u))&&e<57344){if(!o){if(56319<e){-1<(r-=3)&&i.push(239,191,189);continue}if(u+1===n){-1<(r-=3)&&i.push(239,191,189);continue}o=e;continue}if(e<56320){-1<(r-=3)&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&-1<(r-=3)&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function Z(t){return function(t){var r,e,n,o,i;c||l();var u=t.length;if(0<u%4)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[u-2]?2:"="===t[u-1]?1:0,i=new h(3*u/4-o),e=0<o?u-4:u;var a=0;for(r=0;r<e;r+=4,3)n=f[t.charCodeAt(r)]<<18|f[t.charCodeAt(r+1)]<<12|f[t.charCodeAt(r+2)]<<6|f[t.charCodeAt(r+3)],i[a++]=n>>16&255,i[a++]=n>>8&255,i[a++]=255&n;return 2==o?(n=f[t.charCodeAt(r)]<<2|f[t.charCodeAt(r+1)]>>4,i[a++]=255&n):1==o&&(n=f[t.charCodeAt(r)]<<10|f[t.charCodeAt(r+1)]<<4|f[t.charCodeAt(r+2)]>>2,i[a++]=n>>8&255,i[a++]=255&n),i}(H(t))}function $(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function G(t){return null!=t&&(!!t._isBuffer||K(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&K(t.slice(0,0))}(t))}function K(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function Q(t){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function W(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),e.push.apply(e,n)}return e}function X(o){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?W(i,!0).forEach(function(t){var r,e,n;r=o,n=i[e=t],e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):W(i).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(i,t))})}return o}function tt(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],0<=r.indexOf(e)||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],0<=r.indexOf(e)||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function rt(t,r){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};this.status=this.statusCode=this.code=t,this.message=r,Object.assign(this,e),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function et(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,0].concat(r))}function nt(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this].concat(r))}function ot(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,400].concat(r))}function it(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,401].concat(r))}function ut(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,403].concat(r))}function at(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,404].concat(r))}function st(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,409].concat(r))}function ft(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,500].concat(r))}function ht(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];rt.call.apply(rt,[this,503].concat(r))}function ct(t){switch(t){case 0:return et;case 400:return ot;case 401:return it;case 403:return ut;case 404:return at;case 409:return st;case 500:return ft;case 503:return ht;default:return}}var lt=Object.freeze({__proto__:null,NetworkError:et,HttpError:nt,BadRequest:ot,Unauthorized:it,Forbidden:ut,NotFound:at,ConcurrentModification:st,InternalServerError:ft,ServiceUnavailable:ht,default:ct});function pt(t){if(t.raw)return t.raw();if(!t.forEach)return{};var e={};return t.forEach(function(t,r){e[r]=t}),e}function gt(t,r,e,n,o){return n&&0!==t?Math.min(Math.round((Math.random()+1)*r*Math.pow(2,t)),o):r}function yt(t,r){r&&(t.headers.authorization&&(t.headers.authorization=["Bearer ********"]),t.headers.Authorization&&(t.headers.Authorization=["Bearer ********"]))}t.createHttpMiddleware=function(t){var o,f,h=t.host,c=t.credentialsMode,l=t.includeResponseHeaders,p=t.includeOriginalRequest,r=t.maskSensitiveHeaderData,g=void 0===r||r,y=t.enableRetry,d=t.timeout,e=t.retryConfig,n=(e=void 0===e?{}:e).maxRetries,w=void 0===n?10:n,i=e.backoff,v=void 0===i||i,u=e.retryDelay,b=void 0===u?200:u,a=e.maxDelay,E=void 0===a?1/0:a,m=t.fetch,s=t.abortController;if(!m&&"undefined"==typeof fetch)throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(d&&!s&&"undefined"==typeof AbortController)throw new Error("`AbortController` is not available. Please pass in `AbortController` as an option or have it globally available when using timeout.");return m=m||fetch,(d||s)&&(o=s||new AbortController),d&&(f=setTimeout(function(){o.abort()},d)),function(s){return function(i,u){var t=h.replace(/\/$/,"")+i.uri,r="string"==typeof i.body||G(i.body)?i.body:JSON.stringify(i.body||void 0),e=X({"Content-Type":["application/json"]},i.headers,{},r?{"Content-Length":A.byteLength(r).toString()}:null),n=X({method:i.method,headers:e},c?{credentials:c}:{},{},d||o?{signal:o.signal}:{},{},r?{body:r}:null),a=0;!function e(){m(t,n).then(function(o){return o.ok?"HEAD"===n.method?void s(i,X({},u,{statusCode:o.status})):void o.json().then(function(t){var r=X({},u,{body:t,statusCode:o.status});l&&(r.headers=pt(o.headers)),p&&(r.request=X({},n),yt(r.request,g)),s(i,r)}):503===o.status&&y&&a<w?(setTimeout(e,gt(a,b,0,v,E)),void(a+=1)):void o.text().then(function(t){var r;try{r=JSON.parse(t)}catch(e){r=t}var e=function(t){var r=t.statusCode,e=t.message,n=tt(t,["statusCode","message"]),o=e||"Unexpected non-JSON error response";404===r&&(o="URI not found: ".concat(n.originalRequest.uri));var i=ct(r);return i?new i(o,n):new nt(r,o,n)}(X({statusCode:o.status,originalRequest:i,retryCount:a,headers:pt(o.headers)},"object"===Q(r)?{message:r.message,body:r}:{message:r,body:r}));yt(e.originalRequest,g);var n=X({},u,{error:e,statusCode:o.status});s(i,n)})},function(t){if(y&&a<w)return setTimeout(e,gt(a,b,0,v,E)),void(a+=1);var r=new et(t.message,{originalRequest:i,retryCount:a});yt(r.originalRequest,g),s(i,X({},u,{error:r,statusCode:0}))}).finally(function(){clearTimeout(f)})}()}}},t.errors=lt,t.getErrorByCode=ct,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).CommercetoolsSdkMiddlewareHttp={})}(this,function(t){"use strict";var r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},s=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,c=!1;function l(){c=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,e=t.length;r<e;++r)s[r]=t[r],f[t.charCodeAt(r)]=r;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function p(t,r,e){for(var n,o,i=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(s[(o=n)>>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}function n(t){var r;c||l();for(var e=t.length,n=e%3,o="",i=[],a=0,u=e-n;a<u;a+=16383)i.push(p(t,a,u<a+16383?u:a+16383));return 1==n?(r=t[e-1],o+=s[r>>2],o+=s[r<<4&63],o+="=="):2==n&&(r=(t[e-2]<<8)+t[e-1],o+=s[r>>10],o+=s[r>>4&63],o+=s[r<<2&63],o+="="),i.push(o),i.join("")}function e(t,r,e,n,o){var i,a,u=8*o-n-1,s=(1<<u)-1,f=s>>1,h=-7,c=e?o-1:0,l=e?-1:1,p=t[r+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=u;0<h;i=256*i+t[r+c],c+=l,h-=8);for(a=i&(1<<-h)-1,i>>=-h,h+=n;0<h;a=256*a+t[r+c],c+=l,h-=8);if(0===i)i=1-f;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=f}return(p?-1:1)*a*Math.pow(2,i-n)}function i(t,r,e,n,o,i){var a,u,s,f=8*i-o-1,h=(1<<f)-1,c=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-a))<1&&(a--,s*=2),2<=(r+=1<=a+c?l/s:l*Math.pow(2,1-c))*s&&(a++,s/=2),h<=a+c?(u=0,a=h):1<=a+c?(u=(r*s-1)*Math.pow(2,o),a+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,o),a=0));8<=o;t[e+p]=255&u,p+=g,u/=256,o-=8);for(a=a<<o|u,f+=o;0<f;t[e+p]=255&a,p+=g,a/=256,f-=8);t[e+p-g]|=128*y}var o={}.toString,a=Array.isArray||function(t){return"[object Array]"==o.call(t)};function u(){return A.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(t,r){if(u()<r)throw new RangeError("Invalid typed array length");return A.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=A.prototype:(null===t&&(t=new A(r)),t.length=r),t}function A(t,r,e){if(!(A.TYPED_ARRAY_SUPPORT||this instanceof A))return new A(t,r,e);if("number"!=typeof t)return y(this,t,r,e);if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return w(this,t)}function y(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);A.TYPED_ARRAY_SUPPORT?(t=r).__proto__=A.prototype:t=v(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!A.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(r,e),o=(t=g(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(E(r)){var e=0|b(r.length);return 0===(t=g(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||function(t){return t!=t}(r.length)?g(t,0):v(t,r);if("Buffer"===r.type&&a(r.data))return v(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function d(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function w(t,r){if(d(r),t=g(t,r<0?0:0|b(r)),!A.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function v(t,r){var e=r.length<0?0:0|b(r.length);t=g(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function b(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function E(t){return null!=t&&t._isBuffer}function m(t,r){if(E(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return V(t).length;default:if(n)return J(t).length;r=(""+r).toLowerCase(),n=!0}}function R(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function _(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):2147483647<e?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=A.from(r,n)),E(r))return 0===r.length?-1:P(t,r,e,n,o);if("number"==typeof r)return r&=255,A.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):P(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function P(t,r,e,n,o){var i,a=1,u=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u/=a=2,s/=2,e/=2}function f(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(o){var h=-1;for(i=e;i<u;i++)if(f(t,i)===f(r,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===s)return h*a}else-1!==h&&(i-=i-h),h=-1}else for(u<e+s&&(e=u-s),i=e;0<=i;i--){for(var c=!0,l=0;l<s;l++)if(f(t,i+l)!==f(r,l)){c=!1;break}if(c)return i}return-1}function T(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?o<(n=Number(n))&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");i/2<n&&(n=i/2);for(var a=0;a<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function O(t,r,e,n){return Z(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function S(t,r,e,n){return Z(function(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)e=t.charCodeAt(a),n=e>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function U(t,r,e){return 0===r&&e===t.length?n(t):n(t.slice(r,e))}function B(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,a,u,s,f=t[o],h=null,c=239<f?4:223<f?3:191<f?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&127<(s=(31&f)<<6|63&i)&&(h=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&2047<(s=(15&f)<<12|(63&i)<<6|63&a)&&(s<55296||57343<s)&&(h=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&65535<(s=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&u)&&s<1114112&&(h=s)}null===h?(h=65533,c=1):65535<h&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=C)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=C));return e}(n)}A.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT,A.poolSize=8192,A._augment=function(t){return t.__proto__=A.prototype,t},A.from=function(t,r,e){return y(null,t,r,e)},A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array),A.alloc=function(t,r,e){return n=null,i=r,a=e,d(o=t),o<=0?g(n,o):void 0!==i?"string"==typeof a?g(n,o).fill(i,a):g(n,o).fill(i):g(n,o);var n,o,i,a},A.allocUnsafe=function(t){return w(null,t)},A.allocUnsafeSlow=function(t){return w(null,t)},A.isBuffer=$,A.compare=function(t,r){if(!E(t)||!E(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},A.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},A.concat=function(t,r){if(!a(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return A.alloc(0);var e;if(void 0===r)for(e=r=0;e<t.length;++e)r+=t[e].length;var n=A.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!E(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},A.byteLength=m,A.prototype._isBuffer=!0,A.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)R(this,r,r+1);return this},A.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)R(this,r,r+3),R(this,r+1,r+2);return this},A.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)R(this,r,r+7),R(this,r+1,r+6),R(this,r+2,r+5),R(this,r+3,r+4);return this},A.prototype.toString=function(){var t=0|this.length;return 0==t?"":0===arguments.length?B(this,0,t):function(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":return M(this,r,e);case"utf8":case"utf-8":return B(this,r,e);case"ascii":return Y(this,r,e);case"latin1":case"binary":return I(this,r,e);case"base64":return U(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},A.prototype.equals=function(t){if(!E(t))throw new TypeError("Argument must be a Buffer");return this===t||0===A.compare(this,t)},A.prototype.inspect=function(){var t="";return 0<this.length&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length&&(t+=" ... ")),"<Buffer "+t+">"},A.prototype.compare=function(t,r,e,n,o){if(!E(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&e<=r)return 0;if(o<=n)return-1;if(e<=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(i,a),s=this.slice(n,o),f=t.slice(r,e),h=0;h<u;++h)if(s[h]!==f[h]){i=s[h],a=f[h];break}return i<a?-1:a<i?1:0},A.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},A.prototype.indexOf=function(t,r,e){return _(this,t,r,e,!0)},A.prototype.lastIndexOf=function(t,r,e){return _(this,t,r,e,!1)},A.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||o<e)&&(e=o),0<t.length&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,a,u,s,f,h,c=!1;;)switch(n){case"hex":return T(this,t,r,e);case"utf8":case"utf-8":return f=r,h=e,Z(J(t,(s=this).length-f),s,f,h);case"ascii":return O(this,t,r,e);case"latin1":case"binary":return O(this,t,r,e);case"base64":return i=this,a=r,u=e,Z(V(t),i,a,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r,e);default:if(c)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}},A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function Y(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function I(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function M(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||n<e)&&(e=n);for(var o="",i=r;i<e;++i)o+=H(t[i]);return o}function D(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function L(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(e<t+r)throw new RangeError("Trying to access beyond buffer length")}function j(t,r,e,n,o,i){if(!E(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<r||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function x(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function k(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function N(t,r,e,n){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function z(t,r,e,n,o){return o||N(t,0,e,4),i(t,r,e,n,23,4),e+4}function q(t,r,e,n,o){return o||N(t,0,e,8),i(t,r,e,n,52,8),e+8}A.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):n<r&&(r=n),r<t&&(r=t),A.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=A.prototype;else{var o=r-t;e=new A(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},A.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},A.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t+--r],o=1;0<r&&(o*=256);)n+=this[t+--r]*o;return n},A.prototype.readUInt8=function(t,r){return r||L(t,1,this.length),this[t]},A.prototype.readUInt16LE=function(t,r){return r||L(t,2,this.length),this[t]|this[t+1]<<8},A.prototype.readUInt16BE=function(t,r){return r||L(t,2,this.length),this[t]<<8|this[t+1]},A.prototype.readUInt32LE=function(t,r){return r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},A.prototype.readUInt32BE=function(t,r){return r||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},A.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return(o*=128)<=n&&(n-=Math.pow(2,8*r)),n},A.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||L(t,r,this.length);for(var n=r,o=1,i=this[t+--n];0<n&&(o*=256);)i+=this[t+--n]*o;return(o*=128)<=i&&(i-=Math.pow(2,8*r)),i},A.prototype.readInt8=function(t,r){return r||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},A.prototype.readInt16LE=function(t,r){r||L(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},A.prototype.readInt16BE=function(t,r){r||L(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},A.prototype.readInt32LE=function(t,r){return r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},A.prototype.readInt32BE=function(t,r){return r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},A.prototype.readFloatLE=function(t,r){return r||L(t,4,this.length),e(this,t,!0,23,4)},A.prototype.readFloatBE=function(t,r){return r||L(t,4,this.length),e(this,t,!1,23,4)},A.prototype.readDoubleLE=function(t,r){return r||L(t,8,this.length),e(this,t,!0,52,8)},A.prototype.readDoubleBE=function(t,r){return r||L(t,8,this.length),e(this,t,!1,52,8)},A.prototype.writeUIntLE=function(t,r,e,n){t=+t,r|=0,e|=0,n||j(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},A.prototype.writeUIntBE=function(t,r,e,n){t=+t,r|=0,e|=0,n||j(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;0<=--o&&(i*=256);)this[r+o]=t/i&255;return r+e},A.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,255,0),A.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},A.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):x(this,t,r,!0),r+2},A.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):x(this,t,r,!1),r+2},A.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):k(this,t,r,!0),r+4},A.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},A.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);j(this,t,r,e,o-1,-o)}var i=0,a=1,u=0;for(this[r]=255&t;++i<e&&(a*=256);)t<0&&0===u&&0!==this[r+i-1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},A.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);j(this,t,r,e,o-1,-o)}var i=e-1,a=1,u=0;for(this[r+i]=255&t;0<=--i&&(a*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},A.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,1,127,-128),A.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},A.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):x(this,t,r,!0),r+2},A.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):x(this,t,r,!1),r+2},A.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),A.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):k(this,t,r,!0),r+4},A.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||j(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),A.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},A.prototype.writeFloatLE=function(t,r,e){return z(this,t,r,!0,e)},A.prototype.writeFloatBE=function(t,r,e){return z(this,t,r,!1,e)},A.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},A.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},A.prototype.copy=function(t,r,e,n){if(e=e||0,n||0===n||(n=this.length),r>=t.length&&(r=t.length),r=r||0,0<n&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;0<=o;--o)t[o+r]=this[o+e];else if(i<1e3||!A.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},A.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!A.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,"number"==typeof(t=t||0))for(i=r;i<e;++i)this[i]=t;else{var a=E(t)?t:J(new A(t,n).toString()),u=a.length;for(i=0;i<e-r;++i)this[i+r]=a[i%u]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if(55295<(e=t.charCodeAt(a))&&e<57344){if(!o){if(56319<e){-1<(r-=3)&&i.push(239,191,189);continue}if(a+1===n){-1<(r-=3)&&i.push(239,191,189);continue}o=e;continue}if(e<56320){-1<(r-=3)&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&-1<(r-=3)&&i.push(239,191,189);if(o=null,e<128){if(--r<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function V(t){return function(t){var r,e,n,o,i;c||l();var a=t.length;if(0<a%4)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,i=new h(3*a/4-o),e=0<o?a-4:a;var u=0;for(r=0;r<e;r+=4,0)n=f[t.charCodeAt(r)]<<18|f[t.charCodeAt(r+1)]<<12|f[t.charCodeAt(r+2)]<<6|f[t.charCodeAt(r+3)],i[u++]=n>>16&255,i[u++]=n>>8&255,i[u++]=255&n;return 2==o?(n=f[t.charCodeAt(r)]<<2|f[t.charCodeAt(r+1)]>>4,i[u++]=255&n):1==o&&(n=f[t.charCodeAt(r)]<<10|f[t.charCodeAt(r+1)]<<4|f[t.charCodeAt(r+2)]>>2,i[u++]=n>>8&255,i[u++]=255&n),i}(function(t){var r;if((t=((r=t).trim?r.trim():r.replace(/^\s+|\s+$/g,"")).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Z(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function $(t){return null!=t&&(!!t._isBuffer||G(t)||"function"==typeof(r=t).readFloatLE&&"function"==typeof r.slice&&G(r.slice(0,0)));var r}function G(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function K(t){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Q(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),e.push.apply(e,n)}return e}function W(o){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(i),!0).forEach(function(t){var r,e,n;r=o,n=i[e=t],e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):Q(Object(i)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(i,t))})}return o}function X(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],0<=r.indexOf(e)||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],0<=r.indexOf(e)||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function tt(t,r){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};this.status=this.statusCode=this.code=t,this.message=r,Object.assign(this,e),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function rt(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,0].concat(r))}function et(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this].concat(r))}function nt(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,400].concat(r))}function ot(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,401].concat(r))}function it(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,403].concat(r))}function at(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,404].concat(r))}function ut(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,409].concat(r))}function st(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,500].concat(r))}function ft(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];tt.call.apply(tt,[this,503].concat(r))}function ht(t){switch(t){case 0:return rt;case 400:return nt;case 401:return ot;case 403:return it;case 404:return at;case 409:return ut;case 500:return st;case 503:return ft;default:return}}var ct=Object.freeze({__proto__:null,NetworkError:rt,HttpError:et,BadRequest:nt,Unauthorized:ot,Forbidden:it,NotFound:at,ConcurrentModification:ut,InternalServerError:st,ServiceUnavailable:ft,default:ht});function lt(t){if(t.raw)return t.raw();if(!t.forEach)return{};var e={};return t.forEach(function(t,r){e[r]=t}),e}function pt(t,r,e,n,o){return n&&0!==t?Math.min(Math.round((Math.random()+1)*r*Math.pow(2,t)),o):r}function gt(t,r){r&&(t.headers.authorization&&(t.headers.authorization=["Bearer ********"]),t.headers.Authorization&&(t.headers.Authorization=["Bearer ********"]))}t.createHttpMiddleware=function(t){var o,f,h=t.host,c=t.credentialsMode,l=t.includeResponseHeaders,p=t.includeOriginalRequest,r=t.maskSensitiveHeaderData,g=void 0===r||r,y=t.enableRetry,d=t.timeout,e=t.retryConfig,n=(e=void 0===e?{}:e).maxRetries,w=void 0===n?10:n,i=e.backoff,v=void 0===i||i,a=e.retryDelay,b=void 0===a?200:a,u=e.maxDelay,E=void 0===u?1/0:u,m=t.fetch,s=t.abortController;if(!m&&"undefined"==typeof fetch)throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(d&&!s&&"undefined"==typeof AbortController)throw new Error("`AbortController` is not available. Please pass in `AbortController` as an option or have it globally available when using timeout.");return m=m||fetch,(d||s)&&(o=s||new AbortController),d&&(f=setTimeout(function(){o.abort()},d)),function(s){return function(i,a){var t=h.replace(/\/$/,"")+i.uri,r="string"==typeof i.body||$(i.body)?i.body:JSON.stringify(i.body||void 0),e=W({"Content-Type":["application/json"]},i.headers,{},r?{"Content-Length":A.byteLength(r).toString()}:null),n=W({method:i.method,headers:e},c?{credentials:c}:{},{},d||o?{signal:o.signal}:{},{},r?{body:r}:null),u=0;!function e(){m(t,n).then(function(o){return o.ok?"HEAD"===n.method?void s(i,W({},a,{statusCode:o.status})):void o.json().then(function(t){var r=W({},a,{body:t,statusCode:o.status});l&&(r.headers=lt(o.headers)),p&&(r.request=W({},n),gt(r.request,g)),s(i,r)}):503===o.status&&y&&u<w?(setTimeout(e,pt(u,b,0,v,E)),void(u+=1)):void o.text().then(function(t){var r;try{r=JSON.parse(t)}catch(e){r=t}var e=function(t){var r=t.statusCode,e=t.message,n=X(t,["statusCode","message"]),o=e||"Unexpected non-JSON error response";404===r&&(o="URI not found: ".concat(n.originalRequest.uri));var i=ht(r);return i?new i(o,n):new et(r,o,n)}(W({statusCode:o.status,originalRequest:i,retryCount:u,headers:lt(o.headers)},"object"===K(r)?{message:r.message,body:r}:{message:r,body:r}));gt(e.originalRequest,g);var n=W({},a,{error:e,statusCode:o.status});s(i,n)})},function(t){if(y&&u<w)return setTimeout(e,pt(u,b,0,v,E)),void(u+=1);var r=new rt(t.message,{originalRequest:i,retryCount:u});gt(r.originalRequest,g),s(i,W({},a,{error:r,statusCode:0}))}).finally(function(){clearTimeout(f)})}()}}},t.errors=ct,t.getErrorByCode=ht,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -7,3 +7,3 @@ { | ||
"name": "@commercetools/sdk-middleware-http", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": "Middleware for http requests, to use with @commercetools/sdk-client", | ||
@@ -37,6 +37,6 @@ "keywords": [ | ||
"abort-controller": "3.0.0", | ||
"nock": "11.7.0", | ||
"nock": "11.7.1", | ||
"node-fetch": "2.6.0" | ||
}, | ||
"gitHead": "65bfeae2388ad3e062c9da4c1f1925478efc3d50" | ||
"gitHead": "68b36bf3c81ea502a406073d3ce861b046088e83" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149658
9