diff --git a/dist/maps/vhx.min.js.map b/dist/maps/vhx.min.js.map index 2beddf2..be7e3f6 100644 --- a/dist/maps/vhx.min.js.map +++ b/dist/maps/vhx.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["vhx.min.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length","1","module","_VHX_DEFAULTS","HOST","PROTOCOL","API_VERSION","version","TIMEOUT","TOKEN_HOST","../package.json","2","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","Paginate","resource","args","this","_this","response","body","options","page","method","last","Math","ceil","total","count","map","callback","goToPage","num","merge","_embedded","object","concat","value","parseInt","3","_typeof","Symbol","iterator","obj","constructor","request","paginate","Resource","api","path","methods","isToken","_api","init","forEach","item","getMethod","type","getType","params","http_method","client_method","match","b","c","isCallbackFunction","id","parseHref","scope","makeRequest","isObject","href","val","indexOf","host","substr","split","cb","protocol","window","location","post","set","$","attr","then","data","token","console","log","Date","getTime","url","timeout","auth","headers","Authorization","qs","getParams","undefined","getToken","ajaxRequest","withCredentials","query","end","err","errorHandler","status","statusCode","successHandler","get","error","JSON","parse","error_types","400","401","404","408","500","apply","./paginate","superagent","4","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","Browse","_Resource","getPrototypeOf","../resource","5","Collection","6","Customer","7","Product","8","Video","9","_interopRequireDefault","__esModule","default","_defaults","_defaults2","_collections","_collections2","_videos","_videos2","_customers","_customers2","_products","_products2","_browse","_browse2","resources","collections","videos","products","customer","browse","vhx","setApi","setToken","prepareResources","btoa","token_host","name","toLowerCase","substring","./defaults","./resources/browse","./resources/collections","./resources/customers","./resources/products","./resources/videos","10","Emitter","mixin","on","addEventListener","event","fn","_callbacks","push","once","off","arguments","removeListener","removeAllListeners","removeEventListener","callbacks","splice","emit","slice","len","listeners","hasListeners","11","noop","serialize","pairs","pushEncodedKeyValuePair","join","Array","isArray","v","subkey","encodeURIComponent","parseString","str","pair","pos","decodeURIComponent","parseHeader","index","line","field","lines","fields","pop","trim","isJSON","mime","test","shift","reduce","parts","Response","req","xhr","text","responseType","responseText","statusText","_setStatusProperties","header","getAllResponseHeaders","getResponseHeader","_setHeaderProperties","_parseBody","Request","_query","_header","res","original","rawResponse","new_err","del","root","warn","requestBase","bind","getXHR","XMLHttpRequest","ActiveXObject","replace","serializeObject","types","html","json","xml","urlencoded","form","form-data","application/x-www-form-urlencoded","application/json","stringify","ct","statusType","info","ok","clientError","serverError","toError","accepted","noContent","badRequest","unauthorized","notAcceptable","notFound","forbidden","msg","_responseType","accept","user","pass","username","password","attach","file","filename","_getFormData","append","_formData","FormData","_callback","clearTimeout","crossDomainError","crossDomain","_timeoutError","_timeout","_appendQueryString","_data","onreadystatechange","readyState","timedout","_aborted","handleProgress","percent","loaded","direction","onprogress","upload","_timer","setTimeout","abort","open","_withCredentials","_isHost","contentType","_serializer","setRequestHeader","send","head","patch","put","./is-object","./request","./request-base","emitter","12","13","_parser","ms","resolve","reject","_fullfilledPromise","Promise","innerResolve","innerReject","use","getHeader","unset","redirects","_maxRedirects","toJSON","toString","14","RequestConstructor","15","description","main","author","homepage","contributors","license","repository","bugs:","devDependencies","babel-cli","babel-preset-es2015","babelify","browserify","gulp","gulp-babel","gulp-browserify","gulp-livereload","gulp-sourcemaps","gulp-uglify","vinyl-buffer","vinyl-source-stream"],"mappings":"CAAA,QAAUA,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATC,UAAqBA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGI,EAAE,MAAOA,GAAEJ,GAAE,EAAI,IAAIK,GAAE,GAAIC,OAAM,uBAAuBN,EAAE,IAAK,MAAMK,GAAEE,KAAK,mBAAmBF,EAAE,G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,QAAQ,gBAChB,qCAAuChM,EACzCxC,KAAKoS,MAAQpS,KAAKoS,MACdpS,KAAKoS,MAAQ,IAAM/N,EACnBA,EAEJrE,KAAKoS,OAASpS,KAAKoS,OAAS,IAAM/N,GAGpCrE,KAAKoS,MAAQ/N,CAGf,QAAK3C,GAAO1B,KAAKoT,QAAQ/O,GAAcrE,MAGlCwC,GAAMxC,KAAKwC,KAAK,QACdxC,SAGN4T,cAAc,KAAKqB,IAAI,SAAS1X,EAAQU,EAAOJ,GAkBlD,QAAS+D,GAAQsT,EAAoB5U,EAAQqE,GAE3C,MAAI,kBAAqBA,GAChB,GAAIuQ,GAAmB,MAAO5U,GAAQiF,IAAIZ,GAI/C,GAAKqG,UAAUjN,OACV,GAAImX,GAAmB,MAAO5U,GAGhC,GAAI4U,GAAmB5U,EAAQqE,GAGxC1G,EAAOJ,QAAU+D,OAEXuT,IAAI,SAAS5X,EAAQU,EAAOJ,GAClCI,EAAOJ,SACL+L,KAAQ,QACRtL,QAAW,aACX8W,YAAe,4BACfC,KAAQ,SACRC,OAAU,MACVC,SAAY,kCACZC,cAAiB,iCAAkC,kCACnDC,QAAW,MACXC,YACElT,KAAQ,MACRmC,IAAO,mCAETgR,QAAS,uCACTC,iBACEC,YAAa,UACbC,sBAAuB,SACvBC,SAAY,SACZC,WAAc,UACdC,KAAQ,SACRC,aAAc,SACdC,kBAAmB,SACnBC,kBAAmB,SACnBC,kBAAmB,SACnBC,cAAe,SACf7P,WAAc,SACd8P,eAAgB,SAChBC,sBAAuB,qBAIhB","file":"vhx.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o _this.last) {\n throw 'No more pages to request';\n }\n\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'previousPage',\n value: function previousPage(_this, callback) {\n if (_this.page === 1) {\n throw 'No previous pages to request';\n }\n\n _this.options.page = _this.page - 1;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'firstPage',\n value: function firstPage(_this, callback) {\n _this.options.page = 1;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'lastPage',\n value: function lastPage(_this, callback) {\n _this.options.page = _this.last;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'goToPage',\n value: function goToPage(_this, num, callback) {\n num = parseInt(num, 10);\n\n if (num > 0 && num <= _this.last) {\n _this.options.page = num;\n return _this.resource[_this.method](_this.options, callback);\n }\n\n throw 'You must pass a valid page number';\n }\n }]);\n\n return Paginate;\n}();\n\nmodule.exports = Paginate;\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar request = require('superagent');\nvar paginate = require('./paginate');\n\nvar Resource = function () {\n function Resource(api, path, methods, isToken) {\n _classCallCheck(this, Resource);\n\n var _this = this;\n _this._api = api;\n _this.methods = methods;\n _this.path = path;\n\n _this.init();\n }\n\n _createClass(Resource, [{\n key: 'init',\n value: function init() {\n var _this = this;\n\n _this.methods.forEach(function (item) {\n var method = _this.getMethod(item),\n type = _this.getType(_this.path),\n params = {\n http_method: 'get', // superagent reads 'get' not 'GET'\n client_method: method\n };\n\n if (method.match(/retrieve|items|files/i)) {\n _this[method] = function (a, b, c) {\n if (a[type]) {\n if (_this.isCallbackFunction(b)) {\n params.callback = b;\n }\n params.id = _this.parseHref(a[type]);\n delete a[type];\n params.options = a;\n } else {\n params.id = _this.parseHref(a);\n if (_this.isCallbackFunction(b)) {\n params.callback = b;\n } else {\n params.options = b;\n params.callback = c;\n }\n }\n\n params.scope = item.scope ? item.scope : null;\n _this.makeRequest(params);\n };\n } else {\n _this[method] = function (options, callback) {\n params.options = options;\n params.callback = callback;\n\n _this.makeRequest(params);\n };\n }\n });\n }\n }, {\n key: 'getType',\n value: function getType(resource) {\n if (resource === 'collections') {\n return 'collection';\n }\n if (resource === 'customers') {\n return 'customer';\n }\n if (resource === 'videos') {\n return 'video';\n }\n\n return 'id';\n }\n }, {\n key: 'getMethod',\n value: function getMethod(params) {\n var _this = this;\n\n if (_this.isObject(params) && params.method) {\n return params.method;\n } else {\n return params;\n }\n }\n }, {\n key: 'parseHref',\n value: function parseHref(href) {\n var _this = this,\n val = void 0;\n\n if (parseInt(href, 10)) {\n return href;\n } else if (href.indexOf(_this._api.host) >= 0) {\n if (href.substr(-1) === '/') {\n href.substr(0, href.length - 1);\n }\n val = href.split('/');\n return val[val.length - 1];\n }\n }\n }, {\n key: 'getToken',\n value: function getToken(cb) {\n var _this = this;\n var path = '' + _this._api.protocol + window.location.host + '/tokens';\n\n request.post(path).set('X-CSRF-Token', $('meta[name=\"csrf-token\"]').attr('content')).then(function (data) {\n _this._api.token = data.body.token;\n if (cb) cb();\n }, function (data) {\n console.log(data);\n });\n }\n }, {\n key: 'timeStamp',\n value: function timeStamp() {\n return new Date().getTime();\n }\n }, {\n key: 'getParams',\n value: function getParams(client_method, id, options, scope) {\n var _this = this,\n params = {};\n\n params.url = _this._api.protocol + _this._api.host + '/' + _this.path;\n params.timeout = _this._api.timeout;\n\n if (_this._api.auth) {\n params.headers = {\n 'Authorization': _this._api.auth\n };\n }\n\n params.qs = options || null;\n\n if (!client_method.match(/^list$|^all$/)) {\n params.url += '/' + id;\n }\n\n if (client_method.match(/items/i)) {\n params.url += '/items';\n }\n\n if (client_method.match(/files/i)) {\n params.url += '/files';\n }\n\n if (scope) {\n params.url += '/' + scope;\n }\n\n return params;\n }\n }, {\n key: 'makeRequest',\n value: function makeRequest(args) {\n var _this = this;\n var params = _this.getParams(args.client_method, args.id || null, args.options, args.scope);\n\n if (_this.isCallbackFunction(args.options)) {\n args.callback = args.options;\n }\n\n if (_this._api.token !== undefined) {\n _this.getToken(function () {\n params.headers = {\n 'Authorization': 'Bearer ' + _this._api.token\n };\n\n _this.ajaxRequest(args, params);\n });\n } else {\n _this.ajaxRequest(args, params);\n }\n }\n }, {\n key: 'ajaxRequest',\n value: function ajaxRequest(args, params) {\n var _this = this;\n\n request[args.http_method](params.url).withCredentials().set(params.headers || {}).set('Content-Type', 'application/json').query(params.qs).end(function (err, response) {\n if (err && err.code === 'ETIMEDOUT') {\n _this.errorHandler({\n status: 408,\n body: '{\"message\": \"The request timed out.\",\"documentation_url\": \"http://dev.vhx.tv/docs/api\"}',\n callback: args.callback || ''\n });\n }\n\n if (!err && response.statusCode >= 200 && response.statusCode < 300) {\n _this.successHandler({\n body: response.body || null,\n callback: args.callback,\n options: args.options,\n object: _this.path,\n method: args.client_method\n });\n } else {\n _this.errorHandler({\n status: 408,\n body: '{\"message\": \"The request timed out.\",\"documentation_url\": \"http://dev.vhx.tv/docs/api\"}',\n callback: args.callback || ''\n });\n }\n });\n }\n }, {\n key: 'successHandler',\n value: function successHandler(args) {\n var response = args.body;\n\n if (args.body.count && args.body.count < args.body.total) {\n response = new paginate(this, args).get();\n }\n\n response.object = args.object;\n\n if (args.callback) {\n args.callback(false, response);\n }\n }\n }, {\n key: 'errorHandler',\n value: function errorHandler(args) {\n var error = JSON.parse(args.body),\n error_types = {\n 400: 'VHXInvalidRequestError',\n 401: 'VHXAuthenticationError',\n 404: 'VHXResourceNotFound',\n 408: 'VHXConnectionError',\n 500: 'VHXAPIError'\n };\n\n error.status = args.status;\n error.type = error_types[error.status];\n\n if (args.callback) {\n args.callback(error, null);\n }\n }\n }, {\n key: 'isCallbackFunction',\n value: function isCallbackFunction(obj) {\n return !!(obj && obj.constructor && obj.call && obj.apply);\n }\n }, {\n key: 'isObject',\n value: function isObject(obj) {\n var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj);\n return type === 'function' || type === 'object' && !!obj;\n }\n }]);\n\n return Resource;\n}();\n\n;\n\nmodule.exports = Resource;\n\n},{\"./paginate\":2,\"superagent\":11}],4:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Browse = function (_Resource) {\n _inherits(Browse, _Resource);\n\n function Browse(api) {\n _classCallCheck(this, Browse);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Browse).call(this, api, 'browse', ['all', 'list']));\n }\n\n return Browse;\n}(Resource);\n\n;\n\nmodule.exports = Browse;\n\n},{\"../resource\":3}],5:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Collection = function (_Resource) {\n _inherits(Collection, _Resource);\n\n function Collection(api) {\n _classCallCheck(this, Collection);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Collection).call(this, api, 'collections', ['all', 'list', 'items']));\n }\n\n return Collection;\n}(Resource);\n\n;\n\nmodule.exports = Collection;\n\n},{\"../resource\":3}],6:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Customer = function (_Resource) {\n _inherits(Customer, _Resource);\n\n function Customer(api) {\n _classCallCheck(this, Customer);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Customer).call(this, api, 'customers', ['retrieve', 'all']));\n }\n\n return Customer;\n}(Resource);\n\n;\n\nmodule.exports = Customer;\n\n},{\"../resource\":3}],7:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Product = function (_Resource) {\n _inherits(Product, _Resource);\n\n function Product(api) {\n _classCallCheck(this, Product);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Product).call(this, api, 'products', ['retrieve', 'all']));\n }\n\n return Product;\n}(Resource);\n\n;\n\nmodule.exports = Product;\n\n},{\"../resource\":3}],8:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Video = function (_Resource) {\n _inherits(Video, _Resource);\n\n function Video(api) {\n _classCallCheck(this, Video);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Video).call(this, api, 'videos', ['all', 'retrieve', 'files']));\n }\n\n return Video;\n}(Resource);\n\n;\n\nmodule.exports = Video;\n\n},{\"../resource\":3}],9:[function(require,module,exports){\n'use strict';\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _defaults = require('./defaults');\n\nvar _defaults2 = _interopRequireDefault(_defaults);\n\nvar _collections = require('./resources/collections');\n\nvar _collections2 = _interopRequireDefault(_collections);\n\nvar _videos = require('./resources/videos');\n\nvar _videos2 = _interopRequireDefault(_videos);\n\nvar _customers = require('./resources/customers');\n\nvar _customers2 = _interopRequireDefault(_customers);\n\nvar _products = require('./resources/products');\n\nvar _products2 = _interopRequireDefault(_products);\n\nvar _browse = require('./resources/browse');\n\nvar _browse2 = _interopRequireDefault(_browse);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar resources = {\n collections: _collections2.default,\n videos: _videos2.default,\n products: _products2.default,\n customer: _customers2.default,\n browse: _browse2.default\n};\n\nvar vhx = function () {\n function vhx(key) {\n _classCallCheck(this, vhx);\n\n var _this = this;\n\n if (!(_this instanceof vhx)) {\n return new vhx(key);\n }\n\n _this.api = key ? _this.setApi(key) : _this.setToken();\n _this.prepareResources();\n }\n\n _createClass(vhx, [{\n key: 'setApi',\n value: function setApi(key) {\n return {\n auth: 'Basic ' + btoa(key),\n host: _defaults2.default.HOST,\n protocol: _defaults2.default.PROTOCOL,\n timeout: _defaults2.default.TIMEOUT\n };\n }\n }, {\n key: 'setToken',\n value: function setToken() {\n return {\n token: null,\n host: _defaults2.default.HOST,\n protocol: _defaults2.default.PROTOCOL,\n timeout: _defaults2.default.TIMEOUT,\n token_host: _defaults2.default.TOKEN_HOST\n };\n }\n }, {\n key: 'prepareResources',\n value: function prepareResources() {\n var _this = this;\n\n for (var name in resources) {\n _this[name[0].toLowerCase() + name.substring(1)] = new resources[name](_this.api);\n }\n }\n }]);\n\n return vhx;\n}();\n\nwindow.vhx = vhx;\n\n},{\"./defaults\":1,\"./resources/browse\":4,\"./resources/collections\":5,\"./resources/customers\":6,\"./resources/products\":7,\"./resources/videos\":8}],10:[function(require,module,exports){\n\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n},{}],11:[function(require,module,exports){\n/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('emitter');\nvar requestBase = require('./request-base');\nvar isObject = require('./is-object');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = module.exports = require('./request').bind(null, Request);\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n if (null != obj[key]) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (Array.isArray(val)) {\n return val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n return;\n }\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction type(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction params(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */),\n key = parts.shift(),\n val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req, options) {\n options = options || {};\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n this._setStatusProperties(this.xhr.status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponse.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponse.prototype._setHeaderProperties = function(header){\n // content-type\n var ct = this.header['content-type'] || '';\n this.type = type(ct);\n\n // params\n var obj = params(ct);\n for (var key in obj) this[key] = obj[key];\n};\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponse.prototype._setStatusProperties = function(status){\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.notFound = 404 == status;\n this.forbidden = 403 == status;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;\n // issue #876: return the http status code if the response parsing fails\n err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (res.status < 200 || res.status >= 300) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `requestBase`.\n */\n\nEmitter(Request.prototype);\nfor (var key in requestBase) {\n Request.prototype[key] = requestBase[key];\n}\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set responseType to `val`. Presently valid responseTypes are 'blob' and\n * 'arraybuffer'.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} pass\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (!options) {\n options = {\n type: 'basic'\n }\n }\n\n switch (options.type) {\n case 'basic':\n var str = btoa(user + ':' + pass);\n this.set('Authorization', 'Basic ' + str);\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n }\n return this;\n};\n\n/**\n* Add query-string `val`.\n*\n* Examples:\n*\n* request.get('/shoes')\n* .query('size=10')\n* .query({ color: 'blue' })\n*\n* @param {Object|String} val\n* @return {Request} for chaining\n* @api public\n*/\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `filename`.\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['hey!'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String} filename\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, filename){\n this._getFormData().append(field, file, filename || file.name);\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n var fn = this._callback;\n this.clearTimeout();\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequest.prototype._timeoutError = function(){\n var timeout = this._timeout;\n var err = new Error('timeout of ' + timeout + 'ms exceeded');\n err.timeout = timeout;\n this.callback(err);\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += ~this.url.indexOf('?')\n ? '&' + query\n : '?' + query;\n }\n};\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var timeout = this._timeout;\n var data = this._formData || this._data;\n\n // store callback\n this._callback = fn || noop;\n\n // state change\n xhr.onreadystatechange = function(){\n if (4 != xhr.readyState) return;\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (0 == status) {\n if (self.timedout) return self._timeoutError();\n if (self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(e){\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = 'download';\n self.emit('progress', e);\n };\n if (this.hasListeners('progress')) {\n xhr.onprogress = handleProgress;\n }\n try {\n if (xhr.upload && this.hasListeners('progress')) {\n xhr.upload.onprogress = handleProgress;\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n\n // timeout\n if (timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self.timedout = true;\n self.abort();\n }, timeout);\n }\n\n // querystring\n this._appendQueryString();\n\n // initiate request\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n\n/**\n * Expose `Request`.\n */\n\nrequest.Request = Request;\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n},{\"./is-object\":12,\"./request\":14,\"./request-base\":13,\"emitter\":10}],12:[function(require,module,exports){\n/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n\n},{}],13:[function(require,module,exports){\n/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nexports.clearTimeout = function _clearTimeout(){\n this._timeout = 0;\n clearTimeout(this._timer);\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nexports.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nexports.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeout to `ms`.\n *\n * @param {Number} ms\n * @return {Request} for chaining\n * @api public\n */\n\nexports.timeout = function timeout(ms){\n this._timeout = ms;\n return this;\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} reject\n * @return {Request}\n */\n\nexports.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\n/**\n * Allow for extension\n */\n\nexports.use = function use(fn) {\n fn(this);\n return this;\n}\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nexports.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nexports.getHeader = exports.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nexports.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nexports.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val` for \"multipart/form-data\"\n * request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n * ```\n *\n * @param {String} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nexports.field = function(name, val) {\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nexports.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nexports.withCredentials = function(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nexports.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nexports.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * TODO: future proof, move to compoent land\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nexports._isHost = function _isHost(obj) {\n var str = {}.toString.call(obj);\n\n switch (str) {\n case '[object File]':\n case '[object Blob]':\n case '[object FormData]':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nexports.send = function(data){\n var obj = isObject(data);\n var type = this._header['content-type'];\n\n // merge\n if (obj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!obj || this._isHost(data)) return this;\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n\n},{\"./is-object\":12}],14:[function(require,module,exports){\n// The node and browser modules expose versions of this with the\n// appropriate constructor function bound as first argument\n/**\n * Issue a request:\n *\n * Examples:\n *\n * request('GET', '/users').end(callback)\n * request('/users').end(callback)\n * request('/users', callback)\n *\n * @param {String} method\n * @param {String|Function} url or callback\n * @return {Request}\n * @api public\n */\n\nfunction request(RequestConstructor, method, url) {\n // callback\n if ('function' == typeof url) {\n return new RequestConstructor('GET', method).end(url);\n }\n\n // url first\n if (2 == arguments.length) {\n return new RequestConstructor('GET', method);\n }\n\n return new RequestConstructor(method, url);\n}\n\nmodule.exports = request;\n\n},{}],15:[function(require,module,exports){\nmodule.exports={\n \"name\": \"vhxjs\",\n \"version\": \"1.0.0-beta\",\n \"description\": \"VHX Javascript API Client\",\n \"main\": \"vhx.js\",\n \"author\": \"VHX\",\n \"homepage\": \"https://github.com/vhx/vhx-node\",\n \"contributors\": [\"David Gonzalez \", \"Scott Robertson \"],\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/vhx/vhx-js.git\"\n },\n \"bugs:\": \"https://github.com/vhx/vhx-js/issues\",\n \"devDependencies\": {\n \"babel-cli\": \"^6.11.4\",\n \"babel-preset-es2015\": \"^6.9.0\",\n \"babelify\": \"^7.3.0\",\n \"browserify\": \"^13.1.0\",\n \"gulp\": \"^3.9.1\",\n \"gulp-babel\": \"^6.1.2\",\n \"gulp-browserify\": \"^0.5.1\",\n \"gulp-livereload\": \"^3.8.1\",\n \"gulp-sourcemaps\": \"^1.6.0\",\n \"gulp-uglify\": \"^1.5.4\",\n \"superagent\": \"^2.1.0\",\n \"vinyl-buffer\": \"^1.0.0\",\n \"vinyl-source-stream\": \"^1.1.0\"\n }\n}\n\n},{}]},{},[9])\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvZGVmYXVsdHMuanMiLCJsaWIvcGFnaW5hdGUuanMiLCJsaWIvcmVzb3VyY2UuanMiLCJsaWIvcmVzb3VyY2VzL2Jyb3dzZS5qcyIsImxpYi9yZXNvdXJjZXMvY29sbGVjdGlvbnMuanMiLCJsaWIvcmVzb3VyY2VzL2N1c3RvbWVycy5qcyIsImxpYi9yZXNvdXJjZXMvcHJvZHVjdHMuanMiLCJsaWIvcmVzb3VyY2VzL3ZpZGVvcy5qcyIsImxpYi92aHguanMiLCJub2RlX21vZHVsZXMvY29tcG9uZW50LWVtaXR0ZXIvaW5kZXguanMiLCJub2RlX21vZHVsZXMvc3VwZXJhZ2VudC9saWIvY2xpZW50LmpzIiwibm9kZV9tb2R1bGVzL3N1cGVyYWdlbnQvbGliL2lzLW9iamVjdC5qcyIsIm5vZGVfbW9kdWxlcy9zdXBlcmFnZW50L2xpYi9yZXF1ZXN0LWJhc2UuanMi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1xuICAgIF90aGlzLl9hcGkgICAgPSBhcGk7XG4gICAgX3RoaXMubWV0aG9kcyA9IG1ldGhvZHM7XG4gICAgX3RoaXMucGF0aCAgICA9IHBhdGg7XG5cbiAgICBfdGhpcy5pbml0KCk7XG4gIH1cblxuICBpbml0KCkge1xuICAgIGxldCBfdGhpcyA9IHRoaXM7XG5cbiAgICBfdGhpcy5tZXRob2RzLmZvckVhY2goZnVuY3Rpb24oaXRlbSkge1xuICAgICAgbGV0IG1ldGhvZCA9IF90aGlzLmdldE1ldGhvZChpdGVtKSxcbiAgICAgICAgICB0eXBlID0gX3RoaXMuZ2V0VHlwZShfdGhpcy5wYXRoKSxcbiAgICAgICAgICBwYXJhbXMgPSB7XG4gICAgICAgICAgICBodHRwX21ldGhvZDogJ2dldCcsIC8vIHN1cGVyYWdlbnQgcmVhZHMgJ2dldCcgbm90ICdHRVQnXG4gICAgICAgICAgICBjbGllbnRfbWV0aG9kOiBtZXRob2RcbiAgICAgICAgICB9O1xuXG4gICAgICBpZiAobWV0aG9kLm1hdGNoKC9yZXRyaWV2ZXxpdGVtc3xmaWxlcy9pKSkge1xuICAgICAgICBfdGhpc1ttZXRob2RdID0gZnVuY3Rpb24oYSwgYiwgYykge1xuICAgICAgICAgIGlmIChhW3R5cGVdKSB7XG4gICAgICAgICAgIGlmIChfdGhpcy5pc0NhbGxiYWNrRnVuY3Rpb24oYikpIHtcbiAgICAgICAgICAgICBwYXJhbXMuY2FsbGJhY2sgPSBiO1xuICAgICAgICAgICB9XG4gICAgICAgICAgICBwYXJhbXMuaWQgPSBfdGhpcy5wYXJzZUhyZWYoYVt0eXBlXSk7XG4gICAgICAgICAgICBkZWxldGUgYVt0eXBlXTtcbiAgICAgICAgICAgIHBhcmFtcy5vcHRpb25zID0gYTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBwYXJhbXMuaWQgPSBfdGhpcy5wYXJzZUhyZWYoYSk7XG4gICAgICAgICAgICBpZi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ih7XG4gICAgICAgICAgICBzdGF0dXM6IDQwOCxcbiAgICAgICAgICAgIGJvZHk6ICd7XCJtZXNzYWdlXCI6IFwiVGhlIHJlcXVlc3QgdGltZWQgb3V0LlwiLFwiZG9jdW1lbnRhdGlvbl91cmxcIjogXCJodHRwOi8vZGV2LnZoeC50di9kb2NzL2FwaVwifScsXG4gICAgICAgICAgICBjYWxsYmFjazogKGFyZ3MuY2FsbGJhY2sgfHwgJycpXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWVyciAmJiByZXNwb25zZS5zdGF0dXNDb2RlID49IDIwMCAmJiByZXNwb25zZS5zdGF0dXNDb2RlIDwgMzAwKSB7XG4gICAgICAgICAgX3RoaXMuc3VjY2Vzc0hhbmRsZXIoe1xuICAgICAgICAgICAgYm9keTogcmVzcG9uc2UuYm9keSB8fCBudWxsLFxuICAgICAgICAgICAgY2FsbGJhY2s6IGFyZ3MuY2FsbGJhY2ssXG4gICAgICAgICAgICBvcHRpb25zOiBhcmdzLm9wdGlvbnMsXG4gICAgICAgICAgICBvYmplY3Q6IF90aGlzLnBhdGgsXG4gICAgICAgICAgICBtZXRob2Q6IGFyZ3MuY2xpZW50X21ldGhvZFxuICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIF90aGlzLmVycm9ySGFuZGxlcih7XG4gICAgICAgICAgICBzdGF0dXM6IDQwOCxcbiAgICAgICAgICAgIGJvZHk6ICd7XCJtZXNzYWdlXCI6IFwiVGhlIHJlcXVlc3QgdGltZWQgb3V0LlwiLFwiZG9jdW1lbnRhdGlvbl91cmxcIjogXCJodHRwOi8vZGV2LnZoeC50di9kb2NzL2FwaVwifScsXG4gICAgICAgICAgICBjYWxsYmFjazogKGFyZ3MuY2FsbGJhY2sgfHwgJycpXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICB9XG5cbiAgc3VjY2Vzc0hhbmRsZXIoYXJncykge1xuIC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4iXX0=\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["vhx.min.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length","1","module","_VHX_DEFAULTS","HOST","PROTOCOL","API_VERSION","version","TIMEOUT","TOKEN_HOST","../package.json","2","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","Paginate","resource","args","this","_this","response","body","options","page","method","last","Math","ceil","total","count","map","callback","goToPage","num","merge","_embedded","object","concat","value","parseInt","3","_typeof","Symbol","iterator","obj","constructor","request","paginate","Resource","api","path","methods","isToken","_api","init","forEach","item","getMethod","type","getType","params","http_method","client_method","match","b","c","isCallbackFunction","id","parseHref","scope","makeRequest","isObject","href","val","indexOf","host","substr","split","cb","protocol","window","location","post","set","$","attr","then","data","token","console","log","Date","getTime","url","timeout","auth","headers","Authorization","qs","getParams","undefined","getToken","ajaxRequest","withCredentials","query","end","err","errorHandler","status","statusCode","successHandler","get","error","JSON","parse","error_types","400","401","404","408","500","apply","./paginate","superagent","4","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","Browse","_Resource","getPrototypeOf","../resource","5","Collection","6","Customer","7","Product","8","Video","9","_interopRequireDefault","__esModule","default","_defaults","_defaults2","_collections","_collections2","_videos","_videos2","_customers","_customers2","_products","_products2","_browse","_browse2","resources","collections","videos","products","customer","browse","vhx","setApi","setToken","prepareResources","btoa","token_host","name","toLowerCase","substring","./defaults","./resources/browse","./resources/collections","./resources/customers","./resources/products","./resources/videos","10","noop","serialize","pairs","pushEncodedKeyValuePair","join","Array","isArray","v","subkey","push","encodeURIComponent","parseString","str","pair","pos","len","decodeURIComponent","slice","parseHeader","index","line","field","lines","fields","pop","trim","isJSON","mime","test","shift","reduce","parts","Response","req","xhr","text","responseType","responseText","statusText","_setStatusProperties","header","getAllResponseHeaders","getResponseHeader","_setHeaderProperties","_parseBody","Request","_query","_header","on","res","original","rawResponse","emit","new_err","del","fn","root","warn","Emitter","requestBase","bind","getXHR","XMLHttpRequest","ActiveXObject","replace","serializeObject","types","html","json","xml","urlencoded","form","form-data","application/x-www-form-urlencoded","application/json","stringify","ct","statusType","info","ok","clientError","serverError","toError","accepted","noContent","badRequest","unauthorized","notAcceptable","notFound","forbidden","msg","_responseType","accept","user","pass","username","password","attach","file","filename","_getFormData","append","_formData","FormData","_callback","clearTimeout","crossDomainError","crossDomain","_timeoutError","_timeout","_appendQueryString","_data","onreadystatechange","readyState","timedout","_aborted","handleProgress","percent","loaded","direction","hasListeners","onprogress","upload","_timer","setTimeout","abort","open","_withCredentials","_isHost","contentType","_serializer","setRequestHeader","send","head","patch","put","./is-object","./request","./request-base","emitter","11","12","_parser","ms","resolve","reject","_fullfilledPromise","Promise","innerResolve","innerReject","use","getHeader","unset","redirects","_maxRedirects","toJSON","toString","13","RequestConstructor","arguments","14","mixin","addEventListener","event","_callbacks","once","off","removeListener","removeAllListeners","removeEventListener","callbacks","splice","listeners","15","description","main","author","homepage","contributors","license","repository","bugs:","devDependencies","babel-cli","babel-preset-es2015","babelify","browserify","gulp","gulp-babel","gulp-browserify","gulp-livereload","gulp-sourcemaps","gulp-uglify","vinyl-buffer","vinyl-source-stream"],"mappings":"CAAA,QAAUA,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATC,UAAqBA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGI,EAAE,MAAOA,GAAEJ,GAAE,EAAI,IAAIK,GAAE,GAAIC,OAAM,uBAAuBN,EAAE,IAAK,MAAMK,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEX,EAAEG,IAAIS,WAAYb,GAAEI,GAAG,GAAGU,KAAKF,EAAEC,QAAQ,SAASd,GAAG,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,WAAa1U,KAAK0U,cACvB,IAAI3U,MAAUwL,MAAMzN,KAAKuW,UAAW,GAChCW,EAAYhV,KAAK0U,WAAW,IAAMD,EAEtC,IAAIO,EAAW,CACbA,EAAYA,EAAUzJ,MAAM,EAC5B,KAAK,GAAI/N,GAAI,EAAG6N,EAAM2J,EAAUjX,OAAQP,EAAI6N,IAAO7N,EACjDwX,EAAUxX,GAAG+I,MAAMvG,KAAMD,GAI7B,MAAOC,OAWTgO,EAAQpO,UAAUsV,UAAY,SAAST,GAErC,MADAzU,MAAK0U,WAAa1U,KAAK0U,eAChB1U,KAAK0U,WAAW,IAAMD,QAW/BzG,EAAQpO,UAAUkS,aAAe,SAAS2C,GACxC,QAAUzU,KAAKkV,UAAUT,GAAO1W,aAG5BoX,IAAI,SAAS5X,EAAQU,EAAOJ,GAClCI,EAAOJ,SACL+L,KAAQ,QACRtL,QAAW,eACX8W,YAAe,4BACfC,KAAQ,SACRC,OAAU,MACVC,SAAY,kCACZC,cAAiB,iCAAkC,kCACnDC,QAAW,MACXC,YACElT,KAAQ,MACRmC,IAAO,mCAETgR,QAAS,uCACTC,iBACEC,YAAa,UACbC,sBAAuB,SACvBC,SAAY,SACZC,WAAc,UACdC,KAAQ,SACRC,aAAc,SACdC,kBAAmB,SACnBC,kBAAmB,SACnBC,kBAAmB,SACnBC,cAAe,SACf7P,WAAc,SACd8P,eAAgB,SAChBC,sBAAuB,qBAIhB","file":"vhx.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o _this.last) {\n throw 'No more pages to request';\n }\n\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'previousPage',\n value: function previousPage(_this, callback) {\n if (_this.page === 1) {\n throw 'No previous pages to request';\n }\n\n _this.options.page = _this.page - 1;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'firstPage',\n value: function firstPage(_this, callback) {\n _this.options.page = 1;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'lastPage',\n value: function lastPage(_this, callback) {\n _this.options.page = _this.last;\n _this.resource[_this.method](_this.options, callback);\n }\n }, {\n key: 'goToPage',\n value: function goToPage(_this, num, callback) {\n num = parseInt(num, 10);\n\n if (num > 0 && num <= _this.last) {\n _this.options.page = num;\n return _this.resource[_this.method](_this.options, callback);\n }\n\n throw 'You must pass a valid page number';\n }\n }]);\n\n return Paginate;\n}();\n\nmodule.exports = Paginate;\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar request = require('superagent');\nvar paginate = require('./paginate');\n\nvar Resource = function () {\n function Resource(api, path, methods, isToken) {\n _classCallCheck(this, Resource);\n\n var _this = this;\n _this._api = api;\n _this.methods = methods;\n _this.path = path;\n\n _this.init();\n }\n\n _createClass(Resource, [{\n key: 'init',\n value: function init() {\n var _this = this;\n\n _this.methods.forEach(function (item) {\n var method = _this.getMethod(item),\n type = _this.getType(_this.path),\n params = {\n http_method: 'get', // superagent reads 'get' not 'GET'\n client_method: method\n };\n\n if (method.match(/retrieve|items|files/i)) {\n _this[method] = function (a, b, c) {\n if (a[type]) {\n if (_this.isCallbackFunction(b)) {\n params.callback = b;\n }\n params.id = _this.parseHref(a[type]);\n delete a[type];\n params.options = a;\n } else {\n params.id = _this.parseHref(a);\n if (_this.isCallbackFunction(b)) {\n params.callback = b;\n } else {\n params.options = b;\n params.callback = c;\n }\n }\n\n params.scope = item.scope ? item.scope : null;\n _this.makeRequest(params);\n };\n } else {\n _this[method] = function (options, callback) {\n params.options = options;\n params.callback = callback;\n\n _this.makeRequest(params);\n };\n }\n });\n }\n }, {\n key: 'getType',\n value: function getType(resource) {\n if (resource === 'collections') {\n return 'collection';\n }\n if (resource === 'customers') {\n return 'customer';\n }\n if (resource === 'videos') {\n return 'video';\n }\n\n return 'id';\n }\n }, {\n key: 'getMethod',\n value: function getMethod(params) {\n var _this = this;\n\n if (_this.isObject(params) && params.method) {\n return params.method;\n } else {\n return params;\n }\n }\n }, {\n key: 'parseHref',\n value: function parseHref(href) {\n var _this = this,\n val = void 0;\n\n if (parseInt(href, 10)) {\n return href;\n } else if (href.indexOf(_this._api.host) >= 0) {\n if (href.substr(-1) === '/') {\n href.substr(0, href.length - 1);\n }\n val = href.split('/');\n return val[val.length - 1];\n }\n }\n }, {\n key: 'getToken',\n value: function getToken(cb) {\n var _this = this;\n var path = '' + _this._api.protocol + window.location.host + '/tokens';\n\n request.post(path).set('X-CSRF-Token', $('meta[name=\"csrf-token\"]').attr('content')).then(function (data) {\n _this._api.token = data.body.token;\n if (cb) cb();\n }, function (data) {\n console.log(data);\n });\n }\n }, {\n key: 'timeStamp',\n value: function timeStamp() {\n return new Date().getTime();\n }\n }, {\n key: 'getParams',\n value: function getParams(client_method, id, options, scope) {\n var _this = this,\n params = {};\n\n params.url = _this._api.protocol + _this._api.host + '/' + _this.path;\n params.timeout = _this._api.timeout;\n\n if (_this._api.auth) {\n params.headers = {\n 'Authorization': _this._api.auth\n };\n }\n\n params.qs = options || null;\n\n if (!client_method.match(/^list$|^all$/)) {\n params.url += '/' + id;\n }\n\n if (client_method.match(/items/i)) {\n params.url += '/items';\n }\n\n if (client_method.match(/files/i)) {\n params.url += '/files';\n }\n\n if (scope) {\n params.url += '/' + scope;\n }\n\n return params;\n }\n }, {\n key: 'makeRequest',\n value: function makeRequest(args) {\n var _this = this;\n var params = _this.getParams(args.client_method, args.id || null, args.options, args.scope);\n\n if (_this.isCallbackFunction(args.options)) {\n args.callback = args.options;\n }\n\n if (_this._api.token !== undefined) {\n _this.getToken(function () {\n params.headers = {\n 'Authorization': 'Bearer ' + _this._api.token\n };\n\n _this.ajaxRequest(args, params);\n });\n } else {\n _this.ajaxRequest(args, params);\n }\n }\n }, {\n key: 'ajaxRequest',\n value: function ajaxRequest(args, params) {\n var _this = this;\n\n request[args.http_method](params.url).withCredentials().set(params.headers || {}).set('Content-Type', 'application/json').query(params.qs).end(function (err, response) {\n if (err && err.code === 'ETIMEDOUT') {\n _this.errorHandler({\n status: 408,\n body: '{\"message\": \"The request timed out.\",\"documentation_url\": \"http://dev.vhx.tv/docs/api\"}',\n callback: args.callback || ''\n });\n }\n\n if (!err && response.statusCode >= 200 && response.statusCode < 300) {\n _this.successHandler({\n body: response.body || null,\n callback: args.callback,\n options: args.options,\n object: _this.path,\n method: args.client_method\n });\n } else {\n _this.errorHandler({\n status: 408,\n body: '{\"message\": \"The request timed out.\",\"documentation_url\": \"http://dev.vhx.tv/docs/api\"}',\n callback: args.callback || ''\n });\n }\n });\n }\n }, {\n key: 'successHandler',\n value: function successHandler(args) {\n var response = args.body;\n\n if (args.body.count && args.body.count < args.body.total) {\n response = new paginate(this, args).get();\n }\n\n response.object = args.object;\n\n if (args.callback) {\n args.callback(false, response);\n }\n }\n }, {\n key: 'errorHandler',\n value: function errorHandler(args) {\n var error = JSON.parse(args.body),\n error_types = {\n 400: 'VHXInvalidRequestError',\n 401: 'VHXAuthenticationError',\n 404: 'VHXResourceNotFound',\n 408: 'VHXConnectionError',\n 500: 'VHXAPIError'\n };\n\n error.status = args.status;\n error.type = error_types[error.status];\n\n if (args.callback) {\n args.callback(error, null);\n }\n }\n }, {\n key: 'isCallbackFunction',\n value: function isCallbackFunction(obj) {\n return !!(obj && obj.constructor && obj.call && obj.apply);\n }\n }, {\n key: 'isObject',\n value: function isObject(obj) {\n var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj);\n return type === 'function' || type === 'object' && !!obj;\n }\n }]);\n\n return Resource;\n}();\n\n;\n\nmodule.exports = Resource;\n\n},{\"./paginate\":2,\"superagent\":10}],4:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Browse = function (_Resource) {\n _inherits(Browse, _Resource);\n\n function Browse(api) {\n _classCallCheck(this, Browse);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Browse).call(this, api, 'browse', ['all', 'list']));\n }\n\n return Browse;\n}(Resource);\n\n;\n\nmodule.exports = Browse;\n\n},{\"../resource\":3}],5:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Collection = function (_Resource) {\n _inherits(Collection, _Resource);\n\n function Collection(api) {\n _classCallCheck(this, Collection);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Collection).call(this, api, 'collections', ['all', 'list', 'items']));\n }\n\n return Collection;\n}(Resource);\n\n;\n\nmodule.exports = Collection;\n\n},{\"../resource\":3}],6:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Customer = function (_Resource) {\n _inherits(Customer, _Resource);\n\n function Customer(api) {\n _classCallCheck(this, Customer);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Customer).call(this, api, 'customers', ['retrieve', 'all']));\n }\n\n return Customer;\n}(Resource);\n\n;\n\nmodule.exports = Customer;\n\n},{\"../resource\":3}],7:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Product = function (_Resource) {\n _inherits(Product, _Resource);\n\n function Product(api) {\n _classCallCheck(this, Product);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Product).call(this, api, 'products', ['retrieve', 'all']));\n }\n\n return Product;\n}(Resource);\n\n;\n\nmodule.exports = Product;\n\n},{\"../resource\":3}],8:[function(require,module,exports){\n'use strict';\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar Resource = require('../resource');\n\nvar Video = function (_Resource) {\n _inherits(Video, _Resource);\n\n function Video(api) {\n _classCallCheck(this, Video);\n\n return _possibleConstructorReturn(this, Object.getPrototypeOf(Video).call(this, api, 'videos', ['all', 'retrieve', 'files']));\n }\n\n return Video;\n}(Resource);\n\n;\n\nmodule.exports = Video;\n\n},{\"../resource\":3}],9:[function(require,module,exports){\n'use strict';\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _defaults = require('./defaults');\n\nvar _defaults2 = _interopRequireDefault(_defaults);\n\nvar _collections = require('./resources/collections');\n\nvar _collections2 = _interopRequireDefault(_collections);\n\nvar _videos = require('./resources/videos');\n\nvar _videos2 = _interopRequireDefault(_videos);\n\nvar _customers = require('./resources/customers');\n\nvar _customers2 = _interopRequireDefault(_customers);\n\nvar _products = require('./resources/products');\n\nvar _products2 = _interopRequireDefault(_products);\n\nvar _browse = require('./resources/browse');\n\nvar _browse2 = _interopRequireDefault(_browse);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar resources = {\n collections: _collections2.default,\n videos: _videos2.default,\n products: _products2.default,\n customer: _customers2.default,\n browse: _browse2.default\n};\n\nvar vhx = function () {\n function vhx(key) {\n _classCallCheck(this, vhx);\n\n var _this = this;\n\n if (!(_this instanceof vhx)) {\n return new vhx(key);\n }\n\n _this.api = key ? _this.setApi(key) : _this.setToken();\n _this.prepareResources();\n }\n\n _createClass(vhx, [{\n key: 'setApi',\n value: function setApi(key) {\n return {\n auth: 'Basic ' + btoa(key),\n host: _defaults2.default.HOST,\n protocol: _defaults2.default.PROTOCOL,\n timeout: _defaults2.default.TIMEOUT\n };\n }\n }, {\n key: 'setToken',\n value: function setToken() {\n return {\n token: null,\n host: _defaults2.default.HOST,\n protocol: _defaults2.default.PROTOCOL,\n timeout: _defaults2.default.TIMEOUT,\n token_host: _defaults2.default.TOKEN_HOST\n };\n }\n }, {\n key: 'prepareResources',\n value: function prepareResources() {\n var _this = this;\n\n for (var name in resources) {\n _this[name[0].toLowerCase() + name.substring(1)] = new resources[name](_this.api);\n }\n }\n }]);\n\n return vhx;\n}();\n\nwindow.vhx = vhx;\n\n},{\"./defaults\":1,\"./resources/browse\":4,\"./resources/collections\":5,\"./resources/customers\":6,\"./resources/products\":7,\"./resources/videos\":8}],10:[function(require,module,exports){\n/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('emitter');\nvar requestBase = require('./request-base');\nvar isObject = require('./is-object');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = module.exports = require('./request').bind(null, Request);\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (val != null) {\n if (Array.isArray(val)) {\n val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n } else {\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n }\n } else if (val === null) {\n pairs.push(encodeURIComponent(key));\n }\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction type(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction params(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */),\n key = parts.shift(),\n val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req, options) {\n options = options || {};\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n this._setStatusProperties(this.xhr.status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponse.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponse.prototype._setHeaderProperties = function(header){\n // content-type\n var ct = this.header['content-type'] || '';\n this.type = type(ct);\n\n // params\n var obj = params(ct);\n for (var key in obj) this[key] = obj[key];\n};\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponse.prototype._setStatusProperties = function(status){\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.notFound = 404 == status;\n this.forbidden = 403 == status;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;\n // issue #876: return the http status code if the response parsing fails\n err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (res.status < 200 || res.status >= 300) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `requestBase`.\n */\n\nEmitter(Request.prototype);\nfor (var key in requestBase) {\n Request.prototype[key] = requestBase[key];\n}\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set responseType to `val`. Presently valid responseTypes are 'blob' and\n * 'arraybuffer'.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} pass\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (!options) {\n options = {\n type: 'basic'\n }\n }\n\n switch (options.type) {\n case 'basic':\n var str = btoa(user + ':' + pass);\n this.set('Authorization', 'Basic ' + str);\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n }\n return this;\n};\n\n/**\n* Add query-string `val`.\n*\n* Examples:\n*\n* request.get('/shoes')\n* .query('size=10')\n* .query({ color: 'blue' })\n*\n* @param {Object|String} val\n* @return {Request} for chaining\n* @api public\n*/\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `filename`.\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['hey!'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String} filename\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, filename){\n this._getFormData().append(field, file, filename || file.name);\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n var fn = this._callback;\n this.clearTimeout();\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequest.prototype._timeoutError = function(){\n var timeout = this._timeout;\n var err = new Error('timeout of ' + timeout + 'ms exceeded');\n err.timeout = timeout;\n this.callback(err);\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += ~this.url.indexOf('?')\n ? '&' + query\n : '?' + query;\n }\n};\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var timeout = this._timeout;\n var data = this._formData || this._data;\n\n // store callback\n this._callback = fn || noop;\n\n // state change\n xhr.onreadystatechange = function(){\n if (4 != xhr.readyState) return;\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (0 == status) {\n if (self.timedout) return self._timeoutError();\n if (self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(e){\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = 'download';\n self.emit('progress', e);\n };\n if (this.hasListeners('progress')) {\n xhr.onprogress = handleProgress;\n }\n try {\n if (xhr.upload && this.hasListeners('progress')) {\n xhr.upload.onprogress = handleProgress;\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n\n // timeout\n if (timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self.timedout = true;\n self.abort();\n }, timeout);\n }\n\n // querystring\n this._appendQueryString();\n\n // initiate request\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n\n/**\n * Expose `Request`.\n */\n\nrequest.Request = Request;\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n},{\"./is-object\":11,\"./request\":13,\"./request-base\":12,\"emitter\":14}],11:[function(require,module,exports){\n/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n\n},{}],12:[function(require,module,exports){\n/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nexports.clearTimeout = function _clearTimeout(){\n this._timeout = 0;\n clearTimeout(this._timer);\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nexports.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nexports.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeout to `ms`.\n *\n * @param {Number} ms\n * @return {Request} for chaining\n * @api public\n */\n\nexports.timeout = function timeout(ms){\n this._timeout = ms;\n return this;\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} reject\n * @return {Request}\n */\n\nexports.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\n/**\n * Allow for extension\n */\n\nexports.use = function use(fn) {\n fn(this);\n return this;\n}\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nexports.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nexports.getHeader = exports.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nexports.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nexports.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val` for \"multipart/form-data\"\n * request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n * ```\n *\n * @param {String} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nexports.field = function(name, val) {\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nexports.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nexports.withCredentials = function(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nexports.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nexports.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * TODO: future proof, move to compoent land\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nexports._isHost = function _isHost(obj) {\n var str = {}.toString.call(obj);\n\n switch (str) {\n case '[object File]':\n case '[object Blob]':\n case '[object FormData]':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nexports.send = function(data){\n var obj = isObject(data);\n var type = this._header['content-type'];\n\n // merge\n if (obj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!obj || this._isHost(data)) return this;\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n\n},{\"./is-object\":11}],13:[function(require,module,exports){\n// The node and browser modules expose versions of this with the\n// appropriate constructor function bound as first argument\n/**\n * Issue a request:\n *\n * Examples:\n *\n * request('GET', '/users').end(callback)\n * request('/users').end(callback)\n * request('/users', callback)\n *\n * @param {String} method\n * @param {String|Function} url or callback\n * @return {Request}\n * @api public\n */\n\nfunction request(RequestConstructor, method, url) {\n // callback\n if ('function' == typeof url) {\n return new RequestConstructor('GET', method).end(url);\n }\n\n // url first\n if (2 == arguments.length) {\n return new RequestConstructor('GET', method);\n }\n\n return new RequestConstructor(method, url);\n}\n\nmodule.exports = request;\n\n},{}],14:[function(require,module,exports){\n\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n\n},{}],15:[function(require,module,exports){\nmodule.exports={\n \"name\": \"vhxjs\",\n \"version\": \"1.0.0-beta.2\",\n \"description\": \"VHX Javascript API Client\",\n \"main\": \"vhx.js\",\n \"author\": \"VHX\",\n \"homepage\": \"https://github.com/vhx/vhx-node\",\n \"contributors\": [\"David Gonzalez \", \"Scott Robertson \"],\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/vhx/vhx-js.git\"\n },\n \"bugs:\": \"https://github.com/vhx/vhx-js/issues\",\n \"devDependencies\": {\n \"babel-cli\": \"^6.11.4\",\n \"babel-preset-es2015\": \"^6.9.0\",\n \"babelify\": \"^7.3.0\",\n \"browserify\": \"^13.1.0\",\n \"gulp\": \"^3.9.1\",\n \"gulp-babel\": \"^6.1.2\",\n \"gulp-browserify\": \"^0.5.1\",\n \"gulp-livereload\": \"^3.8.1\",\n \"gulp-sourcemaps\": \"^1.6.0\",\n \"gulp-uglify\": \"^1.5.4\",\n \"superagent\": \"^2.1.0\",\n \"vinyl-buffer\": \"^1.0.0\",\n \"vinyl-source-stream\": \"^1.1.0\"\n }\n}\n\n},{}]},{},[9])\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvZGVmYXVsdHMuanMiLCJsaWIvcGFnaW5hdGUuanMiLCJsaWIvcmVzb3VyY2UuanMiLCJsaWIvcmVzb3VyY2VzL2Jyb3dzZS5qcyIsImxpYi9yZXNvdXJjZXMvY29sbGVjdGlvbnMuanMiLCJsaWIvcmVzb3VyY2VzL2N1c3RvbWVycy5qcyIsImxpYi9yZXNvdXJjZXMvcHJvZHVjdHMuanMiLCJsaWIvcmVzb3VyY2VzL3ZpZGVvcy5qcyIsImxpYi92aHguanMiLCJub2RlX21vZHVsZXMvc3VwZXJhZ2VudC9saWIvY2xpZW50LmpzIiwibm9kZV9tb2R1bGVzL3N1cGVyYWdlbnQvbGliL2lzLW9iamVjdC5qcyIsIm5vZGVfbW9kdWxlcy9zdXBlcmFnZW50L2xpYi9yZXF1ZXN0LWJhc2UuanMiLCJub2RlX21vZHVsZXMvc3VwZXJhZ2VudC9saWIvcmVxdWVzdC5qcyI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xuICAgICAgICAgICAgcGFyYW1zLmlkID0gX3RoaXMucGFyc2VIcmVmKGEpO1xuICAgICAgICAgICAgaWYgKF90aGlzLmlzQ2FsbGJhY2tGdW5jdGlvbihiKSkge1xuICAgICAgICAgICAgICBwYXJhbXMuY2FsbGJhY2sgPSBiO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGFyYW1zLm9wdGlvbnMgPSBiO1xuICAgICAgICAgICAgICBwYXJhbXMuY2FsbGJhY2sgPSBjO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIHBhcmFtcy5zY29wZSA9IGl0ZW0uc2NvcGUgPyBpdGVtLnNjb3BlIDogbnVsbDtcbiAgICAgICAgICBfdGhpcy5tYWtlUmVxdWVzdChwYXJhbXMpO1xuICAgICAgICB9O1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIF90aGlzW21ldGhvZF0gPSBmdW5jdGlvbihvcHRpb25zLCBjYWxsYmFjaykge1xuICAgICAgICAgIHBhcmFtcy5vcHRpb25zID0gb3B0aW9ucztcbiAgICAgICAgICBwYXJhbXMuY2FsbGJhY2sgPSBjYWxsYmFjaztcblxuICAgICAgICAgIF90aGlzLm1ha2VSZXF1ZXN0KHBhcmFtcyk7XG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfSk7XG4gIH1cblxuICBnZXRUeXBlKHJlc291cmNlKSB7XG4gICAgaWYgKHJlc291cmNlID09PSAnY29sbGVjdGlvbnMnKSB7XG4gICAgICByZXR1cm4gJ2NvbGxlY3Rpb24nO1xuICAgIH1cbiAgICBpZiAocmVzb3VyY2UgPT09ICdjdXN0b21lcnMnKSB7XG4gICAgICByZXR1cm4gJ2N1c3RvbWVyJztcbiAgICB9XG4gICAgaWYgKHJlc291cmNlID09PSAndmlkZW9zJykge1xuICAgICAgcmV0dXJuICd2aWRlbyc7XG4gICAgfVxuXG4gICAgcmV0dXJuICdpZCc7XG4gIH1cblxuICBnZXRN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mFnZW50XCI6IFwiXjIuMS4wXCIsXG4gICAgXCJ2aW55bC1idWZmZXJcIjogXCJeMS4wLjBcIixcbiAgICBcInZpbnlsLXNvdXJjZS1zdHJlYW1cIjogXCJeMS4xLjBcIlxuICB9XG59XG4iXX0=\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/vhx.js b/dist/vhx.js index 997e27c..acbd1eb 100644 --- a/dist/vhx.js +++ b/dist/vhx.js @@ -2,11 +2,11 @@ 'use strict'; var _VHX_DEFAULTS = { - HOST: 'api.crystal.dev', - PROTOCOL: 'http://', + HOST: 'api.vhx.tv', + PROTOCOL: 'https://', API_VERSION: require('../package.json').version, TIMEOUT: '30000', - TOKEN_HOST: 'crystal.dev' + TOKEN_HOST: 'vhx.tv' }; module.exports = _VHX_DEFAULTS; @@ -379,7 +379,7 @@ var Resource = function () { module.exports = Resource; -},{"./paginate":2,"superagent":11}],4:[function(require,module,exports){ +},{"./paginate":2,"superagent":10}],4:[function(require,module,exports){ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -607,171 +607,6 @@ var vhx = function () { window.vhx = vhx; },{"./defaults":1,"./resources/browse":4,"./resources/collections":5,"./resources/customers":6,"./resources/products":7,"./resources/videos":8}],10:[function(require,module,exports){ - -/** - * Expose `Emitter`. - */ - -if (typeof module !== 'undefined') { - module.exports = Emitter; -} - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks['$' + event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; - -},{}],11:[function(require,module,exports){ /** * Root reference for iframes. */ @@ -844,9 +679,7 @@ function serialize(obj) { if (!isObject(obj)) return obj; var pairs = []; for (var key in obj) { - if (null != obj[key]) { - pushEncodedKeyValuePair(pairs, key, obj[key]); - } + pushEncodedKeyValuePair(pairs, key, obj[key]); } return pairs.join('&'); } @@ -861,18 +694,22 @@ function serialize(obj) { */ function pushEncodedKeyValuePair(pairs, key, val) { - if (Array.isArray(val)) { - return val.forEach(function(v) { - pushEncodedKeyValuePair(pairs, key, v); - }); - } else if (isObject(val)) { - for(var subkey in val) { - pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); + if (val != null) { + if (Array.isArray(val)) { + val.forEach(function(v) { + pushEncodedKeyValuePair(pairs, key, v); + }); + } else if (isObject(val)) { + for(var subkey in val) { + pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); + } + } else { + pairs.push(encodeURIComponent(key) + + '=' + encodeURIComponent(val)); } - return; + } else if (val === null) { + pairs.push(encodeURIComponent(key)); } - pairs.push(encodeURIComponent(key) - + '=' + encodeURIComponent(val)); } /** @@ -1747,7 +1584,7 @@ request.put = function(url, data, fn){ return req; }; -},{"./is-object":12,"./request":14,"./request-base":13,"emitter":10}],12:[function(require,module,exports){ +},{"./is-object":11,"./request":13,"./request-base":12,"emitter":14}],11:[function(require,module,exports){ /** * Check if `obj` is an object. * @@ -1762,7 +1599,7 @@ function isObject(obj) { module.exports = isObject; -},{}],13:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ /** * Module of mixed-in functions shared between node and client code */ @@ -2111,7 +1948,7 @@ exports.send = function(data){ return this; }; -},{"./is-object":12}],14:[function(require,module,exports){ +},{"./is-object":11}],13:[function(require,module,exports){ // The node and browser modules expose versions of this with the // appropriate constructor function bound as first argument /** @@ -2145,10 +1982,175 @@ function request(RequestConstructor, method, url) { module.exports = request; +},{}],14:[function(require,module,exports){ + +/** + * Expose `Emitter`. + */ + +if (typeof module !== 'undefined') { + module.exports = Emitter; +} + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; + },{}],15:[function(require,module,exports){ module.exports={ "name": "vhxjs", - "version": "1.0.0-beta", + "version": "1.0.0-beta.2", "description": "VHX Javascript API Client", "main": "vhx.js", "author": "VHX", diff --git a/dist/vhx.min.js b/dist/vhx.min.js index b092abf..e679dc4 100644 --- a/dist/vhx.min.js +++ b/dist/vhx.min.js @@ -1,2 +1,2 @@ -!function t(e,r,o){function n(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return n(r?r:t)},l,l.exports,t,e,r,o)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;st.last)throw"No more pages to request";t.resource[t.method](t.options,e)}},{key:"previousPage",value:function(t,e){if(1===t.page)throw"No previous pages to request";t.options.page=t.page-1,t.resource[t.method](t.options,e)}},{key:"firstPage",value:function(t,e){t.options.page=1,t.resource[t.method](t.options,e)}},{key:"lastPage",value:function(t,e){t.options.page=t.last,t.resource[t.method](t.options,e)}},{key:"goToPage",value:function(t,e,r){if(e=parseInt(e,10),e>0&&e<=t.last)return t.options.page=e,t.resource[t.method](t.options,r);throw"You must pass a valid page number"}}]),t}();e.exports=i},{}],3:[function(t,e,r){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r=0?("/"===t.substr(-1)&&t.substr(0,t.length-1),r=t.split("/"),r[r.length-1]):void 0}},{key:"getToken",value:function(t){var e=this,r=""+e._api.protocol+window.location.host+"/tokens";s.post(r).set("X-CSRF-Token",$('meta[name="csrf-token"]').attr("content")).then(function(r){e._api.token=r.body.token,t&&t()},function(t){console.log(t)})}},{key:"timeStamp",value:function(){return(new Date).getTime()}},{key:"getParams",value:function(t,e,r,o){var n=this,i={};return i.url=n._api.protocol+n._api.host+"/"+n.path,i.timeout=n._api.timeout,n._api.auth&&(i.headers={Authorization:n._api.auth}),i.qs=r||null,t.match(/^list$|^all$/)||(i.url+="/"+e),t.match(/items/i)&&(i.url+="/items"),t.match(/files/i)&&(i.url+="/files"),o&&(i.url+="/"+o),i}},{key:"makeRequest",value:function(t){var e=this,r=e.getParams(t.client_method,t.id||null,t.options,t.scope);e.isCallbackFunction(t.options)&&(t.callback=t.options),void 0!==e._api.token?e.getToken(function(){r.headers={Authorization:"Bearer "+e._api.token},e.ajaxRequest(t,r)}):e.ajaxRequest(t,r)}},{key:"ajaxRequest",value:function(t,e){var r=this;s[t.http_method](e.url).withCredentials().set(e.headers||{}).set("Content-Type","application/json").query(e.qs).end(function(e,o){e&&"ETIMEDOUT"===e.code&&r.errorHandler({status:408,body:'{"message": "The request timed out.","documentation_url": "http://dev.vhx.tv/docs/api"}',callback:t.callback||""}),!e&&o.statusCode>=200&&o.statusCode<300?r.successHandler({body:o.body||null,callback:t.callback,options:t.options,object:r.path,method:t.client_method}):r.errorHandler({status:408,body:'{"message": "The request timed out.","documentation_url": "http://dev.vhx.tv/docs/api"}',callback:t.callback||""})})}},{key:"successHandler",value:function(t){var e=t.body;t.body.count&&t.body.count=300)&&(n=new Error(e.statusText||"Unsuccessful HTTP response"),n.original=t,n.response=e,n.status=e.status)}catch(o){n=o}n?r.callback(n,e):r.callback(null,e)})}function f(t,e){var r=v("DELETE",t);return e&&r.end(e),r}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var y=t("emitter"),b=t("./request-base"),m=t("./is-object"),v=e.exports=t("./request").bind(null,h);v.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};v.serializeObject=n,v.parseString=s,v.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},v.serialize={"application/x-www-form-urlencoded":n,"application/json":JSON.stringify},v.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},p.prototype.get=function(t){return this.header[t.toLowerCase()]},p.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var r=l(e);for(var o in r)this[o]=r[o]},p.prototype._parseBody=function(t){var e=v.parse[this.type];return!e&&u(this.type)&&(e=v.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},p.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},p.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,o="cannot "+e+" "+r+" ("+this.status+")",n=new Error(o);return n.status=this.status,n.method=e,n.url=r,n},v.Response=p,y(h.prototype);for(var _ in b)h.prototype[_]=b[_];h.prototype.type=function(t){return this.set("Content-Type",v.types[t]||t),this},h.prototype.responseType=function(t){return this._responseType=t,this},h.prototype.accept=function(t){return this.set("Accept",v.types[t]||t),this},h.prototype.auth=function(t,e,r){switch(r||(r={type:"basic"}),r.type){case"basic":var o=btoa(t+":"+e);this.set("Authorization","Basic "+o);break;case"auto":this.username=t,this.password=e}return this},h.prototype.query=function(t){return"string"!=typeof t&&(t=n(t)),t&&this._query.push(t),this},h.prototype.attach=function(t,e,r){return this._getFormData().append(t,e,r||e.name),this},h.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},h.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),r(t,e)},h.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},h.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},h.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},h.prototype.end=function(t){var e=this,r=this.xhr=v.getXHR(),n=this._timeout,i=this._formData||this._data;this._callback=t||o,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(o){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var s=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(r.onprogress=s);try{r.upload&&this.hasListeners("progress")&&(r.upload.onprogress=s)}catch(a){}if(n&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},n)),this._appendQueryString(),this.username&&this.password?r.open(this.method,this.url,!0,this.username,this.password):r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var c=this._header["content-type"],l=this._serializer||v.serialize[c?c.split(";")[0]:""];!l&&u(c)&&(l=v.serialize["application/json"]),l&&(i=l(i))}for(var p in this.header)null!=this.header[p]&&r.setRequestHeader(p,this.header[p]);return this._responseType&&(r.responseType=this._responseType),this.emit("request",this),r.send("undefined"!=typeof i?i:null),this},v.Request=h,v.get=function(t,e,r){var o=v("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},v.head=function(t,e,r){var o=v("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.options=function(t,e,r){var o=v("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.del=f,v["delete"]=f,v.patch=function(t,e,r){var o=v("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.post=function(t,e,r){var o=v("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.put=function(t,e,r){var o=v("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}},{"./is-object":12,"./request":14,"./request-base":13,emitter:10}],12:[function(t,e,r){function o(t){return null!==t&&"object"==typeof t}e.exports=o},{}],13:[function(t,e,r){var o=t("./is-object");r.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},r.parse=function(t){return this._parser=t,this},r.serialize=function(t){return this._serializer=t,this},r.timeout=function(t){return this._timeout=t,this},r.then=function(t,e){if(!this._fullfilledPromise){var r=this;this._fullfilledPromise=new Promise(function(t,e){r.end(function(r,o){r?e(r):t(o)})})}return this._fullfilledPromise.then(t,e)},r.use=function(t){return t(this),this},r.get=function(t){return this._header[t.toLowerCase()]},r.getHeader=r.get,r.set=function(t,e){if(o(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.field=function(t,e){return this._getFormData().append(t,e),this},r.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.withCredentials=function(){return this._withCredentials=!0,this},r.redirects=function(t){return this._maxRedirects=t,this},r.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r._isHost=function(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},r.send=function(t){var e=o(t),r=this._header["content-type"];if(e&&o(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)}},{"./is-object":12}],14:[function(t,e,r){function o(t,e,r){return"function"==typeof r?new t("GET",e).end(r):2==arguments.length?new t("GET",e):new t(e,r)}e.exports=o},{}],15:[function(t,e,r){e.exports={name:"vhxjs",version:"1.0.0-beta",description:"VHX Javascript API Client",main:"vhx.js",author:"VHX",homepage:"https://github.com/vhx/vhx-node",contributors:["David Gonzalez ","Scott Robertson "],license:"MIT",repository:{type:"git",url:"git://github.com/vhx/vhx-js.git"},"bugs:":"https://github.com/vhx/vhx-js/issues",devDependencies:{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0",babelify:"^7.3.0",browserify:"^13.1.0",gulp:"^3.9.1","gulp-babel":"^6.1.2","gulp-browserify":"^0.5.1","gulp-livereload":"^3.8.1","gulp-sourcemaps":"^1.6.0","gulp-uglify":"^1.5.4",superagent:"^2.1.0","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"}}},{}]},{},[9]); +!function t(e,r,o){function n(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return n(r?r:t)},l,l.exports,t,e,r,o)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;st.last)throw"No more pages to request";t.resource[t.method](t.options,e)}},{key:"previousPage",value:function(t,e){if(1===t.page)throw"No previous pages to request";t.options.page=t.page-1,t.resource[t.method](t.options,e)}},{key:"firstPage",value:function(t,e){t.options.page=1,t.resource[t.method](t.options,e)}},{key:"lastPage",value:function(t,e){t.options.page=t.last,t.resource[t.method](t.options,e)}},{key:"goToPage",value:function(t,e,r){if(e=parseInt(e,10),e>0&&e<=t.last)return t.options.page=e,t.resource[t.method](t.options,r);throw"You must pass a valid page number"}}]),t}();e.exports=i},{}],3:[function(t,e,r){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r=0?("/"===t.substr(-1)&&t.substr(0,t.length-1),r=t.split("/"),r[r.length-1]):void 0}},{key:"getToken",value:function(t){var e=this,r=""+e._api.protocol+window.location.host+"/tokens";s.post(r).set("X-CSRF-Token",$('meta[name="csrf-token"]').attr("content")).then(function(r){e._api.token=r.body.token,t&&t()},function(t){console.log(t)})}},{key:"timeStamp",value:function(){return(new Date).getTime()}},{key:"getParams",value:function(t,e,r,o){var n=this,i={};return i.url=n._api.protocol+n._api.host+"/"+n.path,i.timeout=n._api.timeout,n._api.auth&&(i.headers={Authorization:n._api.auth}),i.qs=r||null,t.match(/^list$|^all$/)||(i.url+="/"+e),t.match(/items/i)&&(i.url+="/items"),t.match(/files/i)&&(i.url+="/files"),o&&(i.url+="/"+o),i}},{key:"makeRequest",value:function(t){var e=this,r=e.getParams(t.client_method,t.id||null,t.options,t.scope);e.isCallbackFunction(t.options)&&(t.callback=t.options),void 0!==e._api.token?e.getToken(function(){r.headers={Authorization:"Bearer "+e._api.token},e.ajaxRequest(t,r)}):e.ajaxRequest(t,r)}},{key:"ajaxRequest",value:function(t,e){var r=this;s[t.http_method](e.url).withCredentials().set(e.headers||{}).set("Content-Type","application/json").query(e.qs).end(function(e,o){e&&"ETIMEDOUT"===e.code&&r.errorHandler({status:408,body:'{"message": "The request timed out.","documentation_url": "http://dev.vhx.tv/docs/api"}',callback:t.callback||""}),!e&&o.statusCode>=200&&o.statusCode<300?r.successHandler({body:o.body||null,callback:t.callback,options:t.options,object:r.path,method:t.client_method}):r.errorHandler({status:408,body:'{"message": "The request timed out.","documentation_url": "http://dev.vhx.tv/docs/api"}',callback:t.callback||""})})}},{key:"successHandler",value:function(t){var e=t.body;t.body.count&&t.body.count=300)&&(n=new Error(e.statusText||"Unsuccessful HTTP response"),n.original=t,n.response=e,n.status=e.status)}catch(o){n=o}n?r.callback(n,e):r.callback(null,e)})}function f(t,e){var r=v("DELETE",t);return e&&r.end(e),r}var d;"undefined"!=typeof window?d=window:"undefined"!=typeof self?d=self:(console.warn("Using browser-only version of superagent in non-browser environment"),d=this);var y=t("emitter"),b=t("./request-base"),m=t("./is-object"),v=e.exports=t("./request").bind(null,h);v.getXHR=function(){if(!(!d.XMLHttpRequest||d.location&&"file:"==d.location.protocol&&d.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only verison of superagent could not find XHR")};var g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};v.serializeObject=n,v.parseString=s,v.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},v.serialize={"application/x-www-form-urlencoded":n,"application/json":JSON.stringify},v.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},p.prototype.get=function(t){return this.header[t.toLowerCase()]},p.prototype._setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=c(e);var r=l(e);for(var o in r)this[o]=r[o]},p.prototype._parseBody=function(t){var e=v.parse[this.type];return!e&&u(this.type)&&(e=v.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},p.prototype._setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},p.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,o="cannot "+e+" "+r+" ("+this.status+")",n=new Error(o);return n.status=this.status,n.method=e,n.url=r,n},v.Response=p,y(h.prototype);for(var _ in b)h.prototype[_]=b[_];h.prototype.type=function(t){return this.set("Content-Type",v.types[t]||t),this},h.prototype.responseType=function(t){return this._responseType=t,this},h.prototype.accept=function(t){return this.set("Accept",v.types[t]||t),this},h.prototype.auth=function(t,e,r){switch(r||(r={type:"basic"}),r.type){case"basic":var o=btoa(t+":"+e);this.set("Authorization","Basic "+o);break;case"auto":this.username=t,this.password=e}return this},h.prototype.query=function(t){return"string"!=typeof t&&(t=n(t)),t&&this._query.push(t),this},h.prototype.attach=function(t,e,r){return this._getFormData().append(t,e,r||e.name),this},h.prototype._getFormData=function(){return this._formData||(this._formData=new d.FormData),this._formData},h.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),r(t,e)},h.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},h.prototype._timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},h.prototype._appendQueryString=function(){var t=this._query.join("&");t&&(this.url+=~this.url.indexOf("?")?"&"+t:"?"+t)},h.prototype.end=function(t){var e=this,r=this.xhr=v.getXHR(),n=this._timeout,i=this._formData||this._data;this._callback=t||o,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(o){t=0}if(0==t){if(e.timedout)return e._timeoutError();if(e._aborted)return;return e.crossDomainError()}e.emit("end")}};var s=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(r.onprogress=s);try{r.upload&&this.hasListeners("progress")&&(r.upload.onprogress=s)}catch(a){}if(n&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},n)),this._appendQueryString(),this.username&&this.password?r.open(this.method,this.url,!0,this.username,this.password):r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!this._isHost(i)){var c=this._header["content-type"],l=this._serializer||v.serialize[c?c.split(";")[0]:""];!l&&u(c)&&(l=v.serialize["application/json"]),l&&(i=l(i))}for(var p in this.header)null!=this.header[p]&&r.setRequestHeader(p,this.header[p]);return this._responseType&&(r.responseType=this._responseType),this.emit("request",this),r.send("undefined"!=typeof i?i:null),this},v.Request=h,v.get=function(t,e,r){var o=v("GET",t);return"function"==typeof e&&(r=e,e=null),e&&o.query(e),r&&o.end(r),o},v.head=function(t,e,r){var o=v("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.options=function(t,e,r){var o=v("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.del=f,v["delete"]=f,v.patch=function(t,e,r){var o=v("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.post=function(t,e,r){var o=v("POST",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o},v.put=function(t,e,r){var o=v("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&o.send(e),r&&o.end(r),o}},{"./is-object":11,"./request":13,"./request-base":12,emitter:14}],11:[function(t,e,r){function o(t){return null!==t&&"object"==typeof t}e.exports=o},{}],12:[function(t,e,r){var o=t("./is-object");r.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},r.parse=function(t){return this._parser=t,this},r.serialize=function(t){return this._serializer=t,this},r.timeout=function(t){return this._timeout=t,this},r.then=function(t,e){if(!this._fullfilledPromise){var r=this;this._fullfilledPromise=new Promise(function(t,e){r.end(function(r,o){r?e(r):t(o)})})}return this._fullfilledPromise.then(t,e)},r.use=function(t){return t(this),this},r.get=function(t){return this._header[t.toLowerCase()]},r.getHeader=r.get,r.set=function(t,e){if(o(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},r.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},r.field=function(t,e){return this._getFormData().append(t,e),this},r.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.withCredentials=function(){return this._withCredentials=!0,this},r.redirects=function(t){return this._maxRedirects=t,this},r.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r._isHost=function(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}},r.send=function(t){var e=o(t),r=this._header["content-type"];if(e&&o(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)}},{"./is-object":11}],13:[function(t,e,r){function o(t,e,r){return"function"==typeof r?new t("GET",e).end(r):2==arguments.length?new t("GET",e):new t(e,r)}e.exports=o},{}],14:[function(t,e,r){function o(t){if(t)return n(t)}function n(t){for(var e in o.prototype)t[e]=o.prototype[e];return t}"undefined"!=typeof e&&(e.exports=o),o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},o.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o,n=0;n ","Scott Robertson "],license:"MIT",repository:{type:"git",url:"git://github.com/vhx/vhx-js.git"},"bugs:":"https://github.com/vhx/vhx-js/issues",devDependencies:{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0",babelify:"^7.3.0",browserify:"^13.1.0",gulp:"^3.9.1","gulp-babel":"^6.1.2","gulp-browserify":"^0.5.1","gulp-livereload":"^3.8.1","gulp-sourcemaps":"^1.6.0","gulp-uglify":"^1.5.4",superagent:"^2.1.0","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"}}},{}]},{},[9]); //# sourceMappingURL=maps/vhx.min.js.map