UNPKG

simple-fxtrade

Version:

A node js wrapper for the Oanda Rest v20 api to make things really simple

7 lines 49 kB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=32)}([function(t,e,n){"use strict";function r(t){return"[object Array]"===_.call(t)}function o(t){return"[object ArrayBuffer]"===_.call(t)}function s(t){return"undefined"!=typeof FormData&&t instanceof FormData}function i(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function u(t){return"string"==typeof t}function c(t){return"number"==typeof t}function a(t){return void 0===t}function f(t){return null!==t&&"object"===(void 0===t?"undefined":j(t))}function p(t){return"[object Date]"===_.call(t)}function l(t){return"[object File]"===_.call(t)}function d(t){return"[object Blob]"===_.call(t)}function h(t){return"[object Function]"===_.call(t)}function m(t){return f(t)&&h(t.pipe)}function y(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function v(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function b(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function g(t,e){if(null!==t&&void 0!==t)if("object"===(void 0===t?"undefined":j(t))||r(t)||(t=[t]),r(t))for(var n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function x(){function t(t,n){"object"===j(e[n])&&"object"===(void 0===t?"undefined":j(t))?e[n]=x(e[n],t):e[n]=t}for(var e={},n=0,r=arguments.length;n<r;n++)g(arguments[n],t);return e}function w(t,e,n){return g(e,function(e,r){t[r]=n&&"function"==typeof e?S(e,n):e}),t}var j="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},S=n(9),O=n(35),_=Object.prototype.toString;t.exports={isArray:r,isArrayBuffer:o,isBuffer:O,isFormData:s,isArrayBufferView:i,isString:u,isNumber:c,isObject:f,isUndefined:a,isDate:p,isFile:l,isBlob:d,isFunction:h,isStream:m,isURLSearchParams:y,isStandardBrowserEnv:b,forEach:g,merge:x,extend:w,trim:v}},function(t,e,n){"use strict";(function(){var t=[].indexOf;e.validate=function(e,n){var r,o,s;if(o=Object.keys(e),r=function(){var e,r,i;for(i=[],e=0,r=n.length;e<r;e++)s=n[e],t.call(o,s)<0&&i.push(s);return i}(),r.length>0)throw new Error("Required parameters missing: "+r.join(", "))},e.assign=n(65),e.omit=function(t,n){var r;return r=e.assign({},t),delete r[n],r}}).call(void 0)},function(t,e,n){"use strict";function r(t,e){!o.isUndefined(t)&&o.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var o=n(0),s=n(37),i={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:function(){var t;return"undefined"!=typeof XMLHttpRequest?t=n(38):"undefined"!=typeof process&&(t=n(43)),t}(),transformRequest:[function(t,e){return s(e,"Content-Type"),o.isFormData(t)||o.isArrayBuffer(t)||o.isBuffer(t)||o.isStream(t)||o.isFile(t)||o.isBlob(t)?t:o.isArrayBufferView(t)?t.buffer:o.isURLSearchParams(t)?(r(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):o.isObject(t)?(r(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(t){u.headers[t]={}}),o.forEach(["post","put","patch"],function(t){u.headers[t]=o.merge(i)}),t.exports=u},function(t,e,n){"use strict";var r=n(11);t.exports=function(t,e,n,o,s){var i=new Error(t);return r(i,e,n,o,s)}},function(t,e,n){"use strict";function r(t){return null==t?void 0===t?c:u:a&&a in Object(t)?s(t):i(t)}var o=n(24),s=n(68),i=n(69),u="[object Null]",c="[object Undefined]",a=o?o.toStringTag:void 0;t.exports=r},function(t,e,n){"use strict";var r="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},o=n(25),s="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,i=o||s||Function("return this")();t.exports=i},function(t,e,n){"use strict";function r(t){var e=void 0===t?"undefined":o(t);return null!=t&&("object"==e||"function"==e)}var o="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.exports=r},function(t,e,n){"use strict";function r(t){return null!=t&&s(t.length)&&!o(t)}var o=n(23),s=n(28);t.exports=r},function(t,e,n){"use strict";function r(t){return null!=t&&"object"==(void 0===t?"undefined":o(t))}var o="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.exports=r},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?e(r("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}},function(t,e,n){"use strict";t.exports=function(t,e,n,r,o){return t.config=e,n&&(t.code=n),t.request=r,t.response=o,t}},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(0);t.exports=function(t,e,n){if(!e)return t;var s;if(n)s=n(e);else if(o.isURLSearchParams(e))s=e.toString();else{var i=[];o.forEach(e,function(t,e){null!==t&&void 0!==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)),i.push(r(e)+"="+r(t))}))}),s=i.join("&")}return s&&(t+=(-1===t.indexOf("?")?"?":"&")+s),t}},function(t,e){t.exports=require("http")},function(t,e){t.exports=require("https")},function(t,e,n){"use strict";function r(t,e){c.call(this),this._options=t,this._redirectCount=0,this._bufferedWrites=[],e&&this.on("response",e);var n=this;if(this._onNativeResponse=function(t){n._processResponse(t)},!t.pathname&&t.path){var r=t.path.indexOf("?");r<0?t.pathname=t.path:(t.pathname=t.path.substring(0,r),t.search=t.path.substring(r))}this._performRequest()}var o=n(16),s=n(44),i=n(13),u=n(14),c=n(45).Writable,a=n(46)("follow-redirects"),f={"http:":i,"https:":u},p={},l=t.exports={maxRedirects:21},d={GET:!0,HEAD:!0,OPTIONS:!0,TRACE:!0},h=Object.create(null);["abort","aborted","error","socket"].forEach(function(t){h[t]=function(e){this._redirectable.emit(t,e)}}),r.prototype=Object.create(c.prototype),r.prototype._performRequest=function(){var t=this._options.protocol;this._options.agents&&(this._options.agent=this._options.agents[p[t]]);var e=f[t],n=this._currentRequest=e.request(this._options,this._onNativeResponse);this._currentUrl=o.format(this._options),n._redirectable=this;for(var r in h)r&&n.on(r,h[r]);if(this._isRedirect){var s=this._bufferedWrites;if(0===s.length)n.end();else{var i=0;!function t(){if(i<s.length){var e=s[i++];n.write(e.data,e.encoding,t)}else n.end()}()}}},r.prototype._processResponse=function(t){var e=t.headers.location;if(e&&!1!==this._options.followRedirects&&t.statusCode>=300&&t.statusCode<400){if(++this._redirectCount>this._options.maxRedirects)return this.emit("error",new Error("Max redirects exceeded."));var n,r=this._options.headers;if(307!==t.statusCode&&!(this._options.method in d)){this._options.method="GET",this._bufferedWrites=[];for(n in r)/^content-/i.test(n)&&delete r[n]}if(!this._isRedirect)for(n in r)/^host$/i.test(n)&&delete r[n];var s=o.resolve(this._currentUrl,e);a("redirecting to",s),Object.assign(this._options,o.parse(s)),this._isRedirect=!0,this._performRequest()}else t.responseUrl=this._currentUrl,this.emit("response",t),delete this._options,delete this._bufferedWrites},r.prototype.abort=function(){this._currentRequest.abort()},r.prototype.flushHeaders=function(){this._currentRequest.flushHeaders()},r.prototype.setNoDelay=function(t){this._currentRequest.setNoDelay(t)},r.prototype.setSocketKeepAlive=function(t,e){this._currentRequest.setSocketKeepAlive(t,e)},r.prototype.setTimeout=function(t,e){this._currentRequest.setTimeout(t,e)},r.prototype.write=function(t,e,n){this._currentRequest.write(t,e,n),this._bufferedWrites.push({data:t,encoding:e})},r.prototype.end=function(t,e,n){this._currentRequest.end(t,e,n),t&&this._bufferedWrites.push({data:t,encoding:e})},Object.keys(f).forEach(function(t){var e=p[t]=t.substr(0,t.length-1),n=f[t],i=l[e]=Object.create(n);i.request=function(e,n){return"string"==typeof e?(e=o.parse(e),e.maxRedirects=l.maxRedirects):e=Object.assign({maxRedirects:l.maxRedirects,protocol:t},e),s.equal(e.protocol,t,"protocol mismatch"),a("options",e),new r(e,n)},i.get=function(t,e){var n=i.request(t,e);return n.end(),n}})},function(t,e){t.exports=require("url")},function(t,e,n){"use strict";function r(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,r=+new Date,o=r-(a||r);t.diff=o,t.prev=a,t.curr=r,a=r;for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var u=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;u++;var o=e.formatters[r];if("function"==typeof o){var i=s[u];n=o.call(t,i),s.splice(u,1),u--}return n}),e.formatArgs.call(t,s);(n.log||e.log||console.log.bind(console)).apply(t,s)}}return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=r(t),"function"==typeof e.init&&e.init(n),n}function s(t){e.save(t),e.names=[],e.skips=[];for(var n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(t=n[o].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function i(){e.enable("")}function u(t){var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1}function c(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o.default=o,e.coerce=c,e.disable=i,e.enable=s,e.enabled=u,e.humanize=n(48),e.names=[],e.skips=[],e.formatters={};var a},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";function r(t,e,n){var r=t[e];u.call(t,e)&&s(r,n)&&(void 0!==n||e in t)||o(t,e,n)}var o=n(21),s=n(26),i=Object.prototype,u=i.hasOwnProperty;t.exports=r},function(t,e,n){"use strict";function r(t,e,n){"__proto__"==e&&o?o(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var o=n(22);t.exports=r},function(t,e,n){"use strict";var r=n(66),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,n){"use strict";function r(t){if(!s(t))return!1;var e=o(t);return e==u||e==c||e==i||e==a}var o=n(4),s=n(6),i="[object AsyncFunction]",u="[object Function]",c="[object GeneratorFunction]",a="[object Proxy]";t.exports=r},function(t,e,n){"use strict";var r=n(5),o=r.Symbol;t.exports=o},function(t,e,n){"use strict";var r="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},o="object"==("undefined"==typeof global?"undefined":r(global))&&global&&global.Object===Object&&global;t.exports=o},function(t,e,n){"use strict";function r(t,e){return t===e||t!==t&&e!==e}t.exports=r},function(t,e,n){"use strict";function r(t){return t}t.exports=r},function(t,e,n){"use strict";function r(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}var o=9007199254740991;t.exports=r},function(t,e,n){"use strict";function r(t,e){var n=void 0===t?"undefined":o(t);return!!(e=null==e?s:e)&&("number"==n||"symbol"!=n&&i.test(t))&&t>-1&&t%1==0&&t<e}var o="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},s=9007199254740991,i=/^(?:0|[1-9]\d*)$/;t.exports=r},function(t,e,n){"use strict";function r(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||o)}var o=Object.prototype;t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";(function(){var e,r,o,s,i,u,c,a,f;i=n(33),f=n(63),e=n(105);var p=n(1);a=p.omit,s=p.assign,c=function(t){return c.method=t.toUpperCase(),c},c.configure=function(t){return this.options=s({},this.options,t)},c.setAccount=function(t){return this.options.accountId=t},c.setDateTimeFormat=function(t){if("UNIX"!==t&&"RFC3339"!==t)throw new Error("invalid date time format");return this.options.dateTimeFormat=t},c.request=function(t,e){var n,r,u,c,f,p,l,d=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return o(this.options,d),r=null!=(c=this.method)?c:"GET",this.method=null,l="json",null==t.json||t.json||(l="text"),u={method:r,url:null!=(f=t.url)?f:this.endpoint(e),headers:{Authorization:"Bearer "+this.options.apiKey,"Accept-Datetime-Format":this.options.dateTimeFormat},data:t.body,params:a(t,"body"),responseType:l},n=i(u),this.options.fullResponse?n:null!=n&&null!=(p=n.then(function(t){var e=t.status,n=t.headers,r=t.data;return s({},{status:e,headers:n},r)}))?p.catch(function(t){var e,n,r,o,i;if(!(null!=t&&null!=(r=t.response)?r.status:void 0))return Promise.reject(t);o=t.response;var u=o;return i=u.status,n=u.headers,e=u.data,Promise.reject(s({},{status:i,headers:n},e))}):void 0},c.subscribe=function(t,n){var r,s,u,c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return o(this.options,c),r={method:"GET",url:null!=(s=t.url)?s:this.endpoint(n,"stream"),headers:{Authorization:"Bearer "+this.options.apiKey,"Accept-Datetime-Format":this.options.dateTimeFormat},params:a(t,"body"),responseType:"stream"},this.method=null,null!=(u=i(r))?u.then(function(n){var r,o=n.data;return new e(o,{json:null==(r=t.json)||r})}):void 0},c.endpoint=function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"api",o=this.options;if(t=o.live,e=o.version,"api"!==r&&"stream"!==r)throw new Error("invalid mode");switch(!1){case!t:return"https://"+r+"-fxtrade.oanda.com/"+e+"/"+n;default:return"https://"+r+"-fxpractice.oanda.com/"+e+"/"+n}},o=function(t,e){if(!t.apiKey)throw new Error("Api key is not set. Use configure or env OANDA_API_KEY");if(e&&!t.accountId)throw new Error("Account id must be set for this request")},r=function(t,e){var n,r;for(r in t){e[r]=t[r].bind(e);for(n in t[r])e[r][n]=t[r][n].bind(e)}return e},u=function(){return c.configure({apiKey:process.env.OANDA_API_KEY,live:!1,version:"v3",dateTimeFormat:"RFC3339",throwHttpErrors:!0}),s(c,f),r(f,c)},t.exports=u()}).call(void 0)},function(t,e,n){"use strict";t.exports=n(34)},function(t,e,n){"use strict";function r(t){var e=new i(t),n=s(i.prototype.request,e);return o.extend(n,i.prototype,e),o.extend(n,e),n}var o=n(0),s=n(9),i=n(36),u=n(2),c=r(u);c.Axios=i,c.create=function(t){return r(o.merge(u,t))},c.Cancel=n(19),c.CancelToken=n(61),c.isCancel=n(18),c.all=function(t){return Promise.all(t)},c.spread=n(62),t.exports=c,t.exports.default=c},function(t,e,n){"use strict";function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function o(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}/*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> * @license MIT */ t.exports=function(t){return null!=t&&(r(t)||o(t)||!!t._isBuffer)}},function(t,e,n){"use strict";function r(t){this.defaults=t,this.interceptors={request:new i,response:new i}}var o=n(2),s=n(0),i=n(56),u=n(57),c=n(59),a=n(60);r.prototype.request=function(t){"string"==typeof t&&(t=s.merge({url:arguments[0]},arguments[1])),t=s.merge(o,this.defaults,{method:"get"},t),t.method=t.method.toLowerCase(),t.baseURL&&!c(t.url)&&(t.url=a(t.baseURL,t.url));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},s.forEach(["delete","get","head","options"],function(t){r.prototype[t]=function(e,n){return this.request(s.merge(n||{},{method:t,url:e}))}}),s.forEach(["post","put","patch"],function(t){r.prototype[t]=function(e,n,r){return this.request(s.merge(r||{},{method:t,url:e,data:n}))}}),t.exports=r},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},function(t,e,n){"use strict";var r=n(0),o=n(10),s=n(12),i=n(39),u=n(40),c=n(3),a="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(41);t.exports=function(t){return new Promise(function(e,f){var p=t.data,l=t.headers;r.isFormData(p)&&delete l["Content-Type"];var d=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in d||u(t.url)||(d=new window.XDomainRequest,h="onload",m=!0,d.onprogress=function(){},d.ontimeout=function(){}),t.auth){var y=t.auth.username||"",v=t.auth.password||"";l.Authorization="Basic "+a(y+":"+v)}if(d.open(t.method.toUpperCase(),s(t.url,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d[h]=function(){if(d&&(4===d.readyState||m)&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,r=t.responseType&&"text"!==t.responseType?d.response:d.responseText,s={data:r,status:1223===d.status?204:d.status,statusText:1223===d.status?"No Content":d.statusText,headers:n,config:t,request:d};o(e,f,s),d=null}},d.onerror=function(){f(c("Network Error",t,null,d)),d=null},d.ontimeout=function(){f(c("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",d)),d=null},r.isStandardBrowserEnv()){var b=n(42),g=(t.withCredentials||u(t.url))&&t.xsrfCookieName?b.read(t.xsrfCookieName):void 0;g&&(l[t.xsrfHeaderName]=g)}if("setRequestHeader"in d&&r.forEach(l,function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete l[e]:d.setRequestHeader(e,t)}),t.withCredentials&&(d.withCredentials=!0),t.responseType)try{d.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){d&&(d.abort(),f(t),d=null)}),void 0===p&&(p=null),d.send(p)})}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t){var e,n,o,s={};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&&(s[e]=s[e]?s[e]+", "+n:n)}),s):s}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?function(){function t(t){var e=t;return n&&(o.setAttribute("href",e),e=o.href),o.setAttribute("href",e),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var e,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return e=t(window.location.href),function(n){var o=r.isString(n)?t(n):n;return o.protocol===e.protocol&&o.host===e.host}}():function(){return function(){return!0}}()},function(t,e,n){"use strict";function r(){this.message="String contains an invalid character"}function o(t){for(var e,n,o=String(t),i="",u=0,c=s;o.charAt(0|u)||(c="=",u%1);i+=c.charAt(63&e>>8-u%1*8)){if((n=o.charCodeAt(u+=.75))>255)throw new r;e=e<<8|n}return i}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",t.exports=o},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?function(){return{write:function(t,e,n,o,s,i){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(s)&&u.push("domain="+s),!0===i&&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(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(t,e,n){"use strict";var r=n(0),o=n(10),s=n(12),i=n(13),u=n(14),c=n(15).http,a=n(15).https,f=n(16),p=n(54),l=n(55),d=n(3),h=n(11);t.exports=function(t){return new Promise(function(e,n){var m,y=t.data,v=t.headers,b=!1;if(v["User-Agent"]||v["user-agent"]||(v["User-Agent"]="axios/"+l.version),y&&!r.isStream(y)){if(Buffer.isBuffer(y));else if(r.isArrayBuffer(y))y=new Buffer(new Uint8Array(y));else{if(!r.isString(y))return n(d("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",t));y=new Buffer(y,"utf-8")}v["Content-Length"]=y.length}var g=void 0;if(t.auth){g=(t.auth.username||"")+":"+(t.auth.password||"")}var x=f.parse(t.url),w=x.protocol||"http:";if(!g&&x.auth){var j=x.auth.split(":");g=(j[0]||"")+":"+(j[1]||"")}g&&delete v.Authorization;var S="https:"===w,O=S?t.httpsAgent:t.httpAgent,_={hostname:x.hostname,port:x.port,path:s(x.path,t.params,t.paramsSerializer).replace(/^\?/,""),method:t.method,headers:v,agent:O,auth:g},E=t.proxy;if(!E){var A=w.slice(0,-1)+"_proxy",q=process.env[A]||process.env[A.toUpperCase()];if(q){var C=f.parse(q);if(E={host:C.hostname,port:C.port},C.auth){var R=C.auth.split(":");E.auth={username:R[0],password:R[1]}}}}if(E&&(_.hostname=E.host,_.host=E.host,_.headers.host=x.hostname+(x.port?":"+x.port:""),_.port=E.port,_.path=w+"//"+x.hostname+(x.port?":"+x.port:"")+_.path,E.auth)){var k=new Buffer(E.auth.username+":"+E.auth.password,"utf8").toString("base64");_.headers["Proxy-Authorization"]="Basic "+k}var T;0===t.maxRedirects?T=S?u:i:(t.maxRedirects&&(_.maxRedirects=t.maxRedirects),T=S?a:c);var P=T.request(_,function(r){if(!b){clearTimeout(m),m=null;var s=r;switch(r.headers["content-encoding"]){case"gzip":case"compress":case"deflate":s=s.pipe(p.createUnzip()),delete r.headers["content-encoding"]}var i=r.req||P,u={status:r.statusCode,statusText:r.statusMessage,headers:r.headers,config:t,request:i};if("stream"===t.responseType)u.data=s,o(e,n,u);else{var c=[];s.on("data",function(e){c.push(e),t.maxContentLength>-1&&Buffer.concat(c).length>t.maxContentLength&&n(d("maxContentLength size of "+t.maxContentLength+" exceeded",t,null,i))}),s.on("error",function(e){b||n(h(e,t,null,i))}),s.on("end",function(){var r=Buffer.concat(c);"arraybuffer"!==t.responseType&&(r=r.toString("utf8")),u.data=r,o(e,n,u)})}}});P.on("error",function(e){b||n(h(e,t,null,P))}),t.timeout&&!m&&(m=setTimeout(function(){P.abort(),n(d("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",P)),b=!0},t.timeout)),t.cancelToken&&t.cancelToken.promise.then(function(t){b||(P.abort(),n(t),b=!0)}),r.isStream(y)?y.pipe(P):P.end(y)})}},function(t,e){t.exports=require("assert")},function(t,e){t.exports=require("stream")},function(t,e,n){"use strict";"undefined"!=typeof process&&"renderer"===process.type?t.exports=n(47):t.exports=n(49)},function(t,e,n){"use strict";function r(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,s=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(s=o))}),t.splice(s,0,r)}}function s(){return"object"===("undefined"==typeof console?"undefined":c(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function u(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}var c="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};e=t.exports=n(17),e.log=s,e.formatArgs=o,e.save=i,e.load=u,e.useColors=r,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(u())},function(t,e,n){"use strict";function r(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*p;case"hours":case"hour":case"hrs":case"hr":case"h":return n*f;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function o(t){return t>=p?Math.round(t/p)+"d":t>=f?Math.round(t/f)+"h":t>=a?Math.round(t/a)+"m":t>=c?Math.round(t/c)+"s":t+"ms"}function s(t){return i(t,p,"day")||i(t,f,"hour")||i(t,a,"minute")||i(t,c,"second")||t+" ms"}function i(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var u="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},c=1e3,a=60*c,f=60*a,p=24*f,l=365.25*p;t.exports=function(t,e){e=e||{};var n=void 0===t?"undefined":u(t);if("string"===n&&t.length>0)return r(t);if("number"===n&&!1===isNaN(t))return e.long?s(t):o(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){"use strict";function r(){return"colors"in e.inspectOpts?Boolean(e.inspectOpts.colors):a.isatty(p)}function o(t){var n=this.namespace;if(this.useColors){var r=this.color,o=" [3"+r+";1m"+n+" ";t[0]=o+t[0].split("\n").join("\n"+o),t.push("[3"+r+"m+"+e.humanize(this.diff)+"")}else t[0]=(new Date).toUTCString()+" "+n+" "+t[0]}function s(){return l.write(f.format.apply(f,arguments)+"\n")}function i(t){null==t?delete process.env.DEBUG:process.env.DEBUG=t}function u(){return process.env.DEBUG}function c(t){t.inspectOpts={};for(var n=Object.keys(e.inspectOpts),r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}var a=n(50),f=n(51);e=t.exports=n(17),e.init=c,e.log=s,e.formatArgs=o,e.save=i,e.load=u,e.useColors=r,e.colors=[6,2,3,4,5,1],e.inspectOpts=Object.keys(process.env).filter(function(t){return/^debug_/i.test(t)}).reduce(function(t,e){var n=e.substring(6).toLowerCase().replace(/_([a-z])/g,function(t,e){return e.toUpperCase()}),r=process.env[e];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),t[n]=r,t},{});var p=parseInt(process.env.DEBUG_FD,10)||2;1!==p&&2!==p&&f.deprecate(function(){},"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var l=1===p?process.stdout:2===p?process.stderr:function(t){var e;switch(process.binding("tty_wrap").guessHandleType(t)){case"TTY":e=new a.WriteStream(t),e._type="tty",e._handle&&e._handle.unref&&e._handle.unref();break;case"FILE":e=new(n(52).SyncWriteStream)(t,{autoClose:!1}),e._type="fs";break;case"PIPE":case"TCP":e=new(n(53).Socket)({fd:t,readable:!1,writable:!0}),e.readable=!1,e.read=null,e._type="pipe",e._handle&&e._handle.unref&&e._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return e.fd=t,e._isStdio=!0,e}(p);e.formatters.o=function(t){return this.inspectOpts.colors=this.useColors,f.inspect(t,this.inspectOpts).replace(/\s*\n\s*/g," ")},e.formatters.O=function(t){return this.inspectOpts.colors=this.useColors,f.inspect(t,this.inspectOpts)},e.enable(u())},function(t,e){t.exports=require("tty")},function(t,e){t.exports=require("util")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("net")},function(t,e){t.exports=require("zlib")},function(t,e,n){"use strict";t.exports={name:"axios",version:"0.16.2",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},repository:{type:"git",url:"https://github.com/mzabriskie/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/mzabriskie/axios/issues"},homepage:"https://github.com/mzabriskie/axios",devDependencies:{coveralls:"^2.11.9","es6-promise":"^4.0.5",grunt:"^1.0.1","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.0.0","grunt-contrib-nodeunit":"^1.0.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^19.0.0","grunt-karma":"^2.0.0","grunt-ts":"^6.0.0-beta.3","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^1.3.0","karma-chrome-launcher":"^2.0.0","karma-coverage":"^1.0.0","karma-firefox-launcher":"^1.0.0","karma-jasmine":"^1.0.2","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-phantomjs-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.1.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0","phantomjs-prebuilt":"^2.1.7",sinon:"^1.17.4",webpack:"^1.13.1","webpack-dev-server":"^1.14.1","url-search-params":"^0.6.1",typescript:"^2.0.3"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.2.3","is-buffer":"^1.1.5"},_resolved:"https://registry.npmjs.org/axios/-/axios-0.16.2.tgz",_integrity:"sha1-uk+S8XFn37q0CYN4VFS5rBScPG0=",_from:"axios@0.16.2"}},function(t,e,n){"use strict";function r(){this.handlers=[]}var o=n(0);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){"use strict";function r(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var o=n(0),s=n(58),i=n(18),u=n(2);t.exports=function(t){return r(t),t.headers=t.headers||{},t.data=s(t.data,t.headers,t.transformRequest),t.headers=o.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||u.adapter)(t).then(function(e){return r(t),e.data=s(e.data,e.headers,t.transformResponse),e},function(e){return i(e)||(r(t),e&&e.response&&(e.response.data=s(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e,n){return r.forEach(n,function(n){t=n(t,e)}),t}},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,n){"use strict";function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new o(t),e(n.reason))})}var o=n(19);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t;return{token:new r(function(e){t=e}),cancel:t}},t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";(function(){t.exports=Object.assign({},n(64),n(99),n(100),n(101),n(102),n(103),n(104))}).call(void 0)},function(t,e,n){"use strict";(function(){var t,r,o=n(1);r=o.validate,t=o.omit,e.accounts=function(){var e,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=o.id,"PATCH"===this.method?(r(o,["id"]),this.request({body:t(o,"id")},"accounts/"+e+"/configuration",!1)):(n=function(){switch(!1){case null==e:return"accounts/"+e;default:return"accounts"}}(),this.request(o,n,!1))},e.summary=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.request(t,"accounts/"+this.options.accountId+"/summary")},e.instruments=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.request(t,"accounts/"+this.options.accountId+"/instruments")},e.changes=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(t,["sinceTransactionID"]),this.request(t,"accounts/"+this.options.accountId+"/changes")}}).call(void 0)},function(t,e,n){"use strict";var r=n(20),o=n(74),s=n(75),i=n(7),u=n(30),c=n(84),a=Object.prototype,f=a.hasOwnProperty,p=s(function(t,e){if(u(e)||i(e))return void o(e,c(e),t);for(var n in e)f.call(e,n)&&r(t,n,e[n])});t.exports=p},function(t,e,n){"use strict";function r(t,e){var n=s(t,e);return o(n)?n:void 0}var o=n(67),s=n(73);t.exports=r},function(t,e,n){"use strict";function r(t){return!(!i(t)||s(t))&&(o(t)?h:a).test(u(t))}var o=n(23),s=n(70),i=n(6),u=n(72),c=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,f=Function.prototype,p=Object.prototype,l=f.toString,d=p.hasOwnProperty,h=RegExp("^"+l.call(d).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e,n){"use strict";function r(t){var e=i.call(t,c),n=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[c]=n:delete t[c]),o}var o=n(24),s=Object.prototype,i=s.hasOwnProperty,u=s.toString,c=o?o.toStringTag:void 0;t.exports=r},function(t,e,n){"use strict";function r(t){return s.call(t)}var o=Object.prototype,s=o.toString;t.exports=r},function(t,e,n){"use strict";function r(t){return!!s&&s in t}var o=n(71),s=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=r},function(t,e,n){"use strict";var r=n(5),o=r["__core-js_shared__"];t.exports=o},function(t,e,n){"use strict";function r(t){if(null!=t){try{return s.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var o=Function.prototype,s=o.toString;t.exports=r},function(t,e,n){"use strict";function r(t,e){return null==t?void 0:t[e]}t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){var i=!n;n||(n={});for(var u=-1,c=e.length;++u<c;){var a=e[u],f=r?r(n[a],t[a],a,n,t):void 0;void 0===f&&(f=t[a]),i?s(n,a,f):o(n,a,f)}return n}var o=n(20),s=n(21);t.exports=r},function(t,e,n){"use strict";function r(t){return o(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,u=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,u&&s(n[0],n[1],u)&&(i=o<3?void 0:i,o=1),e=Object(e);++r<o;){var c=n[r];c&&t(e,c,r,i)}return e})}var o=n(76),s=n(83);t.exports=r},function(t,e,n){"use strict";function r(t,e){return i(s(t,e,o),t+"")}var o=n(27),s=n(77),i=n(79);t.exports=r},function(t,e,n){"use strict";function r(t,e,n){return e=s(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,u=s(r.length-e,0),c=Array(u);++i<u;)c[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(c),o(t,this,a)}}var o=n(78),s=Math.max;t.exports=r},function(t,e,n){"use strict";function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}t.exports=r},function(t,e,n){"use strict";var r=n(80),o=n(82),s=o(r);t.exports=s},function(t,e,n){"use strict";var r=n(81),o=n(22),s=n(27),i=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:s;t.exports=i},function(t,e,n){"use strict";function r(t){return function(){return t}}t.exports=r},function(t,e,n){"use strict";function r(t){var e=0,n=0;return function(){var r=i(),u=s-(r-n);if(n=r,u>0){if(++e>=o)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var o=800,s=16,i=Date.now;t.exports=r},function(t,e,n){"use strict";function r(t,e,n){if(!c(n))return!1;var r=void 0===e?"undefined":o(e);return!!("number"==r?i(n)&&u(e,n.length):"string"==r&&e in n)&&s(n[e],t)}var o="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},s=n(26),i=n(7),u=n(29),c=n(6);t.exports=r},function(t,e,n){"use strict";function r(t){return i(t)?o(t):s(t)}var o=n(85),s=n(96),i=n(7);t.exports=r},function(t,e,n){"use strict";function r(t,e){var n=i(t),r=!n&&s(t),f=!n&&!r&&u(t),l=!n&&!r&&!f&&a(t),d=n||r||f||l,h=d?o(t.length,String):[],m=h.length;for(var y in t)!e&&!p.call(t,y)||d&&("length"==y||f&&("offset"==y||"parent"==y)||l&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||c(y,m))||h.push(y);return h}var o=n(86),s=n(87),i=n(89),u=n(90),c=n(29),a=n(92),f=Object.prototype,p=f.hasOwnProperty;t.exports=r},function(t,e,n){"use strict";function r(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}t.exports=r},function(t,e,n){"use strict";var r=n(88),o=n(8),s=Object.prototype,i=s.hasOwnProperty,u=s.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return o(t)&&i.call(t,"callee")&&!u.call(t,"callee")};t.exports=c},function(t,e,n){"use strict";function r(t){return s(t)&&o(t)==i}var o=n(4),s=n(8),i="[object Arguments]";t.exports=r},function(t,e,n){"use strict";var r=Array.isArray;t.exports=r},function(t,e,n){"use strict";(function(t){var r="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},o=n(5),s=n(91),i="object"==r(e)&&e&&!e.nodeType&&e,u=i&&"object"==r(t)&&t&&!t.nodeType&&t,c=u&&u.exports===i,a=c?o.Buffer:void 0,f=a?a.isBuffer:void 0,p=f||s;t.exports=p}).call(e,n(31)(t))},function(t,e,n){"use strict";function r(){return!1}t.exports=r},function(t,e,n){"use strict";var r=n(93),o=n(94),s=n(95),i=s&&s.isTypedArray,u=i?o(i):r;t.exports=u},function(t,e,n){"use strict";function r(t){return i(t)&&s(t.length)&&!!u[o(t)]}var o=n(4),s=n(28),i=n(8),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1,t.exports=r},function(t,e,n){"use strict";function r(t){return function(e){return t(e)}}t.exports=r},function(t,e,n){"use strict";(function(t){var r="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},o=n(25),s="object"==r(e)&&e&&!e.nodeType&&e,i=s&&"object"==r(t)&&t&&!t.nodeType&&t,u=i&&i.exports===s,c=u&&o.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||c&&c.binding&&c.binding("util")}catch(t){}}();t.exports=a}).call(e,n(31)(t))},function(t,e,n){"use strict";function r(t){if(!o(t))return s(t);var e=[];for(var n in Object(t))u.call(t,n)&&"constructor"!=n&&e.push(n);return e}var o=n(30),s=n(97),i=Object.prototype,u=i.hasOwnProperty;t.exports=r},function(t,e,n){"use strict";var r=n(98),o=r(Object.keys,Object);t.exports=o},function(t,e,n){"use strict";function r(t,e){return function(n){return t(e(n))}}t.exports=r},function(t,e,n){"use strict";(function(){var t,r=n(1);t=r.validate,e.candles=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t(e,["id"]),this.request(e,"instruments/"+e.id+"/candles",!1)}}).call(void 0)},function(t,e,n){"use strict";(function(){var t,r,o=n(1);r=o.validate,t=o.omit,e.orders=function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=n.id,e=function(){switch(!1){case null==t:return"accounts/"+this.options.accountId+"/orders/"+t;default:return"accounts/"+this.options.accountId+"/orders"}}.call(this),this.request(n,e)},e.orders.create=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(t,["order"]),this("post").request({body:t},"accounts/"+this.options.accountId+"/orders")},e.orders.replace=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id","order"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/orders/"+e.id)},e.orders.cancel=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/orders/"+e.id+"/cancel")},e.orders.clientExtensions=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/orders/"+e.id+"/clientExtensions")}}).call(void 0)},function(t,e,n){"use strict";(function(){var t,r,o=n(1);t=o.omit,r=o.validate,e.trades=function(){var t,e,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=r.id,e=r.open,e&&(r.state="OPEN"),n=function(){switch(!1){case null==t:return"accounts/"+this.options.accountId+"/trades/"+t;default:return"accounts/"+this.options.accountId+"/trades"}}.call(this),this.request(r,n)},e.trades.close=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/trades/"+e.id+"/close")},e.trades.clientExtensions=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/trades/"+e.id+"/clientExtensions")},e.trades.orders=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/trades/"+e.id+"/orders")}}).call(void 0)},function(t,e,n){"use strict";(function(){var t,r,o=n(1);t=o.omit,r=o.validate,e.positions=function(){var t,e,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=r.id,e=r.open,n=function(){switch(!1){case null==t:return"accounts/"+this.options.accountId+"/positions/"+t;case!e:return"accounts/"+this.options.accountId+"/openPositions";default:return"accounts/"+this.options.accountId+"/positions"}}.call(this),this.request(r,n)},e.positions.close=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r(e,["id"]),this("put").request({body:t(e,"id")},"accounts/"+this.options.accountId+"/positions/"+e.id+"/close")}}).call(void 0)},function(t,e,n){"use strict";(function(){n(1).validate,e.transactions=function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=n.id,e=function(){switch(!1){case null==t:return"accounts/"+this.options.accountId+"/transactions/"+t;default:return"accounts/"+this.options.accountId+"/transactions"}}.call(this),this.request(n,e)},e.transactions.stream=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.subscribe(t,"accounts/"+this.options.accountId+"/transactions/stream")}}).call(void 0)},function(t,e,n){"use strict";(function(){var t,r=n(1);t=r.validate,e.pricing=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t(e,["instruments"]),this.request(e,"accounts/"+this.options.accountId+"/pricing")},e.pricing.stream=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t(e,["instruments"]),this.subscribe(e,"accounts/"+this.options.accountId+"/pricing/stream")}}).call(void 0)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();(function(){var e,u,c;e=n(106).EventEmitter;var a=n(1);c=a.assign,u=function(t){function e(t,n){r(this,e);var s=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return null==t?o(s):(s.connected=!1,s.stream=t,s.options=c({},n),s.stream.on("data",function(t){var e,n;s.connected=!0;try{return n=function(){switch(!1){case!this.options.json:return t.toString().split(/\r?\n/).filter(Boolean).map(JSON.parse);default:return[t]}}.call(s),n.forEach(function(t){return s.emit("data",t)})}catch(n){return e=n.message,s.emit("error",new Error("Subscription error parsing Oanda response:\nMessage: "+e+"\nData string: "+t.toString()))}}),s.stream.on("error",function(t){return s.connected=!1,s.emit("error",t)}),s.stream.on("end",function(t){return s.connected=!1,s.emit("end",t)}),s)}return s(e,t),i(e,[{key:"connect",value:function(){return this.stream(),this.connected=!0}},{key:"disconnect",value:function(){return this.connected=!1,this.stream.req.abort()}}]),e}(e),t.exports=u}).call(void 0)},function(t,e){t.exports=require("events")}])});