text: /**
   * Clarifai JavaScript SDK v2.0.17
   *
   * Last updated: Tue Dec 06 2016 17:19:35 GMT-0500 (EST)
   *
   * Visit https://developer.clarifai.com
   *
   * Copyright (c) 2016-present, Clarifai, Inc.
   * All rights reserved.
   * Licensed under the Apache License, Version 2.0.
   *
   * The source tree of this library can be found at
   *   https://github.com/Clarifai/clarifai-javascript
   */
  (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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  module.exports = require('./lib/axios');
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/index.js","/../node_modules/axios")
  },{"./lib/axios":3,"1YiZ5S":23,"buffer":20}],2:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  var buildURL = require('./../helpers/buildURL');
  var parseHeaders = require('./../helpers/parseHeaders');
  var transformData = require('./../helpers/transformData');
  var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
  var btoa = (typeof window !== 'undefined' && window.btoa) || require('./../helpers/btoa');
  var settle = require('../helpers/settle');
  
  module.exports = function xhrAdapter(resolve, reject, config) {
    var requestData = config.data;
    var requestHeaders = config.headers;
  
    if (utils.isFormData(requestData)) {
      delete requestHeaders['Content-Type']; // Let the browser set it
    }
  
    var request = new XMLHttpRequest();
    var loadEvent = 'onreadystatechange';
    var xDomain = false;
  
    // For IE 8/9 CORS support
    // Only supports POST and GET calls and doesn't returns the response headers.
    // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
    if (process.env.NODE_ENV !== 'test' && typeof window !== 'undefined' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
      request = new window.XDomainRequest();
      loadEvent = 'onload';
      xDomain = true;
      request.onprogress = function handleProgress() {};
      request.ontimeout = function handleTimeout() {};
    }
  
    // HTTP basic authentication
    if (config.auth) {
      var username = config.auth.username || '';
      var password = config.auth.password || '';
      requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
    }
  
    request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  
    // Set the request timeout in MS
    request.timeout = config.timeout;
  
    // Listen for ready state
    request[loadEvent] = function handleLoad() {
      if (!request || (request.readyState !== 4 && !xDomain)) {
        return;
      }
  
      // The request errored out and we didn't get a response, this will be
      // handled by onerror instead
      if (request.status === 0) {
        return;
      }
  
      // Prepare the response
      var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
      var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
      var response = {
        data: transformData(
          responseData,
          responseHeaders,
          config.transformResponse
        ),
        // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
        status: request.status === 1223 ? 204 : request.status,
        statusText: request.status === 1223 ? 'No Content' : request.statusText,
        headers: responseHeaders,
        config: config,
        request: request
      };
  
      settle(resolve, reject, response);
  
      // Clean up request
      request = null;
    };
  
    // Handle low level network errors
    request.onerror = function handleError() {
      // Real errors are hidden from us by the browser
      // onerror should only fire if it's a network error
      reject(new Error('Network Error'));
  
      // Clean up request
      request = null;
    };
  
    // Handle timeout
    request.ontimeout = function handleTimeout() {
      var err = new Error('timeout of ' + config.timeout + 'ms exceeded');
      err.timeout = config.timeout;
      err.code = 'ECONNABORTED';
      reject(err);
  
      // Clean up request
      request = null;
    };
  
    // Add xsrf header
    // This is only done if running in a standard browser environment.
    // Specifically not if we're in a web worker, or react-native.
    if (utils.isStandardBrowserEnv()) {
      var cookies = require('./../helpers/cookies');
  
      // Add xsrf header
      var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?
          cookies.read(config.xsrfCookieName) :
          undefined;
  
      if (xsrfValue) {
        requestHeaders[config.xsrfHeaderName] = xsrfValue;
      }
    }
  
    // Add headers to the request
    if ('setRequestHeader' in request) {
      utils.forEach(requestHeaders, function setRequestHeader(val, key) {
        if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
          // Remove Content-Type if data is undefined
          delete requestHeaders[key];
        } else {
          // Otherwise add header to the request
          request.setRequestHeader(key, val);
        }
      });
    }
  
    // Add withCredentials to request if needed
    if (config.withCredentials) {
      request.withCredentials = true;
    }
  
    // Add responseType to request if needed
    if (config.responseType) {
      try {
        request.responseType = config.responseType;
      } catch (e) {
        if (request.responseType !== 'json') {
          throw e;
        }
      }
    }
  
    // Handle progress if needed
    if (config.progress) {
      if (config.method === 'post' || config.method === 'put') {
        request.upload.addEventListener('progress', config.progress);
      } else if (config.method === 'get') {
        request.addEventListener('progress', config.progress);
      }
    }
  
    if (requestData === undefined) {
      requestData = null;
    }
  
    // Send the request
    request.send(requestData);
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/adapters/xhr.js","/../node_modules/axios/lib/adapters")
  },{"../helpers/settle":15,"./../helpers/btoa":8,"./../helpers/buildURL":9,"./../helpers/cookies":11,"./../helpers/isURLSameOrigin":13,"./../helpers/parseHeaders":14,"./../helpers/transformData":17,"./../utils":18,"1YiZ5S":23,"buffer":20}],3:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var defaults = require('./defaults');
  var utils = require('./utils');
  var dispatchRequest = require('./core/dispatchRequest');
  var InterceptorManager = require('./core/InterceptorManager');
  var isAbsoluteURL = require('./helpers/isAbsoluteURL');
  var combineURLs = require('./helpers/combineURLs');
  var bind = require('./helpers/bind');
  var transformData = require('./helpers/transformData');
  
  function Axios(defaultConfig) {
    this.defaults = utils.merge({}, defaultConfig);
    this.interceptors = {
      request: new InterceptorManager(),
      response: new InterceptorManager()
    };
  }
  
  Axios.prototype.request = function request(config) {
    /*eslint no-param-reassign:0*/
    // Allow for axios('example/url'[, config]) a la fetch API
    if (typeof config === 'string') {
      config = utils.merge({
        url: arguments[0]
      }, arguments[1]);
    }
  
    config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  
    // Support baseURL config
    if (config.baseURL && !isAbsoluteURL(config.url)) {
      config.url = combineURLs(config.baseURL, config.url);
    }
  
    // Don't allow overriding defaults.withCredentials
    config.withCredentials = config.withCredentials || this.defaults.withCredentials;
  
    // Transform request data
    config.data = transformData(
      config.data,
      config.headers,
      config.transformRequest
    );
  
    // Flatten headers
    config.headers = utils.merge(
      config.headers.common || {},
      config.headers[config.method] || {},
      config.headers || {}
    );
  
    utils.forEach(
      ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
      function cleanHeaderConfig(method) {
        delete config.headers[method];
      }
    );
  
    // Hook up interceptors middleware
    var chain = [dispatchRequest, undefined];
    var promise = Promise.resolve(config);
  
    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
      chain.unshift(interceptor.fulfilled, interceptor.rejected);
    });
  
    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
      chain.push(interceptor.fulfilled, interceptor.rejected);
    });
  
    while (chain.length) {
      promise = promise.then(chain.shift(), chain.shift());
    }
  
    return promise;
  };
  
  var defaultInstance = new Axios(defaults);
  var axios = module.exports = bind(Axios.prototype.request, defaultInstance);
  module.exports.Axios = Axios;
  
  // Expose properties from defaultInstance
  axios.defaults = defaultInstance.defaults;
  axios.interceptors = defaultInstance.interceptors;
  
  // Factory for creating new instances
  axios.create = function create(defaultConfig) {
    return new Axios(defaultConfig);
  };
  
  // Expose all/spread
  axios.all = function all(promises) {
    return Promise.all(promises);
  };
  axios.spread = require('./helpers/spread');
  
  // Provide aliases for supported request methods
  utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
    /*eslint func-names:0*/
    Axios.prototype[method] = function(url, config) {
      return this.request(utils.merge(config || {}, {
        method: method,
        url: url
      }));
    };
    axios[method] = bind(Axios.prototype[method], defaultInstance);
  });
  
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
    /*eslint func-names:0*/
    Axios.prototype[method] = function(url, data, config) {
      return this.request(utils.merge(config || {}, {
        method: method,
        url: url,
        data: data
      }));
    };
    axios[method] = bind(Axios.prototype[method], defaultInstance);
  });
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/axios.js","/../node_modules/axios/lib")
  },{"./core/InterceptorManager":4,"./core/dispatchRequest":5,"./defaults":6,"./helpers/bind":7,"./helpers/combineURLs":10,"./helpers/isAbsoluteURL":12,"./helpers/spread":16,"./helpers/transformData":17,"./utils":18,"1YiZ5S":23,"buffer":20}],4:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  function InterceptorManager() {
    this.handlers = [];
  }
  
  /**
   * Add a new interceptor to the stack
   *
   * @param {Function} fulfilled The function to handle `then` for a `Promise`
   * @param {Function} rejected The function to handle `reject` for a `Promise`
   *
   * @return {Number} An ID used to remove interceptor later
   */
  InterceptorManager.prototype.use = function use(fulfilled, rejected) {
    this.handlers.push({
      fulfilled: fulfilled,
      rejected: rejected
    });
    return this.handlers.length - 1;
  };
  
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   */
  InterceptorManager.prototype.eject = function eject(id) {
    if (this.handlers[id]) {
      this.handlers[id] = null;
    }
  };
  
  /**
   * Iterate over all the registered interceptors
   *
   * This method is particularly useful for skipping over any
   * interceptors that may have become `null` calling `eject`.
   *
   * @param {Function} fn The function to call for each interceptor
   */
  InterceptorManager.prototype.forEach = function forEach(fn) {
    utils.forEach(this.handlers, function forEachHandler(h) {
      if (h !== null) {
        fn(h);
      }
    });
  };
  
  module.exports = InterceptorManager;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/core/InterceptorManager.js","/../node_modules/axios/lib/core")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],5:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /**
   * Dispatch a request to the server using whichever adapter
   * is supported by the current environment.
   *
   * @param {object} config The config that is to be used for the request
   * @returns {Promise} The Promise to be fulfilled
   */
  module.exports = function dispatchRequest(config) {
    return new Promise(function executor(resolve, reject) {
      try {
        var adapter;
  
        if (typeof config.adapter === 'function') {
          // For custom adapter support
          adapter = config.adapter;
        } else if (typeof XMLHttpRequest !== 'undefined') {
          // For browsers use XHR adapter
          adapter = require('../adapters/xhr');
        } else if (typeof process !== 'undefined') {
          // For node use HTTP adapter
          adapter = require('../adapters/http');
        }
  
        if (typeof adapter === 'function') {
          adapter(resolve, reject, config);
        }
      } catch (e) {
        reject(e);
      }
    });
  };
  
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/core/dispatchRequest.js","/../node_modules/axios/lib/core")
  },{"../adapters/http":2,"../adapters/xhr":2,"1YiZ5S":23,"buffer":20}],6:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./utils');
  
  var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  var DEFAULT_CONTENT_TYPE = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };
  
  module.exports = {
    transformRequest: [function transformRequest(data, headers) {
      if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isStream(data)) {
        return data;
      }
      if (utils.isArrayBufferView(data)) {
        return data.buffer;
      }
      if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
        // Set application/json if no Content-Type has been specified
        if (!utils.isUndefined(headers)) {
          utils.forEach(headers, function processContentTypeHeader(val, key) {
            if (key.toLowerCase() === 'content-type') {
              headers['Content-Type'] = val;
            }
          });
  
          if (utils.isUndefined(headers['Content-Type'])) {
            headers['Content-Type'] = 'application/json;charset=utf-8';
          }
        }
        return JSON.stringify(data);
      }
      return data;
    }],
  
    transformResponse: [function transformResponse(data) {
      /*eslint no-param-reassign:0*/
      if (typeof data === 'string') {
        data = data.replace(PROTECTION_PREFIX, '');
        try {
          data = JSON.parse(data);
        } catch (e) { /* Ignore */ }
      }
      return data;
    }],
  
    headers: {
      common: {
        'Accept': 'application/json, text/plain, */*'
      },
      patch: utils.merge(DEFAULT_CONTENT_TYPE),
      post: utils.merge(DEFAULT_CONTENT_TYPE),
      put: utils.merge(DEFAULT_CONTENT_TYPE)
    },
  
    timeout: 0,
  
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
  
    maxContentLength: -1,
  
    validateStatus: function validateStatus(status) {
      return status >= 200 && status < 300;
    }
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/defaults.js","/../node_modules/axios/lib")
  },{"./utils":18,"1YiZ5S":23,"buffer":20}],7:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  module.exports = function bind(fn, thisArg) {
    return function wrap() {
      var args = new Array(arguments.length);
      for (var i = 0; i < args.length; i++) {
        args[i] = arguments[i];
      }
      return fn.apply(thisArg, args);
    };
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/bind.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],8:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  
  function E() {
    this.message = 'String contains an invalid character';
  }
  E.prototype = new Error;
  E.prototype.code = 5;
  E.prototype.name = 'InvalidCharacterError';
  
  function btoa(input) {
    var str = String(input);
    var output = '';
    for (
      // initialize result and counter
      var block, charCode, idx = 0, map = chars;
      // if the next str index does not exist:
      //   change the mapping table to "="
      //   check if d has no fractional digits
      str.charAt(idx | 0) || (map = '=', idx % 1);
      // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
      output += map.charAt(63 & block >> 8 - idx % 1 * 8)
    ) {
      charCode = str.charCodeAt(idx += 3 / 4);
      if (charCode > 0xFF) {
        throw new E();
      }
      block = block << 8 | charCode;
    }
    return output;
  }
  
  module.exports = btoa;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/btoa.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],9:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  function encode(val) {
    return encodeURIComponent(val).
      replace(/%40/gi, '@').
      replace(/%3A/gi, ':').
      replace(/%24/g, '$').
      replace(/%2C/gi, ',').
      replace(/%20/g, '+').
      replace(/%5B/gi, '[').
      replace(/%5D/gi, ']');
  }
  
  /**
   * Build a URL by appending params to the end
   *
   * @param {string} url The base of the url (e.g., http://www.google.com)
   * @param {object} [params] The params to be appended
   * @returns {string} The formatted url
   */
  module.exports = function buildURL(url, params, paramsSerializer) {
    /*eslint no-param-reassign:0*/
    if (!params) {
      return url;
    }
  
    var serializedParams;
    if (paramsSerializer) {
      serializedParams = paramsSerializer(params);
    } else {
      var parts = [];
  
      utils.forEach(params, function serialize(val, key) {
        if (val === null || typeof val === 'undefined') {
          return;
        }
  
        if (utils.isArray(val)) {
          key = key + '[]';
        }
  
        if (!utils.isArray(val)) {
          val = [val];
        }
  
        utils.forEach(val, function parseValue(v) {
          if (utils.isDate(v)) {
            v = v.toISOString();
          } else if (utils.isObject(v)) {
            v = JSON.stringify(v);
          }
          parts.push(encode(key) + '=' + encode(v));
        });
      });
  
      serializedParams = parts.join('&');
    }
  
    if (serializedParams) {
      url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
    }
  
    return url;
  };
  
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/buildURL.js","/../node_modules/axios/lib/helpers")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],10:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /**
   * Creates a new URL by combining the specified URLs
   *
   * @param {string} baseURL The base URL
   * @param {string} relativeURL The relative URL
   * @returns {string} The combined URL
   */
  module.exports = function combineURLs(baseURL, relativeURL) {
    return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/combineURLs.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],11:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  module.exports = (
    utils.isStandardBrowserEnv() ?
  
    // Standard browser envs support document.cookie
    (function standardBrowserEnv() {
      return {
        write: function write(name, value, expires, path, domain, secure) {
          var cookie = [];
          cookie.push(name + '=' + encodeURIComponent(value));
  
          if (utils.isNumber(expires)) {
            cookie.push('expires=' + new Date(expires).toGMTString());
          }
  
          if (utils.isString(path)) {
            cookie.push('path=' + path);
          }
  
          if (utils.isString(domain)) {
            cookie.push('domain=' + domain);
          }
  
          if (secure === true) {
            cookie.push('secure');
          }
  
          document.cookie = cookie.join('; ');
        },
  
        read: function read(name) {
          var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
          return (match ? decodeURIComponent(match[3]) : null);
        },
  
        remove: function remove(name) {
          this.write(name, '', Date.now() - 86400000);
        }
      };
    })() :
  
    // Non standard browser env (web workers, react-native) lack needed support.
    (function nonStandardBrowserEnv() {
      return {
        write: function write() {},
        read: function read() { return null; },
        remove: function remove() {}
      };
    })()
  );
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/cookies.js","/../node_modules/axios/lib/helpers")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],12:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /**
   * Determines whether the specified URL is absolute
   *
   * @param {string} url The URL to test
   * @returns {boolean} True if the specified URL is absolute, otherwise false
   */
  module.exports = function isAbsoluteURL(url) {
    // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
    // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
    // by any combination of letters, digits, plus, period, or hyphen.
    return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/isAbsoluteURL.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],13:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  module.exports = (
    utils.isStandardBrowserEnv() ?
  
    // Standard browser envs have full support of the APIs needed to test
    // whether the request URL is of the same origin as current location.
    (function standardBrowserEnv() {
      var msie = /(msie|trident)/i.test(navigator.userAgent);
      var urlParsingNode = document.createElement('a');
      var originURL;
  
      /**
      * Parse a URL to discover it's components
      *
      * @param {String} url The URL to be parsed
      * @returns {Object}
      */
      function resolveURL(url) {
        var href = url;
  
        if (msie) {
          // IE needs attribute set twice to normalize properties
          urlParsingNode.setAttribute('href', href);
          href = urlParsingNode.href;
        }
  
        urlParsingNode.setAttribute('href', href);
  
        // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
        return {
          href: urlParsingNode.href,
          protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
          host: urlParsingNode.host,
          search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
          hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
          hostname: urlParsingNode.hostname,
          port: urlParsingNode.port,
          pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
                    urlParsingNode.pathname :
                    '/' + urlParsingNode.pathname
        };
      }
  
      originURL = resolveURL(window.location.href);
  
      /**
      * Determine if a URL shares the same origin as the current location
      *
      * @param {String} requestURL The URL to test
      * @returns {boolean} True if URL shares the same origin, otherwise false
      */
      return function isURLSameOrigin(requestURL) {
        var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
        return (parsed.protocol === originURL.protocol &&
              parsed.host === originURL.host);
      };
    })() :
  
    // Non standard browser envs (web workers, react-native) lack needed support.
    (function nonStandardBrowserEnv() {
      return function isURLSameOrigin() {
        return true;
      };
    })()
  );
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/isURLSameOrigin.js","/../node_modules/axios/lib/helpers")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],14:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  /**
   * Parse headers into an object
   *
   * ```
   * Date: Wed, 27 Aug 2014 08:58:49 GMT
   * Content-Type: application/json
   * Connection: keep-alive
   * Transfer-Encoding: chunked
   * ```
   *
   * @param {String} headers Headers needing to be parsed
   * @returns {Object} Headers parsed into an object
   */
  module.exports = function parseHeaders(headers) {
    var parsed = {};
    var key;
    var val;
    var i;
  
    if (!headers) { return parsed; }
  
    utils.forEach(headers.split('\n'), function parser(line) {
      i = line.indexOf(':');
      key = utils.trim(line.substr(0, i)).toLowerCase();
      val = utils.trim(line.substr(i + 1));
  
      if (key) {
        parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
      }
    });
  
    return parsed;
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/parseHeaders.js","/../node_modules/axios/lib/helpers")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],15:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /**
   * Resolve or reject a Promise based on response status.
   *
   * @param {Function} resolve A function that resolves the promise.
   * @param {Function} reject A function that rejects the promise.
   * @param {object} response The response.
   */
  module.exports = function settle(resolve, reject, response) {
    var validateStatus = response.config.validateStatus;
    // Note: status is not exposed by XDomainRequest
    if (!response.status || !validateStatus || validateStatus(response.status)) {
      resolve(response);
    } else {
      reject(response);
    }
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/settle.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],16:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /**
   * Syntactic sugar for invoking a function and expanding an array for arguments.
   *
   * Common use case would be to use `Function.prototype.apply`.
   *
   *  ```js
   *  function f(x, y, z) {}
   *  var args = [1, 2, 3];
   *  f.apply(null, args);
   *  ```
   *
   * With `spread` this example can be re-written.
   *
   *  ```js
   *  spread(function(x, y, z) {})([1, 2, 3]);
   *  ```
   *
   * @param {Function} callback
   * @returns {Function}
   */
  module.exports = function spread(callback) {
    return function wrap(arr) {
      return callback.apply(null, arr);
    };
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/spread.js","/../node_modules/axios/lib/helpers")
  },{"1YiZ5S":23,"buffer":20}],17:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var utils = require('./../utils');
  
  /**
   * Transform the data for a request or a response
   *
   * @param {Object|String} data The data to be transformed
   * @param {Array} headers The headers for the request or response
   * @param {Array|Function} fns A single function or Array of functions
   * @returns {*} The resulting transformed data
   */
  module.exports = function transformData(data, headers, fns) {
    /*eslint no-param-reassign:0*/
    utils.forEach(fns, function transform(fn) {
      data = fn(data, headers);
    });
  
    return data;
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/helpers/transformData.js","/../node_modules/axios/lib/helpers")
  },{"./../utils":18,"1YiZ5S":23,"buffer":20}],18:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  /*global toString:true*/
  
  // utils is a library of generic helper functions non-specific to axios
  
  var toString = Object.prototype.toString;
  
  /**
   * Determine if a value is an Array
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an Array, otherwise false
   */
  function isArray(val) {
    return toString.call(val) === '[object Array]';
  }
  
  /**
   * Determine if a value is an ArrayBuffer
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an ArrayBuffer, otherwise false
   */
  function isArrayBuffer(val) {
    return toString.call(val) === '[object ArrayBuffer]';
  }
  
  /**
   * Determine if a value is a FormData
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an FormData, otherwise false
   */
  function isFormData(val) {
    return (typeof FormData !== 'undefined') && (val instanceof FormData);
  }
  
  /**
   * Determine if a value is a view on an ArrayBuffer
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
   */
  function isArrayBufferView(val) {
    var result;
    if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
      result = ArrayBuffer.isView(val);
    } else {
      result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
    }
    return result;
  }
  
  /**
   * Determine if a value is a String
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a String, otherwise false
   */
  function isString(val) {
    return typeof val === 'string';
  }
  
  /**
   * Determine if a value is a Number
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Number, otherwise false
   */
  function isNumber(val) {
    return typeof val === 'number';
  }
  
  /**
   * Determine if a value is undefined
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if the value is undefined, otherwise false
   */
  function isUndefined(val) {
    return typeof val === 'undefined';
  }
  
  /**
   * Determine if a value is an Object
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an Object, otherwise false
   */
  function isObject(val) {
    return val !== null && typeof val === 'object';
  }
  
  /**
   * Determine if a value is a Date
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Date, otherwise false
   */
  function isDate(val) {
    return toString.call(val) === '[object Date]';
  }
  
  /**
   * Determine if a value is a File
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a File, otherwise false
   */
  function isFile(val) {
    return toString.call(val) === '[object File]';
  }
  
  /**
   * Determine if a value is a Blob
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Blob, otherwise false
   */
  function isBlob(val) {
    return toString.call(val) === '[object Blob]';
  }
  
  /**
   * Determine if a value is a Function
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Function, otherwise false
   */
  function isFunction(val) {
    return toString.call(val) === '[object Function]';
  }
  
  /**
   * Determine if a value is a Stream
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Stream, otherwise false
   */
  function isStream(val) {
    return isObject(val) && isFunction(val.pipe);
  }
  
  /**
   * Trim excess whitespace off the beginning and end of a string
   *
   * @param {String} str The String to trim
   * @returns {String} The String freed of excess whitespace
   */
  function trim(str) {
    return str.replace(/^\s*/, '').replace(/\s*$/, '');
  }
  
  /**
   * Determine if we're running in a standard browser environment
   *
   * This allows axios to run in a web worker, and react-native.
   * Both environments support XMLHttpRequest, but not fully standard globals.
   *
   * web workers:
   *  typeof window -> undefined
   *  typeof document -> undefined
   *
   * react-native:
   *  typeof document.createElement -> undefined
   */
  function isStandardBrowserEnv() {
    return (
      typeof window !== 'undefined' &&
      typeof document !== 'undefined' &&
      typeof document.createElement === 'function'
    );
  }
  
  /**
   * Iterate over an Array or an Object invoking a function for each item.
   *
   * If `obj` is an Array callback will be called passing
   * the value, index, and complete array for each item.
   *
   * If 'obj' is an Object callback will be called passing
   * the value, key, and complete object for each property.
   *
   * @param {Object|Array} obj The object to iterate
   * @param {Function} fn The callback to invoke for each item
   */
  function forEach(obj, fn) {
    // Don't bother if no value provided
    if (obj === null || typeof obj === 'undefined') {
      return;
    }
  
    // Force an array if not already something iterable
    if (typeof obj !== 'object' && !isArray(obj)) {
      /*eslint no-param-reassign:0*/
      obj = [obj];
    }
  
    if (isArray(obj)) {
      // Iterate over array values
      for (var i = 0, l = obj.length; i < l; i++) {
        fn.call(null, obj[i], i, obj);
      }
    } else {
      // Iterate over object keys
      for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
          fn.call(null, obj[key], key, obj);
        }
      }
    }
  }
  
  /**
   * Accepts varargs expecting each argument to be an object, then
   * immutably merges the properties of each object and returns result.
   *
   * When multiple objects contain the same key the later object in
   * the arguments list will take precedence.
   *
   * Example:
   *
   * ```js
   * var result = merge({foo: 123}, {foo: 456});
   * console.log(result.foo); // outputs 456
   * ```
   *
   * @param {Object} obj1 Object to merge
   * @returns {Object} Result of all merge properties
   */
  function merge(/* obj1, obj2, obj3, ... */) {
    var result = {};
    function assignValue(val, key) {
      if (typeof result[key] === 'object' && typeof val === 'object') {
        result[key] = merge(result[key], val);
      } else {
        result[key] = val;
      }
    }
  
    for (var i = 0, l = arguments.length; i < l; i++) {
      forEach(arguments[i], assignValue);
    }
    return result;
  }
  
  module.exports = {
    isArray: isArray,
    isArrayBuffer: isArrayBuffer,
    isFormData: isFormData,
    isArrayBufferView: isArrayBufferView,
    isString: isString,
    isNumber: isNumber,
    isObject: isObject,
    isUndefined: isUndefined,
    isDate: isDate,
    isFile: isFile,
    isBlob: isBlob,
    isFunction: isFunction,
    isStream: isStream,
    isStandardBrowserEnv: isStandardBrowserEnv,
    forEach: forEach,
    merge: merge,
    trim: trim
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/axios/lib/utils.js","/../node_modules/axios/lib")
  },{"1YiZ5S":23,"buffer":20}],19:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  /*!
   * @overview es6-promise - a tiny implementation of Promises/A+.
   * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
   * @license   Licensed under MIT license
   *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
   * @version   3.1.2
   */
  
  (function() {
      "use strict";
      function lib$es6$promise$utils$$objectOrFunction(x) {
        return typeof x === 'function' || (typeof x === 'object' && x !== null);
      }
  
      function lib$es6$promise$utils$$isFunction(x) {
        return typeof x === 'function';
      }
  
      function lib$es6$promise$utils$$isMaybeThenable(x) {
        return typeof x === 'object' && x !== null;
      }
  
      var lib$es6$promise$utils$$_isArray;
      if (!Array.isArray) {
        lib$es6$promise$utils$$_isArray = function (x) {
          return Object.prototype.toString.call(x) === '[object Array]';
        };
      } else {
        lib$es6$promise$utils$$_isArray = Array.isArray;
      }
  
      var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
      var lib$es6$promise$asap$$len = 0;
      var lib$es6$promise$asap$$vertxNext;
      var lib$es6$promise$asap$$customSchedulerFn;
  
      var lib$es6$promise$asap$$asap = function asap(callback, arg) {
        lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
        lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
        lib$es6$promise$asap$$len += 2;
        if (lib$es6$promise$asap$$len === 2) {
          // If len is 2, that means that we need to schedule an async flush.
          // If additional callbacks are queued before the queue is flushed, they
          // will be processed by this flush that we are scheduling.
          if (lib$es6$promise$asap$$customSchedulerFn) {
            lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
          } else {
            lib$es6$promise$asap$$scheduleFlush();
          }
        }
      }
  
      function lib$es6$promise$asap$$setScheduler(scheduleFn) {
        lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
      }
  
      function lib$es6$promise$asap$$setAsap(asapFn) {
        lib$es6$promise$asap$$asap = asapFn;
      }
  
      var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
      var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
      var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
      var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  
      // test for web worker but not in IE10
      var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
        typeof importScripts !== 'undefined' &&
        typeof MessageChannel !== 'undefined';
  
      // node
      function lib$es6$promise$asap$$useNextTick() {
        // node version 0.10.x displays a deprecation warning when nextTick is used recursively
        // see https://github.com/cujojs/when/issues/410 for details
        return function() {
          process.nextTick(lib$es6$promise$asap$$flush);
        };
      }
  
      // vertx
      function lib$es6$promise$asap$$useVertxTimer() {
        return function() {
          lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
        };
      }
  
      function lib$es6$promise$asap$$useMutationObserver() {
        var iterations = 0;
        var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
        var node = document.createTextNode('');
        observer.observe(node, { characterData: true });
  
        return function() {
          node.data = (iterations = ++iterations % 2);
        };
      }
  
      // web worker
      function lib$es6$promise$asap$$useMessageChannel() {
        var channel = new MessageChannel();
        channel.port1.onmessage = lib$es6$promise$asap$$flush;
        return function () {
          channel.port2.postMessage(0);
        };
      }
  
      function lib$es6$promise$asap$$useSetTimeout() {
        return function() {
          setTimeout(lib$es6$promise$asap$$flush, 1);
        };
      }
  
      var lib$es6$promise$asap$$queue = new Array(1000);
      function lib$es6$promise$asap$$flush() {
        for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
          var callback = lib$es6$promise$asap$$queue[i];
          var arg = lib$es6$promise$asap$$queue[i+1];
  
          callback(arg);
  
          lib$es6$promise$asap$$queue[i] = undefined;
          lib$es6$promise$asap$$queue[i+1] = undefined;
        }
  
        lib$es6$promise$asap$$len = 0;
      }
  
      function lib$es6$promise$asap$$attemptVertx() {
        try {
          var r = require;
          var vertx = r('vertx');
          lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
          return lib$es6$promise$asap$$useVertxTimer();
        } catch(e) {
          return lib$es6$promise$asap$$useSetTimeout();
        }
      }
  
      var lib$es6$promise$asap$$scheduleFlush;
      // Decide what async method to use to triggering processing of queued callbacks:
      if (lib$es6$promise$asap$$isNode) {
        lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
      } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
        lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
      } else if (lib$es6$promise$asap$$isWorker) {
        lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
      } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
        lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
      } else {
        lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
      }
      function lib$es6$promise$then$$then(onFulfillment, onRejection) {
        var parent = this;
        var state = parent._state;
  
        if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
          return this;
        }
  
        var child = new this.constructor(lib$es6$promise$$internal$$noop);
        var result = parent._result;
  
        if (state) {
          var callback = arguments[state - 1];
          lib$es6$promise$asap$$asap(function(){
            lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
          });
        } else {
          lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
        }
  
        return child;
      }
      var lib$es6$promise$then$$default = lib$es6$promise$then$$then;
      function lib$es6$promise$promise$resolve$$resolve(object) {
        /*jshint validthis:true */
        var Constructor = this;
  
        if (object && typeof object === 'object' && object.constructor === Constructor) {
          return object;
        }
  
        var promise = new Constructor(lib$es6$promise$$internal$$noop);
        lib$es6$promise$$internal$$resolve(promise, object);
        return promise;
      }
      var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
  
      function lib$es6$promise$$internal$$noop() {}
  
      var lib$es6$promise$$internal$$PENDING   = void 0;
      var lib$es6$promise$$internal$$FULFILLED = 1;
      var lib$es6$promise$$internal$$REJECTED  = 2;
  
      var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  
      function lib$es6$promise$$internal$$selfFulfillment() {
        return new TypeError("You cannot resolve a promise with itself");
      }
  
      function lib$es6$promise$$internal$$cannotReturnOwn() {
        return new TypeError('A promises callback cannot return that same promise.');
      }
  
      function lib$es6$promise$$internal$$getThen(promise) {
        try {
          return promise.then;
        } catch(error) {
          lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
          return lib$es6$promise$$internal$$GET_THEN_ERROR;
        }
      }
  
      function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
        try {
          then.call(value, fulfillmentHandler, rejectionHandler);
        } catch(e) {
          return e;
        }
      }
  
      function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
         lib$es6$promise$asap$$asap(function(promise) {
          var sealed = false;
          var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
            if (sealed) { return; }
            sealed = true;
            if (thenable !== value) {
              lib$es6$promise$$internal$$resolve(promise, value);
            } else {
              lib$es6$promise$$internal$$fulfill(promise, value);
            }
          }, function(reason) {
            if (sealed) { return; }
            sealed = true;
  
            lib$es6$promise$$internal$$reject(promise, reason);
          }, 'Settle: ' + (promise._label || ' unknown promise'));
  
          if (!sealed && error) {
            sealed = true;
            lib$es6$promise$$internal$$reject(promise, error);
          }
        }, promise);
      }
  
      function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
        if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
          lib$es6$promise$$internal$$fulfill(promise, thenable._result);
        } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
          lib$es6$promise$$internal$$reject(promise, thenable._result);
        } else {
          lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
            lib$es6$promise$$internal$$resolve(promise, value);
          }, function(reason) {
            lib$es6$promise$$internal$$reject(promise, reason);
          });
        }
      }
  
      function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable, then) {
        if (maybeThenable.constructor === promise.constructor &&
            then === lib$es6$promise$then$$default &&
            constructor.resolve === lib$es6$promise$promise$resolve$$default) {
          lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
        } else {
          if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
            lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
          } else if (then === undefined) {
            lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
          } else if (lib$es6$promise$utils$$isFunction(then)) {
            lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
          } else {
            lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
          }
        }
      }
  
      function lib$es6$promise$$internal$$resolve(promise, value) {
        if (promise === value) {
          lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
        } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
          lib$es6$promise$$internal$$handleMaybeThenable(promise, value, lib$es6$promise$$internal$$getThen(value));
        } else {
          lib$es6$promise$$internal$$fulfill(promise, value);
        }
      }
  
      function lib$es6$promise$$internal$$publishRejection(promise) {
        if (promise._onerror) {
          promise._onerror(promise._result);
        }
  
        lib$es6$promise$$internal$$publish(promise);
      }
  
      function lib$es6$promise$$internal$$fulfill(promise, value) {
        if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
  
        promise._result = value;
        promise._state = lib$es6$promise$$internal$$FULFILLED;
  
        if (promise._subscribers.length !== 0) {
          lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
        }
      }
  
      function lib$es6$promise$$internal$$reject(promise, reason) {
        if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
        promise._state = lib$es6$promise$$internal$$REJECTED;
        promise._result = reason;
  
        lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
      }
  
      function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
        var subscribers = parent._subscribers;
        var length = subscribers.length;
  
        parent._onerror = null;
  
        subscribers[length] = child;
        subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
        subscribers[length + lib$es6$promise$$internal$$REJECTED]  = onRejection;
  
        if (length === 0 && parent._state) {
          lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
        }
      }
  
      function lib$es6$promise$$internal$$publish(promise) {
        var subscribers = promise._subscribers;
        var settled = promise._state;
  
        if (subscribers.length === 0) { return; }
  
        var child, callback, detail = promise._result;
  
        for (var i = 0; i < subscribers.length; i += 3) {
          child = subscribers[i];
          callback = subscribers[i + settled];
  
          if (child) {
            lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
          } else {
            callback(detail);
          }
        }
  
        promise._subscribers.length = 0;
      }
  
      function lib$es6$promise$$internal$$ErrorObject() {
        this.error = null;
      }
  
      var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  
      function lib$es6$promise$$internal$$tryCatch(callback, detail) {
        try {
          return callback(detail);
        } catch(e) {
          lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
          return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
        }
      }
  
      function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
        var hasCallback = lib$es6$promise$utils$$isFunction(callback),
            value, error, succeeded, failed;
  
        if (hasCallback) {
          value = lib$es6$promise$$internal$$tryCatch(callback, detail);
  
          if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
            failed = true;
            error = value.error;
            value = null;
          } else {
            succeeded = true;
          }
  
          if (promise === value) {
            lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
            return;
          }
  
        } else {
          value = detail;
          succeeded = true;
        }
  
        if (promise._state !== lib$es6$promise$$internal$$PENDING) {
          // noop
        } else if (hasCallback && succeeded) {
          lib$es6$promise$$internal$$resolve(promise, value);
        } else if (failed) {
          lib$es6$promise$$internal$$reject(promise, error);
        } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
          lib$es6$promise$$internal$$fulfill(promise, value);
        } else if (settled === lib$es6$promise$$internal$$REJECTED) {
          lib$es6$promise$$internal$$reject(promise, value);
        }
      }
  
      function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
        try {
          resolver(function resolvePromise(value){
            lib$es6$promise$$internal$$resolve(promise, value);
          }, function rejectPromise(reason) {
            lib$es6$promise$$internal$$reject(promise, reason);
          });
        } catch(e) {
          lib$es6$promise$$internal$$reject(promise, e);
        }
      }
  
      function lib$es6$promise$promise$all$$all(entries) {
        return new lib$es6$promise$enumerator$$default(this, entries).promise;
      }
      var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
      function lib$es6$promise$promise$race$$race(entries) {
        /*jshint validthis:true */
        var Constructor = this;
  
        var promise = new Constructor(lib$es6$promise$$internal$$noop);
  
        if (!lib$es6$promise$utils$$isArray(entries)) {
          lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
          return promise;
        }
  
        var length = entries.length;
  
        function onFulfillment(value) {
          lib$es6$promise$$internal$$resolve(promise, value);
        }
  
        function onRejection(reason) {
          lib$es6$promise$$internal$$reject(promise, reason);
        }
  
        for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
          lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
        }
  
        return promise;
      }
      var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
      function lib$es6$promise$promise$reject$$reject(reason) {
        /*jshint validthis:true */
        var Constructor = this;
        var promise = new Constructor(lib$es6$promise$$internal$$noop);
        lib$es6$promise$$internal$$reject(promise, reason);
        return promise;
      }
      var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
  
      var lib$es6$promise$promise$$counter = 0;
  
      function lib$es6$promise$promise$$needsResolver() {
        throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
      }
  
      function lib$es6$promise$promise$$needsNew() {
        throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
      }
  
      var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
      /**
        Promise objects represent the eventual result of an asynchronous operation. The
        primary way of interacting with a promise is through its `then` method, which
        registers callbacks to receive either a promise's eventual value or the reason
        why the promise cannot be fulfilled.
  
        Terminology
        -----------
  
        - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
        - `thenable` is an object or function that defines a `then` method.
        - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
        - `exception` is a value that is thrown using the throw statement.
        - `reason` is a value that indicates why a promise was rejected.
        - `settled` the final resting state of a promise, fulfilled or rejected.
  
        A promise can be in one of three states: pending, fulfilled, or rejected.
  
        Promises that are fulfilled have a fulfillment value and are in the fulfilled
        state.  Promises that are rejected have a rejection reason and are in the
        rejected state.  A fulfillment value is never a thenable.
  
        Promises can also be said to *resolve* a value.  If this value is also a
        promise, then the original promise's settled state will match the value's
        settled state.  So a promise that *resolves* a promise that rejects will
        itself reject, and a promise that *resolves* a promise that fulfills will
        itself fulfill.
  
  
        Basic Usage:
        ------------
  
        ```js
        var promise = new Promise(function(resolve, reject) {
          // on success
          resolve(value);
  
          // on failure
          reject(reason);
        });
  
        promise.then(function(value) {
          // on fulfillment
        }, function(reason) {
          // on rejection
        });
        ```
  
        Advanced Usage:
        ---------------
  
        Promises shine when abstracting away asynchronous interactions such as
        `XMLHttpRequest`s.
  
        ```js
        function getJSON(url) {
          return new Promise(function(resolve, reject){
            var xhr = new XMLHttpRequest();
  
            xhr.open('GET', url);
            xhr.onreadystatechange = handler;
            xhr.responseType = 'json';
            xhr.setRequestHeader('Accept', 'application/json');
            xhr.send();
  
            function handler() {
              if (this.readyState === this.DONE) {
                if (this.status === 200) {
                  resolve(this.response);
                } else {
                  reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
                }
              }
            };
          });
        }
  
        getJSON('/posts.json').then(function(json) {
          // on fulfillment
        }, function(reason) {
          // on rejection
        });
        ```
  
        Unlike callbacks, promises are great composable primitives.
  
        ```js
        Promise.all([
          getJSON('/posts'),
          getJSON('/comments')
        ]).then(function(values){
          values[0] // => postsJSON
          values[1] // => commentsJSON
  
          return values;
        });
        ```
  
        @class Promise
        @param {function} resolver
        Useful for tooling.
        @constructor
      */
      function lib$es6$promise$promise$$Promise(resolver) {
        this._id = lib$es6$promise$promise$$counter++;
        this._state = undefined;
        this._result = undefined;
        this._subscribers = [];
  
        if (lib$es6$promise$$internal$$noop !== resolver) {
          typeof resolver !== 'function' && lib$es6$promise$promise$$needsResolver();
          this instanceof lib$es6$promise$promise$$Promise ? lib$es6$promise$$internal$$initializePromise(this, resolver) : lib$es6$promise$promise$$needsNew();
        }
      }
  
      lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
      lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
      lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
      lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
      lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
      lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
      lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
  
      lib$es6$promise$promise$$Promise.prototype = {
        constructor: lib$es6$promise$promise$$Promise,
  
      /**
        The primary way of interacting with a promise is through its `then` method,
        which registers callbacks to receive either a promise's eventual value or the
        reason why the promise cannot be fulfilled.
  
        ```js
        findUser().then(function(user){
          // user is available
        }, function(reason){
          // user is unavailable, and you are given the reason why
        });
        ```
  
        Chaining
        --------
  
        The return value of `then` is itself a promise.  This second, 'downstream'
        promise is resolved with the return value of the first promise's fulfillment
        or rejection handler, or rejected if the handler throws an exception.
  
        ```js
        findUser().then(function (user) {
          return user.name;
        }, function (reason) {
          return 'default name';
        }).then(function (userName) {
          // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
          // will be `'default name'`
        });
  
        findUser().then(function (user) {
          throw new Error('Found user, but still unhappy');
        }, function (reason) {
          throw new Error('`findUser` rejected and we're unhappy');
        }).then(function (value) {
          // never reached
        }, function (reason) {
          // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
          // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
        });
        ```
        If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  
        ```js
        findUser().then(function (user) {
          throw new PedagogicalException('Upstream error');
        }).then(function (value) {
          // never reached
        }).then(function (value) {
          // never reached
        }, function (reason) {
          // The `PedgagocialException` is propagated all the way down to here
        });
        ```
  
        Assimilation
        ------------
  
        Sometimes the value you want to propagate to a downstream promise can only be
        retrieved asynchronously. This can be achieved by returning a promise in the
        fulfillment or rejection handler. The downstream promise will then be pending
        until the returned promise is settled. This is called *assimilation*.
  
        ```js
        findUser().then(function (user) {
          return findCommentsByAuthor(user);
        }).then(function (comments) {
          // The user's comments are now available
        });
        ```
  
        If the assimliated promise rejects, then the downstream promise will also reject.
  
        ```js
        findUser().then(function (user) {
          return findCommentsByAuthor(user);
        }).then(function (comments) {
          // If `findCommentsByAuthor` fulfills, we'll have the value here
        }, function (reason) {
          // If `findCommentsByAuthor` rejects, we'll have the reason here
        });
        ```
  
        Simple Example
        --------------
  
        Synchronous Example
  
        ```javascript
        var result;
  
        try {
          result = findResult();
          // success
        } catch(reason) {
          // failure
        }
        ```
  
        Errback Example
  
        ```js
        findResult(function(result, err){
          if (err) {
            // failure
          } else {
            // success
          }
        });
        ```
  
        Promise Example;
  
        ```javascript
        findResult().then(function(result){
          // success
        }, function(reason){
          // failure
        });
        ```
  
        Advanced Example
        --------------
  
        Synchronous Example
  
        ```javascript
        var author, books;
  
        try {
          author = findAuthor();
          books  = findBooksByAuthor(author);
          // success
        } catch(reason) {
          // failure
        }
        ```
  
        Errback Example
  
        ```js
  
        function foundBooks(books) {
  
        }
  
        function failure(reason) {
  
        }
  
        findAuthor(function(author, err){
          if (err) {
            failure(err);
            // failure
          } else {
            try {
              findBoooksByAuthor(author, function(books, err) {
                if (err) {
                  failure(err);
                } else {
                  try {
                    foundBooks(books);
                  } catch(reason) {
                    failure(reason);
                  }
                }
              });
            } catch(error) {
              failure(err);
            }
            // success
          }
        });
        ```
  
        Promise Example;
  
        ```javascript
        findAuthor().
          then(findBooksByAuthor).
          then(function(books){
            // found books
        }).catch(function(reason){
          // something went wrong
        });
        ```
  
        @method then
        @param {Function} onFulfilled
        @param {Function} onRejected
        Useful for tooling.
        @return {Promise}
      */
        then: lib$es6$promise$then$$default,
  
      /**
        `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
        as the catch block of a try/catch statement.
  
        ```js
        function findAuthor(){
          throw new Error('couldn't find that author');
        }
  
        // synchronous
        try {
          findAuthor();
        } catch(reason) {
          // something went wrong
        }
  
        // async with promises
        findAuthor().catch(function(reason){
          // something went wrong
        });
        ```
  
        @method catch
        @param {Function} onRejection
        Useful for tooling.
        @return {Promise}
      */
        'catch': function(onRejection) {
          return this.then(null, onRejection);
        }
      };
      var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
      function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
        this._instanceConstructor = Constructor;
        this.promise = new Constructor(lib$es6$promise$$internal$$noop);
  
        if (Array.isArray(input)) {
          this._input     = input;
          this.length     = input.length;
          this._remaining = input.length;
  
          this._result = new Array(this.length);
  
          if (this.length === 0) {
            lib$es6$promise$$internal$$fulfill(this.promise, this._result);
          } else {
            this.length = this.length || 0;
            this._enumerate();
            if (this._remaining === 0) {
              lib$es6$promise$$internal$$fulfill(this.promise, this._result);
            }
          }
        } else {
          lib$es6$promise$$internal$$reject(this.promise, this._validationError());
        }
      }
  
      lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
        return new Error('Array Methods must be provided an Array');
      };
  
      lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
        var length  = this.length;
        var input   = this._input;
  
        for (var i = 0; this._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
          this._eachEntry(input[i], i);
        }
      };
  
      lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
        var c = this._instanceConstructor;
        var resolve = c.resolve;
  
        if (resolve === lib$es6$promise$promise$resolve$$default) {
          var then = lib$es6$promise$$internal$$getThen(entry);
  
          if (then === lib$es6$promise$then$$default &&
              entry._state !== lib$es6$promise$$internal$$PENDING) {
            this._settledAt(entry._state, i, entry._result);
          } else if (typeof then !== 'function') {
            this._remaining--;
            this._result[i] = entry;
          } else if (c === lib$es6$promise$promise$$default) {
            var promise = new c(lib$es6$promise$$internal$$noop);
            lib$es6$promise$$internal$$handleMaybeThenable(promise, entry, then);
            this._willSettleAt(promise, i);
          } else {
            this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);
          }
        } else {
          this._willSettleAt(resolve(entry), i);
        }
      };
  
      lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
        var promise = this.promise;
  
        if (promise._state === lib$es6$promise$$internal$$PENDING) {
          this._remaining--;
  
          if (state === lib$es6$promise$$internal$$REJECTED) {
            lib$es6$promise$$internal$$reject(promise, value);
          } else {
            this._result[i] = value;
          }
        }
  
        if (this._remaining === 0) {
          lib$es6$promise$$internal$$fulfill(promise, this._result);
        }
      };
  
      lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
        var enumerator = this;
  
        lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
          enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
        }, function(reason) {
          enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
        });
      };
      function lib$es6$promise$polyfill$$polyfill() {
        var local;
  
        if (typeof global !== 'undefined') {
            local = global;
        } else if (typeof self !== 'undefined') {
            local = self;
        } else {
            try {
                local = Function('return this')();
            } catch (e) {
                throw new Error('polyfill failed because global object is unavailable in this environment');
            }
        }
  
        var P = local.Promise;
  
        if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
          return;
        }
  
        local.Promise = lib$es6$promise$promise$$default;
      }
      var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
  
      var lib$es6$promise$umd$$ES6Promise = {
        'Promise': lib$es6$promise$promise$$default,
        'polyfill': lib$es6$promise$polyfill$$default
      };
  
      /* global define:true module:true window: true */
      if (typeof define === 'function' && define['amd']) {
        define(function() { return lib$es6$promise$umd$$ES6Promise; });
      } else if (typeof module !== 'undefined' && module['exports']) {
        module['exports'] = lib$es6$promise$umd$$ES6Promise;
      } else if (typeof this !== 'undefined') {
        this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
      }
  
      lib$es6$promise$polyfill$$default();
  }).call(this);
  
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/es6-promise/dist/es6-promise.js","/../node_modules/es6-promise/dist")
  },{"1YiZ5S":23,"buffer":20}],20:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  /*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */
  
  var base64 = require('base64-js')
  var ieee754 = require('ieee754')
  
  exports.Buffer = Buffer
  exports.SlowBuffer = Buffer
  exports.INSPECT_MAX_BYTES = 50
  Buffer.poolSize = 8192
  
  /**
   * If `Buffer._useTypedArrays`:
   *   === true    Use Uint8Array implementation (fastest)
   *   === false   Use Object implementation (compatible down to IE6)
   */
  Buffer._useTypedArrays = (function () {
    // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+,
    // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding
    // properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support
    // because we need to be able to add all the node Buffer API methods. This is an issue
    // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438
    try {
      var buf = new ArrayBuffer(0)
      var arr = new Uint8Array(buf)
      arr.foo = function () { return 42 }
      return 42 === arr.foo() &&
          typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray`
    } catch (e) {
      return false
    }
  })()
  
  /**
   * Class: Buffer
   * =============
   *
   * The Buffer constructor returns instances of `Uint8Array` that are augmented
   * with function properties for all the node `Buffer` API functions. We use
   * `Uint8Array` so that square bracket notation works as expected -- it returns
   * a single octet.
   *
   * By augmenting the instances, we can avoid modifying the `Uint8Array`
   * prototype.
   */
  function Buffer (subject, encoding, noZero) {
    if (!(this instanceof Buffer))
      return new Buffer(subject, encoding, noZero)
  
    var type = typeof subject
  
    // Workaround: node's base64 implementation allows for non-padded strings
    // while base64-js does not.
    if (encoding === 'base64' && type === 'string') {
      subject = stringtrim(subject)
      while (subject.length % 4 !== 0) {
        subject = subject + '='
      }
    }
  
    // Find the length
    var length
    if (type === 'number')
      length = coerce(subject)
    else if (type === 'string')
      length = Buffer.byteLength(subject, encoding)
    else if (type === 'object')
      length = coerce(subject.length) // assume that object is array-like
    else
      throw new Error('First argument needs to be a number, array or string.')
  
    var buf
    if (Buffer._useTypedArrays) {
      // Preferred: Return an augmented `Uint8Array` instance for best performance
      buf = Buffer._augment(new Uint8Array(length))
    } else {
      // Fallback: Return THIS instance of Buffer (created by `new`)
      buf = this
      buf.length = length
      buf._isBuffer = true
    }
  
    var i
    if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') {
      // Speed optimization -- use set if we're copying from a typed array
      buf._set(subject)
    } else if (isArrayish(subject)) {
      // Treat array-ish objects as a byte array
      for (i = 0; i < length; i++) {
        if (Buffer.isBuffer(subject))
          buf[i] = subject.readUInt8(i)
        else
          buf[i] = subject[i]
      }
    } else if (type === 'string') {
      buf.write(subject, 0, encoding)
    } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) {
      for (i = 0; i < length; i++) {
        buf[i] = 0
      }
    }
  
    return buf
  }
  
  // STATIC METHODS
  // ==============
  
  Buffer.isEncoding = function (encoding) {
    switch (String(encoding).toLowerCase()) {
      case 'hex':
      case 'utf8':
      case 'utf-8':
      case 'ascii':
      case 'binary':
      case 'base64':
      case 'raw':
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return true
      default:
        return false
    }
  }
  
  Buffer.isBuffer = function (b) {
    return !!(b !== null && b !== undefined && b._isBuffer)
  }
  
  Buffer.byteLength = function (str, encoding) {
    var ret
    str = str + ''
    switch (encoding || 'utf8') {
      case 'hex':
        ret = str.length / 2
        break
      case 'utf8':
      case 'utf-8':
        ret = utf8ToBytes(str).length
        break
      case 'ascii':
      case 'binary':
      case 'raw':
        ret = str.length
        break
      case 'base64':
        ret = base64ToBytes(str).length
        break
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        ret = str.length * 2
        break
      default:
        throw new Error('Unknown encoding')
    }
    return ret
  }
  
  Buffer.concat = function (list, totalLength) {
    assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\n' +
        'list should be an Array.')
  
    if (list.length === 0) {
      return new Buffer(0)
    } else if (list.length === 1) {
      return list[0]
    }
  
    var i
    if (typeof totalLength !== 'number') {
      totalLength = 0
      for (i = 0; i < list.length; i++) {
        totalLength += list[i].length
      }
    }
  
    var buf = new Buffer(totalLength)
    var pos = 0
    for (i = 0; i < list.length; i++) {
      var item = list[i]
      item.copy(buf, pos)
      pos += item.length
    }
    return buf
  }
  
  // BUFFER INSTANCE METHODS
  // =======================
  
  function _hexWrite (buf, string, offset, length) {
    offset = Number(offset) || 0
    var remaining = buf.length - offset
    if (!length) {
      length = remaining
    } else {
      length = Number(length)
      if (length > remaining) {
        length = remaining
      }
    }
  
    // must be an even number of digits
    var strLen = string.length
    assert(strLen % 2 === 0, 'Invalid hex string')
  
    if (length > strLen / 2) {
      length = strLen / 2
    }
    for (var i = 0; i < length; i++) {
      var byte = parseInt(string.substr(i * 2, 2), 16)
      assert(!isNaN(byte), 'Invalid hex string')
      buf[offset + i] = byte
    }
    Buffer._charsWritten = i * 2
    return i
  }
  
  function _utf8Write (buf, string, offset, length) {
    var charsWritten = Buffer._charsWritten =
      blitBuffer(utf8ToBytes(string), buf, offset, length)
    return charsWritten
  }
  
  function _asciiWrite (buf, string, offset, length) {
    var charsWritten = Buffer._charsWritten =
      blitBuffer(asciiToBytes(string), buf, offset, length)
    return charsWritten
  }
  
  function _binaryWrite (buf, string, offset, length) {
    return _asciiWrite(buf, string, offset, length)
  }
  
  function _base64Write (buf, string, offset, length) {
    var charsWritten = Buffer._charsWritten =
      blitBuffer(base64ToBytes(string), buf, offset, length)
    return charsWritten
  }
  
  function _utf16leWrite (buf, string, offset, length) {
    var charsWritten = Buffer._charsWritten =
      blitBuffer(utf16leToBytes(string), buf, offset, length)
    return charsWritten
  }
  
  Buffer.prototype.write = function (string, offset, length, encoding) {
    // Support both (string, offset, length, encoding)
    // and the legacy (string, encoding, offset, length)
    if (isFinite(offset)) {
      if (!isFinite(length)) {
        encoding = length
        length = undefined
      }
    } else {  // legacy
      var swap = encoding
      encoding = offset
      offset = length
      length = swap
    }
  
    offset = Number(offset) || 0
    var remaining = this.length - offset
    if (!length) {
      length = remaining
    } else {
      length = Number(length)
      if (length > remaining) {
        length = remaining
      }
    }
    encoding = String(encoding || 'utf8').toLowerCase()
  
    var ret
    switch (encoding) {
      case 'hex':
        ret = _hexWrite(this, string, offset, length)
        break
      case 'utf8':
      case 'utf-8':
        ret = _utf8Write(this, string, offset, length)
        break
      case 'ascii':
        ret = _asciiWrite(this, string, offset, length)
        break
      case 'binary':
        ret = _binaryWrite(this, string, offset, length)
        break
      case 'base64':
        ret = _base64Write(this, string, offset, length)
        break
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        ret = _utf16leWrite(this, string, offset, length)
        break
      default:
        throw new Error('Unknown encoding')
    }
    return ret
  }
  
  Buffer.prototype.toString = function (encoding, start, end) {
    var self = this
  
    encoding = String(encoding || 'utf8').toLowerCase()
    start = Number(start) || 0
    end = (end !== undefined)
      ? Number(end)
      : end = self.length
  
    // Fastpath empty strings
    if (end === start)
      return ''
  
    var ret
    switch (encoding) {
      case 'hex':
        ret = _hexSlice(self, start, end)
        break
      case 'utf8':
      case 'utf-8':
        ret = _utf8Slice(self, start, end)
        break
      case 'ascii':
        ret = _asciiSlice(self, start, end)
        break
      case 'binary':
        ret = _binarySlice(self, start, end)
        break
      case 'base64':
        ret = _base64Slice(self, start, end)
        break
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        ret = _utf16leSlice(self, start, end)
        break
      default:
        throw new Error('Unknown encoding')
    }
    return ret
  }
  
  Buffer.prototype.toJSON = function () {
    return {
      type: 'Buffer',
      data: Array.prototype.slice.call(this._arr || this, 0)
    }
  }
  
  // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  Buffer.prototype.copy = function (target, target_start, start, end) {
    var source = this
  
    if (!start) start = 0
    if (!end && end !== 0) end = this.length
    if (!target_start) target_start = 0
  
    // Copy 0 bytes; we're done
    if (end === start) return
    if (target.length === 0 || source.length === 0) return
  
    // Fatal error conditions
    assert(end >= start, 'sourceEnd < sourceStart')
    assert(target_start >= 0 && target_start < target.length,
        'targetStart out of bounds')
    assert(start >= 0 && start < source.length, 'sourceStart out of bounds')
    assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')
  
    // Are we oob?
    if (end > this.length)
      end = this.length
    if (target.length - target_start < end - start)
      end = target.length - target_start + start
  
    var len = end - start
  
    if (len < 100 || !Buffer._useTypedArrays) {
      for (var i = 0; i < len; i++)
        target[i + target_start] = this[i + start]
    } else {
      target._set(this.subarray(start, start + len), target_start)
    }
  }
  
  function _base64Slice (buf, start, end) {
    if (start === 0 && end === buf.length) {
      return base64.fromByteArray(buf)
    } else {
      return base64.fromByteArray(buf.slice(start, end))
    }
  }
  
  function _utf8Slice (buf, start, end) {
    var res = ''
    var tmp = ''
    end = Math.min(buf.length, end)
  
    for (var i = start; i < end; i++) {
      if (buf[i] <= 0x7F) {
        res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
        tmp = ''
      } else {
        tmp += '%' + buf[i].toString(16)
      }
    }
  
    return res + decodeUtf8Char(tmp)
  }
  
  function _asciiSlice (buf, start, end) {
    var ret = ''
    end = Math.min(buf.length, end)
  
    for (var i = start; i < end; i++)
      ret += String.fromCharCode(buf[i])
    return ret
  }
  
  function _binarySlice (buf, start, end) {
    return _asciiSlice(buf, start, end)
  }
  
  function _hexSlice (buf, start, end) {
    var len = buf.length
  
    if (!start || start < 0) start = 0
    if (!end || end < 0 || end > len) end = len
  
    var out = ''
    for (var i = start; i < end; i++) {
      out += toHex(buf[i])
    }
    return out
  }
  
  function _utf16leSlice (buf, start, end) {
    var bytes = buf.slice(start, end)
    var res = ''
    for (var i = 0; i < bytes.length; i += 2) {
      res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)
    }
    return res
  }
  
  Buffer.prototype.slice = function (start, end) {
    var len = this.length
    start = clamp(start, len, 0)
    end = clamp(end, len, len)
  
    if (Buffer._useTypedArrays) {
      return Buffer._augment(this.subarray(start, end))
    } else {
      var sliceLen = end - start
      var newBuf = new Buffer(sliceLen, undefined, true)
      for (var i = 0; i < sliceLen; i++) {
        newBuf[i] = this[i + start]
      }
      return newBuf
    }
  }
  
  // `get` will be removed in Node 0.13+
  Buffer.prototype.get = function (offset) {
    console.log('.get() is deprecated. Access using array indexes instead.')
    return this.readUInt8(offset)
  }
  
  // `set` will be removed in Node 0.13+
  Buffer.prototype.set = function (v, offset) {
    console.log('.set() is deprecated. Access using array indexes instead.')
    return this.writeUInt8(v, offset)
  }
  
  Buffer.prototype.readUInt8 = function (offset, noAssert) {
    if (!noAssert) {
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset < this.length, 'Trying to read beyond buffer length')
    }
  
    if (offset >= this.length)
      return
  
    return this[offset]
  }
  
  function _readUInt16 (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    var val
    if (littleEndian) {
      val = buf[offset]
      if (offset + 1 < len)
        val |= buf[offset + 1] << 8
    } else {
      val = buf[offset] << 8
      if (offset + 1 < len)
        val |= buf[offset + 1]
    }
    return val
  }
  
  Buffer.prototype.readUInt16LE = function (offset, noAssert) {
    return _readUInt16(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readUInt16BE = function (offset, noAssert) {
    return _readUInt16(this, offset, false, noAssert)
  }
  
  function _readUInt32 (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    var val
    if (littleEndian) {
      if (offset + 2 < len)
        val = buf[offset + 2] << 16
      if (offset + 1 < len)
        val |= buf[offset + 1] << 8
      val |= buf[offset]
      if (offset + 3 < len)
        val = val + (buf[offset + 3] << 24 >>> 0)
    } else {
      if (offset + 1 < len)
        val = buf[offset + 1] << 16
      if (offset + 2 < len)
        val |= buf[offset + 2] << 8
      if (offset + 3 < len)
        val |= buf[offset + 3]
      val = val + (buf[offset] << 24 >>> 0)
    }
    return val
  }
  
  Buffer.prototype.readUInt32LE = function (offset, noAssert) {
    return _readUInt32(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readUInt32BE = function (offset, noAssert) {
    return _readUInt32(this, offset, false, noAssert)
  }
  
  Buffer.prototype.readInt8 = function (offset, noAssert) {
    if (!noAssert) {
      assert(offset !== undefined && offset !== null,
          'missing offset')
      assert(offset < this.length, 'Trying to read beyond buffer length')
    }
  
    if (offset >= this.length)
      return
  
    var neg = this[offset] & 0x80
    if (neg)
      return (0xff - this[offset] + 1) * -1
    else
      return this[offset]
  }
  
  function _readInt16 (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    var val = _readUInt16(buf, offset, littleEndian, true)
    var neg = val & 0x8000
    if (neg)
      return (0xffff - val + 1) * -1
    else
      return val
  }
  
  Buffer.prototype.readInt16LE = function (offset, noAssert) {
    return _readInt16(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readInt16BE = function (offset, noAssert) {
    return _readInt16(this, offset, false, noAssert)
  }
  
  function _readInt32 (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    var val = _readUInt32(buf, offset, littleEndian, true)
    var neg = val & 0x80000000
    if (neg)
      return (0xffffffff - val + 1) * -1
    else
      return val
  }
  
  Buffer.prototype.readInt32LE = function (offset, noAssert) {
    return _readInt32(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readInt32BE = function (offset, noAssert) {
    return _readInt32(this, offset, false, noAssert)
  }
  
  function _readFloat (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
    }
  
    return ieee754.read(buf, offset, littleEndian, 23, 4)
  }
  
  Buffer.prototype.readFloatLE = function (offset, noAssert) {
    return _readFloat(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readFloatBE = function (offset, noAssert) {
    return _readFloat(this, offset, false, noAssert)
  }
  
  function _readDouble (buf, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')
    }
  
    return ieee754.read(buf, offset, littleEndian, 52, 8)
  }
  
  Buffer.prototype.readDoubleLE = function (offset, noAssert) {
    return _readDouble(this, offset, true, noAssert)
  }
  
  Buffer.prototype.readDoubleBE = function (offset, noAssert) {
    return _readDouble(this, offset, false, noAssert)
  }
  
  Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset < this.length, 'trying to write beyond buffer length')
      verifuint(value, 0xff)
    }
  
    if (offset >= this.length) return
  
    this[offset] = value
  }
  
  function _writeUInt16 (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 1 < buf.length, 'trying to write beyond buffer length')
      verifuint(value, 0xffff)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {
      buf[offset + i] =
          (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
              (littleEndian ? i : 1 - i) * 8
    }
  }
  
  Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) {
    _writeUInt16(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) {
    _writeUInt16(this, value, offset, false, noAssert)
  }
  
  function _writeUInt32 (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 3 < buf.length, 'trying to write beyond buffer length')
      verifuint(value, 0xffffffff)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {
      buf[offset + i] =
          (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
    }
  }
  
  Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) {
    _writeUInt32(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) {
    _writeUInt32(this, value, offset, false, noAssert)
  }
  
  Buffer.prototype.writeInt8 = function (value, offset, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset < this.length, 'Trying to write beyond buffer length')
      verifsint(value, 0x7f, -0x80)
    }
  
    if (offset >= this.length)
      return
  
    if (value >= 0)
      this.writeUInt8(value, offset, noAssert)
    else
      this.writeUInt8(0xff + value + 1, offset, noAssert)
  }
  
  function _writeInt16 (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')
      verifsint(value, 0x7fff, -0x8000)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    if (value >= 0)
      _writeUInt16(buf, value, offset, littleEndian, noAssert)
    else
      _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)
  }
  
  Buffer.prototype.writeInt16LE = function (value, offset, noAssert) {
    _writeInt16(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeInt16BE = function (value, offset, noAssert) {
    _writeInt16(this, value, offset, false, noAssert)
  }
  
  function _writeInt32 (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')
      verifsint(value, 0x7fffffff, -0x80000000)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    if (value >= 0)
      _writeUInt32(buf, value, offset, littleEndian, noAssert)
    else
      _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)
  }
  
  Buffer.prototype.writeInt32LE = function (value, offset, noAssert) {
    _writeInt32(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeInt32BE = function (value, offset, noAssert) {
    _writeInt32(this, value, offset, false, noAssert)
  }
  
  function _writeFloat (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')
      verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    ieee754.write(buf, value, offset, littleEndian, 23, 4)
  }
  
  Buffer.prototype.writeFloatLE = function (value, offset, noAssert) {
    _writeFloat(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeFloatBE = function (value, offset, noAssert) {
    _writeFloat(this, value, offset, false, noAssert)
  }
  
  function _writeDouble (buf, value, offset, littleEndian, noAssert) {
    if (!noAssert) {
      assert(value !== undefined && value !== null, 'missing value')
      assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
      assert(offset !== undefined && offset !== null, 'missing offset')
      assert(offset + 7 < buf.length,
          'Trying to write beyond buffer length')
      verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)
    }
  
    var len = buf.length
    if (offset >= len)
      return
  
    ieee754.write(buf, value, offset, littleEndian, 52, 8)
  }
  
  Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) {
    _writeDouble(this, value, offset, true, noAssert)
  }
  
  Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) {
    _writeDouble(this, value, offset, false, noAssert)
  }
  
  // fill(value, start=0, end=buffer.length)
  Buffer.prototype.fill = function (value, start, end) {
    if (!value) value = 0
    if (!start) start = 0
    if (!end) end = this.length
  
    if (typeof value === 'string') {
      value = value.charCodeAt(0)
    }
  
    assert(typeof value === 'number' && !isNaN(value), 'value is not a number')
    assert(end >= start, 'end < start')
  
    // Fill 0 bytes; we're done
    if (end === start) return
    if (this.length === 0) return
  
    assert(start >= 0 && start < this.length, 'start out of bounds')
    assert(end >= 0 && end <= this.length, 'end out of bounds')
  
    for (var i = start; i < end; i++) {
      this[i] = value
    }
  }
  
  Buffer.prototype.inspect = function () {
    var out = []
    var len = this.length
    for (var i = 0; i < len; i++) {
      out[i] = toHex(this[i])
      if (i === exports.INSPECT_MAX_BYTES) {
        out[i + 1] = '...'
        break
      }
    }
    return '<Buffer ' + out.join(' ') + '>'
  }
  
  /**
   * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
   * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
   */
  Buffer.prototype.toArrayBuffer = function () {
    if (typeof Uint8Array !== 'undefined') {
      if (Buffer._useTypedArrays) {
        return (new Buffer(this)).buffer
      } else {
        var buf = new Uint8Array(this.length)
        for (var i = 0, len = buf.length; i < len; i += 1)
          buf[i] = this[i]
        return buf.buffer
      }
    } else {
      throw new Error('Buffer.toArrayBuffer not supported in this browser')
    }
  }
  
  // HELPER FUNCTIONS
  // ================
  
  function stringtrim (str) {
    if (str.trim) return str.trim()
    return str.replace(/^\s+|\s+$/g, '')
  }
  
  var BP = Buffer.prototype
  
  /**
   * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
   */
  Buffer._augment = function (arr) {
    arr._isBuffer = true
  
    // save reference to original Uint8Array get/set methods before overwriting
    arr._get = arr.get
    arr._set = arr.set
  
    // deprecated, will be removed in node 0.13+
    arr.get = BP.get
    arr.set = BP.set
  
    arr.write = BP.write
    arr.toString = BP.toString
    arr.toLocaleString = BP.toString
    arr.toJSON = BP.toJSON
    arr.copy = BP.copy
    arr.slice = BP.slice
    arr.readUInt8 = BP.readUInt8
    arr.readUInt16LE = BP.readUInt16LE
    arr.readUInt16BE = BP.readUInt16BE
    arr.readUInt32LE = BP.readUInt32LE
    arr.readUInt32BE = BP.readUInt32BE
    arr.readInt8 = BP.readInt8
    arr.readInt16LE = BP.readInt16LE
    arr.readInt16BE = BP.readInt16BE
    arr.readInt32LE = BP.readInt32LE
    arr.readInt32BE = BP.readInt32BE
    arr.readFloatLE = BP.readFloatLE
    arr.readFloatBE = BP.readFloatBE
    arr.readDoubleLE = BP.readDoubleLE
    arr.readDoubleBE = BP.readDoubleBE
    arr.writeUInt8 = BP.writeUInt8
    arr.writeUInt16LE = BP.writeUInt16LE
    arr.writeUInt16BE = BP.writeUInt16BE
    arr.writeUInt32LE = BP.writeUInt32LE
    arr.writeUInt32BE = BP.writeUInt32BE
    arr.writeInt8 = BP.writeInt8
    arr.writeInt16LE = BP.writeInt16LE
    arr.writeInt16BE = BP.writeInt16BE
    arr.writeInt32LE = BP.writeInt32LE
    arr.writeInt32BE = BP.writeInt32BE
    arr.writeFloatLE = BP.writeFloatLE
    arr.writeFloatBE = BP.writeFloatBE
    arr.writeDoubleLE = BP.writeDoubleLE
    arr.writeDoubleBE = BP.writeDoubleBE
    arr.fill = BP.fill
    arr.inspect = BP.inspect
    arr.toArrayBuffer = BP.toArrayBuffer
  
    return arr
  }
  
  // slice(start, end)
  function clamp (index, len, defaultValue) {
    if (typeof index !== 'number') return defaultValue
    index = ~~index;  // Coerce to integer.
    if (index >= len) return len
    if (index >= 0) return index
    index += len
    if (index >= 0) return index
    return 0
  }
  
  function coerce (length) {
    // Coerce length to a number (possibly NaN), round up
    // in case it's fractional (e.g. 123.456) then do a
    // double negate to coerce a NaN to 0. Easy, right?
    length = ~~Math.ceil(+length)
    return length < 0 ? 0 : length
  }
  
  function isArray (subject) {
    return (Array.isArray || function (subject) {
      return Object.prototype.toString.call(subject) === '[object Array]'
    })(subject)
  }
  
  function isArrayish (subject) {
    return isArray(subject) || Buffer.isBuffer(subject) ||
        subject && typeof subject === 'object' &&
        typeof subject.length === 'number'
  }
  
  function toHex (n) {
    if (n < 16) return '0' + n.toString(16)
    return n.toString(16)
  }
  
  function utf8ToBytes (str) {
    var byteArray = []
    for (var i = 0; i < str.length; i++) {
      var b = str.charCodeAt(i)
      if (b <= 0x7F)
        byteArray.push(str.charCodeAt(i))
      else {
        var start = i
        if (b >= 0xD800 && b <= 0xDFFF) i++
        var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')
        for (var j = 0; j < h.length; j++)
          byteArray.push(parseInt(h[j], 16))
      }
    }
    return byteArray
  }
  
  function asciiToBytes (str) {
    var byteArray = []
    for (var i = 0; i < str.length; i++) {
      // Node's code seems to be doing this and not & 0x7F..
      byteArray.push(str.charCodeAt(i) & 0xFF)
    }
    return byteArray
  }
  
  function utf16leToBytes (str) {
    var c, hi, lo
    var byteArray = []
    for (var i = 0; i < str.length; i++) {
      c = str.charCodeAt(i)
      hi = c >> 8
      lo = c % 256
      byteArray.push(lo)
      byteArray.push(hi)
    }
  
    return byteArray
  }
  
  function base64ToBytes (str) {
    return base64.toByteArray(str)
  }
  
  function blitBuffer (src, dst, offset, length) {
    var pos
    for (var i = 0; i < length; i++) {
      if ((i + offset >= dst.length) || (i >= src.length))
        break
      dst[i + offset] = src[i]
    }
    return i
  }
  
  function decodeUtf8Char (str) {
    try {
      return decodeURIComponent(str)
    } catch (err) {
      return String.fromCharCode(0xFFFD) // UTF 8 invalid char
    }
  }
  
  /*
   * We have to make sure that the value is a valid integer. This means that it
   * is non-negative. It has no fractional component and that it does not
   * exceed the maximum allowed value.
   */
  function verifuint (value, max) {
    assert(typeof value === 'number', 'cannot write a non-number as a number')
    assert(value >= 0, 'specified a negative value for writing an unsigned value')
    assert(value <= max, 'value is larger than maximum value for type')
    assert(Math.floor(value) === value, 'value has a fractional component')
  }
  
  function verifsint (value, max, min) {
    assert(typeof value === 'number', 'cannot write a non-number as a number')
    assert(value <= max, 'value larger than maximum allowed value')
    assert(value >= min, 'value smaller than minimum allowed value')
    assert(Math.floor(value) === value, 'value has a fractional component')
  }
  
  function verifIEEE754 (value, max, min) {
    assert(typeof value === 'number', 'cannot write a non-number as a number')
    assert(value <= max, 'value larger than maximum allowed value')
    assert(value >= min, 'value smaller than minimum allowed value')
  }
  
  function assert (test, message) {
    if (!test) throw new Error(message || 'Failed assertion')
  }
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer/index.js","/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer")
  },{"1YiZ5S":23,"base64-js":21,"buffer":20,"ieee754":22}],21:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  
  ;(function (exports) {
  	'use strict';
  
    var Arr = (typeof Uint8Array !== 'undefined')
      ? Uint8Array
      : Array
  
  	var PLUS   = '+'.charCodeAt(0)
  	var SLASH  = '/'.charCodeAt(0)
  	var NUMBER = '0'.charCodeAt(0)
  	var LOWER  = 'a'.charCodeAt(0)
  	var UPPER  = 'A'.charCodeAt(0)
  	var PLUS_URL_SAFE = '-'.charCodeAt(0)
  	var SLASH_URL_SAFE = '_'.charCodeAt(0)
  
  	function decode (elt) {
  		var code = elt.charCodeAt(0)
  		if (code === PLUS ||
  		    code === PLUS_URL_SAFE)
  			return 62 // '+'
  		if (code === SLASH ||
  		    code === SLASH_URL_SAFE)
  			return 63 // '/'
  		if (code < NUMBER)
  			return -1 //no match
  		if (code < NUMBER + 10)
  			return code - NUMBER + 26 + 26
  		if (code < UPPER + 26)
  			return code - UPPER
  		if (code < LOWER + 26)
  			return code - LOWER + 26
  	}
  
  	function b64ToByteArray (b64) {
  		var i, j, l, tmp, placeHolders, arr
  
  		if (b64.length % 4 > 0) {
  			throw new Error('Invalid string. Length must be a multiple of 4')
  		}
  
  		// the number of equal signs (place holders)
  		// if there are two placeholders, than the two characters before it
  		// represent one byte
  		// if there is only one, then the three characters before it represent 2 bytes
  		// this is just a cheap hack to not do indexOf twice
  		var len = b64.length
  		placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
  
  		// base64 is 4/3 + up to two characters of the original data
  		arr = new Arr(b64.length * 3 / 4 - placeHolders)
  
  		// if there are placeholders, only get up to the last complete 4 chars
  		l = placeHolders > 0 ? b64.length - 4 : b64.length
  
  		var L = 0
  
  		function push (v) {
  			arr[L++] = v
  		}
  
  		for (i = 0, j = 0; i < l; i += 4, j += 3) {
  			tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
  			push((tmp & 0xFF0000) >> 16)
  			push((tmp & 0xFF00) >> 8)
  			push(tmp & 0xFF)
  		}
  
  		if (placeHolders === 2) {
  			tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
  			push(tmp & 0xFF)
  		} else if (placeHolders === 1) {
  			tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
  			push((tmp >> 8) & 0xFF)
  			push(tmp & 0xFF)
  		}
  
  		return arr
  	}
  
  	function uint8ToBase64 (uint8) {
  		var i,
  			extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
  			output = "",
  			temp, length
  
  		function encode (num) {
  			return lookup.charAt(num)
  		}
  
  		function tripletToBase64 (num) {
  			return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
  		}
  
  		// go through the array every three bytes, we'll deal with trailing stuff later
  		for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
  			temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  			output += tripletToBase64(temp)
  		}
  
  		// pad the end with zeros, but make sure to not forget the extra bytes
  		switch (extraBytes) {
  			case 1:
  				temp = uint8[uint8.length - 1]
  				output += encode(temp >> 2)
  				output += encode((temp << 4) & 0x3F)
  				output += '=='
  				break
  			case 2:
  				temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
  				output += encode(temp >> 10)
  				output += encode((temp >> 4) & 0x3F)
  				output += encode((temp << 2) & 0x3F)
  				output += '='
  				break
  		}
  
  		return output
  	}
  
  	exports.toByteArray = b64ToByteArray
  	exports.fromByteArray = uint8ToBase64
  }(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib/b64.js","/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer/node_modules/base64-js/lib")
  },{"1YiZ5S":23,"buffer":20}],22:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  exports.read = function (buffer, offset, isLE, mLen, nBytes) {
    var e, m
    var eLen = nBytes * 8 - mLen - 1
    var eMax = (1 << eLen) - 1
    var eBias = eMax >> 1
    var nBits = -7
    var i = isLE ? (nBytes - 1) : 0
    var d = isLE ? -1 : 1
    var s = buffer[offset + i]
  
    i += d
  
    e = s & ((1 << (-nBits)) - 1)
    s >>= (-nBits)
    nBits += eLen
    for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  
    m = e & ((1 << (-nBits)) - 1)
    e >>= (-nBits)
    nBits += mLen
    for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  
    if (e === 0) {
      e = 1 - eBias
    } else if (e === eMax) {
      return m ? NaN : ((s ? -1 : 1) * Infinity)
    } else {
      m = m + Math.pow(2, mLen)
      e = e - eBias
    }
    return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  }
  
  exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
    var e, m, c
    var eLen = nBytes * 8 - mLen - 1
    var eMax = (1 << eLen) - 1
    var eBias = eMax >> 1
    var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
    var i = isLE ? 0 : (nBytes - 1)
    var d = isLE ? 1 : -1
    var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  
    value = Math.abs(value)
  
    if (isNaN(value) || value === Infinity) {
      m = isNaN(value) ? 1 : 0
      e = eMax
    } else {
      e = Math.floor(Math.log(value) / Math.LN2)
      if (value * (c = Math.pow(2, -e)) < 1) {
        e--
        c *= 2
      }
      if (e + eBias >= 1) {
        value += rt / c
      } else {
        value += rt * Math.pow(2, 1 - eBias)
      }
      if (value * c >= 2) {
        e++
        c /= 2
      }
  
      if (e + eBias >= eMax) {
        m = 0
        e = eMax
      } else if (e + eBias >= 1) {
        m = (value * c - 1) * Math.pow(2, mLen)
        e = e + eBias
      } else {
        m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
        e = 0
      }
    }
  
    for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  
    e = (e << mLen) | m
    eLen += mLen
    for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  
    buffer[offset + i - d] |= s * 128
  }
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer/node_modules/ieee754/index.js","/../node_modules/gulp-browserify/node_modules/browserify/node_modules/buffer/node_modules/ieee754")
  },{"1YiZ5S":23,"buffer":20}],23:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  // shim for using process in browser
  
  var process = module.exports = {};
  
  process.nextTick = (function () {
      var canSetImmediate = typeof window !== 'undefined'
      && window.setImmediate;
      var canPost = typeof window !== 'undefined'
      && window.postMessage && window.addEventListener
      ;
  
      if (canSetImmediate) {
          return function (f) { return window.setImmediate(f) };
      }
  
      if (canPost) {
          var queue = [];
          window.addEventListener('message', function (ev) {
              var source = ev.source;
              if ((source === window || source === null) && ev.data === 'process-tick') {
                  ev.stopPropagation();
                  if (queue.length > 0) {
                      var fn = queue.shift();
                      fn();
                  }
              }
          }, true);
  
          return function nextTick(fn) {
              queue.push(fn);
              window.postMessage('process-tick', '*');
          };
      }
  
      return function nextTick(fn) {
          setTimeout(fn, 0);
      };
  })();
  
  process.title = 'browser';
  process.browser = true;
  process.env = {};
  process.argv = [];
  
  function noop() {}
  
  process.on = noop;
  process.addListener = noop;
  process.once = noop;
  process.off = noop;
  process.removeListener = noop;
  process.removeAllListeners = noop;
  process.emit = noop;
  
  process.binding = function (name) {
      throw new Error('process.binding is not supported');
  }
  
  // TODO(shtylman)
  process.cwd = function () { return '/' };
  process.chdir = function (dir) {
      throw new Error('process.chdir is not supported');
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/../node_modules/gulp-browserify/node_modules/browserify/node_modules/process/browser.js","/../node_modules/gulp-browserify/node_modules/browserify/node_modules/process")
  },{"1YiZ5S":23,"buffer":20}],24:[function(require,module,exports){
  module.exports={
    "name": "clarifai",
    "version": "2.0.17",
    "description": "Official Clarifai Javascript SDK",
    "main": "dist/index.js",
    "repository": "https://github.com/Clarifai/clarifai-javascript",
    "author": "Clarifai Inc.",
    "license": "Apache-2.0",
    "scripts": {
      "jsdoc": "jsdoc src/* -t node_modules/minami -d docs/$npm_package_version && jsdoc src/* -t node_modules/minami -d docs/latest"
    },
    "dependencies": {
      "axios": "0.11.1",
      "es6-promise": "3.1.2",
      "form-data": "0.2.0"
    },
    "devDependencies": {
      "babel-eslint": "^6.1.2",
      "babel-preset-es2015": "^6.14.0",
      "babel-register": "^6.14.0",
      "babelify": "^7.3.0",
      "del": "2.0.2",
      "envify": "3.4.0",
      "git-branch": "0.3.0",
      "gulp": "3.9.0",
      "gulp-awspublish": "3.0.1",
      "gulp-babel": "^6.1.2",
      "gulp-browserify": "0.5.1",
      "gulp-concat": "2.6.0",
      "gulp-data": "1.2.1",
      "gulp-eslint": "2.0.0",
      "gulp-if": "2.0.0",
      "gulp-imagemin": "2.3.0",
      "gulp-insert": "0.5.0",
      "gulp-jasmine": "^2.2.1",
      "gulp-newer": "0.5.1",
      "gulp-notify": "2.2.0",
      "gulp-rename": "1.2.2",
      "gulp-replace-task": "0.11.0",
      "gulp-uglify": "1.4.1",
      "gulp-util": "3.0.6",
      "jsdoc": "^3.4.1",
      "minami": "^1.1.1",
      "require-dir": "0.3.0",
      "serve-static": "1.10.0"
    }
  }
  
  },{}],25:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  var es6Promise = require('es6-promise');
  var Promise = es6Promise.Promise;
  
  var Models = require('./Models');
  var Inputs = require('./Inputs');
  var Concepts = require('./Concepts');
  var constants = require('./constants');
  var API = constants.API;
  var TOKEN_PATH = API.TOKEN_PATH;
  
  /**
  * top-level class that allows access to models, inputs and concepts
  * @class
  */
  
  var App = function () {
    function App(clientId, clientSecret, options) {
      _classCallCheck(this, App);
  
      this._validate(clientId, clientSecret, options);
      this._init(clientId, clientSecret, options);
    }
    /**
    * Gets a token from the API using client credentials
    * @return {Promise(token, error)} A Promise that is fulfilled with the token string or rejected with an error
    */
  
  
    _createClass(App, [{
      key: 'getToken',
      value: function getToken() {
        return this._config.token();
      }
      /**
      * Sets the token to use for the API
      * @param {String}         _token    The token you are setting
      * @return {Boolean}                 true if token has valid fields, false if not
      */
  
    }, {
      key: 'setToken',
      value: function setToken(_token) {
        var token = _token;
        if (typeof _token === 'string') {
          token = {
            'access_token': _token,
            'expires_in': 176400
          };
        }
        if (token.access_token && token.expires_in) {
          this._config['_token'] = token;
          return true;
        }
        return false;
      }
    }, {
      key: '_validate',
      value: function _validate(clientId, clientSecret, options) {
        if (clientId === undefined || clientSecret === undefined) {
          throw new Error('Client ID and client secret is required');
        }
      }
    }, {
      key: '_init',
      value: function _init(clientId, clientSecret) {
        var _this = this;
  
        var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
        this._config = {
          'apiEndpoint': options.apiEndpoint || process && process.env && process.env.API_ENDPOINT || 'https://api.clarifai.com',
          'clientId': clientId,
          'clientSecret': clientSecret,
          '_token': null,
          token: function token() {
            return new Promise(function (resolve, reject) {
              var now = new Date().getTime();
              if (_this._config._token !== null && _this._config._token.expireTime > now) {
                resolve(_this._config._token);
              } else {
                _this._getToken(resolve, reject);
              }
            });
          }
        };
        this.models = new Models(this._config);
        this.inputs = new Inputs(this._config);
        this.concepts = new Concepts(this._config);
      }
    }, {
      key: '_getToken',
      value: function _getToken(resolve, reject) {
        var _this2 = this;
  
        this._requestToken().then(function (response) {
          if (response.status === 200) {
            var token = response.data;
            var now = new Date().getTime();
            token.expireTime = now + token.expires_in * 1000;
            _this2.setToken(token);
            resolve(token);
          } else {
            reject(response);
          }
        }, reject);
      }
    }, {
      key: '_requestToken',
      value: function _requestToken() {
        var url = '' + this._config['apiEndpoint'] + TOKEN_PATH;
        var clientId = this._config['clientId'];
        var clientSecret = this._config['clientSecret'];
        return axios({
          'url': url,
          'method': 'POST',
          'auth': {
            'username': clientId,
            'password': clientSecret
          }
        });
      }
    }]);
  
    return App;
  }();
  
  ;
  
  module.exports = App;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/App.js","/")
  },{"./Concepts":27,"./Inputs":29,"./Models":31,"./constants":32,"1YiZ5S":23,"axios":1,"buffer":20,"es6-promise":19}],26:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  "use strict";
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  /**
  * class representing a concept and its info
  * @class
  */
  var Concept = function () {
    function Concept(_config, data) {
      _classCallCheck(this, Concept);
  
      this.id = data.id;
      this.name = data.name;
      this.createdAt = data.created_at || data.createdAt;
      this.appId = data.app_id || data.appId;
      this.value = data.value || null;
      this._config = _config;
      this._rawData = data;
    }
    /**
    * Returns a javascript object with the raw data attributes (from API)
    * @return {object} An object that contains data about concept from api
    */
  
  
    _createClass(Concept, [{
      key: "toObject",
      value: function toObject() {
        return this._rawData;
      }
    }]);
  
    return Concept;
  }();
  
  ;
  
  module.exports = Concept;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Concept.js","/")
  },{"1YiZ5S":23,"buffer":20}],27:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  var Concept = require('./Concept');
  
  var _require = require('./constants');
  
  var API = _require.API;
  var replaceVars = _require.replaceVars;
  var CONCEPTS_PATH = API.CONCEPTS_PATH;
  var CONCEPT_PATH = API.CONCEPT_PATH;
  var CONCEPT_SEARCH_PATH = API.CONCEPT_SEARCH_PATH;
  
  var _require2 = require('./utils');
  
  var wrapToken = _require2.wrapToken;
  var formatConcept = _require2.formatConcept;
  
  var _require3 = require('./helpers');
  
  var isSuccess = _require3.isSuccess;
  var checkType = _require3.checkType;
  
  /**
  * class representing a collection of concepts
  * @class
  */
  
  var Concepts = function () {
    function Concepts(_config) {
      var _this = this;
  
      var rawData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  
      _classCallCheck(this, Concepts);
  
      this._config = _config;
      this.rawData = rawData;
      rawData.forEach(function (conceptData, index) {
        _this[index] = new Concept(_this._config, conceptData);
      });
      this.length = rawData.length;
    }
    /**
    * List all the concepts
    * @param {object}     options     Object with keys explained below: (optional)
    *    @param {number}    options.page        The page number (optional, default: 1)
    *    @param {number}    options.perPage     Number of images to return per page (optional, default: 20)
    * @return {Promise(Concepts, error)} A Promise that is fulfilled with a Concepts instance or rejected with an error
    */
  
  
    _createClass(Concepts, [{
      key: 'list',
      value: function list() {
        var _this2 = this;
  
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { page: 1, perPage: 20 };
  
        var url = '' + this._config.apiEndpoint + CONCEPTS_PATH;
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, {
              headers: headers,
              params: {
                'page': options.page,
                'per_page': options.perPage
              }
            }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Concepts(_this2._config, response.data.concepts));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * List a single concept given an id
      * @param {String}     id          The concept's id
      * @return {Promise(Concept, error)} A Promise that is fulfilled with a Concept instance or rejected with an error
      */
  
    }, {
      key: 'get',
      value: function get(id) {
        var _this3 = this;
  
        var url = '' + this._config.apiEndpoint + replaceVars(CONCEPT_PATH, [id]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Concept(_this3._config, response.data.concept));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Add a list of concepts given an id and name
      * @param {object|object[]}   concepts       Can be a single media object or an array of media objects
      *   @param  {object|string}    concepts[].concept         If string, this is assumed to be the concept id. Otherwise, an object with the following attributes
      *     @param  {object}           concepts[].concept.id      The new concept's id (Required)
      *     @param  {object}           concepts[].concept.name    The new concept's name
      * @return {Promise(Concept, error)}             A Promise that is fulfilled with a Concept instance or rejected with an error
      */
  
    }, {
      key: 'create',
      value: function create() {
        var _this4 = this;
  
        var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  
        if (checkType(/(Object|String)/, concepts)) {
          concepts = [concepts];
        }
        var data = {
          'concepts': concepts.map(formatConcept)
        };
        var url = '' + this._config.apiEndpoint + CONCEPTS_PATH;
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.post(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Concepts(_this4._config, response.data.concepts));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Search for a concept given a name. A wildcard can be given (example: The name "bo*" will match with "boat" and "bow" given those concepts exist
      * @param  {string}   name  The name of the concept to search for
      * @return {Promise(Models, error)} A Promise that is fulfilled with a Concepts instance or rejected with an error
      */
  
    }, {
      key: 'search',
      value: function search(name) {
        var _this5 = this;
  
        var url = '' + this._config.apiEndpoint + CONCEPT_SEARCH_PATH;
        return wrapToken(this._config, function (headers) {
          var params = {
            'concept_query': {
              name: name
            }
          };
          return new Promise(function (resolve, reject) {
            axios.post(url, params, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Concepts(_this5._config, response.data.concepts));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
    }, {
      key: 'toObjects',
      value: function toObjects() {
        for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
          keys[_key] = arguments[_key];
        }
  
        return Array.prototype.map.call(this, function (concept, i) {
          var val = void 0;
          if (keys.length > 0) {
            val = {};
            keys.forEach(function (k) {
              val[k] = concept[k];
            });
          } else {
            val = concept.toObject();
          }
          return val;
        });
      }
    }]);
  
    return Concepts;
  }();
  
  ;
  
  module.exports = Concepts;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Concepts.js","/")
  },{"./Concept":26,"./constants":32,"./helpers":34,"./utils":35,"1YiZ5S":23,"axios":1,"buffer":20}],28:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  var Concepts = require('./Concepts');
  
  var _require = require('./constants');
  
  var API = _require.API;
  var INPUTS_PATH = API.INPUTS_PATH;
  
  /**
  * class representing an input
  * @class
  */
  
  var Input = function () {
    function Input(_config, data) {
      _classCallCheck(this, Input);
  
      this.id = data.id;
      this.createdAt = data.created_at || data.createdAt;
      this.imageUrl = data.data.image.url;
      this.concepts = new Concepts(_config, data.data.concepts);
      this.score = data.score;
      this._config = _config;
      this._rawData = data;
    }
    /**
    * Returns a javascript object with the raw data attributes (from API)
    * @return {object} An object that contains data about input from api
    */
  
  
    _createClass(Input, [{
      key: 'toObject',
      value: function toObject() {
        return this._rawData;
      }
      /**
      * Merge concepts to an input
      * @param {object[]}         concepts    Object with keys explained below:
      *   @param {object}           concepts[].concept
      *     @param {string}           concepts[].concept.id        The concept id (required)
      *     @param {boolean}          concepts[].concept.value     Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @param {object}           metadata                      Object with key values to attach to the input (optional)
      * @return {Promise(input, error)} A Promise that is fulfilled with an instance of Input or rejected with an error
      */
  
    }, {
      key: 'mergeConcepts',
      value: function mergeConcepts(concepts, metadata) {
        return this._update('merge', concepts, metadata);
      }
      /**
      * Delete concept from an input
      * @param {object[]}         concepts    Object with keys explained below:
      *   @param {object}           concepts[].concept
      *     @param {string}           concepts[].concept.id        The concept id (required)
      *     @param {boolean}          concepts[].concept.value     Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @param {object}           metadata                      Object with key values to attach to the input (optional)
      * @return {Promise(input, error)} A Promise that is fulfilled with an instance of Input or rejected with an error
      */
  
    }, {
      key: 'deleteConcepts',
      value: function deleteConcepts(concepts, metadata) {
        return this._update('remove', concepts, metadata);
      }
      /**
      * Overwrite inputs
      * @param {object[]}         concepts                      Array of object with keys explained below:
      *   @param {object}           concepts[].concept
      *     @param {string}           concepts[].concept.id         The concept id (required)
      *     @param {boolean}          concepts[].concept.value      Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @param {object}           metadata                      Object with key values to attach to the input (optional)
      * @return {Promise(input, error)}                         A Promise that is fulfilled with an instance of Input or rejected with an error
      */
  
    }, {
      key: 'overwriteConcepts',
      value: function overwriteConcepts(concepts, metadata) {
        return this._update('overwrite', concepts, metadata);
      }
    }, {
      key: '_update',
      value: function _update(action) {
        var concepts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
        var metadata = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  
        var url = '' + this._config.apiEndpoint + INPUTS_PATH;
        var inputData = {};
        if (concepts.length) {
          inputData.concepts = concepts;
        }
        if (metadata !== null) {
          inputData.metadata = metadata;
        }
        var data = {
          action: action,
          inputs: [{
            id: this.id,
            data: inputData
          }]
        };
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            return axios.patch(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Input(response.data.input));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
    }]);
  
    return Input;
  }();
  
  ;
  
  module.exports = Input;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Input.js","/")
  },{"./Concepts":27,"./constants":32,"1YiZ5S":23,"axios":1,"buffer":20}],29:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  var Input = require('./Input');
  
  var _require = require('./constants');
  
  var API = _require.API;
  var replaceVars = _require.replaceVars;
  var INPUT_PATH = API.INPUT_PATH;
  var INPUTS_PATH = API.INPUTS_PATH;
  var INPUTS_STATUS_PATH = API.INPUTS_STATUS_PATH;
  var SEARCH_PATH = API.SEARCH_PATH;
  
  var _require2 = require('./utils');
  
  var wrapToken = _require2.wrapToken;
  var formatInput = _require2.formatInput;
  var formatImagesSearch = _require2.formatImagesSearch;
  var formatConceptsSearch = _require2.formatConceptsSearch;
  
  var _require3 = require('./helpers');
  
  var isSuccess = _require3.isSuccess;
  var checkType = _require3.checkType;
  
  var MAX_BATCH_SIZE = 128;
  
  /**
  * class representing a collection of inputs
  * @class
  */
  
  var Inputs = function () {
    function Inputs(_config) {
      var _this = this;
  
      var rawData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  
      _classCallCheck(this, Inputs);
  
      this._config = _config;
      this.rawData = rawData;
      rawData.forEach(function (inputData, index) {
        if (inputData.input && inputData.score) {
          inputData.input.score = inputData.score;
          inputData = inputData.input;
        }
        _this[index] = new Input(_this._config, inputData);
      });
      this.length = rawData.length;
    }
    /**
    * Get all inputs in app
    * @param {Object}    options  Object with keys explained below: (optional)
    *   @param {Number}    options.page  The page number (optional, default: 1)
    *   @param {Number}    options.perPage  Number of images to return per page (optional, default: 20)
    * @return {Promise(inputs, error)} A Promise that is fulfilled with an instance of Inputs or rejected with an error
    */
  
  
    _createClass(Inputs, [{
      key: 'list',
      value: function list() {
        var _this2 = this;
  
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { page: 1, perPage: 20 };
  
        var url = '' + this._config.apiEndpoint + INPUTS_PATH;
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, {
              headers: headers,
              params: {
                'page': options.page,
                'per_page': options.perPage
              }
            }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Inputs(_this2._config, response.data.inputs));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Adds an input or multiple inputs
      * @param {object|object[]}        inputs                                Can be a single media object or an array of media objects (max of 128 inputs/call; passing > 128 will throw an exception)
      *   @param {object|string}          inputs[].input                        If string, is given, this is assumed to be an image url
      *     @param {string}                 inputs[].input.(url|base64)           Can be a publicly accessibly url or base64 string representing image bytes (required)
      *     @param {string}                 inputs[].input.id                     ID of input (optional)
      *     @param {number[]}               inputs[].input.crop                   An array containing the percent to be cropped from top, left, bottom and right (optional)
      *     @param {object[]}               inputs[].input.metadata               Object with key values to attach to the input (optional)
      *     @param {object[]}               inputs[].input.concepts               An array of concepts to attach to media object (optional)
      *       @param {object|string}          inputs[].input.concepts[].concept     If string, is given, this is assumed to be concept id with value equals true
      *         @param {string}                 inputs[].input.concepts[].concept.id          The concept id (required)
      *         @param {boolean}                inputs[].input.concepts[].concept.value       Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      *       @param {string}                 inputs[].input.concepts[].<key>       <key> can be any string with any <value>
      * @return {Promise(inputs, error)} A Promise that is fulfilled with an instance of Inputs or rejected with an error
      */
  
    }, {
      key: 'create',
      value: function create(inputs) {
        var _this3 = this;
  
        if (checkType(/(String|Object)/, inputs)) {
          inputs = [inputs];
        }
        var url = '' + this._config.apiEndpoint + INPUTS_PATH;
        if (inputs.length > MAX_BATCH_SIZE) {
          throw new Error('Number of inputs exceeded maximum of ' + MAX_BATCH_SIZE);
        }
        return wrapToken(this._config, function (headers) {
          var data = {
            'inputs': inputs.map(formatInput)
          };
          return new Promise(function (resolve, reject) {
            axios.post(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Inputs(_this3._config, response.data.inputs));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Get input by id
      * @param {String}    id  The input id
      * @return {Promise(input, error)} A Promise that is fulfilled with an instance of Input or rejected with an error
      */
  
    }, {
      key: 'get',
      value: function get(id) {
        var _this4 = this;
  
        var url = '' + this._config.apiEndpoint + replaceVars(INPUT_PATH, [id]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Input(_this4._config, response.data.input));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Delete an input or a list of inputs by id or all inputs if no id is passed
      * @param {string|string[]}    id           The id of input to delete (optional)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'delete',
      value: function _delete() {
        var _this5 = this;
  
        var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  
        var val = void 0;
        // delete an input
        if (checkType(/String/, id)) {
          (function () {
            var url = '' + _this5._config.apiEndpoint + replaceVars(INPUT_PATH, [id]);
            val = wrapToken(_this5._config, function (headers) {
              return axios.delete(url, { headers: headers });
            });
          })();
        } else {
          val = this._deleteInputs(id);
        }
        return val;
      }
    }, {
      key: '_deleteInputs',
      value: function _deleteInputs() {
        var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  
        var url = '' + this._config.apiEndpoint + INPUTS_PATH;
        return wrapToken(this._config, function (headers) {
          var data = id === null ? { 'delete_all': true } : { 'ids': id };
          return axios({
            url: url,
            method: 'delete',
            headers: headers,
            data: data
          });
        });
      }
      /**
      * Merge concepts to inputs in bulk
      * @param {object[]}         inputs    List of concepts to update (max of 128 inputs/call; passing > 128 will throw an exception)
      *   @param {object}           inputs[].input
      *     @param {string}           inputs[].input.id        The id of the input to update
      *     @param {object}           inputs[].input.metadata                     Object with key values to attach to the input (optional)
      *     @param {string}           inputs[].input.concepts  Object with keys explained below:
      *       @param {object}           inputs[].input.concepts[].concept
      *         @param {string}           inputs[].input.concepts[].concept.id        The concept id (required)
      *         @param {boolean}          inputs[].input.concepts[].concept.value     Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @return {Promise(inputs, error)} A Promise that is fulfilled with an instance of Inputs or rejected with an error
      */
  
    }, {
      key: 'mergeConcepts',
      value: function mergeConcepts(inputs) {
        return this._update('merge', inputs);
      }
      /**
      * Delete concepts to inputs in bulk
      * @param {object[]}         inputs    List of concepts to update (max of 128 inputs/call; passing > 128 will throw an exception)
      *   @param {object}           inputs[].input
      *     @param {string}           inputs[].input.id                           The id of the input to update
      *     @param {object}           inputs[].input.metadata                     Object with key values to attach to the input (optional)
      *     @param {string}           inputs[].input.concepts                     Object with keys explained below:
      *       @param {object}           inputs[].input.concepts[].concept
      *         @param {string}           inputs[].input.concepts[].concept.id        The concept id (required)
      *         @param {boolean}          inputs[].input.concepts[].concept.value     Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @return {Promise(inputs, error)} A Promise that is fulfilled with an instance of Inputs or rejected with an error
      */
  
    }, {
      key: 'deleteConcepts',
      value: function deleteConcepts(inputs) {
        return this._update('remove', inputs);
      }
      /**
      * Overwrite inputs in bulk
      * @param {object[]}         inputs    List of concepts to update (max of 128 inputs/call; passing > 128 will throw an exception)
      *   @param {object}           inputs[].input
      *     @param {string}           inputs[].input.id                           The id of the input to update
      *     @param {object}           inputs[].input.metadata                     Object with key values to attach to the input (optional)
      *     @param {string}           inputs[].input.concepts                     Object with keys explained below:
      *       @param {object}           inputs[].input.concepts[].concept
      *         @param {string}           inputs[].input.concepts[].concept.id        The concept id (required)
      *         @param {boolean}          inputs[].input.concepts[].concept.value     Whether or not the input is a positive (true) or negative (false) example of the concept (default: true)
      * @return {Promise(inputs, error)} A Promise that is fulfilled with an instance of Inputs or rejected with an error
      */
  
    }, {
      key: 'overwriteConcepts',
      value: function overwriteConcepts(inputs) {
        return this._update('overwrite', inputs);
      }
    }, {
      key: '_update',
      value: function _update(action, inputs) {
        var _this6 = this;
  
        var url = '' + this._config.apiEndpoint + INPUTS_PATH;
        if (checkType(/Object/, inputs)) {
          inputs = [inputs];
        }
        if (inputs.length > MAX_BATCH_SIZE) {
          throw new Error('Number of inputs exceeded maximum of ' + MAX_BATCH_SIZE);
        }
        var data = {
          action: action,
          'inputs': inputs.map(function (input) {
            return formatInput(input, false);
          })
        };
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.patch(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Inputs(_this6._config, response.data.inputs));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Search for inputs or outputs based on concepts or images
      *   @param {object[]}               queries          List of all predictions to match with
      *     @param {object}                 queries[].concept            An object with the following keys:
      *       @param {string}                 queries[].concept.type        Search over 'input' or 'output' (default: 'output')
      *       @param {string}                 queries[].concept.name        The concept name
      *       @param {boolean}                queries[].concept.value       Indicates whether or not the term should match with the prediction returned (default: true)
      *     @param {object}                 queries[].image              An image object that contains the following keys:
      *       @param {string}                 queries[].image.type          Search over 'input' or 'output' (default: 'output')
      *       @param {string}                 queries[].image.(base64|url)  Can be a publicly accessibly url or base64 string representing image bytes (required)
      *       @param {number[]}               queries[].image.crop          An array containing the percent to be cropped from top, left, bottom and right (optional)
      *       @param {object}                 queries[].image.metadata      An object with <key> and <value> specified by user to refine search with (optional)
      * @param {Object}                   options       Object with keys explained below: (optional)
      *    @param {Number}                  options.page          The page number (optional, default: 1)
      *    @param {Number}                  options.perPage       Number of images to return per page (optional, default: 20)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'search',
      value: function search() {
        var _this7 = this;
  
        var ands = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { page: 1, perPage: 20 };
  
        var formattedAnds = [];
        var url = '' + this._config.apiEndpoint + SEARCH_PATH;
        var data = {
          'query': {
            'ands': []
          },
          'pagination': {
            'page': options.page,
            'per_page': options.perPage
          }
        };
  
        if (!Array.isArray(ands)) {
          ands = [ands];
        }
        if (ands.length > 0) {
          ands.forEach(function (andQuery) {
            var el = andQuery.name ? formatConceptsSearch(andQuery) : formatImagesSearch(andQuery);
            formattedAnds = formattedAnds.concat(el);
          });
          data['query']['ands'] = formattedAnds;
        }
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.post(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Inputs(_this7._config, response.data.hits));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Get inputs status (number of uploaded, in process or failed inputs)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'getStatus',
      value: function getStatus() {
        var url = '' + this._config.apiEndpoint + INPUTS_STATUS_PATH;
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(response.data);
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
    }]);
  
    return Inputs;
  }();
  
  ;
  
  module.exports = Inputs;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Inputs.js","/")
  },{"./Input":28,"./constants":32,"./helpers":34,"./utils":35,"1YiZ5S":23,"axios":1,"buffer":20}],30:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  
  var _require = require('./helpers');
  
  var isSuccess = _require.isSuccess;
  var checkType = _require.checkType;
  
  var _require2 = require('./constants');
  
  var API = _require2.API;
  var SYNC_TIMEOUT = _require2.SYNC_TIMEOUT;
  var replaceVars = _require2.replaceVars;
  
  var _require3 = require('./utils');
  
  var wrapToken = _require3.wrapToken;
  var formatImagePredict = _require3.formatImagePredict;
  var MODEL_VERSIONS_PATH = API.MODEL_VERSIONS_PATH;
  var MODEL_VERSION_PATH = API.MODEL_VERSION_PATH;
  var MODELS_PATH = API.MODELS_PATH;
  var PREDICT_PATH = API.PREDICT_PATH;
  var VERSION_PREDICT_PATH = API.VERSION_PREDICT_PATH;
  var MODEL_INPUTS_PATH = API.MODEL_INPUTS_PATH;
  var MODEL_OUTPUT_PATH = API.MODEL_OUTPUT_PATH;
  var MODEL_VERSION_INPUTS_PATH = API.MODEL_VERSION_INPUTS_PATH;
  
  var MODEL_QUEUED_FOR_TRAINING = '21103';
  var MODEL_TRAINING = '21101';
  var POLLTIME = 2000;
  
  /**
  * class representing a model
  * @class
  */
  
  var Model = function () {
    function Model(_config, data) {
      _classCallCheck(this, Model);
  
      this._config = _config;
      this.data = data;
      this.name = data.name;
      this.id = data.id;
      this.createdAt = data.created_at || data.createdAt;
      this.appId = data.app_id || data.appId;
      this.outputInfo = data.output_info || data.outputInfo;
      if (checkType(/(String)/, data.version)) {
        this.modelVersion = {};
        this.versionId = data.version;
      } else {
        this.modelVersion = data.model_version || data.modelVersion || data.version;
        this.versionId = (this.modelVersion || {}).id;
      }
      this._rawData = data;
    }
    /**
    * Returns a javascript object with the raw data attributes (from API)
    * @return {object} An object that contains data about model from api
    */
  
  
    _createClass(Model, [{
      key: 'toObject',
      value: function toObject() {
        return this._rawData;
      }
      /**
      * Merge concepts to a model
      * @param {object[]}      concepts    List of concept objects with id
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'mergeConcepts',
      value: function mergeConcepts() {
        var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  
        return this._update({ action: 'merge', concepts: concepts });
      }
      /**
      * Remove concepts from a model
      * @param {object[]}      concepts    List of concept objects with id
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'deleteConcepts',
      value: function deleteConcepts() {
        var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  
        return this._update({ action: 'remove', concepts: concepts });
      }
      /**
      * Overwrite concepts in a model
      * @param {object[]}      concepts    List of concept objects with id
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'overwriteConcepts',
      value: function overwriteConcepts() {
        var concepts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  
        return this._update({ action: 'overwrite', concepts: concepts });
      }
      /**
      * Update a model's output config or concepts
      * @param {object}               model                                 An object with any of the following attrs:
      *   @param {string}               name                                  The new name of the model to update with
      *   @param {boolean}              conceptsMutuallyExclusive             Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
      *   @param {boolean}              closedEnvironment                     Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
      *   @param {object[]}             concepts                              An array of concept objects or string
      *     @param {object|string}        concepts[].concept                    If string is given, this is interpreted as concept id. Otherwise, if object is given, client expects the following attributes
      *       @param {string}             concepts[].concept.id                   The id of the concept to attach to the model
      *   @param {object[]}             action                                The action to perform on the given concepts. Possible values are 'merge', 'remove', or 'overwrite'. Default: 'merge'
      */
  
    }, {
      key: 'update',
      value: function update(obj) {
        var _this = this;
  
        var url = '' + this._config.apiEndpoint + MODELS_PATH;
        var modelData = [obj];
        var data = { models: modelData.map(formatModel) };
        if (data.concepts) {
          data['action'] = obj.action || 'merge';
        }
  
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.patch(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Model(_this._config, response.data.models[0]));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Create a new model version
      * @param {boolean}       sync     If true, this returns after model has completely trained. If false, this immediately returns default api response.
      * @return {Promise(model, error)} A Promise that is fulfilled with a Model instance or rejected with an error
      */
  
    }, {
      key: 'train',
      value: function train(sync) {
        var _this2 = this;
  
        var url = '' + this._config.apiEndpoint + replaceVars(MODEL_VERSIONS_PATH, [this.id]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.post(url, null, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                if (sync) {
                  var timeStart = Date.now();
                  _this2._pollTrain.bind(_this2)(timeStart, resolve, reject);
                } else {
                  resolve(new Model(_this2._config, response.data.model));
                }
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
    }, {
      key: '_pollTrain',
      value: function _pollTrain(timeStart, resolve, reject) {
        var _this3 = this;
  
        clearTimeout(this.pollTimeout);
        if (Date.now() - timeStart >= SYNC_TIMEOUT) {
          return reject({
            status: 'Error',
            message: 'Sync call timed out'
          });
        }
        this.getOutputInfo().then(function (model) {
          var modelStatusCode = model.modelVersion.status.code.toString();
          if (modelStatusCode === MODEL_QUEUED_FOR_TRAINING || modelStatusCode === MODEL_TRAINING) {
            _this3.pollTimeout = setTimeout(function () {
              return _this3._pollTrain(timeStart, resolve, reject);
            }, POLLTIME);
          } else {
            resolve(model);
          }
        }, reject).catch(reject);
      }
      /**
      * Returns model ouputs according to inputs
      * @param {object[]|object|string}       inputs    An array of objects/object/string pointing to an image resource. A string can either be a url or base64 image bytes. Object keys explained below:
      *    @param {object}                      inputs[].image     Object with keys explained below:
      *       @param {string}                     inputs[].image.(url|base64)  Can be a publicly accessibly url or base64 string representing image bytes (required)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'predict',
      value: function predict(inputs) {
        if (checkType(/(Object|String)/, inputs)) {
          inputs = [inputs];
        }
        var url = '' + this._config.apiEndpoint + (this.versionId ? replaceVars(VERSION_PREDICT_PATH, [this.id, this.versionId]) : replaceVars(PREDICT_PATH, [this.id]));
        return wrapToken(this._config, function (headers) {
          var params = {
            'inputs': inputs.map(formatImagePredict)
          };
          return axios.post(url, params, { headers: headers });
        });
      }
      /**
      * Returns a version of the model specified by its id
      * @param {string}     versionId   The model's id
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'getVersion',
      value: function getVersion(versionId) {
        var url = '' + this._config.apiEndpoint + replaceVars(MODEL_VERSION_PATH, [this.id, versionId]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              resolve(response.data);
            }, reject);
          });
        });
      }
      /**
      * Returns a list of versions of the model
      * @param {object}     options     Object with keys explained below: (optional)
      *   @param {number}     options.page        The page number (optional, default: 1)
      *   @param {number}     options.perPage     Number of images to return per page (optional, default: 20)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'getVersions',
      value: function getVersions() {
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { page: 1, perPage: 20 };
  
        var url = '' + this._config.apiEndpoint + replaceVars(MODEL_VERSIONS_PATH, [this.id]);
        return wrapToken(this._config, function (headers) {
          var data = {
            headers: headers,
            params: { 'per_page': options.perPage, 'page': options.page }
          };
          return axios.get(url, data);
        });
      }
      /**
      * Returns all the model's output info
      * @return {Promise(Model, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'getOutputInfo',
      value: function getOutputInfo() {
        var _this4 = this;
  
        var url = '' + this._config.apiEndpoint + replaceVars(MODEL_OUTPUT_PATH, [this.id]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              resolve(new Model(_this4._config, response.data.model));
            }, reject);
          });
        });
      }
      /**
      * Returns all the model's inputs
      * @param {object}     options     Object with keys explained below: (optional)
      *   @param {number}     options.page        The page number (optional, default: 1)
      *   @param {number}     options.perPage     Number of images to return per page (optional, default: 20)
      * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
      */
  
    }, {
      key: 'getInputs',
      value: function getInputs() {
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { page: 1, perPage: 20 };
  
        var url = '' + this._config.apiEndpoint + (this.versionId ? replaceVars(MODEL_VERSION_INPUTS_PATH, [this.id, this.versionId]) : replaceVars(MODEL_INPUTS_PATH, [this.id]));
        return wrapToken(this._config, function (headers) {
          return axios.get(url, {
            params: { 'per_page': options.perPage, 'page': options.page },
            headers: headers
          });
        });
      }
    }]);
  
    return Model;
  }();
  
  ;
  
  module.exports = Model;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Model.js","/")
  },{"./constants":32,"./helpers":34,"./utils":35,"1YiZ5S":23,"axios":1,"buffer":20}],31:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _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; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  var axios = require('axios');
  
  var _require = require('es6-promise');
  
  var Promise = _require.Promise;
  
  var Model = require('./Model');
  var Concepts = require('./Concepts');
  
  var _require2 = require('./constants');
  
  var API = _require2.API;
  var replaceVars = _require2.replaceVars;
  
  var _require3 = require('./helpers');
  
  var isSuccess = _require3.isSuccess;
  var checkType = _require3.checkType;
  
  var _require4 = require('./utils');
  
  var wrapToken = _require4.wrapToken;
  var formatModel = _require4.formatModel;
  var MODELS_PATH = API.MODELS_PATH;
  var MODEL_PATH = API.MODEL_PATH;
  var MODEL_SEARCH_PATH = API.MODEL_SEARCH_PATH;
  var MODEL_VERSION_PATH = API.MODEL_VERSION_PATH;
  
  /**
  * class representing a collection of models
  * @class
  */
  
  var Models = function () {
    function Models(_config) {
      var _this = this;
  
      var rawData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  
      _classCallCheck(this, Models);
  
      this._config = _config;
      this.rawData = rawData;
      rawData.forEach(function (modelData, index) {
        _this[index] = new Model(_this._config, modelData);
      });
      this.length = rawData.length;
    }
    /**
    * Returns a Model instance given model id or name without calling the backend
    * @param {string|object}    model       If string, it is assumed to be model id. Otherwise, if object is given, it can have any of the following keys:
    *   @param {string}           model.id          Model id
    *   @param {string}           model.name        Model name
    *   @param {string}           model.version     Model version
    *   @param {string}           model.type        This can be "concept", "color", "embed", "facedetect", "cluster" or "blur"
    * @return {Model}       An instance of Model with the given id/name
    */
  
  
    _createClass(Models, [{
      key: 'initModel',
      value: function initModel(model) {
        var _this2 = this;
  
        var data = {};
        var fn = void 0;
        if (checkType(/String/, model)) {
          data.id = model;
        } else {
          data = model;
        }
        if (data.id) {
          fn = function fn(resolve, reject) {
            resolve(new Model(_this2._config, data));
          };
        } else {
          fn = function fn(resolve, reject) {
            _this2.search(data.name, data.type).then(function (models) {
              if (data.version) {
                resolve(models.filter(function (model) {
                  return model.modelVersion.id === data.version;
                }));
              } else {
                resolve(models[0]);
              }
            }, reject).catch(reject);
          };
        }
        return new Promise(fn);
      }
      /**
       * Calls predict given model info and inputs to predict on
       * @param {string|object}            model       If string, it is assumed to be model id. Otherwise, if object is given, it can have any of the following keys:
       *   @param {string}                   model.id          Model id
       *   @param {string}                   model.name        Model name
       *   @param {string}                   model.version     Model version
       *   @param {string}                   model.type        This can be "concept", "color", "embed", "facedetect", "cluster" or "blur"
       * @param {object[]|object|string}   inputs    An array of objects/object/string pointing to an image resource. A string can either be a url or base64 image bytes. Object keys explained below:
       *    @param {object}                  inputs[].image     Object with keys explained below:
       *       @param {string}                 inputs[].image.(url|base64)  Can be a publicly accessibly url or base64 string representing image bytes (required)
       * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
       */
  
    }, {
      key: 'predict',
      value: function predict(model, inputs) {
        var _this3 = this;
  
        return new Promise(function (resolve, reject) {
          _this3.initModel(model).then(function (model) {
            model.predict(inputs).then(resolve, reject).catch(reject);
          }, reject);
        });
      }
      /**
       * Calls train on a model and creates a new model version given model info
       * @param {string|object}            model       If string, it is assumed to be model id. Otherwise, if object is given, it can have any of the following keys:
       *   @param {string}                   model.id          Model id
       *   @param {string}                   model.name        Model name
       *   @param {string}                   model.version     Model version
       *   @param {string}                   model.type        This can be "concept", "color", "embed", "facedetect", "cluster" or "blur"
       * @param {boolean}                  sync        If true, this returns after model has completely trained. If false, this immediately returns default api response.
       * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
       */
  
    }, {
      key: 'train',
      value: function train(model) {
        var _this4 = this;
  
        var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
        return new Promise(function (resolve, reject) {
          _this4.initModel(model).then(function (model) {
            model.train(sync).then(resolve, reject).catch(reject);
          }, reject);
        });
      }
      /**
       * Returns all the models
       * @param {Object}     options     Object with keys explained below: (optional)
       *   @param {Number}     options.page        The page number (optional, default: 1)
       *   @param {Number}     options.perPage     Number of images to return per page (optional, default: 20)
       * @return {Promise(models, error)} A Promise that is fulfilled with an instance of Models or rejected with an error
       */
  
    }, {
      key: 'list',
      value: function list() {
        var _this5 = this;
  
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { page: 1, perPage: 20 };
  
        var url = '' + this._config.apiEndpoint + MODELS_PATH;
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, {
              params: { 'per_page': options.perPage, 'page': options.page },
              headers: headers
            }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Models(_this5._config, response.data.models));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
       * Create a model
       * @param {string|object}                  model                                  If string, it is assumed to be the model id. Otherwise, if object is given, it can have any of the following keys:
       *   @param {string}                         model.id                               Model id
       *   @param {string}                         model.name                             Model name
       * @param {object[]|string[]|Concepts[]}   conceptsData                           List of objects with ids, concept id strings or an instance of Concepts object
       * @param {Object}                         options                                Object with keys explained below:
       *   @param {boolean}                        options.conceptsMutuallyExclusive      Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
       *   @param {boolean}                        options.closedEnvironment              Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
       * @return {Promise(model, error)} A Promise that is fulfilled with an instance of Model or rejected with an error
       */
  
    }, {
      key: 'create',
      value: function create(model) {
        var _this6 = this;
  
        var conceptsData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
        var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
        var concepts = conceptsData instanceof Concepts ? conceptsData.toObject('id') : conceptsData.map(function (concept) {
          var val = concept;
          if (checkType(/String/, concept)) {
            val = { 'id': concept };
          }
          return val;
        });
        var modelObj = model;
        if (checkType(/String/, model)) {
          modelObj = { id: model, name: model };
        }
        if (modelObj.id === undefined) {
          throw new Error('Model ID is required');
        }
        var url = '' + this._config.apiEndpoint + MODELS_PATH;
        var data = { model: modelObj };
        data['model']['output_info'] = {
          'data': {
            concepts: concepts
          },
          'output_config': {
            'concepts_mutually_exclusive': !!options.conceptsMutuallyExclusive,
            'closed_environment': !!options.closedEnvironment
          }
        };
  
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.post(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Model(_this6._config, response.data.model));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
       * Returns a model specified by ID
       * @param {String}     id          The model's id
       * @return {Promise(model, error)} A Promise that is fulfilled with an instance of Model or rejected with an error
       */
  
    }, {
      key: 'get',
      value: function get(id) {
        var _this7 = this;
  
        var url = '' + this._config.apiEndpoint + replaceVars(MODEL_PATH, [id]);
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.get(url, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Model(_this7._config, response.data.model));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Update a model's or a list of models' output config or concepts
      * @param {object|object[]}      model                                 Can be a single model object or list of model objects with the following attrs:
      *   @param {string}               id                                    The id of the model to apply changes to (Required)
      *   @param {string}               name                                  The new name of the model to update with
      *   @param {boolean}              conceptsMutuallyExclusive             Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
      *   @param {boolean}              closedEnvironment                     Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
      *   @param {object[]}             concepts                              An array of concept objects or string
      *     @param {object|string}        concepts[].concept                    If string is given, this is interpreted as concept id. Otherwise, if object is given, client expects the following attributes
      *       @param {string}             concepts[].concept.id                   The id of the concept to attach to the model
      *   @param {object[]}             action                                The action to perform on the given concepts. Possible values are 'merge', 'remove', or 'overwrite'. Default: 'merge'
      */
  
    }, {
      key: 'update',
      value: function update(obj) {
        var _this8 = this;
  
        var url = '' + this._config.apiEndpoint + MODELS_PATH;
        var models = obj;
        if (checkType(/Object/, obj)) {
          models = [obj];
        }
        var data = { models: models.map(formatModel) };
        if (obj.concepts) {
          data['action'] = obj.action || 'merge';
        }
  
        return wrapToken(this._config, function (headers) {
          return new Promise(function (resolve, reject) {
            axios.patch(url, data, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Models(_this8._config, response.data.models));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
      /**
      * Update model by merging concepts
      * @param {object|object[]}      model                                 Can be a single model object or list of model objects with the following attrs:
      *   @param {string}               id                                    The id of the model to apply changes to (Required)
      *   @param {string}               name                                  The new name of the model to update with
      *   @param {boolean}              conceptsMutuallyExclusive             Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
      *   @param {boolean}              closedEnvironment                     Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
      *   @param {object[]}             concepts                              An array of concept objects or string
      *     @param {object|string}        concepts[].concept                    If string is given, this is interpreted as concept id. Otherwise, if object is given, client expects the following attributes
      *       @param {string}             concepts[].concept.id                   The id of the concept to attach to the model
      */
  
    }, {
      key: 'mergeConcepts',
      value: function mergeConcepts() {
        var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
        data.action = 'merge';
        return this.update(data);
      }
      /**
      * Update model by removing concepts
      * @param {object|object[]}      model                                 Can be a single model object or list of model objects with the following attrs:
      *   @param {string}               id                                    The id of the model to apply changes to (Required)
      *   @param {string}               name                                  The new name of the model to update with
      *   @param {boolean}              conceptsMutuallyExclusive             Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
      *   @param {boolean}              closedEnvironment                     Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
      *   @param {object[]}             concepts                              An array of concept objects or string
      *     @param {object|string}        concepts[].concept                    If string is given, this is interpreted as concept id. Otherwise, if object is given, client expects the following attributes
      *       @param {string}             concepts[].concept.id                   The id of the concept to attach to the model
      */
  
    }, {
      key: 'deleteConcepts',
      value: function deleteConcepts() {
        var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
        data.action = 'remove';
        return this.update(data);
      }
      /**
      * Update model by overwriting concepts
      * @param {object|object[]}      model                                 Can be a single model object or list of model objects with the following attrs:
      *   @param {string}               id                                    The id of the model to apply changes to (Required)
      *   @param {string}               name                                  The new name of the model to update with
      *   @param {boolean}              conceptsMutuallyExclusive             Do you expect to see more than one of the concepts in this model in the SAME image? Set to false (default) if so. Otherwise, set to true.
      *   @param {boolean}              closedEnvironment                     Do you expect to run the trained model on images that do not contain ANY of the concepts in the model? Set to false (default) if so. Otherwise, set to true.
      *   @param {object[]}             concepts                              An array of concept objects or string
      *     @param {object|string}        concepts[].concept                    If string is given, this is interpreted as concept id. Otherwise, if object is given, client expects the following attributes
      *       @param {string}             concepts[].concept.id                   The id of the concept to attach to the model
      */
  
    }, {
      key: 'overwriteConcepts',
      value: function overwriteConcepts() {
        var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
        data.action = 'overwrite';
        return this.update(data);
      }
      /**
       * Deletes all models or a model (if given id) or a model version (if given id and verion id)
       * @param {String}     id          The model's id
       * @param {String}     versionId   The model's version id
       * @return {Promise(response, error)} A Promise that is fulfilled with the API response or rejected with an error
       */
  
    }, {
      key: 'delete',
      value: function _delete(id, versionId) {
        var url = void 0;
        if (id) {
          url = '' + this._config.apiEndpoint + replaceVars(MODEL_PATH, [id]);
        } else if (versionId) {
          url = '' + this._config.apiEndpoint + replaceVars(MODEL_VERSION_PATH, [id, versionId]);
        } else {
          url = '' + this._config.apiEndpoint + MODELS_PATH;
        }
        return wrapToken(this._config, function (headers) {
          return axios.delete(url, { headers: headers });
        });
      }
      /**
       * Search for models by name or type
      * @param {String}     name        The model name
      * @param {String}     type        This can be "concept", "color", "embed", "facedetect", "cluster" or "blur"
      * @return {Promise(models, error)} A Promise that is fulfilled with an instance of Models or rejected with an error
      */
  
    }, {
      key: 'search',
      value: function search(name) {
        var _this9 = this;
  
        var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  
        var url = '' + this._config.apiEndpoint + MODEL_SEARCH_PATH;
        return wrapToken(this._config, function (headers) {
          var params = {
            'model_query': {
              name: name,
              type: type
            }
          };
          return new Promise(function (resolve, reject) {
            axios.post(url, params, { headers: headers }).then(function (response) {
              if (isSuccess(response)) {
                resolve(new Models(_this9._config, response.data.models));
              } else {
                reject(response);
              }
            }, reject);
          });
        });
      }
    }]);
  
    return Models;
  }();
  
  ;
  
  module.exports = Models;
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/Models.js","/")
  },{"./Concepts":27,"./Model":30,"./constants":32,"./helpers":34,"./utils":35,"1YiZ5S":23,"axios":1,"buffer":20,"es6-promise":19}],32:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  module.exports = {
    API: {
      TOKEN_PATH: '/v2/token',
      MODELS_PATH: '/v2/models',
      MODEL_PATH: '/v2/models/$0',
      MODEL_VERSIONS_PATH: '/v2/models/$0/versions',
      MODEL_VERSION_PATH: '/v2/models/$0/versions/$1',
      MODEL_PATCH_PATH: '/v2/models/$0/output_info/data/concepts',
      MODEL_OUTPUT_PATH: '/v2/models/$0/output_info',
      MODEL_SEARCH_PATH: '/v2/models/searches',
      PREDICT_PATH: '/v2/models/$0/outputs',
      VERSION_PREDICT_PATH: '/v2/models/$0/versions/$1/outputs',
      CONCEPTS_PATH: '/v2/concepts',
      CONCEPT_PATH: '/v2/concepts/$0',
      CONCEPT_SEARCH_PATH: '/v2/concepts/searches',
      MODEL_INPUTS_PATH: '/v2/models/$0/inputs',
      MODEL_VERSION_INPUTS_PATH: '/v2/models/$0/versions/$1/inputs',
      INPUTS_PATH: '/v2/inputs',
      INPUT_PATH: '/v2/inputs/$0',
      INPUTS_STATUS_PATH: '/v2/inputs/status',
      SEARCH_PATH: '/v2/searches'
    },
    // var replacement must be given in order
    replaceVars: function replaceVars(path) {
      var vars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  
      var newPath = path;
      vars.forEach(function (val, index) {
        newPath = newPath.replace(new RegExp('\\$' + index, 'g'), val);
      });
      return newPath;
    },
    URL_REGEX: /^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i,
    SYNC_TIMEOUT: 60000
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/constants.js","/")
  },{"1YiZ5S":23,"buffer":20}],33:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var App = require('./App');
  
  module.exports = global.Clarifai = {
    App: App,
    GENERAL_MODEL: 'aaa03c23b3724a16a56b629203edc62c',
    FOOD_MODEL: 'bd367be194cf45149e75f01d59f77ba7',
    TRAVEL_MODEL: 'eee28c313d69466f836ab83287a54ed9',
    NSFW_MODEL: 'e9576d86d2004ed1a38ba0cf39ecb4b1',
    WEDDINGS_MODEL: 'c386b7a870114f4a87477c0824499348',
    COLOR_MODEL: 'eeed0b6733a644cea07cf4c60f87ebb7',
    CLUSTER_MODEL: 'cccbe437d6e54e2bb911c6aa292fb072',
    FACE_DETECT_MODEL: 'a403429f2ddf4b49b307e318f00e528b',
    BLUR: 'ddd9d34872ab32be9f0e3b2b98a87be2'
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_dae6be34.js","/")
  },{"./App":25,"1YiZ5S":23,"buffer":20}],34:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var SUCCESS_CODES = [200, 201];
  
  module.exports = {
    isSuccess: function isSuccess(response) {
      return SUCCESS_CODES.indexOf(response.status) > -1;
    },
    deleteEmpty: function deleteEmpty(obj) {
      var strict = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
      Object.keys(obj).forEach(function (key) {
        if (obj[key] === null || obj[key] === undefined || strict === true && (obj[key] === '' || obj[key].length === 0 || Object.keys(obj[key]).length === 0)) {
          delete obj[key];
        }
      });
    },
    checkType: function checkType(regex, val) {
      if (regex instanceof RegExp === false) {
        regex = new RegExp(regex);
      }
      return regex.test(Object.prototype.toString.call(val));
    }
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/helpers.js","/")
  },{"1YiZ5S":23,"buffer":20}],35:[function(require,module,exports){
  (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,__filename,__dirname){
  'use strict';
  
  var _require = require('es6-promise');
  
  var Promise = _require.Promise;
  
  var _require2 = require('./constants');
  
  var URL_REGEX = _require2.URL_REGEX;
  
  var _require3 = require('./helpers');
  
  var checkType = _require3.checkType;
  
  var _require4 = require('./../package.json');
  
  var VERSION = _require4.version;
  
  
  module.exports = {
    wrapToken: function wrapToken(_config, requestFn) {
      return new Promise(function (resolve, reject) {
        _config.token().then(function (token) {
          var headers = {
            'Authorization': 'Bearer ' + token['access_token'],
            'X-Clarifai-Client': 'js:' + VERSION
          };
          requestFn(headers).then(resolve, reject);
        }, reject);
      });
    },
    formatModel: function formatModel() {
      var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      var formatted = {};
      if (data.id === null || data.id === undefined) {
        throw new Error('Model id is required');
      }
      formatted.id = data.id;
      if (data.name) {
        formatted.name = data.name;
      }
      formatted['output_info'] = {};
      if (data.conceptsMutuallyExclusive !== undefined) {
        formatted['output_info']['output_config'] = formatted['output_info']['output_config'] || {};
        formatted['output_info']['output_config']['concepts_mutually_exclusive'] = !!data.conceptsMutuallyExclusive;
      }
      if (data.closedEnvironment !== undefined) {
        formatted['output_info']['output_config'] = formatted['output_info']['output_config'] || {};
        formatted['output_info']['output_config']['closed_environment'] = !!data.closedEnvironment;
      }
      if (data.concepts) {
        formatted['output_info']['data'] = {
          'concepts': data.concepts.map(module.exports.formatConcept)
        };
      }
      return formatted;
    },
    formatInput: function formatInput(data, includeImage) {
      var input = checkType(/String/, data) ? { 'url': data } : data;
      var formatted = {
        'id': input['id'] || null,
        'data': {}
      };
      if (input['concepts']) {
        formatted['data']['concepts'] = input['concepts'];
      }
      if (input['metadata']) {
        formatted['data']['metadata'] = input['metadata'];
      }
      if (includeImage !== false) {
        formatted.data['image'] = {
          'url': input['url'],
          'base64': input['base64'],
          'crop': input['crop']
        };
        if (data.allowDuplicateUrl) {
          formatted.data.image['allow_duplicate_url'] = true;
        }
      }
      return formatted;
    },
    formatImagePredict: function formatImagePredict(data) {
      var image = data;
      if (checkType(/String/, data)) {
        if (URL_REGEX.test(image) === true) {
          image = {
            'url': data
          };
        } else {
          image = {
            'base64': data
          };
        }
      }
      return {
        'data': {
          image: image
        }
      };
    },
    formatImagesSearch: function formatImagesSearch(image) {
      var imageQuery = void 0;
      var formatted = [];
      if (typeof image === 'string') {
        imageQuery = {
          'url': image
        };
      } else {
        imageQuery = {
          'url': image['url'] || null,
          'base64': image['base64'] || null,
          'crop': image['crop'] || null
        };
      }
  
      if (imageQuery.url || imageQuery.baseQuery) {
        var input = {
          'input': {
            'data': {
              'image': imageQuery
            }
          }
        };
        if (image.type !== 'input') {
          input = { 'output': input };
        }
        formatted.push(input);
      }
  
      if (image.metadata !== undefined) {
        formatted.push({
          'input': {
            'data': {
              'metadata': image.metadata
            }
          }
        });
      }
  
      return formatted;
    },
    formatConcept: function formatConcept(concept) {
      var formatted = concept;
      if (checkType(/String/, concept)) {
        formatted = {
          id: concept
        };
      }
      return formatted;
    },
    formatConceptsSearch: function formatConceptsSearch(query) {
      if (checkType(/String/, query)) {
        query = { name: query };
      }
      var v = {};
      var type = query.type === 'input' ? 'input' : 'output';
      v[type] = {
        'data': {
          'concepts': [{
            'name': query.name,
            'value': query.value === undefined ? true : !!query.value
          }]
        }
      };
      return v;
    }
  };
  
  }).call(this,require("1YiZ5S"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/utils.js","/")
  },{"./../package.json":24,"./constants":32,"./helpers":34,"1YiZ5S":23,"buffer":20,"es6-promise":19}]},{},[33])